aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2015-12-21 15:47:10 +0100
committerEugene Sandulenko2015-12-27 15:40:58 +0100
commitc1d051da65e9790330f712c9e3962e31af965851 (patch)
treea1f30b9e01425bd00a4903c28b91fe6895d1d4f1 /engines
parent6590f2c3f7ab594ae728409d6dca3251b36798cf (diff)
downloadscummvm-rg350-c1d051da65e9790330f712c9e3962e31af965851.tar.gz
scummvm-rg350-c1d051da65e9790330f712c9e3962e31af965851.tar.bz2
scummvm-rg350-c1d051da65e9790330f712c9e3962e31af965851.zip
WAGE: More work on menu reading
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/world.cpp54
-rw-r--r--engines/wage/world.h3
2 files changed, 53 insertions, 4 deletions
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 0fd31c6232..96f3faf618 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -45,15 +45,16 @@
*
*/
+#include "common/file.h"
+#include "common/macresman.h"
+#include "common/memstream.h"
+#include "common/str-array.h"
+
#include "wage/wage.h"
#include "wage/entities.h"
#include "wage/script.h"
#include "wage/world.h"
-#include "common/file.h"
-#include "common/macresman.h"
-#include "common/memstream.h"
-
namespace Wage {
World::World() {
@@ -235,6 +236,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
res = resMan->getResource(MKTAG('M','E','N','U'), 2001);
if (res != NULL) {
+ readMenu(res);
warning("STUB: aboutMenu");
//String aboutMenuItemName = appleMenu[1].split(";")[0];
//world.setAboutMenuItemName(aboutMenuItemName);
@@ -242,6 +244,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
res = resMan->getResource(MKTAG('M','E','N','U'), 2004);
if (res != NULL) {
+ readMenu(res);
warning("STUB: commandsMenu");
//world.setCommandsMenuName(commandsMenu[0]);
//world.setDefaultCommandsMenu(commandsMenu[1]);
@@ -249,6 +252,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
res = resMan->getResource(MKTAG('M','E','N','U'), 2005);
if (res != NULL) {
+ readMenu(res);
warning("STUB: weaponsMenu");
//world.setWeaponsMenuName(weaponsMenu[0]);
delete res;
@@ -261,6 +265,48 @@ bool World::loadWorld(Common::MacResManager *resMan) {
return true;
}
+Common::StringArray World::readMenu(Common::SeekableReadStream *res) {
+ res->skip(10);
+ int enableFlags = res->readUint32BE();
+ String menuName = readPascalString(res);
+ String menuItem = readPascalString(res);
+ int menuItemNumber = 1;
+ Common::String sb;
+ byte itemData[4];
+
+ while (menuItem.size() > 0) {
+ if (sb.size() > 0) {
+ sb += ';';
+ }
+ if ((enableFlags & (1 << menuItemNumber)) == 0) {
+ sb += '(';
+ }
+ sb += menuItem;
+ res->read(itemData, 4);
+ static const char styles[] = {'B', 'I', 'U', 'O', 'S', 'C', 'E', 0};
+ for (int i = 0; styles[i] != 0; i++) {
+ if ((itemData[3] & (1 << i)) != 0) {
+ sb += '<';
+ sb += styles[i];
+ }
+ }
+ if (itemData[1] != 0) {
+ sb += '/';
+ sb += (char)itemData[1];
+ }
+ menuItem = readPascalString(res);
+ menuItemNumber++;
+ }
+
+ Common::StringArray result;
+ result.push_back(menuName);
+ result.push_back(sb);
+
+ warning("menuName: %s", menuName.c_str());
+ warning("sb: %s", sb.c_str());
+ return result;
+}
+
void World::loadExternalSounds(String fname) {
Common::File in;
diff --git a/engines/wage/world.h b/engines/wage/world.h
index 1514b57b20..8e45dcbee5 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -117,6 +117,9 @@ public:
_sounds[s] = sound;
_orderedSounds.push_back(sound);
}
+
+private:
+ Common::StringArray readMenu(Common::SeekableReadStream *res);
};
} // End of namespace Wage