aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-10 19:41:26 +0000
committerJohannes Schickel2008-05-10 19:41:26 +0000
commitd21d9858fd33a56983eb89b662db2b27fead3ce5 (patch)
treec9c5b8a5e12e5a4fc9950d1b05d5ac785c8915c4 /engines/kyra
parent5082419fe9957ca144904fe2cdb3e86ff7b36e1f (diff)
downloadscummvm-rg350-d21d9858fd33a56983eb89b662db2b27fead3ce5.tar.gz
scummvm-rg350-d21d9858fd33a56983eb89b662db2b27fead3ce5.tar.bz2
scummvm-rg350-d21d9858fd33a56983eb89b662db2b27fead3ce5.zip
- Cleaned up main menu quit handling
- Moved KyraEngine_HoF delay implementation to KyraEngine_v2 svn-id: r31987
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui.cpp9
-rw-r--r--engines/kyra/gui.h2
-rw-r--r--engines/kyra/kyra_hof.cpp17
-rw-r--r--engines/kyra/kyra_hof.h3
-rw-r--r--engines/kyra/kyra_mr.cpp15
-rw-r--r--engines/kyra/kyra_mr.h2
-rw-r--r--engines/kyra/kyra_v2.cpp19
-rw-r--r--engines/kyra/kyra_v2.h2
8 files changed, 26 insertions, 43 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 8ce513d77c..1296717467 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -382,7 +382,7 @@ bool MainMenu::getInput() {
while (_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
- _quitFlag = true;
+ _vm->quitGame();
break;
case Common::EVENT_LBUTTONUP:
return true;
@@ -396,7 +396,6 @@ bool MainMenu::getInput() {
int MainMenu::handle(int dim) {
debugC(9, kDebugLevelMain, "MainMenu::handle(%d)", dim);
int command = -1;
- _quitFlag = false;
uint8 colorMap[16];
memset(colorMap, 0, sizeof(colorMap));
@@ -436,7 +435,7 @@ int MainMenu::handle(int dim) {
Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4);
- while (!_quitFlag) {
+ while (!_vm->quit()) {
updateAnimation();
bool mousePressed = getInput();
@@ -467,10 +466,8 @@ int MainMenu::handle(int dim) {
_system->delayMillis(10);
}
- if (_quitFlag) {
- _vm->quitGame();
+ if (_vm->quit())
command = -1;
- }
_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0);
_screen->_charWidth = charWidthBackUp;
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index a04ac20de3..4e59f0ca78 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -222,8 +222,6 @@ private:
Screen *_screen;
OSystem *_system;
- bool _quitFlag;
-
StaticData _static;
struct AnimIntern {
int curFrame;
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index cd4ed72ae3..ebe39ee02c 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -743,23 +743,6 @@ void KyraEngine_HoF::updateMouse() {
}
}
-void KyraEngine_HoF::delay(uint32 amount, bool updateGame, bool isMainLoop) {
- uint32 start = _system->getMillis();
- do {
- if (updateGame) {
- if (_chatText)
- updateWithText();
- else
- update();
- } else {
- updateInput();
- }
-
- if (amount > 0)
- _system->delayMillis(amount > 10 ? 10 : amount);
- } while (!skipFlag() && _system->getMillis() < start + amount && !_quitFlag);
-}
-
void KyraEngine_HoF::cleanup() {
delete[] _inventoryButtons; _inventoryButtons = 0;
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index 93e1246b7d..5ee13eb261 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -655,9 +655,6 @@ protected:
void setWalkspeed(uint8 speed);
- // delay
- void delay(uint32 millis, bool updateGame = false, bool isMainLoop = false);
-
// ingame static sequence handling
void seq_makeBookOrCauldronAppear(int type);
void seq_makeBookAppear();
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 481a3d124f..be788f5a64 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -276,6 +276,8 @@ int KyraEngine_MR::go() {
delayUntil(nextRun);
}
+ _eventList.clear();
+
switch (_menu->handle(3)) {
case 2:
_menuDirectlyToLoad = true;
@@ -1276,19 +1278,6 @@ void KyraEngine_MR::updateMouse() {
}
}
-void KyraEngine_MR::delay(uint32 millis, bool doUpdate, bool isMainLoop) {
- debugC(9, kDebugLevelMain, "KyraEngine_MR::delay(%d, %d, %d)", millis, doUpdate, isMainLoop);
- uint32 endTime = _system->getMillis() + millis;
- while (endTime > _system->getMillis()) {
- if (doUpdate) {
- //XXX
- update();
- }
-
- _system->delayMillis(10);
- }
-}
-
#pragma mark -
void KyraEngine_MR::makeCharFacingMouse() {
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 6faadf8197..306438ac1b 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -98,8 +98,6 @@ private:
void updateWithText();
void updateMouse();
- void delay(uint32 millis, bool update = false, bool isMainLoop = false);
-
// sound specific
private:
void playMenuAudioFile();
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 597f81d843..a2911dec84 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -91,6 +91,25 @@ KyraEngine_v2::~KyraEngine_v2() {
delete[] _screenBuffer;
}
+void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::delay(%u, %d, %d)", amount, updateGame, isMainLoop);
+
+ uint32 start = _system->getMillis();
+ do {
+ if (updateGame) {
+ if (_chatText)
+ updateWithText();
+ else
+ update();
+ } else {
+ updateInput();
+ }
+
+ if (amount > 0)
+ _system->delayMillis(amount > 10 ? 10 : amount);
+ } while (!skipFlag() && _system->getMillis() < start + amount && !_quitFlag);
+}
+
int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) {
debugC(9, kDebugLevelMain, "KyraEngine_v2::checkInput(%p, %d)", (const void*)buttonList, mainLoop);
updateInput();
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index ca6569a56c..3b7aac91ba 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -78,6 +78,8 @@ public:
virtual Screen_v2 *screen_v2() const = 0;
virtual GUI *gui_v2() const = 0;
+ void delay(uint32 time, bool update = false, bool isMainLoop = false);
+
const EngineDesc &engineDesc() const { return _desc; }
protected:
EngineDesc _desc;