diff options
author | Borja Lorente | 2016-06-16 18:17:45 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 18:24:59 +0200 |
commit | b209c52ed980db3fed608b2743eec2556869c1bb (patch) | |
tree | 90b103f45e588bb796c431d25717563f98e8c85e /engines/macventure | |
parent | b024a24821eac6f3b0e4513c853ca845d608c198 (diff) | |
download | scummvm-rg350-b209c52ed980db3fed608b2743eec2556869c1bb.tar.gz scummvm-rg350-b209c52ed980db3fed608b2743eec2556869c1bb.tar.bz2 scummvm-rg350-b209c52ed980db3fed608b2743eec2556869c1bb.zip |
MACVENTURE: Add filepath retrieval
Diffstat (limited to 'engines/macventure')
-rw-r--r-- | engines/macventure/container.h | 2 | ||||
-rw-r--r-- | engines/macventure/macventure.cpp | 21 | ||||
-rw-r--r-- | engines/macventure/macventure.h | 19 | ||||
-rw-r--r-- | engines/macventure/world.cpp | 8 | ||||
-rw-r--r-- | engines/macventure/world.h | 1 |
5 files changed, 40 insertions, 11 deletions
diff --git a/engines/macventure/container.h b/engines/macventure/container.h index e960ddb9c3..0c6a41ee17 100644 --- a/engines/macventure/container.h +++ b/engines/macventure/container.h @@ -42,7 +42,7 @@ typedef uint32 ContainerHeader; class Container { public: - Container(char *filename) { + Container(const char *filename) { if (!_file.open(filename)) error("Could not open %s", filename); diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 92ae709b5e..821a786924 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -53,6 +53,10 @@ MacVentureEngine::~MacVentureEngine() { delete _rnd; delete _debugger; delete _gui; + + if (_filenames) { + delete _filenames; + } } Common::Error MacVentureEngine::run() { @@ -72,6 +76,10 @@ Common::Error MacVentureEngine::run() { if (!loadGlobalSettings()) error("Could not load the engine settings"); + // Engine-wide loading + _filenames = new StringTable(this, _resourceManager, kFilenamesStringTableID); + + // Big class instantiation _gui = new Gui(this, _resourceManager); _world = new World(this, _resourceManager); @@ -96,7 +104,7 @@ void MacVentureEngine::requestUnpause() { _paused = false; } -const GlobalSettings& MacVentureEngine::getGlobalSettings() { +const GlobalSettings& MacVentureEngine::getGlobalSettings() const { return _globalSettings; } @@ -106,7 +114,7 @@ bool MacVentureEngine::isPaused() { return _paused; } -Common::String MacVentureEngine::getCommandsPausedString() { +Common::String MacVentureEngine::getCommandsPausedString() const { return Common::String("Click to continue"); } @@ -127,6 +135,15 @@ void MacVentureEngine::processEvents() { } } +Common::String MacVentureEngine::getFilePath(FilePathID id) const { + const Common::Array<Common::String> *names = _filenames->getStrings(); + if (id <= 3) { // We don't want a file in the subdirectory + return Common::String((*names)[id]); + } else { // We want a game file + return Common::String((*names)[3] + "/" + (*names)[id]); + } +} + // Data loading bool MacVentureEngine::loadGlobalSettings() { diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h index 3a20bbe2a8..d4f1a33fb9 100644 --- a/engines/macventure/macventure.h +++ b/engines/macventure/macventure.h @@ -32,6 +32,7 @@ #include "macventure/gui.h" #include "macventure/world.h" +#include "macventure/stringtable.h" struct ADGameDescription; @@ -65,6 +66,18 @@ enum { kStartGameFilenameID = 0x85 }; +enum FilePathID { + kMCVID = 1, + kTitlePathID = 2, + kSubdirPathID = 3, + kObjectPathID = 4, + kFilterPathID = 5, + kTextPathID = 6, + kGraphicPathID = 7, + kSoundPathID = 8 +}; + + struct GlobalSettings { uint16 numObjects; // number of game objects defined uint16 numGlobals; // number of globals defined @@ -99,8 +112,9 @@ public: // Data retrieval bool isPaused(); - Common::String getCommandsPausedString(); - const GlobalSettings& getGlobalSettings(); + Common::String getCommandsPausedString() const; + const GlobalSettings& getGlobalSettings() const; + Common::String getFilePath(FilePathID id) const; private: void processEvents(); @@ -121,6 +135,7 @@ private: // Attributes // Engine state GlobalSettings _globalSettings; + StringTable *_filenames; bool _shouldQuit; bool _paused; diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index 68faa0a5d1..cdc0e1682e 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -19,12 +19,8 @@ World::World(MacVentureEngine *engine, Common::MacResManager *resMan) { _saveGame = new SaveGame(_engine, saveGameRes); - _objectConstants = new Container("Shadowgate II/Shadow Graphic"); - - uint32 size = _objectConstants->getItemByteSize(2); - char * ob1 = new char[size]; - _objectConstants->getItem(2, ob1); - + _objectConstants = new Container(_engine->getFilePath(kObjectPathID).c_str()); + delete saveGameRes; saveGameFile.close(); } diff --git a/engines/macventure/world.h b/engines/macventure/world.h index 38eb4bbc9d..eed7b50363 100644 --- a/engines/macventure/world.h +++ b/engines/macventure/world.h @@ -66,6 +66,7 @@ private: SaveGame *_saveGame; Container *_objectConstants; + Container *_gameText; }; |