From 38924ed7b160bbcd7e206c5bb073df86e521bb45 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 25 Jan 2018 15:55:47 +0500 Subject: [PATCH] Do not show hud on vis_credits map. --- cl_dll/battery.cpp | 8 +------- cl_dll/health.cpp | 2 +- dlls/cdll_dll.h | 3 ++- dlls/player.cpp | 24 ++++++++++++++++++------ dlls/visitors/kevlar.cpp | 23 +++++++++-------------- dlls/weapons.h | 2 +- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/cl_dll/battery.cpp b/cl_dll/battery.cpp index b38ad543..4b2fd952 100644 --- a/cl_dll/battery.cpp +++ b/cl_dll/battery.cpp @@ -71,13 +71,7 @@ int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf ) int CHudBattery::Draw( float flTime ) { - if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) - return 1; - - // - // HL: Visitors - Only draw (kevlar vest) value if non-zero. - // - if( m_iBat <= 0 ) + if( gHUD.m_iHideHUDDisplay & HIDEHUD_SUIT ) return 1; int r, g, b, x, y, a; diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index 93775b58..9a93f8da 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -212,7 +212,7 @@ int CHudHealth::Draw( float flTime ) ScaleColors( r, g, b, a ); // Only draw health if we have the suit. - if( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) + // if( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) { HealthWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left; int CrossWidth = gHUD.GetSpriteRect( m_HUD_cross ).right - gHUD.GetSpriteRect( m_HUD_cross ).left; diff --git a/dlls/cdll_dll.h b/dlls/cdll_dll.h index 431cc078..ab6a457e 100644 --- a/dlls/cdll_dll.h +++ b/dlls/cdll_dll.h @@ -31,6 +31,7 @@ #define HIDEHUD_FLASHLIGHT ( 1<<1 ) #define HIDEHUD_ALL ( 1<<2 ) #define HIDEHUD_HEALTH ( 1<<3 ) +#define HIDEHUD_SUIT ( 1<<4 ) #define MAX_AMMO_TYPES 32 // ??? #define MAX_AMMO_SLOTS 32 // not really slots @@ -40,7 +41,7 @@ #define HUD_PRINTTALK 3 #define HUD_PRINTCENTER 4 -#define WEAPON_FLASHLIGHT 30 +#define WEAPON_FLASHLIGHT 18 #define WEAPON_SUIT 31 #endif diff --git a/dlls/player.cpp b/dlls/player.cpp index b2889c5c..8ae2b372 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1,4 +1,4 @@ -/*** +Y/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * @@ -3901,12 +3901,24 @@ void CBasePlayer::UpdateClientData( void ) InitStatusBar(); } - // - // HL: Visitors - Give suit to toggle hud on map vis07 (Security system failed) - // - if( !( pev->weapons & ( 1 << WEAPON_SUIT ) ) && FStrEq( STRING( gpGlobals->mapname ), "vis07" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "vis01" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis02" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis03" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis04" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis05" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis05a" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis06" ) + || FStrEq( STRING( gpGlobals->mapname ), "vis_credits" ) ) { - pev->weapons |= ( 1 << WEAPON_SUIT ); + SetBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ) + } + else + { + ClearBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ) + if( !( pev->weapons & ( 1 << WEAPON_SUIT ) ) || pev->armorvalue == 0 ) + { + SetBits( m_iHideHUD, HIDEHUD_SUIT ) + } } if( m_iHideHUD != m_iClientHideHUD ) diff --git a/dlls/visitors/kevlar.cpp b/dlls/visitors/kevlar.cpp index 886dc930..89a956d0 100644 --- a/dlls/visitors/kevlar.cpp +++ b/dlls/visitors/kevlar.cpp @@ -40,25 +40,20 @@ class CItemKevlar : public CItem BOOL MyTouch(CBasePlayer *pPlayer) { if (pPlayer->pev->deadflag != DEAD_NO) - { return FALSE; - } - if ((pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY) && - (pPlayer->pev->weapons & (1 << WEAPON_SUIT))) - { - pPlayer->pev->armorvalue += MAX_NORMAL_BATTERY; - pPlayer->pev->armorvalue = Q_min(pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY); + if( !( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) + pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ) - EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "player/kevlar_zipper.wav", 1, ATTN_NORM); + pPlayer->pev->armorvalue = MAX_NORMAL_BATTERY; - MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev); - WRITE_STRING(STRING(pev->classname)); - MESSAGE_END(); + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "player/kevlar_zipper.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 100, 150 ) ); - return TRUE; - } - return FALSE; + MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev ); + WRITE_STRING( STRING( pev->classname ) ); + MESSAGE_END(); + + return TRUE; } }; diff --git a/dlls/weapons.h b/dlls/weapons.h index 3b9a2ac9..d0394bb4 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -80,7 +80,7 @@ public: #define WEAPON_SNARK 15 #define WEAPON_SNIPER 16 #define WEAPON_PIPE 17 -#define WEAPON_FLASHLIGHT 30 +#define WEAPON_FLASHLIGHT 18 #define WEAPON_ALLWEAPONS (~(1<