Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.8 KiB

  1. #include "cbase.h"
  2. // NOTE: This has to be the last file included!
  3. #include "tier0/memdbgon.h"
  4. //-----------------------------------------------------------------------------
  5. // Purpose: Calculate the FOV for the intro sequence (needed by both server and client)
  6. //-----------------------------------------------------------------------------
  7. float ScriptInfo_CalculateFOV( float flFOVBlendStartTime, float flNextFOVBlendTime, int nFOV, int nNextFOV, bool bSplineRamp )
  8. {
  9. // Handle the spline case
  10. if ( bSplineRamp )
  11. {
  12. //If we're past the zoom time, just take the new value and stop transitioning
  13. float deltaTime = (float)( gpGlobals->curtime - flFOVBlendStartTime ) / ( flNextFOVBlendTime - flFOVBlendStartTime );
  14. if ( deltaTime >= 1.0f )
  15. return nNextFOV;
  16. float flResult = SimpleSplineRemapVal( deltaTime, 0.0f, 1.0f, (float) nFOV, (float) nNextFOV );
  17. // Msg("FOV BLENDING: curtime %.2f StartedAt %.2f FinishAt: %.2f\n", gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime );
  18. // Msg(" Perc: %.2f Start: %d End: %d FOV: %.2f\n", SimpleSplineRemapVal( deltaTime, 0.0f, 1.0f, nFOV, nNextFOV ), nFOV, nNextFOV, flResult );
  19. return flResult;
  20. }
  21. // Common, linear blend
  22. if ( (flNextFOVBlendTime - flFOVBlendStartTime) != 0 )
  23. {
  24. float flResult = RemapValClamped( gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime, (float) nFOV, (float) nNextFOV );
  25. // Msg("FOV BLENDING: curtime %.2f StartedAt %.2f FinishAt: %.2f\n", gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime );
  26. // Msg(" Perc: %.2f Start: %d End: %d FOV: %.2f\n", RemapValClamped( gpGlobals->curtime, flFOVBlendStartTime, flNextFOVBlendTime, 0.0, 1.0 ), nFOV, nNextFOV, flResult );
  27. return flResult;
  28. }
  29. // Msg("FOV BLENDING: JUMPED TO NEXT FOV (%d)\n", nNextFOV );
  30. return nNextFOV;
  31. }