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; uint16 _marks;
// bool _quit;
bool _scriptVar2; bool _scriptVar2;
bool _runScriptReturn1; bool _runScriptReturn1;
bool _runScriptCondition[40]; bool _runScriptCondition[40];

View file

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

View file

@ -141,9 +141,9 @@ void Mouse::waitForRelease() {
LureEngine &engine = LureEngine::getReference(); LureEngine &engine = LureEngine::getReference();
do { do {
while (e.pollEvent() && !engine._quit) ; while (e.pollEvent() && !engine.quit()) ;
g_system->delayMillis(20); 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 // Handle keypress
switch (_event.type) { switch (_event.type) {
case Common::EVENT_QUIT:
engine._quit = true;
break;
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN: case Common::EVENT_RBUTTONDOWN:
@ -217,7 +213,7 @@ bool Events::interruptableDelay(uint32 milliseconds) {
uint32 delayCtr = g_system->getMillis() + milliseconds; uint32 delayCtr = g_system->getMillis() + milliseconds;
while (g_system->getMillis() < delayCtr) { while (g_system->getMillis() < delayCtr) {
if (engine._quit) return true; if (engine.quit()) return true;
if (events.pollEvent()) { if (events.pollEvent()) {
if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) || 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(); uint32 timerVal = g_system->getMillis();
// Loop for the duration of the battle // Loop for the duration of the battle
while (!engine._quit && (playerFight.fwhits != GENERAL_MAGIC_ID)) { while (!engine.quit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
checkEvents(); checkEvents();
if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) { if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) {
@ -198,7 +198,7 @@ void FightsManager::checkEvents() {
if (events.type() == Common::EVENT_KEYDOWN) { if (events.type() == Common::EVENT_KEYDOWN) {
switch (events.event().kbd.keycode) { switch (events.event().kbd.keycode) {
case Common::KEYCODE_ESCAPE: case Common::KEYCODE_ESCAPE:
engine._quit = true; engine.quitGame();
return; return;
case Common::KEYCODE_d: case Common::KEYCODE_d:

View file

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

View file

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

View file

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

View file

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

View file

@ -221,7 +221,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
anim->show(); anim->show();
if (!events.interruptableDelay(30000)) { if (!events.interruptableDelay(30000)) {
// No key yet pressed, so keep waiting // 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)) if (events.interruptableDelay(20))
break; break;
} }
@ -229,7 +229,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {
delete anim; delete anim;
screen.paletteFadeOut(); screen.paletteFadeOut();
engine._quit = true; engine.quitGame();
} }
// Setup the pig fight in the cave // 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 // Loop until the input string changes
refreshFlag = false; refreshFlag = false;
while (!refreshFlag && !abortFlag) { while (!refreshFlag && !abortFlag) {
abortFlag = engine._quit; abortFlag = engine.quit();
if (abortFlag) break; if (abortFlag) break;
while (events.pollEvent()) { while (events.pollEvent()) {
@ -976,7 +976,7 @@ bool SaveRestoreDialog::show(bool saveDialog) {
// Provide highlighting of lines to select a save slot // Provide highlighting of lines to select a save slot
while (!abortFlag && !(mouse.lButton() && (selectedLine != -1)) while (!abortFlag && !(mouse.lButton() && (selectedLine != -1))
&& !mouse.rButton() && !mouse.mButton()) { && !mouse.rButton() && !mouse.mButton()) {
abortFlag = engine._quit; abortFlag = engine.quit();
if (abortFlag) break; if (abortFlag) break;
while (events.pollEvent()) { while (events.pollEvent()) {
@ -1179,7 +1179,7 @@ bool RestartRestoreDialog::show() {
// Event loop for making selection // Event loop for making selection
bool buttonPressed = false; bool buttonPressed = false;
while (!engine._quit) { while (!engine.quit()) {
// Handle events // Handle events
while (events.pollEvent()) { while (events.pollEvent()) {
if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) { if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) {
@ -1231,7 +1231,7 @@ bool RestartRestoreDialog::show() {
Sound.killSounds(); Sound.killSounds();
if (!restartFlag && !engine._quit) { if (!restartFlag && !engine.quit()) {
// Need to show Restore game dialog // Need to show Restore game dialog
if (!SaveRestoreDialog::show(false)) if (!SaveRestoreDialog::show(false))
// User cancelled, so fall back on Restart // User cancelled, so fall back on Restart
@ -1351,7 +1351,7 @@ bool CopyProtectionDialog::show() {
// Clear any prior try // Clear any prior try
_charIndex = 0; _charIndex = 0;
while (!engine._quit) { while (!engine.quit()) {
while (events.pollEvent() && (_charIndex < 4)) { while (events.pollEvent() && (_charIndex < 4)) {
if (events.type() == Common::EVENT_KEYDOWN) { if (events.type() == Common::EVENT_KEYDOWN) {
if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) { if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) {
@ -1385,7 +1385,7 @@ bool CopyProtectionDialog::show() {
break; break;
} }
if (engine._quit) if (engine.quit())
return false; return false;
// At this point, two page numbers have been entered - validate them // At this point, two page numbers have been entered - validate them