diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/shared/script_intro_shared.cpp | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/shared/script_intro_shared.cpp')
| -rw-r--r-- | sp/src/game/shared/script_intro_shared.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sp/src/game/shared/script_intro_shared.cpp b/sp/src/game/shared/script_intro_shared.cpp new file mode 100644 index 00000000..e8659f7c --- /dev/null +++ b/sp/src/game/shared/script_intro_shared.cpp @@ -0,0 +1,39 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+#include "cbase.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Calculate the FOV for the intro sequence (needed by both server and client)
+//-----------------------------------------------------------------------------
+float ScriptInfo_CalculateFOV( float flFOVBlendStartTime, float flNextFOVBlendTime, int nFOV, int nNextFOV, bool bSplineRamp )
+{
+ // Handle the spline case
+ if ( bSplineRamp )
+ {
+ //If we're past the zoom time, just take the new value and stop transitioning
+ float deltaTime = (float)( gpGlobals->curtime - flFOVBlendStartTime ) / ( flNextFOVBlendTime - flFOVBlendStartTime );
+ if ( deltaTime >= 1.0f )
+ return nNextFOV;
+
+ float flResult = SimpleSplineRemapVal( deltaTime, 0.0f, 1.0f, (float) nFOV, (float) nNextFOV );
+
+ // Msg("FOV BLENDING: curtime %.2f StartedAt %.2f FinishAt: %.2f\n", gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime );
+ // Msg(" Perc: %.2f Start: %d End: %d FOV: %.2f\n", SimpleSplineRemapVal( deltaTime, 0.0f, 1.0f, nFOV, nNextFOV ), nFOV, nNextFOV, flResult );
+
+ return flResult;
+ }
+
+ // Common, linear blend
+ if ( (flNextFOVBlendTime - flFOVBlendStartTime) != 0 )
+ {
+ float flResult = RemapValClamped( gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime, (float) nFOV, (float) nNextFOV );
+
+ // Msg("FOV BLENDING: curtime %.2f StartedAt %.2f FinishAt: %.2f\n", gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime );
+ // Msg(" Perc: %.2f Start: %d End: %d FOV: %.2f\n", RemapValClamped( gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime, 0.0, 1.0 ), nFOV, nNextFOV, flResult );
+
+ return flResult;
+ }
+
+
+ // Msg("FOV BLENDING: JUMPED TO NEXT FOV (%d)\n", nNextFOV );
+ return nNextFOV;
+}
|