aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-25 23:12:14 -0400
committerPaul Gilbert2018-03-25 23:14:22 -0400
commit99729bc15d994fa0b5b6b98a19faa252b7c1415e (patch)
tree5026accf42239921f63abcfb839e8405ef53a2cb /engines
parentf198c16f455bcbab0b5908eee2771146af544969 (diff)
downloadscummvm-rg350-99729bc15d994fa0b5b6b98a19faa252b7c1415e.tar.gz
scummvm-rg350-99729bc15d994fa0b5b6b98a19faa252b7c1415e.tar.bz2
scummvm-rg350-99729bc15d994fa0b5b6b98a19faa252b7c1415e.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/detection.cpp21
-rw-r--r--engines/xeen/detection_tables.h12
-rw-r--r--engines/xeen/dialogs/dialogs_items.cpp7
-rw-r--r--engines/xeen/xeen.cpp10
-rw-r--r--engines/xeen/xeen.h14
5 files changed, 52 insertions, 12 deletions
diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp
index f245900154..49b74b24a2 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 c311bde202..282fc62cc7 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 a43439b15b..9a029dc1c3 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 f645732562..bf71c8ee6f 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 90452ae5e3..b6a95f0d43 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();