From 85e657e62bf23ea867d2fd266fe8fe93c1107aee Mon Sep 17 00:00:00 2001 From: Blixibon Date: Tue, 9 Dec 2025 11:05:03 -0600 Subject: [PATCH] Add SendHUDAnimation input --- sp/src/game/client/clientmode_shared.cpp | 13 +++++++++++++ sp/src/game/server/player.cpp | 15 +++++++++++++++ sp/src/game/server/player.h | 1 + .../game/shared/mapbase/mapbase_usermessages.cpp | 4 ++++ 4 files changed, 33 insertions(+) diff --git a/sp/src/game/client/clientmode_shared.cpp b/sp/src/game/client/clientmode_shared.cpp index f2e6e31dc55..11f33b4822d 100644 --- a/sp/src/game/client/clientmode_shared.cpp +++ b/sp/src/game/client/clientmode_shared.cpp @@ -282,6 +282,16 @@ static void __MsgFunc_VGUIMenu( bf_read &msg ) gViewPortInterface->ShowPanel( viewport, bShow ); } +#ifdef MAPBASE +static void __MsgFunc_HudAnim( bf_read &msg ) +{ + char animname[128]; + msg.ReadString( animname, sizeof( animname ) ); + + g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( animname ); +} +#endif + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -387,6 +397,9 @@ void ClientModeShared::Init() HOOK_MESSAGE( VGUIMenu ); HOOK_MESSAGE( Rumble ); +#ifdef MAPBASE + HOOK_MESSAGE( HudAnim ); +#endif } diff --git a/sp/src/game/server/player.cpp b/sp/src/game/server/player.cpp index dad94dea600..0b9fea271b0 100644 --- a/sp/src/game/server/player.cpp +++ b/sp/src/game/server/player.cpp @@ -473,6 +473,7 @@ BEGIN_DATADESC( CBasePlayer ) DEFINE_INPUTFUNC( FIELD_STRING, "HandleMapEvent", InputHandleMapEvent ), #ifdef MAPBASE DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetSuppressAttacks", InputSetSuppressAttacks ), + DEFINE_INPUTFUNC( FIELD_STRING, "SendHUDAnimation", InputSendHUDAnimation ), #endif DEFINE_FIELD( m_nNumCrouches, FIELD_INTEGER ), @@ -9624,6 +9625,20 @@ void CBasePlayer::InputSetSuppressAttacks( inputdata_t &inputdata ) AddSpawnFlags( SF_PLAYER_SUPPRESS_FIRING ) : RemoveSpawnFlags( SF_PLAYER_SUPPRESS_FIRING ); } + +//----------------------------------------------------------------------------- +// Purpose: +// Input : &inputdata - +//----------------------------------------------------------------------------- +void CBasePlayer::InputSendHUDAnimation( inputdata_t &inputdata ) +{ + CSingleUserRecipientFilter filter( this ); + filter.MakeReliable(); + + UserMessageBegin( filter, "HudAnim" ); + WRITE_STRING( inputdata.value.String() ); // anim name + MessageEnd(); +} #endif //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/player.h b/sp/src/game/server/player.h index 9c147c0853d..1606d2be168 100644 --- a/sp/src/game/server/player.h +++ b/sp/src/game/server/player.h @@ -827,6 +827,7 @@ class CBasePlayer : public CBaseCombatCharacter void InputHandleMapEvent( inputdata_t &inputdata ); #ifdef MAPBASE void InputSetSuppressAttacks( inputdata_t &inputdata ); + void InputSendHUDAnimation( inputdata_t &inputdata ); #endif surfacedata_t *GetSurfaceData( void ) { return m_pSurfaceData; } diff --git a/sp/src/game/shared/mapbase/mapbase_usermessages.cpp b/sp/src/game/shared/mapbase/mapbase_usermessages.cpp index f0a71fd410a..bcc4ebbbdae 100644 --- a/sp/src/game/shared/mapbase/mapbase_usermessages.cpp +++ b/sp/src/game/shared/mapbase/mapbase_usermessages.cpp @@ -22,6 +22,8 @@ void HookMapbaseUserMessages( void ) //HOOK_MESSAGE( ScriptMsg ); // Hooked in CNetMsgScriptHelper //HOOK_MESSAGE( ShowMenuComplex ); // Hooked in CHudMenu + + //HOOK_MESSAGE( HudAnim ); // Hooked in ClientModeShared } #endif @@ -32,6 +34,8 @@ void RegisterMapbaseUserMessages( void ) usermessages->Register( "ShowMenuComplex", -1 ); // CHudMenu + usermessages->Register( "HudAnim", -1 ); // ClientModeShared + #ifdef CLIENT_DLL // TODO: Better placement? HookMapbaseUserMessages();