[Scummvm-cvs-logs] scummvm master -> 19a9c068f994d5800a60dff6f14221f03f5d4cc3

bluegr bluegr at gmail.com
Sun Mar 15 03:06:10 CET 2015


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:
19a9c068f9 MADS: Hook up all of the remaining options, and add custom game options


Commit: 19a9c068f994d5800a60dff6f14221f03f5d4cc3
    https://github.com/scummvm/scummvm/commit/19a9c068f994d5800a60dff6f14221f03f5d4cc3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-03-15T04:05:06+02:00

Commit Message:
MADS: Hook up all of the remaining options, and add custom game options

Changed paths:
    engines/mads/detection.cpp
    engines/mads/game.h
    engines/mads/mads.cpp
    engines/mads/nebular/dialogs_nebular.cpp
    engines/mads/nebular/game_nebular.h



diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp
index 971acde..ea71fc8 100644
--- a/engines/mads/detection.cpp
+++ b/engines/mads/detection.cpp
@@ -29,6 +29,7 @@
 #include "common/memstream.h"
 #include "engines/advancedDetector.h"
 #include "common/system.h"
+#include "common/translation.h"
 #include "graphics/colormasks.h"
 #include "graphics/surface.h"
 #include "mads/events.h"
@@ -75,11 +76,71 @@ static const PlainGameDescriptor MADSGames[] = {
 	{0, 0}
 };
 
+#define GAMEOPTION_EASY_MOUSE          GUIO_GAMEOPTIONS1
+#define GAMEOPTION_ANIMATED_INVENTORY  GUIO_GAMEOPTIONS2
+#define GAMEOPTION_ANIMATED_INTERFACE  GUIO_GAMEOPTIONS3
+#define GAMEOPTION_NAUGHTY_MODE        GUIO_GAMEOPTIONS4
+//#define GAMEOPTION_GRAPHICS_DITHERING  GUIO_GAMEOPTIONS5
+
 #include "mads/detection_tables.h"
 
