aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/menu_views.cpp15
-rw-r--r--engines/mads/menu_views.h17
-rw-r--r--engines/mads/nebular/dialogs_nebular.cpp4
-rw-r--r--engines/mads/nebular/game_nebular.cpp26
-rw-r--r--engines/mads/nebular/menu_nebular.cpp15
-rw-r--r--engines/mads/nebular/menu_nebular.h12
-rw-r--r--engines/mads/scene.cpp3
7 files changed, 83 insertions, 9 deletions
diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp
index 857db68fa6..1314774371 100644
--- a/engines/mads/menu_views.cpp
+++ b/engines/mads/menu_views.cpp
@@ -80,6 +80,15 @@ bool MenuView::onEvent(Common::Event &event) {
return false;
}
+Common::String MenuView::getResourceName() {
+ Common::String s(_filename);
+ s.toLowercase();
+ while (s.contains('.'))
+ s.deleteLastChar();
+
+ return s;
+}
+
/*------------------------------------------------------------------------*/
char TextView::_resourceName[100];
@@ -112,12 +121,17 @@ TextView::TextView(MADSEngine *vm) : MenuView(vm) {
}
TextView::~TextView() {
+ // Turn off palette cycling as well as any playing sound
+ Scene &scene = _vm->_game->_scene;
+ scene._cyclingActive = false;
+ _vm->_sound->stop();
}
void TextView::load() {
Common::String scriptName(_resourceName);
scriptName += ".txr";
+ _filename = scriptName;
if (!_script.open(scriptName))
error("Could not open resource %s", _resourceName);
@@ -491,6 +505,7 @@ void AnimationView::load() {
if (!resName.hasSuffix("."))
resName += ".res";
+ _filename = resName;
if (!_script.open(resName))
error("Could not open resource %s", resName.c_str());
diff --git a/engines/mads/menu_views.h b/engines/mads/menu_views.h
index 6faa665bff..c13213c3ed 100644
--- a/engines/mads/menu_views.h
+++ b/engines/mads/menu_views.h
@@ -36,6 +36,7 @@ class MenuView: public FullScreenDialog {
protected:
bool _breakFlag;
bool _redrawFlag;
+ Common::String _filename;
virtual void doFrame() = 0;
@@ -51,6 +52,8 @@ public:
virtual ~MenuView() {}
virtual void show();
+
+ Common::String getResourceName();
};
struct TextLine {
@@ -107,11 +110,6 @@ private:
int getParameter(const char **paramP);
/**
- * Called when the script is finished
- */
- void scriptDone();
-
- /**
* Reset the game palette
*/
void resetPalette();
@@ -119,6 +117,11 @@ protected:
virtual void display();
virtual void doFrame();
+
+ /**
+ * Called when the script is finished
+ */
+ virtual void scriptDone();
public:
/**
* Queue the given text resource for display
@@ -201,8 +204,6 @@ private:
int getParameter();
- void scriptDone();
-
void loadNextResource();
protected:
virtual void display();
@@ -210,6 +211,8 @@ protected:
virtual void doFrame();
virtual bool onEvent(Common::Event &event);
+
+ virtual void scriptDone();
public:
/**
* Queue the given text resource for display
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 86244bd3bb..1900a12b59 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -314,13 +314,13 @@ void DialogsNebular::showDialog() {
break;
}
case DIALOG_TEXTVIEW: {
- TextView *dlg = new TextView(_vm);
+ TextView *dlg = new RexTextView(_vm);
dlg->show();
delete dlg;
break;
}
case DIALOG_ANIMVIEW: {
- AnimationView *dlg = new AnimationView(_vm);
+ AnimationView *dlg = new RexAnimationView(_vm);
dlg->show();
delete dlg;
break;
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 902f42507a..eae74d6da0 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -27,6 +27,7 @@
#include "mads/game.h"
#include "mads/screen.h"
#include "mads/msurface.h"
+#include "mads/menu_views.h"
#include "mads/nebular/game_nebular.h"
#include "mads/nebular/dialogs_nebular.h"
#include "mads/nebular/globals_nebular.h"
@@ -309,6 +310,31 @@ void GameNebular::setSectionHandler() {
}
void GameNebular::checkShowDialog() {
+ // Handling to start endgame sequences if the win/lose type has been set
+ switch (_winStatus) {
+ case 1:
+ // No shields failure ending
+ AnimationView::execute(_vm, "rexend1");
+ break;
+ case 2:
+ // Shields, but no targetting failure ending
+ AnimationView::execute(_vm, "rexend2");
+ break;
+ case 3:
+ // Completed game successfully, so activate quotes item on the main menu
+ ConfMan.setBool("ShowQuotes", true);
+ ConfMan.flushToDisk();
+
+ AnimationView::execute(_vm, "rexend3");
+ break;
+ case 4:
+ // Decompression ending
+ TextView::execute(_vm, "ending4");
+ break;
+ }
+ _winStatus = 0;
+
+ // Loop for showing dialogs, if any need to be shown
if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[kCopyProtectFailed]) {
_player.releasePlayerSprites();
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp
index 717e3f6cf9..46dc411678 100644
--- a/engines/mads/nebular/menu_nebular.cpp
+++ b/engines/mads/nebular/menu_nebular.cpp
@@ -375,6 +375,21 @@ bool AdvertView::onEvent(Common::Event &event) {
return false;
}
+/*------------------------------------------------------------------------*/
+
+void RexAnimationView::scriptDone() {
+ AnimationView::scriptDone();
+
+ Common::String s = getResourceName();
+ if (s == "rexend1") {
+ TextView::execute(_vm, "ending1");
+ } else if (s == "rexend2") {
+ TextView::execute(_vm, "ending2");
+ } else if (s == "rexend3") {
+ TextView::execute(_vm, "credits");
+ }
+}
+
} // End of namespace Nebular
} // End of namespace MADS
diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h
index 29777a7a7c..d00439c1e4 100644
--- a/engines/mads/nebular/menu_nebular.h
+++ b/engines/mads/nebular/menu_nebular.h
@@ -128,6 +128,18 @@ public:
void show();
};
+class RexAnimationView : public AnimationView {
+protected:
+ virtual void scriptDone();
+public:
+ RexAnimationView(MADSEngine *vm) : AnimationView(vm) {}
+};
+
+class RexTextView : public TextView {
+public:
+ RexTextView(MADSEngine *vm) : TextView(vm) {}
+};
+
} // End of namespace Nebular
} // End of namespace MADS
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index ad24dd4f60..18ceb3c813 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -360,6 +360,9 @@ void Scene::loop() {
if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_trigger
&& _vm->_game->_player._stepEnabled)
_reloadSceneFlag = true;
+
+ if (_vm->_game->_winStatus)
+ break;
}
}