[Scummvm-git-logs] scummvm master -> 99729bc15d994fa0b5b6b98a19faa252b7c1415e

dreammaster dreammaster at scummvm.org
Mon Mar 26 05:14:55 CEST 2018


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:
99729bc15d XEEN: Add custom engine option for showing inventory item costs


Commit: 99729bc15d994fa0b5b6b98a19faa252b7c1415e
    https://github.com/scummvm/scummvm/commit/99729bc15d994fa0b5b6b98a19faa252b7c1415e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-25T23:14:22-04:00

Commit Message:
XEEN: Add custom engine option for showing inventory item costs

This first new option displays the effective cost of items
when viewing in the standard character inventory. This makes
it easier to compare the value (and thus relative power)
of items against either other

Changed paths:
    engines/xeen/detection.cpp
    engines/xeen/detection_tables.h
    engines/xeen/dialogs/dialogs_items.cpp
    engines/xeen/xeen.cpp
    engines/xeen/xeen.h


diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp
index f245900..49b74b2 100644
--- a/engines/xeen/detection.cpp
+++ b/engines/xeen/detection.cpp
@@ -28,6 +28,7 @@
 #include "common/savefile.h"
 #include "engines/advancedDetector.h"
 #include "common/system.h"
+#include "common/translation.h"
 
 #define MAX_SAVES 99
 
@@ -71,11 +72,29 @@ static const PlainGameDescriptor XeenGames[] = {
 	{0, 0}
 };
 
+#define GAMEOPTION_SHOW_ITEM_COSTS	GUIO_GAMEOPTIONS1
+
 #include "xeen/detection_tables.h"
 
+
+static const ADExtraGuiOptionsMap optionsList[] = {
+	{
+		GAMEOPTION_SHOW_ITEM_COSTS,
+		{
+			_s("Show item costs in standard inventory mode"),
+			_s("Shows item costs in standard inventory mode, allowing the value of items to be compared"),
+			"ShowItemCosts",
+			false
+		}
+	},
+
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
 class XeenMetaEngine : public AdvancedMetaEngine {
 public:
-	XeenMetaEngine() : AdvancedMetaEngine(Xeen::gameDescriptions, sizeof(Xeen::XeenGameDescription), XeenGames) {
+	XeenMetaEngine() : AdvancedMetaEngine(Xeen::gameDescriptions, sizeof(Xeen::XeenGameDescription),
+			XeenGames, optionsList) {
 		_maxScanDepth = 3;
 	}
 
diff --git a/engines/xeen/detection_tables.h b/engines/xeen/detection_tables.h
index c311bde..282fc62 100644
--- a/engines/xeen/detection_tables.h
+++ b/engines/xeen/detection_tables.h
@@ -36,7 +36,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_WorldOfXeen,
 		0
@@ -55,7 +55,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::DE_DEU,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_WorldOfXeen,
 		0
@@ -74,7 +74,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_WorldOfXeen,
 		0
@@ -92,7 +92,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_Clouds,
 		0
@@ -110,7 +110,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_DarkSide,
 		0
@@ -128,7 +128,7 @@ static const XeenGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GAMEOPTION_SHOW_ITEM_COSTS)
 		},
 		GType_Swords,
 		0
diff --git a/engines/xeen/dialogs/dialogs_items.cpp b/engines/xeen/dialogs/dialogs_items.cpp
index a43439b..9a029dc 100644
--- a/engines/xeen/dialogs/dialogs_items.cpp
+++ b/engines/xeen/dialogs/dialogs_items.cpp
@@ -149,8 +149,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
 				case CATEGORY_ARMOR:
 				case CATEGORY_ACCESSORY:
 					if (i._id) {
-						if (mode == ITEMMODE_CHAR_INFO || mode == ITEMMODE_8
-								|| mode == ITEMMODE_ENCHANT || mode == ITEMMODE_RECHARGE) {
+						if ((mode == ITEMMODE_CHAR_INFO && !g_vm->_extOptions._showItemCosts)
+								|| mode == ITEMMODE_8 || mode == ITEMMODE_ENCHANT || mode == ITEMMODE_RECHARGE) {
 							lines.push_back(Common::String::format(Res.ITEMS_DIALOG_LINE1,
 								arr[idx], idx + 1,
 								c->_items[category].getFullDescription(idx, arr[idx]).c_str()));
@@ -158,7 +158,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
 							lines.push_back(Common::String::format(Res.ITEMS_DIALOG_LINE2,
 								arr[idx], idx + 1,
 								c->_items[category].getFullDescription(idx, arr[idx]).c_str(),
-								calcItemCost(c, idx, mode,
+								calcItemCost(c, idx,
+									(mode == ITEMMODE_CHAR_INFO) ? ITEMMODE_BLACKSMITH : mode,
 									mode == ITEMMODE_TO_GOLD ? 1 : startingChar->_skills[MERCHANT],
 									category)
 							));
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index f645732..bf71c8e 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -114,19 +114,25 @@ bool XeenEngine::initialize() {
 	syncSoundSettings();
 
 	// Load settings
+	loadSettings();
+
+	return true;
+}
+
+void XeenEngine::loadSettings() {
 	_gameWon[0] = ConfMan.hasKey("game_won") && ConfMan.getBool("game_won");
 	_gameWon[1] = ConfMan.hasKey("game_won2") && ConfMan.getBool("game_won2");
 	_gameWon[2] = ConfMan.hasKey("game_won3") && ConfMan.getBool("game_won3");
 	_finalScore = ConfMan.hasKey("final_score") ? ConfMan.getInt("final_score") : 0;
 
+	_extOptions._showItemCosts = ConfMan.hasKey("ShowItemCosts") && ConfMan.getBool("ShowItemCosts");
+
 	// If requested, load a savegame instead of showing the intro
 	if (ConfMan.hasKey("save_slot")) {
 		int saveSlot = ConfMan.getInt("save_slot");
 		if (saveSlot >= 0 && saveSlot <= 999)
 			_loadSaveSlot = saveSlot;
 	}
-
-	return true;
 }
 
 Common::Error XeenEngine::run() {
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 90452ae..b6a95f0 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -106,6 +106,14 @@ struct XeenGameDescription;
 #define XEEN_SAVEGAME_VERSION 1
 
 class XeenEngine : public Engine {
+	/**
+	 * Container to a set of options newly introduced under ScummVM
+	 */
+	struct ExtendedOptions {
+		bool _showItemCosts;
+
+		ExtendedOptions() : _showItemCosts(false) {}
+	};
 private:
 	const XeenGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
@@ -115,6 +123,11 @@ private:
 	 */
 	bool initialize();
 
+	/**
+	 * Load settings
+	 */
+	void loadSettings();
+
 	// Engine APIs
 	virtual Common::Error run();
 	virtual bool hasFeature(EngineFeature f) const;
@@ -185,6 +198,7 @@ public:
 	uint _endingScore;
 	bool _gameWon[3];
 	uint _finalScore;
+	ExtendedOptions _extOptions;
 public:
 	XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc);
 	virtual ~XeenEngine();





More information about the Scummvm-git-logs mailing list