]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port another 10 stats
authorMario <mario@smbclan.net>
Tue, 17 Nov 2015 10:51:23 +0000 (20:51 +1000)
committerMario <mario@smbclan.net>
Tue, 17 Nov 2015 10:51:23 +0000 (20:51 +1000)
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/stats.qh
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/cl_vehicles.qh
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc

index 4e509e5c5fc7db3de6336c58cc8e6d0ccc71ce62..6ab4537ace438eba0cff107b377f802439f1a380 100644 (file)
@@ -70,7 +70,7 @@ void HUD_Powerups()
 
                strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
                shieldTime = bound(0, STAT(INVINCIBLE_FINISHED) - time, 99);
-               superTime = bound(0, getstatf(STAT_SUPERWEAPONS_FINISHED) - time, 99);
+               superTime = bound(0, STAT(SUPERWEAPONS_FINISHED) - time, 99);
 
                if(allItems & IT_UNLIMITED_SUPERWEAPONS)
                        superTime = 99;
index 55347c64d355525d3f552acf105637f1d7905073..3b4e94cb479a366846eddb3b18a0e6ac935ed324 100644 (file)
@@ -1010,9 +1010,9 @@ void HUD_Draw()
        else if (getstatf(STAT_HEALING_ORB)>time)
                drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
        if(!intermission)
-       if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
+       if(STAT(NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
        {
-               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * getstatf(STAT_NADE_TIMER)) - ('0 1 1' * getstatf(STAT_NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * STAT(NADE_TIMER)) - ('0 1 1' * STAT(NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
                drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
        }
        else if(getstatf(STAT_REVIVE_PROGRESS))
index 556265f1f99699227b3d10fa85350ca234964ba7..e2119b7c06ec9917441871607103e329a60ebc78 100644 (file)
@@ -7,7 +7,7 @@
 
 .entity nade;
 .entity fake_nade;
-.float nade_timer;
+.float nade_timer = _STAT(NADE_TIMER);
 .float nade_refire;
 .float bonus_nades;
 .float nade_special_time;
@@ -54,7 +54,6 @@ REGISTER_MUTATOR(nades, cvar("g_nades"))
 {
        MUTATOR_ONADD
        {
-               addstat(STAT_NADE_TIMER, AS_FLOAT, nade_timer);
                addstat(STAT_NADE_BONUS, AS_FLOAT, bonus_nades);
                addstat(STAT_NADE_BONUS_TYPE, AS_INT, nade_type);
                addstat(STAT_NADE_BONUS_SCORE, AS_FLOAT, bonus_nade_score);
index 084a001556464bc9eda98fb92c82d9a1092288a8..7eeefc6ab71d5327bc8d11d5f2938ac29d73231e 100644 (file)
@@ -89,7 +89,7 @@ enum {
     STAT_LAST_VECTOR
 };
 
-const int REGISTERED_STATS = 24;
+const int REGISTERED_STATS = 33;
 
 REGISTER_STAT(KH_KEYS, int)
 /** weapon requested to switch to; next WANTED weapon (for HUD) */
@@ -120,20 +120,20 @@ REGISTER_STAT(TYPEHIT_TIME, float)
 REGISTER_STAT(LAYED_MINES, int)
 REGISTER_STAT(HAGAR_LOAD, int)
 REGISTER_STAT(SWITCHINGWEAPON, int)
+REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
+REGISTER_STAT(VEHICLESTAT_HEALTH, int)
+REGISTER_STAT(VEHICLESTAT_SHIELD, int)
+REGISTER_STAT(VEHICLESTAT_ENERGY, int)
+REGISTER_STAT(VEHICLESTAT_AMMO1, int)
+REGISTER_STAT(VEHICLESTAT_RELOAD1, int)
+REGISTER_STAT(VEHICLESTAT_AMMO2, int)
+REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
+REGISTER_STAT(VEHICLESTAT_W2MODE, int)
+REGISTER_STAT(NADE_TIMER, float)
 
 enum {
     STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS,
 
-    STAT_SUPERWEAPONS_FINISHED,
-    STAT_VEHICLESTAT_HEALTH,
-    STAT_VEHICLESTAT_SHIELD,
-    STAT_VEHICLESTAT_ENERGY,
-    STAT_VEHICLESTAT_AMMO1,
-    STAT_VEHICLESTAT_RELOAD1,
-    STAT_VEHICLESTAT_AMMO2,
-    STAT_VEHICLESTAT_RELOAD2,
-    STAT_VEHICLESTAT_W2MODE,
-    STAT_NADE_TIMER,
     STAT_SECRETS_TOTAL,
     STAT_SECRETS_FOUND,
     STAT_RESPAWN_TIME,
index f737f4a421bfc8db9e0302c1f928a5fc84818547..44178f92f8178486eee45abbe90c2fff72345544 100644 (file)
@@ -3,25 +3,6 @@
 
 #include "all.qh"
 
-#ifndef MENUQC
-STATIC_INIT(vehicles_common_initialize)
-{
-#ifdef SVQC
-       addstat(STAT_VEHICLESTAT_HEALTH,  AS_INT, vehicle_health);
-       addstat(STAT_VEHICLESTAT_SHIELD,  AS_INT, vehicle_shield);
-       addstat(STAT_VEHICLESTAT_ENERGY,  AS_INT, vehicle_energy);
-
-       addstat(STAT_VEHICLESTAT_W2MODE, AS_INT, vehicle_weapon2mode);
-
-       addstat(STAT_VEHICLESTAT_AMMO1,   AS_INT, vehicle_ammo1);
-       addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1);
-
-       addstat(STAT_VEHICLESTAT_AMMO2,   AS_INT, vehicle_ammo2);
-       addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2);
-#endif // SVQC
-}
-#endif
-
 REGISTER_NET_LINKED(ENT_CLIENT_AUXILIARYXHAIR)
 
 #if defined(SVQC)
index be615772a9d5714eae39657e3c4b736c57a3ad5d..cc4fa0f122b9652f90a038e30fb3796ab7e16702 100644 (file)
@@ -132,13 +132,13 @@ void Vehicles_drawHUD(
        float barAlpha = autocvar_hud_progressbar_alpha * hudAlpha;
        float blinkValue = 0.55 + sin(time * 7) * 0.45;
 
-       float health  = getstati(STAT_VEHICLESTAT_HEALTH)  * 0.01;
-       float shield  = getstati(STAT_VEHICLESTAT_SHIELD)  * 0.01;
-       float energy  = getstati(STAT_VEHICLESTAT_ENERGY)  * 0.01;
-       float ammo1   = getstati(STAT_VEHICLESTAT_AMMO1)   * 0.01;
-       float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1) * 0.01;
-       float ammo2   = getstati(STAT_VEHICLESTAT_AMMO2)   * 0.01;
-       float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2) * 0.01;
+       float health  = STAT(VEHICLESTAT_HEALTH)  * 0.01;
+       float shield  = STAT(VEHICLESTAT_SHIELD)  * 0.01;
+       float energy  = STAT(VEHICLESTAT_ENERGY)  * 0.01;
+       float ammo1   = STAT(VEHICLESTAT_AMMO1)   * 0.01;
+       float reload1 = STAT(VEHICLESTAT_RELOAD1) * 0.01;
+       float ammo2   = STAT(VEHICLESTAT_AMMO2)   * 0.01;
+       float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
 
        // HACK to deal with the inconsistent use of the vehicle stats
        ammo1 = (ammo1) ? ammo1 : energy;
index fbaf88c6f916526f1694ac2f0c2ca493bfc15b34..5293030c19fe9ecda1aad3c8e733edabc29eda72 100644 (file)
@@ -7,6 +7,6 @@ vector vehicleHud_Pos;
 void RaptorCBShellfragDraw(entity this);
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
 
-#define weapon2mode getstati(STAT_VEHICLESTAT_W2MODE)
+#define weapon2mode STAT(VEHICLESTAT_W2MODE)
 
 #endif
index 6da75bf60cdb002e1d24c78dd6573f963b4e5c06..423c8ec047380a2a84f20212bd4324ded774ff70 100644 (file)
@@ -42,14 +42,14 @@ float autocvar_g_vehicles_weapon_damagerate = 1;
 .entity gunner1;
 .entity gunner2;
 
-.float vehicle_health;  /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
-.float vehicle_energy;  /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
-.float vehicle_shield;  /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
+.float vehicle_health = _STAT(VEHICLESTAT_HEALTH);  /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
+.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY);  /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
+.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD);  /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
 
-.float vehicle_ammo1;   /// If self is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If self is vehile, this is the real ammo1 value.
-.float vehicle_reload1; /// If self is player this is 0..100 indicating percentage of primary reload status. If self is vehile, this is the real reload1 value.
-.float vehicle_ammo2;   /// If self is player this is 0..100 indicating percentage of secondary ammo left. If self is vehile, this is the real ammo2 value.
-.float vehicle_reload2; /// If self is player this is 0..100 indicating percentage of secondary reload status. If self is vehile, this is the real reload2 value.
+.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1);   /// If self is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If self is vehile, this is the real ammo1 value.
+.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If self is player this is 0..100 indicating percentage of primary reload status. If self is vehile, this is the real reload1 value.
+.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2);   /// If self is player this is 0..100 indicating percentage of secondary ammo left. If self is vehile, this is the real ammo2 value.
+.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If self is player this is 0..100 indicating percentage of secondary reload status. If self is vehile, this is the real reload2 value.
 
 .float sound_nexttime;
 const float VOL_VEHICLEENGINE = 1;
