diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index ec1d894f7aa0..776d5df80a7f 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -60,6 +60,11 @@ World::World() { _storageScene._name = STORAGESCENE; _orderedScenes.push_back(&_storageScene); _scenes[STORAGESCENE] = &_storageScene; + + _gameOverMessage = nullptr; + _saveBeforeQuitMessage = nullptr; + _saveBeforeCloseMessage = nullptr; + _revertMessage = nullptr; } bool World::loadWorld(Common::MacResManager *resMan) { @@ -106,6 +111,28 @@ bool World::loadWorld(Common::MacResManager *resMan) { delete res; } + Common::String *message; + if ((message = loadStringFromDITL(resMan, 2910, 1)) != NULL) { + message->trim(); + warning("_gameOverMessage: %s", message->c_str()); + _gameOverMessage = message; + } + if ((message = loadStringFromDITL(resMan, 2480, 3)) != NULL) { + message->trim(); + warning("_saveBeforeQuitMessage: %s", message->c_str()); + _saveBeforeQuitMessage = message; + } + if ((message = loadStringFromDITL(resMan, 2490, 3)) != NULL) { + message->trim(); + warning("_saveBeforeCloseMessage: %s", message->c_str()); + _saveBeforeCloseMessage = message; + } + if ((message = loadStringFromDITL(resMan, 2940, 2)) != NULL) { + message->trim(); + warning("_revertMessage: %s", message->c_str()); + _revertMessage = message; + } + // Load scenes resArray = resMan->getResIDArray(MKTAG('A','S','C','N')); debug(3, "Loading %d scenes", resArray.size()); @@ -221,4 +248,22 @@ void World::loadExternalSounds(String fname) { } } +Common::String *World::loadStringFromDITL(Common::MacResManager *resMan, int resourceId, int itemIndex) { + Common::SeekableReadStream *res = resMan->getResource(MKTAG('D','I','T','L'), resourceId); + if (res) { + int itemCount = res->readSint16BE(); + for (int i = 0; i <= itemCount; i++) { + // int placeholder; short rect[4]; byte flags; pstring str; + res->skip(13); + Common::String message = readPascalString(res); + if (i == itemIndex) { + Common::String *msg = new Common::String(message); + return msg; + } + } + } + + return NULL; +} + } // End of namespace Wage diff --git a/engines/wage/world.h b/engines/wage/world.h index 1b1bc73e9f72..1514b57b2095 100644 --- a/engines/wage/world.h +++ b/engines/wage/world.h @@ -59,6 +59,7 @@ class World { bool loadWorld(Common::MacResManager *resMan); void loadExternalSounds(String fname); + Common::String *loadStringFromDITL(Common::MacResManager *resMan, int resourceId, int itemIndex); String _name; String _aboutMessage; @@ -80,6 +81,11 @@ class World { Chr *_player; //List moveListeners; + Common::String *_gameOverMessage; + Common::String *_saveBeforeQuitMessage; + Common::String *_saveBeforeCloseMessage; + Common::String *_revertMessage; + void addScene(Scene *room) { if (room->_name.size() != 0) { String s = room->_name;