]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port 10 more
authorMario <mario@smbclan.net>
Sat, 14 Nov 2015 13:33:59 +0000 (23:33 +1000)
committerMario <mario@smbclan.net>
Sat, 14 Nov 2015 13:33:59 +0000 (23:33 +1000)
qcsrc/client/view.qc
qcsrc/common/stats.qh
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/weapons/accuracy.qc

index 8fdefe0ec0180132db0dfcae392e469240c102e6..55347c64d355525d3f552acf105637f1d7905073 100644 (file)
@@ -475,12 +475,12 @@ void UpdateDamage()
 {
        // accumulate damage with each stat update
        static float damage_total_prev = 0;
-       float damage_total = getstati(STAT_DAMAGE_DEALT_TOTAL);
+       float damage_total = STAT(DAMAGE_DEALT_TOTAL);
        float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev);
        damage_total_prev = damage_total;
 
        static float damage_dealt_time_prev = 0;
-       float damage_dealt_time = getstatf(STAT_HIT_TIME);
+       float damage_dealt_time = STAT(HIT_TIME);
        if (damage_dealt_time != damage_dealt_time_prev)
        {
                unaccounted_damage += unaccounted_damage_new;
@@ -536,7 +536,7 @@ void HitSound()
        }
 
        static float typehit_time_prev = 0;
