2011-12-26 21:30:46 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2012-02-13 09:07:48 +11:00
|
|
|
* file _distributed with this source _distribution.
|
2011-12-26 21:30:46 +01:00
|
|
|
*
|
2012-02-13 09:07:48 +11:00
|
|
|
* This program is free software; you can re_distribute it and/or
|
2011-12-26 21:30:46 +01:00
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
2012-02-13 09:07:48 +11:00
|
|
|
* This program is _distributed in the hope that it will be useful,
|
2011-12-26 21:30:46 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on original Mortville Manor DOS source code
|
2012-03-29 16:39:18 +02:00
|
|
|
* Copyright (c) 1987-1989 Lankhor
|
2011-12-26 21:30:46 +01:00
|
|
|
*/
|
|
|
|
|
2012-01-20 22:13:36 +11:00
|
|
|
#include "mortevielle/mortevielle.h"
|
2013-07-19 11:51:10 +02:00
|
|
|
|
|
|
|
#include "mortevielle/menu.h"
|
2011-12-30 23:42:28 +11:00
|
|
|
#include "mortevielle/mouse.h"
|
2012-02-13 09:07:48 +11:00
|
|
|
#include "mortevielle/outtext.h"
|
2011-12-26 21:42:55 +01:00
|
|
|
|
2013-07-19 11:51:10 +02:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
#include "common/textconsole.h"
|
|
|
|
|
2011-12-26 22:08:18 +01:00
|
|
|
namespace Mortevielle {
|
2011-12-26 21:30:46 +01:00
|
|
|
|
2013-07-19 11:33:42 +02:00
|
|
|
const byte menuConstants[8][4] = {
|
2012-03-28 08:05:12 +02:00
|
|
|
{ 7, 37, 23, 8},
|
2012-03-20 22:52:59 +01:00
|
|
|
{19, 33, 23, 7},
|
|
|
|
{31, 89, 10, 21},
|
|
|
|
{43, 25, 11, 5},
|
|
|
|
{55, 37, 5, 8},
|
|
|
|
{64, 13, 11, 2},
|
2012-03-28 07:59:22 +02:00
|
|
|
{62, 42, 13, 9},
|
|
|
|
{62, 46, 13, 10}
|
2012-03-20 22:52:59 +01:00
|
|
|
};
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2013-08-15 07:57:07 +02:00
|
|
|
Menu::Menu() {
|
2013-08-15 20:03:27 +02:00
|
|
|
_opcodeAttach = _opcodeWait = _opcodeForce = _opcodeSleep = OPCODE_NONE;
|
|
|
|
_opcodeListen = _opcodeEnter = _opcodeClose = _opcodeSearch = OPCODE_NONE;
|
|
|
|
_opcodeKnock = _opcodeScratch = _opcodeRead = _opcodeEat = OPCODE_NONE;
|
|
|
|
_opcodePlace = _opcodeOpen = _opcodeTake = _opcodeLook = OPCODE_NONE;
|
|
|
|
_opcodeSmell = _opcodeSound = _opcodeLeave = _opcodeLift = OPCODE_NONE;
|
|
|
|
_opcodeTurn = _opcodeSHide = _opcodeSSearch = _opcodeSRead = OPCODE_NONE;
|
|
|
|
_opcodeSPut = _opcodeSLook = OPCODE_NONE;
|
2013-08-15 07:57:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Menu::readVerbNums(Common::File &f, int dataSize) {
|
|
|
|
// Figure out what language Id is needed
|
|
|
|
byte desiredLanguageId;
|
|
|
|
switch(_vm->getLanguage()) {
|
|
|
|
case Common::EN_ANY:
|
|
|
|
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
desiredLanguageId = MORTDAT_LANG_FRENCH;
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
desiredLanguageId = MORTDAT_LANG_GERMAN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
warning("Language not supported, switching to English");
|
|
|
|
desiredLanguageId = MORTDAT_LANG_ENGLISH;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Read in the language
|
|
|
|
byte languageId = f.readByte();
|
|
|
|
--dataSize;
|
|
|
|
|
|
|
|
// If the language isn't correct, then skip the entire block
|
|
|
|
if (languageId != desiredLanguageId) {
|
|
|
|
f.skip(dataSize);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(dataSize == 52);
|
2013-08-15 20:03:27 +02:00
|
|
|
_opcodeAttach = f.readUint16LE();
|
|
|
|
_opcodeWait = f.readUint16LE();
|
|
|
|
_opcodeForce = f.readUint16LE();
|
|
|
|
_opcodeSleep = f.readUint16LE();
|
|
|
|
_opcodeListen = f.readUint16LE();
|
|
|
|
_opcodeEnter = f.readUint16LE();
|
|
|
|
_opcodeClose = f.readUint16LE();
|
|
|
|
_opcodeSearch = f.readUint16LE();
|
|
|
|
_opcodeKnock = f.readUint16LE();
|
|
|
|
_opcodeScratch = f.readUint16LE();
|
|
|
|
_opcodeRead = f.readUint16LE();
|
|
|
|
_opcodeEat = f.readUint16LE();
|
|
|
|
_opcodePlace = f.readUint16LE();
|
|
|
|
_opcodeOpen = f.readUint16LE();
|
|
|
|
_opcodeTake = f.readUint16LE();
|
|
|
|
_opcodeLook = f.readUint16LE();
|
|
|
|
_opcodeSmell = f.readUint16LE();
|
|
|
|
_opcodeSound = f.readUint16LE();
|
|
|
|
_opcodeLeave = f.readUint16LE();
|
|
|
|
_opcodeLift = f.readUint16LE();
|
|
|
|
_opcodeTurn = f.readUint16LE();
|
|
|
|
_opcodeSHide = f.readUint16LE();
|
|
|
|
_opcodeSSearch = f.readUint16LE();
|
|
|
|
_opcodeSRead = f.readUint16LE();
|
|
|
|
_opcodeSPut = f.readUint16LE();
|
|
|
|
_opcodeSLook = f.readUint16LE();
|
2013-08-15 07:57:07 +02:00
|
|
|
|
|
|
|
_actionMenu[0]._menuId = OPCODE_NONE >> 8;
|
|
|
|
_actionMenu[0]._actionId = OPCODE_NONE & 0xFF;
|
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[1]._menuId = _opcodeSHide >> 8;
|
|
|
|
_actionMenu[1]._actionId = _opcodeSHide & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[2]._menuId = _opcodeAttach >> 8;
|
|
|
|
_actionMenu[2]._actionId = _opcodeAttach & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[3]._menuId = _opcodeForce >> 8;
|
|
|
|
_actionMenu[3]._actionId = _opcodeForce & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[4]._menuId = _opcodeSleep >> 8;
|
|
|
|
_actionMenu[4]._actionId = _opcodeSleep & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[5]._menuId = _opcodeEnter >> 8;
|
|
|
|
_actionMenu[5]._actionId = _opcodeEnter & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[6]._menuId = _opcodeClose >> 8;
|
|
|
|
_actionMenu[6]._menuId = _opcodeClose & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[7]._menuId = _opcodeKnock >> 8;
|
|
|
|
_actionMenu[7]._menuId = _opcodeKnock & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[8]._menuId = _opcodeEat >> 8;
|
|
|
|
_actionMenu[8]._menuId = _opcodeEat & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[9]._menuId = _opcodePlace >> 8;
|
|
|
|
_actionMenu[9]._menuId = _opcodePlace & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[10]._menuId = _opcodeOpen >> 8;
|
|
|
|
_actionMenu[10]._menuId = _opcodeOpen & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
_actionMenu[11]._menuId = _opcodeLeave >> 8;
|
|
|
|
_actionMenu[11]._menuId = _opcodeLeave & 0xFF;
|
2013-08-15 07:57:07 +02:00
|
|
|
}
|
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Setup a menu's contents
|
2012-03-07 08:33:48 +01:00
|
|
|
* @remarks Originally called 'menut'
|
2012-02-13 00:02:03 +11:00
|
|
|
*/
|
2013-07-29 01:58:03 +02:00
|
|
|
void Menu::setText(int menuId, int actionId, Common::String name) {
|
2012-02-27 21:31:58 +01:00
|
|
|
Common::String s = name;
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-03-28 08:05:12 +02:00
|
|
|
while (s.size() < 22)
|
2012-02-20 23:56:32 +01:00
|
|
|
s += ' ';
|
2012-02-13 00:02:03 +11:00
|
|
|
|
2013-07-29 01:58:03 +02:00
|
|
|
switch (menuId) {
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_INVENTORY:
|
2013-07-29 01:58:03 +02:00
|
|
|
if (actionId != 7) {
|
|
|
|
_inventoryStringArray[actionId] = s;
|
|
|
|
_inventoryStringArray[actionId].insertChar(' ', 0);
|
2011-12-31 17:11:37 +11:00
|
|
|
}
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-20 08:28:06 +01:00
|
|
|
case MENU_MOVE:
|
2013-07-29 01:58:03 +02:00
|
|
|
_moveStringArray[actionId] = s;
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_ACTION:
|
2013-07-29 01:58:03 +02:00
|
|
|
_actionStringArray[actionId] = s;
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-28 07:59:51 +01:00
|
|
|
case MENU_SELF:
|
2013-07-29 01:58:03 +02:00
|
|
|
_selfStringArray[actionId] = s;
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-20 23:56:32 +01:00
|
|
|
case MENU_DISCUSS:
|
2013-07-29 01:58:03 +02:00
|
|
|
_discussStringArray[actionId] = s;
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-03-11 23:06:33 +01:00
|
|
|
/**
|
|
|
|
* Init destination menu
|
|
|
|
* @remarks Originally called 'tmlieu'
|
|
|
|
*/
|
2012-03-24 15:19:54 +01:00
|
|
|
void Menu::setDestinationText(int roomId) {
|
2012-03-11 23:06:33 +01:00
|
|
|
Common::String nomp;
|
|
|
|
|
2013-08-16 13:29:23 +02:00
|
|
|
if (roomId == ROOM26)
|
2012-03-11 23:06:33 +01:00
|
|
|
roomId = LANDING;
|
|
|
|
|
|
|
|
int destinationId = 0;
|
2013-06-25 08:00:11 +02:00
|
|
|
for (; (destinationId < 7) && (_vm->_destinationArray[destinationId][roomId]); ++destinationId) {
|
|
|
|
nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex);
|
2012-03-11 23:06:33 +01:00
|
|
|
while (nomp.size() < 20)
|
|
|
|
nomp += ' ';
|
2013-07-29 01:58:03 +02:00
|
|
|
setText(_moveMenu[destinationId + 1]._menuId, _moveMenu[destinationId + 1]._actionId, nomp);
|
2012-03-11 23:06:33 +01:00
|
|
|
}
|
|
|
|
nomp = "* ";
|
|
|
|
for (int i = 7; i >= destinationId + 1; --i)
|
2013-07-29 01:58:03 +02:00
|
|
|
setText(_moveMenu[i]._menuId, _moveMenu[i]._actionId, nomp);
|
2012-03-11 23:06:33 +01:00
|
|
|
}
|
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
2012-02-13 09:07:48 +11:00
|
|
|
* _disable a menu item
|
2013-07-29 01:58:03 +02:00
|
|
|
* @param menuId Menu number
|
|
|
|
* @param actionId Item index
|
2012-02-13 00:02:03 +11:00
|
|
|
*/
|
2013-07-29 01:58:03 +02:00
|
|
|
void Menu::disableMenuItem(int menuId, int actionId) {
|
|
|
|
switch (menuId) {
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_INVENTORY:
|
2013-07-29 01:58:03 +02:00
|
|
|
if (actionId > 6) {
|
|
|
|
_inventoryStringArray[actionId].setChar('<', 0);
|
|
|
|
_inventoryStringArray[actionId].setChar('>', 21);
|
2012-02-13 00:02:03 +11:00
|
|
|
} else
|
2013-07-29 01:58:03 +02:00
|
|
|
_inventoryStringArray[actionId].setChar('*', 0);
|
2012-02-21 18:51:44 +01:00
|
|
|
break;
|
2012-02-20 08:28:06 +01:00
|
|
|
case MENU_MOVE:
|
2013-07-29 01:58:03 +02:00
|
|
|
_moveStringArray[actionId].setChar('*', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_ACTION:
|
2013-07-29 01:58:03 +02:00
|
|
|
_actionStringArray[actionId].setChar('*', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-28 07:59:51 +01:00
|
|
|
case MENU_SELF:
|
2013-07-29 01:58:03 +02:00
|
|
|
_selfStringArray[actionId].setChar('*', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-20 23:56:32 +01:00
|
|
|
case MENU_DISCUSS:
|
2013-07-29 01:58:03 +02:00
|
|
|
_discussStringArray[actionId].setChar('*', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Enable a menu item
|
2013-07-29 01:58:03 +02:00
|
|
|
* @param menuId Menu number
|
|
|
|
* @param actionId Item index
|
2012-02-27 21:31:58 +01:00
|
|
|
* @remarks Originally called menu_enable
|
2012-02-13 00:02:03 +11:00
|
|
|
*/
|
2013-07-29 01:58:03 +02:00
|
|
|
void Menu::enableMenuItem(int menuId, int actionId) {
|
|
|
|
switch (menuId) {
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_INVENTORY:
|
2013-07-29 01:58:03 +02:00
|
|
|
_inventoryStringArray[actionId].setChar(' ', 0);
|
|
|
|
_inventoryStringArray[actionId].setChar(' ', 21);
|
2012-02-20 23:56:32 +01:00
|
|
|
break;
|
2012-02-20 08:28:06 +01:00
|
|
|
case MENU_MOVE:
|
2013-07-29 01:58:03 +02:00
|
|
|
_moveStringArray[actionId].setChar(' ', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-25 21:13:24 +01:00
|
|
|
case MENU_ACTION:
|
2013-07-29 01:58:03 +02:00
|
|
|
_actionStringArray[actionId].setChar(' ', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-28 07:59:51 +01:00
|
|
|
case MENU_SELF:
|
2013-07-29 01:58:03 +02:00
|
|
|
_selfStringArray[actionId].setChar(' ', 0);
|
2012-02-20 23:56:32 +01:00
|
|
|
break;
|
|
|
|
case MENU_DISCUSS:
|
2013-07-29 01:58:03 +02:00
|
|
|
_discussStringArray[actionId].setChar(' ', 0);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-28 08:22:20 +01:00
|
|
|
void Menu::displayMenu() {
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_mouse.hideMouse();
|
|
|
|
_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10));
|
2013-08-16 13:29:23 +02:00
|
|
|
|
|
|
|
int col = 28 * _vm->_resolutionScaler;
|
|
|
|
int color;
|
2013-06-25 08:00:11 +02:00
|
|
|
if (_vm->_currGraphicalDevice == MODE_CGA)
|
2012-02-20 23:56:32 +01:00
|
|
|
color = 1;
|
|
|
|
else
|
|
|
|
color = 9;
|
2013-08-16 13:29:23 +02:00
|
|
|
for (int charNum = 0; charNum < 6; charNum++) {
|
|
|
|
// One character after the other
|
|
|
|
int idx = 0;
|
|
|
|
for (int y = 1; y < 9; ++y) {
|
|
|
|
// One column after the other
|
|
|
|
int x = col;
|
|
|
|
for (int k = 0; k < 3; ++k) {
|
|
|
|
// One line after the other
|
|
|
|
uint msk = 0x80;
|
|
|
|
for (int pt = 0; pt <= 7; ++pt) {
|
|
|
|
if ((_charArr[charNum][idx] & msk) != 0) {
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0);
|
|
|
|
_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0);
|
|
|
|
_vm->_screenSurface.setPixel(Common::Point(x, y), color);
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2013-08-16 13:29:23 +02:00
|
|
|
msk >>= 1;
|
2012-02-20 23:56:32 +01:00
|
|
|
++x;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2013-08-16 13:29:23 +02:00
|
|
|
++idx;
|
|
|
|
}
|
|
|
|
}
|
2013-06-25 08:00:11 +02:00
|
|
|
col += 48 * _vm->_resolutionScaler;
|
2013-08-16 13:29:23 +02:00
|
|
|
}
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_mouse.showMouse();
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Show the menu
|
|
|
|
*/
|
|
|
|
void Menu::drawMenu() {
|
2012-02-28 08:22:20 +01:00
|
|
|
displayMenu();
|
2012-02-13 09:07:48 +11:00
|
|
|
_menuActive = true;
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg4 = OPCODE_NONE;
|
|
|
|
_msg3 = OPCODE_NONE;
|
2012-03-08 08:24:54 +01:00
|
|
|
_menuSelected = false;
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2012-03-08 08:24:54 +01:00
|
|
|
_multiTitle = false;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-03-20 22:52:59 +01:00
|
|
|
/**
|
|
|
|
* Menu function - Invert a menu entry
|
|
|
|
* @remarks Originally called 'invers'
|
|
|
|
*/
|
|
|
|
void Menu::invert(int indx) {
|
2012-03-23 07:44:04 +01:00
|
|
|
if (_msg4 == OPCODE_NONE)
|
2012-02-20 23:56:32 +01:00
|
|
|
return;
|
|
|
|
|
2013-07-29 01:58:03 +02:00
|
|
|
int menuIndex = _msg4 & 0xFF;
|
2012-02-28 08:22:20 +01:00
|
|
|
|
2013-07-19 11:33:42 +02:00
|
|
|
_vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3);
|
2012-03-20 22:52:59 +01:00
|
|
|
|
|
|
|
Common::String str;
|
2012-03-23 07:44:04 +01:00
|
|
|
switch (_msg3) {
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_INVENTORY:
|
2012-03-20 22:52:59 +01:00
|
|
|
str = _inventoryStringArray[menuIndex];
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_MOVE:
|
2012-03-20 22:52:59 +01:00
|
|
|
str = _moveStringArray[menuIndex];
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_ACTION:
|
2012-03-20 22:52:59 +01:00
|
|
|
str = _actionStringArray[menuIndex];
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_SELF:
|
2012-03-20 22:52:59 +01:00
|
|
|
str = _selfStringArray[menuIndex];
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_DISCUSS:
|
2012-03-20 22:52:59 +01:00
|
|
|
str = _discussStringArray[menuIndex];
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_FILE:
|
2013-06-25 08:00:11 +02:00
|
|
|
str = _vm->getEngineString(S_SAVE_LOAD + menuIndex);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_SAVE:
|
2013-06-25 08:00:11 +02:00
|
|
|
str = _vm->getEngineString(S_SAVE_LOAD + 1);
|
2012-03-20 22:52:59 +01:00
|
|
|
str += ' ';
|
|
|
|
str += (char)(48 + menuIndex);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2013-06-28 22:07:53 +02:00
|
|
|
case MENU_LOAD:
|
2012-02-28 08:22:20 +01:00
|
|
|
if (menuIndex == 1) {
|
2013-06-25 08:00:11 +02:00
|
|
|
str = _vm->getEngineString(S_RESTART);
|
2012-01-21 21:22:33 +11:00
|
|
|
} else {
|
2013-06-25 08:00:11 +02:00
|
|
|
str = _vm->getEngineString(S_SAVE_LOAD + 2);
|
2012-03-20 22:52:59 +01:00
|
|
|
str += ' ';
|
|
|
|
str += (char)(47 + menuIndex);
|
2012-01-21 21:22:33 +11:00
|
|
|
}
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2012-03-20 22:52:59 +01:00
|
|
|
if ((str[0] != '*') && (str[0] != '<'))
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_screenSurface.drawString(str, indx);
|
2012-01-21 21:22:33 +11:00
|
|
|
else
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg4 = OPCODE_NONE;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-03-20 07:05:25 +01:00
|
|
|
void Menu::util(Common::Point pos) {
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2013-07-19 11:33:42 +02:00
|
|
|
int ymx = (menuConstants[_msg3 - 1][3] << 3) + 16;
|
|
|
|
int dxcar = menuConstants[_msg3 - 1][2];
|
|
|
|
int xmn = (menuConstants[_msg3 - 1][0] << 2) * _vm->_resolutionScaler;
|
2012-02-21 18:51:44 +01:00
|
|
|
|
|
|
|
int ix;
|
2013-06-25 08:00:11 +02:00
|
|
|
if (_vm->_resolutionScaler == 1)
|
2012-02-20 23:56:32 +01:00
|
|
|
ix = 5;
|
|
|
|
else
|
|
|
|
ix = 3;
|
2013-06-25 08:00:11 +02:00
|
|
|
int xmx = dxcar * ix * _vm->_resolutionScaler + xmn + 2;
|
2012-03-20 07:05:25 +01:00
|
|
|
if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) {
|
2012-03-23 07:44:04 +01:00
|
|
|
ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8);
|
|
|
|
if (ix != _msg4) {
|
2012-03-20 22:52:59 +01:00
|
|
|
invert(1);
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg4 = ix;
|
2012-03-20 22:52:59 +01:00
|
|
|
invert(0);
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2012-03-23 07:44:04 +01:00
|
|
|
} else if (_msg4 != OPCODE_NONE) {
|
2012-03-20 22:52:59 +01:00
|
|
|
invert(1);
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg4 = OPCODE_NONE;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Draw a menu
|
|
|
|
*/
|
|
|
|
void Menu::menuDown(int ii) {
|
2012-01-20 22:13:36 +11:00
|
|
|
// Make a copy of the current screen surface for later restore
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_backgroundSurface.copyFrom(_vm->_screenSurface);
|
2012-01-20 22:13:36 +11:00
|
|
|
|
|
|
|
// Draw the menu
|
2013-08-16 13:29:23 +02:00
|
|
|
int minX = menuConstants[ii - 1][0] << 3;
|
|
|
|
int lineNum = menuConstants[ii - 1][3];
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_mouse.hideMouse();
|
2013-08-16 13:29:23 +02:00
|
|
|
int deltaX;
|
2013-06-25 08:00:11 +02:00
|
|
|
if (_vm->_resolutionScaler == 1)
|
2013-08-16 13:29:23 +02:00
|
|
|
deltaX = 10;
|
2012-02-20 23:56:32 +01:00
|
|
|
else
|
2013-08-16 13:29:23 +02:00
|
|
|
deltaX = 6;
|
|
|
|
int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6;
|
2013-06-25 08:00:11 +02:00
|
|
|
if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY))
|
2012-03-05 22:35:32 +11:00
|
|
|
// Extra width needed for Self menu in English version
|
2013-08-16 13:29:23 +02:00
|
|
|
maxX = 435;
|
|
|
|
|
|
|
|
_vm->_screenSurface.fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1)));
|
|
|
|
_vm->_screenSurface.fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1)));
|
|
|
|
_vm->_screenSurface.fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1)));
|
|
|
|
_vm->_screenSurface.putxy(minX, 16);
|
|
|
|
for (int i = 1; i <= lineNum; i++) {
|
2011-12-23 22:15:35 +00:00
|
|
|
switch (ii) {
|
2012-02-21 18:51:44 +01:00
|
|
|
case 1:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (_inventoryStringArray[i][0] != '*')
|
|
|
|
_vm->_screenSurface.drawString(_inventoryStringArray[i], 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 2:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (_moveStringArray[i][0] != '*')
|
|
|
|
_vm->_screenSurface.drawString(_moveStringArray[i], 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 3:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (_actionStringArray[i][0] != '*')
|
|
|
|
_vm->_screenSurface.drawString(_actionStringArray[i], 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 4:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (_selfStringArray[i][0] != '*')
|
|
|
|
_vm->_screenSurface.drawString(_selfStringArray[i], 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 5:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (_discussStringArray[i][0] != '*')
|
|
|
|
_vm->_screenSurface.drawString(_discussStringArray[i], 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 6:
|
2013-08-16 13:29:23 +02:00
|
|
|
_vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4);
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 7: {
|
2013-06-25 08:00:11 +02:00
|
|
|
Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1);
|
2012-01-20 22:28:13 +11:00
|
|
|
s += ' ';
|
2013-08-16 13:29:23 +02:00
|
|
|
s += (char)(48 + i);
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_screenSurface.drawString(s, 4);
|
2012-02-21 18:51:44 +01:00
|
|
|
}
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
case 8:
|
2013-08-16 13:29:23 +02:00
|
|
|
if (i == 1)
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4);
|
2012-01-20 22:28:13 +11:00
|
|
|
else {
|
2013-06-25 08:00:11 +02:00
|
|
|
Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2);
|
2012-01-20 22:28:13 +11:00
|
|
|
s += ' ';
|
2013-08-16 13:29:23 +02:00
|
|
|
s += (char)(47 + i);
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_screenSurface.drawString(s, 4);
|
2012-01-20 22:28:13 +11:00
|
|
|
}
|
2011-12-23 22:15:35 +00:00
|
|
|
break;
|
2012-02-21 18:51:44 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2013-08-16 13:29:23 +02:00
|
|
|
_vm->_screenSurface.putxy(minX, _vm->_screenSurface._textPos.y + 8);
|
|
|
|
}
|
2012-03-08 08:24:54 +01:00
|
|
|
_multiTitle = true;
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_mouse.showMouse();
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Menu is being removed, so restore the previous background area.
|
|
|
|
*/
|
2013-02-21 00:53:52 +01:00
|
|
|
void Menu::menuUp(int msgId) {
|
2012-03-08 08:24:54 +01:00
|
|
|
if (_multiTitle) {
|
2012-01-20 22:13:36 +11:00
|
|
|
/* Restore the background area */
|
2013-06-25 08:00:11 +02:00
|
|
|
assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch);
|
2012-01-20 22:13:36 +11:00
|
|
|
|
|
|
|
// Get a pointer to the source and destination of the area to restore
|
2013-06-25 08:00:11 +02:00
|
|
|
const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10);
|
|
|
|
Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT));
|
2013-08-03 02:40:37 +02:00
|
|
|
byte *pDest = (byte *)destArea.getPixels();
|
2012-01-20 22:13:36 +11:00
|
|
|
|
|
|
|
// Copy the data
|
|
|
|
Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest);
|
|
|
|
|
2012-03-08 08:24:54 +01:00
|
|
|
_multiTitle = false;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Erase the menu
|
|
|
|
*/
|
|
|
|
void Menu::eraseMenu() {
|
2012-02-13 09:07:48 +11:00
|
|
|
_menuActive = false;
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2012-03-23 07:44:04 +01:00
|
|
|
menuUp(_msg3);
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2012-02-13 00:02:03 +11:00
|
|
|
/**
|
|
|
|
* Handle updates to the menu
|
2013-02-21 00:53:52 +01:00
|
|
|
* @remarks Originally called 'mdn'
|
2012-02-13 00:02:03 +11:00
|
|
|
*/
|
2013-02-21 00:53:52 +01:00
|
|
|
void Menu::updateMenu() {
|
2012-02-13 09:07:48 +11:00
|
|
|
if (!_menuActive)
|
|
|
|
return;
|
2012-02-20 23:56:32 +01:00
|
|
|
|
2013-06-25 08:00:11 +02:00
|
|
|
Common::Point curPos = _vm->_mouse._pos;
|
|
|
|
if (!_vm->getMouseClick()) {
|
|
|
|
if (curPos == _vm->_prevPos)
|
2012-02-20 23:56:32 +01:00
|
|
|
return;
|
2012-03-20 07:05:25 +01:00
|
|
|
else
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->_prevPos = curPos;
|
2012-03-27 22:54:50 +02:00
|
|
|
|
|
|
|
bool tes = (curPos.y < 11)
|
2013-06-25 08:00:11 +02:00
|
|
|
&& ((curPos.x >= (28 * _vm->_resolutionScaler) && curPos.x <= (28 * _vm->_resolutionScaler + 24))
|
|
|
|
|| (curPos.x >= (76 * _vm->_resolutionScaler) && curPos.x <= (76 * _vm->_resolutionScaler + 24))
|
|
|
|
|| ((curPos.x > 124 * _vm->_resolutionScaler) && (curPos.x < 124 * _vm->_resolutionScaler + 24))
|
|
|
|
|| ((curPos.x > 172 * _vm->_resolutionScaler) && (curPos.x < 172 * _vm->_resolutionScaler + 24))
|
|
|
|
|| ((curPos.x > 220 * _vm->_resolutionScaler) && (curPos.x < 220 * _vm->_resolutionScaler + 24))
|
|
|
|
|| ((curPos.x > 268 * _vm->_resolutionScaler) && (curPos.x < 268 * _vm->_resolutionScaler + 24)));
|
2011-12-23 22:15:35 +00:00
|
|
|
if (tes) {
|
2012-02-29 23:50:49 +01:00
|
|
|
int ix;
|
|
|
|
|
2013-06-25 08:00:11 +02:00
|
|
|
if (curPos.x < 76 * _vm->_resolutionScaler)
|
2012-02-25 21:13:24 +01:00
|
|
|
ix = MENU_INVENTORY;
|
2013-06-25 08:00:11 +02:00
|
|
|
else if (curPos.x < 124 * _vm->_resolutionScaler)
|
2012-02-20 23:56:32 +01:00
|
|
|
ix = MENU_MOVE;
|
2013-06-25 08:00:11 +02:00
|
|
|
else if (curPos.x < 172 * _vm->_resolutionScaler)
|
2012-02-25 21:13:24 +01:00
|
|
|
ix = MENU_ACTION;
|
2013-06-25 08:00:11 +02:00
|
|
|
else if (curPos.x < 220 * _vm->_resolutionScaler)
|
2012-02-28 07:59:51 +01:00
|
|
|
ix = MENU_SELF;
|
2013-06-25 08:00:11 +02:00
|
|
|
else if (curPos.x < 268 * _vm->_resolutionScaler)
|
2012-02-20 23:56:32 +01:00
|
|
|
ix = MENU_DISCUSS;
|
|
|
|
else
|
2012-02-25 21:13:24 +01:00
|
|
|
ix = MENU_FILE;
|
2012-02-20 23:56:32 +01:00
|
|
|
|
2012-03-23 07:44:04 +01:00
|
|
|
if ((ix != _msg3) || (!_multiTitle))
|
|
|
|
if (!((ix == MENU_FILE) && ((_msg3 == MENU_SAVE) || (_msg3 == MENU_LOAD)))) {
|
|
|
|
menuUp(_msg3);
|
2012-02-13 00:02:03 +11:00
|
|
|
menuDown(ix);
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg3 = ix;
|
|
|
|
_msg4 = OPCODE_NONE;
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2012-02-20 23:56:32 +01:00
|
|
|
} else { // Not in the MenuTitle line
|
2012-03-20 07:05:25 +01:00
|
|
|
if ((curPos.y > 11) && (_multiTitle))
|
|
|
|
util(curPos);
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2012-02-20 23:56:32 +01:00
|
|
|
} else { // There was a click
|
2012-03-23 07:44:04 +01:00
|
|
|
if ((_msg3 == MENU_FILE) && (_msg4 != OPCODE_NONE)) {
|
2012-02-13 09:07:48 +11:00
|
|
|
// Another menu to be _displayed
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2012-03-23 07:44:04 +01:00
|
|
|
menuUp(_msg3);
|
2013-07-29 01:58:03 +02:00
|
|
|
if ((_msg4 & 0xFF) == 1)
|
2013-06-28 22:07:53 +02:00
|
|
|
_msg3 = MENU_SAVE;
|
2012-02-20 23:56:32 +01:00
|
|
|
else
|
2013-06-28 22:07:53 +02:00
|
|
|
_msg3 = MENU_LOAD;
|
2012-03-23 07:44:04 +01:00
|
|
|
menuDown(_msg3);
|
2012-01-21 20:06:08 +11:00
|
|
|
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2012-03-27 22:54:50 +02:00
|
|
|
} else {
|
2012-01-21 20:06:08 +11:00
|
|
|
// A menu was clicked on
|
2012-03-23 07:44:04 +01:00
|
|
|
_menuSelected = (_multiTitle) && (_msg4 != OPCODE_NONE);
|
|
|
|
menuUp(_msg3);
|
2013-07-22 23:59:43 +02:00
|
|
|
_vm->_currAction = _msg4;
|
|
|
|
_vm->_currMenu = _msg3;
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg3 = OPCODE_NONE;
|
|
|
|
_msg4 = OPCODE_NONE;
|
2012-01-21 20:06:08 +11:00
|
|
|
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2012-02-13 00:02:03 +11:00
|
|
|
}
|
2011-12-23 22:15:35 +00:00
|
|
|
}
|
2011-12-23 19:02:50 +00:00
|
|
|
|
2013-08-15 07:57:07 +02:00
|
|
|
void Menu::setParent(MortevielleEngine *vm) {
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm = vm;
|
2013-08-15 07:57:07 +02:00
|
|
|
}
|
2013-06-25 08:00:11 +02:00
|
|
|
|
2013-08-15 07:57:07 +02:00
|
|
|
void Menu::initMenu() {
|
2012-02-13 09:07:48 +11:00
|
|
|
Common::File f;
|
2013-08-03 16:45:05 +01:00
|
|
|
|
|
|
|
bool enMenuLoaded = false;
|
|
|
|
if (_vm->getLanguage() == Common::EN_ANY) {
|
|
|
|
// Open the mort.dat file
|
|
|
|
if (!f.open(MORT_DAT))
|
|
|
|
warning("File %s not found. Using default menu from game data", MORT_DAT);
|
|
|
|
else {
|
|
|
|
// Validate the data file header
|
|
|
|
char fileId[4];
|
|
|
|
f.read(fileId, 4);
|
|
|
|
// Do not display warnings here. They would already have been displayed in MortevielleEngine::loadMortDat().
|
|
|
|
if (strncmp(fileId, "MORT", 4) == 0 && f.readByte() >= MORT_DAT_REQUIRED_VERSION) {
|
|
|
|
f.readByte(); // Minor version
|
|
|
|
// Loop to load resources from the data file
|
|
|
|
while (f.pos() < f.size()) {
|
|
|
|
// Get the Id and size of the next resource
|
|
|
|
char dataType[4];
|
|
|
|
int dataSize;
|
|
|
|
f.read(dataType, 4);
|
|
|
|
dataSize = f.readUint16LE();
|
|
|
|
if (!strncmp(dataType, "MENU", 4)) {
|
|
|
|
// MENU section
|
|
|
|
if (dataSize <= 7 * 24) {
|
|
|
|
f.read(_charArr, dataSize);
|
|
|
|
enMenuLoaded = true;
|
|
|
|
} else
|
|
|
|
warning("Wrong size %d for menu data. Expected %d or less", dataSize, 7*24);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
// Other sections
|
|
|
|
f.skip(dataSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Close the file
|
|
|
|
f.close();
|
|
|
|
if (!enMenuLoaded)
|
|
|
|
warning("Failed to load English menu. Will use default menu from game data instead");
|
|
|
|
}
|
|
|
|
}
|
2012-02-13 09:07:48 +11:00
|
|
|
|
2013-08-03 16:45:05 +01:00
|
|
|
if (!enMenuLoaded) {
|
2013-08-16 10:47:11 +01:00
|
|
|
if (_vm->getOriginalLanguage() == Common::FR_FRA) {
|
|
|
|
if (!f.open("menufr.mor"))
|
|
|
|
error("Missing file - menufr.mor");
|
|
|
|
} else { // Common::DE_DEU
|
2013-08-03 16:45:05 +01:00
|
|
|
if (!f.open("menual.mor"))
|
2013-08-16 10:47:11 +01:00
|
|
|
error("Missing file - menual.mor");
|
|
|
|
}
|
2013-08-03 16:45:05 +01:00
|
|
|
f.read(_charArr, 7 * 24);
|
|
|
|
f.close();
|
|
|
|
}
|
2012-02-13 09:07:48 +11:00
|
|
|
|
2012-03-07 08:33:48 +01:00
|
|
|
// Skipped: dialog asking to swap floppy
|
2012-02-13 09:07:48 +11:00
|
|
|
|
2013-08-16 13:29:23 +02:00
|
|
|
for (int i = 1; i <= 8; ++i)
|
2012-02-27 21:31:58 +01:00
|
|
|
_inventoryStringArray[i] = "* ";
|
|
|
|
_inventoryStringArray[7] = "< -*-*-*-*-*-*-*-*-*- ";
|
2013-08-16 13:29:23 +02:00
|
|
|
for (int i = 1; i <= 7; ++i)
|
2012-02-27 21:31:58 +01:00
|
|
|
_moveStringArray[i] = "* ";
|
2013-08-16 13:29:23 +02:00
|
|
|
for (int i = 1; i < 22; i++) {
|
2013-06-25 08:00:11 +02:00
|
|
|
_actionStringArray[i] = _vm->getString(i + kMenuActionStringIndex);
|
2012-02-26 18:08:53 +01:00
|
|
|
|
2012-02-27 21:31:58 +01:00
|
|
|
while (_actionStringArray[i].size() < 10)
|
|
|
|
_actionStringArray[i] += ' ';
|
2012-02-13 09:07:48 +11:00
|
|
|
|
|
|
|
if (i < 9) {
|
|
|
|
if (i < 6) {
|
2013-06-25 08:00:11 +02:00
|
|
|
_selfStringArray[i] = _vm->getString(i + kMenuSelfStringIndex);
|
2012-02-27 21:31:58 +01:00
|
|
|
while (_selfStringArray[i].size() < 10)
|
|
|
|
_selfStringArray[i] += ' ';
|
2012-02-13 09:07:48 +11:00
|
|
|
}
|
2013-06-25 08:00:11 +02:00
|
|
|
_discussStringArray[i] = _vm->getString(i + kMenuSayStringIndex) + ' ';
|
2012-02-13 09:07:48 +11:00
|
|
|
}
|
2013-08-16 13:29:23 +02:00
|
|
|
}
|
|
|
|
for (int i = 1; i <= 8; ++i) {
|
2013-07-29 01:58:03 +02:00
|
|
|
_discussMenu[i]._menuId = MENU_DISCUSS;
|
|
|
|
_discussMenu[i]._actionId = i;
|
|
|
|
if (i < 8) {
|
|
|
|
_moveMenu[i]._menuId = MENU_MOVE;
|
|
|
|
_moveMenu[i]._actionId = i;
|
|
|
|
}
|
|
|
|
_inventoryMenu[i]._menuId = MENU_INVENTORY;
|
|
|
|
_inventoryMenu[i]._actionId = i;
|
2012-02-13 09:07:48 +11:00
|
|
|
if (i > 6)
|
2013-07-29 01:58:03 +02:00
|
|
|
disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
|
2012-02-13 09:07:48 +11:00
|
|
|
}
|
2012-03-23 07:44:04 +01:00
|
|
|
_msg3 = OPCODE_NONE;
|
|
|
|
_msg4 = OPCODE_NONE;
|
2013-07-22 23:59:43 +02:00
|
|
|
_vm->_currMenu = OPCODE_NONE;
|
|
|
|
_vm->_currAction = OPCODE_NONE;
|
2013-06-25 08:00:11 +02:00
|
|
|
_vm->setMouseClick(false);
|
2012-02-13 09:07:48 +11:00
|
|
|
}
|
|
|
|
|
2012-03-11 23:06:33 +01:00
|
|
|
/**
|
|
|
|
* Engine function - Switch action menu to "Search" mode
|
|
|
|
* @remarks Originally called 'mfoudi'
|
|
|
|
*/
|
|
|
|
void Menu::setSearchMenu() {
|
2012-03-27 22:54:50 +02:00
|
|
|
for (int i = 1; i <= 7; ++i)
|
2013-07-29 01:58:03 +02:00
|
|
|
disableMenuItem(MENU_MOVE, _moveMenu[i]._actionId);
|
2012-03-11 23:06:33 +01:00
|
|
|
|
|
|
|
for (int i = 1; i <= 11; ++i)
|
2013-07-29 01:58:03 +02:00
|
|
|
disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId);
|
2012-03-11 23:06:33 +01:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_SUITE));
|
|
|
|
setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_STOP));
|
2012-03-11 23:06:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Engine function - Switch action menu from "Search" mode back to normal mode
|
|
|
|
* @remarks Originally called 'mfouen'
|
|
|
|
*/
|
|
|
|
void Menu::unsetSearchMenu() {
|
2013-06-25 08:00:11 +02:00
|
|
|
setDestinationText(_vm->_coreVar._currPlace);
|
2012-03-11 23:06:33 +01:00
|
|
|
for (int i = 1; i <= 11; ++i)
|
2013-07-29 01:58:03 +02:00
|
|
|
enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId);
|
2012-03-11 23:06:33 +01:00
|
|
|
|
2013-08-15 20:03:27 +02:00
|
|
|
setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_PROBE));
|
|
|
|
setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_RAISE));
|
2012-03-11 23:06:33 +01:00
|
|
|
}
|
|
|
|
|
2012-03-24 15:19:54 +01:00
|
|
|
/**
|
|
|
|
* Set Inventory menu texts
|
|
|
|
* @remarks Originally called 'modinv'
|
|
|
|
*/
|
|
|
|
void Menu::setInventoryText() {
|
|
|
|
Common::String nomp;
|
|
|
|
|
|
|
|
int cy = 0;
|
|
|
|
for (int i = 1; i <= 6; ++i) {
|
2013-06-25 08:00:11 +02:00
|
|
|
if (_vm->_coreVar._inventory[i] != 0) {
|
2012-03-24 15:19:54 +01:00
|
|
|
++cy;
|
2013-06-25 08:00:11 +02:00
|
|
|
int r = _vm->_coreVar._inventory[i] + 400;
|
|
|
|
nomp = _vm->getString(r - 501 + kInventoryStringIndex);
|
2013-07-29 01:58:03 +02:00
|
|
|
setText(_inventoryMenu[cy]._menuId, _inventoryMenu[cy]._actionId, nomp);
|
|
|
|
enableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
|
2012-03-24 15:19:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cy < 6) {
|
|
|
|
for (int i = cy + 1; i <= 6; ++i) {
|
2013-07-29 01:58:03 +02:00
|
|
|
setText(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId, " ");
|
|
|
|
disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
|
2012-03-24 15:19:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-12-26 22:08:18 +01:00
|
|
|
} // End of namespace Mortevielle
|