From 37608ee1f62882f4fd35b28a3e45d1452d48cf71 Mon Sep 17 00:00:00 2001 From: Elinsrc Date: Sat, 2 Nov 2024 21:05:56 +0500 Subject: [PATCH] Added: hud_longjump and hud_splash --- cl_dll/CMakeLists.txt | 2 + cl_dll/ui/hud/OpenAG/hud_longjump.cpp | 63 +++++++++++++++++++++++ cl_dll/ui/hud/OpenAG/hud_longjump.h | 17 ++++++ cl_dll/ui/hud/OpenAG/hud_splash.cpp | 74 +++++++++++++++++++++++++++ cl_dll/ui/hud/OpenAG/hud_splash.h | 18 +++++++ cl_dll/ui/hud/hud.cpp | 4 ++ cl_dll/ui/hud/hud.h | 4 ++ 7 files changed, 182 insertions(+) create mode 100644 cl_dll/ui/hud/OpenAG/hud_longjump.cpp create mode 100644 cl_dll/ui/hud/OpenAG/hud_longjump.h create mode 100644 cl_dll/ui/hud/OpenAG/hud_splash.cpp create mode 100644 cl_dll/ui/hud/OpenAG/hud_splash.h diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index c267fb0..092daff 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -131,6 +131,8 @@ set (CLDLL_SOURCES ui/hud/OpenAG/hud_suddendeath.cpp ui/hud/OpenAG/hud_timeout.cpp ui/hud/OpenAG/hud_vote.cpp + ui/hud/OpenAG/hud_splash.cpp + ui/hud/OpenAG/hud_longjump.cpp cdll_int.cpp com_weapons.cpp demo.cpp diff --git a/cl_dll/ui/hud/OpenAG/hud_longjump.cpp b/cl_dll/ui/hud/OpenAG/hud_longjump.cpp new file mode 100644 index 0000000..1f364d3 --- /dev/null +++ b/cl_dll/ui/hud/OpenAG/hud_longjump.cpp @@ -0,0 +1,63 @@ +//++ BulliT + +#include "hud.h" +#include "cl_util.h" +#include +#include +#include +#include "parsemsg.h" + +DECLARE_MESSAGE(m_Longjump, Longjump ) + +int CHudLongjump::Init(void) +{ + HOOK_MESSAGE( Longjump ); + + m_flTurnoff = 0; + m_iFlags = 0; + + gHUD.AddHudElem(this); + + return 1; +} + +int CHudLongjump::VidInit(void) +{ + return 1; +} + +void CHudLongjump::Reset(void) +{ + m_iFlags &= ~HUD_ACTIVE; +} + +int CHudLongjump::Draw(float fTime) +{ + if ( m_flTurnoff < gHUD.m_flTime || gHUD.m_iIntermission ) + { + Reset(); + return 1; + } + + char szText[32]; + int r, g, b; + UnpackRGB(r, g, b, gHUD.m_iDefaultHUDColor); + sprintf(szText,"Longjump %d",(int)(m_flTurnoff - gHUD.m_flTime)); + gHUD.DrawHudStringCentered(ScreenWidth / 2, gHUD.m_scrinfo.iCharHeight * 2, szText, r, g, b ); + + return 0; +} + + +int CHudLongjump::MsgFunc_Longjump(const char *pszName, int iSize, void *pbuf) +{ + BEGIN_READ( pbuf, iSize ); + int iTime = READ_BYTE(); + + m_flTurnoff = gHUD.m_flTime + iTime; + m_iFlags |= HUD_ACTIVE; + + return 1; +} + +//-- Martin Webrant diff --git a/cl_dll/ui/hud/OpenAG/hud_longjump.h b/cl_dll/ui/hud/OpenAG/hud_longjump.h new file mode 100644 index 0000000..e05e811 --- /dev/null +++ b/cl_dll/ui/hud/OpenAG/hud_longjump.h @@ -0,0 +1,17 @@ +//++ BulliT +#pragma once + +class CHudLongjump: public CHudBase +{ +public: + int Init( void ); + int VidInit( void ); + int Draw(float flTime); + void Reset(void); + int MsgFunc_Longjump(const char *pszName, int iSize, void *pbuf); + +private: + float m_flTurnoff; +}; + +//-- Martin Webrant diff --git a/cl_dll/ui/hud/OpenAG/hud_splash.cpp b/cl_dll/ui/hud/OpenAG/hud_splash.cpp new file mode 100644 index 0000000..90457a4 --- /dev/null +++ b/cl_dll/ui/hud/OpenAG/hud_splash.cpp @@ -0,0 +1,74 @@ +//++ BulliT + +#include "hud.h" +#include "cl_util.h" +#include +#include +#include +#include "parsemsg.h" + +DECLARE_MESSAGE(m_Splash, Splash ) + +int CHudSplash::Init(void) +{ + HOOK_MESSAGE( Splash ); + + m_flTurnoff = 0.0; + m_iFlags = 0; + gHUD.AddHudElem(this); + + return 1; +} + +int CHudSplash::VidInit(void) +{ + m_hSprite = SPR_Load("sprites/ag_splash.spr"); + return 1; +} + +void CHudSplash::Reset(void) +{ + m_iFlags &= ~HUD_ACTIVE; +} + +#define RGB_WHITEISH 0x00FFFFFF //255,255,255 + +int CHudSplash::Draw(float fTime) +{ + if (m_flTurnoff < gHUD.m_flTime || 0 == m_hSprite) + { + Reset(); + return 1; + } + + int r, g, b, x, y; + + UnpackRGB(r,g,b, RGB_WHITEISH); + ScaleColors(r, g, b, 255); + SPR_Set(m_hSprite, r, g, b ); + + // This should show up to the top right corner + y = SPR_Height(m_hSprite,0); + x = ScreenWidth - SPR_Width(m_hSprite,0); + SPR_DrawHoles( 0, x, y, NULL); + + return 0; +} + +int CHudSplash::MsgFunc_Splash(const char *pszName, int iSize, void *pbuf) +{ + BEGIN_READ( pbuf, iSize ); + + // update data + int iTime = READ_BYTE(); + m_flTurnoff = gHUD.m_flTime + iTime; + m_iFlags |= HUD_ACTIVE; + + if (iTime > 0) + m_iFlags |= HUD_ACTIVE; + else + m_iFlags &= ~HUD_ACTIVE; + return 1; +} + +//-- Martin Webrant diff --git a/cl_dll/ui/hud/OpenAG/hud_splash.h b/cl_dll/ui/hud/OpenAG/hud_splash.h new file mode 100644 index 0000000..7f2cd96 --- /dev/null +++ b/cl_dll/ui/hud/OpenAG/hud_splash.h @@ -0,0 +1,18 @@ +//++ BulliT +#pragma once + +class CHudSplash: public CHudBase +{ +public: + int Init( void ); + int VidInit( void ); + int Draw(float flTime); + void Reset(void); + int MsgFunc_Splash(const char *pszName, int iSize, void *pbuf); + +private: + float m_flTurnoff; + HSPRITE m_hSprite; +}; + +//-- Martin Webrant diff --git a/cl_dll/ui/hud/hud.cpp b/cl_dll/ui/hud/hud.cpp index 9153516..dfdc1e9 100644 --- a/cl_dll/ui/hud/hud.cpp +++ b/cl_dll/ui/hud/hud.cpp @@ -562,6 +562,8 @@ void CHud::Init( void ) m_SuddenDeath.Init(); m_Timeout.Init(); m_Vote.Init(); + m_Splash.Init(); + m_Longjump.Init(); #if USE_VGUI GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort); #endif @@ -768,6 +770,8 @@ void CHud::VidInit( void ) m_SuddenDeath.VidInit(); m_Timeout.VidInit(); m_Vote.VidInit(); + m_Splash.VidInit(); + m_Longjump.VidInit(); #if USE_VGUI GetClientVoiceMgr()->VidInit(); #endif diff --git a/cl_dll/ui/hud/hud.h b/cl_dll/ui/hud/hud.h index 5976b8d..c39571d 100644 --- a/cl_dll/ui/hud/hud.h +++ b/cl_dll/ui/hud/hud.h @@ -114,6 +114,8 @@ struct HUDLIST #include "hud_suddendeath.h" #include "hud_timeout.h" #include "hud_vote.h" +#include "hud_splash.h" +#include "hud_longjump.h" // //----------------------------------------------------- // @@ -686,6 +688,8 @@ class CHud CHudSuddenDeath m_SuddenDeath; CHudTimeout m_Timeout; CHudVote m_Vote; + CHudSplash m_Splash; + CHudLongjump m_Longjump; #if !USE_VGUI || USE_NOVGUI_SCOREBOARD CHudScoreboard m_Scoreboard; #endif