From 09667d161c6228ad19e292a1d3905d59ed9bbd2e Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 5 Jan 2019 20:28:31 +0100 Subject: [PATCH] Added missing escape-zone, vip-zone and defusal-kit HUD icons --- Source/Client/HUD.c | 41 +++++++++++++++++++++------ Source/Globals.h | 2 ++ Source/Server/Client.c | 2 ++ Source/Server/DefsFields.h | 2 ++ Source/Server/Main.c | 9 +++--- Source/Server/func_escapezone.cpp | 11 ++++--- Source/Server/func_vip_safetyzone.cpp | 9 ++++-- Source/gs-entbase/server/cycler.cpp | 2 +- 8 files changed, 57 insertions(+), 21 deletions(-) diff --git a/Source/Client/HUD.c b/Source/Client/HUD.c index 18071c91..d0533573 100755 --- a/Source/Client/HUD.c +++ b/Source/Client/HUD.c @@ -168,16 +168,38 @@ Draw icons such as hostage, bomb and buyzones ================= */ void HUD_DrawIcons(void) { + vector iconpos; + + iconpos = vVideoMins + [16, (vVideoResolution[1] / 2) - 24]; + + // Defusal Kit Icon (64, 148) + if (getstatf(STAT_EQUIPMENT) & EQUIPMENT_DEFUSALKIT) { + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0.25, 0.578125], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + iconpos[1] += 32; + } + // BuyZone Icon - if(getstatf(STAT_BUYZONE) == TRUE) { - vector vBuyIconPos = vVideoMins + [16, (vVideoResolution[1] / 2) - 12]; - drawsubpic(vBuyIconPos, [32,32], HUD_NUMFILE_LAYER, [0.125 * 3, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + if (getstatf(STAT_BUYZONE) == TRUE) { + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0.125 * 3, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + iconpos[1] += 32; } // Hostage-Rescue Area Icon - if(getstatf(STAT_HOSTAGEZONE) == TRUE) { - vector vRIconPos = vVideoMins + [16, (vVideoResolution[1] / 2) + 24]; - drawsubpic(vRIconPos, [32,32], HUD_NUMFILE_LAYER, [0.125 * 2, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + if (getstatf(STAT_HOSTAGEZONE) == TRUE) { + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0.125 * 2, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + iconpos[1] += 32; + } + + // Escape Zone Icon (128, 148) + if (getstatf(STAT_ESCAPEZONE) == TRUE) { + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0.5, 0.578125], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + iconpos[1] += 32; + } + + // VIP Zone Icon (160, 148) + if (getstatf(STAT_VIPZONE) == TRUE) { + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0.625, 0.578125], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + iconpos[1] += 32; } // Bomb-Area @@ -185,11 +207,12 @@ void HUD_DrawIcons(void) { if (getstatf(STAT_SLOT_GRENADE) == WEAPON_C4BOMB) { if (getstatf(STAT_BOMBZONE) == TRUE) { float fAlpha = fabs(sin(time * 20)); - drawsubpic(vBIconPos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [1,0,0], fAlpha, DRAWFLAG_ADDITIVE); - drawsubpic(vBIconPos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1 - fAlpha, DRAWFLAG_ADDITIVE); + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [1,0,0], fAlpha, DRAWFLAG_ADDITIVE); + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1 - fAlpha, DRAWFLAG_ADDITIVE); } else { - drawsubpic(vBIconPos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); + drawsubpic(iconpos, [32,32], HUD_NUMFILE_LAYER, [0, 0.125 * 5 - 0.046875], [0.125, 0.125], [0,1,0], 1, DRAWFLAG_ADDITIVE); } + iconpos[1] += 32; } } diff --git a/Source/Globals.h b/Source/Globals.h index b239f154..535e10e1 100755 --- a/Source/Globals.h +++ b/Source/Globals.h @@ -61,6 +61,8 @@ enum { enum { STAT_BUYZONE = 34, + STAT_ESCAPEZONE, + STAT_VIPZONE, STAT_HOSTAGEZONE, STAT_BOMBZONE, STAT_MONEY, diff --git a/Source/Server/Client.c b/Source/Server/Client.c index e6b9719f..1d84891d 100755 --- a/Source/Server/Client.c +++ b/Source/Server/Client.c @@ -204,6 +204,8 @@ void SV_RunClientCommand( void ) { self.fInBombZone = FALSE; self.fInBuyZone = FALSE; self.fInHostageZone = FALSE; + self.fInEscapeZone = FALSE; + self.fInVIPZone = FALSE; QPhysics_Run( self ); diff --git a/Source/Server/DefsFields.h b/Source/Server/DefsFields.h index 62ec2c73..e7839351 100644 --- a/Source/Server/DefsFields.h +++ b/Source/Server/DefsFields.h @@ -51,6 +51,8 @@ .float fInBuyZone; .float fInHostageZone; .float fInBombZone; +.float fInEscapeZone; +.float fInVIPZone; .float fMoney; .float fStepTime; .int iInGame; diff --git a/Source/Server/Main.c b/Source/Server/Main.c index 9c28f7d0..7f0f199e 100755 --- a/Source/Server/Main.c +++ b/Source/Server/Main.c @@ -624,17 +624,18 @@ void worldspawn( void ) { lightstyle( 10, "mmamammmmammamamaaamammma" ); lightstyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" ); - // TODO: Merge these into a single field? clientstat( 0, EV_FLOAT, health ); clientstat( 10, EV_FLOAT, weapon ); clientstat( 16, EV_FLOAT, view_ofs_z ); clientstat( 21, EV_FLOAT, viewzoom ); -// clientstat( STAT_BOMBZONE, EV_FLOAT, fInBombZone ); - + + /* FIXME: Turn those into bitflags */ clientstat( STAT_BUYZONE, EV_FLOAT, fInBuyZone ); clientstat( STAT_HOSTAGEZONE, EV_FLOAT, fInHostageZone ); clientstat( STAT_BOMBZONE, EV_FLOAT, fInBombZone ); - + clientstat( STAT_ESCAPEZONE, EV_FLOAT, fInEscapeZone ); + clientstat( STAT_VIPZONE, EV_FLOAT, fInVIPZone ); + clientstat( 4, EV_FLOAT, armor ); clientstat( STAT_MONEY, EV_FLOAT, fMoney ); clientstat( STAT_SLOT_MELEE, EV_FLOAT, fSlotMelee ); diff --git a/Source/Server/func_escapezone.cpp b/Source/Server/func_escapezone.cpp index 0425de78..d3357ec6 100644 --- a/Source/Server/func_escapezone.cpp +++ b/Source/Server/func_escapezone.cpp @@ -37,12 +37,15 @@ func_escapezone_touch */ void func_escapezone::touch(void) { - if ((other.classname == "player") && (other.team == TEAM_T)) { - Escape_Touch(other); + if (other.classname == "player") { + if (other.team == TEAM_T) { + Escape_Touch(other); - if (iAlivePlayers_T == 0) { - Rules_RoundOver(TEAM_T, 2500, FALSE); + if (iAlivePlayers_T == 0) { + Rules_RoundOver(TEAM_T, 2500, FALSE); + } } + other.fInEscapeZone = TRUE; } } diff --git a/Source/Server/func_vip_safetyzone.cpp b/Source/Server/func_vip_safetyzone.cpp index 195f8dd1..5339db82 100644 --- a/Source/Server/func_vip_safetyzone.cpp +++ b/Source/Server/func_vip_safetyzone.cpp @@ -27,9 +27,12 @@ void VIP_Rescue(entity targ) void func_vip_safetyzone::touch(void) { - if ((other.classname == "player") && (other.team == TEAM_VIP)) { - Rules_RoundOver(TEAM_CT, 2500, FALSE); - VIP_Rescue(other); + if (other.classname == "player") { + if (other.team == TEAM_VIP) { + Rules_RoundOver(TEAM_CT, 2500, FALSE); + VIP_Rescue(other); + } + other.fInVIPZone = TRUE; } } diff --git a/Source/gs-entbase/server/cycler.cpp b/Source/gs-entbase/server/cycler.cpp index 93d9721d..5915a242 100644 --- a/Source/gs-entbase/server/cycler.cpp +++ b/Source/gs-entbase/server/cycler.cpp @@ -25,7 +25,7 @@ Notes Given the way this entity behaves, there is little practical use for this entity beyond viewing animations (for which there are programs that are far more convenient). */ -class cycler:CBaseEntity +class cycler:CBaseTrigger { void() cycler; virtual void(entity, int, int) vPain;