Skip to content

Commit 85e657e

Browse files
committed
Add SendHUDAnimation input
1 parent 6cc2937 commit 85e657e

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

sp/src/game/client/clientmode_shared.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ static void __MsgFunc_VGUIMenu( bf_read &msg )
282282
gViewPortInterface->ShowPanel( viewport, bShow );
283283
}
284284

285+
#ifdef MAPBASE
286+
static void __MsgFunc_HudAnim( bf_read &msg )
287+
{
288+
char animname[128];
289+
msg.ReadString( animname, sizeof( animname ) );
290+
291+
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( animname );
292+
}
293+
#endif
294+
285295
//-----------------------------------------------------------------------------
286296
// Purpose:
287297
//-----------------------------------------------------------------------------
@@ -387,6 +397,9 @@ void ClientModeShared::Init()
387397

388398
HOOK_MESSAGE( VGUIMenu );
389399
HOOK_MESSAGE( Rumble );
400+
#ifdef MAPBASE
401+
HOOK_MESSAGE( HudAnim );
402+
#endif
390403
}
391404

392405

sp/src/game/server/player.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ BEGIN_DATADESC( CBasePlayer )
473473
DEFINE_INPUTFUNC( FIELD_STRING, "HandleMapEvent", InputHandleMapEvent ),
474474
#ifdef MAPBASE
475475
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetSuppressAttacks", InputSetSuppressAttacks ),
476+
DEFINE_INPUTFUNC( FIELD_STRING, "SendHUDAnimation", InputSendHUDAnimation ),
476477
#endif
477478

478479
DEFINE_FIELD( m_nNumCrouches, FIELD_INTEGER ),
@@ -9624,6 +9625,20 @@ void CBasePlayer::InputSetSuppressAttacks( inputdata_t &inputdata )
96249625
AddSpawnFlags( SF_PLAYER_SUPPRESS_FIRING ) :
96259626
RemoveSpawnFlags( SF_PLAYER_SUPPRESS_FIRING );
96269627
}
9628+
9629+
//-----------------------------------------------------------------------------
9630+
// Purpose:
9631+
// Input : &inputdata -
9632+
//-----------------------------------------------------------------------------
9633+
void CBasePlayer::InputSendHUDAnimation( inputdata_t &inputdata )
9634+
{
9635+
CSingleUserRecipientFilter filter( this );
9636+
filter.MakeReliable();
9637+
9638+
UserMessageBegin( filter, "HudAnim" );
9639+
WRITE_STRING( inputdata.value.String() ); // anim name
9640+
MessageEnd();
9641+
}
96279642
#endif
96289643

96299644
//-----------------------------------------------------------------------------

sp/src/game/server/player.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ class CBasePlayer : public CBaseCombatCharacter
827827
void InputHandleMapEvent( inputdata_t &inputdata );
828828
#ifdef MAPBASE
829829
void InputSetSuppressAttacks( inputdata_t &inputdata );
830+
void InputSendHUDAnimation( inputdata_t &inputdata );
830831
#endif
831832

832833
surfacedata_t *GetSurfaceData( void ) { return m_pSurfaceData; }

sp/src/game/shared/mapbase/mapbase_usermessages.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ void HookMapbaseUserMessages( void )
2222
//HOOK_MESSAGE( ScriptMsg ); // Hooked in CNetMsgScriptHelper
2323

2424
//HOOK_MESSAGE( ShowMenuComplex ); // Hooked in CHudMenu
25+
26+
//HOOK_MESSAGE( HudAnim ); // Hooked in ClientModeShared
2527
}
2628
#endif
2729

@@ -32,6 +34,8 @@ void RegisterMapbaseUserMessages( void )
3234

3335
usermessages->Register( "ShowMenuComplex", -1 ); // CHudMenu
3436

37+
usermessages->Register( "HudAnim", -1 ); // ClientModeShared
38+
3539
#ifdef CLIENT_DLL
3640
// TODO: Better placement?
3741
HookMapbaseUserMessages();

0 commit comments

Comments
 (0)