aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/replay/replayperformanceplaybackhandler.cpp
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/client/replay/replayperformanceplaybackhandler.cpp
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/client/replay/replayperformanceplaybackhandler.cpp')
-rw-r--r--mp/src/game/client/replay/replayperformanceplaybackhandler.cpp99
1 files changed, 99 insertions, 0 deletions
diff --git a/mp/src/game/client/replay/replayperformanceplaybackhandler.cpp b/mp/src/game/client/replay/replayperformanceplaybackhandler.cpp
new file mode 100644
index 00000000..1779fdbe
--- /dev/null
+++ b/mp/src/game/client/replay/replayperformanceplaybackhandler.cpp
@@ -0,0 +1,99 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#include "cbase.h"
+
+#if defined( REPLAY_ENABLED )
+
+#include "replayperformanceplaybackhandler.h"
+#include "replay/replaycamera.h"
+#include "replay/vgui/replayperformanceeditor.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include <tier0/memdbgon.h>
+
+//-----------------------------------------------------------------------------
+
+class CReplayPerformancePlaybackHandler : public IReplayPerformancePlaybackHandler
+{
+public:
+ CReplayPerformancePlaybackHandler() {}
+
+private:
+ //
+ // IReplayPerformancePlaybackController
+ //
+ virtual void OnEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex )
+ {
+ ReplayCamera()->SetMode( OBS_MODE_IN_EYE );
+ Editor_UpdateCameraModeIcon( CAM_FIRST );
+ }
+
+ virtual void OnEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex )
+ {
+ ReplayCamera()->SetMode( OBS_MODE_CHASE );
+ Editor_UpdateCameraModeIcon( CAM_THIRD );
+ }
+
+ virtual void OnEvent_Camera_Change_Free( float flTime )
+ {
+ ReplayCamera()->SetMode( OBS_MODE_ROAMING );
+ Editor_UpdateCameraModeIcon( CAM_FREE );
+ }
+
+ virtual void OnEvent_Camera_ChangePlayer( float flTime, int nEntIndex )
+ {
+ ReplayCamera()->SetPrimaryTarget( nEntIndex );
+ }
+
+ virtual void OnEvent_Camera_SetView( const SetViewParams_t &params )
+ {
+ ReplayCamera()->OverrideView( params.m_pOrigin, params.m_pAngles, params.m_flFov );
+ Editor_UpdateFreeCamSettings( params );
+ }
+
+ virtual void OnEvent_TimeScale( float flTime, float flScale )
+ {
+ // Update the slider position
+ Editor_UpdateTimeScale( flScale );
+ }
+
+ // ---
+
+ void Editor_UpdateCameraModeIcon( CameraMode_t nMode )
+ {
+ CReplayPerformanceEditorPanel *pEditor = ReplayUI_GetPerformanceEditor();
+ if ( !pEditor )
+ return;
+
+ pEditor->UpdateCameraSelectionPosition( nMode );
+ }
+
+ void Editor_UpdateFreeCamSettings( const SetViewParams_t &params )
+ {
+ CReplayPerformanceEditorPanel *pEditor = ReplayUI_GetPerformanceEditor();
+ if ( !pEditor )
+ return;
+
+ pEditor->UpdateFreeCamSettings( params );
+ }
+
+ void Editor_UpdateTimeScale( float flScale )
+ {
+ CReplayPerformanceEditorPanel *pEditor = ReplayUI_GetPerformanceEditor();
+ if ( !pEditor )
+ return;
+
+ pEditor->UpdateTimeScale( flScale );
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+CReplayPerformancePlaybackHandler s_ReplayPerformancePlaybackHandler;
+IReplayPerformancePlaybackHandler *g_pReplayPerformancePlaybackHandler = &s_ReplayPerformancePlaybackHandler;
+
+//-----------------------------------------------------------------------------
+
+#endif \ No newline at end of file