]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rename GetAmmoConsumptionPrimary to GetAmmoConsumptionQ3 and move to quake3.qc
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 18 Oct 2020 10:52:41 +0000 (20:52 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 18 Oct 2020 10:52:41 +0000 (20:52 +1000)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/quake3.qh
qcsrc/server/weapons/spawning.qc

index 5de760d4854fd81422e9112c571723005e896aa5..d6e7cdbe72c315bda572d9b71d8b6eab272bf0ae 100644 (file)
@@ -251,23 +251,6 @@ entity GetAmmoItem(int ammotype)
        // GetAmmoPicture  GetAmmoName  notif_arg_item_wepammo  ammo_pickupevalfunc ?
 }
 
-#ifdef SVQC
-int GetAmmoConsumptionPrimary(string netname)
-// Returns ammo consumed per shot by the primary/default fire mode
-// Returns 0 if the netname has no ammo cvar
-{
-       switch (netname)
-       {
-               case "arc":        return autocvar_g_balance_arc_beam_ammo;
-               case "devastator": return autocvar_g_balance_devastator_ammo;
-               case "machinegun": return autocvar_g_balance_machinegun_sustained_ammo;
-               case "minelayer":  return autocvar_g_balance_minelayer_ammo;
-               case "seeker":     return autocvar_g_balance_seeker_tag_ammo;
-               default:           return cvar(strcat("g_balance_", netname, "_primary_ammo"));
-       }
-}
-#endif
-
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i)
 {
index cf266b8d69964b0c9cc7c9dc9420381d83b53dac..83f3f4a0febd438e9f817f3ba9010bd747f78992 100644 (file)
@@ -229,10 +229,6 @@ string GetAmmoName(int ammotype);
 
 entity GetAmmoItem(int ammotype);
 
-#ifdef SVQC
-int GetAmmoConsumptionPrimary(string netname);
-#endif
-
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i);
 int GetAmmoStat(int ammotype);
index fec250558784a5ff3f42bf02e7f0b88cac029191..4c50ea51f66822002ca47d48f9509b2f20df34c3 100644 (file)
@@ -333,3 +333,19 @@ bool DoesQ3ARemoveThisEntity(entity this)
 
        return false;
 }
+
+int GetAmmoConsumptionQ3(string netname)
+// Returns ammo consumed per shot by the primary/default fire mode
+// Returns 0 if the netname has no ammo cvar
+{
+       switch (netname)
+       {
+               case "arc":        return autocvar_g_balance_arc_beam_ammo;
+               case "devastator": return autocvar_g_balance_devastator_ammo;
+               case "machinegun": return autocvar_g_balance_machinegun_sustained_ammo;
+               case "minelayer":  return autocvar_g_balance_minelayer_ammo;
+               case "seeker":     return autocvar_g_balance_seeker_tag_ammo;
+               default:           return cvar(strcat("g_balance_", netname, "_primary_ammo"));
+       }
+}
+
index 321c6fb4feb5ace4bb736d766a48892afdfefe54..029485ab03f969fecd2d45c033a309dc2b0f5092 100644 (file)
@@ -5,6 +5,7 @@ int q3compat = 0;
 #define Q3COMPAT_DEFI BIT(1)
 
 bool DoesQ3ARemoveThisEntity(entity this);
+int GetAmmoConsumptionQ3(string netname);
 
 .int fragsfilter_cnt;
 
@@ -17,7 +18,7 @@ bool DoesQ3ARemoveThisEntity(entity this);
        spawnfunc(ammo_classname) \
        { \
                if(this.count && xonwep.ammo_type) \
-                       SetResource(this, xonwep.ammo_type, this.count * GetAmmoConsumptionPrimary(xonwep.netname)); \
+                       SetResource(this, xonwep.ammo_type, this.count * GetAmmoConsumptionQ3(xonwep.netname)); \
        SPAWNFUNC_BODY(GetAmmoItem(xonwep.ammo_type)) \
        }
 
index dd664986d699c7645cd12e56a2083a71403b27bd..730a73796a204e79646221831abf1572f3e83dbd 100644 (file)
@@ -111,8 +111,8 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
        if ((wpn.ammo_type != RES_NONE) && !GetResource(this, wpn.ammo_type))
        {
                int ammo = 0;
-               if (this.count > 0)
-                       ammo = this.count * GetAmmoConsumptionPrimary(wpn.netname);
+               if (q3compat && this.count > 0)
+                       ammo = this.count * GetAmmoConsumptionQ3(wpn.netname);
                        // WEAPONTODO: magazines of MG, rifle and OK weapons are unaccounted for
                else
                {