Lure works with the new GMM implementation

svn-id: r32996
This commit is contained in:
Christopher Page 2008-07-10 22:34:48 +00:00
parent 1fd613afa6
commit 17ce8db211
10 changed files with 26 additions and 34 deletions

View File

@ -269,7 +269,6 @@ protected:
uint16 _marks;
// bool _quit;
bool _scriptVar2;
bool _runScriptReturn1;
bool _runScriptCondition[40];

View File

@ -555,7 +555,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) {
_currentTable = sub;
restart:
if (_quit)
if (quit())
return result;
while ((byte *)sl != (byte *)sub) {

View File

@ -141,9 +141,9 @@ void Mouse::waitForRelease() {
LureEngine &engine = LureEngine::getReference();
do {
while (e.pollEvent() && !engine._quit) ;
while (e.pollEvent() && !engine.quit()) ;
g_system->delayMillis(20);
} while (!engine._quit && (lButton() || rButton() || mButton()));
} while (!engine.quit() && (lButton() || rButton() || mButton()));
}
/*--------------------------------------------------------------------------*/
@ -166,10 +166,6 @@ bool Events::pollEvent() {
// Handle keypress
switch (_event.type) {
case Common::EVENT_QUIT:
engine._quit = true;
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
@ -217,7 +213,7 @@ bool Events::interruptableDelay(uint32 milliseconds) {
uint32 delayCtr = g_system->getMillis() + milliseconds;
while (g_system->getMillis() < delayCtr) {
if (engine._quit) return true;
if (engine.quit()) return true;
if (events.pollEvent()) {
if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||

View File

@ -117,7 +117,7 @@ void FightsManager::fightLoop() {
uint32 timerVal = g_system->getMillis();
// Loop for the duration of the battle
while (!engine._quit && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
while (!engine.quit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
checkEvents();
if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) {
@ -198,7 +198,7 @@ void FightsManager::checkEvents() {
if (events.type() == Common::EVENT_KEYDOWN) {
switch (events.event().kbd.keycode) {
case Common::KEYCODE_ESCAPE:
engine._quit = true;
engine.quitGame();
return;
case Common::KEYCODE_d:

View File

@ -143,7 +143,7 @@ void Game::execute() {
setState(GS_RESTART);
bool initialRestart = true;
while (!engine._quit) {
while (!engine.quit()) {
if ((_state & GS_RESTART) != 0) {
res.reset();
@ -163,7 +163,7 @@ void Game::execute() {
mouse.cursorOn();
// Main game loop
while (!engine._quit && ((_state & GS_RESTART) == 0)) {
while (!engine.quit() && ((_state & GS_RESTART) == 0)) {
// If time for next frame, allow everything to update
if (system.getMillis() > timerVal + GAME_FRAME_DELAY) {
timerVal = system.getMillis();
@ -292,10 +292,7 @@ void Game::execute() {
if (restartFlag)
setState(GS_RESTART);
} else if ((_state & GS_RESTART) == 0)
// Exiting game
engine._quit = true;
}
}
}
@ -893,7 +890,7 @@ void Game::doShowCredits() {
void Game::doQuit() {
Sound.pause();
if (getYN())
LureEngine::getReference()._quit = true;
LureEngine::getReference().quitGame();
Sound.resume();
}
@ -1020,7 +1017,7 @@ bool Game::getYN() {
}
g_system->delayMillis(10);
} while (!engine._quit && !breakFlag);
} while (!engine.quit() && !breakFlag);
screen.update();
if (!vKbdFlag)

View File

@ -64,7 +64,7 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz
else screen.paletteFadeIn(&p);
bool result = interruptableDelay(delaySize);
if (LureEngine::getReference()._quit) return true;
if (LureEngine::getReference().quit()) return true;
if (!isEGA)
screen.paletteFadeOut();

View File

@ -126,8 +126,8 @@ int LureEngine::go() {
CopyProtectionDialog *dialog = new CopyProtectionDialog();
bool result = dialog->show();
delete dialog;
if (_quit)
return _rtl;
if (quit())
return _eventMan->shouldRTL();
if (!result)
error("Sorry - copy protection failed");
@ -145,14 +145,14 @@ int LureEngine::go() {
}
// Play the game
if (!_quit) {
if (!quit()) {
// Play the game
Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID);
gameInstance->execute();
}
delete gameInstance;
return _rtl;
return _eventMan->shouldRTL();
}
void LureEngine::pauseEngineIntern(bool pause) {

View File

@ -131,7 +131,7 @@ uint8 Menu::execute() {
while (mouse.lButton() || mouse.rButton()) {
while (events.pollEvent()) {
if (engine._quit) return MENUITEM_NONE;
if (engine.quit()) return MENUITEM_NONE;
if (mouse.y() < MENUBAR_Y_SIZE) {
MenuRecord *p = getMenuAt(mouse.x());
@ -547,7 +547,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
}
while (e.pollEvent()) {
if (engine._quit) {
if (engine.quit()) {
selectedIndex = 0xffff;
goto bail_out;

View File

@ -221,7 +221,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
anim->show();
if (!events.interruptableDelay(30000)) {
// No key yet pressed, so keep waiting
while (Sound.musicInterface_CheckPlaying(6) && !engine._quit) {
while (Sound.musicInterface_CheckPlaying(6) && !engine.quit()) {
if (events.interruptableDelay(20))
break;
}
@ -229,7 +229,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
delete anim;
screen.paletteFadeOut();
engine._quit = true;
engine.quitGame();
}
// Setup the pig fight in the cave

View File

@ -534,7 +534,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
// Loop until the input string changes
refreshFlag = false;
while (!refreshFlag && !abortFlag) {
abortFlag = engine._quit;
abortFlag = engine.quit();
if (abortFlag) break;
while (events.pollEvent()) {
@ -976,7 +976,7 @@ bool SaveRestoreDialog::show(bool saveDialog) {
// Provide highlighting of lines to select a save slot
while (!abortFlag && !(mouse.lButton() && (selectedLine != -1))
&& !mouse.rButton() && !mouse.mButton()) {
abortFlag = engine._quit;
abortFlag = engine.quit();
if (abortFlag) break;
while (events.pollEvent()) {
@ -1179,7 +1179,7 @@ bool RestartRestoreDialog::show() {
// Event loop for making selection
bool buttonPressed = false;
while (!engine._quit) {
while (!engine.quit()) {
// Handle events
while (events.pollEvent()) {
if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) {
@ -1231,7 +1231,7 @@ bool RestartRestoreDialog::show() {
Sound.killSounds();
if (!restartFlag && !engine._quit) {
if (!restartFlag && !engine.quit()) {
// Need to show Restore game dialog
if (!SaveRestoreDialog::show(false))
// User cancelled, so fall back on Restart
@ -1351,7 +1351,7 @@ bool CopyProtectionDialog::show() {
// Clear any prior try
_charIndex = 0;
while (!engine._quit) {
while (!engine.quit()) {
while (events.pollEvent() && (_charIndex < 4)) {
if (events.type() == Common::EVENT_KEYDOWN) {
if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) {
@ -1385,7 +1385,7 @@ bool CopyProtectionDialog::show() {
break;
}
if (engine._quit)
if (engine.quit())
return false;
// At this point, two page numbers have been entered - validate them