From a56b25d4cd1d12047ad963a4a66da58f2fec89de Mon Sep 17 00:00:00 2001 From: Mischa Aster Alff Date: Sun, 28 Aug 2016 14:32:34 +0200 Subject: [PATCH] Change default object timeOff from 0 to 24 Remove now-useless check in ObjectRenderer --- rwengine/src/loaders/LoaderIDE.cpp | 3 ++- rwengine/src/render/ObjectRenderer.cpp | 17 +++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/rwengine/src/loaders/LoaderIDE.cpp b/rwengine/src/loaders/LoaderIDE.cpp index e13f824e..f91c9e59 100644 --- a/rwengine/src/loaders/LoaderIDE.cpp +++ b/rwengine/src/loaders/LoaderIDE.cpp @@ -81,7 +81,8 @@ bool LoaderIDE::load(const std::string &filename) objs->timeOff = atoi(buff.c_str()); } else { - objs->timeOff = objs->timeOn = 0; + objs->timeOn = 0; + objs->timeOff = 24; } // Put stuff in our struct diff --git a/rwengine/src/render/ObjectRenderer.cpp b/rwengine/src/render/ObjectRenderer.cpp index 24e03aa9..211b7e90 100644 --- a/rwengine/src/render/ObjectRenderer.cpp +++ b/rwengine/src/render/ObjectRenderer.cpp @@ -198,17 +198,14 @@ void ObjectRenderer::renderInstance(InstanceObject *instance, // Handles times provided by TOBJ data - if (instance->object->timeOn != 0 || instance->object->timeOff != 0) + const auto currentHour = m_world->getHour(); + if (instance->object->timeOff < instance->object->timeOn) { - const auto currentHour = m_world->getHour(); - if (instance->object->timeOff < instance->object->timeOn) - { - if ( currentHour >= instance->object->timeOff && currentHour < instance->object->timeOn ) - return; - } else { - if ( currentHour >= instance->object->timeOff || currentHour < instance->object->timeOn ) - return; - } + if ( currentHour >= instance->object->timeOff && currentHour < instance->object->timeOn ) + return; + } else { + if ( currentHour >= instance->object->timeOff || currentHour < instance->object->timeOn ) + return; } auto matrixModel = instance->getTimeAdjustedTransform(m_renderAlpha);