diff options
Diffstat (limited to 'engines/toltecs')
-rw-r--r-- | engines/toltecs/menu.cpp | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp index 201c256ac4..e117351600 100644 --- a/engines/toltecs/menu.cpp +++ b/engines/toltecs/menu.cpp @@ -67,7 +67,7 @@ int MenuSystem::run(MenuID menuId) { _vm->_screen->_renderQueue->clear(); // Draw the menu background and frame _vm->_screen->blastSprite(0x140 + _vm->_cameraX, 0x175 + _vm->_cameraY, 0, 1, 0x4000); - shadeRect(60, 39, 520, 246, 225, 229); + shadeRect(60, 39, 520, 247, 225, 229); memcpy(_background->pixels, _vm->_screen->_frontScreen, 640 * 400); @@ -214,6 +214,8 @@ void MenuSystem::setItemCaption(Item *item, const char *caption) { Font font(_vm->_res->load(_vm->_screen->getFontResIndex(item->fontNum))->data); int width = font.getTextWidth((const byte*)caption); int height = font.getHeight(); + if (width & 1) + width++; item->rect = Common::Rect(item->x, item->y - height, item->x + width, item->y); if (item->w) { item->rect.translate(item->w - width / 2, 0); @@ -230,24 +232,25 @@ void MenuSystem::initMenu(MenuID menuID) { switch (menuID) { case kMenuIdMain: - drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrWhatCanIDoForYou)); - addClickTextItem(kItemIdLoad, 0, 115, 320, 0, _vm->getSysString(kStrLoad), 253, 255); - addClickTextItem(kItemIdSave, 0, 135, 320, 0, _vm->getSysString(kStrSave), 253, 255); - addClickTextItem(kItemIdToggleText, 0, 165, 320, 0, _vm->getSysString(_vm->_cfgText ? kStrTextOn : kStrTextOff), 253, 255); - addClickTextItem(kItemIdToggleVoices, 0, 185, 320, 0, _vm->getSysString(_vm->_cfgVoices ? kStrVoicesOn : kStrVoicesOff), 253, 255); - addClickTextItem(kItemIdVolumesMenu, 0, 215, 320, 0, _vm->getSysString(kStrVolume), 253, 255); - addClickTextItem(kItemIdPlay, 0, 245, 320, 0, _vm->getSysString(kStrPlay), 253, 255); - addClickTextItem(kItemIdQuit, 0, 275, 320, 0, _vm->getSysString(kStrQuit), 253, 255); + drawString(0, 75, 320, 1, 229, _vm->getSysString(kStrWhatCanIDoForYou)); + addClickTextItem(kItemIdLoad, 0, 116, 320, 0, _vm->getSysString(kStrLoad), 253, 255); + addClickTextItem(kItemIdSave, 0, 136, 320, 0, _vm->getSysString(kStrSave), 253, 255); + addClickTextItem(kItemIdToggleText, 0, 166, 320, 0, _vm->getSysString(_vm->_cfgText ? kStrTextOn : kStrTextOff), 253, 255); + addClickTextItem(kItemIdToggleVoices, 0, 186, 320, 0, _vm->getSysString(_vm->_cfgVoices ? kStrVoicesOn : kStrVoicesOff), 253, 255); + addClickTextItem(kItemIdVolumesMenu, 0, 216, 320, 0, _vm->getSysString(kStrVolume), 253, 255); + addClickTextItem(kItemIdPlay, 0, 246, 320, 0, _vm->getSysString(kStrPlay), 253, 255); + addClickTextItem(kItemIdQuit, 0, 276, 320, 0, _vm->getSysString(kStrQuit), 253, 255); break; case kMenuIdLoad: if (ConfMan.getBool("originalsaveload")) { - drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrLoadGame)); - addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255); - addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255); - addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255); + shadeRect(80, 92, 440, 141, 226, 225); + drawString(0, 75, 320, 1, 229, _vm->getSysString(kStrLoadGame)); + addClickTextItem(kItemIdSavegameUp, 0, 156, 545, 1, "^", 253, 255); + addClickTextItem(kItemIdSavegameDown, 0, 196, 545, 1, "\\", 253, 255); + addClickTextItem(kItemIdCancel, 0, 276, 320, 0, _vm->getSysString(kStrCancel), 253, 255); for (int i = 1; i <= 7; i++) { Common::String saveDesc = Common::String::format("SAVEGAME %d", i); - addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234); + addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 116 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234); } loadSavegamesList(); setSavegameCaptions(); @@ -264,16 +267,17 @@ void MenuSystem::initMenu(MenuID menuID) { break; case kMenuIdSave: if (ConfMan.getBool("originalsaveload")) { - drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrSaveGame)); - addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 253, 255); - addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 253, 255); - addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 253, 255); + shadeRect(80, 92, 440, 141, 226, 225); + drawString(0, 75, 320, 1, 229, _vm->getSysString(kStrSaveGame)); + addClickTextItem(kItemIdSavegameUp, 0, 156, 545, 1, "^", 253, 255); + addClickTextItem(kItemIdSavegameDown, 0, 196, 545, 1, "\\", 253, 255); + addClickTextItem(kItemIdCancel, 0, 276, 320, 0, _vm->getSysString(kStrCancel), 253, 255); for (int i = 1; i <= 7; i++) { Common::String saveDesc = Common::String::format("SAVEGAME %d", i); - addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234); + addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 116 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234); } newSlotNum = loadSavegamesList() + 1; - _savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %03d", _savegames.size() + 1))); + _savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %04d", _savegames.size()))); setSavegameCaptions(); } else { GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); @@ -291,24 +295,24 @@ void MenuSystem::initMenu(MenuID menuID) { } break; case kMenuIdVolumes: - drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrAdjustVolume)); - drawString(0, 130, 200, 0, 246, _vm->getSysString(kStrMaster)); - drawString(0, 155, 200, 0, 244, _vm->getSysString(kStrVoices)); - drawString(0, 180, 200, 0, 244, _vm->getSysString(kStrMusic)); - drawString(0, 205, 200, 0, 244, _vm->getSysString(kStrSoundFx)); - drawString(0, 230, 200, 0, 244, _vm->getSysString(kStrBackground)); - addClickTextItem(kItemIdDone, 0, 275, 200, 0, _vm->getSysString(kStrDone), 253, 255); - addClickTextItem(kItemIdCancel, 0, 275, 440, 0, _vm->getSysString(kStrCancel), 253, 255); - addClickTextItem(kItemIdMasterDown, 0, 130 + 25 * 0, 348, 1, "[", 243, 246); - addClickTextItem(kItemIdVoicesDown, 0, 130 + 25 * 1, 348, 1, "[", 243, 246); - addClickTextItem(kItemIdMusicDown, 0, 130 + 25 * 2, 348, 1, "[", 243, 246); - addClickTextItem(kItemIdSoundFXDown, 0, 130 + 25 * 3, 348, 1, "[", 243, 246); - addClickTextItem(kItemIdBackgroundDown, 0, 130 + 25 * 4, 348, 1, "[", 243, 246); - addClickTextItem(kItemIdMasterUp, 0, 130 + 25 * 0, 372, 1, "]", 243, 246); - addClickTextItem(kItemIdVoicesUp, 0, 130 + 25 * 1, 372, 1, "]", 243, 246); - addClickTextItem(kItemIdMusicUp, 0, 130 + 25 * 2, 372, 1, "]", 243, 246); - addClickTextItem(kItemIdSoundFXUp, 0, 130 + 25 * 3, 372, 1, "]", 243, 246); - addClickTextItem(kItemIdBackgroundUp, 0, 130 + 25 * 4, 372, 1, "]", 243, 246); + drawString(0, 75, 320, 1, 229, _vm->getSysString(kStrAdjustVolume)); + drawString(0, 131, 200, 0, 246, _vm->getSysString(kStrMaster)); + drawString(0, 156, 200, 0, 244, _vm->getSysString(kStrVoices)); + drawString(0, 181, 200, 0, 244, _vm->getSysString(kStrMusic)); + drawString(0, 206, 200, 0, 244, _vm->getSysString(kStrSoundFx)); + drawString(0, 231, 200, 0, 244, _vm->getSysString(kStrBackground)); + addClickTextItem(kItemIdDone, 0, 276, 200, 0, _vm->getSysString(kStrDone), 253, 255); + addClickTextItem(kItemIdCancel, 0, 276, 440, 0, _vm->getSysString(kStrCancel), 253, 255); + addClickTextItem(kItemIdMasterDown, 0, 131 + 25 * 0, 348, 1, "[", 243, 246); + addClickTextItem(kItemIdVoicesDown, 0, 131 + 25 * 1, 348, 1, "[", 243, 246); + addClickTextItem(kItemIdMusicDown, 0, 131 + 25 * 2, 348, 1, "[", 243, 246); + addClickTextItem(kItemIdSoundFXDown, 0, 131 + 25 * 3, 348, 1, "[", 243, 246); + addClickTextItem(kItemIdBackgroundDown, 0, 131 + 25 * 4, 348, 1, "[", 243, 246); + addClickTextItem(kItemIdMasterUp, 0, 131 + 25 * 0, 372, 1, "]", 243, 246); + addClickTextItem(kItemIdVoicesUp, 0, 131 + 25 * 1, 372, 1, "]", 243, 246); + addClickTextItem(kItemIdMusicUp, 0, 131 + 25 * 2, 372, 1, "]", 243, 246); + addClickTextItem(kItemIdSoundFXUp, 0, 131 + 25 * 3, 372, 1, "]", 243, 246); + addClickTextItem(kItemIdBackgroundUp, 0, 131 + 25 * 4, 372, 1, "]", 243, 246); drawVolumeBar(kItemIdMaster); drawVolumeBar(kItemIdVoices); drawVolumeBar(kItemIdMusic); @@ -322,7 +326,6 @@ void MenuSystem::initMenu(MenuID menuID) { for (Common::Array<Item>::iterator iter = _items.begin(); iter != _items.end(); iter++) { drawItem((*iter).id, false); } - } void MenuSystem::enterItem(ItemID id) { @@ -453,7 +456,10 @@ void MenuSystem::drawString(int16 x, int16 y, int w, uint fontNum, byte color, c fontNum = _vm->_screen->getFontResIndex(fontNum); Font font(_vm->_res->load(fontNum)->data); if (w) { - x = x + w - font.getTextWidth((const byte*)text) / 2; + int width = font.getTextWidth((const byte*)text); + if (width & 1) + width++; + x = x + w - width / 2; } _vm->_screen->drawString(x, y - font.getHeight(), color, fontNum, (const byte*)text, -1, NULL, true); _needRedraw = true; |