From 8ad4fa693790cf01b4e3fe8021179a3b6fc78e1f Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 15 Apr 2018 21:40:31 +0500 Subject: [PATCH] Show new HUD elements. --- cl_dll/3wave/CTF_FlagStatus.cpp | 12 +++--- cl_dll/3wave/CTF_HudMessage.cpp | 7 ++-- cl_dll/CMakeLists.txt | 2 + cl_dll/hud.cpp | 4 ++ cl_dll/hud.h | 71 +++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+), 9 deletions(-) diff --git a/cl_dll/3wave/CTF_FlagStatus.cpp b/cl_dll/3wave/CTF_FlagStatus.cpp index ea8cee41..61cbe23f 100644 --- a/cl_dll/3wave/CTF_FlagStatus.cpp +++ b/cl_dll/3wave/CTF_FlagStatus.cpp @@ -26,8 +26,8 @@ #include "pm_materials.h" #include "ref_params.h" #include -#include "vgui_viewport.h" -#include "vgui_ScorePanel.h" +//#include "vgui_viewport.h" +//#include "vgui_ScorePanel.h" #define RED_FLAG_STOLE 1 #define BLUE_FLAG_STOLE 2 @@ -247,10 +247,10 @@ int CHudFlagStatus::MsgFunc_FlagCarrier(const char *pszName, int iSize, void *pb } } - if ( !bRedFlag ) - gViewPort->m_pScoreBoard->m_pImages[ 5 ]->setVisible( false ); - if ( !bBlueFlag ) - gViewPort->m_pScoreBoard->m_pImages[ 4 ]->setVisible( false ); + if ( !bRedFlag ); + //gViewPort->m_pScoreBoard->m_pImages[ 5 ]->setVisible( false ); + if ( !bBlueFlag ); + //gViewPort->m_pScoreBoard->m_pImages[ 4 ]->setVisible( false ); return 1; } diff --git a/cl_dll/3wave/CTF_HudMessage.cpp b/cl_dll/3wave/CTF_HudMessage.cpp index 0d0aa284..0ce94c91 100644 --- a/cl_dll/3wave/CTF_HudMessage.cpp +++ b/cl_dll/3wave/CTF_HudMessage.cpp @@ -60,14 +60,14 @@ char *sBonusStrings[] = DECLARE_MESSAGE(m_Bonus, Bonus) -struct bonus_info_t +typedef struct bonus_info_s { int iSlot; int iType; bool bActive; float flBonusTime; char sPlayerName[64]; -}; +} bonus_info_t; bonus_info_t g_PlayerBonus[MAX_BONUS+1]; @@ -159,9 +159,10 @@ int CHudBonus ::Draw(float flTime ) int CHudBonus::MsgFunc_Bonus(const char *pszName, int iSize, void *pbuf) { + int index; BEGIN_READ( pbuf, iSize ); - for ( int index = 1; index < MAX_BONUS + 1; index++) + for ( index = 1; index < MAX_BONUS + 1; index++) { //Find wich one is not used if ( g_PlayerBonus[ index ].bActive == false ) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 5d4a1ff0..79bfcc3a 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -45,6 +45,8 @@ endif() set (CLDLL_SOURCES + 3wave/CTF_FlagStatus.cpp + 3wave/CTF_HudMessage.cpp dmc/DMC_Teleporters.cpp ev_hldm.cpp ../dlls/dmc/quake_gun.cpp diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 9a852a61..c1d371cf 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -179,6 +179,8 @@ void CHud::Init( void ) m_StatusIcons.Init(); m_MOTD.Init(); m_Scoreboard.Init(); + m_FlagStat.Init(); + m_Bonus.Init(); m_Menu.Init(); @@ -361,6 +363,8 @@ void CHud::VidInit( void ) m_Spectator.VidInit(); m_Scoreboard.VidInit(); m_MOTD.VidInit(); + m_FlagStat.VidInit(); + m_Bonus.VidInit(); } int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf ) diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 88ed5b02..40fc8748 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -343,6 +343,7 @@ struct extra_player_info_t short playerclass; short teamnumber; char teamname[MAX_TEAM_NAME]; + int iHasFlag; }; struct team_info_t @@ -577,6 +578,74 @@ private: icon_sprite_t m_IconList[MAX_ICONSPRITES]; }; +// +//----------------------------------------------------- +// +class CHudFlagStatus : public CHudBase +{ +public: + int Init(); + int VidInit(); + void Reset(); + int Draw( float flTime ); + int MsgFunc_FlagStat( const char *pszName, int iSize, void *pbuf ); + int MsgFunc_RuneStat( const char *pszName, int iSize, void *pbuf ); + int MsgFunc_FlagCarrier( const char *pszName, int iSize, void *pbuf ); + + int iDrawStatus; + int iRedFlagStatus; + int iBlueFlagStatus; + int iRedTeamScore; + int iBlueTeamScore; + +private: + int m_iBlueAtBaseIndex; + int m_iBlueFlagIndex; + int m_iBlueLostIndex; + int m_iBlueStolenIndex; + + int m_iRedAtBaseIndex; + int m_iRedFlagIndex; + int m_iRedLostIndex; + int m_iRedStolenIndex; + + int m_iRune1Index; + int m_iRune2Index; + int m_iRune3Index; + int m_iRune4Index; + int m_iRuneStat; + + HSPRITE m_hBlueFlag; + HSPRITE m_hBlueAtBase; + HSPRITE m_hBlueLost; + HSPRITE m_hBlueStolen; + + HSPRITE m_hRedFlag; + HSPRITE m_hRedAtBase; + HSPRITE m_hRedLost; + HSPRITE m_hRedStolen; + + HSPRITE m_hRune1; + HSPRITE m_hRune2; + HSPRITE m_hRune3; + HSPRITE m_hRune4; +}; + +// +//----------------------------------------------------- +// +class CHudBonus : public CHudBase +{ +public: + int Init(); + int VidInit(); + void Reset(); + int Draw( float flTime ); + int MsgFunc_Bonus( const char *pszName, int iSize, void *pbuf ); + +private: + bool m_bUsedSlot[32]; +}; // //----------------------------------------------------- // @@ -658,6 +727,8 @@ public: CHudStatusIcons m_StatusIcons; CHudScoreboard m_Scoreboard; CHudMOTD m_MOTD; + CHudFlagStatus m_FlagStat; + CHudBonus m_Bonus; void Init( void ); void VidInit( void );