From ecad39e246475603b7ee55f7df73a77c32b60ba6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2011 20:20:01 +1000 Subject: CGE: Implemented code for game tick --- engines/cge/cge.h | 1 + engines/cge/cge_main.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/engines/cge/cge.h b/engines/cge/cge.h index e4bb260bcc..ba6326726a 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -45,6 +45,7 @@ enum { class CGEEngine : public Engine { private: uint32 _lastFrame; + void tick(); public: CGEEngine(OSystem *syst, const ADGameDescription *gameDescription); ~CGEEngine(); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 33abf7917d..4bb954eaed 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -1537,8 +1537,21 @@ void CGEEngine::mainLoop() { millis = g_system->getMillis(); } _lastFrame = millis; + + // Dispatch the tick to any active objects + tick(); } +void CGEEngine::tick() { + for (Sprite *spr = Vga->ShowQ->First(); spr; spr = spr->_next) { + if (spr->_time) { + if (!spr->_flags._hide) { + if (--spr->_time == 0) + spr->tick(); + } + } + } +} void CGEEngine::loadUser() { // set scene -- cgit v1.2.3