aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBorja Lorente2016-08-09 19:55:43 +0200
committerBorja Lorente2016-08-19 16:29:15 +0200
commit5c38a0c33b3c7487fcfa441c4d6406c5decce809 (patch)
treef058980abed68c1305d0e3e35fc67a70dc1ac773 /engines
parent7f533ff7df2e54efc01a44a838cd8f67ddf551b0 (diff)
downloadscummvm-rg350-5c38a0c33b3c7487fcfa441c4d6406c5decce809.tar.gz
scummvm-rg350-5c38a0c33b3c7487fcfa441c4d6406c5decce809.tar.bz2
scummvm-rg350-5c38a0c33b3c7487fcfa441c4d6406c5decce809.zip
MACVENTURE: Add win game dialog
Diffstat (limited to 'engines')
-rw-r--r--engines/macventure/dialog.cpp36
-rw-r--r--engines/macventure/gui.cpp23
-rw-r--r--engines/macventure/gui.h7
-rw-r--r--engines/macventure/macventure.cpp3
-rw-r--r--engines/macventure/prebuilt_dialogs.cpp12
-rw-r--r--engines/macventure/prebuilt_dialogs.h6
6 files changed, 63 insertions, 24 deletions
diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp
index fe01d8fd8a..7cbf0cb610 100644
--- a/engines/macventure/dialog.cpp
+++ b/engines/macventure/dialog.cpp
@@ -45,18 +45,30 @@ Dialog::~Dialog() {
}
void Dialog::handleDialogAction(DialogElement *trigger, DialogAction action) {
- switch(action) {
- case kDACloseDialog:
- _gui->closeDialog();
- break;
- case kDASubmit:
- _gui->setTextInput(_userInput);
- _gui->closeDialog();
- break;
- case kDASaveAs:
- _gui->saveInto(0);
- _gui->closeDialog();
- break;
+ switch(action) {
+ case kDACloseDialog:
+ _gui->closeDialog();
+ break;
+ case kDASubmit:
+ _gui->setTextInput(_userInput);
+ _gui->closeDialog();
+ break;
+ case kDASaveAs:
+ _gui->saveGame();
+ _gui->closeDialog();
+ break;
+ case kDALoadGame:
+ _gui->loadGame();
+ _gui->closeDialog();
+ break;
+ case kDANewGame:
+ _gui->newGame();
+ _gui->closeDialog();
+ break;
+ case kDAQuit:
+ _gui->quitGame();
+ _gui->closeDialog();
+ break;
}
}
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index deb4a09a77..6c8122d156 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -867,13 +867,20 @@ void Gui::getTextFromUser() {
showPrebuiltDialog(kSpeakDialog);
}
-void Gui::loadGame(int slot) {
- _engine->loadGameState(slot);
+void Gui::loadGame() {
+ _engine->scummVMSaveLoadDialog(false);
}
-void Gui::saveInto(int slot) {
- _engine->saveGameState(slot, "desc");
- _engine->preparedToRun();
+void Gui::saveGame() {
+ _engine->scummVMSaveLoadDialog(true);
+}
+
+void Gui::newGame() {
+ warning("New Game not implemented!");
+}
+
+void Gui::quitGame() {
+ _engine->requestQuit();
}
void Gui::createInnerSurface(Graphics::ManagedSurface *innerSurface, Graphics::ManagedSurface *outerSurface, const BorderBounds &borders) {
@@ -1098,13 +1105,13 @@ void Gui::handleMenuAction(MenuAction action) {
warning("Unimplemented MacVenture Menu Action: New");
break;
case MacVenture::kMenuActionOpen:
- _engine->scummVMSaveLoadDialog(false);
+ loadGame();
break;
case MacVenture::kMenuActionSave:
- _engine->scummVMSaveLoadDialog(true);
+ saveGame();
break;
case MacVenture::kMenuActionSaveAs:
- _engine->scummVMSaveLoadDialog(true);
+ saveGame();
break;
case MacVenture::kMenuActionQuit:
debug("MacVenture Menu Action: Quit");
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 7d1a08aa5b..185171f6b9 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -157,9 +157,10 @@ public:
void setTextInput(Common::String str);
void closeDialog();
- // TODO: Currently unused, we are using ScummVM dialogs instead.
- void loadGame(int slot);
- void saveInto(int slot);
+ void loadGame();
+ void saveGame();
+ void newGame();
+ void quitGame();
void createInnerSurface(Graphics::ManagedSurface *innerSurface, Graphics::ManagedSurface *outerSurface, const BorderBounds &borders);
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index beee71aae5..a1b2387a87 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -293,10 +293,13 @@ void MacVentureEngine::gameChanged() {
}
void MacVentureEngine::winGame() {
+ _gui->showPrebuiltDialog(kWinGameDialog);
_gameState = kGameStateWinnig;
}
void MacVentureEngine::loseGame() {
+ _gui->showPrebuiltDialog(kWinGameDialog);
+ _paused = true;
_gameState = kGameStateLosing;
}
diff --git a/engines/macventure/prebuilt_dialogs.cpp b/engines/macventure/prebuilt_dialogs.cpp
index 13d2d446bf..945808bfcc 100644
--- a/engines/macventure/prebuilt_dialogs.cpp
+++ b/engines/macventure/prebuilt_dialogs.cpp
@@ -47,6 +47,18 @@ PrebuiltDialog prebuiltDialogs[kPrebuiltDialogCount] = {
{kDETextInput, "", kDANone, Common::Point(10, 25), 350, 40},
{kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
}
+},
+
+ { /* kWinGameDialog */
+ Common::Rect(20, 100, 400, 200),
+ {
+ {kDEPlainText, "You Won!", kDANone, Common::Point(10, 10), 400, 20},
+ {kDEPlainText, "What do you want to do?", kDANone, Common::Point(10, 30), 400, 20},
+ {kDEButton, "New Game", kDANewGame, Common::Point(40, 30), 50, 20},
+ {kDEButton, "Load", kDALoadGame, Common::Point(100, 30), 50, 20},
+ {kDEButton, "Quit", kDAQuit, Common::Point(160, 30), 50, 20},
+ {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ }
}
};
diff --git a/engines/macventure/prebuilt_dialogs.h b/engines/macventure/prebuilt_dialogs.h
index 58e8f0b823..5deda1b7e9 100644
--- a/engines/macventure/prebuilt_dialogs.h
+++ b/engines/macventure/prebuilt_dialogs.h
@@ -31,12 +31,16 @@ enum DialogAction {
kDANone,
kDACloseDialog,
kDASubmit,
- kDASaveAs
+ kDASaveAs,
+ kDALoadGame,
+ kDAQuit,
+ kDANewGame
};
enum PrebuiltDialogs {
kSaveAsDialog = 0, //TODO: Currently unused, we are using ScummVM dialogs instead.
kSpeakDialog = 1,
+ kWinGameDialog = 2,
kPrebuiltDialogCount
};