MORTEVIELLE: More renaming

This commit is contained in:
Strangerke 2012-03-22 08:36:59 +01:00
parent c1e8ff3ada
commit 1a9183e0ba
12 changed files with 654 additions and 653 deletions

File diff suppressed because it is too large Load Diff

View File

@ -196,7 +196,7 @@ void Menu::displayMenu() {
do { // One line after the other
msk = 0x80;
for (pt = 0; pt <= 7; ++pt) {
if ((g_lettres[num_letr - 1][ind_tabl] & msk) != 0) {
if ((_charArr[num_letr - 1][ind_tabl] & msk) != 0) {
g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0);
g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0);
g_vm->_screenSurface.setPixel(Common::Point(x, y), color);
@ -505,7 +505,7 @@ void Menu::initMenu() {
if (!f.open("menu.mor"))
error("Missing file - menufr.mor or menual.mor or menu.mor");
f.read(g_lettres, 7 * 24);
f.read(_charArr, 7 * 24);
f.close();
// Skipped: dialog asking to swap floppy
@ -567,7 +567,7 @@ void Menu::setSearchMenu() {
* @remarks Originally called 'mfouen'
*/
void Menu::unsetSearchMenu() {
setDestinationMenuText(g_vm->g_s._currPlace);
setDestinationMenuText(g_vm->_coreVar._currPlace);
for (int i = 1; i <= 11; ++i)
enableMenuItem(_actionMenu[i]);

View File

@ -40,6 +40,8 @@ enum {
class Menu {
private:
byte _charArr[7][24];
void util(Common::Point pos);
void invert(int indx);
void menuDown(int ii);

View File

@ -95,18 +95,6 @@ int animof(int ouf, int num) {
return animof_result;
}
/**
* Read the current system time
*/
int readclock() {
TimeDate dateTime;
g_system->getTimeAndDate(dateTime);
int m = dateTime.tm_min * 60;
int h = dateTime.tm_hour * 3600;
return h + m + dateTime.tm_sec;
}
void modif(int &nu) {
if (nu == 26)
nu = 25;
@ -245,12 +233,12 @@ void repon(int f, int m) {
g_vm->prepareScreenType2();
text1(8, 182, 103, m);
if ((m == 68) || (m == 69))
g_vm->g_s._teauto[40] = '*';
g_vm->_coreVar._teauto[40] = '*';
if ((m == 104) && (g_caff == 14)) {
g_vm->g_s._teauto[36] = '*';
if (g_vm->g_s._teauto[39] == '*') {
g_vm->g_s._pourc[3] = '*';
g_vm->g_s._teauto[38] = '*';
g_vm->_coreVar._teauto[36] = '*';
if (g_vm->_coreVar._teauto[39] == '*') {
g_vm->_coreVar._pourc[3] = '*';
g_vm->_coreVar._teauto[38] = '*';
}
}
break;
@ -267,9 +255,9 @@ void repon(int f, int m) {
displayStr(tmpStr, 80, 40, 60, 25, i);
if (m == 180)
g_vm->g_s._pourc[6] = '*';
g_vm->_coreVar._pourc[6] = '*';
else if (m == 179)
g_vm->g_s._pourc[10] = '*';
g_vm->_coreVar._pourc[10] = '*';
}
break;
default:
@ -286,57 +274,6 @@ int chlm() {
return retval;
}
/**
* Engine function - Draw Clock
* @remarks Originally called 'pendule'
*/
void drawClock() {
const int cv[2][12] = {
{ 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 },
{ -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 }
};
const int x = 580;
const int y = 123;
const int rg = 9;
int h, co;
g_vm->_mouse.hideMouse();
paint_rect(570, 118, 20, 10);
paint_rect(578, 114, 6, 18);
if ((g_vm->_currGraphicalDevice == MODE_CGA) || (g_vm->_currGraphicalDevice == MODE_HERCULES))
co = 0;
else
co = 1;
if (g_vm->_minute == 0)
g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co);
else
g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co);
h = g_vm->_hour;
if (h > 12)
h -= 12;
if (h == 0)
h = 12;
g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co);
g_vm->_mouse.showMouse();
g_vm->_screenSurface.putxy(568, 154);
if (g_vm->_hour > 11)
g_vm->_screenSurface.drawString("PM ", 1);
else
g_vm->_screenSurface.drawString("AM ", 1);
g_vm->_screenSurface.putxy(550, 160);
if ((g_vm->_day >= 0) && (g_vm->_day <= 8)) {
Common::String tmp = g_vm->getEngineString(S_DAY);
tmp.insertChar((char)(g_vm->_day + 49), 0);
g_vm->_screenSurface.drawString(tmp, 1);
}
}
/*************
* NIVEAU 11 *
*************/
@ -426,7 +363,7 @@ int t11(int roomId) {
int retVal = 0;
int p, rand;
ecfren(p, rand, g_vm->g_s._faithScore, roomId);
ecfren(p, rand, g_vm->_coreVar._faithScore, roomId);
g_vm->_place = roomId;
if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) {
if (p != -500) {
@ -458,7 +395,7 @@ int t11(int roomId) {
p = g_vm->getPresenceStatsLanding();
else if (roomId == CHAPEL)
p = g_vm->getPresenceStatsChapel(h);
p += g_vm->g_s._faithScore;
p += g_vm->_coreVar._faithScore;
rand = g_vm->getRandomNumber(1, 100);
if (rand > p) {
g_vm->displayAloneText();
@ -483,9 +420,9 @@ int t11(int roomId) {
}
void cavegre() {
g_vm->g_s._faithScore += 2;
if (g_vm->g_s._faithScore > 69)
g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10);
g_vm->_coreVar._faithScore += 2;
if (g_vm->_coreVar._faithScore > 69)
g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10);
g_vm->clearScreenType3();
g_vm->prepareScreenType2();
ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS));
@ -551,16 +488,16 @@ void dessin(int ad) {
}
if (g_caff == 13) {
if (g_vm->g_s._atticBallHoleObjectId == 141)
if (g_vm->_coreVar._atticBallHoleObjectId == 141)
aniof(1, 7);
if (g_vm->g_s._atticRodHoleObjectId == 159)
if (g_vm->_coreVar._atticRodHoleObjectId == 159)
aniof(1, 6);
} else if ((g_caff == 14) && (g_vm->g_s._cellarObjectId == 151))
} else if ((g_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151))
aniof(1, 2);
else if ((g_caff == 17) && (g_vm->g_s._secretPassageObjectId == 143))
else if ((g_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143))
aniof(1, 1);
else if ((g_caff == 24) && (g_vm->g_s._wellObjectId != 0))
else if ((g_caff == 24) && (g_vm->_coreVar._wellObjectId != 0))
aniof(1, 1);
}
@ -570,157 +507,6 @@ void dessin(int ad) {
}
}
void tinke() {
Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED);
Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS);
const char d3 = '[';
const char d4 = ']';
const char d5 = '1';
Common::String d6 = g_vm->getEngineString(S_OK);
int cf, day, hour, minute;
Common::String stpo;
g_vm->_anyone = false;
g_vm->updateHour(day, hour, minute);
if (day != g_vm->_day) {
g_vm->_day = day;
int i = 0;
do {
++i;
if (g_nbrepm[i] != 0)
--g_nbrepm[i];
g_nbrep[i] = 0;
} while (i != 8);
}
if ((hour > g_vm->_hour) || ((hour == 0) && (g_vm->_hour == 23))) {
g_vm->_hour = hour;
g_vm->_minute = 0;
drawClock();
cf = 0;
for (int i = 1; i <= 10; ++i) {
if (g_vm->g_s._pourc[i] == '*')
++cf;
}
if (cf == 10)
stpo = "10";
else
stpo = chr(cf + 48);
g_vm->_hintPctMessage = Common::String(d3);
g_vm->_hintPctMessage += d5;
g_vm->_hintPctMessage += d4;
g_vm->_hintPctMessage += d3;
g_vm->_hintPctMessage += d1;
g_vm->_hintPctMessage += stpo;
g_vm->_hintPctMessage += '0';
g_vm->_hintPctMessage += d2;
g_vm->_hintPctMessage += d4;
g_vm->_hintPctMessage += d3;
g_vm->_hintPctMessage += d6;
g_vm->_hintPctMessage += d4;
}
if (minute > g_vm->_minute) {
g_vm->_minute = 30;
drawClock();
}
if (g_vm->_mouse._pos.y < 12)
return;
if (!g_vm->_blo) {
if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7)))
g_t = kTime2;
else
g_t = kTime1;
cf = g_vm->g_s._faithScore;
if ((cf > 33) && (cf < 66))
g_t -= (g_t / 3);
if (cf > 65)
g_t -= ((g_t / 3) * 2);
int nh = readclock();
if ((nh - g_mh) > g_t) {
bool activeMenu = g_vm->_menu._menuActive;
g_vm->_menu.eraseMenu();
g_jh += ((nh - g_mh) / g_t);
g_mh = nh;
switch (g_vm->_place) {
case GREEN_ROOM:
case DARKBLUE_ROOM:
g_vm->setRandomPresenceGreenRoom(cf);
break;
case PURPLE_ROOM:
g_vm->setRandomPresencePurpleRoom(cf);
break;
case BLUE_ROOM:
g_vm->setRandomPresenceBlueRoom(cf);
break;
case RED_ROOM:
case GREEN_ROOM2:
g_vm->setRandomPresenceRedRoom(cf);
break;
case ROOM9:
g_vm->setRandomPresenceRoom9(cf);
break;
case DINING_ROOM:
g_vm->setRandomPresenceDiningRoom(cf);
break;
case BUREAU:
g_vm->setRandomPresenceBureau(cf);
break;
case KITCHEN:
g_vm->setRandomPresenceKitchen(cf);
break;
case ATTIC:
case CELLAR:
g_vm->setRandomPresenceAttic(cf);
break;
case LANDING:
case ROOM26:
g_vm->setRandomPresenceLanding(cf);
break;
case CHAPEL:
g_vm->setRandomPresenceChapel(cf);
break;
}
if ((g_mpers != 0) && (g_vm->_currBitIndex != 10))
g_mpers = g_vm->_currBitIndex;
if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) {
if ((g_vm->g_s._currPlace == ATTIC) || (g_vm->g_s._currPlace == CELLAR)) {
cavegre();
} else if (g_vm->_currBitIndex == 10) {
g_vm->_currBitIndex = 0;
if (!g_vm->_brt) {
g_vm->_brt = true;
g_hdb = readclock();
if (g_vm->getRandomNumber(1, 5) < 5) {
g_vm->clearScreenType3();
g_vm->prepareScreenType2();
ecr3(g_vm->getEngineString(S_HEAR_NOISE));
int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(1, rand, 1);
g_vm->clearScreenType3();
}
}
}
}
if (activeMenu)
g_vm->_menu.drawMenu();
}
}
g_hfb = readclock();
if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) {
g_vm->getPresenceBitIndex(g_vm->_place);
g_vm->_brt = false;
g_hdb = 0;
if ((g_vm->g_s._currPlace > OWN_ROOM) && (g_vm->g_s._currPlace < DINING_ROOM))
g_vm->_anyone = true;
}
}
void fenat(char ans) {
int coul;
@ -763,7 +549,7 @@ void tkey1(bool d) {
// Event loop
do {
if (d)
tinke();
g_vm->prepareRoom();
quest = g_vm->keyPressed();
g_vm->_mouse.getMousePosition(x, y, c);
CHECK_QUIT;
@ -787,17 +573,17 @@ void tlu(int af, int ob) {
}
void affrep() {
g_caff = g_vm->g_s._currPlace;
g_crep = g_vm->g_s._currPlace;
g_caff = g_vm->_coreVar._currPlace;
g_crep = g_vm->_coreVar._currPlace;
}
void tsort() {
if ((g_iouv > 0) && (g_vm->g_s._currPlace != 0)) {
if (g_vm->g_s._faithScore < 50)
g_vm->g_s._faithScore += 2;
if ((g_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) {
if (g_vm->_coreVar._faithScore < 50)
g_vm->_coreVar._faithScore += 2;
else
g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10);
g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10);
}
for (int cx = 1; cx <= 7; ++cx)
@ -805,7 +591,7 @@ void tsort() {
g_ment = 0;
g_iouv = 0;
g_mchai = 0;
debloc(g_vm->g_s._currPlace);
debloc(g_vm->_coreVar._currPlace);
}
void st4(int ob) {
@ -844,9 +630,9 @@ void modinv() {
int cy = 0;
for (int i = 1; i <= 6; ++i) {
if (g_vm->g_s._sjer[i] != chr(0)) {
if (g_vm->_coreVar._sjer[i] != chr(0)) {
++cy;
r = (ord(g_vm->g_s._sjer[i]) + 400);
r = (ord(g_vm->_coreVar._sjer[i]) + 400);
nomp = g_vm->getString(r - 501 + kInventoryStringIndex);
g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp);
g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]);
@ -879,7 +665,7 @@ void ajchai() {
} while ((cx <= 9) && (g_tabdon[cy + cx] != 0));
if (g_tabdon[cy + cx] == 0)
g_tabdon[cy + cx] = g_vm->g_s._selectedObjectId;
g_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId;
else
g_crep = 192;
}
@ -888,10 +674,10 @@ void ajjer(int ob) {
int cx = 0;
do {
++cx;
} while ((cx <= 5) && (ord(g_vm->g_s._sjer[cx]) != 0));
} while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0));
if (ord(g_vm->g_s._sjer[cx]) == 0) {
g_vm->g_s._sjer[(cx)] = chr(ob);
if (ord(g_vm->_coreVar._sjer[cx]) == 0) {
g_vm->_coreVar._sjer[(cx)] = chr(ob);
modinv();
} else
g_crep = 139;
@ -920,11 +706,11 @@ L1:
g_vm->_speechManager.startSpeech(4, 4, 1);
if (g_iouv == 0)
g_vm->g_s._faithScore += 2;
else if (g_vm->g_s._faithScore < 50)
g_vm->g_s._faithScore += 4;
g_vm->_coreVar._faithScore += 2;
else if (g_vm->_coreVar._faithScore < 50)
g_vm->_coreVar._faithScore += 4;
else
g_vm->g_s._faithScore += 3 * (g_vm->g_s._faithScore / 10);
g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10);
tsort();
g_vm->_menu.setDestinationMenuText(LANDING);
int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex);
@ -971,7 +757,7 @@ void tsuiv() {
g_caff = tbcl;
g_crep = g_caff + 400;
if (g_vm->_currBitIndex != 0)
g_vm->g_s._faithScore += 2;
g_vm->_coreVar._faithScore += 2;
} else {
affrep();
g_vm->endSearch();
@ -998,7 +784,7 @@ void tfleche() {
if (g_vm->getMouseClick())
inRect = (g_vm->_mouse._pos.x < 256 * g_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12);
tinke();
g_vm->prepareRoom();
} while (!(qust || inRect || g_vm->_anyone));
if (qust && (touch == '\103'))
@ -1112,20 +898,20 @@ void treg(int ob) {
void avpoing(int &ob) {
g_crep = 999;
if (g_vm->g_s._selectedObjectId != 0)
ajjer(g_vm->g_s._selectedObjectId);
if (g_vm->_coreVar._selectedObjectId != 0)
ajjer(g_vm->_coreVar._selectedObjectId);
if (g_crep != 139) {
modobj(ob + 400);
g_vm->g_s._selectedObjectId = ob;
g_vm->_coreVar._selectedObjectId = ob;
ob = 0;
}
}
void rechai(int &ch) {
int tmpPlace = g_vm->g_s._currPlace;
int tmpPlace = g_vm->_coreVar._currPlace;
if (g_vm->g_s._currPlace == CRYPT)
if (g_vm->_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1];
}
@ -1140,7 +926,7 @@ int t23coul() {
}
void maivid() {
g_vm->g_s._selectedObjectId = 0;
g_vm->_coreVar._selectedObjectId = 0;
modobj(500);
}

View File

@ -48,7 +48,6 @@ extern void charecr(int y, int dy);
extern void adzon();
extern int animof(int ouf, int num);
/* Niveau 14 suite */
extern int readclock();
extern void modif(int &nu);
/* NIVEAU 13 */
extern void text1(int x, int y, int nb, int m);
@ -77,8 +76,6 @@ extern void writetp(Common::String s, int t);
extern void aniof(int ouf, int num);
/* NIVEAU 9 */
extern void dessin(int ad);
extern void tinke();
extern void fenat(char ans);
/* NIVEAU 8 */
extern void afdes();
@ -89,7 +86,6 @@ extern void affrep();
/* NIVEAU 6 */
extern void tsort();
extern void st4(int ob);
extern void displayDiningRoom();
extern void modinv();
extern void mennor();
extern void premtet();

View File

@ -625,10 +625,10 @@ void MortevielleEngine::handleAction() {
_inMainGameLoop = true;
do {
_menu.mdn();
tinke();
prepareRoom();
_mouse.moveMouse(funct, inkey);
CHECK_QUIT;
temps = temps + 1;
++temps;
} while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone)));
_inMainGameLoop = false;
@ -682,7 +682,7 @@ void MortevielleEngine::handleAction() {
oo = true;
if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) {
endSearch();
g_caff = g_s._currPlace;
g_caff = _coreVar._currPlace;
g_crep = 998;
} else
tsuiv();
@ -1432,7 +1432,7 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) {
void MortevielleEngine::initGame() {
_place = MANOR_FRONT;
g_jh = 0;
if (!g_s._alreadyEnteredManor)
if (!_coreVar._alreadyEnteredManor)
_blo = true;
g_t = kTime1;
g_mh = readclock();
@ -1625,21 +1625,21 @@ void MortevielleEngine::startMusicOrSpeech(int so) {
if (so == 0) {
/* musik(0) */
;
} else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) {
} else if ((g_prebru == 0) && (!_coreVar._alreadyEnteredManor)) {
// Type 1: Speech
_speechManager.startSpeech(10, 1, 1);
++g_prebru;
} else {
if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2))
if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2))
// Type 1: Speech
_speechManager.startSpeech(9, getRandomNumber(2, 4), 1);
else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1))
else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1))
// Type 1: Speech
_speechManager.startSpeech(8, 1, 1);
else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2))
else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2))
// Type 1: Speech
_speechManager.startSpeech(12, 1, 1);
else if (g_s._currPlace == INSIDE_WELL)
else if (_coreVar._currPlace == INSIDE_WELL)
// Type 1: Speech
_speechManager.startSpeech(13, 1, 1);
else
@ -1679,9 +1679,9 @@ void MortevielleEngine::loseGame() {
bool MortevielleEngine::checkInventory(int objectId) {
bool retVal = false;
for (int i = 1; i <= 6; ++i)
retVal = (retVal || (ord(g_s._sjer[i]) == objectId));
retVal = (retVal || (ord(_coreVar._sjer[i]) == objectId));
if (g_s._selectedObjectId == objectId)
if (_coreVar._selectedObjectId == objectId)
retVal = true;
return retVal;
@ -1692,7 +1692,7 @@ bool MortevielleEngine::checkInventory(int objectId) {
* @remarks Originally called 'st1sama'
*/
void MortevielleEngine::displayDiningRoom() {
g_s._currPlace = DINING_ROOM;
_coreVar._currPlace = DINING_ROOM;
affrep();
}
@ -1741,13 +1741,13 @@ void MortevielleEngine::gotoDiningRoom() {
int day, hour, minute;
updateHour(day, hour, minute);
if ((hour < 5) && (g_s._currPlace > ROOM18)) {
if ((hour < 5) && (_coreVar._currPlace > ROOM18)) {
if (!checkInventory(137)) { //You don't have the keys, and it's late
g_crep = 1511;
loseGame();
} else
displayDiningRoom();
} else if (!g_s._alreadyEnteredManor) { //Is it your first time?
} else if (!_coreVar._alreadyEnteredManor) { //Is it your first time?
_currBitIndex = 255; // Everybody is present
showPeoplePresent(_currBitIndex);
g_caff = 77;
@ -1763,14 +1763,14 @@ void MortevielleEngine::gotoDiningRoom() {
drawRightFrame();
drawClock();
_mouse.showMouse();
g_s._currPlace = OWN_ROOM;
_coreVar._currPlace = OWN_ROOM;
affrep();
resetPresenceInRooms(DINING_ROOM);
if (!_blo)
minute = t11(OWN_ROOM);
_currBitIndex = 0;
g_mpers = 0;
g_s._alreadyEnteredManor = true;
_coreVar._alreadyEnteredManor = true;
} else
displayDiningRoom();
}
@ -1786,7 +1786,7 @@ void MortevielleEngine::checkManorDistance() {
loseGame();
} else {
_okdes = true;
g_s._currPlace = MOUNTAIN;
_coreVar._currPlace = MOUNTAIN;
affrep();
}
}
@ -1797,7 +1797,7 @@ void MortevielleEngine::checkManorDistance() {
*/
void MortevielleEngine::gotoManorFront() {
_manorDistance = 0;
g_s._currPlace = MANOR_FRONT;
_coreVar._currPlace = MANOR_FRONT;
affrep();
}
@ -1806,7 +1806,7 @@ void MortevielleEngine::gotoManorFront() {
* @remarks Originally called 't1derr'
*/
void MortevielleEngine::gotoManorBack() {
g_s._currPlace = MANOR_BACK;
_coreVar._currPlace = MANOR_BACK;
affrep();
}
@ -1830,7 +1830,7 @@ void MortevielleEngine::changeGraphicalDevice(int newDevice) {
_mouse.initMouse();
_mouse.showMouse();
drawRightFrame();
tinke();
prepareRoom();
drawClock();
if (_currBitIndex != 0)
showPeoplePresent(_currBitIndex);
@ -1884,16 +1884,16 @@ void MortevielleEngine::gameLoaded() {
_heroSearching = false;
displayAloneText();
tinke();
prepareRoom();
drawClock();
afdes();
repon(2, g_crep);
clearScreenType3();
_endGame = false;
_menu.setDestinationMenuText(g_s._currPlace);
_menu.setDestinationMenuText(_coreVar._currPlace);
modinv();
if (g_s._selectedObjectId != 0)
modobj(g_s._selectedObjectId + 400);
if (_coreVar._selectedObjectId != 0)
modobj(_coreVar._selectedObjectId + 400);
_mouse.showMouse();
}
@ -1984,16 +1984,16 @@ void MortevielleEngine::handleOpcode() {
}
int hour, day, minute;
updateHour(day, hour, minute);
if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) ||
((hour > 0) && (hour < 6) && (g_s._currPlace != 0)))
++g_s._faithScore;
if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL)
&& (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) {
if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) {
if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != 10)) ||
((hour > 0) && (hour < 6) && (_coreVar._currPlace != 0)))
++_coreVar._faithScore;
if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL)
&& (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) {
if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) {
g_crep = 1501;
loseGame();
}
if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) {
if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) {
g_crep = 1508;
loseGame();
}
@ -2017,7 +2017,7 @@ void MortevielleEngine::hourToChar() {
minute = 1;
hour += day * 24;
minute += hour * 2;
g_s._fullHour = chr(minute);
_coreVar._fullHour = chr(minute);
}
/**
@ -2025,7 +2025,7 @@ void MortevielleEngine::hourToChar() {
* @remarks Originally called 'theure'
*/
void MortevielleEngine::charToHour() {
int fullHour = ord(g_s._fullHour);
int fullHour = ord(_coreVar._fullHour);
int tmpHour = fullHour % 48;
_currDay = fullHour / 48;
_currHalfHour = tmpHour % 2;
@ -2092,11 +2092,11 @@ void MortevielleEngine::clearScreenType10() {
cod = 544;
}
_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98));
if (g_s._faithScore < 33)
if (_coreVar._faithScore < 33)
st = getEngineString(S_COOL);
else if (g_s._faithScore < 66)
else if (_coreVar._faithScore < 66)
st = getEngineString(S_LOURDE);
else if (g_s._faithScore > 65)
else if (_coreVar._faithScore > 65)
st = getEngineString(S_MALSAINE);
co = 580 - (_screenSurface.getStringWidth(st) / 2);
@ -2252,40 +2252,40 @@ void MortevielleEngine::copcha() {
void MortevielleEngine::resetVariables() {
copcha();
g_s._alreadyEnteredManor = false;
g_s._selectedObjectId = 0;
g_s._cellarObjectId = 0;
g_s._atticBallHoleObjectId = 0;
g_s._atticRodHoleObjectId = 0;
g_s._wellObjectId = 0;
g_s._secretPassageObjectId = 0;
g_s._purpleRoomObjectId = 136;
g_s._cryptObjectId = 141;
g_s._faithScore = getRandomNumber(4, 10);
g_s._currPlace = MANOR_FRONT;
_coreVar._alreadyEnteredManor = false;
_coreVar._selectedObjectId = 0;
_coreVar._cellarObjectId = 0;
_coreVar._atticBallHoleObjectId = 0;
_coreVar._atticRodHoleObjectId = 0;
_coreVar._wellObjectId = 0;
_coreVar._secretPassageObjectId = 0;
_coreVar._purpleRoomObjectId = 136;
_coreVar._cryptObjectId = 141;
_coreVar._faithScore = getRandomNumber(4, 10);
_coreVar._currPlace = MANOR_FRONT;
for (int i = 2; i <= 6; ++i)
g_s._sjer[i] = chr(0);
_coreVar._sjer[i] = chr(0);
g_s._sjer[1] = chr(113);
g_s._fullHour = chr(20);
_coreVar._sjer[1] = chr(113);
_coreVar._fullHour = chr(20);
for (int i = 1; i <= 10; ++i)
g_s._pourc[i] = ' ';
_coreVar._pourc[i] = ' ';
for (int i = 1; i <= 6; ++i)
g_s._teauto[i] = '*';
_coreVar._teauto[i] = '*';
for (int i = 7; i <= 9; ++i)
g_s._teauto[i] = ' ';
_coreVar._teauto[i] = ' ';
for (int i = 10; i <= 28; ++i)
g_s._teauto[i] = '*';
_coreVar._teauto[i] = '*';
for (int i = 29; i <= 42; ++i)
g_s._teauto[i] = ' ';
_coreVar._teauto[i] = ' ';
g_s._teauto[33] = '*';
_coreVar._teauto[33] = '*';
for (int i = 1; i <= 8; ++i)
g_nbrep[i] = 0;
@ -2519,7 +2519,7 @@ void MortevielleEngine::showTitleScreen() {
if (_newGraphicalDevice != _currGraphicalDevice)
_currGraphicalDevice = _newGraphicalDevice;
hirs();
g_vm->draw(g_ades, 0, 0);
draw(g_ades, 0, 0);
Common::String cpr = "COPYRIGHT 1989 : LANKHOR";
_screenSurface.putxy(104 + 72 * g_res, 185);
@ -2531,10 +2531,10 @@ void MortevielleEngine::showTitleScreen() {
* @remarks Originally called 'dessine'
*/
void MortevielleEngine::draw(int ad, int x, int y) {
g_vm->_mouse.hideMouse();
g_vm->setPal(g_numpal);
_mouse.hideMouse();
setPal(g_numpal);
pictout(ad, 0, x, y);
g_vm->_mouse.showMouse();
_mouse.showMouse();
}
/**
@ -2542,13 +2542,231 @@ void MortevielleEngine::draw(int ad, int x, int y) {
* @remarks Originally called 'dessine_rouleau'
*/
void MortevielleEngine::drawRightFrame() {
g_vm->setPal(89);
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
setPal(89);
if (_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 14] = 15;
}
g_vm->_mouse.hideMouse();
_mouse.hideMouse();
pictout(0x73a2, 0, 0, 0);
g_vm->_mouse.showMouse();
_mouse.showMouse();
}
/**
* Read the current system time
*/
int MortevielleEngine::readclock() {
TimeDate dateTime;
g_system->getTimeAndDate(dateTime);
int m = dateTime.tm_min * 60;
int h = dateTime.tm_hour * 3600;
return h + m + dateTime.tm_sec;
}
/**
* Engine function - Prepare room and hint string
* @remarks Originally called 'tinke'
*/
void MortevielleEngine::prepareRoom() {
Common::String d1 = getEngineString(S_SHOULD_HAVE_NOTICED);
Common::String d2 = getEngineString(S_NUMBER_OF_HINTS);
const char d3 = '[';
const char d4 = ']';
const char d5 = '1';
Common::String d6 = getEngineString(S_OK);
int cf, day, hour, minute;
Common::String stpo;
_anyone = false;
updateHour(day, hour, minute);
if (day != _day) {
_day = day;
int i = 0;
do {
++i;
if (g_nbrepm[i] != 0)
--g_nbrepm[i];
g_nbrep[i] = 0;
} while (i != 8);
}
if ((hour > _hour) || ((hour == 0) && (_hour == 23))) {
_hour = hour;
_minute = 0;
drawClock();
cf = 0;
for (int i = 1; i <= 10; ++i) {
if (_coreVar._pourc[i] == '*')
++cf;
}
if (cf == 10)
stpo = "10";
else
stpo = chr(cf + 48);
_hintPctMessage = Common::String(d3);
_hintPctMessage += d5;
_hintPctMessage += d4;
_hintPctMessage += d3;
_hintPctMessage += d1;
_hintPctMessage += stpo;
_hintPctMessage += '0';
_hintPctMessage += d2;
_hintPctMessage += d4;
_hintPctMessage += d3;
_hintPctMessage += d6;
_hintPctMessage += d4;
}
if (minute > _minute) {
_minute = 30;
drawClock();
}
if (_mouse._pos.y < 12)
return;
if (!_blo) {
if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7)))
g_t = kTime2;
else
g_t = kTime1;
cf = _coreVar._faithScore;
if ((cf > 33) && (cf < 66))
g_t -= (g_t / 3);
if (cf > 65)
g_t -= ((g_t / 3) * 2);
int nh = readclock();
if ((nh - g_mh) > g_t) {
bool activeMenu = _menu._menuActive;
_menu.eraseMenu();
g_jh += ((nh - g_mh) / g_t);
g_mh = nh;
switch (_place) {
case GREEN_ROOM:
case DARKBLUE_ROOM:
setRandomPresenceGreenRoom(cf);
break;
case PURPLE_ROOM:
setRandomPresencePurpleRoom(cf);
break;
case BLUE_ROOM:
setRandomPresenceBlueRoom(cf);
break;
case RED_ROOM:
case GREEN_ROOM2:
setRandomPresenceRedRoom(cf);
break;
case ROOM9:
setRandomPresenceRoom9(cf);
break;
case DINING_ROOM:
setRandomPresenceDiningRoom(cf);
break;
case BUREAU:
setRandomPresenceBureau(cf);
break;
case KITCHEN:
setRandomPresenceKitchen(cf);
break;
case ATTIC:
case CELLAR:
setRandomPresenceAttic(cf);
break;
case LANDING:
case ROOM26:
setRandomPresenceLanding(cf);
break;
case CHAPEL:
setRandomPresenceChapel(cf);
break;
}
if ((g_mpers != 0) && (_currBitIndex != 10))
g_mpers = _currBitIndex;
if ((g_mpers == 0) && (_currBitIndex > 0)) {
if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) {
cavegre();
} else if (_currBitIndex == 10) {
_currBitIndex = 0;
if (!_brt) {
_brt = true;
g_hdb = readclock();
if (getRandomNumber(1, 5) < 5) {
clearScreenType3();
prepareScreenType2();
ecr3(getEngineString(S_HEAR_NOISE));
int rand = (getRandomNumber(0, 4)) - 2;
_speechManager.startSpeech(1, rand, 1);
clearScreenType3();
}
}
}
}
if (activeMenu)
_menu.drawMenu();
}
}
g_hfb = readclock();
if ((_brt) && ((g_hfb - g_hdb) > 17)) {
getPresenceBitIndex(_place);
_brt = false;
g_hdb = 0;
if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM))
_anyone = true;
}
}
/**
* Engine function - Draw Clock
* @remarks Originally called 'pendule'
*/
void MortevielleEngine::drawClock() {
const int cv[2][12] = {
{ 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 },
{ -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 }
};
const int x = 580;
const int y = 123;
const int rg = 9;
int h, co;
_mouse.hideMouse();
paint_rect(570, 118, 20, 10);
paint_rect(578, 114, 6, 18);
if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES))
co = 0;
else
co = 1;
if (_minute == 0)
_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co);
else
_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co);
h = _hour;
if (h > 12)
h -= 12;
if (h == 0)
h = 12;
_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co);
_mouse.showMouse();
_screenSurface.putxy(568, 154);
if (_hour > 11)
_screenSurface.drawString("PM ", 1);
else
_screenSurface.drawString("AM ", 1);
_screenSurface.putxy(550, 160);
if ((_day >= 0) && (_day <= 8)) {
Common::String tmp = getEngineString(S_DAY);
tmp.insertChar((char)(_day + 49), 0);
_screenSurface.drawString(tmp, 1);
}
}
} // End of namespace Mortevielle

