aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/resources.cpp4
-rw-r--r--engines/xeen/resources.h4
-rw-r--r--engines/xeen/scripts.cpp10
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_cutscenes.h8
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_menu.cpp160
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_menu.h38
-rw-r--r--engines/xeen/xeen.cpp13
-rw-r--r--engines/xeen/xeen.h4
8 files changed, 210 insertions, 31 deletions
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 6ea4252999..14c87d6a1a 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -66,8 +66,8 @@ void Resources::loadData() {
file.syncString(DARK_SIDE_CREDITS);
file.syncString(SWORDS_CREDITS1);
file.syncString(SWORDS_CREDITS2);
- file.syncString(CLOUDS_MAIN_MENU);
- file.syncString(WORLD_MAIN_MENU);
+ file.syncString(OPTIONS_MENU);
+ file.syncStrings(GAME_NAMES, 3);
file.syncString(THE_PARTY_NEEDS_REST);
file.syncString(WHO_WILL);
file.syncString(HOW_MUCH);
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index b14b9f5273..6dff6a7de9 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -120,8 +120,8 @@ public:
const char *DARK_SIDE_CREDITS;
const char *SWORDS_CREDITS1;
const char *SWORDS_CREDITS2;
- const char *CLOUDS_MAIN_MENU;
- const char *WORLD_MAIN_MENU;
+ const char *OPTIONS_MENU;
+ const char *GAME_NAMES[3];
const char *THE_PARTY_NEEDS_REST;
const char *WHO_WILL;
const char *HOW_MUCH;
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index a3aa67baf8..ffe4e2dfe9 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1085,7 +1085,7 @@ bool Scripts::cmdCutsceneEndClouds(ParamsIterator &params) {
party._mazePosition = Common::Point(18, 4);
g_vm->_gameWon[0] = true;
- g_vm->_finalScore[0] = party.getScore();
+ g_vm->_finalScore = party.getScore();
g_vm->saveSettings();
doCloudsEnding();
@@ -1421,7 +1421,7 @@ bool Scripts::cmdCutsceneEndDarkside(ParamsIterator &params) {
party._mazePosition = Common::Point(25, 21);
g_vm->_gameWon[1] = true;
- g_vm->_finalScore[1] = party.getScore();
+ g_vm->_finalScore = party.getScore();
g_vm->saveSettings();
doDarkSideEnding();
@@ -1429,6 +1429,12 @@ bool Scripts::cmdCutsceneEndDarkside(ParamsIterator &params) {
}
bool Scripts::cmdCutsceneEndWorld(ParamsIterator &params) {
+ Party &party = *g_vm->_party;
+
+ g_vm->_gameWon[2] = true;
+ g_vm->_finalScore = party.getScore();
+ g_vm->saveSettings();
+
_vm->_saves->_wonWorld = true;
_vm->_party->_worldEnd = true;
diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.h b/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
index bd78593e8c..6fee060c3d 100644
--- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
+++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
@@ -70,14 +70,14 @@ private:
* Part 4 of World of Xeen ending
*/
void worldEnding4();
-protected:
+public:
+ WorldOfXeenCutscenes(XeenEngine *vm) : _vm(vm), CloudsCutscenes(vm),
+ DarkSideCutscenes(vm), _goober(NON_GOOBER), _finalScore(0) {}
+
/**
* Shows the World of Xeen ending sequence
*/
void showWorldOfXeenEnding(GooberState state, uint score);
-public:
- WorldOfXeenCutscenes(XeenEngine *vm) : _vm(vm), CloudsCutscenes(vm),
- DarkSideCutscenes(vm), _goober(NON_GOOBER), _finalScore(0) {}
};
} // End of namespace WorldOfXeen
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
index 7b60a70043..36d6b7c95e 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
@@ -264,7 +264,7 @@ void CloudsMenuDialog::draw() {
Window &w = windows[GAME_WINDOW];
w.frame();
- w.writeString(Common::String::format(Res.CLOUDS_MAIN_MENU, g_vm->_gameWon[0] ? 117 : 92));
+ w.writeString(Common::String::format(Res.OPTIONS_MENU, Res.GAME_NAMES[0], g_vm->_gameWon[0] ? 117 : 92, 1992));
drawButtons(&w);
}
@@ -279,7 +279,8 @@ bool CloudsMenuDialog::handleEvents() {
delete this;
// Show clouds ending
- WOX_VM.showCloudsEnding(g_vm->_finalScore[0]);
+ WOX_VM._sound->stopAllAudio();
+ WOX_VM.showCloudsEnding(g_vm->_finalScore);
return true;
}
break;
@@ -363,10 +364,16 @@ bool DarkSideMenuDialog::handleEvents() {
return true;
switch (_buttonValue) {
- case Common::KEYCODE_o:
+ case Common::KEYCODE_o: {
// Show other options dialog
- // TODO
- break;
+ // Remove this dialog
+ MainMenuContainer *owner = _owner;
+ delete this;
+
+ // Set the new options dialog
+ owner->setOwner(new OtherOptionsDialog(owner));
+ return true;
+ }
default:
break;
@@ -405,7 +412,7 @@ void WorldMenuDialog::draw() {
Window &w = windows[GAME_WINDOW];
w.frame();
- w.writeString(Res.WORLD_MAIN_MENU);
+ w.writeString(Common::String::format(Res.OPTIONS_MENU, Res.GAME_NAMES[2], 117, 1993));
drawButtons(&w);
}
@@ -414,10 +421,16 @@ bool WorldMenuDialog::handleEvents() {
return true;
switch (_buttonValue) {
- case Common::KEYCODE_o:
+ case Common::KEYCODE_o: {
// Show other options dialog
- // TODO
- break;
+ // Remove this dialog
+ MainMenuContainer *owner = _owner;
+ delete this;
+
+ // Set the new options dialog
+ owner->setOwner(new OtherOptionsDialog(owner));
+ return true;
+ }
default:
break;
@@ -426,6 +439,135 @@ bool WorldMenuDialog::handleEvents() {
return false;
}
+/*------------------------------------------------------------------------*/
+
+OtherOptionsDialog::OtherOptionsDialog(MainMenuContainer *owner) : MenuContainerDialog(owner) {
+ Windows &windows = *g_vm->_windows;
+ Window &w = windows[GAME_WINDOW];
+
+ int height = (g_vm->getGameID() == GType_WorldOfXeen ? 25 : 0)
+ + (g_vm->getGameID() == GType_WorldOfXeen && g_vm->_gameWon[0] ? 25 : 0)
+ + (g_vm->_gameWon[1] ? 25 : 0)
+ + (g_vm->_gameWon[2] ? 25 : 0)
+ + 75;
+
+ w.setBounds(Common::Rect(72, 25, 248, 25 + height));
+ w.open();
+
+ loadButtons();
+}
+
+OtherOptionsDialog::~OtherOptionsDialog() {
+ Windows &windows = *g_vm->_windows;
+ Window &w = windows[GAME_WINDOW];
+ w.close();
+}
+
+void OtherOptionsDialog::loadButtons() {
+ _buttonSprites.load("special.icn");
+ Common::Rect r(93, 53, 227, 73);
+
+ // View Darkside Intro
+ addButton(r, Common::KEYCODE_d, &_buttonSprites);
+ r.translate(0, 25);
+
+ // View Clouds Intro
+ if (g_vm->getGameID() == GType_WorldOfXeen) {
+ addButton(r, Common::KEYCODE_c, &_buttonSprites);
+ r.translate(0, 25);
+ } else {
+ addButton(Common::Rect(), Common::KEYCODE_INVALID);
+ }
+
+ // View Darkside End
+ if (g_vm->_gameWon[1]) {
+ addButton(r, Common::KEYCODE_e, &_buttonSprites);
+ r.translate(0, 25);
+ } else {
+ addButton(Common::Rect(), Common::KEYCODE_INVALID);
+ }
+
+ // View Clouds End
+ if (g_vm->_gameWon[0]) {
+ addButton(r, Common::KEYCODE_v, &_buttonSprites);
+ r.translate(0, 25);
+ } else {
+ addButton(Common::Rect(), Common::KEYCODE_INVALID);
+ }
+
+ // View World End
+ if (g_vm->_gameWon[2]) {
+ addButton(r, Common::KEYCODE_w, &_buttonSprites);
+ } else {
+ addButton(Common::Rect(), Common::KEYCODE_INVALID);
+ }
+}
+
+void OtherOptionsDialog::draw() {
+ Windows &windows = *g_vm->_windows;
+ Window &w = windows[GAME_WINDOW];
+
+ w.frame();
+ w.writeString(Common::String::format(Res.OPTIONS_MENU,
+ Res.GAME_NAMES[g_vm->getGameID() == GType_WorldOfXeen ? 2 : 1],
+ w.getBounds().height() - 33, 1993));
+ drawButtons(&w);
+}
+
+bool OtherOptionsDialog::handleEvents() {
+ Sound &sound = *g_vm->_sound;
+ checkEvents(g_vm);
+
+ switch (_buttonValue) {
+ case Common::KEYCODE_d:
+ delete this;
+ sound.stopAllAudio();
+ WOX_VM.showDarkSideIntro(false);
+ break;
+
+ case Common::KEYCODE_c:
+ if (g_vm->getGameID() == GType_WorldOfXeen) {
+ delete this;
+ sound.stopAllAudio();
+ WOX_VM.showCloudsIntro();
+ }
+ break;
+
+ case Common::KEYCODE_e:
+ if (g_vm->_gameWon[1]) {
+ delete this;
+ sound.stopAllAudio();
+ WOX_VM.showDarkSideEnding(g_vm->_finalScore);
+ }
+ break;
+
+ case Common::KEYCODE_v:
+ if (g_vm->_gameWon[0]) {
+ delete this;
+ sound.stopAllAudio();
+ WOX_VM.showCloudsEnding(g_vm->_finalScore);
+ }
+ break;
+
+ case Common::KEYCODE_w:
+ if (g_vm->_gameWon[2]) {
+ delete this;
+ sound.stopAllAudio();
+ WOX_VM.showWorldOfXeenEnding(NON_GOOBER, g_vm->_finalScore);
+ }
+ break;
+
+ case Common::KEYCODE_ESCAPE:
+ // Exit dialog
+ delete this;
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
} // End of namespace WorldOfXeen
} // End of namespace Xeen
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.h b/engines/xeen/worldofxeen/worldofxeen_menu.h
index 1db78b9b0d..f3cee755f3 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.h
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.h
@@ -29,14 +29,14 @@
namespace Xeen {
namespace WorldOfXeen {
-class MainMenuDialog;
+class MenuContainerDialog;
class MainMenuContainer {
private:
uint _animateCtr;
uint _frameCount;
SpriteResource _backgroundSprites;
- MainMenuDialog *_dialog;
+ MenuContainerDialog *_dialog;
protected:
/**
* Draws the main menu background
@@ -76,7 +76,7 @@ public:
/**
* Sets the dialog being displayed in the menu
*/
- void setOwner(MainMenuDialog *dlalog) {
+ void setOwner(MenuContainerDialog *dlalog) {
_dialog = dlalog;
}
};
@@ -129,7 +129,7 @@ public:
};
class MenuContainerDialog : public ButtonContainer {
-private:
+protected:
MainMenuContainer *_owner;
public:
/**
@@ -270,6 +270,36 @@ public:
virtual bool handleEvents();
};
+class OtherOptionsDialog : public MenuContainerDialog {
+private:
+ SpriteResource _buttonSprites;
+private:
+ /**
+ * Loads buttons for the dialog
+ */
+ void loadButtons();
+public:
+ /**
+ * Constructor
+ */
+ OtherOptionsDialog(MainMenuContainer *owner);
+
+ /**
+ * Destructor
+ */
+ virtual ~OtherOptionsDialog();
+
+ /**
+ * Draws the dialog
+ */
+ virtual void draw();
+
+ /**
+ * Handles events
+ */
+ virtual bool handleEvents();
+};
+
} // End of namespace WorldOfXeen
} // End of namespace Xeen
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 6122f4deea..c209420086 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -62,8 +62,8 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
_mode = MODE_0;
_endingScore = 0;
_loadSaveSlot = -1;
- _gameWon[0] = _gameWon[1] = false;
- _finalScore[0] = _finalScore[1] = 0;
+ _gameWon[0] = _gameWon[1] = _gameWon[2] = false;
+ _finalScore = 0;
g_vm = this;
}
@@ -116,8 +116,8 @@ bool XeenEngine::initialize() {
// Load settings
_gameWon[0] = ConfMan.hasKey("game_won") && ConfMan.getBool("game_won");
_gameWon[1] = ConfMan.hasKey("game_won2") && ConfMan.getBool("game_won2");
- _finalScore[0] = ConfMan.hasKey("final_score") ? ConfMan.getInt("final_score") : 0;
- _finalScore[1] = ConfMan.hasKey("final_score2") ? ConfMan.getInt("final_score2") : 0;
+ _gameWon[2] = ConfMan.hasKey("game_won3") && ConfMan.getBool("game_won3");
+ _finalScore = ConfMan.hasKey("final_score") ? ConfMan.getInt("final_score") : 0;
// If requested, load a savegame instead of showing the intro
if (ConfMan.hasKey("save_slot")) {
@@ -307,9 +307,10 @@ void XeenEngine::saveSettings() {
ConfMan.setBool("game_won", true);
if (_gameWon[1])
ConfMan.setBool("game_won2", true);
+ if (_gameWon[2])
+ ConfMan.setBool("game_won3", true);
- ConfMan.setInt("final_score", _finalScore[0]);
- ConfMan.setInt("final_score2", _finalScore[1]);
+ ConfMan.setInt("final_score", _finalScore);
ConfMan.flushToDisk();
}
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 62b3a7e426..d26ffdebab 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -183,8 +183,8 @@ public:
bool _noDirectionSense;
bool _startupWindowActive;
uint _endingScore;
- bool _gameWon[2];
- uint _finalScore[2];
+ bool _gameWon[3];
+ uint _finalScore;
public:
XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc);
virtual ~XeenEngine();