@@ -80,7 +80,7 @@ const float   DAMAGE_TARGETDRONE = 10;
 // vehicle functions
 .void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
 .bool(int _imp) vehicles_impulse;
-.int vehicle_weapon2mode;
+.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
 .void(int exit_flags) vehicle_exit;
 .bool() vehicle_enter;
 const int VHEF_NORMAL = 0;  /// User pressed exit key
index 866a69eb2e8c59720f82774449835e8a0e6e38bb..a3739322bc7980df470e0890a2eb9bfabde92bcf 100644 (file)
@@ -804,7 +804,7 @@ spawnfunc(vehicle_raptor)
                                        dropmark.gravity = 1;
                                }
 
-                               float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2) * 0.01;
+                               float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
                                if(reload2 == 1)
                                {
                                        setorigin(dropmark, pmove_org);
index 1d10f4b290f238ecea5df7d09a730ec4747d6b9b..0a515212ede4b6c6ef59316316a14fa1fa48ec6f 100644 (file)
@@ -79,7 +79,7 @@ float server_is_dedicated;
 
 .float strength_finished = _STAT(STRENGTH_FINISHED);
 .float invincible_finished = _STAT(INVINCIBLE_FINISHED);
-.float superweapons_finished;
+.float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
 
 .float cnt; // used in too many places
 .float count;
index 569b5c35fb053a8748eb9b171d6148dc7c72fbaa..9b752144a05b6814cfa7a13529d7ba26cd812f6e 100644 (file)
@@ -760,7 +760,6 @@ spawnfunc(worldspawn)
        addstat(STAT_ROUNDSTARTTIME, AS_FLOAT, stat_round_starttime);
        Nagger_Init();
 
-       addstat(STAT_SUPERWEAPONS_FINISHED, AS_FLOAT, superweapons_finished);
        addstat(STAT_PLASMA, AS_INT, ammo_plasma);
 
        // freeze attacks