diff options
Diffstat (limited to 'engines/supernova')
-rw-r--r-- | engines/supernova/state.cpp | 7 | ||||
-rw-r--r-- | engines/supernova/supernova.cpp | 63 | ||||
-rw-r--r-- | engines/supernova/supernova.h | 1 |
3 files changed, 65 insertions, 6 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp index 93c9d695a9..e3e341e11f 100644 --- a/engines/supernova/state.cpp +++ b/engines/supernova/state.cpp @@ -525,13 +525,8 @@ void GameManager::processInput(Common::KeyState &state) { break; case Common::KEYCODE_x: if (state.flags & Common::KBD_ALT) { - // quit game - GUI::MessageDialog *dialog = new GUI::MessageDialog("Quit Game?", "Quit", "Cancel"); - if (dialog->runModal() == GUI::kMessageOK) + if (_vm->quitGameDialog()) _vm->quitGame(); - delete dialog; - - // TODO: Add original quit game message prompt } break; default: diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 084c8b5ad9..54e87e2aab 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -807,6 +807,69 @@ void SupernovaEngine::setTextSpeed() { _gm->animationOn(); } +bool SupernovaEngine::quitGameDialog() { + bool quit = false; + + // TODO: Center text position dynamically + // Get translated strings + // Create on startup + GuiElement guiQuitBox; + guiQuitBox.setColor(kColorRed, kColorWhite99, kColorRed, kColorWhite99); + guiQuitBox.setSize(112, 97, 112 + 96, 97 + 27); + guiQuitBox.setText("Spiel abbrechen?"); + guiQuitBox.setTextPosition(guiQuitBox.left + 3, guiQuitBox.top + 3); + GuiElement guiQuitYes; + guiQuitYes.setColor(kColorWhite35, kColorWhite99, kColorWhite35, kColorWhite99); + guiQuitYes.setSize(115, 111, 158, 121); + guiQuitYes.setText("Ja"); + guiQuitYes.setTextPosition(132, 112); + GuiElement guiQuitNo; + guiQuitNo.setColor(kColorWhite35, kColorWhite99, kColorWhite35, kColorWhite99); + guiQuitNo.setSize(162, 111, 205, 121); + guiQuitNo.setText("Nein"); + guiQuitNo.setTextPosition(173, 112); + + _gm->animationOff(); + _gm->saveTime(); + saveScreen(guiQuitBox.left, guiQuitBox.top, guiQuitBox.width(), guiQuitBox.height()); + + renderBox(guiQuitBox.left, guiQuitBox.top, guiQuitBox.width(), guiQuitBox.height(), guiQuitBox._bgColorNormal); + renderText(guiQuitBox._text, guiQuitBox._textPosition.x, guiQuitBox._textPosition.y, guiQuitBox._textColorNormal); + renderBox(guiQuitYes.left, guiQuitYes.top, guiQuitYes.width(), guiQuitYes.height(), guiQuitYes._bgColorNormal); + renderText(guiQuitYes._text, guiQuitYes._textPosition.x, guiQuitYes._textPosition.y, guiQuitYes._textColorNormal); + renderBox(guiQuitNo.left, guiQuitNo.top, guiQuitNo.width(), guiQuitNo.height(), guiQuitNo._bgColorNormal); + renderText(guiQuitNo._text, guiQuitNo._textPosition.x, guiQuitNo._textPosition.y, guiQuitNo._textColorNormal); + + do { + _gm->getInput(); + if (_gm->_keyPressed) { + if (_gm->_key.keycode == Common::KEYCODE_j) { + quit = true; + break; + } else if (_gm->_key.keycode == Common::KEYCODE_n) { + quit = false; + break; + } + } + if (_gm->_mouseClicked) { + if (guiQuitYes.contains(_gm->_mouseX, _gm->_mouseY)) { + quit = true; + break; + } else if (guiQuitNo.contains(_gm->_mouseX, _gm->_mouseY)) { + quit = false; + break; + } + } + } while (true); + + _gm->resetInputState(); + restoreScreen(); + _gm->loadTime(); + _gm->animationOn(); + + return quit; +} + Common::MemoryReadStream *SupernovaEngine::convertToMod(const char *filename, int version) { // MSN format struct { diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 0725e0c05c..7aa6c139c6 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -152,6 +152,7 @@ public: void setColor63(byte value); bool loadGame(int slot); bool saveGame(int slot, const Common::String &description); + bool quitGameDialog(); void errorTempSave(bool saving); void setTextSpeed(); |