From 7851be6f738708681f642d305560d7b5215a20a2 Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 27 Oct 2015 10:15:59 +0600 Subject: [PATCH] Add MOTD input --- cl_dll/hud.h | 11 ++++++++--- cl_dll/input.cpp | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 5ebaa45..45ce6ef 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -208,7 +208,7 @@ private: // // REMOVED: Vgui has replaced this. // -/* + class CHudMOTD : public CHudBase { public: @@ -218,14 +218,18 @@ public: void Reset( void ); int MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ); + void Scroll( int dir ); + void Scroll( float amount ); + float scroll; + bool m_bShow; protected: static int MOTD_DISPLAY_TIME; char m_szMOTD[ MAX_MOTD_LENGTH ]; - float m_flActiveRemaining; + int m_iLines; }; -*/ + class CHudScoreboard: public CHudBase { @@ -645,6 +649,7 @@ public: CHudTextMessage m_TextMessage; CHudStatusIcons m_StatusIcons; CHudScoreboard m_Scoreboard; + CHudMOTD m_MOTD; void Init( void ); void VidInit( void ); diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index 6f23ed4..b304950 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -683,8 +683,16 @@ void DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int activ if ( !(in_klook.state & 1 ) ) { - cmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward); - cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back); + if(gHUD.m_MOTD.m_bShow) + { + gHUD.m_MOTD.scroll -= CL_KeyState (&in_forward); + gHUD.m_MOTD.scroll += CL_KeyState (&in_back); + } + else + { + cmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward); + cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back); + } } // adjust for speed key @@ -779,7 +787,10 @@ int CL_ButtonBits( int bResetState ) if ( in_attack.state & 3 ) { - bits |= IN_ATTACK; + if(gHUD.m_MOTD.m_bShow) + gHUD.m_MOTD.Reset(); + else + bits |= IN_ATTACK; } if (in_duck.state & 3)