View File

@ -100,6 +100,29 @@ struct t_pcga {
nhom _a[16];
};
struct Pattern {
byte _tay, _tax;
byte _des[kMaxPatt + 1][kMaxPatt + 1];
};
struct SaveStruct {
int _faithScore;
byte _pourc[11];
byte _teauto[43];
byte _sjer[31];
int _currPlace;
int _atticBallHoleObjectId;
int _atticRodHoleObjectId;
int _cellarObjectId;
int _secretPassageObjectId;
int _wellObjectId;
int _selectedObjectId;
int _purpleRoomObjectId;
int _cryptObjectId;
bool _alreadyEnteredManor;
byte _fullHour;
};
class MortevielleEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
@ -133,6 +156,7 @@ private:
void loadCFIEC();
void loadCFIPH();
void showTitleScreen();
int readclock();
public:
Common::String _hintPctMessage;
@ -183,7 +207,7 @@ public:
int _c_zzz;
int ptr_word;
byte _v_lieu[7][25];
SaveStruct g_s, g_s1;
SaveStruct _coreVar, _saveStruct;
byte g_is;
ScreenSurface _screenSurface;
@ -334,6 +358,8 @@ public:
void music();
void draw(int ad, int x, int y);
void drawRightFrame();
void prepareRoom();
void drawClock();
};

