- moved updating lua tasks to end of loop.
- update actors only when scene exist
This commit is contained in:
parent
64714da41e
commit
3fd8dd8533
1 changed files with 19 additions and 17 deletions
16
engine.cpp
16
engine.cpp
|
@ -86,9 +86,6 @@ void Engine::mainLoop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run asynchronous tasks
|
|
||||||
lua_runtasks();
|
|
||||||
|
|
||||||
if (_mode == ENGINE_MODE_SMUSH) {
|
if (_mode == ENGINE_MODE_SMUSH) {
|
||||||
if (g_smush->isPlaying()) {
|
if (g_smush->isPlaying()) {
|
||||||
movieTime_ = g_smush->getMovieTime();
|
movieTime_ = g_smush->getMovieTime();
|
||||||
|
@ -106,13 +103,14 @@ void Engine::mainLoop() {
|
||||||
if (SCREENBLOCKS_GLOBAL)
|
if (SCREENBLOCKS_GLOBAL)
|
||||||
screenBlocksReset();
|
screenBlocksReset();
|
||||||
|
|
||||||
|
if (currScene_ != NULL) {
|
||||||
// Update actor costumes
|
// Update actor costumes
|
||||||
for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
|
for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
|
||||||
Actor *a = *i;
|
Actor *a = *i;
|
||||||
assert(currScene_);
|
if (currScene_ != NULL && a->inSet(currScene_->name()) && a->visible())
|
||||||
if (a->inSet(currScene_->name()) && a->visible())
|
|
||||||
a->update();
|
a->update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_driver->clearScreen();
|
g_driver->clearScreen();
|
||||||
|
|
||||||
|
@ -144,16 +142,17 @@ void Engine::mainLoop() {
|
||||||
|
|
||||||
g_driver->set3DMode();
|
g_driver->set3DMode();
|
||||||
|
|
||||||
if (currScene_ != NULL)
|
if (currScene_ != NULL) {
|
||||||
currScene_->setupCamera();
|
currScene_->setupCamera();
|
||||||
|
|
||||||
// Draw actors
|
// Draw actors
|
||||||
for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
|
for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
|
||||||
Actor *a = *i;
|
Actor *a = *i;
|
||||||
if (a->inSet(currScene_->name()) && a->visible())
|
if (currScene_ != NULL && a->inSet(currScene_->name()) && a->visible())
|
||||||
a->draw();
|
a->draw();
|
||||||
}
|
}
|
||||||
//screenBlocksDrawDebug();
|
//screenBlocksDrawDebug();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
for (text_list_type::iterator i = textObjects_.begin(); i != textObjects_.end(); i++) {
|
for (text_list_type::iterator i = textObjects_.begin(); i != textObjects_.end(); i++) {
|
||||||
|
@ -189,6 +188,9 @@ void Engine::mainLoop() {
|
||||||
timeAccum = 0;
|
timeAccum = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run asynchronous tasks
|
||||||
|
lua_runtasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue