aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-05 20:17:16 -0500
committerPaul Gilbert2015-02-05 20:17:16 -0500
commit6595abcf144850cc23208db71ce0098d9921112e (patch)
treefda5e45a51d67085f4bd036c998208f7663ecf31 /engines
parent85c2dd5f6864540d66e0abfe74ec791bbde41c30 (diff)
downloadscummvm-rg350-6595abcf144850cc23208db71ce0098d9921112e.tar.gz
scummvm-rg350-6595abcf144850cc23208db71ce0098d9921112e.tar.bz2
scummvm-rg350-6595abcf144850cc23208db71ce0098d9921112e.zip
XEEN: Moved _maeNames to a new Resources class
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/character.cpp17
-rw-r--r--engines/xeen/resources.cpp10
-rw-r--r--engines/xeen/resources.h11
-rw-r--r--engines/xeen/spells.cpp5
-rw-r--r--engines/xeen/spells.h1
-rw-r--r--engines/xeen/xeen.cpp3
-rw-r--r--engines/xeen/xeen.h2
7 files changed, 34 insertions, 15 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index ff85c97855..20cbfbd0fc 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -253,10 +253,10 @@ void WeaponItems::equipItem(int itemIndex) {
*/
Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
- Spells &spells = *vm()->_spells;
+ Resources &res = *vm()->_resources;
return Common::String::format("\f%02u%s%s%s\f%02u%s%s%s", displayNum,
- !i._bonusFlags ? spells._maeNames[i._material] : "",
+ !i._bonusFlags ? res._maeNames[i._material] : "",
(i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "",
WEAPON_NAMES[i._id],
@@ -355,10 +355,10 @@ void ArmorItems::equipItem(int itemIndex) {
*/
Common::String ArmorItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
- Spells &spells = *vm()->_spells;
+ Resources &res = *vm()->_resources;
return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
- !i._bonusFlags ? "" : spells._maeNames[i._material],
+ !i._bonusFlags ? "" : res._maeNames[i._material],
(i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "",
ARMOR_NAMES[i._id],
@@ -425,11 +425,11 @@ void AccessoryItems::equipItem(int itemIndex) {
* the Items dialog
*/
Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum) {
- Spells &spells = *vm()->_spells;
XeenItem &i = operator[](itemIndex);
+ Resources &res = *vm()->_resources;
return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
- !i._bonusFlags ? "" : spells._maeNames[i._material],
+ !i._bonusFlags ? "" : res._maeNames[i._material],
(i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "",
ARMOR_NAMES[i._id],
@@ -446,10 +446,10 @@ Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum)
*/
Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) {
XeenItem &i = operator[](itemIndex);
- Spells &spells = *vm()->_spells;
+ Resources &res = *vm()->_resources;
return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum,
- !i._bonusFlags ? "" : spells._maeNames[i._material],
+ !i._bonusFlags ? "" : res._maeNames[i._material],
(i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "",
(i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "",
ARMOR_NAMES[i._id],
@@ -458,7 +458,6 @@ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) {
);
}
-
/*------------------------------------------------------------------------*/
InventoryItemsGroup::InventoryItemsGroup(InventoryItems &weapons, InventoryItems &armor,
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index b38868f7a4..5cd09cf422 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -22,9 +22,19 @@
#include "common/scummsys.h"
#include "xeen/resources.h"
+#include "xeen/files.h"
namespace Xeen {
+Resources::Resources() {
+ File f("mae.xen");
+ while (f.pos() < f.size())
+ _maeNames.push_back(f.readString());
+ f.close();
+}
+
+/*------------------------------------------------------------------------*/
+
const char *const CREDITS =
"\013""012\010""000\003""c\014""35Designed and Directed By:\n"
"\014""17Jon Van Caneghem\003""l\n"
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index e1f276b91c..8be195f34e 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -24,10 +24,21 @@
#define XEEN_RESOURCES_H
#include "common/scummsys.h"
+#include "common/str-array.h"
#include "gui/debugger.h"
namespace Xeen {
+class Resources {
+public:
+ // Magic and equipment names
+ Common::StringArray _maeNames;
+public:
+ Resources();
+};
+
+#define Res (*_vm->_resources)
+
extern const char *const CREDITS;
extern const char *const OPTIONS_TITLE;
diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp
index 5f1df6aef0..50e77668cd 100644
--- a/engines/xeen/spells.cpp
+++ b/engines/xeen/spells.cpp
@@ -38,11 +38,6 @@ void Spells::load() {
while (f1.pos() < f1.size())
_spellNames.push_back(f1.readString());
f1.close();
-
- File f2("mae.xen");
- while (f2.pos() < f2.size())
- _maeNames.push_back(f2.readString());
- f2.close();
}
int Spells::calcSpellCost(int spellId, int expenseFactor) const {
diff --git a/engines/xeen/spells.h b/engines/xeen/spells.h
index 241d35dca7..c2f9737c80 100644
--- a/engines/xeen/spells.h
+++ b/engines/xeen/spells.h
@@ -121,7 +121,6 @@ private:
void divineIntervention();
public:
Common::StringArray _spellNames;
- Common::StringArray _maeNames;
int _lastCaster;
public:
Spells(XeenEngine *vm);
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index d7a85fbbf8..d34e8edb21 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -43,6 +43,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
_interface = nullptr;
_map = nullptr;
_party = nullptr;
+ _resources = nullptr;
_saves = nullptr;
_screen = nullptr;
_scripts = nullptr;
@@ -72,6 +73,7 @@ XeenEngine::~XeenEngine() {
delete _spells;
delete _town;
delete _eventData;
+ delete _resources;
delete _files;
}
@@ -84,6 +86,7 @@ void XeenEngine::initialize() {
// Create sub-objects of the engine
_files = new FileManager(this);
+ _resources = new Resources();
_combat = new Combat(this);
_debugger = new Debugger(this);
_events = new EventsManager(this);
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 7f1a2cd0f0..af2044b212 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -39,6 +39,7 @@
#include "xeen/interface.h"
#include "xeen/map.h"
#include "xeen/party.h"
+#include "xeen/resources.h"
#include "xeen/saves.h"
#include "xeen/screen.h"
#include "xeen/scripts.h"
@@ -139,6 +140,7 @@ public:
Interface *_interface;
Map *_map;
Party *_party;
+ Resources *_resources;
SavesManager *_saves;
Screen *_screen;
Scripts *_scripts;