View File

@ -196,37 +196,37 @@ void taffich() {
switch (a) {
case 16:
g_vm->g_s._pourc[9] = '*';
g_vm->g_s._teauto[42] = '*';
g_vm->_coreVar._pourc[9] = '*';
g_vm->_coreVar._teauto[42] = '*';
break;
case 20:
g_vm->g_s._teauto[39] = '*';
if (g_vm->g_s._teauto[36] == '*') {
g_vm->g_s._pourc[3] = '*';
g_vm->g_s._teauto[38] = '*';
g_vm->_coreVar._teauto[39] = '*';
if (g_vm->_coreVar._teauto[36] == '*') {
g_vm->_coreVar._pourc[3] = '*';
g_vm->_coreVar._teauto[38] = '*';
}
break;
case 24:
g_vm->g_s._teauto[37] = '*';
g_vm->_coreVar._teauto[37] = '*';
break;
case 30:
g_vm->g_s._teauto[9] = '*';
g_vm->_coreVar._teauto[9] = '*';
break;
case 31:
g_vm->g_s._pourc[4] = '*';
g_vm->g_s._teauto[35] = '*';
g_vm->_coreVar._pourc[4] = '*';
g_vm->_coreVar._teauto[35] = '*';
break;
case 118:
g_vm->g_s._teauto[41] = '*';
g_vm->_coreVar._teauto[41] = '*';
break;
case 143:
g_vm->g_s._pourc[1] = '*';
g_vm->_coreVar._pourc[1] = '*';
break;
case 150:
g_vm->g_s._teauto[34] = '*';
g_vm->_coreVar._teauto[34] = '*';
break;
case 151:
g_vm->g_s._pourc[2] = '*';
g_vm->_coreVar._pourc[2] = '*';
break;
default:
break;
@ -258,7 +258,7 @@ void taffich() {
if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149))
m = 2030;
if (((a < 27) && (((g_maff > 69) && (!g_vm->g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33)))
if (((a < 27) && (((g_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33)))
m = 2033;
g_maff = a;
@ -333,11 +333,11 @@ void taffich() {
charani(filename, lgt, handle);
}
g_vm->_mouse.showMouse();
if ((a < 27) && ((g_maff < 27) || (g_vm->g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a == 13) || (a == 14))
g_vm->displayAloneText();
else if (!g_vm->_blo)
cx = t11(g_vm->g_s._currPlace);
cx = t11(g_vm->_coreVar._currPlace);
g_mpers = 0;
}
}

View File

@ -46,25 +46,25 @@ Common::String SavegameManager::generateSaveName(int slotNumber) {
* Handle saving or loading savegame data
*/
void SavegameManager::sync_save(Common::Serializer &sz) {
sz.syncAsSint16LE(g_vm->g_s1._faithScore);
sz.syncAsSint16LE(g_vm->_saveStruct._faithScore);
for (int i = 0; i < 11; ++i)
sz.syncAsByte(g_vm->g_s1._pourc[i]);
sz.syncAsByte(g_vm->_saveStruct._pourc[i]);
for (int i = 0; i < 43; ++i)
sz.syncAsByte(g_vm->g_s1._teauto[i]);
sz.syncAsByte(g_vm->_saveStruct._teauto[i]);
for (int i = 0; i < 31; ++i)
sz.syncAsByte(g_vm->g_s1._sjer[i]);
sz.syncAsByte(g_vm->_saveStruct._sjer[i]);
sz.syncAsSint16LE(g_vm->g_s1._currPlace);
sz.syncAsSint16LE(g_vm->g_s1._atticBallHoleObjectId);
sz.syncAsSint16LE(g_vm->g_s1._atticRodHoleObjectId);
sz.syncAsSint16LE(g_vm->g_s1._cellarObjectId);
sz.syncAsSint16LE(g_vm->g_s1._secretPassageObjectId);
sz.syncAsSint16LE(g_vm->g_s1._wellObjectId);
sz.syncAsSint16LE(g_vm->g_s1._selectedObjectId);
sz.syncAsSint16LE(g_vm->g_s1._purpleRoomObjectId);
sz.syncAsSint16LE(g_vm->g_s1._cryptObjectId);
sz.syncAsByte(g_vm->g_s1._alreadyEnteredManor);
sz.syncAsByte(g_vm->g_s1._fullHour);
sz.syncAsSint16LE(g_vm->_saveStruct._currPlace);
sz.syncAsSint16LE(g_vm->_saveStruct._atticBallHoleObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._atticRodHoleObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._cellarObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._secretPassageObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._wellObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._selectedObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._purpleRoomObjectId);
sz.syncAsSint16LE(g_vm->_saveStruct._cryptObjectId);
sz.syncAsByte(g_vm->_saveStruct._alreadyEnteredManor);
sz.syncAsByte(g_vm->_saveStruct._fullHour);
sz.syncBytes(g_bufcha, 391);
}
@ -106,7 +106,7 @@ void SavegameManager::loadSavegame(int n) {
Common::Serializer sz(stream, NULL);
sync_save(sz);
g_vm->g_s = g_vm->g_s1;
g_vm->_coreVar = g_vm->_saveStruct;
for (int i = 0; i <= 389; ++i)
g_tabdon[i + kAcha] = g_bufcha[i];
@ -142,9 +142,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
for (i = 0; i <= 389; ++i)
g_bufcha[i] = g_tabdon[i + kAcha];
g_vm->g_s1 = g_vm->g_s;
if (g_vm->g_s1._currPlace == 26)
g_vm->g_s1._currPlace = 15;
g_vm->_saveStruct = g_vm->_coreVar;
if (g_vm->_saveStruct._currPlace == 26)
g_vm->_saveStruct._currPlace = 15;
Common::String filename = generateSaveName(n);
f = g_system->getSavefileManager()->openForSaving(filename);

View File

@ -56,6 +56,14 @@ const int kTempoM = 89;
//const int seg_syst = 0x6fed;
//const int offsetb2 = 4;
struct SpeechQueue {
int _val;
int _code;
int _acc;
int _freq;
int _rep;
};
class SpeechManager {
private:
int _typlec;

View File

@ -106,7 +106,6 @@ int g_nbrep[9];
int g_nbrepm[9];
int g_msg[5];
byte g_touv[8];
SaveStruct g_s, g_s1;
byte g_bufcha[391];
byte g_lettres[7][24];

View File

@ -114,44 +114,12 @@ struct Hint {
byte _point;
};
struct SaveStruct {
int _faithScore;
byte _pourc[11];
byte _teauto[43];
byte _sjer[31];
int _currPlace;
int _atticBallHoleObjectId;
int _atticRodHoleObjectId;
int _cellarObjectId;
int _secretPassageObjectId;
int _wellObjectId;
int _selectedObjectId;
int _purpleRoomObjectId;
int _cryptObjectId;
bool _alreadyEnteredManor;
byte _fullHour;
};
struct SpeechQueue {
int _val;
int _code;
int _acc;
int _freq;
int _rep;
};
struct Rect {
int _x1, _x2, _y1, _y2;
bool _enabled;
};
struct Pattern {
byte _tay, _tax;
byte _des[kMaxPatt + 1][kMaxPatt + 1];
};
typedef int tablint[256];
//typedef Common::Point tabdb[17];
typedef int tfxx[108];
/*---------------------------------------------------------------------------*/
@ -206,8 +174,6 @@ extern int g_msg[5];
extern byte g_touv[8];
extern byte g_bufcha[391];
extern byte g_lettres[7][24];
extern uint16 g_t_mot[kMaxTi + 1];
extern int g_tay_tchar;
extern Hint g_t_rec[kMaxTd + 1];