MORTEVIELLE: More renaming

This commit is contained in:
Strangerke 2012-03-23 00:35:19 +01:00
parent 1a9183e0ba
commit 09e8c82e8f
14 changed files with 208 additions and 232 deletions

View File

@ -42,13 +42,13 @@ namespace Mortevielle {
* @remarks Originally called 'taller'
*/
void MortevielleEngine::fctMove() {
if ((_coreVar._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) {
if ((_coreVar._currPlace == ROOM26) && (_msg[4] == _menu._moveMenu[6])) {
_coreVar._currPlace = LANDING;
g_caff = _coreVar._currPlace;
afdes();
repon(2, _coreVar._currPlace);
}
if ((_coreVar._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) {
if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) {
if (!_syn)
ecr3(getEngineString(S_GO_TO));
tfleche();
@ -89,7 +89,7 @@ void MortevielleEngine::fctMove() {
tsort();
int menuChoice = 1;
while (_menu._moveMenu[menuChoice] != g_msg[4])
while (_menu._moveMenu[menuChoice] != _msg[4])
++menuChoice;
if (_coreVar._currPlace == MOUNTAIN) {
@ -209,7 +209,7 @@ void MortevielleEngine::fctTake() {
_obpart = false;
affrep();
} else {
g_tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0;
_tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0;
tsuiv();
++g_dobj;
if (g_dobj > 6) {
@ -307,7 +307,7 @@ void MortevielleEngine::fctInventoryTake() {
cx = 0;
do {
++cx;
} while (_menu._inventoryMenu[cx] != g_msg[4]);
} while (_menu._inventoryMenu[cx] != _msg[4]);
cz = 0;
cy = 0;
do {
@ -352,7 +352,7 @@ void MortevielleEngine::fctLift() {
tmpPlace = 14;
else if (_coreVar._currPlace == MOUNTAIN)
tmpPlace = 15;
g_crep = g_tabdon[asoul + (tmpPlace << 3) + (g_num - 1)];
g_crep = _tabdon[asoul + (tmpPlace << 3) + (g_num - 1)];
if (g_crep == 255)
g_crep = 997;
}
@ -446,7 +446,7 @@ void MortevielleEngine::fctLook() {
cx -= 4;
if (_coreVar._currPlace == ROOM26)
cx = 21;
g_crep = g_tabdon[arega + (cx * 7) + g_num - 1];
g_crep = _tabdon[arega + (cx * 7) + g_num - 1];
if ((_coreVar._currPlace == ATTIC) && (g_num == 8))
g_crep = 126;
if (_coreVar._currPlace == MOUNTAIN)
@ -508,8 +508,8 @@ void MortevielleEngine::fctSearch() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (g_num != ord(g_touv[cx])));
if (g_num != ord(g_touv[cx]))
} while ((cx <= 6) && (g_num != ord(_touv[cx])));
if (g_num != ord(_touv[cx]))
g_crep = 187;
else {
if (_currBitIndex > 0)
@ -590,7 +590,7 @@ void MortevielleEngine::fctOpen() {
if (g_caff == ROOM26) {
if (g_ment != 0) {
g_msg[4] = OPCODE_ENTER;
_msg[4] = OPCODE_ENTER;
_syn = true;
} else
g_crep = 997;
@ -614,8 +614,8 @@ void MortevielleEngine::fctOpen() {
int tmpPlace = 0;
do {
++tmpPlace;
} while (!((tmpPlace > 6) || (ord(g_touv[tmpPlace]) == 0) || (ord(g_touv[tmpPlace]) == g_num)));
if (ord(g_touv[tmpPlace]) != g_num) {
} while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == g_num)));
if (ord(_touv[tmpPlace]) != g_num) {
if (!( ((g_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM)))
|| ((g_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM)))
|| ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 5))
@ -628,13 +628,13 @@ void MortevielleEngine::fctOpen() {
if (getRandomNumber(1, 4) == 3)
_speechManager.startSpeech(7, 9, 1);
}
g_touv[tmpPlace] = chr(g_num);
_touv[tmpPlace] = chr(g_num);
aniof(1, g_num);
}
tmpPlace = _coreVar._currPlace;
if (_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
g_crep = g_tabdon[aouvr + (tmpPlace * 7) + g_num - 1];
g_crep = _tabdon[aouvr + (tmpPlace * 7) + g_num - 1];
if (g_crep == 254)
g_crep = 999;
} else
@ -699,7 +699,7 @@ void MortevielleEngine::fctPlace() {
// Do you want to enter the hidden passage?
int answer = Alert::show(getEngineString(S_YES_NO), 1);
if (answer == 1) {
Common::String alertTxt = g_vm->getString(582);
Common::String alertTxt = getString(582);
Alert::show(alertTxt, 1);
bool enterPassageFl = KnowledgeCheck::show();
@ -726,7 +726,7 @@ void MortevielleEngine::fctPlace() {
dessin(0);
aniof(1, 2);
aniof(1, 1);
alertTxt = g_vm->getString(577);
alertTxt = getString(577);
Alert::show(alertTxt, 1);
aniof(2, 1);
g_crep = 166;
@ -881,11 +881,11 @@ void MortevielleEngine::fctClose() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (g_num != ord(g_touv[cx])));
if (g_num == ord(g_touv[cx])) {
} while ((cx <= 6) && (g_num != ord(_touv[cx])));
if (g_num == ord(_touv[cx])) {
aniof(2, g_num);
g_crep = 998;
g_touv[cx] = chr(0);
_touv[cx] = chr(0);
--g_iouv;
if (g_iouv < 0)
g_iouv = 0;
@ -981,8 +981,8 @@ void MortevielleEngine::fctSelfPut() {
int cx = 0;
do {
++cx;
} while ((cx <= 6) && (g_num != ord(g_touv[cx])));
if (g_num != ord(g_touv[cx]))
} while ((cx <= 6) && (g_num != ord(_touv[cx])));
if (g_num != ord(_touv[cx]))
g_crep = 187;
else {
g_mchai = chai;
@ -1153,8 +1153,8 @@ void MortevielleEngine::fctEnter() {
g_x = convertBitIndexToCharacterIndex(z);
++_coreVar._faithScore;
_coreVar._currPlace = LANDING;
g_msg[3] = MENU_DISCUSS;
g_msg[4] = _menu._discussMenu[g_x];
_msg[3] = MENU_DISCUSS;
_msg[4] = _menu._discussMenu[g_x];
_syn = true;
if (g_ment == 9) {
_col = true;
@ -1352,7 +1352,7 @@ void MortevielleEngine::fctDiscuss() {
cx = 0;
do {
++cx;
} while (_menu._discussMenu[cx] != g_msg[4]);
} while (_menu._discussMenu[cx] != _msg[4]);
g_caff = 69 + cx;
afdes();
repon(2, g_caff);
@ -1368,7 +1368,7 @@ void MortevielleEngine::fctDiscuss() {
for (int ix = 1; ix <= 46; ++ix)
te[ix] = false;
for (int ix = 1; ix <= 45; ++ix) {
lib[ix] = g_vm->getString(ix + kQuestionStringIndex);
lib[ix] = getString(ix + kQuestionStringIndex);
for (i = lib[ix].size(); i <= 40; ++i)
lib[ix] = lib[ix] + ' ';
}
@ -1477,10 +1477,10 @@ void MortevielleEngine::fctDiscuss() {
suj = 138;
_coreVar._faithScore += (3 * (_coreVar._faithScore / 10));
}
} else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) {
suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)];
_coreVar._faithScore += g_tabdon[arcf + ix];
++g_nbrep[g_caff - 69];
} else if (_nbrep[g_caff - 69] < _nbrepm[g_caff - 69]) {
suj = _tabdon[arep + (ix << 3) + (g_caff - 70)];
_coreVar._faithScore += _tabdon[arcf + ix];
++_nbrep[g_caff - 69];
} else {
_coreVar._faithScore += 3;
suj = 139;

View File

@ -217,7 +217,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li
col += 6;
}
++i;
choiceListStr = copy(inputStr, i, 30);
choiceListStr = g_vm->copy(inputStr, i, 30);
if (g_res == 2)
col *= 6;
else

View File

@ -46,7 +46,7 @@ int testou() {
break;
case '\26' :
if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) {
g_vm->decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
g_vm->decodeNumber(&g_vm->_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64);
++g_vm->_c_zzz;
return 61;

View File

@ -486,8 +486,8 @@ void Menu::mdn() {
// A menu was clicked on
_menuSelected = (_multiTitle) && (g_msg4 != OPCODE_NONE);
menuUp(g_msg3);
g_msg[4] = g_msg4;
g_msg[3] = g_msg3;
g_vm->_msg[4] = g_msg4;
g_vm->_msg[3] = g_msg3;
g_msg3 = OPCODE_NONE;
g_msg4 = OPCODE_NONE;
@ -542,8 +542,8 @@ void Menu::initMenu() {
}
g_msg3 = OPCODE_NONE;
g_msg4 = OPCODE_NONE;
g_msg[3] = OPCODE_NONE;
g_msg[4] = OPCODE_NONE;
g_vm->_msg[3] = OPCODE_NONE;
g_vm->_msg[4] = OPCODE_NONE;
g_vm->setMouseClick(false);
}

View File

@ -65,13 +65,13 @@ void adzon() {
if (!f.open("don.mor"))
error("Missing file - don.mor");
f.read(g_tabdon, 7 * 256);
f.read(g_vm->_tabdon, 7 * 256);
f.close();
if (!f.open("bmor.mor"))
error("Missing file - bmor.mor");
f.read(&g_tabdon[fleche], 1 * 1916);
f.read(&g_vm->_tabdon[fleche], 1 * 1916);
f.close();
if (!f.open("dec.mor"))
@ -152,7 +152,7 @@ void text1(int x, int y, int nb, int m) {
void initouv() {
for (int cx = 1; cx <= 7; ++cx)
g_touv[cx] = chr(0);
g_vm->_touv[cx] = chr(0);
}
void ecr2(Common::String str_) {
@ -164,18 +164,18 @@ void ecr2(Common::String str_) {
g_vm->_screenSurface.drawString(str_, 5);
else if ((int)str_.size() < (tlig << 1)) {
g_vm->_screenSurface.putxy(8, 176);
g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5);
g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5);
g_vm->_screenSurface.putxy(8, 182);
g_vm->_screenSurface.drawString(copy(str_, tlig, tlig << 1), 5);
g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, tlig << 1), 5);
} else {
g_vm->_largestClearScreen = true;
g_vm->clearScreenType2();
g_vm->_screenSurface.putxy(8, 176);
g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5);
g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5);
g_vm->_screenSurface.putxy(8, 182);
g_vm->_screenSurface.drawString(copy(str_, tlig, ((tlig << 1) - 1)), 5);
g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, ((tlig << 1) - 1)), 5);
g_vm->_screenSurface.putxy(8, 190);
g_vm->_screenSurface.drawString(copy(str_, tlig << 1, tlig * 3), 5);
g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig << 1, tlig * 3), 5);
}
}
@ -351,7 +351,7 @@ void init_nbrepm() {
const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 };
for (int idx = 0; idx < 9; ++idx)
g_nbrepm[idx] = ipm[idx];
g_vm->_nbrepm[idx] = ipm[idx];
}
void phaz(int &rand, int &p, int cf) {
@ -440,7 +440,7 @@ void writetp(Common::String s, int t) {
if (g_res == 2)
g_vm->_screenSurface.drawString(s, t);
else
g_vm->_screenSurface.drawString(copy(s, 1, 25), t);
g_vm->_screenSurface.drawString(g_vm->copy(s, 1, 25), t);
}
void aniof(int ouf, int num) {
@ -483,8 +483,8 @@ void dessin(int ad) {
g_vm->prepareScreenType1();
if ((g_caff < 30) || (g_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
if (ord(g_touv[cx]) != 0)
aniof(1, ord(g_touv[cx]));
if (ord(g_vm->_touv[cx]) != 0)
aniof(1, ord(g_vm->_touv[cx]));
}
if (g_caff == 13) {
@ -568,7 +568,7 @@ void tlu(int af, int ob) {
repon(2, 999);
tkey1(true);
g_caff = af;
g_msg[3] = OPCODE_NONE;
g_vm->_msg[3] = OPCODE_NONE;
g_crep = 998;
}
@ -587,7 +587,7 @@ void tsort() {
}
for (int cx = 1; cx <= 7; ++cx)
g_touv[cx] = chr(0);
g_vm->_touv[cx] = chr(0);
g_ment = 0;
g_iouv = 0;
g_mchai = 0;
@ -648,7 +648,7 @@ void modinv() {
}
void mennor() {
g_vm->_menu.menuUp(g_msg[3]);
g_vm->_menu.menuUp(g_vm->_msg[3]);
}
void premtet() {
@ -662,10 +662,10 @@ void ajchai() {
int cx = 0;
do {
++cx;
} while ((cx <= 9) && (g_tabdon[cy + cx] != 0));
} while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0));
if (g_tabdon[cy + cx] == 0)
g_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId;
if (g_vm->_tabdon[cy + cx] == 0)
g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId;
else
g_crep = 192;
}
@ -716,8 +716,8 @@ L1:
int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex);
g_caff = 69 + cx;
g_crep = g_caff;
g_msg[3] = MENU_DISCUSS;
g_msg[4] = g_vm->_menu._discussMenu[cx];
g_vm->_msg[3] = MENU_DISCUSS;
g_vm->_msg[4] = g_vm->_menu._discussMenu[cx];
g_vm->_syn = true;
g_vm->_col = true;
} else {
@ -749,7 +749,7 @@ void tsuiv() {
++cx;
++g_cs;
cl = cy + g_cs;
tbcl = g_tabdon[cl];
tbcl = g_vm->_tabdon[cl];
} while ((tbcl == 0) && (g_cs <= 9));
if ((tbcl != 0) && (g_cs < 11)) {
@ -811,12 +811,12 @@ void tcoord(int sx) {
int atdon = amzon + 3;
int cy = 0;
while (cy < g_caff) {
a += g_tabdon[atdon];
a += g_vm->_tabdon[atdon];
atdon += 4;
++cy;
}
if (g_tabdon[atdon] == 0) {
if (g_vm->_tabdon[atdon] == 0) {
g_crep = 997;
return;
}
@ -824,10 +824,10 @@ void tcoord(int sx) {
a += fleche;
int cb = 0;
for (cy = 0; cy <= (sx - 2); ++cy) {
ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)];
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
cb += (ib * 4) + 2;
}
ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)];
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
if (ib == 0) {
g_crep = 997;
return;
@ -836,11 +836,11 @@ void tcoord(int sx) {
cy = 1;
do {
cb += 2;
sx = g_tabdon[a + cb] * g_res;
sy = g_tabdon[(a + cb + 1)];
sx = g_vm->_tabdon[a + cb] * g_res;
sy = g_vm->_tabdon[(a + cb + 1)];
cb += 2;
ix = g_tabdon[a + cb] * g_res;
iy = g_tabdon[(a + cb + 1)];
ix = g_vm->_tabdon[a + cb] * g_res;
iy = g_vm->_tabdon[(a + cb + 1)];
++cy;
} while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib)));
@ -879,7 +879,7 @@ void treg(int ob) {
int mdes = g_caff;
g_caff = ob;
if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) {
if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) {
afdes();
if ((g_caff > 29) && (g_caff < 33))
repon(2, g_caff);
@ -887,7 +887,7 @@ void treg(int ob) {
repon(2, g_caff + 400);
tkey1(true);
g_caff = mdes;
g_msg[3] = 0;
g_vm->_msg[3] = 0;
g_crep = 998;
} else {
g_vm->_obpart = true;
@ -913,7 +913,7 @@ void rechai(int &ch) {
if (g_vm->_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1];
ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_num - 1];
}
int t23coul() {

View File

@ -200,7 +200,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
loadPalette();
loadCFIPH();
loadCFIEC();
decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64);
_c_zzz = 1;
init_nbrepm();
initMouse();
@ -564,7 +564,7 @@ void MortevielleEngine::mainGame() {
loadCFIEC();
for (g_crep = 1; g_crep <= _c_zzz; ++g_crep)
decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64);
loadBRUIT5();
_menu.initMenu();
@ -638,18 +638,18 @@ void MortevielleEngine::handleAction() {
changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1);
return;
}
if (_menu._menuSelected && (g_msg[3] == MENU_SAVE)) {
Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7);
_savegameManager.saveGame(g_msg[4] & 7, saveName);
if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) {
Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 7);
_savegameManager.saveGame(_msg[4] & 7, saveName);
}
if (_menu._menuSelected && (g_msg[3] == MENU_LOAD))
_savegameManager.loadGame((g_msg[4] & 7) - 1);
if (_menu._menuSelected && (_msg[3] == MENU_LOAD))
_savegameManager.loadGame((_msg[4] & 7) - 1);
if (inkey == '\103') { /* F9 */
temps = Alert::show(_hintPctMessage, 1);
return;
} else if (inkey == '\77') {
if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) {
g_msg[4] = g_mnumo;
if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) {
_msg[4] = _menuOpcode;
ecr3(getEngineString(S_IDEM));
} else
return;
@ -670,17 +670,17 @@ void MortevielleEngine::handleAction() {
if (g_num == 9999)
g_num = 0;
} else {
g_mnumo = g_msg[3];
if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))
g_mnumo = g_msg[4];
_menuOpcode = _msg[3];
if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))
_menuOpcode = _msg[4];
if (!_anyone) {
if ((_heroSearching) || (_obpart)) {
if (_mouse._pos.y < 12)
return;
if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) {
if ((_msg[4] == OPCODE_SOUND) || (_msg[4] == OPCODE_LIFT)) {
oo = true;
if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) {
if ((_msg[4] == OPCODE_LIFT) || (_obpart)) {
endSearch();
g_caff = _coreVar._currPlace;
g_crep = 998;
@ -1858,7 +1858,7 @@ void MortevielleEngine::gameLoaded() {
_hiddenHero = false;
_brt = false;
g_maff = 68;
g_mnumo = OPCODE_NONE;
_menuOpcode = OPCODE_NONE;
g_prebru = 0;
g_x = 0;
g_y = 0;
@ -1908,71 +1908,71 @@ void MortevielleEngine::handleOpcode() {
_keyPressedEsc = false;
if (!_anyone) {
if (_brt) {
if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) {
if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) {
g_ctrm = 4;
mennor();
return;
}
}
if (g_msg[3] == MENU_MOVE)
if (_msg[3] == MENU_MOVE)
fctMove();
if (g_msg[3] == MENU_DISCUSS)
if (_msg[3] == MENU_DISCUSS)
fctDiscuss();
if (g_msg[3] == MENU_INVENTORY)
if (_msg[3] == MENU_INVENTORY)
fctInventoryTake();
if (g_msg[4] == OPCODE_ATTACH)
if (_msg[4] == OPCODE_ATTACH)
fctAttach();
if (g_msg[4] == OPCODE_WAIT)
if (_msg[4] == OPCODE_WAIT)
fctWait();
if (g_msg[4] == OPCODE_FORCE)
if (_msg[4] == OPCODE_FORCE)
fctForce();
if (g_msg[4] == OPCODE_SLEEP)
if (_msg[4] == OPCODE_SLEEP)
fctSleep();
if (g_msg[4] == OPCODE_LISTEN)
if (_msg[4] == OPCODE_LISTEN)
fctListen();
if (g_msg[4] == OPCODE_ENTER)
if (_msg[4] == OPCODE_ENTER)
fctEnter();
if (g_msg[4] == OPCODE_CLOSE)
if (_msg[4] == OPCODE_CLOSE)
fctClose();
if (g_msg[4] == OPCODE_SEARCH)
if (_msg[4] == OPCODE_SEARCH)
fctSearch();
if (g_msg[4] == OPCODE_KNOCK)
if (_msg[4] == OPCODE_KNOCK)
fctKnock();
if (g_msg[4] == OPCODE_SCRATCH)
if (_msg[4] == OPCODE_SCRATCH)
fctScratch();
if (g_msg[4] == OPCODE_READ)
if (_msg[4] == OPCODE_READ)
fctRead();
if (g_msg[4] == OPCODE_EAT)
if (_msg[4] == OPCODE_EAT)
fctEat();
if (g_msg[4] == OPCODE_PLACE)
if (_msg[4] == OPCODE_PLACE)
fctPlace();
if (g_msg[4] == OPCODE_OPEN)
if (_msg[4] == OPCODE_OPEN)
fctOpen();
if (g_msg[4] == OPCODE_TAKE)
if (_msg[4] == OPCODE_TAKE)
fctTake();
if (g_msg[4] == OPCODE_LOOK)
if (_msg[4] == OPCODE_LOOK)
fctLook();
if (g_msg[4] == OPCODE_SMELL)
if (_msg[4] == OPCODE_SMELL)
fctSmell();
if (g_msg[4] == OPCODE_SOUND)
if (_msg[4] == OPCODE_SOUND)
fctSound();
if (g_msg[4] == OPCODE_LEAVE)
if (_msg[4] == OPCODE_LEAVE)
fctLeave();
if (g_msg[4] == OPCODE_LIFT)
if (_msg[4] == OPCODE_LIFT)
fctLift();
if (g_msg[4] == OPCODE_TURN)
if (_msg[4] == OPCODE_TURN)
fctTurn();
if (g_msg[4] == OPCODE_SSEARCH)
if (_msg[4] == OPCODE_SSEARCH)
fctSelfSearch();
if (g_msg[4] == OPCODE_SREAD)
if (_msg[4] == OPCODE_SREAD)
fctSelfRead();
if (g_msg[4] == OPCODE_SPUT)
if (_msg[4] == OPCODE_SPUT)
fctSelfPut();
if (g_msg[4] == OPCODE_SLOOK)
if (_msg[4] == OPCODE_SLOOK)
fctSelftLook();
_hiddenHero = false;
if (g_msg[4] == OPCODE_SHIDE)
if (_msg[4] == OPCODE_SHIDE)
fctSelfHide();
} else {
if (_anyone) {
@ -2158,13 +2158,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
uint16 oct, ocd;
/* 5-8 */
oct = g_t_mot[idx];
oct = _inpBuffer[idx];
oct = ((uint16)(oct << (16 - pt))) >> (16 - pt);
if (pt < 6) {
++idx;
oct = oct << (5 - pt);
pt += 11;
oct = oct | ((uint)g_t_mot[idx] >> pt);
oct = oct | ((uint)_inpBuffer[idx] >> pt);
} else {
pt -= 5;
oct = (uint)oct >> pt;
@ -2177,13 +2177,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
break;
case 30:
case 31:
ocd = g_t_mot[idx];
ocd = _inpBuffer[idx];
ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt);
if (pt < 6) {
++idx;
ocd = ocd << (5 - pt);
pt += 11;
ocd = ocd | ((uint)g_t_mot[idx] >> pt);
ocd = ocd | ((uint)_inpBuffer[idx] >> pt);
} else {
pt -= 5;
ocd = (uint)ocd >> pt;
@ -2217,21 +2217,21 @@ Common::String MortevielleEngine::getString(int num) {
} else if (!_txxFileFl) {
wrkStr = getGameString(num);
} else {
int i = g_t_rec[num]._hintId;
byte k = g_t_rec[num]._point;
int hint = _ntpBuffer[num]._hintId;
byte point = _ntpBuffer[num]._point;
int length = 0;
bool endFl = false;
char let;
do {
cinq_huit(let, i, k, endFl);
cinq_huit(let, hint, point, endFl);
if (length < 254)
wrkStr += let;
++length;
} while (!endFl);
}
if (wrkStr.lastChar() == '$')
// Remove trailing '$'
while (wrkStr.lastChar() == '$')
// Remove trailing '$'s
wrkStr.deleteLastChar();
return wrkStr;
@ -2240,7 +2240,7 @@ Common::String MortevielleEngine::getString(int num) {
void MortevielleEngine::copcha() {
int i = kAcha;
do {
g_tabdon[i] = g_tabdon[i + 390];
_tabdon[i] = _tabdon[i + 390];
++i;
} while (i != kAcha + 390);
}
@ -2288,7 +2288,7 @@ void MortevielleEngine::resetVariables() {
_coreVar._teauto[33] = '*';
for (int i = 1; i <= 8; ++i)
g_nbrep[i] = 0;
_nbrep[i] = 0;
init_nbrepm();
}
@ -2352,7 +2352,7 @@ void MortevielleEngine::loadPalette() {
if (!f.open("fxx.mor"))
error("Missing file - fxx.mor");
for (int i = 0; i < 108; ++i)
g_l[i] = f.readSint16LE();
_fxxBuffer[i] = f.readSint16LE();
f.close();
if (!f.open("plxx.mor"))
@ -2423,14 +2423,14 @@ void MortevielleEngine::loadTexts() {
}
for (int i = 0; i < inpFile.size() / 2; ++i)
g_t_mot[i] = inpFile.readUint16LE();
_inpBuffer[i] = inpFile.readUint16LE();
inpFile.close();
_txxFileFl = true;
for (int i = 0; i < (ntpFile.size() / 3); ++i) {
g_t_rec[i]._hintId = ntpFile.readSint16LE();
g_t_rec[i]._point = ntpFile.readByte();
_ntpBuffer[i]._hintId = ntpFile.readSint16LE();
_ntpBuffer[i]._point = ntpFile.readByte();
}
ntpFile.close();
@ -2453,7 +2453,7 @@ void MortevielleEngine::loadCFIEC() {
if (!f.open("cfiec.mor"))
error("Missing file - cfiec.mor");
f.read(&g_adcfiec[0], 822 * 128);
f.read(&_cfiecBuffer[0], 822 * 128);
f.close();
_reloadCFIEC = false;
@ -2467,7 +2467,7 @@ void MortevielleEngine::loadCFIPH() {
error("Missing file - cfiph.mor");
for (int i = 0; i < (f.size() / 2); ++i)
g_t_cph[i] = f.readSint16LE();
_speechManager._cfiphBuffer[i] = f.readSint16LE();
f.close();
}
@ -2492,13 +2492,13 @@ void MortevielleEngine::music() {
_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623);
_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
_speechManager.cctable(g_tbi);
_speechManager.cctable(_speechManager._tbi);
bool fin = false;
int k = 0;
do {
fin = keyPressed();
_soundManager.musyc(g_tbi, 9958, kTempoMusic);
_soundManager.musyc(_speechManager._tbi, 9958, kTempoMusic);
++k;
fin = fin | keyPressed() | (k >= 5);
} while (!fin);
@ -2532,7 +2532,7 @@ void MortevielleEngine::showTitleScreen() {
*/
void MortevielleEngine::draw(int ad, int x, int y) {
_mouse.hideMouse();
setPal(g_numpal);
setPal(_numpal);
pictout(ad, 0, x, y);
_mouse.showMouse();
}
@ -2584,9 +2584,9 @@ void MortevielleEngine::prepareRoom() {
int i = 0;
do {
++i;
if (g_nbrepm[i] != 0)
--g_nbrepm[i];
g_nbrep[i] = 0;
if (_nbrepm[i] != 0)
--_nbrepm[i];
_nbrep[i] = 0;
} while (i != 8);
}
if ((hour > _hour) || ((hour == 0) && (_hour == 23))) {
@ -2769,4 +2769,26 @@ void MortevielleEngine::drawClock() {
}
}
void MortevielleEngine::palette(int v1) {
warning("TODO: palette");
}
/**
* Returns a substring of the given string
* @param s Source string
* @param idx Starting index (1 based)
* @param size Number of characters to return
*/
Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) {
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
strncpy(tmp, s.c_str() + idx - 1, size);
tmp[size] = '\0';
Common::String result(tmp);
delete[] tmp;
return result;
}
} // End of namespace Mortevielle

View File

@ -135,6 +135,7 @@ private:
Common::StringArray _gameStrings;
Pattern _patternArr[15];
int _menuOpcode;
Common::ErrorCode initialise();
Common::ErrorCode loadMortDat();
@ -156,12 +157,22 @@ private:
void loadCFIEC();
void loadCFIPH();
void showTitleScreen();
int readclock();
int readclock();
void palette(int v1);
public:
Common::String _hintPctMessage;
Common::Point _prevPos;
byte _tabdon[4001];
byte _cfiecBuffer[822 * 128];
int _fxxBuffer[108];
byte _touv[8];
int _msg[5];
int _nbrep[9];
int _nbrepm[9];
uint16 _inpBuffer[kMaxTi + 1];
Hint _ntpBuffer[kMaxTd + 1];
bool _roomPresenceLuc;
bool _roomPresenceIda;
bool _purpleRoomPresenceLeo;
@ -202,6 +213,8 @@ public:
int _minute;
float _addfix;
int _numpal;
Common::Point _stdPal[91][17];
t_pcga _cgaPal[91];
int _c_zzz;
@ -360,6 +373,7 @@ public:
void drawRightFrame();
void prepareRoom();
void drawClock();
Common::String copy(const Common::String &s, int idx, size_t size);
};

View File

@ -281,16 +281,16 @@ void taffich() {
npal = a;
for (cx = 0; cx <= (a - 1); ++cx)
lgt = lgt + g_l[cx];
handle = g_l[a];
lgt += g_vm->_fxxBuffer[cx];
handle = g_vm->_fxxBuffer[a];
filename = "DXX.mor";
} else {
filename = "DZZ.mor";
handle = g_l[87];
handle = g_vm->_fxxBuffer[87];
if (a == 51) {
lgt = handle;
handle = g_l[88];
handle = g_vm->_fxxBuffer[88];
}
g_maff = a;
npal = a + 37;
@ -310,7 +310,7 @@ void taffich() {
alllum[k] = -1;
}
}
g_numpal = npal;
g_vm->_numpal = npal;
g_vm->setPal(npal);
if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) {
@ -323,8 +323,8 @@ void taffich() {
else if (b > 15)
--b;
for (cx = 0; cx <= (b - 1); ++cx)
lgt += g_l[cx + 89];
handle = g_l[b + 89];
lgt += g_vm->_fxxBuffer[cx + 89];
handle = g_vm->_fxxBuffer[b + 89];
filename = "AXX.mor";
} else if (b == 50) {
filename = "AZZ.mor";
@ -333,7 +333,7 @@ void taffich() {
charani(filename, lgt, handle);
}
g_vm->_mouse.showMouse();
if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) {
if ((a == 13) || (a == 14))
g_vm->displayAloneText();
else if (!g_vm->_blo)

View File

@ -66,7 +66,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) {
sz.syncAsByte(g_vm->_saveStruct._alreadyEnteredManor);
sz.syncAsByte(g_vm->_saveStruct._fullHour);
sz.syncBytes(g_bufcha, 391);
sz.syncBytes(_tabdonSaveBuffer, 391);
}
/**
@ -108,7 +108,7 @@ void SavegameManager::loadSavegame(int n) {
g_vm->_coreVar = g_vm->_saveStruct;
for (int i = 0; i <= 389; ++i)
g_tabdon[i + kAcha] = g_bufcha[i];
g_vm->_tabdon[i + kAcha] = _tabdonSaveBuffer[i];
// Close the stream
delete stream;
@ -141,10 +141,10 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
g_vm->hourToChar();
for (i = 0; i <= 389; ++i)
g_bufcha[i] = g_tabdon[i + kAcha];
_tabdonSaveBuffer[i] = g_vm->_tabdon[i + kAcha];
g_vm->_saveStruct = g_vm->_coreVar;
if (g_vm->_saveStruct._currPlace == 26)
g_vm->_saveStruct._currPlace = 15;
if (g_vm->_saveStruct._currPlace == ROOM26)
g_vm->_saveStruct._currPlace = LANDING;
Common::String filename = generateSaveName(n);
f = g_system->getSavefileManager()->openForSaving(filename);

View File

@ -49,6 +49,8 @@ struct SavegameHeader {
class SavegameManager {
private:
byte _tabdonSaveBuffer[391];
void sync_save(Common::Serializer &sz);
public:
void loadSavegame(int n);

View File

@ -93,8 +93,8 @@ void SpeechManager::charg_car(int &currWordNumb) {
void SpeechManager::entroct(byte o) {
g_mem[kAdrTroct * 16 + g_ptr_oct] = o;
++g_ptr_oct;
g_mem[kAdrTroct * 16 + _ptr_oct] = o;
++_ptr_oct;
}
void SpeechManager::veracf(byte b) {
@ -115,7 +115,7 @@ void SpeechManager::regenbruit() {
int i = kOffsetB3 + 8590;
int j = 0;
do {
g_t_cph[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]);
_cfiphBuffer[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]);
i += 2;
++j;
} while (i < kOffsetB3 + 8790);
@ -148,7 +148,7 @@ void SpeechManager::loadPhonemeSounds() {
error("Missing file - phbrui.mor");
for (int i = 1; i <= 3; ++i)
g_t_cph[i] = f.readSint16LE();
_cfiphBuffer[i] = f.readSint16LE();
f.close();
}
@ -499,13 +499,13 @@ void SpeechManager::initQueue() {
void SpeechManager::handlePhoneme() {
const int deca[3] = {300, 30, 40};
int startPos = swap(g_t_cph[_phonemeNumb - 1]) + deca[_typlec];
int endPos = swap(g_t_cph[_phonemeNumb]) + deca[_typlec];
int startPos = swap(_cfiphBuffer[_phonemeNumb - 1]) + deca[_typlec];
int endPos = swap(_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(&g_mem[kAdrWord + currWord], g_t_cph[i]);
WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], _cfiphBuffer[i]);
g_ptr_oct = 0;
_ptr_oct = 0;
int currWord = 0;
initQueue();
@ -536,14 +536,14 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) {
_typlec = typ;
if (_typlec != 0) {
for (int i = 0; i <= 500; ++i)
savph[i] = g_t_cph[i];
savph[i] = _cfiphBuffer[i];
tempo = kTempoNoise;
} else if (g_haut > 5)
tempo = kTempoF;
else
tempo = kTempoM;
g_vm->_addfix = (float)((tempo - g_addv[0])) / 256;
cctable(g_tbi);
cctable(_tbi);
switch (typ) {
case 1:
loadNoise();
@ -558,13 +558,13 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) {
break;
}
handlePhoneme();
g_vm->_soundManager.litph(g_tbi, typ, tempo);
g_vm->_soundManager.litph(_tbi, typ, tempo);
if (_typlec != 0)
for (int i = 0; i <= 500; ++i) {
g_t_cph[i] = savph[i];
_cfiphBuffer[i] = savph[i];
g_mlec = _typlec;
}
g_vm->setPal(g_numpal);
g_vm->setPal(g_vm->_numpal);
}
} // End of namespace Mortevielle

View File

@ -68,9 +68,14 @@ class SpeechManager {
private:
int _typlec;
int _phonemeNumb;
SpeechQueue _queue[3];
int _ptr_oct;
public:
int _cfiphBuffer[6401];
int _tbi[256];
SpeechManager();
void spfrac(int wor);
void charg_car(int &currWordNumb);

View File

@ -92,31 +92,8 @@ int g_x,
g_mchai,
g_menup,
g_mpers,
g_mnumo,
g_perdep,
g_prebru,
g_numpal,
g_ptr_oct,
g_k_tempo;
int g_t_cph[6401];
byte g_tabdon[4001];
int g_nbrep[9];
int g_nbrepm[9];
int g_msg[5];
byte g_touv[8];
byte g_bufcha[391];
byte g_lettres[7][24];
uint16 g_t_mot[kMaxTi + 1];
int g_tay_tchar;
Hint g_t_rec[kMaxTd + 1];
int g_l[108];
int g_tbi[256];
byte g_adcfiec[(4088 * 16) + (311 * 0x80)];
g_prebru;
/*---------------------------------------------------------------------------*/
/*-------------------- PROCEDURES AND FONCTIONS -----------------------*/
@ -131,23 +108,6 @@ void hirs() {
g_vm->_screenSurface.clearScreen();
}
/**
* Returns a substring of the given string
* @param s Source string
* @param idx Starting index (1 based)
* @param size Number of characters to return
*/
Common::String copy(const Common::String &s, int idx, size_t size) {
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
strncpy(tmp, s.c_str() + idx - 1, size);
tmp[size] = '\0';
Common::String result(tmp);
delete[] tmp;
return result;
}
/*---------------------------------------------------------------------------*/
/*------------------------------ STUBS ------------------------------*/
/*---------------------------------------------------------------------------*/
@ -155,10 +115,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) {
int g_port[0xfff];
byte g_mem[65536 * 16];
void palette(int v1) {
warning("TODO: palette");
}
void musyc(tablint &tb, int nbseg, int att) {
warning("TODO: musyc");
}

View File

@ -158,36 +158,14 @@ extern int g_x,
g_mchai,
g_menup,
g_mpers,
g_mnumo,
g_perdep,
g_prebru,
g_numpal,
g_ptr_oct,
g_k_tempo;
extern int g_t_cph[6401]; // Speech
extern byte g_tabdon[4001];
extern int g_nbrep[9];
extern int g_nbrepm[9];
extern int g_msg[5];
extern byte g_touv[8];
extern byte g_bufcha[391];
extern uint16 g_t_mot[kMaxTi + 1];
extern int g_tay_tchar;
extern Hint g_t_rec[kMaxTd + 1];
extern int g_l[108];
extern int g_tbi[256];
extern byte g_adcfiec[822 * 128];
g_prebru;
/*---------------------------------------------------------------------------*/
/*------------------- PROCEDURES AND FONCTIONS ------------------------*/
/*---------------------------------------------------------------------------*/
void hirs();
Common::String copy(const Common::String &s, int idx, size_t size);
void Val(const Common::String &s, int &V, int Code);
/*---------------------------------------------------------------------------*/
@ -197,7 +175,6 @@ void Val(const Common::String &s, int &V, int Code);
extern int g_port[0xfff];
extern byte g_mem[65536 * 16];
extern void palette(int v1);
} // End of namespace Mortevielle