]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_minstanex.qc
Fix shotgun reloading
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_minstanex.qc
index 46f84d258cf2226220567b5a1a3572732c354035..47ed37d200d9a844ba2af50eac44926186459338 100644 (file)
@@ -2,7 +2,7 @@
 REGISTER_WEAPON(
 /* WEP_##id */ MINSTANEX,
 /* function */ w_minstanex,
-/* ammotype */ IT_CELLS,
+/* ammotype */ ammo_cells,
 /* impulse  */ 7,
 /* flags    */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
 /* rating   */ BOT_PICKUP_RATING_HIGH,
@@ -13,21 +13,21 @@ REGISTER_WEAPON(
 
 #define MINSTANEX_SETTINGS(w_cvar,w_prop) MINSTANEX_SETTINGS_LIST(w_cvar, w_prop, MINSTANEX, minstanex)
 #define MINSTANEX_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, MO_PRI, ammo) \
-       w_cvar(id, sn, MO_PRI, animtime) \
-       w_cvar(id, sn, MO_PRI, refire) \
-       w_cvar(id, sn, MO_SEC, ammo) \
-       w_cvar(id, sn, MO_SEC, animtime) \
-       w_cvar(id, sn, MO_SEC, damage) \
-       w_cvar(id, sn, MO_SEC, delay) \
-       w_cvar(id, sn, MO_SEC, edgedamage) \
-       w_cvar(id, sn, MO_SEC, force) \
-       w_cvar(id, sn, MO_SEC, lifetime) \
-       w_cvar(id, sn, MO_SEC, radius) \
-       w_cvar(id, sn, MO_SEC, refire) \
-       w_cvar(id, sn, MO_SEC, shotangle) \
-       w_cvar(id, sn, MO_SEC, speed) \
-       w_cvar(id, sn, MO_SEC, spread) \
+       w_cvar(id, sn, PRI, ammo) \
+       w_cvar(id, sn, PRI, animtime) \
+       w_cvar(id, sn, PRI, refire) \
+       w_cvar(id, sn, SEC, ammo) \
+       w_cvar(id, sn, SEC, animtime) \
+       w_cvar(id, sn, SEC, damage) \
+       w_cvar(id, sn, SEC, delay) \
+       w_cvar(id, sn, SEC, edgedamage) \
+       w_cvar(id, sn, SEC, force) \
+       w_cvar(id, sn, SEC, lifetime) \
+       w_cvar(id, sn, SEC, radius) \
+       w_cvar(id, sn, SEC, refire) \
+       w_cvar(id, sn, SEC, shotangle) \
+       w_cvar(id, sn, SEC, speed) \
+       w_cvar(id, sn, SEC, spread) \
        w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
        w_prop(id, sn, float,  reloading_time, reload_time) \
        w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
@@ -105,7 +105,7 @@ void W_MinstaNex_Attack (void)
                        break;
        }
        
-       W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo));
+       W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)));
 }
 
 float w_minstanex(float req)
@@ -120,7 +120,7 @@ float w_minstanex(float req)
        {
                case WR_AIM:
                {
-                       if(self.ammo_cells > 0)
+                       if(self.AMMO_VAL(WEP_MINSTANEX) > 0)
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(minstanex, speed), 0, WEP_CVAR_SEC(minstanex, lifetime), FALSE); // WEAPONTODO: replace with proper minstanex cvars
@@ -152,7 +152,7 @@ float w_minstanex(float req)
                                        
                                        // decrease ammo for the laser?
                                        if(WEP_CVAR_SEC(minstanex, ammo))
-                                               W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo));
+                                               W_DecreaseAmmo(WEP_CVAR_SEC(minstanex, ammo));
 
                                        // ugly minstagib hack to reuse the fire mode of the laser
                                        float w;
@@ -194,13 +194,13 @@ float w_minstanex(float req)
                }
                case WR_SETUP:
                {
-                       self.current_ammo = ammo_cells;
+                       self.current_ammo = AMMO_VAL(WEP_MINSTANEX);
                        self.minstanex_lasthit = 0;
                        return TRUE;
                }
                case WR_CHECKAMMO1:
                {
-                       ammo_amount = self.ammo_cells >= minstanex_ammo;
+                       ammo_amount = self.AMMO_VAL(WEP_MINSTANEX) >= minstanex_ammo;
                        ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
                        return ammo_amount;
                }
@@ -208,7 +208,7 @@ float w_minstanex(float req)
                {
                        if(!WEP_CVAR_SEC(minstanex, ammo))
                                return TRUE;
-                       ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(minstanex, ammo);
+                       ammo_amount = self.AMMO_VAL(WEP_MINSTANEX) >= WEP_CVAR_SEC(minstanex, ammo);
                        ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= WEP_CVAR_SEC(minstanex, ammo);
                        return ammo_amount;
                }