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