aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-10-11 15:10:59 +0000
committerTravis Howell2006-10-11 15:10:59 +0000
commit71b0add6017fc3d9a29a27d8e29d7492a2c7510d (patch)
treeeaff1a93581ca2ef250fa80b878653cf6b8d144d
parent6c66570726dba50397ab182e933774035275f149 (diff)
downloadscummvm-rg350-71b0add6017fc3d9a29a27d8e29d7492a2c7510d.tar.gz
scummvm-rg350-71b0add6017fc3d9a29a27d8e29d7492a2c7510d.tar.bz2
scummvm-rg350-71b0add6017fc3d9a29a27d8e29d7492a2c7510d.zip
Cleanup
svn-id: r24282
-rw-r--r--engines/agos/agos.cpp148
-rw-r--r--engines/agos/agos.h3
-rw-r--r--engines/agos/event.cpp124
3 files changed, 129 insertions, 146 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 6db763ae24..df1f07b3de 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -28,8 +28,6 @@
#include "common/fs.h"
#include "common/system.h"
-#include "gui/about.h"
-
#include "agos/debugger.h"
#include "agos/intern.h"
#include "agos/agos.h"
@@ -1333,7 +1331,7 @@ startOver:
if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
displayBoxStars();
if (getGameType() == GType_PP) {
- if (checkArrows() != 0) {
+ if (processSpecialKeys() != 0) {
_needHitAreaRecalc++;
return;
}
@@ -1990,28 +1988,7 @@ bool AGOSEngine::isSpriteLoaded(uint16 id, uint16 zoneNum) {
return false;
}
-bool AGOSEngine::checkArrows() {
- switch (_keyPressed) {
- case 17: // Up
- _verbHitArea = 302;
- break;
- case 18: // Down
- _verbHitArea = 304;
- break;
- case 19: // Right
- _verbHitArea = 303;
- break;
- case 20: // Left
- _verbHitArea = 301;
- break;
- }
-
- bool result = (_keyPressed != 0);
- _keyPressed = 0;
- return result;
-}
-
-void AGOSEngine::processSpecialKeys() {
+bool AGOSEngine::processSpecialKeys() {
switch (_keyPressed) {
case 17: // Up
if (getGameType() == GType_PP)
@@ -2127,7 +2104,9 @@ void AGOSEngine::processSpecialKeys() {
break;
}
+ bool result = (_keyPressed != 0);
_keyPressed = 0;
+ return result;
}
void AGOSEngine::pause() {
@@ -2355,125 +2334,6 @@ void AGOSEngine::shutdown() {
_system->quit();
}
-void AGOSEngine::delay(uint amount) {
- OSystem::Event event;
-
- uint32 start = _system->getMillis();
- uint32 cur = start;
- uint this_delay, vga_period;
-
- if (_debugger->isAttached())
- _debugger->onFrame();
-
- if (_fastMode)
- vga_period = 10;
- else if (getGameType() == GType_SIMON2)
- vga_period = 45;
- else
- vga_period = 50;
-
- _rnd.getRandomNumber(2);
-
- do {
- while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) {
- _lastVgaTick += vga_period;
-
- // don't get too many frames behind
- if (cur >= _lastVgaTick + vga_period * 2)
- _lastVgaTick = cur;
-
- _inCallBack = true;
- timer_callback();
- _inCallBack = false;
- }
-
- while (_system->pollEvent(event)) {
- switch (event.type) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
- && (event.kbd.flags == OSystem::KBD_ALT ||
- event.kbd.flags == OSystem::KBD_CTRL)) {
- _saveLoadSlot = event.kbd.keycode - '0';
-
- // There is no save slot 0
- if (_saveLoadSlot == 0)
- _saveLoadSlot = 10;
-
- sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
- _saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
-
- // We should only allow a load or save when it was possible in original
- // This stops load/save during copy protection, conversations and cut scenes
- if (!_mouseHideCount && !_showPreposition)
- quickLoadOrSave();
- } else if (event.kbd.flags == OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'a') {
- GUI::Dialog *_aboutDialog;
- _aboutDialog = new GUI::AboutDialog();
- _aboutDialog->runModal();
- } else if (event.kbd.keycode == 'f')
- _fastMode ^= 1;
- else if (event.kbd.keycode == 'd')
- _debugger->attach();
- }
-
- if (getGameType() == GType_PP) {
- if (event.kbd.flags == OSystem::KBD_SHIFT)
- _variableArray[41] = 0;
- else
- _variableArray[41] = 1;
- }
-
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _keyPressed = 8;
- else
- _keyPressed = (byte)event.kbd.ascii;
- break;
- case OSystem::EVENT_MOUSEMOVE:
- _sdlMouseX = event.mouse.x;
- _sdlMouseY = event.mouse.y;
- break;
- case OSystem::EVENT_LBUTTONDOWN:
- if (getGameType() == GType_FF)
- setBitFlag(89, true);
- _leftButtonDown++;
-#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
- _sdlMouseX = event.mouse.x;
- _sdlMouseY = event.mouse.y;
-#endif
- break;
- case OSystem::EVENT_LBUTTONUP:
- if (getGameType() == GType_FF)
- setBitFlag(89, false);
- break;
- case OSystem::EVENT_RBUTTONDOWN:
- if (getGameType() == GType_FF)
- setBitFlag(92, false);
- _rightButtonDown++;
- break;
- case OSystem::EVENT_QUIT:
- shutdown();
- return;
- default:
- break;
- }
- }
-
- _system->updateScreen();
-
- if (amount == 0)
- break;
-
- this_delay = _fastMode ? 1 : 20;
- if (this_delay > amount)
- this_delay = amount;
- _system->delayMillis(this_delay);
-
- cur = _system->getMillis();
- } while (cur < start + amount);
-}
-
void AGOSEngine::loadMusic(uint music) {
char buf[4];
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 35dddb4430..1ab30dd250 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -740,8 +740,7 @@ protected:
void loadIconData();
void loadIconFile();
- bool checkArrows();
- void processSpecialKeys();
+ bool processSpecialKeys();
void hitarea_stuff_helper();
void permitInput();
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 2c5a8a4c9a..e4f94e0f47 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -24,8 +24,13 @@
#include "common/stdafx.h"
#include "agos/agos.h"
+#include "agos/debugger.h"
#include "agos/intern.h"
+#include "common/system.h"
+
+#include "gui/about.h"
+
namespace AGOS {
void AGOSEngine::addTimeEvent(uint timeout, uint subroutine_id) {
@@ -302,6 +307,125 @@ void AGOSEngine::scrollEvent() {
}
}
+void AGOSEngine::delay(uint amount) {
+ OSystem::Event event;
+
+ uint32 start = _system->getMillis();
+ uint32 cur = start;
+ uint this_delay, vga_period;
+
+ if (_debugger->isAttached())
+ _debugger->onFrame();
+
+ if (_fastMode)
+ vga_period = 10;
+ else if (getGameType() == GType_SIMON2)
+ vga_period = 45;
+ else
+ vga_period = 50;
+
+ _rnd.getRandomNumber(2);
+
+ do {
+ while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) {
+ _lastVgaTick += vga_period;
+
+ // don't get too many frames behind
+ if (cur >= _lastVgaTick + vga_period * 2)
+ _lastVgaTick = cur;
+
+ _inCallBack = true;
+ timer_callback();
+ _inCallBack = false;
+ }
+
+ while (_system->pollEvent(event)) {
+ switch (event.type) {
+ case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
+ && (event.kbd.flags == OSystem::KBD_ALT ||
+ event.kbd.flags == OSystem::KBD_CTRL)) {
+ _saveLoadSlot = event.kbd.keycode - '0';
+
+ // There is no save slot 0
+ if (_saveLoadSlot == 0)
+ _saveLoadSlot = 10;
+
+ sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
+ _saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
+
+ // We should only allow a load or save when it was possible in original
+ // This stops load/save during copy protection, conversations and cut scenes
+ if (!_mouseHideCount && !_showPreposition)
+ quickLoadOrSave();
+ } else if (event.kbd.flags == OSystem::KBD_CTRL) {
+ if (event.kbd.keycode == 'a') {
+ GUI::Dialog *_aboutDialog;
+ _aboutDialog = new GUI::AboutDialog();
+ _aboutDialog->runModal();
+ } else if (event.kbd.keycode == 'f')
+ _fastMode ^= 1;
+ else if (event.kbd.keycode == 'd')
+ _debugger->attach();
+ }
+
+ if (getGameType() == GType_PP) {
+ if (event.kbd.flags == OSystem::KBD_SHIFT)
+ _variableArray[41] = 0;
+ else
+ _variableArray[41] = 1;
+ }
+
+ // Make sure backspace works right (this fixes a small issue on OS X)
+ if (event.kbd.keycode == 8)
+ _keyPressed = 8;
+ else
+ _keyPressed = (byte)event.kbd.ascii;
+ break;
+ case OSystem::EVENT_MOUSEMOVE:
+ _sdlMouseX = event.mouse.x;
+ _sdlMouseY = event.mouse.y;
+ break;
+ case OSystem::EVENT_LBUTTONDOWN:
+ if (getGameType() == GType_FF)
+ setBitFlag(89, true);
+ _leftButtonDown++;
+#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
+ _sdlMouseX = event.mouse.x;
+ _sdlMouseY = event.mouse.y;
+#endif
+ break;
+ case OSystem::EVENT_LBUTTONUP:
+ if (getGameType() == GType_FF)
+ setBitFlag(89, false);
+ break;
+ case OSystem::EVENT_RBUTTONDOWN:
+ if (getGameType() == GType_FF)
+ setBitFlag(92, false);
+ _rightButtonDown++;
+ break;
+ case OSystem::EVENT_QUIT:
+ shutdown();
+ return;
+ default:
+ break;
+ }
+ }
+
+ _system->updateScreen();
+
+ if (amount == 0)
+ break;
+
+ this_delay = _fastMode ? 1 : 20;
+ if (this_delay > amount)
+ this_delay = amount;
+ _system->delayMillis(this_delay);
+
+ cur = _system->getMillis();
+ } while (cur < start + amount);
+}
+
void AGOSEngine::timer_callback() {
if (_timer5 != 0) {
_syncFlag2 = true;