aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-07-29 01:58:03 +0200
committerStrangerke2013-07-29 01:58:03 +0200
commitb50f0e2a0d657c64dedb5800912b9e6558e0529d (patch)
tree24787ffdca1075a61256ebc4bbdd5263e062822c /engines
parent1b2adafefa6512ce8f3d9b85b0d55a3c8fad4672 (diff)
downloadscummvm-rg350-b50f0e2a0d657c64dedb5800912b9e6558e0529d.tar.gz
scummvm-rg350-b50f0e2a0d657c64dedb5800912b9e6558e0529d.tar.bz2
scummvm-rg350-b50f0e2a0d657c64dedb5800912b9e6558e0529d.zip
MORTEVIELLE: Remove remaining macros, start refactoring menus, modify the way _cfiphBuffer is read/written
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/actions.cpp21
-rw-r--r--engines/mortevielle/graphics.cpp2
-rw-r--r--engines/mortevielle/menu.cpp112
-rw-r--r--engines/mortevielle/menu.h39
-rw-r--r--engines/mortevielle/mortevielle.h20
-rw-r--r--engines/mortevielle/speech.cpp23
-rw-r--r--engines/mortevielle/speech.h2
-rw-r--r--engines/mortevielle/utils.cpp52
8 files changed, 143 insertions, 128 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 88eee0cf7d..5738a8fd3a 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -41,13 +41,14 @@ namespace Mortevielle {
* @remarks Originally called 'taller'
*/
void MortevielleEngine::fctMove() {
- if ((_coreVar._currPlace == ROOM26) && (_currAction == _menu._moveMenu[6])) {
+ int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId;
+ if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) {
_coreVar._currPlace = LANDING;
_caff = _coreVar._currPlace;
drawPictureWithText();
handleDescriptionText(2, _coreVar._currPlace);
}
- if ((_coreVar._currPlace == LANDING) && (_currAction == _menu._moveMenu[6])) {
+ if ((_coreVar._currPlace == LANDING) && (_currAction == oldMenu)) {
if (!_syn)
displayTextInVerbBar(getEngineString(S_GO_TO));
displayStatusArrow();
@@ -85,9 +86,11 @@ void MortevielleEngine::fctMove() {
}
exitRoom();
int menuChoice = 1;
-
- while (_menu._moveMenu[menuChoice] != _currAction)
+ oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId;
+ while (oldMenu != _currAction) {
++menuChoice;
+ oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId;
+ }
if (_coreVar._currPlace == MOUNTAIN) {
if (menuChoice == 1)
@@ -300,9 +303,11 @@ void MortevielleEngine::fctTake() {
*/
void MortevielleEngine::fctInventoryTake() {
int inventIndex = 0;
+ int oldMenu = 0;
do {
++inventIndex;
- } while (_menu._inventoryMenu[inventIndex] != _currAction);
+ oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId;
+ } while (oldMenu != _currAction);
int cz = 0;
int cy = 0;
do {
@@ -1154,7 +1159,7 @@ void MortevielleEngine::fctEnter() {
++_coreVar._faithScore;
_coreVar._currPlace = LANDING;
_currMenu = MENU_DISCUSS;
- _currAction = _menu._discussMenu[charIndex];
+ _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId;
_syn = true;
if (_roomDoorId == ROOM9) {
_col = true;
@@ -1352,9 +1357,11 @@ void MortevielleEngine::fctDiscuss() {
displId = 128;
else {
cx = 0;
+ int oldMenu;
do {
++cx;
- } while (_menu._discussMenu[cx] != _currAction);
+ oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId;
+ } while (oldMenu != _currAction);
_caff = 69 + cx;
drawPictureWithText();
handleDescriptionText(2, _caff);
diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp
index 3a411691aa..8392fabd6a 100644
--- a/engines/mortevielle/graphics.cpp
+++ b/engines/mortevielle/graphics.cpp
@@ -1113,7 +1113,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) {
pt.x += 1;
pt.y += 1;
for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) {
- _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), color);
+ _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color);
pt.x += charWidth;
}
_vm->_mouse.showMouse();
diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp
index a1f628992d..f86fd208c1 100644
--- a/engines/mortevielle/menu.cpp
+++ b/engines/mortevielle/menu.cpp
@@ -52,32 +52,30 @@ const byte menuConstants[8][4] = {
* Setup a menu's contents
* @remarks Originally called 'menut'
*/
-void Menu::setText(int menuId, Common::String name) {
- byte h = hi(menuId);
- byte l = lo(menuId);
+void Menu::setText(int menuId, int actionId, Common::String name) {
Common::String s = name;
while (s.size() < 22)
s += ' ';
- switch (h) {
+ switch (menuId) {
case MENU_INVENTORY:
- if (l != 7) {
- _inventoryStringArray[l] = s;
- _inventoryStringArray[l].insertChar(' ', 0);
+ if (actionId != 7) {
+ _inventoryStringArray[actionId] = s;
+ _inventoryStringArray[actionId].insertChar(' ', 0);
}
break;
case MENU_MOVE:
- _moveStringArray[l] = s;
+ _moveStringArray[actionId] = s;
break;
case MENU_ACTION:
- _actionStringArray[l] = s;
+ _actionStringArray[actionId] = s;
break;
case MENU_SELF:
- _selfStringArray[l] = s;
+ _selfStringArray[actionId] = s;
break;
case MENU_DISCUSS:
- _discussStringArray[l] = s;
+ _discussStringArray[actionId] = s;
break;
default:
break;
@@ -99,40 +97,38 @@ void Menu::setDestinationText(int roomId) {
nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex);
while (nomp.size() < 20)
nomp += ' ';
- setText(_moveMenu[destinationId + 1], nomp);
+ setText(_moveMenu[destinationId + 1]._menuId, _moveMenu[destinationId + 1]._actionId, nomp);
}
nomp = "* ";
for (int i = 7; i >= destinationId + 1; --i)
- setText(_moveMenu[i], nomp);
+ setText(_moveMenu[i]._menuId, _moveMenu[i]._actionId, nomp);
}
/**
* _disable a menu item
- * @param menuId Hi byte represents menu number, lo byte reprsents item index
+ * @param menuId Menu number
+ * @param actionId Item index
*/
-void Menu::disableMenuItem(int menuId) {
- byte h = hi(menuId);
- byte l = lo(menuId);
-
- switch (h) {
+void Menu::disableMenuItem(int menuId, int actionId) {
+ switch (menuId) {
case MENU_INVENTORY:
- if (l > 6) {
- _inventoryStringArray[l].setChar('<', 0);
- _inventoryStringArray[l].setChar('>', 21);
+ if (actionId > 6) {
+ _inventoryStringArray[actionId].setChar('<', 0);
+ _inventoryStringArray[actionId].setChar('>', 21);
} else
- _inventoryStringArray[l].setChar('*', 0);
+ _inventoryStringArray[actionId].setChar('*', 0);
break;
case MENU_MOVE:
- _moveStringArray[l].setChar('*', 0);
+ _moveStringArray[actionId].setChar('*', 0);
break;
case MENU_ACTION:
- _actionStringArray[l].setChar('*', 0);
+ _actionStringArray[actionId].setChar('*', 0);
break;
case MENU_SELF:
- _selfStringArray[l].setChar('*', 0);
+ _selfStringArray[actionId].setChar('*', 0);
break;
case MENU_DISCUSS:
- _discussStringArray[l].setChar('*', 0);
+ _discussStringArray[actionId].setChar('*', 0);
break;
default:
break;
@@ -141,31 +137,29 @@ void Menu::disableMenuItem(int menuId) {
/**
* Enable a menu item
- * @param menuId Hi byte represents menu number, lo byte reprsents item index
+ * @param menuId Menu number
+ * @param actionId Item index
* @remarks Originally called menu_enable
*/
-void Menu::enableMenuItem(int menuId) {
- byte h = hi(menuId);
- byte l = lo(menuId);
-
- switch (h) {
+void Menu::enableMenuItem(int menuId, int actionId) {
+ switch (menuId) {
case MENU_INVENTORY:
- _inventoryStringArray[l].setChar(' ', 0);
- _inventoryStringArray[l].setChar(' ', 21);
+ _inventoryStringArray[actionId].setChar(' ', 0);
+ _inventoryStringArray[actionId].setChar(' ', 21);
break;
case MENU_MOVE:
- _moveStringArray[l].setChar(' ', 0);
+ _moveStringArray[actionId].setChar(' ', 0);
break;
case MENU_ACTION:
- _actionStringArray[l].setChar(' ', 0);
+ _actionStringArray[actionId].setChar(' ', 0);
break;
case MENU_SELF:
- _selfStringArray[l].setChar(' ', 0);
+ _selfStringArray[actionId].setChar(' ', 0);
// The original sets two times the same value. Skipped
// _selfStringArray[l].setChar(' ', 0);
break;
case MENU_DISCUSS:
- _discussStringArray[l].setChar(' ', 0);
+ _discussStringArray[actionId].setChar(' ', 0);
break;
default:
break;
@@ -235,7 +229,7 @@ void Menu::invert(int indx) {
if (_msg4 == OPCODE_NONE)
return;
- int menuIndex = lo(_msg4);
+ int menuIndex = _msg4 & 0xFF;
_vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3);
@@ -471,7 +465,7 @@ void Menu::updateMenu() {
// Another menu to be _displayed
_vm->setMouseClick(false);
menuUp(_msg3);
- if (lo(_msg4) == 1)
+ if ((_msg4 & 0xFF) == 1)
_msg3 = MENU_SAVE;
else
_msg3 = MENU_LOAD;
@@ -531,12 +525,16 @@ void Menu::initMenu(MortevielleEngine *vm) {
++i;
} while (i != 22);
for (i = 1; i <= 8; ++i) {
- _discussMenu[i] = 0x500 + i;
- if (i < 8)
- _moveMenu[i] = 0x200 + i;
- _inventoryMenu[i] = 0x100 + i;
+ _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;
if (i > 6)
- disableMenuItem(_inventoryMenu[i]);
+ disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
}
_msg3 = OPCODE_NONE;
_msg4 = OPCODE_NONE;
@@ -551,13 +549,13 @@ void Menu::initMenu(MortevielleEngine *vm) {
*/
void Menu::setSearchMenu() {
for (int i = 1; i <= 7; ++i)
- disableMenuItem(_moveMenu[i]);
+ disableMenuItem(MENU_MOVE, _moveMenu[i]._actionId);
for (int i = 1; i <= 11; ++i)
- disableMenuItem(_actionMenu[i]);
+ disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId);
- setText(OPCODE_SOUND, _vm->getEngineString(S_SUITE));
- setText(OPCODE_LIFT, _vm->getEngineString(S_STOP));
+ setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_SUITE));
+ setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_STOP));
}
/**
@@ -567,10 +565,10 @@ void Menu::setSearchMenu() {
void Menu::unsetSearchMenu() {
setDestinationText(_vm->_coreVar._currPlace);
for (int i = 1; i <= 11; ++i)
- enableMenuItem(_actionMenu[i]);
+ enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId);
- setText(OPCODE_SOUND, _vm->getEngineString(S_PROBE));
- setText(OPCODE_LIFT, _vm->getEngineString(S_RAISE));
+ setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_PROBE));
+ setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_RAISE));
}
/**
@@ -586,15 +584,15 @@ void Menu::setInventoryText() {
++cy;
int r = _vm->_coreVar._inventory[i] + 400;
nomp = _vm->getString(r - 501 + kInventoryStringIndex);
- setText(_inventoryMenu[cy], nomp);
- enableMenuItem(_inventoryMenu[i]);
+ setText(_inventoryMenu[cy]._menuId, _inventoryMenu[cy]._actionId, nomp);
+ enableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
}
}
if (cy < 6) {
for (int i = cy + 1; i <= 6; ++i) {
- setText(_inventoryMenu[i], " ");
- disableMenuItem(_inventoryMenu[i]);
+ setText(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId, " ");
+ disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId);
}
}
}
diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h
index d4538effee..2428d8917b 100644
--- a/engines/mortevielle/menu.h
+++ b/engines/mortevielle/menu.h
@@ -40,6 +40,33 @@ enum {
MENU_LOAD = 8
};
+enum verbs {OPCODE_NONE = 0, OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305,
+OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a,
+OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f,
+OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314,
+OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404,
+OPCODE_SLOOK = 0x405};
+
+struct menuItem {
+ int _menuId;
+ int _actionId;
+};
+
+static const menuItem _actionMenu[12] = {
+ {OPCODE_NONE >> 8, OPCODE_NONE & 0xFF},
+ {OPCODE_SHIDE >> 8, OPCODE_SHIDE & 0xFF},
+ {OPCODE_ATTACH >> 8, OPCODE_ATTACH & 0xFF},
+ {OPCODE_FORCE >> 8, OPCODE_FORCE & 0xFF},
+ {OPCODE_SLEEP >> 8, OPCODE_SLEEP & 0xFF},
+ {OPCODE_ENTER >> 8, OPCODE_ENTER & 0xFF},
+ {OPCODE_CLOSE >> 8, OPCODE_CLOSE & 0xFF},
+ {OPCODE_KNOCK >> 8, OPCODE_KNOCK & 0xFF},
+ {OPCODE_EAT >> 8, OPCODE_EAT & 0xFF},
+ {OPCODE_PLACE >> 8, OPCODE_PLACE & 0xFF},
+ {OPCODE_OPEN >> 8, OPCODE_OPEN & 0xFF},
+ {OPCODE_LEAVE >> 8, OPCODE_LEAVE & 0xFF}
+};
+
class Menu {
private:
MortevielleEngine *_vm;
@@ -61,15 +88,15 @@ public:
Common::String _actionStringArray[22];
Common::String _selfStringArray[7];
Common::String _discussStringArray[9];
- int _discussMenu[9];
- int _inventoryMenu[9];
- int _moveMenu[8];
+ menuItem _discussMenu[9];
+ menuItem _inventoryMenu[9];
+ menuItem _moveMenu[8];
- void setText(int menuId, Common::String name);
+ void setText(int menuId, int actionId, Common::String name);
void setDestinationText(int roomId);
void setInventoryText();
- void disableMenuItem(int menuId);
- void enableMenuItem(int menuId);
+ void disableMenuItem(int menuId, int actionId);
+ void enableMenuItem(int menuId, int actionId);
void displayMenu();
void drawMenu();
void menuUp(int msgId);
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 6f5d4b4fac..4d07d3000f 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -65,12 +65,6 @@ namespace Mortevielle {
*/
const int kAdrMusic = 0x5000;
-#define ord(v) ((int) v)
-#define chr(v) ((unsigned char) v)
-#define lo(v) ((v) & 0xff)
-#define hi(v) (((v) >> 8) & 0xff)
-#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8))
-
// Debug channels
enum {
kMortevielleCore = 1 << 0,
@@ -137,20 +131,6 @@ const int kMenuSelfStringIndex = 497;
const int kMenuSayStringIndex = 502;
const int kMaxPatt = 20;
-const int OPCODE_NONE = 0;
-enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305,
- OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a,
- OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f,
- OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314,
- OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404,
- OPCODE_SLOOK = 0x405};
-
-static const int _actionMenu[12] = { OPCODE_NONE,
- OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP,
- OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT,
- OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
-};
-
/*
9 "A glance at the forbidden$",
18 "It's already open$",
diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp
index 08c92c6560..68ae3dac3e 100644
--- a/engines/mortevielle/speech.cpp
+++ b/engines/mortevielle/speech.cpp
@@ -150,7 +150,7 @@ void SpeechManager::regenbruit() {
int i = kOffsetB3 + 8590;
int j = 0;
do {
- _cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]);
+ _cfiphBuffer[j] = READ_BE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]);
i += 2;
++j;
} while (i < kOffsetB3 + 8790);
@@ -185,7 +185,7 @@ void SpeechManager::loadPhonemeSounds() {
error("Missing file - phbrui.mor");
for (int i = 1; i <= f.size() / 2; ++i)
- _cfiphBuffer[i] = f.readSint16LE();
+ _cfiphBuffer[i] = f.readUint16BE();
f.close();
}
@@ -214,7 +214,7 @@ void SpeechManager::trait_car() {
switch (_queue[1]._code) {
case 9:
- if (_queue[1]._val != ord('#'))
+ if (_queue[1]._val != (int)'#')
for (i = 0; i <= _queue[1]._rep; ++i)
entroct(_queue[1]._val);
break;
@@ -533,13 +533,16 @@ void SpeechManager::initQueue() {
* @remarks Originally called 'trait_ph'
*/
void SpeechManager::handlePhoneme() {
- const int deca[3] = {300, 30, 40};
+ const uint16 deca[3] = {300, 30, 40};
- int startPos = swap(_cfiphBuffer[_phonemeNumb - 1]) + deca[_typlec];
- int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec];
+ uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_typlec];
+ uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_typlec];
int wordCount = endPos - startPos;
- for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2)
- WRITE_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]);
+
+ startPos /= 2;
+ endPos /= 2;
+ for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2)
+ WRITE_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]);
_ptr_oct = 0;
int currWord = 0;
@@ -553,7 +556,7 @@ void SpeechManager::handlePhoneme() {
moveQueue();
trait_car();
- entroct(ord('#'));
+ entroct((int)'#');
}
/**
@@ -561,7 +564,7 @@ void SpeechManager::handlePhoneme() {
* @remarks Originally called 'parole'
*/
void SpeechManager::startSpeech(int rep, int ht, int typ) {
- int savph[501];
+ uint16 savph[501];
int tempo;
if (_vm->_soundOff)
diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h
index ef3211dad9..c3c4c32942 100644
--- a/engines/mortevielle/speech.h
+++ b/engines/mortevielle/speech.h
@@ -75,7 +75,7 @@ private:
int _ptr_oct;
public:
- int16 *_cfiphBuffer;
+ uint16 *_cfiphBuffer;
int _tbi[256];
int _mlec;
byte *_noise5Buf;
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 7a8306067d..2316d1e9fd 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -282,7 +282,7 @@ void MortevielleEngine::handleAction() {
_menu.eraseMenu();
_menu._menuDisplayed = false;
if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) {
- changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1);
+ changeGraphicalDevice((uint)((int)inkey - 1) >> 1);
return;
}
if (_menu._menuSelected && (_currMenu == MENU_SAVE)) {
@@ -504,48 +504,48 @@ void MortevielleEngine::showPeoplePresent(int bitIndex) {
int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2);
for (int i = 1; i <= 8; ++i)
- _menu.disableMenuItem(_menu._discussMenu[i]);
+ _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId);
clearUpperRightPart();
if ((bitIndex & 128) == 128) {
_screenSurface.putxy(xp, 24);
_screenSurface.drawString("LEO", 4);
- _menu.enableMenuItem(_menu._discussMenu[1]);
+ _menu.enableMenuItem(_menu._discussMenu[1]._menuId, _menu._discussMenu[1]._actionId);
}
if ((bitIndex & 64) == 64) {
_screenSurface.putxy(xp, 32);
_screenSurface.drawString("PAT", 4);
- _menu.enableMenuItem(_menu._discussMenu[2]);
+ _menu.enableMenuItem(_menu._discussMenu[2]._menuId, _menu._discussMenu[2]._actionId);
}
if ((bitIndex & 32) == 32) {
_screenSurface.putxy(xp, 40);
_screenSurface.drawString("GUY", 4);
- _menu.enableMenuItem(_menu._discussMenu[3]);
+ _menu.enableMenuItem(_menu._discussMenu[3]._menuId, _menu._discussMenu[3]._actionId);
}
if ((bitIndex & 16) == 16) {
_screenSurface.putxy(xp, 48);
_screenSurface.drawString("EVA", 4);
- _menu.enableMenuItem(_menu._discussMenu[4]);
+ _menu.enableMenuItem(_menu._discussMenu[4]._menuId, _menu._discussMenu[4]._actionId);
}
if ((bitIndex & 8) == 8) {
_screenSurface.putxy(xp, 56);
_screenSurface.drawString("BOB", 4);
- _menu.enableMenuItem(_menu._discussMenu[5]);
+ _menu.enableMenuItem(_menu._discussMenu[5]._menuId, _menu._discussMenu[5]._actionId);
}
if ((bitIndex & 4) == 4) {
_screenSurface.putxy(xp, 64);
_screenSurface.drawString("LUC", 4);
- _menu.enableMenuItem(_menu._discussMenu[6]);
+ _menu.enableMenuItem(_menu._discussMenu[6]._menuId, _menu._discussMenu[6]._actionId);
}
if ((bitIndex & 2) == 2) {
_screenSurface.putxy(xp, 72);
_screenSurface.drawString("IDA", 4);
- _menu.enableMenuItem(_menu._discussMenu[7]);
+ _menu.enableMenuItem(_menu._discussMenu[7]._menuId, _menu._discussMenu[7]._actionId);
}
if ((bitIndex & 1) == 1) {
_screenSurface.putxy(xp, 80);
_screenSurface.drawString("MAX", 4);
- _menu.enableMenuItem(_menu._discussMenu[8]);
+ _menu.enableMenuItem(_menu._discussMenu[8]._menuId, _menu._discussMenu[8]._actionId);
}
_currBitIndex = bitIndex;
}
@@ -699,7 +699,7 @@ int MortevielleEngine::getPresenceStatsRedRoom() {
*/
void MortevielleEngine::displayAloneText() {
for (int i = 1; i <= 8; ++i)
- _menu.disableMenuItem(_menu._discussMenu[i]);
+ _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId);
Common::String sYou = getEngineString(S_YOU);
Common::String sAre = getEngineString(S_ARE);
@@ -1643,7 +1643,7 @@ void MortevielleEngine::hourToChar() {
minute = 1;
hour += day * 24;
minute += hour * 2;
- _coreVar._fullHour = chr(minute);
+ _coreVar._fullHour = (unsigned char)minute;
}
/**
@@ -1651,7 +1651,7 @@ void MortevielleEngine::hourToChar() {
* @remarks Originally called 'theure'
*/
void MortevielleEngine::charToHour() {
- int fullHour = ord(_coreVar._fullHour);
+ int fullHour = _coreVar._fullHour;
int tmpHour = fullHour % 48;
_currDay = fullHour / 48;
_currHalfHour = tmpHour % 2;
@@ -1869,16 +1869,16 @@ bool MortevielleEngine::decryptNextChar(char &c, int &idx, byte &pt) {
}
if (oct == 30)
- c = chr(cryptoArr30[ocd]);
+ c = (unsigned char)cryptoArr30[ocd];
else
- c = chr(cryptoArr31[ocd]);
+ c = (unsigned char)cryptoArr31[ocd];
if (c == '\0') {
c = '#';
return true;
}
} else {
- c = chr(cryptoArrDefault[oct]);
+ c = (unsigned char)cryptoArrDefault[oct];
}
return false;
}
@@ -1944,7 +1944,7 @@ void MortevielleEngine::resetVariables() {
// Only object in inventory: a gun
_coreVar._inventory[1] = 113;
- _coreVar._fullHour = chr(20);
+ _coreVar._fullHour = (unsigned char)20;
for (int i = 1; i <= 10; ++i)
_coreVar._pctHintFound[i] = ' ';
@@ -2175,10 +2175,10 @@ void MortevielleEngine::loadCFIPH() {
error("Missing file - *cfiph.mor");
}
- _speechManager._cfiphBuffer = (int16 *)malloc(sizeof(int16) * (f.size() / 2));
+ _speechManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2));
for (int i = 0; i < (f.size() / 2); ++i)
- _speechManager._cfiphBuffer[i] = f.readSint16LE();
+ _speechManager._cfiphBuffer[i] = f.readUint16BE();
f.close();
}
@@ -2307,7 +2307,7 @@ void MortevielleEngine::prepareRoom() {
if (hintCount == 10)
pctStr = "10";
else
- pctStr = chr(hintCount + 48);
+ pctStr = (unsigned char)(hintCount + 48);
_hintPctMessage = "[1][";
_hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED);
@@ -2762,8 +2762,8 @@ void MortevielleEngine::displayItemInHand(int objId) {
if (objId != 500)
strp = getString(objId - 501 + kInventoryStringIndex);
- _menu.setText(_menu._inventoryMenu[8], strp);
- _menu.disableMenuItem(_menu._inventoryMenu[8]);
+ _menu.setText(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId, strp);
+ _menu.disableMenuItem(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId);
}
/**
@@ -3234,7 +3234,7 @@ L1:
_caff = 69 + cx;
_crep = _caff;
_currMenu = MENU_DISCUSS;
- _currAction = _menu._discussMenu[cx];
+ _currAction = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId;
_syn = true;
_col = true;
} else {
@@ -3291,7 +3291,7 @@ void MortevielleEngine::displayStatusArrow() {
if (_num == 9999)
return;
- displayStatusInDescriptionBar(chr(152));
+ displayStatusInDescriptionBar((unsigned char)152);
bool inRect = false;
do {
touch = '\0';
@@ -3450,7 +3450,7 @@ void MortevielleEngine::displayStatusInDescriptionBar(char stat) {
else
color = 12;
- _screenSurface.writeCharacter(Common::Point(306, 193), ord(stat), color);
+ _screenSurface.writeCharacter(Common::Point(306, 193), stat, color);
_screenSurface.drawBox(300, 191, 16, 8, 15);
_mouse.showMouse();
}
@@ -3491,7 +3491,7 @@ int MortevielleEngine::gettKeyPressed() {
break;
}
- return ord(ch);
+ return (int)ch;
}
} // End of namespace Mortevielle