From 4f9353e03f9182f7309c85436b77fc47e3da4141 Mon Sep 17 00:00:00 2001 From: hiker Date: Mon, 5 Mar 2018 17:52:06 +1100 Subject: [PATCH] Reduce camera shaking (caused by camera being updated during rewind). --- src/karts/kart.cpp | 2 ++ src/modes/world.cpp | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 809fbed55..cb737dbfd 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1269,6 +1269,7 @@ void Kart::update(float dt) if(!history->replayHistory() || !history->dontDoPhysics()) m_controller->update(dt); +#ifndef SERVER_ONLY #undef DEBUG_CAMERA_SHAKE #ifdef DEBUG_CAMERA_SHAKE Log::verbose("camera", "%s t %f %f xyz %f %f %f v %f %f %f d3 %f d2 %f", @@ -1280,6 +1281,7 @@ void Kart::update(float dt) (Camera::getCamera(0)->getXYZ()-getXYZ()).length_2d() ); #endif +#endif #undef DEBUG_TO_COMPARE_KART_PHYSICS #ifdef DEBUG_TO_COMPARE_KART_PHYSICS diff --git a/src/modes/world.cpp b/src/modes/world.cpp index e356ebf70..a4ec60767 100644 --- a/src/modes/world.cpp +++ b/src/modes/world.cpp @@ -1002,12 +1002,17 @@ void World::update(float dt) } PROFILER_POP_CPU_MARKER(); - PROFILER_PUSH_CPU_MARKER("World::update (camera)", 0x60, 0x7F, 0x00); - for(unsigned int i=0; iisRewinding()) { - Camera::getCamera(i)->update(dt); - } - PROFILER_POP_CPU_MARKER(); + PROFILER_PUSH_CPU_MARKER("World::update (camera)", 0x60, 0x7F, 0x00); + + for (unsigned int i = 0; i < Camera::getNumCameras(); i++) + { + Camera::getCamera(i)->update(dt); + } + PROFILER_POP_CPU_MARKER(); + } // if !rewind if(race_manager->isRecordingRace()) ReplayRecorder::get()->update(dt); Scripting::ScriptEngine *script_engine = Scripting::ScriptEngine::getInstance();