parent
4ece4a6c00
commit
0313a308d8
@ -72,6 +72,7 @@ MainLoop::MainLoop(unsigned parent_pid)
|
||||
m_curr_time = 0;
|
||||
m_prev_time = 0;
|
||||
m_throttle_fps = true;
|
||||
m_allow_large_dt = false;
|
||||
m_frame_before_loading_world = false;
|
||||
#ifdef WIN32
|
||||
if (parent_pid != 0)
|
||||
@ -159,8 +160,8 @@ float MainLoop::getLimitedDt()
|
||||
// when the computer can't keep it up, slow down the shown time instead
|
||||
// But this can not be done in networking, otherwise the game time on
|
||||
// client and server will not be in synch anymore
|
||||
if (!NetworkConfig::get()->isNetworking() ||
|
||||
!World::getWorld())
|
||||
if ((!NetworkConfig::get()->isNetworking() || !World::getWorld()) &&
|
||||
!m_allow_large_dt)
|
||||
{
|
||||
/* time 3 internal substeps take */
|
||||
const float MAX_ELAPSED_TIME = 3.0f*1.0f / 60.0f*1000.0f;
|
||||
@ -327,6 +328,7 @@ void MainLoop::run()
|
||||
m_request_abort = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Main loop", 0xFF, 0x00, 0xF7);
|
||||
|
||||
left_over_time += getLimitedDt();
|
||||
|
@ -37,6 +37,9 @@ private:
|
||||
/** True if the frame rate should be throttled. */
|
||||
bool m_throttle_fps;
|
||||
|
||||
/** True if dt is not decreased for low fps */
|
||||
bool m_allow_large_dt;
|
||||
|
||||
bool m_frame_before_loading_world;
|
||||
|
||||
Synchronised<int> m_ticks_adjustment;
|
||||
@ -54,6 +57,7 @@ public:
|
||||
void abort() { m_abort = true; }
|
||||
void requestAbort() { m_request_abort = true; }
|
||||
void setThrottleFPS(bool throttle) { m_throttle_fps = throttle; }
|
||||
void setAllowLargeDt(bool enable) { m_allow_large_dt = enable; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if STK is to be stoppe. */
|
||||
bool isAborted() const { return m_abort; }
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "modes/cutscene_world.hpp"
|
||||
|
||||
#include "main_loop.hpp"
|
||||
#include "animations/animation_base.hpp"
|
||||
#include "animations/three_d_animation.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
@ -71,6 +72,9 @@ CutsceneWorld::CutsceneWorld() : World()
|
||||
*/
|
||||
void CutsceneWorld::init()
|
||||
{
|
||||
// Use real dt even if fps is low. It allows to keep everything synchronized
|
||||
main_loop->setAllowLargeDt(true);
|
||||
|
||||
m_second_reset = false;
|
||||
World::init();
|
||||
|
||||
@ -170,6 +174,7 @@ void CutsceneWorld::init()
|
||||
*/
|
||||
CutsceneWorld::~CutsceneWorld()
|
||||
{
|
||||
main_loop->setAllowLargeDt(false);
|
||||
} // ~CutsceneWorld
|
||||
//-----------------------------------------------------------------------------
|
||||
void CutsceneWorld::reset(bool restart)
|
||||
|
Loading…
Reference in New Issue
Block a user