diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf/tf_taunt_prop.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/tf/tf_taunt_prop.cpp')
| -rw-r--r-- | game/server/tf/tf_taunt_prop.cpp | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/game/server/tf/tf_taunt_prop.cpp b/game/server/tf/tf_taunt_prop.cpp new file mode 100644 index 0000000..8eb0fc5 --- /dev/null +++ b/game/server/tf/tf_taunt_prop.cpp @@ -0,0 +1,107 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Play VCD on taunt prop +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" + +#include "basecombatcharacter.h" +#include "choreoevent.h" +#include "sceneentity.h" + +#include "tf_taunt_prop.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +IMPLEMENT_SERVERCLASS_ST( CTFTauntProp, DT_TFTauntProp ) +END_SEND_TABLE() + +LINK_ENTITY_TO_CLASS( tf_taunt_prop, CTFTauntProp ); + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CTFTauntProp::CTFTauntProp() +{ + UseClientSideAnimation(); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTFTauntProp::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, CChoreoEvent *event, CChoreoActor *actor, CBaseEntity *pTarget ) +{ + switch ( event->GetType() ) + { + case CChoreoEvent::SEQUENCE: + case CChoreoEvent::GESTURE: + { + // Get the (gesture) sequence. + info->m_nSequence = LookupSequence( event->GetParameters() ); + if ( info->m_nSequence < 0 ) + return false; + + SetSequence( info->m_nSequence ); + SetPlaybackRate( 1.0f ); + SetCycle( 0 ); + ResetSequenceInfo(); + + if ( IsUsingClientSideAnimation() ) + { + ResetClientsideFrame(); + } + + return true; + } + default: + return BaseClass::StartSceneEvent( info, scene, event, actor, pTarget ); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CTFTauntProp::ProcessSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, CChoreoEvent *event ) +{ + // Only process sequences + if ( event->GetType() != CChoreoEvent::SEQUENCE ) + return false; + + return BaseClass::ProcessSceneEvent( info, scene, event ); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +float CTFTauntProp::PlayScene( const char *pszScene, float flDelay /*= 0.0f*/, AI_Response *response /*= NULL*/, IRecipientFilter *filter /*= NULL*/ ) +{ + if ( m_hScene.Get() ) + { + StopScriptedScene( this, m_hScene ); + m_hScene = NULL; + } + + MDLCACHE_CRITICAL_SECTION(); + + return InstancedScriptedScene( this, pszScene, &m_hScene, flDelay, false, response, true, filter ); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CTFTauntProp::UpdateOnRemove() +{ + if ( m_hScene.Get() ) + { + StopScriptedScene( this, m_hScene ); + m_hScene = NULL; + } + + BaseClass::UpdateOnRemove(); +} |