diff --git a/framework2/include/data/ObjectData.hpp b/framework2/include/data/ObjectData.hpp index 4d84c4a5..4391827a 100644 --- a/framework2/include/data/ObjectData.hpp +++ b/framework2/include/data/ObjectData.hpp @@ -16,6 +16,9 @@ struct ObjectData int32_t flags; bool LOD; + short timeOn; + short timeOff; + enum { WET = 1, /// Render with a wet effect NIGHTONLY = 1 << 1, /// Render only during the night diff --git a/framework2/src/engine/GameWorld.cpp b/framework2/src/engine/GameWorld.cpp index 296e3f62..78f3a327 100644 --- a/framework2/src/engine/GameWorld.cpp +++ b/framework2/src/engine/GameWorld.cpp @@ -125,7 +125,7 @@ bool GameWorld::placeItems(const std::string& name) for( size_t i = 0; i < ipll.m_instances.size(); ++i) { std::shared_ptr inst = ipll.m_instances[i]; if(! createInstance(inst->id, inst->pos, inst->rot)) { - std::cerr << "No object for instance " << inst->id << " (" << path << ")" << std::endl; + std::cerr << "No object for instance " << inst->id << " Model: " << inst->model << " (" << path << ")" << std::endl; } } diff --git a/framework2/src/loaders/LoaderIDE.cpp b/framework2/src/loaders/LoaderIDE.cpp index 164941da..7a8ecbea 100644 --- a/framework2/src/loaders/LoaderIDE.cpp +++ b/framework2/src/loaders/LoaderIDE.cpp @@ -47,7 +47,8 @@ bool LoaderIDE::load(const std::string &filename) std::stringstream strstream(line); switch (section) { - case OBJS: { // Supports Type 1, 2 and 3 + case OBJS: + case TOBJ: { // Supports Type 1, 2 and 3 std::shared_ptr objs(new ObjectData); std::string id, numClumps, flags, @@ -67,6 +68,18 @@ bool LoaderIDE::load(const std::string &filename) } getline(strstream, flags, ','); + + // Keep reading TOBJ data + if(section == LoaderIDE::TOBJ) { + std::string buff; + getline(strstream, buff, ','); + objs->timeOn = atoi(buff.c_str()); + getline(strstream, buff, ','); + objs->timeOff = atoi(buff.c_str()); + } + else { + objs->timeOff = objs->timeOn = 0; + } // Put stuff in our struct objs->ID = atoi(id.c_str()); diff --git a/framework2/src/render/GTARenderer.cpp b/framework2/src/render/GTARenderer.cpp index 0c378bbd..64fa6bc1 100644 --- a/framework2/src/render/GTARenderer.cpp +++ b/framework2/src/render/GTARenderer.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -288,8 +289,12 @@ void GTARenderer::renderWorld() for(size_t i = 0; i < engine->objectInstances.size(); ++i) { GTAInstance& inst = *engine->objectInstances[i]; - if(((inst.object->flags & ObjectData::NIGHTONLY) | (inst.object->flags & ObjectData::DAYONLY)) != 0) { - //continue; + if(inst.object->timeOn != inst.object->timeOff) { + // Update rendering flags. + if(engine->getHour() < inst.object->timeOn + && engine->getHour() > inst.object->timeOff) { + continue; + } } if(!inst.model) diff --git a/viewer/main.cpp b/viewer/main.cpp index cd83067f..5291f453 100644 --- a/viewer/main.cpp +++ b/viewer/main.cpp @@ -384,6 +384,12 @@ void handleCommandEvent(sf::Event &event) case sf::Keyboard::F9: command("object-info"); break; + case sf::Keyboard::LBracket: + gta->gameTime -= 60.f; + break; + case sf::Keyboard::RBracket: + gta->gameTime += 60.f; + break; break; default: break; }