From c7be3391dfa3d7212692db425e4e2d60ff219c0e Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 21 Nov 2015 17:07:41 +1000 Subject: [PATCH] Do 10 more stats --- qcsrc/client/hud/panel/ammo.qc | 8 +++---- qcsrc/client/hud/panel/powerups.qc | 2 +- qcsrc/client/view.qc | 12 +++++----- qcsrc/common/buffs/all.qh | 2 +- qcsrc/common/mutators/mutator/buffs/buffs.qc | 1 - qcsrc/common/mutators/mutator/nades/nades.qc | 24 +++++-------------- .../mutators/mutator/overkill/overkill.qc | 7 ++---- qcsrc/common/physics.qh | 4 ++-- qcsrc/common/stats.qh | 22 ++++++++--------- qcsrc/common/weapons/all.qc | 2 +- qcsrc/common/weapons/weapon.qh | 2 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/g_world.qc | 3 --- 13 files changed, 36 insertions(+), 55 deletions(-) diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index ac8fee0f1..dc30dbcf9 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -12,9 +12,9 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time) { - float bonusNades = getstatf(STAT_NADE_BONUS); - float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE); - float bonusType = getstati(STAT_NADE_BONUS_TYPE); + float bonusNades = STAT(NADE_BONUS); + float bonusProgress = STAT(NADE_BONUS_SCORE); + float bonusType = STAT(NADE_BONUS_TYPE); Nade def = Nades_from(bonusType); vector nadeColor = def.m_color; string nadeIcon = def.m_icon; @@ -147,7 +147,7 @@ void HUD_Ammo() } int rows = 0, columns, row, column; - float nade_cnt = getstatf(STAT_NADE_BONUS), nade_score = getstatf(STAT_NADE_BONUS_SCORE); + float nade_cnt = STAT(NADE_BONUS), nade_score = STAT(NADE_BONUS_SCORE); bool draw_nades = (nade_cnt > 0 || nade_score > 0); float nade_statuschange_elapsedtime; int total_ammo_count; diff --git a/qcsrc/client/hud/panel/powerups.qc b/qcsrc/client/hud/panel/powerups.qc index 6ab4537ac..933cb4229 100644 --- a/qcsrc/client/hud/panel/powerups.qc +++ b/qcsrc/client/hud/panel/powerups.qc @@ -57,7 +57,7 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b void HUD_Powerups() { int allItems = getstati(STAT_ITEMS, 0, 24); - int allBuffs = getstati(STAT_BUFFS, 0, 24); + int allBuffs = STAT(BUFFS); int strengthTime, shieldTime, superTime; // Initialize items diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 3b4e94cb4..e853e6b62 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -823,8 +823,8 @@ void HUD_Crosshair() weapon_clipsize = STAT(WEAPON_CLIPSIZE); float ok_ammo_charge, ok_ammo_chargepool; - ok_ammo_charge = getstatf(STAT_OK_AMMO_CHARGE); - ok_ammo_chargepool = getstatf(STAT_OK_AMMO_CHARGEPOOL); + ok_ammo_charge = STAT(OK_AMMO_CHARGE); + ok_ammo_chargepool = STAT(OK_AMMO_CHARGEPOOL); float vortex_charge, vortex_chargepool; vortex_charge = STAT(VORTEX_CHARGE); @@ -1005,10 +1005,10 @@ void HUD_Crosshair() void HUD_Draw() { - if(getstati(STAT_FROZEN)) + if(STAT(FROZEN)) drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE); - 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); + else if (STAT(HEALING_ORB)>time) + drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*STAT(HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE); if(!intermission) if(STAT(NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death { @@ -1680,7 +1680,7 @@ void CSQC_UpdateView(float w, float h) } } - if(autocvar_hud_damage && !getstati(STAT_FROZEN)) + if(autocvar_hud_damage && !STAT(FROZEN)) { splash_size.x = max(vid_conwidth, vid_conheight); splash_size.y = max(vid_conwidth, vid_conheight); diff --git a/qcsrc/common/buffs/all.qh b/qcsrc/common/buffs/all.qh index beabaa755..54532535c 100644 --- a/qcsrc/common/buffs/all.qh +++ b/qcsrc/common/buffs/all.qh @@ -41,7 +41,7 @@ CLASS(Buff, Pickup) ENDCLASS(Buff) #ifdef SVQC - .int buffs; + .int buffs = _STAT(BUFFS); void buff_Init(entity ent); void buff_Init_Compat(entity ent, entity replacement); #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \ diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index eeda5db74..ca20d7176 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -84,7 +84,6 @@ REGISTER_MUTATOR(buffs, cvar("g_buffs")) { MUTATOR_ONADD { - addstat(STAT_BUFFS, AS_INT, buffs); addstat(STAT_BUFF_TIME, AS_FLOAT, buff_time); InitializeEntity(world, buffs_DelayedInit, INITPRIO_FINDTARGET); diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index e2119b7c0..0c3018699 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -9,17 +9,17 @@ .entity fake_nade; .float nade_timer = _STAT(NADE_TIMER); .float nade_refire; -.float bonus_nades; +.float bonus_nades = _STAT(NADE_BONUS); .float nade_special_time; -.float bonus_nade_score; -.float nade_type; +.float bonus_nade_score = _STAT(NADE_BONUS_SCORE); +.int nade_type = _STAT(NADE_BONUS_TYPE); .string pokenade_type; .entity nade_damage_target; .float cvar_cl_nade_type; .string cvar_cl_pokenade_type; .float toss_time; -.float stat_healing_orb; -.float stat_healing_orb_alpha; +.float stat_healing_orb = _STAT(HEALING_ORB); +.float stat_healing_orb_alpha = _STAT(HEALING_ORB_ALPHA); .float nade_show_particles; // Remove nades that are being thrown @@ -50,19 +50,7 @@ MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage); #include "../../../monsters/sv_monsters.qh" #include "../../../../server/g_subs.qh" -REGISTER_MUTATOR(nades, cvar("g_nades")) -{ - MUTATOR_ONADD - { - 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); - addstat(STAT_HEALING_ORB, AS_FLOAT, stat_healing_orb); - addstat(STAT_HEALING_ORB_ALPHA, AS_FLOAT, stat_healing_orb_alpha); - } - - return false; -} +REGISTER_MUTATOR(nades, cvar("g_nades")); .float nade_time_primed; diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index c146f1c1a..987074f49 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -14,8 +14,8 @@ float autocvar_g_overkill_ammo_charge_limit; .float ok_notice_time; .float ammo_charge[Weapons_MAX]; -.float ok_use_ammocharge; -.float ok_ammo_charge; +.float ok_use_ammocharge = _STAT(OK_AMMO_CHARGE); +.float ok_ammo_charge = _STAT(OK_AMMO_CHARGEPOOL); .float ok_pauseregen_finished; @@ -372,9 +372,6 @@ void ok_Initialize() precache_all_playermodels("models/ok_player/*.dpm"); - addstat(STAT_OK_AMMO_CHARGE, AS_FLOAT, ok_use_ammocharge); - addstat(STAT_OK_AMMO_CHARGEPOOL, AS_FLOAT, ok_ammo_charge); - WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index f05578cb7..16e028e04 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -98,9 +98,9 @@ bool IsFlying(entity a); #define WAS_ONGROUND(s) !!(s.lastflags & FL_ONGROUND) #define ITEMS_STAT(s) (s).items - #define BUFFS_STAT(s) getstati(STAT_BUFFS) + #define BUFFS_STAT(s) STAT(BUFFS) - #define PHYS_FROZEN(s) getstati(STAT_FROZEN) + #define PHYS_FROZEN(s) STAT(FROZEN) #define PHYS_DOUBLEJUMP getstati(STAT_DOUBLEJUMP) diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 86799ce03..fa245d9d8 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -89,7 +89,7 @@ enum { STAT_LAST_VECTOR }; -const int REGISTERED_STATS = 39; +const int REGISTERED_STATS = 50; REGISTER_STAT(KH_KEYS, int) /** weapon requested to switch to; next WANTED weapon (for HUD) */ @@ -136,20 +136,20 @@ REGISTER_STAT(RESPAWN_TIME, float) REGISTER_STAT(ROUNDSTARTTIME, float) REGISTER_STAT(MONSTERS_TOTAL, int) REGISTER_STAT(MONSTERS_KILLED, int) +REGISTER_STAT(BUFFS, int) +REGISTER_STAT(NADE_BONUS, float) +REGISTER_STAT(NADE_BONUS_TYPE, int) +REGISTER_STAT(NADE_BONUS_SCORE, float) +REGISTER_STAT(HEALING_ORB, float) +REGISTER_STAT(HEALING_ORB_ALPHA, float) +REGISTER_STAT(PLASMA, int) +REGISTER_STAT(OK_AMMO_CHARGE, float) +REGISTER_STAT(OK_AMMO_CHARGEPOOL, float) +REGISTER_STAT(FROZEN, int) enum { STAT_FIRST_MAIN = (STAT_LAST_VECTOR - 1) + REGISTERED_STATS, - STAT_BUFFS, - STAT_NADE_BONUS, - STAT_NADE_BONUS_TYPE, - STAT_NADE_BONUS_SCORE, - STAT_HEALING_ORB, - STAT_HEALING_ORB_ALPHA, - STAT_PLASMA, - STAT_OK_AMMO_CHARGE, - STAT_OK_AMMO_CHARGEPOOL, - STAT_FROZEN, STAT_REVIVE_PROGRESS, STAT_ROUNDLOST, STAT_BUFF_TIME, diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index f0d7b19b6..6315808e0 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -282,7 +282,7 @@ int GetAmmoStat(.int ammotype) case ammo_nails: return STAT_NAILS; case ammo_rockets: return STAT_ROCKETS; case ammo_cells: return STAT_CELLS; - case ammo_plasma: return STAT_PLASMA; + case ammo_plasma: return STAT_PLASMA.m_id; case ammo_fuel: return STAT_FUEL.m_id; default: return -1; } diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 162443bf0..3016b501f 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -23,7 +23,7 @@ int weaponslot(.entity weaponentity) .int ammo_nails; .int ammo_rockets; .int ammo_cells; -.int ammo_plasma; +.int ammo_plasma = _STAT(PLASMA); .int ammo_fuel = _STAT(FUEL); .int ammo_none; #else diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 28d402160..f6ac5348b 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -513,7 +513,7 @@ const float ACTIVE_TOGGLE = 3; .float player_blocked; .float weapon_blocked; // weapon use disabled -.float frozen; // for freeze attacks +.float frozen = _STAT(FROZEN); // for freeze attacks .float revive_progress; .float revival_time; // time at which player was last revived .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index ea6cc6bff..aebbf77c0 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -759,10 +759,7 @@ spawnfunc(worldspawn) WepSet_AddStat_InMap(); Nagger_Init(); - addstat(STAT_PLASMA, AS_INT, ammo_plasma); - // freeze attacks - addstat(STAT_FROZEN, AS_INT, frozen); addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress); // physics -- 2.39.2