mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 08:48:13 +00:00
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
This commit is contained in:
parent
f198c16f45
commit
99729bc15d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
));
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user