aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/kyra_lok.cpp
diff options
context:
space:
mode:
authorMax Horn2008-09-01 17:52:50 +0000
committerMax Horn2008-09-01 17:52:50 +0000
commit91df44f8f6448e9adad901cd675926335d84b9db (patch)
tree72149b8d7b8702a546f455132b7a320c8eb3539d /engines/kyra/kyra_lok.cpp
parent7953312bc666a32ba274e4e2e1fc513a5e36762c (diff)
parent852bc9dbb750b9995d31e70f4158c97d3758c46f (diff)
downloadscummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.tar.gz
scummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.tar.bz2
scummvm-rg350-91df44f8f6448e9adad901cd675926335d84b9db.zip
Merging more of the GSoC 2008 RTL branch: KYRA
svn-id: r34246
Diffstat (limited to 'engines/kyra/kyra_lok.cpp')
-rw-r--r--engines/kyra/kyra_lok.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index 3d228210b9..b6c874339c 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -26,7 +26,6 @@
#include "kyra/kyra_lok.h"
#include "common/file.h"
-#include "common/events.h"
#include "common/system.h"
#include "common/savefile.h"
@@ -119,8 +118,12 @@ KyraEngine_LoK::~KyraEngine_LoK() {
delete[] _characterList;
+ delete[] _roomTable;
+
delete[] _movFacingTable;
+ delete[] _defaultShapeTable;
+
delete[] _gui->_scrollUpButton.data0ShapePtr;
delete[] _gui->_scrollUpButton.data1ShapePtr;
delete[] _gui->_scrollUpButton.data2ShapePtr;
@@ -300,8 +303,8 @@ int KyraEngine_LoK::go() {
if (_gameToLoad == -1) {
setGameFlag(0xEF);
seq_intro();
- if (_quitFlag)
- return 0;
+ if (quit())
+ return _eventMan->shouldRTL();
if (_skipIntroFlag && _abortIntroFlag)
resetGameFlag(0xEF);
}
@@ -309,7 +312,7 @@ int KyraEngine_LoK::go() {
resetGameFlag(0xEF);
mainLoop();
}
- return 0;
+ return _eventMan->shouldRTL();
}
@@ -399,7 +402,7 @@ void KyraEngine_LoK::startup() {
void KyraEngine_LoK::mainLoop() {
debugC(9, kDebugLevelMain, "KyraEngine_LoK::mainLoop()");
- while (!_quitFlag) {
+ while (!quit()) {
int32 frameTime = (int32)_system->getMillis();
_skipFlag = false;
@@ -444,7 +447,7 @@ void KyraEngine_LoK::mainLoop() {
}
void KyraEngine_LoK::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
- while (_system->getMillis() < timestamp && !_quitFlag) {
+ while (_system->getMillis() < timestamp && !quit()) {
if (updateTimers)
_timer->update();
@@ -476,7 +479,7 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
if (event.kbd.keycode == 'd')
_debugger->attach();
else if (event.kbd.keycode == 'q')
- _quitFlag = true;
+ quitGame();
} else if (event.kbd.keycode == '.') {
_skipFlag = true;
} else if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_SPACE || event.kbd.keycode == Common::KEYCODE_ESCAPE) {
@@ -488,9 +491,6 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
case Common::EVENT_MOUSEMOVE:
_animator->_updateScreen = true;
break;
- case Common::EVENT_QUIT:
- quitGame();
- break;
case Common::EVENT_LBUTTONDOWN:
_mousePressFlag = true;
break;
@@ -529,27 +529,24 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE))
_skipFlag = false;
- if (amount > 0 && !_skipFlag && !_quitFlag)
+ if (amount > 0 && !_skipFlag && !quit())
_system->delayMillis(10);
if (_skipFlag)
_sound->voiceStop();
- } while (!_skipFlag && _system->getMillis() < start + amount && !_quitFlag);
+ } while (!_skipFlag && _system->getMillis() < start + amount && !quit());
}
void KyraEngine_LoK::waitForEvent() {
bool finished = false;
Common::Event event;
- while (!finished && !_quitFlag) {
+ while (!finished && !quit()) {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
finished = true;
break;
- case Common::EVENT_QUIT:
- quitGame();
- break;
case Common::EVENT_LBUTTONDOWN:
finished = true;
_skipFlag = true;