MP1: Convert MP1_VARIABLE_DELTA_TIME to cvar

This commit is contained in:
Luke Street 2020-04-14 14:40:49 -04:00
parent 3c8ce3dc99
commit 94be460a1b
3 changed files with 11 additions and 15 deletions

View File

@ -74,6 +74,7 @@ namespace hecl {
extern CVar* com_enableCheats; extern CVar* com_enableCheats;
extern CVar* com_developer; extern CVar* com_developer;
extern CVar* com_cubemaps; extern CVar* com_cubemaps;
extern CVar* com_variableDt;
}; // namespace hecl }; // namespace hecl
namespace urde::MP1 { namespace urde::MP1 {
@ -838,7 +839,7 @@ bool CMain::Proc() {
} }
float dt = 1 / 60.f; float dt = 1 / 60.f;
#if MP1_VARIABLE_DELTA_TIME if (hecl::com_variableDt->toBoolean()) {
auto now = delta_clock::now(); auto now = delta_clock::now();
if (m_firstFrame) { if (m_firstFrame) {
m_firstFrame = false; m_firstFrame = false;
@ -847,7 +848,7 @@ bool CMain::Proc() {
dt = std::min(std::chrono::duration_cast<delta_duration>(now - m_prevFrameTime).count(), 1 / 30.f); dt = std::min(std::chrono::duration_cast<delta_duration>(now - m_prevFrameTime).count(), 1 / 30.f);
} }
m_prevFrameTime = now; m_prevFrameTime = now;
#endif }
m_console->proc(); m_console->proc();
if (!m_console->isOpen()) { if (!m_console->isOpen()) {

View File

@ -3,9 +3,6 @@
#ifndef MP1_USE_BOO #ifndef MP1_USE_BOO
#define MP1_USE_BOO 0 #define MP1_USE_BOO 0
#endif #endif
#ifndef MP1_VARIABLE_DELTA_TIME
#define MP1_VARIABLE_DELTA_TIME 0
#endif
#include "IMain.hpp" #include "IMain.hpp"
#include "CTweaks.hpp" #include "CTweaks.hpp"
@ -250,11 +247,9 @@ private:
bool m_loadedPersistentResources = false; bool m_loadedPersistentResources = false;
bool m_doQuit = false; bool m_doQuit = false;
#if MP1_VARIABLE_DELTA_TIME
bool m_firstFrame = true; bool m_firstFrame = true;
using delta_clock = std::chrono::high_resolution_clock; using delta_clock = std::chrono::high_resolution_clock;
std::chrono::time_point<delta_clock> m_prevFrameTime; std::chrono::time_point<delta_clock> m_prevFrameTime;
#endif
void InitializeSubsystems(); void InitializeSubsystems();
static void InitializeDiscord(); static void InitializeDiscord();

2
hecl

@ -1 +1 @@
Subproject commit f64ed44fe8164b06ed5bef6344d9f743e2c5d638 Subproject commit 90366475c1d45b53f080f57dd7e5626145fdd649