]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Stats: register FUEL
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 7 Nov 2015 04:56:17 +0000 (15:56 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 7 Nov 2015 04:56:17 +0000 (15:56 +1100)
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/common/physics.qh
qcsrc/common/stats.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/server/g_world.qc

index 83043293c5c60a60a4a46e3182f8620393cd4ba8..bab17556d477bf9801af055822d450c2fa165a10 100644 (file)
@@ -41,7 +41,7 @@ void HUD_HealthArmor()
                        prev_health = 0;
                        prev_armor = 0;
                }
-               fuel = getstati(STAT_FUEL);
+               fuel = STAT(FUEL);
        }
        else
        {
index 5ee8954d0c1bd9cbdeb8232f0aef5692672d7b7d..f05578cb759ad6ad7a7d4727e4c8c9574a2d29ea 100644 (file)
@@ -24,6 +24,8 @@ float AdjustAirAccelQW(float accelqw, float factor);
 
 bool IsFlying(entity a);
 
+#define PHYS_AMMO_FUEL(s) STAT(FUEL, s)
+
 #ifdef CSQC
 
        const int FL_WATERJUMP = 2048;  // player jumping out of water
@@ -98,8 +100,6 @@ bool IsFlying(entity a);
        #define ITEMS_STAT(s)                                           (s).items
        #define BUFFS_STAT(s)                                           getstati(STAT_BUFFS)
 
-       #define PHYS_AMMO_FUEL(s)                                       getstati(STAT_FUEL)
-
        #define PHYS_FROZEN(s)                                          getstati(STAT_FROZEN)
 
        #define PHYS_DOUBLEJUMP                                         getstati(STAT_DOUBLEJUMP)
@@ -301,8 +301,6 @@ bool IsFlying(entity a);
        #define ITEMS_STAT(s)                                           s.items
        #define BUFFS_STAT(s)                                           (s).buffs
 
-       #define PHYS_AMMO_FUEL(s)                                       s.ammo_fuel
-
        #define PHYS_FROZEN(s)                                          s.frozen
 
        #define PHYS_DOUBLEJUMP                                         autocvar_sv_doublejump
index 1a9a38fc532da6fb8670269c3585e5b9260a0547..0096000e4a9d882d05a38858c718487ce9b10127 100644 (file)
@@ -89,7 +89,7 @@ enum {
     STAT_LAST_VECTOR
 };
 
-const int REGISTERED_STATS = 8;
+const int REGISTERED_STATS = 9;
 
 REGISTER_STAT(KH_KEYS, int)
 /** weapon requested to switch to; next WANTED weapon (for HUD) */
@@ -102,11 +102,11 @@ REGISTER_STAT(ARC_HEAT, float)
 REGISTER_STAT(PRESSED_KEYS, int)
 /** this stat could later contain some other bits of info, like, more server-side particle config */
 REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool)
+REGISTER_STAT(FUEL, int)
 
 enum {
     STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS,
 
-    STAT_FUEL,
     STAT_NB_METERSTART,
     /** compressShotOrigin */ STAT_SHOTORG,
     STAT_LEADLIMIT,
index b338122139730e150fa773b28e27ded825aca60d..f0d7b19b611246b52994536bf5909f4cb922f10e 100644 (file)
@@ -283,7 +283,7 @@ int GetAmmoStat(.int ammotype)
                case ammo_rockets: return STAT_ROCKETS;
                case ammo_cells: return STAT_CELLS;
                case ammo_plasma: return STAT_PLASMA;
-               case ammo_fuel: return STAT_FUEL;
+               case ammo_fuel: return STAT_FUEL.m_id;
                default: return -1;
        }
 }
index 3a878a461d1f933a93160409ae4f873e5aae5ff7..162443bf0bf63923a6e68cf02fdd49211a3f55ef 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef WEAPON_H
 #define WEAPON_H
 #include "../items/item/pickup.qh"
+#include "../stats.qh"
 
 const int MAX_WEAPONSLOTS = 2;
 .entity weaponentities[MAX_WEAPONSLOTS];
@@ -17,6 +18,15 @@ int weaponslot(.entity weaponentity)
        return 0;
 }
 
+#ifdef SVQC
+.int ammo_shells;
+.int ammo_nails;
+.int ammo_rockets;
+.int ammo_cells;
+.int ammo_plasma;
+.int ammo_fuel = _STAT(FUEL);
+.int ammo_none;
+#else
 .int ammo_shells;
 .int ammo_nails;
 .int ammo_rockets;
@@ -24,6 +34,7 @@ int weaponslot(.entity weaponentity)
 .int ammo_plasma;
 .int ammo_fuel;
 .int ammo_none;
+#endif
 
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
index eeb6801de1897eb8166e237eb5c4269d82564944..202ed1190fc5e7cb19ed4a72dff1ceab64d2a85b 100644 (file)
@@ -762,7 +762,6 @@ spawnfunc(worldspawn)
        Nagger_Init();
 
        addstat(STAT_SUPERWEAPONS_FINISHED, AS_FLOAT, superweapons_finished);
-       addstat(STAT_FUEL, AS_INT, ammo_fuel);
        addstat(STAT_PLASMA, AS_INT, ammo_plasma);
        addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
        addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);