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/shared/script_intro_shared.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'game/shared/script_intro_shared.cpp')
| -rw-r--r-- | game/shared/script_intro_shared.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/game/shared/script_intro_shared.cpp b/game/shared/script_intro_shared.cpp new file mode 100644 index 0000000..a96e9dd --- /dev/null +++ b/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; +} |