diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 427f605614..d48a7f47f9 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -194,6 +194,9 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager int depth = 0; int curMenuItemId = 0; + int action = 0; + bool lastPopUp = false; + bool lastPopUpCopy = false; // no more than 2 level menu for now while (depth >= 0) { uint16 flags = menuData->readUint16LE(); if (flags & kPopUp) { @@ -204,14 +207,32 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager // for now skip readUnicodeString(menuData); } - if (!(flags & kEndMenu)) { - depth++; + if (lastPopUp) { + lastPopUpCopy = lastPopUp; } + + lastPopUp = (flags & kEndMenu) != 0; + depth++; } else { menuData->readUint16LE(); // menu id - menu->addMenuSubItem(curMenuItemId, readUnicodeString(menuData), 0); + Common::U32String name = readUnicodeString(menuData); + if (depth == 1) { + menu->addMenuSubItem(curMenuItemId, name, action); + } + if (!name.empty()) { + action++; + } if (flags & kEndMenu) { - depth--; + if (lastPopUp) + depth -= 2; + else + depth--; + + if (depth == 0) + curMenuItemId++; + + lastPopUp = lastPopUpCopy; + lastPopUpCopy = false; } } } |