@@ -209,7 +209,7 @@ CameraState Camera::InterpolateStates(float time) {
209209 LAST };
210210
211211 // reading 4 frames closest to time
212- float frameTime = time * 60 . 0f ;
212+ float frameTime = time * sar. game -> Tickrate () ;
213213 int frames[4 ] = {INT_MIN, INT_MIN, INT_MAX, INT_MAX};
214214 for (auto const &state : camera->states ) {
215215 int stateTime = state.first ;
@@ -285,7 +285,7 @@ void Camera::DrawInWorld() const {
285285 MeshId mesh_cams = OverlayRender::createMesh (RenderCallback::none, RenderCallback::constant ({ 255 , 0 , 0 }, true ));
286286 MeshId mesh_currentCam = OverlayRender::createMesh (RenderCallback::none, RenderCallback::constant ({ 255 , 255 , 0 }, true ));
287287
288- float frameTime = 1 .0f / 60 ;
288+ float frameTime = 1 .0f / 30 ; // don't draw a line for every frame, that's just too much
289289 int maxTimeTicks = 0 ;
290290 int minTimeTicks = INT_MAX;
291291 for (auto const &state : camera->states ) {
@@ -294,8 +294,8 @@ void Camera::DrawInWorld() const {
294294 }
295295
296296 // changing in-game ticks to seconds.
297- float maxTime = maxTimeTicks * frameTime ;
298- float minTime = minTimeTicks * frameTime ;
297+ float maxTime = maxTimeTicks * engine-> GetIPT () ;
298+ float minTime = minTimeTicks * engine-> GetIPT () ;
299299
300300 // for each frame, calculate interpolated path
301301 Vector pos = camera->InterpolateStates (minTime).origin ;
@@ -348,24 +348,7 @@ void Camera::DrawInWorld() const {
348348 );
349349
350350 Vector forward, right, up;
351- float cp, sp, cy, sy, cr, sr;
352- cp = cosf (DEG2RAD (state.angles .x ));
353- sp = sinf (DEG2RAD (state.angles .x ));
354- cy = cosf (DEG2RAD (state.angles .y ));
355- sy = sinf (DEG2RAD (state.angles .y ));
356- cr = cosf (DEG2RAD (state.angles .z ));
357- sr = sinf (DEG2RAD (state.angles .z ));
358-
359- forward.x = cp * cy;
360- forward.y = cp * sy;
361- forward.z = -sp;
362-
363- right.x = (-1 * sr * sp * cy + -1 * cr * -sy);
364- right.y = (-1 * sr * sp * sy + -1 * cr * cy);
365- right.z = -1 * sr * cp;
366-
367- up = right.Cross (forward);
368-
351+ Math::AngleVectors (state.angles , &forward, &right, &up);
369352
370353 float fovScalar = tanf (DEG2RAD (state.fov / 2 ));
371354
@@ -405,7 +388,7 @@ void Camera::OverrideView(CViewSetup *m_View) {
405388 }
406389
407390 if (timeOffsetRefreshRequested) {
408- timeOffset = engine->GetClientTime () - engine->demoplayer ->GetTick () / 60 . 0f ;
391+ timeOffset = engine->GetClientTime () - engine->demoplayer ->GetTick () * engine-> GetIPT () ;
409392 timeOffsetRefreshRequested = false ;
410393 }
411394
@@ -839,7 +822,7 @@ CON_COMMAND(sar_cam_path_goto, "sar_cam_path_goto <frame> [skipto] - sends the c
839822 return console->Print (" This frame does not exist.\n " );
840823 }
841824
842- camera->currentState = camera->InterpolateStates (i * ( 1 . 0f / 60 ));
825+ camera->currentState = camera->InterpolateStates (i * engine-> GetIPT ( ));
843826
844827 if (args.ArgC () == 3 && std::atoi (args[2 ]) == 1 ) {
845828 if (engine->demoplayer ->IsPlaying ()) {
@@ -904,8 +887,8 @@ CON_COMMAND(sar_cam_path_export,
904887 }
905888
906889 // changing in-game ticks to seconds.
907- float maxTime = maxTimeTicks / 60 . 0f ;
908- float minTime = minTimeTicks / 60 . 0f ;
890+ float maxTime = maxTimeTicks * engine-> GetIPT () ;
891+ float minTime = minTimeTicks * engine-> GetIPT () ;
909892
910893 if (daVinci) file << " C={\n " ;
911894
0 commit comments