aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mortevielle/actions.cpp6
-rw-r--r--engines/mortevielle/menu.cpp87
-rw-r--r--engines/mortevielle/menu.h12
-rw-r--r--engines/mortevielle/mor.cpp44
-rw-r--r--engines/mortevielle/mor.h1
-rw-r--r--engines/mortevielle/mortevielle.cpp92
-rw-r--r--engines/mortevielle/mortevielle.h3
-rw-r--r--engines/mortevielle/outtext.cpp2
-rw-r--r--engines/mortevielle/ovd1.cpp4
-rw-r--r--engines/mortevielle/speech.cpp222
-rw-r--r--engines/mortevielle/speech.h2
-rw-r--r--engines/mortevielle/var_mor.cpp44
-rw-r--r--engines/mortevielle/var_mor.h74
13 files changed, 285 insertions, 308 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 86c03b41d1..a4255fd598 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -83,7 +83,7 @@ void MortevielleEngine::fctMove() {
if (g_num != 6)
affrep();
else
- aldepl();
+ showMoveMenuAlert();
return;
}
tsort();
@@ -598,7 +598,7 @@ void MortevielleEngine::fctOpen() {
}
if (g_caff == 15) {
- aldepl();
+ showMoveMenuAlert();
return;
}
@@ -1132,7 +1132,7 @@ void MortevielleEngine::fctEnter() {
gotoDiningRoom();
_menu.setDestinationMenuText(g_s._currPlace);
} else if (g_s._currPlace == LANDING)
- aldepl();
+ showMoveMenuAlert();
else if (g_ment == 0)
g_crep = 997;
else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) {
diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp
index e4f3702a7b..6cf09be3c8 100644
--- a/engines/mortevielle/menu.cpp
+++ b/engines/mortevielle/menu.cpp
@@ -38,7 +38,16 @@
namespace Mortevielle {
-/* NIVEAU 14*/
+const byte _menuConstants[8][4] = {
+ { 7, 37, 22, 8},
+ {19, 33, 23, 7},
+ {31, 89, 10, 21},
+ {43, 25, 11, 5},
+ {55, 37, 5, 8},
+ {64, 13, 11, 2},
+ {62, 22, 13, 4},
+ {62, 25, 13, 5}
+};
/**
* Setup a menu's contents
@@ -219,62 +228,66 @@ void Menu::drawMenu() {
_multiTitle = false;
}
-void Menu::invers(int ix) {
- Common::String s;
-
+/**
+ * Menu function - Invert a menu entry
+ * @remarks Originally called 'invers'
+ */
+void Menu::invert(int indx) {
if (g_msg4 == OPCODE_NONE)
return;
int menuIndex = lo(g_msg4);
- g_vm->_screenSurface.putxy(g_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3);
+ g_vm->_screenSurface.putxy(_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3);
+
+ Common::String str;
switch (g_msg3) {
case 1:
- s = _inventoryStringArray[menuIndex];
+ str = _inventoryStringArray[menuIndex];
break;
case 2:
- s = _moveStringArray[menuIndex];
+ str = _moveStringArray[menuIndex];
break;
case 3:
- s = _actionStringArray[menuIndex];
+ str = _actionStringArray[menuIndex];
break;
case 4:
- s = _selfStringArray[menuIndex];
+ str = _selfStringArray[menuIndex];
break;
case 5:
- s = _discussStringArray[menuIndex];
+ str = _discussStringArray[menuIndex];
break;
case 6:
- s = g_vm->getEngineString(S_SAVE_LOAD + menuIndex);
+ str = g_vm->getEngineString(S_SAVE_LOAD + menuIndex);
break;
case 7:
- s = g_vm->getEngineString(S_SAVE_LOAD + 1);
- s += ' ';
- s += (char)(48 + menuIndex);
+ str = g_vm->getEngineString(S_SAVE_LOAD + 1);
+ str += ' ';
+ str += (char)(48 + menuIndex);
break;
case 8:
if (menuIndex == 1) {
- s = g_vm->getEngineString(S_RESTART);
+ str = g_vm->getEngineString(S_RESTART);
} else {
- s = g_vm->getEngineString(S_SAVE_LOAD + 2);
- s += ' ';
- s += (char)(47 + menuIndex);
+ str = g_vm->getEngineString(S_SAVE_LOAD + 2);
+ str += ' ';
+ str += (char)(47 + menuIndex);
}
break;
default:
break;
}
- if ((s[0] != '*') && (s[0] != '<'))
- g_vm->_screenSurface.drawString(s, ix);
+ if ((str[0] != '*') && (str[0] != '<'))
+ g_vm->_screenSurface.drawString(str, indx);
else
g_msg4 = OPCODE_NONE;
}
void Menu::util(Common::Point pos) {
- int ymx = (g_menuConstants[g_msg3 - 1][3] << 3) + 16;
- int dxcar = g_menuConstants[g_msg3 - 1][2];
- int xmn = (g_menuConstants[g_msg3 - 1][0] << 2) * g_res;
+ int ymx = (_menuConstants[g_msg3 - 1][3] << 3) + 16;
+ int dxcar = _menuConstants[g_msg3 - 1][2];
+ int xmn = (_menuConstants[g_msg3 - 1][0] << 2) * g_res;
int ix;
if (g_res == 1)
@@ -285,12 +298,12 @@ void Menu::util(Common::Point pos) {
if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) {
ix = (((uint)pos.y >> 3) - 1) + (g_msg3 << 8);
if (ix != g_msg4) {
- invers(1);
+ invert(1);
g_msg4 = ix;
- invers(0);
+ invert(0);
}
} else if (g_msg4 != OPCODE_NONE) {
- invers(1);
+ invert(1);
g_msg4 = OPCODE_NONE;
}
}
@@ -299,8 +312,8 @@ void Menu::util(Common::Point pos) {
* Draw a menu
*/
void Menu::menuDown(int ii) {
- int cx, xcc;
- int xco, nb_lig;
+ int cx, xcc, xco;
+ int lignNumb;
/* debug('menuDown'); */
@@ -308,23 +321,23 @@ void Menu::menuDown(int ii) {
g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface);
// Draw the menu
- xco = g_menuConstants[ii - 1][0];
- nb_lig = g_menuConstants[ii - 1][3];
+ xco = _menuConstants[ii - 1][0];
+ lignNumb = _menuConstants[ii - 1][3];
g_vm->_mouse.hideMouse();
- sauvecr(10, (g_menuConstants[ii - 1][1] + 1) << 1);
+ sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1);
xco = xco << 3;
if (g_res == 1)
cx = 10;
else
cx = 6;
- xcc = xco + (g_menuConstants[ii - 1][2] * cx) + 6;
+ xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6;
if ((ii == 4) && (g_vm->getLanguage() == Common::EN_ANY))
// Extra width needed for Self menu in English version
xcc = 435;
- g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (g_menuConstants[ii - 1][1] << 1)));
- g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (g_menuConstants[ii - 1][1] << 1)));
- g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (g_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (g_menuConstants[ii - 1][1] << 1)));
+ g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1)));
+ g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1)));
+ g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1)));
g_vm->_screenSurface.putxy(xco, 16);
cx = 0;
do {
@@ -374,7 +387,7 @@ void Menu::menuDown(int ii) {
break;
}
g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8);
- } while (cx != nb_lig);
+ } while (cx != lignNumb);
_multiTitle = true;
g_vm->_mouse.showMouse();
}
@@ -384,7 +397,7 @@ void Menu::menuDown(int ii) {
*/
void Menu::menuUp(int xx) {
if (_multiTitle) {
- charecr(10, (g_menuConstants[xx - 1][1] + 1) << 1);
+ charecr(10, (_menuConstants[xx - 1][1] + 1) << 1);
/* Restore the background area */
assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch);
diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h
index ccf5bd8954..7f224a3ee5 100644
--- a/engines/mortevielle/menu.h
+++ b/engines/mortevielle/menu.h
@@ -33,10 +33,15 @@
namespace Mortevielle {
+enum {
+ MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4,
+ MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8
+};
+
class Menu {
private:
void util(Common::Point pos);
- void invers(int ix);
+ void invert(int indx);
void menuDown(int ii);
public:
bool _menuActive;
@@ -67,10 +72,5 @@ public:
void unsetSearchMenu();
};
-enum {
- MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4,
- MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8
-};
-
} // End of namespace Mortevielle
#endif
diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp
index 041841fcca..4ba68c3778 100644
--- a/engines/mortevielle/mor.cpp
+++ b/engines/mortevielle/mor.cpp
@@ -109,18 +109,6 @@ void pictout(int seg, int dep, int x, int y) {
g_vm->_screenSurface.drawPicture(surface, x, y);
}
-void sauvecr(int y, int dy) {
- g_vm->_mouse.hideMouse();
- s_sauv(g_vm->_currGraphicalDevice, y, dy);
- g_vm->_mouse.showMouse();
-}
-
-void charecr(int y, int dy) {
- g_vm->_mouse.hideMouse();
- s_char(g_vm->_currGraphicalDevice, y, dy);
- g_vm->_mouse.showMouse();
-}
-
void adzon() {
Common::File f;
@@ -363,7 +351,7 @@ void repon(int f, int m) {
}
int chlm() {
- int retval = getRandomNumber(1, 2);
+ int retval = g_vm->getRandomNumber(1, 2);
if (retval == 2)
retval = 128;
@@ -459,13 +447,13 @@ void ecfren(int &p, int &rand, int cf, int roomId) {
p = -400;
if (p != -500) {
p += cf;
- rand = getRandomNumber(1, 100);
+ rand = g_vm->getRandomNumber(1, 100);
}
}
void becfren(int roomId) {
if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) {
- int rand = getRandomNumber(1, 2);
+ int rand = g_vm->getRandomNumber(1, 2);
if (roomId == GREEN_ROOM) {
if (rand == 1)
g_vm->_roomPresenceLuc = true;
@@ -503,7 +491,7 @@ void init_nbrepm() {
void phaz(int &rand, int &p, int cf) {
p += cf;
- rand = getRandomNumber(1, 100);
+ rand = g_vm->getRandomNumber(1, 100);
}
/**
@@ -522,7 +510,7 @@ void resetVariables() {
g_s._secretPassageObjectId = 0;
g_s._purpleRoomObjectId = 136;
g_s._cryptObjectId = 141;
- g_s._faithScore = getRandomNumber(4, 10);
+ g_s._faithScore = g_vm->getRandomNumber(4, 10);
g_s._currPlace = MANOR_FRONT;
for (int i = 2; i <= 6; ++i)
@@ -591,7 +579,7 @@ int t11(int roomId) {
else if (roomId == CHAPEL)
p = g_vm->getPresenceStatsChapel(h);
p += g_s._faithScore;
- rand = getRandomNumber(1, 100);
+ rand = g_vm->getRandomNumber(1, 100);
if (rand > p) {
g_vm->displayAloneText();
retVal = 0;
@@ -621,7 +609,7 @@ void cavegre() {
g_vm->clearScreenType3();
g_vm->prepareScreenType2();
ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS));
- int rand = (getRandomNumber(0, 4)) - 2;
+ int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(2, rand, 1);
// The original was doing here a useless loop.
@@ -827,11 +815,11 @@ void tinke() {
if (!g_vm->_brt) {
g_vm->_brt = true;
g_hdb = readclock();
- if (getRandomNumber(1, 5) < 5) {
+ if (g_vm->getRandomNumber(1, 5) < 5) {
g_vm->clearScreenType3();
g_vm->prepareScreenType2();
ecr3(g_vm->getEngineString(S_HEAR_NOISE));
- int rand = (getRandomNumber(0, 4)) - 2;
+ int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(1, rand, 1);
g_vm->clearScreenType3();
}
@@ -1067,13 +1055,13 @@ L1:
g_vm->_syn = true;
g_vm->_col = true;
} else {
- if (getRandomNumber(1, 3) == 2) {
+ if (g_vm->getRandomNumber(1, 3) == 2) {
g_vm->_hiddenHero = false;
g_crep = 137;
goto L1;
} else {
repon(2, 136);
- int rand = (getRandomNumber(0, 4)) - 2;
+ int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(3, rand, 1);
g_vm->clearScreenType2();
g_vm->displayAloneText();
@@ -1287,8 +1275,14 @@ void st13(int ob) {
g_crep = 105;
}
-void aldepl() {
- Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1);
+void sauvecr(int y, int dy) {
+// g_vm->_mouse.hideMouse();
+// g_vm->_mouse.showMouse();
+}
+
+void charecr(int y, int dy) {
+// g_vm->_mouse.hideMouse();
+// g_vm->_mouse.showMouse();
}
} // End of namespace Mortevielle
diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h
index 0cd467c177..d3defc1b04 100644
--- a/engines/mortevielle/mor.h
+++ b/engines/mortevielle/mor.h
@@ -114,7 +114,6 @@ extern void rechai(int &ch);
extern int t23coul();
extern void maivid();
extern void st13(int ob);
-extern void aldepl();
} // End of namespace Mortevielle
#endif
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 4a8961f536..9b7ade1967 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -339,8 +339,8 @@ bool MortevielleEngine::handleEvents() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_MOUSEMOVE:
_mousePos = Common::Point(event.mouse.x, event.mouse.y / 2);
- g_vm->_mouse._pos.x = event.mouse.x;
- g_vm->_mouse._pos.y = event.mouse.y / 2;
+ _mouse._pos.x = event.mouse.x;
+ _mouse._pos.y = event.mouse.y / 2;
if (event.type == Common::EVENT_LBUTTONDOWN)
_mouseClick = true;
@@ -550,7 +550,7 @@ void MortevielleEngine::mainGame() {
initGame();
hirs();
drawRightFrame();
- g_vm->_mouse.showMouse();
+ _mouse.showMouse();
// Loop to play the game
do {
@@ -603,7 +603,7 @@ void MortevielleEngine::handleAction() {
do {
_menu.mdn();
tinke();
- g_vm->_mouse.moveMouse(funct, inkey);
+ _mouse.moveMouse(funct, inkey);
CHECK_QUIT;
temps = temps + 1;
} while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone)));
@@ -652,7 +652,7 @@ void MortevielleEngine::handleAction() {
g_mnumo = g_msg[4];
if (!_anyone) {
if ((_heroSearching) || (_obpart)) {
- if (g_vm->_mouse._pos.y < 12)
+ if (_mouse._pos.y < 12)
return;
if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) {
@@ -1989,7 +1989,7 @@ void MortevielleEngine::handleOpcode() {
void MortevielleEngine::hourToChar() {
int day, hour, minute;
- g_vm->updateHour(day, hour, minute);
+ updateHour(day, hour, minute);
if (minute == 30)
minute = 1;
hour += day * 24;
@@ -2004,14 +2004,14 @@ void MortevielleEngine::hourToChar() {
void MortevielleEngine::charToHour() {
int fullHour = ord(g_s._fullHour);
int tmpHour = fullHour % 48;
- g_vm->_currDay = fullHour / 48;
- g_vm->_currHalfHour = tmpHour % 2;
- g_vm->_currHour = tmpHour / 2;
- g_vm->_hour = g_vm->_currHour;
- if (g_vm->_currHalfHour == 1)
- g_vm->_minute = 30;
+ _currDay = fullHour / 48;
+ _currHalfHour = tmpHour % 2;
+ _currHour = tmpHour / 2;
+ _hour = _currHour;
+ if (_currHalfHour == 1)
+ _minute = 30;
else
- g_vm->_minute = 0;
+ _minute = 0;
}
/**
@@ -2019,9 +2019,9 @@ void MortevielleEngine::charToHour() {
* @remarks Originally called 'clsf1'
*/
void MortevielleEngine::clearScreenType1() {
- g_vm->_mouse.hideMouse();
- g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175));
- g_vm->_mouse.showMouse();
+ _mouse.hideMouse();
+ _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175));
+ _mouse.showMouse();
}
/**
@@ -2029,16 +2029,16 @@ void MortevielleEngine::clearScreenType1() {
* @remarks Originally called 'clsf2'
*/
void MortevielleEngine::clearScreenType2() {
- g_vm->_mouse.hideMouse();
- if (g_vm->_largestClearScreen) {
- g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199));
- g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15);
- g_vm->_largestClearScreen = false;
+ _mouse.hideMouse();
+ if (_largestClearScreen) {
+ _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199));
+ _screenSurface.drawBox(0, 175, 634, 24, 15);
+ _largestClearScreen = false;
} else {
- g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190));
- g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15);
+ _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190));
+ _screenSurface.drawBox(0, 175, 634, 15, 15);
}
- g_vm->_mouse.showMouse();
+ _mouse.showMouse();
}
/**
@@ -2046,10 +2046,10 @@ void MortevielleEngine::clearScreenType2() {
* @remarks Originally called 'clsf3'
*/
void MortevielleEngine::clearScreenType3() {
- g_vm->_mouse.hideMouse();
- g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199));
- g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15);
- g_vm->_mouse.showMouse();
+ _mouse.hideMouse();
+ _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199));
+ _screenSurface.drawBox(0, 191, 634, 8, 15);
+ _mouse.showMouse();
}
/**
@@ -2060,7 +2060,7 @@ void MortevielleEngine::clearScreenType10() {
int co, cod;
Common::String st;
- g_vm->_mouse.hideMouse();
+ _mouse.hideMouse();
if (g_res == 1) {
co = 634;
cod = 534;
@@ -2068,21 +2068,37 @@ void MortevielleEngine::clearScreenType10() {
co = 600;
cod = 544;
}
- g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98));
+ _screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98));
if (g_s._faithScore < 33)
- st = g_vm->getEngineString(S_COOL);
+ st = getEngineString(S_COOL);
else if (g_s._faithScore < 66)
- st = g_vm->getEngineString(S_LOURDE);
+ st = getEngineString(S_LOURDE);
else if (g_s._faithScore > 65)
- st = g_vm->getEngineString(S_MALSAINE);
+ st = getEngineString(S_MALSAINE);
- co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2);
- g_vm->_screenSurface.putxy(co, 92);
- g_vm->_screenSurface.drawString(st, 4);
+ co = 580 - (_screenSurface.getStringWidth(st) / 2);
+ _screenSurface.putxy(co, 92);
+ _screenSurface.drawString(st, 4);
- g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86));
+ _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86));
/* rempli(69,12,32,5,255);*/
- g_vm->_mouse.showMouse();
+ _mouse.showMouse();
+}
+
+/**
+ * Engine function - Get a random number between two values
+ * @remarks Originally called 'get_random_number' and 'hazard'
+ */
+int MortevielleEngine::getRandomNumber(int minval, int maxval) {
+ return _randomSource.getRandomNumber(maxval - minval) + minval;
+}
+
+/**
+ * Engine function - Show alert "use move menu"
+ * @remarks Originally called 'aldepl'
+ */
+void MortevielleEngine::showMoveMenuAlert() {
+ Alert::show(getEngineString(S_USE_DEP_MENU), 1);
}
} // End of namespace Mortevielle
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index e6df67024e..c2fd857536 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -154,6 +154,7 @@ public:
int _day;
int _hour;
int _minute;
+ float _addfix;
int _c_zzz;
@@ -299,6 +300,8 @@ public:
void clearScreenType2();
void clearScreenType3();
void clearScreenType10();
+ int getRandomNumber(int minval, int maxval);
+ void showMoveMenuAlert();
};
diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp
index 1947e3d860..a941f79aa1 100644
--- a/engines/mortevielle/outtext.cpp
+++ b/engines/mortevielle/outtext.cpp
@@ -136,7 +136,7 @@ Common::String deline(int num) {
} else if (!g_vm->_txxFileFl) {
wrkStr = g_vm->getGameString(num);
} else {
- int i = g_t_rec[num]._indis;
+ int i = g_t_rec[num]._hintId;
byte k = g_t_rec[num]._point;
int length = 0;
bool endFl = false;
diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp
index 2f86437b3f..0a93a84516 100644
--- a/engines/mortevielle/ovd1.cpp
+++ b/engines/mortevielle/ovd1.cpp
@@ -119,7 +119,7 @@ void chartex() {
g_vm->_txxFileFl = true;
for (int i = 0; i < (ntpFile.size() / 3); ++i) {
- g_t_rec[i]._indis = ntpFile.readSint16LE();
+ g_t_rec[i]._hintId = ntpFile.readSint16LE();
g_t_rec[i]._point = ntpFile.readByte();
}
@@ -151,7 +151,7 @@ void music() {
fic.close();
g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623);
- g_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
+ g_vm->_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
g_vm->_speechManager.cctable(g_tbi);
bool fin = false;
diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp
index bd589057c3..ba7ef62195 100644
--- a/engines/mortevielle/speech.cpp
+++ b/engines/mortevielle/speech.cpp
@@ -41,15 +41,15 @@ SpeechManager::SpeechManager() {
}
void SpeechManager::spfrac(int wor) {
- g_c3._rep = (uint)wor >> 12;
- if ((_typlec == 0) && (g_c3._code != 9))
- if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) ||
- ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) {
- ++g_c3._rep;
+ _queue[2]._rep = (uint)wor >> 12;
+ if ((_typlec == 0) && (_queue[2]._code != 9))
+ if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) ||
+ ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) {
+ ++_queue[2]._rep;
}
- g_c3._freq = ((uint)wor >> 6) & 7;
- g_c3._acc = ((uint)wor >> 9) & 7;
+ _queue[2]._freq = ((uint)wor >> 6) & 7;
+ _queue[2]._acc = ((uint)wor >> 9) & 7;
}
void SpeechManager::charg_car(int &currWordNumb) {
@@ -57,31 +57,31 @@ void SpeechManager::charg_car(int &currWordNumb) {
int int_ = wor & 0x3f; // 63
if ((int_ >= 0) && (int_ <= 13)) {
- g_c3._val = int_;
- g_c3._code = 5;
+ _queue[2]._val = int_;
+ _queue[2]._code = 5;
} else if ((int_ >= 14) && (int_ <= 21)) {
- g_c3._val = int_;
- g_c3._code = 6;
+ _queue[2]._val = int_;
+ _queue[2]._code = 6;
} else if ((int_ >= 22) && (int_ <= 47)) {
int_ = int_ - 22;
- g_c3._val = int_;
- g_c3._code = g_typcon[int_];
+ _queue[2]._val = int_;
+ _queue[2]._code = g_typcon[int_];
} else if ((int_ >= 48) && (int_ <= 56)) {
- g_c3._val = int_ - 22;
- g_c3._code = 4;
+ _queue[2]._val = int_ - 22;
+ _queue[2]._code = 4;
} else {
switch (int_) {
case 60:
- g_c3._val = 32; /* " " */
- g_c3._code = 9;
+ _queue[2]._val = 32; /* " " */
+ _queue[2]._code = 9;
break;
case 61:
- g_c3._val = 46; /* "." */
- g_c3._code = 9;
+ _queue[2]._val = 46; /* "." */
+ _queue[2]._code = 9;
break;
case 62:
- g_c3._val = 35; /* "#" */
- g_c3._code = 9;
+ _queue[2]._val = 35; /* "#" */
+ _queue[2]._code = 9;
default:
break;
}
@@ -106,7 +106,7 @@ void SpeechManager::cctable(tablint &t) {
tb[0] = 0;
for (int k = 0; k <= 255; ++k) {
- tb[k + 1] = g_addfix + tb[k];
+ tb[k + 1] = g_vm->_addfix + tb[k];
t[255 - k] = abs((int)tb[k] + 1);
}
}
@@ -176,40 +176,40 @@ void SpeechManager::trait_car() {
byte d3;
int d2, i;
- switch (g_c2._code) {
+ switch (_queue[1]._code) {
case 9:
- if (g_c2._val != ord('#'))
- for (i = 0; i <= g_c2._rep; ++i)
- entroct(g_c2._val);
+ if (_queue[1]._val != ord('#'))
+ for (i = 0; i <= _queue[1]._rep; ++i)
+ entroct(_queue[1]._val);
break;
case 5:
case 6:
- if (g_c2._code == 6)
- d3 = g_tabdph[(g_c2._val - 14) << 1];
+ if (_queue[1]._code == 6)
+ d3 = g_tabdph[(_queue[1]._val - 14) << 1];
else
d3 = kNullValue;
- if (g_c1._code >= 5) {
- veracf(g_c2._acc);
- if (g_c1._code == 9) {
+ if (_queue[0]._code >= 5) {
+ veracf(_queue[1]._acc);
+ if (_queue[0]._code == 9) {
entroct(4);
if (d3 == kNullValue)
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
else
entroct(d3);
entroct(22);
}
}
- switch (g_c2._rep) {
+ switch (_queue[1]._rep) {
case 0:
entroct(0);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
if (d3 == kNullValue)
- if (g_c3._code == 9)
+ if (_queue[2]._code == 9)
entroct(2);
else
entroct(4);
- else if (g_c3._code == 9)
+ else if (_queue[2]._code == 9)
entroct(0);
else
entroct(1);
@@ -217,13 +217,13 @@ void SpeechManager::trait_car() {
case 4:
case 5:
case 6:
- if (g_c2._rep != 4) {
- i = g_c2._rep - 5;
+ if (_queue[1]._rep != 4) {
+ i = _queue[1]._rep - 5;
do {
--i;
entroct(0);
if (d3 == kNullValue)
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
else
entroct(d3);
entroct(3);
@@ -231,24 +231,24 @@ void SpeechManager::trait_car() {
}
if (d3 == kNullValue) {
entroct(4);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(0);
} else {
entroct(0);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(3);
}
break;
case 7:
case 8:
case 9:
- if (g_c2._rep != 7) {
- i = g_c2._rep - 8;
+ if (_queue[1]._rep != 7) {
+ i = _queue[1]._rep - 8;
do {
--i;
entroct(0);
if (d3 == kNullValue)
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
else
entroct(d3);
entroct(3);
@@ -256,32 +256,32 @@ void SpeechManager::trait_car() {
}
if (d3 == kNullValue) {
entroct(0);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(2);
} else {
entroct(0);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(0);
}
break;
case 1:
case 2:
case 3:
- if (g_c2._rep != 1) {
- i = g_c2._rep - 2;
+ if (_queue[1]._rep != 1) {
+ i = _queue[1]._rep - 2;
do {
--i;
entroct(0);
if (d3 == kNullValue)
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
else
entroct(d3);
entroct(3);
} while (i >= 0);
}
entroct(0);
- entroct(g_c2._val);
- if (g_c3._code == 9)
+ entroct(_queue[1]._val);
+ if (_queue[2]._code == 9)
entroct(0);
else
entroct(1);
@@ -293,16 +293,16 @@ void SpeechManager::trait_car() {
case 2:
case 3:
- d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel
- if (g_c1._code > 4) {
- veracf(g_c2._acc);
- if (g_c1._code == 9) {
+ d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel
+ if (_queue[0]._code > 4) {
+ veracf(_queue[1]._acc);
+ if (_queue[0]._code == 9) {
entroct(4);
entroct(d3);
entroct(22);
}
}
- i = g_c2._rep;
+ i = _queue[1]._rep;
assert(i >= 0);
if (i != 0) {
do {
@@ -312,24 +312,24 @@ void SpeechManager::trait_car() {
entroct(3);
} while (i > 0);
}
- veracf(g_c3._acc);
- if (g_c3._code == 6) {
+ veracf(_queue[2]._acc);
+ if (_queue[2]._code == 6) {
entroct(4);
- entroct(g_tabdph[(g_c3._val - 14) << 1]);
- entroct(g_c2._val);
+ entroct(g_tabdph[(_queue[2]._val - 14) << 1]);
+ entroct(_queue[1]._val);
} else {
entroct(4);
- if (g_c3._val == 4)
+ if (_queue[2]._val == 4)
entroct(3);
else
- entroct(g_c3._val);
- entroct(g_c2._val);
+ entroct(_queue[2]._val);
+ entroct(_queue[1]._val);
}
break;
case 0:
case 1:
- veracf(g_c2._acc);
- switch (g_c3._code) {
+ veracf(_queue[1]._acc);
+ switch (_queue[2]._code) {
case 2:
d2 = 7;
break;
@@ -337,66 +337,66 @@ void SpeechManager::trait_car() {
d2 = 8;
break;
case 6:
- d2 = g_tabdph[(g_c3._val - 14) << 1];
+ d2 = g_tabdph[(_queue[2]._val - 14) << 1];
break;
case 5:
- d2 = g_c3._val;
+ d2 = _queue[2]._val;
break;
default:
d2 = 10;
break;
} // switch c3._code
- d2 = (d2 * 26) + g_c2._val;
+ d2 = (d2 * 26) + _queue[1]._val;
if (g_tnocon[d2] == 0)
d3 = 2;
else
d3 = 6;
- if (g_c2._rep >= 5) {
- g_c2._rep = g_c2._rep - 5;
+ if (_queue[1]._rep >= 5) {
+ _queue[1]._rep -= 5;
d3 = 8 - d3; // Swap 2 and 6
}
- if (g_c2._code == 0) {
- i = g_c2._rep;
+ if (_queue[1]._code == 0) {
+ i = _queue[1]._rep;
if (i != 0) {
do {
--i;
entroct(d3);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(3);
} while (i > 0);
}
entroct(d3);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(4);
} else {
entroct(d3);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(3);
- i = g_c2._rep;
+ i = _queue[1]._rep;
if (i != 0) {
do {
--i;
entroct(d3);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(4);
} while (i > 0);
}
}
- if (g_c3._code == 9) {
+ if (_queue[2]._code == 9) {
entroct(d3);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(5);
- } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) {
- veracf(g_c3._acc);
- switch (g_c3._code) {
+ } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) {
+ veracf(_queue[2]._acc);
+ switch (_queue[2]._code) {
case 3:
d2 = 8;
break;
case 6:
- d2 = g_tabdph[(g_c3._val - 14) << 1];
+ d2 = g_tabdph[(_queue[2]._val - 14) << 1];
break;
case 5:
- d2 = g_c3._val;
+ d2 = _queue[2]._val;
break;
default:
d2 = 7;
@@ -405,47 +405,47 @@ void SpeechManager::trait_car() {
if (d2 == 4)
d2 = 3;
- if (g_intcon[g_c2._val] != 0)
- ++g_c2._val;
+ if (g_intcon[_queue[1]._val] != 0)
+ ++_queue[1]._val;
- if ((g_c2._val == 17) || (g_c2._val == 18))
- g_c2._val = 16;
+ if ((_queue[1]._val == 17) || (_queue[1]._val == 18))
+ _queue[1]._val = 16;
entroct(4);
entroct(d2);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
}
break;
case 4:
- veracf(g_c2._acc);
- i = g_c2._rep;
+ veracf(_queue[1]._acc);
+ i = _queue[1]._rep;
if (i != 0) {
do {
--i;
entroct(2);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(3);
} while (i > 0);
}
entroct(2);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(4);
- if (g_c3._code == 9) {
+ if (_queue[2]._code == 9) {
entroct(2);
- entroct(g_c2._val);
+ entroct(_queue[1]._val);
entroct(5);
- } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) {
- veracf(g_c3._acc);
- switch (g_c3._code) {
+ } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) {
+ veracf(_queue[2]._acc);
+ switch (_queue[2]._code) {
case 3:
d2 = 8;
break;
case 6:
- d2 = g_tabdph[(g_c3._val - 14) << 1];
+ d2 = g_tabdph[(_queue[2]._val - 14) << 1];
break;
case 5:
- d2 = g_c3._val;
+ d2 = _queue[2]._val;
break;
default:
d2 = 7;
@@ -455,12 +455,12 @@ void SpeechManager::trait_car() {
if (d2 == 4)
d2 = 3;
- if (g_intcon[g_c2._val] != 0)
- ++g_c2._val;
+ if (g_intcon[_queue[1]._val] != 0)
+ ++_queue[1]._val;
entroct(4);
entroct(d2);
- entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]);
+ entroct(g_tabdbc[((_queue[1]._val - 26) << 1) + 1]);
}
break;
@@ -474,10 +474,10 @@ void SpeechManager::trait_car() {
* @remarks Originally called 'rot_chariot'
*/
void SpeechManager::moveQueue() {
- g_c1 = g_c2;
- g_c2 = g_c3;
- g_c3._val = 32;
- g_c3._code = 9;
+ _queue[0] = _queue[1];
+ _queue[1] = _queue[2];
+ _queue[2]._val = 32;
+ _queue[2]._code = 9;
}
/**
@@ -485,9 +485,9 @@ void SpeechManager::moveQueue() {
* @remarks Originally called 'init_chariot'
*/
void SpeechManager::initQueue() {
- g_c3._rep = 0;
- g_c3._freq = 0;
- g_c3._acc = 0;
+ _queue[2]._rep = 0;
+ _queue[2]._freq = 0;
+ _queue[2]._acc = 0;
moveQueue();
moveQueue();
}
@@ -542,7 +542,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) {
tempo = kTempoF;
else
tempo = kTempoM;
- g_addfix = (float)((tempo - g_addv[0])) / 256;
+ g_vm->_addfix = (float)((tempo - g_addv[0])) / 256;
cctable(g_tbi);
switch (typ) {
case 1:
diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h
index a0bdf8a4dd..eabffb9bba 100644
--- a/engines/mortevielle/speech.h
+++ b/engines/mortevielle/speech.h
@@ -60,6 +60,8 @@ class SpeechManager {
private:
int _typlec;
int _phonemeNumb;
+ SpeechQueue _queue[3];
+
public:
SpeechManager();
void spfrac(int wor);
diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp
index f4a5d12955..392e8a21c4 100644
--- a/engines/mortevielle/var_mor.cpp
+++ b/engines/mortevielle/var_mor.cpp
@@ -58,18 +58,6 @@ const byte g_tnocon[364] = {
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-
-const byte g_menuConstants[8][4] = {
- { 7, 37, 22, 8},
- {19, 33, 23, 7},
- {31, 89, 10, 21},
- {43, 25, 11, 5},
- {55, 37, 5, 8},
- {64, 13, 11, 2},
- {62, 22, 13, 4},
- {62, 25, 13, 5}
-};
-
const byte g_addv[2] = {8, 8};
const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0};
@@ -119,18 +107,16 @@ int g_nbrep[9];
int g_nbrepm[9];
int g_msg[5];
byte g_touv[8];
-sav_chaine g_s, g_s1;
+SaveStruct g_s, g_s1;
byte g_bufcha[391];
byte g_lettres[7][24];
uint16 g_t_mot[maxti + 1];
int g_tay_tchar;
-ind g_t_rec[maxtd + 1];
+Hint g_t_rec[maxtd + 1];
int g_l[108];
int g_tbi[256];
-chariot g_c1, g_c2, g_c3;
-float g_addfix;
Common::Point g_tabpal[91][17];
t_pcga g_palcga[91];
pattern g_tpt[15];
@@ -174,36 +160,10 @@ Common::String copy(const Common::String &s, int idx, size_t size) {
int g_port[0xfff];
byte g_mem[65536 * 16];
-/**
- * Engine function - Get a random number between two values
- * @remarks Originally called 'get_random_number' and 'hazard'
- */
-int getRandomNumber(int minval, int maxval) {
- return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval;
-}
-
-/**
- * Restore a screen sectio
- */
-void s_sauv(int Gd, int y, int dy) {
- // Note: May no longer be necessary, since the backgorund restore code
- // is being handled slightly differently now in the menuUp() method
-}
-
void palette(int v1) {
warning("TODO: palette");
}
-/**
- * Restore a screen area
- * @remarks Currently implemented differently in ScummVM, so this method is redundant.
- * Original assembly was present in 'charecr.asm'
- */
-void s_char(int Gd, int y, int dy) {
- debugC(1, kMortevielleCore, "s_char called");
-}
-
-// (* external 'c:\mc\reusint.com'; *)
void musyc(tablint &tb, int nbseg, int att) {
warning("TODO: musyc");
}
diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h
index d71c0d7668..a91e6d921b 100644
--- a/engines/mortevielle/var_mor.h
+++ b/engines/mortevielle/var_mor.h
@@ -76,7 +76,7 @@ const int kMenuActionStringIndex = 476;
const int kMenuSelfStringIndex = 497;
const int kMenuSayStringIndex = 502;
const int kSecretPassageQuestionStringIndex = 510; // Unusued?
-
+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,
@@ -86,31 +86,12 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303,
OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404,
OPCODE_SLOOK = 0x405};
-const int kMaxPatt = 20;
-
-extern const byte g_tabdbc[18];
-extern const byte g_tabdph[16];
-extern const byte g_typcon[26];
-extern const byte g_intcon[26];
-extern const byte g_tnocon[364];
-
-extern const byte g_menuConstants[8][4];
-
-extern const byte g_addv[2];
-
-extern const byte g_rang[16];
-
-/*---------------------------------------------------------------------------*/
-/*-------------------------------- TYPES --------------------------------*/
-/*---------------------------------------------------------------------------*/
-
/*
9 "A glance at the forbidden$",
18 "It's already open$",
26 "A photograph$",
27 "The coat of arms$",
*/
-
enum places {
OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4,
BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9,
@@ -120,28 +101,43 @@ enum places {
DOOR = 25, ROOM26 = 26, ROOM27 = 27
};
-struct sav_chaine {
+extern const byte g_tabdbc[18];
+extern const byte g_tabdph[16];
+extern const byte g_typcon[26];
+extern const byte g_intcon[26];
+extern const byte g_tnocon[364];
+extern const byte g_addv[2];
+extern const byte g_rang[16];
+
+struct Hint {
+ int _hintId;
+ byte _point;
+};
+
+struct SaveStruct {
int _faithScore;
byte _pourc[11];
byte _teauto[43];
byte _sjer[31];
- int _currPlace, _atticBallHoleObjectId, _atticRodHoleObjectId, _cellarObjectId, _secretPassageObjectId, _wellObjectId;
- int _selectedObjectId, _purpleRoomObjectId, _cryptObjectId;
+ int _currPlace;
+ int _atticBallHoleObjectId;
+ int _atticRodHoleObjectId;
+ int _cellarObjectId;
+ int _secretPassageObjectId;
+ int _wellObjectId;
+ int _selectedObjectId;
+ int _purpleRoomObjectId;
+ int _cryptObjectId;
bool _alreadyEnteredManor;
byte _fullHour;
};
-struct ind {
- int _indis;
- byte _point;
-};
-
-struct chariot {
- int _val,
- _code,
- _acc,
- _freq,
- _rep;
+struct SpeechQueue {
+ int _val;
+ int _code;
+ int _acc;
+ int _freq;
+ int _rep;
};
struct rectangle {
@@ -221,18 +217,16 @@ extern int g_nbrep[9];
extern int g_nbrepm[9];
extern int g_msg[5];
extern byte g_touv[8];
-extern sav_chaine g_s, g_s1;
+extern SaveStruct g_s, g_s1;
extern byte g_bufcha[391];
extern byte g_lettres[7][24];
extern uint16 g_t_mot[maxti + 1];
extern int g_tay_tchar;
-extern ind g_t_rec[maxtd + 1];
+extern Hint g_t_rec[maxtd + 1];
extern int g_l[108];
extern int g_tbi[256];
-extern chariot g_c1, g_c2, g_c3;
-extern float g_addfix;
extern Common::Point g_tabpal[91][17];
extern t_pcga g_palcga[91];
extern pattern g_tpt[15];
@@ -258,10 +252,6 @@ extern byte g_mem[65536 * 16];
#define hires {}
extern void palette(int v1);
-extern int getRandomNumber(int minval, int maxval);
-
-extern void s_char(int Gd, int y, int dy);
-extern void s_sauv(int Gd, int y, int dy);
} // End of namespace Mortevielle