Skip to content

Commit

Permalink
WAGE: Implementing loading service dialog strings
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent bb46957 commit 5b957c4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
45 changes: 45 additions & 0 deletions engines/wage/world.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions engines/wage/world.h
Expand Up @@ -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;
Expand All @@ -80,6 +81,11 @@ class World {
Chr *_player;
//List<MoveListener> 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;
Expand Down

0 comments on commit 5b957c4

Please sign in to comment.