From 3e3366f52122d8bb49ab1f5f138019b942659af5 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 3 Aug 2003 15:50:39 +0000 Subject: Added "fast mode" (Ctrl-F/Ctrl-G) like the one we have for SCUMM and Simon. It does not change the game speed setting, because the most likely use (I think) is to toggle it on briefly, e.g. while travelling the walkways. svn-id: r9434 --- sky/sky.cpp | 20 +++++++++++++++++++- sky/sky.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'sky') diff --git a/sky/sky.cpp b/sky/sky.cpp index cb0ba22b82..876872670c 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -93,6 +93,8 @@ SkyState::SkyState(GameDetector *detector, OSystem *syst) _floppyIntro = detector->_floppyIntro; + _fastMode = 0; + _system->init_size(320, 200); } @@ -202,7 +204,12 @@ void SkyState::go() { _lastSaveTime = _system->get_msecs(); while (1) { - delay(_systemVars.gameSpeed); + if (_fastMode & 2) + delay(0); + else if (_fastMode & 1) + delay(10); + else + delay(_systemVars.gameSpeed); if (_system->get_msecs() - _lastSaveTime > 5 * 60 * 1000) { if (_skyControl->loadSaveAllowed()) { @@ -404,6 +411,17 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp while (_system->poll_event(&event)) { switch (event.event_code) { case OSystem::EVENT_KEYDOWN: + if (event.kbd.flags == OSystem::KBD_CTRL) { + if (event.kbd.keycode == 'f') { + _fastMode ^= 1; + break; + } + if (event.kbd.keycode == 'g') { + _fastMode ^= 2; + break; + } + } + // Make sure backspace works right (this fixes a small issue on OS X) if (event.kbd.keycode == 8) _key_pressed = 8; diff --git a/sky/sky.h b/sky/sky.h index a82d91798c..13f44fb2b1 100644 --- a/sky/sky.h +++ b/sky/sky.h @@ -106,6 +106,8 @@ public: static SystemVars _systemVars; protected: + byte _fastMode; + void logic_engine(); void delay(uint amount); void go(); -- cgit v1.2.3