[Scummvm-cvs-logs] scummvm master -> 72303564f70573dc4bacd9c726dc626920bf21e8

dreammaster dreammaster at scummvm.org
Sat Oct 18 17:21:43 CEST 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
72303564f7 MADS: Hook up Rex game endings to show the correct animation and/or credits


Commit: 72303564f70573dc4bacd9c726dc626920bf21e8
    https://github.com/scummvm/scummvm/commit/72303564f70573dc4bacd9c726dc626920bf21e8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-10-18T11:20:50-04:00

Commit Message:
MADS: Hook up Rex game endings to show the correct animation and/or credits

Changed paths:
    engines/mads/menu_views.cpp
    engines/mads/menu_views.h
    engines/mads/nebular/dialogs_nebular.cpp
    engines/mads/nebular/game_nebular.cpp
    engines/mads/nebular/menu_nebular.cpp
    engines/mads/nebular/menu_nebular.h
    engines/mads/scene.cpp



diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp
index 857db68..1314774 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 6faa665..c13213c 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 86244bd..1900a12 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 902f425..eae74d6 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 717e3f6..46dc411 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 29777a7..d00439c 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 ad24dd4..18ceb3c 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;
 	}
 }
 






More information about the Scummvm-git-logs mailing list