From 67b127cee4597c5a385921ca51c24f0cea863f4e Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 17 Nov 2015 20:51:23 +1000 Subject: [PATCH] Port another 10 stats --- qcsrc/client/hud/panel/powerups.qc | 2 +- qcsrc/client/view.qc | 4 ++-- qcsrc/common/mutators/mutator/nades/nades.qc | 3 +-- qcsrc/common/stats.qh | 22 ++++++++++---------- qcsrc/common/vehicles/all.qc | 19 ----------------- qcsrc/common/vehicles/cl_vehicles.qc | 14 ++++++------- qcsrc/common/vehicles/cl_vehicles.qh | 2 +- qcsrc/common/vehicles/sv_vehicles.qh | 16 +++++++------- qcsrc/common/vehicles/vehicle/raptor.qc | 2 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/g_world.qc | 1 - 11 files changed, 33 insertions(+), 54 deletions(-) diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 4e509e5c5..6ab4537ac 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -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; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 55347c64d..3b4e94cb4 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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)) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 556265f1f..e2119b7c0 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -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); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 084a00155..7eeefc6ab 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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, diff --git a/qcsrc/common/vehicles/all.qc b/qcsrc/common/vehicles/all.qc index f737f4a42..44178f92f 100644 --- a/qcsrc/common/vehicles/all.qc +++ b/qcsrc/common/vehicles/all.qc @@ -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) diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index be615772a..cc4fa0f12 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -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; diff --git a/qcsrc/common/vehicles/cl_vehicles.qh b/qcsrc/common/vehicles/cl_vehicles.qh index fbaf88c6f..5293030c1 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qh +++ b/qcsrc/common/vehicles/cl_vehicles.qh @@ -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 diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 6da75bf60..423c8ec04 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -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 diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 866a69eb2..a3739322b 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 1d10f4b29..0a515212e 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 569b5c35f..9b752144a 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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 -- 2.39.2