aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-14 13:04:40 +0100
committerEugene Sandulenko2017-01-14 13:04:40 +0100
commit8690fe444e6959bc2aa17ba7517303dbceda86c8 (patch)
tree79045b295cc86d4f41751185098db251bbf71fc7 /engines/wage
parenta0907d26792dcd8301d24c821e3375c41c41b04a (diff)
downloadscummvm-rg350-8690fe444e6959bc2aa17ba7517303dbceda86c8.tar.gz
scummvm-rg350-8690fe444e6959bc2aa17ba7517303dbceda86c8.tar.bz2
scummvm-rg350-8690fe444e6959bc2aa17ba7517303dbceda86c8.zip
WAGE: Switch menu reading to common code
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/world.cpp51
-rw-r--r--engines/wage/world.h3
2 files changed, 5 insertions, 49 deletions
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 2e99af9f1e..9118c8b5bc 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -46,7 +46,9 @@
*/
#include "common/file.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/macfontmanager.h"
+#include "graphics/macgui/macmenu.h"
#include "wage/wage.h"
#include "wage/entities.h"
@@ -294,7 +296,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
res = resMan->getResource(MKTAG('M','E','N','U'), 2001);
if (res != NULL) {
- Common::StringArray *menu = readMenu(res);
+ Common::StringArray *menu = Graphics::Menu::readMenuFromResource(res);
_aboutMenuItemName.clear();
Common::String string = menu->operator[](1);
@@ -306,7 +308,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
res = resMan->getResource(MKTAG('M','E','N','U'), 2004);
if (res != NULL) {
- Common::StringArray *menu = readMenu(res);
+ Common::StringArray *menu = Graphics::Menu::readMenuFromResource(res);
_commandsMenuName = menu->operator[](0);
_commandsMenu = menu->operator[](1);
delete menu;
@@ -314,7 +316,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
res = resMan->getResource(MKTAG('M','E','N','U'), 2005);
if (res != NULL) {
- Common::StringArray *menu = readMenu(res);
+ Common::StringArray *menu = Graphics::Menu::readMenuFromResource(res);
_weaponsMenuName = menu->operator[](0);
delete menu;
delete res;
@@ -334,49 +336,6 @@ void World::addSound(Sound *sound) {
_orderedSounds.push_back(sound);
}
-Common::StringArray *World::readMenu(Common::SeekableReadStream *res) {
- res->skip(10);
- int enableFlags = res->readUint32BE();
- Common::String menuName = res->readPascalString();
- Common::String menuItem = res->readPascalString();
- int menuItemNumber = 1;
- Common::String menu;
- byte itemData[4];
-
- while (!menuItem.empty()) {
- if (!menu.empty()) {
- menu += ';';
- }
- if ((enableFlags & (1 << menuItemNumber)) == 0) {
- menu += '(';
- }
- menu += 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) {
- menu += '<';
- menu += styles[i];
- }
- }
- if (itemData[1] != 0) {
- menu += '/';
- menu += (char)itemData[1];
- }
- menuItem = res->readPascalString();
- menuItemNumber++;
- }
-
- Common::StringArray *result = new Common::StringArray;
- result->push_back(menuName);
- result->push_back(menu);
-
- debug(4, "menuName: %s", menuName.c_str());
- debug(4, "menu: %s", menu.c_str());
-
- return result;
-}
-
void World::loadExternalSounds(Common::String fname) {
Common::File in;
diff --git a/engines/wage/world.h b/engines/wage/world.h
index b5ad33a8a8..dbcf71039d 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -134,9 +134,6 @@ public:
}
void addSound(Sound *sound);
-
-private:
- Common::StringArray *readMenu(Common::SeekableReadStream *res);
};
} // End of namespace Wage