diff options
Diffstat (limited to 'engines/sci/gui')
-rw-r--r-- | engines/sci/gui/gui.cpp | 32 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 5 | ||||
-rw-r--r-- | engines/sci/gui/gui_palette.cpp | 6 |
3 files changed, 17 insertions, 26 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 6257ad8a84..898de3d0a3 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -27,6 +27,7 @@ #include "common/util.h" #include "sci/sci.h" +#include "sci/debug.h" // for g_debug_sleeptime_factor #include "sci/engine/state.h" #include "sci/tools.h" #include "sci/gui/gui.h" @@ -43,7 +44,6 @@ namespace Sci { SciGui::SciGui(OSystem *system, EngineState *state, SciGuiScreen *screen) : _system(system), _s(state), _screen(screen) { _picNotValid = 0; - _sysTicks = 0; _palette = new SciGuiPalette(_s, this, _screen); _gfx = new SciGuiGfx(_s, _screen, _palette); @@ -54,30 +54,26 @@ SciGui::SciGui() { } SciGui::~SciGui() { - _system->getTimerManager()->removeTimerProc(&timerHandler); } void SciGui::init(bool usesOldGfxFunctions) { - _sysSpeed = 1000000 / 60; - Common::TimerManager *tm = _system->getTimerManager(); - tm->removeTimerProc(&timerHandler); - tm->installTimerProc(&timerHandler, _sysSpeed, this); } -void SciGui::timerHandler(void *ref) { - ((SciGui *)ref)->_sysTicks++; -} - -int16 SciGui::getTimeTicks() { - return _sysTicks; -} void SciGui::wait(int16 ticks) { - uint32 waitto = _sysTicks + ticks; - do { - //eventMgr->pollEvents(); - _system->delayMillis(_sysSpeed >> 11); - } while (_sysTicks < waitto); + uint32 time; + + time = g_system->getMillis(); + _s->r_acc = make_reg(0, ((long)time - (long)_s->last_wait_time) * 60 / 1000); + _s->last_wait_time = time; + + ticks *= g_debug_sleeptime_factor; + gfxop_sleep(_s->gfx_state, ticks * 1000 / 60); + + + // Reset speed throttler: Game is playing along nicely anyway + if (ticks > 0) + _s->speedThrottler->reset(); } void SciGui::setPort(uint16 portPtr) { diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index a6262771a9..cbd1f315ef 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -46,7 +46,6 @@ public: virtual void init(bool usesOldGfxFunctions); - virtual int16 getTimeTicks(); virtual void wait(int16 ticks); virtual void setPort(uint16 portPtr); virtual void setPortPic(Common::Rect rect, int16 picTop, int16 picLeft); @@ -93,8 +92,6 @@ public: int _picNotValid; // possible values 0, 1 and 2 private: - static void timerHandler(void*ref); - OSystem *_system; EngineState *_s; SciGuiScreen *_screen; @@ -102,8 +99,6 @@ private: SciGuiGfx *_gfx; SciGuiresources *_resources; SciGuiWindowMgr *_windowMgr; - uint32 _sysTicks; - int32 _sysSpeed; // ticker timer in ms }; } // End of namespace Sci diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp index ec4e127814..953ed93121 100644 --- a/engines/sci/gui/gui_palette.cpp +++ b/engines/sci/gui/gui_palette.cpp @@ -229,10 +229,10 @@ void SciGuiPalette::merge(GuiPalette *pFrom, GuiPalette *pTo, uint16 flag) { pTo->colors[res & 0xFF].used |= 0x10; } } - pTo->timestamp = _gui->getTimeTicks(); + pTo->timestamp = (g_system->getMillis() - _s->game_start_time) * 60 / 1000;; } -uint16 SciGuiPalette::matchColor(GuiPalette*pPal, byte r, byte g, byte b) { +uint16 SciGuiPalette::matchColor(GuiPalette *pPal, byte r, byte g, byte b) { byte found = 0xFF; int diff = 0x2FFFF, cdiff; int16 dr,dg,db; @@ -275,7 +275,7 @@ void SciGuiPalette::setIntensity(int fromColor, int toColor, int intensity, GuiP void SciGuiPalette::animate(byte fromColor, byte toColor, int speed) { GuiColor col; int len = toColor - fromColor - 1; - uint32 now = _gui->getTimeTicks(); + uint32 now = (g_system->getMillis() - _s->game_start_time) * 60 / 1000;; // search for sheduled animations with the same 'from' value int sz = _palSchedules.size(); for (int i = 0; i < sz; i++) { |