+static const ADExtraGuiOptionsMap optionsList[] = {
+	{
+		GAMEOPTION_EASY_MOUSE,
+		{
+			_s("Easy mouse interface"),
+			_s("Shows object names when hovering the mouse over them"),
+			"EasyMouse",
+			true
+		}
+	},
+
+	{
+		GAMEOPTION_ANIMATED_INVENTORY,
+		{
+			_s("Animated inventory items"),
+			_s("Animated inventory items"),
+			"InvObjectsAnimated",
+			true
+		}
+	},
+
+	{
+		GAMEOPTION_ANIMATED_INTERFACE,
+		{
+			_s("Animated game interface"),
+			_s("Animated game interface"),
+			"TextWindowAnimated",
+			true
+		}
+	},
+
+	{
+		GAMEOPTION_NAUGHTY_MODE,
+		{
+			_s("Naughty game mode"),
+			_s("Naughty game mode"),
+			"NaughtyMode",
+			true
+		}
+	},
+
+	/*{
+		GAMEOPTION_GRAPHICS_DITHERING,
+		{
+			_s("Graphics dithering"),
+			_s("Graphics dithering"),
+			"GraphicsDithering",
+			true
+		}
+	},*/
+
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
 class MADSMetaEngine : public AdvancedMetaEngine {
 public:
-	MADSMetaEngine() : AdvancedMetaEngine(MADS::gameDescriptions, sizeof(MADS::MADSGameDescription), MADSGames) {
+	MADSMetaEngine() : AdvancedMetaEngine(MADS::gameDescriptions, sizeof(MADS::MADSGameDescription), MADSGames, optionsList) {
 		_maxScanDepth = 3;
 	}
 
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 66f2580..d246aa5 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -195,6 +195,9 @@ public:
 	 */
 	virtual void synchronize(Common::Serializer &s, bool phase1);
 
+	virtual void setNaughtyMode(bool naughtyMode) {}
+	virtual bool getNaughtyMode() const { return true; }
+
 	// DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs
 	void clearQuotes() {}
 	void loadQuoteRange(int startNum, int endNum) {}
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 761aef3..59d600f 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -38,7 +38,7 @@ namespace MADS {
 MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
 		_gameDescription(gameDesc), Engine(syst), _randomSource("MADS") {
 
-	// Initialize fields
+	// Initialize game/engine options
 	_easyMouse = true;
 	_invObjectsAnimated = true;
 	_textWindowStill = false;
@@ -83,8 +83,6 @@ void MADSEngine::initialize() {
 	MSurface::setVm(this);
 	MSprite::setVm(this);
 
-	loadOptions();
-
 	Resources::init(this);
 	Conversation::init(this);
 	_debugger = new Debugger(this);
@@ -98,16 +96,14 @@ void MADSEngine::initialize() {
 	_audio = new AudioPlayer(_mixer, getGameID());
 	_game = Game::init(this);
 
+	loadOptions();
+
 	_screen.empty();
 }
 
 void MADSEngine::loadOptions() {
 	if (ConfMan.hasKey("EasyMouse"))
 		_easyMouse = ConfMan.getBool("EasyMouse");
-	if (ConfMan.hasKey("InvObjectsAnimated"))
-		_invObjectsAnimated = ConfMan.getBool("InvObjectsAnimated");
-	if (ConfMan.hasKey("TextWindowStill"))
-		_textWindowStill = ConfMan.getBool("TextWindowStill");
 
 	if (ConfMan.hasKey("mute") && ConfMan.getBool("mute")) {
 		_soundFlag = false;
@@ -116,16 +112,37 @@ void MADSEngine::loadOptions() {
 		_soundFlag = !ConfMan.hasKey("sfx_mute") || !ConfMan.getBool("sfx_mute");
 		_musicFlag = !ConfMan.hasGameDomain("music_mute") || !ConfMan.getBool("music_mute");
 	}
+
+	if (ConfMan.hasKey("ScreenFade"))
+		_screenFade = (ScreenFade)ConfMan.getInt("ScreenFade");
+	//if (ConfMan.hasKey("GraphicsDithering"))
+	//	_dithering = ConfMan.getBool("GraphicsDithering");
+
+	if (getGameID() == GType_RexNebular) {
+		if (ConfMan.hasKey("InvObjectsAnimated"))
+			_invObjectsAnimated = ConfMan.getBool("InvObjectsAnimated");
+		if (ConfMan.hasKey("TextWindowStill"))
+			_textWindowStill = !ConfMan.getBool("TextWindowAnimated");
+		if (ConfMan.hasKey("NaughtyMode"))
+			_game->setNaughtyMode(ConfMan.getBool("NaughtyMode"));
+	}
 }
 
 void MADSEngine::saveOptions() {
 	ConfMan.setBool("EasyMouse", _easyMouse);
-	ConfMan.setBool("InvObjectsAnimated", _invObjectsAnimated);
-	ConfMan.setBool("TextWindowStill", _textWindowStill);
+	ConfMan.setInt("ScreenFade", (int)_screenFade);
+	//ConfMan.setBool("GraphicsDithering", _dithering);
+
 	ConfMan.setBool("mute", !_soundFlag && !_musicFlag);
 	ConfMan.setBool("sfx_mute", !_soundFlag && _musicFlag);
 	ConfMan.setBool("music_mute", _soundFlag && !_musicFlag);
 
+	if (getGameID() == GType_RexNebular) {
+		ConfMan.setBool("InvObjectsAnimated", _invObjectsAnimated);
+		ConfMan.setBool("TextWindowAnimated", !_textWindowStill);
+		ConfMan.setBool("NaughtyMode", _game->getNaughtyMode());
+	}
+
 	ConfMan.flushToDisk();
 }
 
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 10fa28c..0b5e921 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -1050,12 +1050,11 @@ OptionsDialog::OptionsDialog(MADSEngine *vm) : GameDialog(vm) {
 int OptionsDialog::getOptionQuote(int option) {
 	Nebular::GameNebular &game = *(Nebular::GameNebular *)_vm->_game;
 
-	// TODO: Hook the rest of the options to the current config
 	switch (option) {
 	case 17:	// Music
-		return 24;	// 24: ON, 25: OFF
+		return _vm->_musicFlag ? 24 : 25;	// 24: ON, 25: OFF
 	case 18:	// Sound
-		return 26;	// 26: ON, 27: OFF
+		return _vm->_soundFlag ? 26 : 27;	// 26: ON, 27: OFF
 	case 19:	// Interface
 		return !_vm->_easyMouse ? 28 : 29;	// 28: Standard, 29: Easy
 	case 20:	// Inventory
@@ -1098,6 +1097,7 @@ void OptionsDialog::show() {
 	Nebular::GameNebular &game = *(Nebular::GameNebular *)_vm->_game;
 
 	// Previous options, restored when cancel is selected
+	bool prevMusicFlag = _vm->_musicFlag;
 	bool prevEasyMouse = _vm->_easyMouse;
 	bool prevInvObjectsAnimated = _vm->_invObjectsAnimated;
 	bool prevTextWindowStill = _vm->_textWindowStill;
@@ -1110,22 +1110,19 @@ void OptionsDialog::show() {
 
 		switch (_selectedLine) {
 		case 1:	// Music
-			warning("STUB: Music toggle");
+			_vm->_musicFlag = _vm->_soundFlag = !_vm->_musicFlag;
 			break;
 		case 2:	// Sound
-			warning("STUB: Sound toggle");
+			_vm->_musicFlag = _vm->_soundFlag = !_vm->_musicFlag;
 			break;
 		case 3:	// Interface
 			_vm->_easyMouse = !_vm->_easyMouse;
-			_vm->saveOptions();
 			break;
 		case 4:	// Inventory
 			_vm->_invObjectsAnimated = !_vm->_invObjectsAnimated;
-			_vm->saveOptions();
 			break;
 		case 5:	// Text window
 			_vm->_textWindowStill = !_vm->_textWindowStill;
-			_vm->saveOptions();
 			break;
 		case 6:	// Screen fade
 			if (_vm->_screenFade == SCREEN_FADE_FAST)
@@ -1150,16 +1147,17 @@ void OptionsDialog::show() {
 		setLines();
 	} while (!_vm->shouldQuit() && _selectedLine != 0 && _selectedLine <= 7);
 
-	// If Done button not pressed, reset settings
-	if (_selectedLine != 8) {
-		// Revert all options from the saved ones
+	if (_selectedLine == 8) {
+		// OK button, save settings
+		_vm->saveOptions();
+	} else if (_selectedLine == 9) {
+		// Cancel button, revert all options from the saved ones
+		_vm->_musicFlag = prevMusicFlag;
 		_vm->_easyMouse = prevEasyMouse;
 		_vm->_invObjectsAnimated = prevInvObjectsAnimated;
 		_vm->_textWindowStill = prevTextWindowStill;
 		_vm->_screenFade = prevScreenFade;
 		game._storyMode = prevStoryMode;
-
-		_vm->saveOptions();
 	}
 }
 
diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h
index efa21a2..1b89d11 100644
--- a/engines/mads/nebular/game_nebular.h
+++ b/engines/mads/nebular/game_nebular.h
@@ -131,6 +131,9 @@ public:
 	virtual void step();
 
 	virtual void synchronize(Common::Serializer &s, bool phase1);
+
+	virtual void setNaughtyMode(bool naughtyMode) { _storyMode = naughtyMode ? STORYMODE_NAUGHTY : STORYMODE_NICE; }
+	virtual bool getNaughtyMode() const { return _storyMode == STORYMODE_NAUGHTY; }
 };
 
 // Section handlers aren't needed in ScummVM implementation






More information about the Scummvm-git-logs mailing list