mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 17:57:14 +00:00
WAGE: More work on menu reading
This commit is contained in:
parent
6590f2c3f7
commit
c1d051da65
@ -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;
|
||||
|
||||
|
@ -117,6 +117,9 @@ public:
|
||||
_sounds[s] = sound;
|
||||
_orderedSounds.push_back(sound);
|
||||
}
|
||||
|
||||
private:
|
||||
Common::StringArray readMenu(Common::SeekableReadStream *res);
|
||||
};
|
||||
|
||||
} // End of namespace Wage
|
||||
|
Loading…
x
Reference in New Issue
Block a user