-       float typehit_time = getstatf(STAT_TYPEHIT_TIME);
+       float typehit_time = STAT(TYPEHIT_TIME);
        if (COMPARE_INCREASING(typehit_time, typehit_time_prev) > autocvar_cl_hitsound_antispam_time)
        {
                sound(world, CH_INFO, SND_TYPEHIT, VOL_BASE, ATTN_NONE);
@@ -712,7 +712,7 @@ void HUD_Crosshair()
 
                if(autocvar_crosshair_pickup)
                {
-                       float stat_pickup_time = getstatf(STAT_LAST_PICKUP);
+                       float stat_pickup_time = STAT(LAST_PICKUP);
 
                        if(pickup_crosshair_time < stat_pickup_time)
                        {
@@ -827,8 +827,8 @@ void HUD_Crosshair()
                                ok_ammo_chargepool = getstatf(STAT_OK_AMMO_CHARGEPOOL);
 
                                float vortex_charge, vortex_chargepool;
-                               vortex_charge = getstatf(STAT_VORTEX_CHARGE);
-                               vortex_chargepool = getstatf(STAT_VORTEX_CHARGEPOOL);
+                               vortex_charge = STAT(VORTEX_CHARGE);
+                               vortex_chargepool = STAT(VORTEX_CHARGEPOOL);
 
                                float arc_heat = STAT(ARC_HEAT);
 
@@ -859,14 +859,14 @@ void HUD_Crosshair()
                                }
                                else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER.m_id && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
                                {
-                                       ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+                                       ring_value = bound(0, STAT(LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
                                        ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring.tga";
                                }
-                               else if (activeweapon == WEP_HAGAR.m_id && getstati(STAT_HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
+                               else if (activeweapon == WEP_HAGAR.m_id && STAT(HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
                                {
-                                       ring_value = bound(0, getstati(STAT_HAGAR_LOAD) / hagar_maxrockets, 1);
+                                       ring_value = bound(0, STAT(HAGAR_LOAD) / hagar_maxrockets, 1);
                                        ring_alpha = autocvar_crosshair_ring_hagar_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring.tga";
@@ -1065,7 +1065,7 @@ void CSQC_UpdateView(float w, float h)
        ++framecount;
 
        stats_get();
-       hud = getstati(STAT_HUD);
+       hud = STAT(HUD);
 
        if(hud != HUD_NORMAL && lasthud == HUD_NORMAL)
                vh_notice_time = time + autocvar_cl_vehicles_notify_time;
@@ -1389,7 +1389,7 @@ void CSQC_UpdateView(float w, float h)
        ColorTranslateMode = autocvar_cl_stripcolorcodes;
 
        // currently switching-to weapon (for crosshair)
-       switchingweapon = getstati(STAT_SWITCHINGWEAPON);
+       switchingweapon = STAT(SWITCHINGWEAPON);
 
        // actually active weapon (for zoom)
        activeweapon = getstati(STAT_ACTIVEWEAPON);
index 5e29b2f9d99e807bf01a61bd7731044a8e9a1e31..084a001556464bc9eda98fb92c82d9a1092288a8 100644 (file)
@@ -89,7 +89,7 @@ enum {
     STAT_LAST_VECTOR
 };
 
-const int REGISTERED_STATS = 14;
+const int REGISTERED_STATS = 24;
 
 REGISTER_STAT(KH_KEYS, int)
 /** weapon requested to switch to; next WANTED weapon (for HUD) */
@@ -110,19 +110,20 @@ REGISTER_STAT(LEADLIMIT, float)
 REGISTER_STAT(WEAPON_CLIPLOAD, int)
 REGISTER_STAT(WEAPON_CLIPSIZE, int)
 
+REGISTER_STAT(VORTEX_CHARGE, float)
+REGISTER_STAT(LAST_PICKUP, float)
+REGISTER_STAT(HUD, int)
+REGISTER_STAT(VORTEX_CHARGEPOOL, float)
+REGISTER_STAT(HIT_TIME, float)
+REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
+REGISTER_STAT(TYPEHIT_TIME, float)
+REGISTER_STAT(LAYED_MINES, int)
+REGISTER_STAT(HAGAR_LOAD, int)
+REGISTER_STAT(SWITCHINGWEAPON, int)
+
 enum {
     STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS,
 
-    STAT_VORTEX_CHARGE,
-    STAT_LAST_PICKUP,
-    STAT_HUD,
-    STAT_VORTEX_CHARGEPOOL,
-    STAT_HIT_TIME,
-    STAT_DAMAGE_DEALT_TOTAL,
-    STAT_TYPEHIT_TIME,
-    STAT_LAYED_MINES,
-    STAT_HAGAR_LOAD,
-    STAT_SWITCHINGWEAPON,
     STAT_SUPERWEAPONS_FINISHED,
     STAT_VEHICLESTAT_HEALTH,
     STAT_VEHICLESTAT_SHIELD,
index c7b84582239e1c129ab4de4d95d2e79fb6a82f66..f737f4a421bfc8db9e0302c1f928a5fc84818547 100644 (file)
@@ -7,7 +7,6 @@
 STATIC_INIT(vehicles_common_initialize)
 {
 #ifdef SVQC
-       addstat(STAT_HUD, AS_INT, hud);
        addstat(STAT_VEHICLESTAT_HEALTH,  AS_INT, vehicle_health);
        addstat(STAT_VEHICLESTAT_SHIELD,  AS_INT, vehicle_shield);
        addstat(STAT_VEHICLESTAT_ENERGY,  AS_INT, vehicle_energy);
index b3f252e3b12597ed22b4bbae58ce9711c297bf19..6da75bf60cdb002e1d24c78dd6573f963b4e5c06 100644 (file)
@@ -61,7 +61,7 @@ const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
 const float VHSF_NORMAL = 0;
 const float VHSF_FACTORY = 2;
 
-.int hud;
+.int hud = _STAT(HUD);
 .float dmg_time;
 
 .int volly_counter;
index eb40628ef51d625458f974a49affe6190b7f2ac3..1d10f4b290f238ecea5df7d09a730ec4747d6b9b 100644 (file)
@@ -158,7 +158,7 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 
 //.int weapon; // current weapon
 .int switchweapon = _STAT(SWITCHWEAPON);
-.int switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
+.int switchingweapon = _STAT(SWITCHINGWEAPON); // weapon currently being switched to (is copied from switchweapon once switch is possible)
 .string weaponname; // name of .weapon
 
 // WEAPONTODO
@@ -447,12 +447,12 @@ float servertime, serverprevtime, serverframetime;
 
 string matchid;
 
-.float last_pickup;
+.float last_pickup = _STAT(LAST_PICKUP);
 
-.float hit_time;
-.float typehit_time;
+.float hit_time = _STAT(HIT_TIME);
+.float typehit_time = _STAT(TYPEHIT_TIME);
 
-.float damage_dealt_total;
+.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
 
 .float stat_leadlimit = _STAT(LEADLIMIT);
 
@@ -469,11 +469,11 @@ float client_cefc_accumulatortime;
 .float old_clip_load;
 .float clip_size = _STAT(WEAPON_CLIPSIZE);
 
-.float minelayer_mines;
-.float vortex_charge;
+.float minelayer_mines = _STAT(LAYED_MINES);
+.float vortex_charge = _STAT(VORTEX_CHARGE);
 .float vortex_charge_rottime;
-.float vortex_chargepool_ammo;
-.float hagar_load;
+.float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
+.float hagar_load = _STAT(HAGAR_LOAD);
 
 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
 
index e7a079a57b4b7916e2be00af4e353ea29753ddbe..569b5c35fb053a8748eb9b171d6148dc7c72fbaa 100644 (file)
@@ -757,22 +757,11 @@ spawnfunc(worldspawn)
 
        WepSet_AddStat();
        WepSet_AddStat_InMap();
-       addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon);
        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);
-       addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
-       addstat(STAT_HIT_TIME, AS_FLOAT, hit_time);
-       addstat(STAT_DAMAGE_DEALT_TOTAL, AS_INT, damage_dealt_total);
-       addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time);
-       addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines);
-
-       addstat(STAT_VORTEX_CHARGE, AS_FLOAT, vortex_charge);
-       addstat(STAT_VORTEX_CHARGEPOOL, AS_FLOAT, vortex_chargepool_ammo);
-
-       addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
 
        // freeze attacks
        addstat(STAT_FROZEN, AS_INT, frozen);
index 211ef8cec090682aeaf040286f54018f8ff27376..b92a21da2d6352f63ba88b08884c21e7a39a0327 100644 (file)
@@ -58,7 +58,7 @@ void accuracy_resend(entity e)
 }
 
 // update accuracy stats
-.float hit_time;
+//.float hit_time;
 .float fired_time;
 
 void accuracy_add(entity this, int w, int fired, int hit)