diff options
-rw-r--r-- | engines/mortevielle/actions.cpp | 14 | ||||
-rw-r--r-- | engines/mortevielle/actions.h | 4 | ||||
-rw-r--r-- | engines/mortevielle/dialogs.cpp | 130 | ||||
-rw-r--r-- | engines/mortevielle/graphics.cpp | 5 | ||||
-rw-r--r-- | engines/mortevielle/keyboard.cpp | 29 | ||||
-rw-r--r-- | engines/mortevielle/level15.cpp | 39 | ||||
-rw-r--r-- | engines/mortevielle/menu.cpp | 114 | ||||
-rw-r--r-- | engines/mortevielle/menu.h | 2 | ||||
-rw-r--r-- | engines/mortevielle/mor.cpp | 886 | ||||
-rw-r--r-- | engines/mortevielle/mor2.cpp | 289 | ||||
-rw-r--r-- | engines/mortevielle/outtext.cpp | 5 | ||||
-rw-r--r-- | engines/mortevielle/prog.cpp | 6 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.h | 3 |
13 files changed, 905 insertions, 621 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index caaeb07638..66215170ce 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -909,7 +909,11 @@ void fctKnock() { } } -void tposer() { +/** + * Engine function - Put + * @remarks Originally called 'tposer' + */ +void fctPut() { int cx, chai; if (!syn) @@ -1099,7 +1103,7 @@ void fctEnter() { tip(z, x); ++s.conf; s.mlieu = 15; - msg[3] = discut; + msg[3] = MENU_DISCUSS; msg[4] = g_vm->_menu._disc[x]; syn = true; if (ment == 9) { @@ -1275,7 +1279,11 @@ void fctSound() { } } -void tparler() { +/** + * Engine function - Discuss + * @remarks Originally called 'tparler' + */ +void fctDiscuss() { bool te[47]; int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index d96b712835..e73dc080f5 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -48,7 +48,7 @@ extern void fctHideSelf(); extern void fctAttach(); extern void fctClose(); extern void fctKnock(); -extern void tposer(); +extern void fctPut(); extern void fctListen(); extern void fctEat(); extern void fctEnter(); @@ -57,7 +57,7 @@ extern void fctForce(); extern void fctLeave(); extern void fctWait(); extern void fctSound(); -extern void tparler(); +extern void fctDiscuss(); extern void fctSmell(); extern void fctScratch(); /* NIVEAU 2 */ diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index bccbb10f56..89658452e8 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -83,19 +83,23 @@ int Alert::show(const Common::String &msg, int n) { cx = 320; st = ""; while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { - i = i + 1; + ++i; st = st + chaine[i]; - if (res == 2) cx = cx - 3; - else cx = cx - 5; + if (res == 2) + cx -= 3; + else + cx -= 5; } g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); g_vm->_screenSurface._textPos.y += 6; g_vm->_screenSurface.writeg(st, 4); - i = i + 1; + ++i; } while (!(chaine[i] == ']')); } - if (nbcase == 1) esp = nbcol - 40; - else esp = (uint)(nbcol - nbcase * 40) >> 1; + if (nbcase == 1) + esp = nbcol - 40; + else + esp = (uint)(nbcol - nbcase * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); fait_choix(cas, coldep, nbcase, &s[0], esp); limit[1][1] = ((uint)(coldep) >> 1) * res; @@ -121,11 +125,14 @@ int Alert::show(const Common::String &msg, int n) { if (test) { test1 = (cx > limit[1][1]) && (cx < limit[1][2]); test2 = test1; - if (nbcase > 1) test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); + if (nbcase > 1) + test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); if (test2) { newaff = true; - if (test1) ix = 1; - else ix = 2; + if (test1) + ix = 1; + else + ix = 2; if (ix != quoi) { hideMouse(); if (quoi != 0) { @@ -165,7 +172,7 @@ int Alert::show(const Common::String &msg, int n) { } while (!g_vm->getMouseClick()); g_vm->setMouseClick(false); hideMouse(); - if (! test3) { + if (!test3) { quoi = n; setPosition(n, coldep, esp); Common::String tmp4(" "); @@ -199,26 +206,30 @@ void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String col = 0; while (s[i] != ']') { - c = c + s[i]; + c += s[i]; if ((s[i] == '|') || (s[i + 1] == ']')) { - if (k > col) col = k; + if (k > col) + col = k; k = 0; nbl = nbl + 1; - } else if (s[i] != ' ') v = false; - i = i + 1; - k = k + 1; + } else if (s[i] != ' ') + v = false; + ++i; + ++k; } if (v) { c = ""; col = 20; } else { - c = c + ']'; - col = col + 6; + c += ']'; + col += 6; } - i = i + 1; + ++i; cs = copy(s, i, 30); - if (res == 2) col = col * 6; - else col = col * 10; + if (res == 2) + col *= 6; + else + col *= 10; } void Alert::setPosition(int ji, int coldep, int esp) { @@ -228,7 +239,8 @@ void Alert::setPosition(int ji, int coldep, int esp) { void Alert::fait_boite(int lidep, int nli, int tx) { int x, y, xx, yy; - if (tx > 640) tx = 640; + if (tx > 640) + tx = 640; x = 320 - ((uint)tx >> 1); y = pred(int, lidep) << 3; xx = x + tx; @@ -249,12 +261,13 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String for (l = 1; l <= nbcase; l ++) { str[l] = ""; do { - i = i + 1; + ++i; ch = c[i]; - str[l] = str[l] + ch; + str[l] += ch; } while (!(c[i + 1] == ']')); i = i + 2; - while (str[l].size() < 3) str[l] = str[l] + ' '; + while (str[l].size() < 3) + str[l] += ' '; g_vm->_screenSurface.putxy(x, 98); Common::String tmp(" "); @@ -262,7 +275,7 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String tmp += " "; g_vm->_screenSurface.writeg(tmp, 0); - x = x + esp + 40; + x += esp + 40; } } @@ -292,10 +305,12 @@ bool Ques::show() { hideMouse(); hirs(); showMouse(); - i = i + 1; + ++i; deline(ta[i], st, tay); - if (res == 1) y = 29; - else y = 23; + if (res == 1) + y = 29; + else + y = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); afftex(st, 20, 15, 100, 2, 0); if (i != 10) { @@ -310,29 +325,31 @@ bool Ques::show() { memk = 1; for (j = prem; j <= der; j ++) { deline(j, st, tay); - if (tay > tmax) tmax = tay; + if (tay > tmax) + tmax = tay; afftex(st, 100, y, 100, 1, 0); chaines[memk] = delig; - memk = memk + 1; - y = y + 8; + ++memk; + y += 8; } - for (j = 1; j <= succ(int, der - prem); j ++) { - { - rectangle &with = coor[j]; - - with.x1 = 45 * res; - with.x2 = (tmax * 3 + 55) * res; - with.y1 = 27 + j * 8; - with.y2 = 34 + j * 8; - with.etat = true; - } + for (j = 1; j <= succ(int, der - prem); j++) { + rectangle &with = coor[j]; + + with.x1 = 45 * res; + with.x2 = (tmax * 3 + 55) * res; + with.y1 = 27 + j * 8; + with.y2 = 34 + j * 8; + with.etat = true; + while ((int)chaines[j].size() < tmax) { - chaines[j] = chaines[j] + ' '; + chaines[j] += ' '; } } coor[j + 1].etat = false; - if (res == 1) rep = 10; - else rep = 6; + if (res == 1) + rep = 10; + else + rep = 6; g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); rep = 0; j = 0; @@ -347,29 +364,40 @@ bool Ques::show() { while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; if (coor[k].etat) { if ((memk != 0) && (memk != k)) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[memk][j]; + strncpy(st, chaines[memk].c_str(), tmax); +// st[1 + tmax] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); } if (memk != k) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[k][j]; + strncpy(st, chaines[k].c_str(), tmax); st[1 + tmax] = '$'; afftex(st, 100, 27 + k * 8, 100, 1, 1); memk = k; } } else if (memk != 0) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[memk][j]; + strncpy(st, chaines[memk].c_str(), tmax); st[1 + tmax] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); memk = 0; } } while (!((memk != 0) && g_vm->getMouseClick())); - if (memk == ok[i]) compte = compte + 1; + if (memk == ok[i]) + ++compte; else { - if (i == 5) i = i + 1; - if ((i == 7) || (i == 8)) i = 10; + if (i == 5) + ++i; + if ((i == 7) || (i == 8)) + i = 10; } - if (i == 10) q = /*testprot*/ true; + if (i == 10) + q = /*testprot*/ true; } while (!(i == 10)); ques_result = (compte == 10) && q; return ques_result; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 62f13dac5e..1c0a4fa0a3 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -484,7 +484,8 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku for (;;) { // If position is past end point, then skip this line if (((_thickness - 1) * DEFAULT_WIDTH) + pDest >= pDestEnd) { - if (--_thickness == 0) break; + if (--_thickness == 0) + break; continue; } @@ -1081,7 +1082,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { } pt.x += 1; pt.y += 1; - for (x = 1; x <= (int)l.size(); ++x) { + for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); pt.x += i; } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index a330a382d9..abf8c26346 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -32,43 +32,38 @@ namespace Mortevielle { char readkey1() { - char c; + char c = get_ch(); - char readkey1_result; - c = get_ch(); // input >> kbd >> c; - readkey1_result = c; - return readkey1_result; + return c; } int testou() { - char ch; + char ch = get_ch(); - int testou_result; - ch = get_ch(); // input >> kbd >> ch; switch (ch) { case '\23' : - sonoff = ! sonoff; + sonoff = !sonoff; break; case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); c_zzz = succ(int, c_zzz); - testou_result = 61; - return testou_result; + + return 61; } break; case '\33' : - if (keypressed()) ch = get_ch(); // input >> kbd >> ch; + if (keypressed()) + ch = get_ch(); break; } - testou_result = ord(ch); - return testou_result; + + return ord(ch); } void teskbd() { - int dum; - - if (keypressed()) dum = testou(); + if (keypressed()) + testou(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 374851f7f0..571abfa18d 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -37,9 +37,7 @@ namespace Mortevielle { /* NIVEAU 15 */ void copcha() { - int i; - - i = acha; + int i = acha; do { tabdon[i] = tabdon[i + 390]; i = succ(int, i); @@ -54,8 +52,11 @@ bool dans_rect(rectangle r) { if ((x > r.x1) && (x < r.x2) && (y > r.y1) && - (y < r.y2)) dans_rect_result = true; - else dans_rect_result = false; + (y < r.y2)) + dans_rect_result = true; + else + dans_rect_result = false; + return dans_rect_result; } @@ -63,27 +64,24 @@ void outbloc(int n, pattern p, t_nhom pal) { int i, j, ad; ad = n * 404 + 0xd700; - { - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); - ad = ad + 4; - for (i = 1; i <= p.tax; i ++) - for (j = 1; j <= p.tay; j ++) - mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; - } -} + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); + ad = ad + 4; + for (i = 1; i <= p.tax; i ++) + for (j = 1; j <= p.tay; j ++) + mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; +} void writepal(int n) { int i; t_nhom pal; - switch (gd) { case tan: case ega: case ams : - for (i = 1; i <= 16; i ++) { + for (i = 1; i <= 16; i++) { mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; } @@ -91,8 +89,10 @@ void writepal(int n) { case cga : { warning("TODO: If this code is needed, resolve the incompatible types"); // pal = palcga[n].a; - if (n < 89) palette(palcga[n].p); - for (i = 0; i <= 15; i ++) outbloc(i, tpt[pal[i].n], pal); + if (n < 89) + palette(palcga[n].p); + for (i = 0; i <= 15; i++) + outbloc(i, tpt[pal[i].n], pal); } break; } @@ -152,7 +152,8 @@ int animof(int ouf, int num) { int animof_result; nani = mem[adani * 16 + 1]; aux = num; - if (ouf != 1) aux = aux + nani; + if (ouf != 1) + aux += nani; animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); return animof_result; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 51fad3f651..97ba083d77 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -44,20 +44,19 @@ namespace Mortevielle { * Setup a menu's contents */ void Menu::menut(int no, Common::String nom) { - byte h, l; - Common::String s; + byte h = hi(no); + byte l = lo(no); + Common::String s = nom; - h = hi(no); - l = lo(no); - s = nom; if (! tesok) { g_vm->quitGame(); } + while (s.size() < 20) - s = s + ' '; + s += ' '; switch (h) { - case invent : + case invent: if (l != 7) { _inv[l] = s; _inv[l].insertChar(' ', 0); @@ -72,7 +71,7 @@ void Menu::menut(int no, Common::String nom) { case saction: _self[l] = s; break; - case discut: + case MENU_DISCUSS: _dis[l] = s; break; } @@ -83,13 +82,12 @@ void Menu::menut(int no, Common::String nom) { * @param no Hi byte represents menu number, lo byte reprsents item index */ void Menu::disableMenuItem(int no) { - byte h, l; + byte h = hi(no); + byte l = lo(no); - h = hi(no); - l = lo(no); switch (h) { case invent : { - if (l > 6) { + if (l > 6) { _inv[l].setChar('<', 0); _inv[l].setChar('>', 21); } else @@ -105,7 +103,7 @@ void Menu::disableMenuItem(int no) { case saction: _self[l].setChar('*', 0); break; - case discut: + case MENU_DISCUSS: _dis[l].setChar('*', 0); break; } @@ -116,28 +114,25 @@ void Menu::disableMenuItem(int no) { * @param no Hi byte represents menu number, lo byte reprsents item index */ void Menu::enableMenuItem(int no) { - byte h, l; + byte h = hi(no); + byte l = lo(no); - h = hi(no); - l = lo(no); switch (h) { - case invent : { + case invent : _inv[l].setChar(' ', 0); _inv[l].setChar(' ', 21); - } - break; + break; case MENU_MOVE: _dep[l].setChar(' ', 0); break; case action: _act[l].setChar(' ', 0); break; - case saction: { + case saction: _self[l].setChar(' ', 0); _self[l].setChar(' ', 0); - } - break; - case discut: + break; + case MENU_DISCUSS: _dis[l].setChar(' ', 0); break; } @@ -152,17 +147,19 @@ void Menu::menu_aff() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; - if (gd == cga) color = 1; - else color = 9; + if (gd == cga) + color = 1; + else + color = 9; num_letr = 0; - do { /* lettre par lettre */ - num_letr = num_letr + 1; + do { // One character after the other + ++num_letr; ind_tabl = 0; y = 1; - do { /* colonne par colonne */ + do { // One column after the other k = 0; x = col; - do { /* ligne par ligne */ + do { // One line after the other msk = 0x80; for (pt = 0; pt <= 7; pt ++) { if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { @@ -171,14 +168,14 @@ void Menu::menu_aff() { g_vm->_screenSurface.setPixel(Common::Point(x, y), color); } msk = (uint)msk >> 1; - x = x + 1; + ++x; } ind_tabl = succ(int, ind_tabl); k = succ(int, k); } while (!(k == 3)); - y = y + 1; + ++y; } while (!(y == 9)); - col = col + 48 * res; + col += 48 * res; } while (!(num_letr == 6)); showMouse(); } @@ -199,7 +196,9 @@ void Menu::drawMenu() { void Menu::invers(int ix) { Common::String s; - if (msg4 == OPCODE_NONE) return; + if (msg4 == OPCODE_NONE) + return; + g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : @@ -248,8 +247,10 @@ void Menu::util(int x, int y) { ymx = (don[msg3][4] << 3) + 16; dxcar = don[msg3][3]; xmn = (don[msg3][1] << 2) * res; - if (res == 1) ix = 5; - else ix = 3; + if (res == 1) + ix = 5; + else + ix = 3; xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); @@ -282,8 +283,10 @@ void Menu::menuDown(int ii) { hideMouse(); sauvecr(10, succ(byte, don[ii][2]) << 1); xco = xco << 3; - if (res == 1) cx = 10; - else cx = 6; + if (res == 1) + cx = 10; + else + cx = 6; xcc = xco + (don[ii][3] * cx) + 6; g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); @@ -384,11 +387,12 @@ void Menu::mdn() { /* debug('mdn'); */ if (!_menuActive) return; + x = x_s; y = y_s; if (!g_vm->getMouseClick()) { - if ((x == xprec) && - (y == yprec)) return; + if ((x == xprec) && (y == yprec)) + return; else { xprec = x; yprec = y; @@ -400,12 +404,19 @@ void Menu::mdn() { || ((x > 220 * res) && (x < 220 * res + 24)) || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { - if (x < 76 * res) ix = invent; - else if (x < 124 * res) ix = MENU_MOVE; - else if (x < 172 * res) ix = action; - else if (x < 220 * res) ix = saction; - else if (x < 268 * res) ix = discut; - else ix = fichier; + if (x < 76 * res) + ix = invent; + else if (x < 124 * res) + ix = MENU_MOVE; + else if (x < 172 * res) + ix = action; + else if (x < 220 * res) + ix = saction; + else if (x < 268 * res) + ix = MENU_DISCUSS; + else + ix = fichier; + if ((ix != msg3) || (! test0)) if (!((ix == fichier) && ((msg3 == sauve) || (msg3 == charge)))) { menuUp(msg3); @@ -413,16 +424,19 @@ void Menu::mdn() { msg3 = ix; msg4 = OPCODE_NONE; } - } else { /* Not in the MenuTitle line */ - if ((y > 11) && (test0)) util(x, y); + } else { // Not in the MenuTitle line + if ((y > 11) && (test0)) + util(x, y); } - } else { /* There was a click */ + } else { // There was a click if ((msg3 == fichier) && (msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); - if (lo(msg4) == 1) msg3 = 7; - else msg3 = 8; + if (lo(msg4) == 1) + msg3 = 7; + else + msg3 = 8; menuDown(msg3); g_vm->setMouseClick(false); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index d4aecbcbd9..1fb8ad45c6 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -61,7 +61,7 @@ public: enum { invent = 1, MENU_MOVE = 2, action = 3, saction = 4, - discut = 5, fichier = 6, sauve = 7, charge = 8 + MENU_DISCUSS = 5, fichier = 6, sauve = 7, charge = 8 }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 78e577a3f5..bf9a480af7 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -56,42 +56,55 @@ void testfi() { * Read the current system time */ int readclock() { - int m, h; - - /* debug('readclock');*/ TimeDate dateTime; g_system->getTimeAndDate(dateTime); - m = dateTime.tm_min * 60; - h = dateTime.tm_hour * 3600; + int m = dateTime.tm_min * 60; + int h = dateTime.tm_hour * 3600; return h + m + dateTime.tm_sec; } void modif(int &nu) { - /* debug('modif'); */ - if (nu == 26) nu = 25; - if ((nu > 29) && (nu < 36)) nu = nu - 4; - if ((nu > 69) && (nu < 78)) nu = nu - 37; - if ((nu > 99) && (nu < 194)) nu = nu - 59; - if ((nu > 996) && (nu < 1000)) nu = nu - 862; - if ((nu > 1500) && (nu < 1507)) nu = nu - 1363; - if ((nu > 1507) && (nu < 1513)) nu = nu - 1364; - if ((nu > 1999) && (nu < 2002)) nu = nu - 1851; - if (nu == 2010) nu = 151; - if ((nu > 2011) && (nu < 2025)) nu = nu - 1860; - if (nu == 2026) nu = 165; - if ((nu > 2029) && (nu < 2037)) nu = nu - 1864; - if ((nu > 3000) && (nu < 3005)) nu = nu - 2828; - if (nu == 4100) nu = 177; - if (nu == 4150) nu = 178; - if ((nu > 4151) && (nu < 4156)) nu = nu - 3973; - if (nu == 4157) nu = 183; - if ((nu == 4160) || (nu == 4161)) nu = nu - 3976; + if (nu == 26) + nu = 25; + else if ((nu > 29) && (nu < 36)) + nu -= 4; + else if ((nu > 69) && (nu < 78)) + nu -= 37; + else if ((nu > 99) && (nu < 194)) + nu -= 59; + else if ((nu > 996) && (nu < 1000)) + nu -= 862; + else if ((nu > 1500) && (nu < 1507)) + nu -= 1363; + else if ((nu > 1507) && (nu < 1513)) + nu -= 1364; + else if ((nu > 1999) && (nu < 2002)) + nu -= 1851; + else if (nu == 2010) + nu = 151; + else if ((nu > 2011) && (nu < 2025)) + nu -= 1860; + else if (nu == 2026) + nu = 165; + else if ((nu > 2029) && (nu < 2037)) + nu -= 1864; + else if ((nu > 3000) && (nu < 3005)) + nu -= 2828; + else if (nu == 4100) + nu = 177; + else if (nu == 4150) + nu = 178; + else if ((nu > 4151) && (nu < 4156)) + nu -= 3973; + else if (nu == 4157) + nu = 183; + else if ((nu == 4160) || (nu == 4161)) + nu -= 3976; } void dessine(int ad, int x, int y) { - /* debug('dessine'); */ hideMouse(); writepal(numpal); pictout(ad, 0, x, y); @@ -99,7 +112,6 @@ void dessine(int ad, int x, int y) { } void dessine_rouleau() { - /* debug('dessine_rouleau'); */ writepal(89); if (gd == her) { mem[0x7000 * 16 + 14] = 15; @@ -124,18 +136,19 @@ void text1(int x, int y, int nb, int m) { /* debug('text'); */ - if (res == 1) co = 10; - else co = 6; + if (res == 1) + co = 10; + else + co = 6; deline(m, st, tay); - if ((y == 182) && (tay * co > nb * 6)) y = 176; + if ((y == 182) && (tay * co > nb * 6)) + y = 176; afftex(st, x, y, nb, 20, color_txt); } void initouv() { - int cx; - - /* debug('initouv'); */ - for (cx = 1; cx <= 7; cx ++) touv[cx] = chr(0); + for (int cx = 1; cx <= 7; cx++) + touv[cx] = chr(0); } void ecrf1() { @@ -144,7 +157,6 @@ void ecrf1() { } void clsf1() { - /* debug('clsf1'); */ hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); @@ -152,9 +164,6 @@ void clsf1() { } void clsf2() { -// int i, j; - - /* debug('clsf2'); */ hideMouse(); if (f2_all) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); @@ -173,13 +182,13 @@ void ecrf2() { void ecr2(Common::String str_) { int tab; - int tlig; - /* debug('ecr2 : '+str_);*/ - if (res == 1) tab = 10; - else tab = 6; + if (res == 1) + tab = 10; + else + tab = 6; g_vm->_screenSurface.putxy(8, 177); - tlig = 59 + pred(int, res) * 36; + int tlig = 59 + pred(int, res) * 36; if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { @@ -200,9 +209,6 @@ void ecr2(Common::String str_) { } void clsf3() { -// int i, j; - - /* debug('clsf3'); */ hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); @@ -210,14 +216,12 @@ void clsf3() { } void ecr3(Common::String text) { - /* debug('ecr3 : '+text);*/ clsf3(); g_vm->_screenSurface.putxy(8, 192); g_vm->_screenSurface.writeg(text, 5); } void ecrf6() { - /* debug('ecrf6'); */ text_color(5); g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15); } @@ -230,7 +234,6 @@ void clsf10() { int co, cod; Common::String st; - /* debug('clsf10'); */ hideMouse(); if (res == 1) { co = 634; @@ -250,8 +253,12 @@ void clsf10() { co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); g_vm->_screenSurface.putxy(co, 92); g_vm->_screenSurface.writeg(st, 4); - if (res == 1) co = 620; - else co = 584; + + if (res == 1) + co = 620; + else + co = 584; + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, co, 86)); /* rempli(69,12,32,5,255);*/ showMouse(); @@ -267,23 +274,20 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - /* debug('paint_rect'); */ - if (gd == cga) co = 3; - else co = 11; + if (gd == cga) + co = 3; + else + co = 11; g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } int hazard(int min, int max) { - /* debug('hazard'); */ return get_random_number(min, max); } void calch(int &j, int &h, int &m) { - int th, nh; - - /* debug('calch');*/ - nh = readclock(); - th = jh + ((nh - mh) / t); + int nh = readclock(); + int th = jh + ((nh - mh) / t); m = ((th % 2) + vm) * 30; h = ((uint)th >> 1) + vh; if (m == 60) { @@ -295,10 +299,7 @@ void calch(int &j, int &h, int &m) { } void conv(int x, int &y) { - int cx; - - /* debug('conv'); */ - cx = 1; + int cx = 1; y = 128; while (cx < x) { y = (uint)y >> 1; @@ -313,11 +314,9 @@ void okpas() { void modobj(int m) { char str_[1410]; - Common::String strp; int tay; - /* debug('modobj'); */ - strp = ' '; + Common::String strp = Common::String(' '); if (m != 500) { deline(m - 501 + c_st41, str_, tay); strp = delig; @@ -328,13 +327,13 @@ void modobj(int m) { void modobj2(int m, bool t1, bool t2) { char str_[1410]; - Common::String strp; int tay; - /* debug('modobj'); */ - strp = ' '; - if (t1 || t2) okpas(); - else tesok = false;; + Common::String strp = Common::String(' '); + if (t1 || t2) + okpas(); + else + tesok = false;; if (m != 500) { deline(m - 501 + c_st41, str_, tay); strp = delig; @@ -348,25 +347,28 @@ void repon(int f, int m) { Common::String str_; Common::String str1; char st[1410]; -// text1 fic; int i, xco, dx, caspe, tay; - /* debug('repon fenetre nø'+chr(f+48));*/ if ((m > 499) && (m < 563)) { deline(m - 501 + c_st41, st, tay); - if (tay > ((58 + pred(int, res) * 37) << 1)) f2_all = true; - else f2_all = false; + if (tay > ((58 + pred(int, res) * 37) << 1)) + f2_all = true; + else + f2_all = false; clsf2(); afftex(st, 8, 176, 85, 3, 5); } else { modif(m); - if (f == 8) f = 2; - if (f == 1) f = 6; + if (f == 8) + f = 2; + if (f == 1) + f = 6; if (f == 2) { clsf2(); ecrf2(); text1(8, 182, 103, m); - if ((m == 68) || (m == 69)) s.teauto[40] = '*'; + if ((m == 68) || (m == 69)) + s.teauto[40] = '*'; if ((m == 104) && (caff == 14)) { s.teauto[36] = '*'; if (s.teauto[39] == '*') { @@ -377,11 +379,15 @@ void repon(int f, int m) { } if ((f >= 6) && (f <= 9)) { deline(m, st, tay); - if (f == 6) i = 4; - else i = 5; + if (f == 6) + i = 4; + else + i = 5; afftex(st, 80, 40, 60, 25, i); - if (m == 180) s.pourc[6] = '*'; - if (m == 179) s.pourc[10] = '*'; + if (m == 180) + s.pourc[6] = '*'; + if (m == 179) + s.pourc[10] = '*'; } if (f == 7) { /* messint */ ecrf7(); @@ -395,30 +401,43 @@ void repon(int f, int m) { caspe = 144; dx = 50; } - if (tay < 40) afftex(st, xco, 86, dx, 3, 5); - else afftex(st, caspe, 86, dx, 3, 5); + if (tay < 40) + afftex(st, xco, 86, dx, 3, 5); + else + afftex(st, caspe, 86, dx, 3, 5); } } } void t5(int cx) { - /* debug('t5'); */ - if (cx == 10) blo = false; + if (cx == 10) + blo = false; + if (cx != 1) { bh1 = false; bf1 = false; } - if (cx != 2) bh2 = false; + + if (cx != 2) + bh2 = false; + if (cx != 4) { bh4 = false; bf4 = false; } - if (cx != 5) bh5 = false; - if (cx != 6) bh6 = false; - if (cx != 8) bh8 = false; - if (cx != 3) bt3 = false; - if (cx != 7) bt7 = false; - if (cx != 9) bh9 = false; + + if (cx != 5) + bh5 = false; + if (cx != 6) + bh6 = false; + if (cx != 8) + bh8 = false; + if (cx != 3) + bt3 = false; + if (cx != 7) + bt7 = false; + if (cx != 9) + bh9 = false; } void affper(int per) { @@ -473,91 +492,109 @@ void affper(int per) { void choix(int min, int max, int &per) { bool i; - int haz, cx, cy, cz; + int cz; - /* debug('o0 choix'); */ - haz = hazard(min, max); + int haz = hazard(min, max); if (haz > 4) { haz = 8 - haz; i = true; - } else i = false; - cx = 0; + } else + i = false; + + int cx = 0; per = 0; while (cx < haz) { - cy = hazard(1, 8); + int cy = hazard(1, 8); conv(cy, cz); if ((per & cz) != cz) { - cx = cx + 1; - per = (per | cz); + ++cx; + per |= cz; } } - if (i) per = 255 - per; - i = false; + if (i) + per = 255 - per; } void cpl1(int &p) { int j, h, m; - /* debug('o0 cpl1'); */ calch(j, h, m); - if ((h > 7) || (h < 11)) p = 25; - if ((h > 10) && (h < 14)) p = 35; - if ((h > 13) && (h < 16)) p = 50; - if ((h > 15) && (h < 18)) p = 5; - if ((h > 17) && (h < 22)) p = 35; - if ((h > 21) && (h < 24)) p = 50; - if ((h >= 0) && (h < 8)) p = 70; + if ((h > 7) || (h < 11)) + p = 25; + else if ((h > 10) && (h < 14)) + p = 35; + else if ((h > 13) && (h < 16)) + p = 50; + else if ((h > 15) && (h < 18)) + p = 5; + else if ((h > 17) && (h < 22)) + p = 35; + else if ((h > 21) && (h < 24)) + p = 50; + else if ((h >= 0) && (h < 8)) + p = 70; + g_vm->_menu.mdn(); } void cpl2(int &p) { int j, h, m; - /* debug('o0 cpl2'); */ calch(j, h, m); - if ((h > 7) && (h < 11)) p = -2; - if (h == 11) p = 100; - if ((h > 11) && (h < 23)) p = 10; - if (h == 23) p = 20; - if ((h >= 0) && (h < 8)) p = 50; + if ((h > 7) && (h < 11)) + p = -2; + if (h == 11) + p = 100; + if ((h > 11) && (h < 23)) + p = 10; + if (h == 23) + p = 20; + if ((h >= 0) && (h < 8)) + p = 50; } void cpl3(int &p) { int j, h, m; - /* debug('o0 cpl3'); */ calch(j, h, m); - if (((h > 8) && (h < 10)) || ((h > 19) && (h < 24))) p = 34; - if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) p = 0; + if (((h > 8) && (h < 10)) || ((h > 19) && (h < 24))) + p = 34; + if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) + p = 0; } void cpl5(int &p) { int j, h, m; - /* debug('o0 cpl5'); */ calch(j, h, m); - if ((h > 6) && (h < 10)) p = 0; - if (h == 10) p = 100; - if ((h > 10) && (h < 24)) p = 15; - if ((h >= 0) && (h < 7)) p = 50; + if ((h > 6) && (h < 10)) + p = 0; + if (h == 10) + p = 100; + if ((h > 10) && (h < 24)) + p = 15; + if ((h >= 0) && (h < 7)) + p = 50; } void cpl6(int &p) { int j, h, m; - /* debug('o0 cpl6'); */ calch(j, h, m); - if (((h > 7) && (h < 13)) || ((h > 17) && (h < 20))) p = -2; - if (((h > 12) && (h < 17)) || ((h > 19) && (h < 24))) p = 35; - if (h == 17) p = 100; - if ((h >= 0) && (h < 8)) p = 60; + if (((h > 7) && (h < 13)) || ((h > 17) && (h < 20))) + p = -2; + if (((h > 12) && (h < 17)) || ((h > 19) && (h < 24))) + p = 35; + if (h == 17) + p = 100; + if ((h >= 0) && (h < 8)) + p = 60; } /** * Shows the you are alone message in the status area on the right hand side of the screen */ void person() { - /* debug('person'); */ for (int cf = 1; cf <= 8; cf ++) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); @@ -577,7 +614,6 @@ void person() { } void chlm(int &per) { - /* debug('chlm'); */ per = hazard(1, 2); if (per == 2) per = 128; } @@ -594,7 +630,6 @@ void pendule() { int h, co; - /* debug('pendule'); */ hideMouse(); paint_rect(570, 118, 20, 10); @@ -602,20 +637,27 @@ void pendule() { if ((gd == cga) || (gd == her)) co = 0; else co = 1; + if (min == 0) g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); else g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); + h = heu; - if (h > 12) h = h - 12; - if (h == 0) h = 12; + if (h > 12) + h -= 12; + if (h == 0) + h = 12; + g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); showMouse(); g_vm->_screenSurface.putxy(568, 154); + if (heu > 11) g_vm->_screenSurface.writeg("PM ", 1); else g_vm->_screenSurface.writeg("AM ", 1); + g_vm->_screenSurface.putxy(550, 160); if ((jou >= 0) && (jou <= 8)) { Common::String tmp = g_vm->getString(S_DAY); @@ -629,134 +671,158 @@ void pendule() { *************/ void debloc(int l) { - /* debug('debloc'); */ num = 0; x = 0; y = 0; - if ((l != 26) && (l != 15)) t5(l); + if ((l != 26) && (l != 15)) + t5(l); mpers = ipers; } void cpl10(int &p, int &h) { int j, m; - /* debug('o1 cpl10'); */ calch(j, h, m); - if (((h > 7) && (h < 11)) || ((h > 11) && (h < 14)) - || ((h > 18) && (h < 21))) p = 100; - if ((h == 11) || ((h > 20) && (h < 24))) p = 45; - if (((h > 13) && (h < 17)) || (h == 18)) p = 35; - if (h == 17) p = 60; - if ((h >= 0) && (h < 8)) p = 5; + if (((h > 7) && (h < 11)) || ((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + p = 100; + if ((h == 11) || ((h > 20) && (h < 24))) + p = 45; + if (((h > 13) && (h < 17)) || (h == 18)) + p = 35; + if (h == 17) + p = 60; + if ((h >= 0) && (h < 8)) + p = 5; } void cpl11(int &p, int &h) { int j, m; - /* debug('o1 cpl11'); */ calch(j, h, m); - if (((h > 8) && (h < 12)) || ((h > 20) && (h < 24))) p = 25; - if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) p = 5; - if ((h > 13) && (h < 17)) p = 55; - if ((h > 16) && (h < 19)) p = 45; - if ((h >= 0) && (h < 9)) p = 0; + if (((h > 8) && (h < 12)) || ((h > 20) && (h < 24))) + p = 25; + if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + p = 5; + if ((h > 13) && (h < 17)) + p = 55; + if ((h > 16) && (h < 19)) + p = 45; + if ((h >= 0) && (h < 9)) + p = 0; } void cpl12(int &p) { int j, h, m; - /* debug('o1 cpl12'); */ calch(j, h, m); - if (((h > 8) && (h < 15)) || ((h > 16) && (h < 22))) p = 55; - if (((h > 14) && (h < 17)) || ((h > 21) && (h < 24))) p = 25; - if ((h >= 0) && (h < 5)) p = 0; - if ((h > 4) && (h < 9)) p = 15; + if (((h > 8) && (h < 15)) || ((h > 16) && (h < 22))) + p = 55; + if (((h > 14) && (h < 17)) || ((h > 21) && (h < 24))) + p = 25; + if ((h >= 0) && (h < 5)) + p = 0; + if ((h > 4) && (h < 9)) + p = 15; } void cpl13(int &p) { - /* debug('o1 cpl13'); */ p = 0; } void cpl15(int &p) { int j, h, m; - /* debug('o1 cpl15'); */ calch(j, h, m); - if ((h > 7) && (h < 12)) p = 25; - if ((h > 11) && (h < 14)) p = 0; - if ((h > 13) && (h < 18)) p = 10; - if ((h > 17) && (h < 20)) p = 55; - if ((h > 19) && (h < 22)) p = 5; - if ((h > 21) && (h < 24)) p = 15; - if ((h >= 0) && (h < 8)) p = -15; + if ((h > 7) && (h < 12)) + p = 25; + else if ((h > 11) && (h < 14)) + p = 0; + else if ((h > 13) && (h < 18)) + p = 10; + else if ((h > 17) && (h < 20)) + p = 55; + else if ((h > 19) && (h < 22)) + p = 5; + else if ((h > 21) && (h < 24)) + p = 15; + else if ((h >= 0) && (h < 8)) + p = -15; } void cpl20(int &p, int &h) { int j, m; - /* debug('o1 cpl20'); */ calch(j, h, m); - if (h == 10) p = 65; - if ((h > 10) && (h < 21)) p = 5; - if ((h > 20) && (h < 24)) p = -15; - if ((h >= 0) && (h < 5)) p = -300; - if ((h > 4) && (h < 10)) p = -5; + if (h == 10) + p = 65; + else if ((h > 10) && (h < 21)) + p = 5; + else if ((h > 20) && (h < 24)) + p = -15; + else if ((h >= 0) && (h < 5)) + p = -300; + else if ((h > 4) && (h < 10)) + p = -5; } void quelq1(int l) { int per; - /* debug('o1 quelq1'); */ per = hazard(1, 2); - if (l == 1) - if (per == 1) bh1 = true; - else bf1 = true; - if (l == 4) - if (per == 1) bh4 = true; - else bf4 = true; + if (l == 1) { + if (per == 1) + bh1 = true; + else + bf1 = true; + } else if (l == 4) { + if (per == 1) + bh4 = true; + else + bf4 = true; + } + ipers = 10; } void quelq2() { - /* debug('o1 quelq2'); */ - if (li == 2) bh2 = true; - else bh9 = true; + if (li == 2) + bh2 = true; + else + bh9 = true; + ipers = 10; } void quelq5() { - /* debug('o1 quelq5'); */ bh5 = true; ipers = 10; } void quelq6(int l) { - /* debug('o1 quelq6'); */ - if (l == 6) bh6 = true; - if (l == 8) bh8 = true; + if (l == 6) + bh6 = true; + else if (l == 8) + bh8 = true; + ipers = 10; } void quelq10(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq10'); */ - if ((h >= 0) && (h < 8)) chlm(per); + if ((h >= 0) && (h < 8)) + chlm(per); else { if ((h > 7) && (h < 10)) { min = 5; max = 7; - } - if ((h > 9) && (h < 12)) { + } else if ((h > 9) && (h < 12)) { min = 1; max = 4; - } - if (((h > 11) && (h < 15)) || ((h > 18) && (h < 21))) { + } else if (((h > 11) && (h < 15)) || ((h > 18) && (h < 21))) { min = 6; max = 8; - } - if (((h > 14) && (h < 19)) || ((h > 20) && (h < 24))) { + } else if (((h > 14) && (h < 19)) || ((h > 20) && (h < 24))) { min = 1; max = 5; } @@ -768,18 +834,16 @@ void quelq10(int h, int &per) { void quelq11(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq11'); */ - if ((h >= 0) && (h < 8)) chlm(per); + if ((h >= 0) && (h < 8)) + chlm(per); else { if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { min = 1; max = 3; - } - if (((h > 9) && (h < 12)) || ((h > 13) && (h < 19))) { + } else if (((h > 9) && (h < 12)) || ((h > 13) && (h < 19))) { min = 1; max = 4; - } - if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) { + } else if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) { min = 1; max = 2; } @@ -789,7 +853,6 @@ void quelq11(int h, int &per) { } void quelq12(int &per) { - /* debug('o1 quelq12'); */ chlm(per); affper(per); } @@ -798,41 +861,37 @@ void quelq15(int &per) { int cx; bool test; - - /* debug('o1 quelq15'); */ per = 0; - if (per == 0) { - do { - cx = hazard(1, 8); - test = (((cx == 1) && (bh2 || bh9)) || - ((cx == 2) && bh8) || - ((cx == 3) && bh4) || - ((cx == 4) && bf4) || - ((cx == 5) && bh6) || - ((cx == 6) && bh1) || - ((cx == 7) && bf1) || - ((cx == 8) && bh5)); - } while (!(! test)); - conv(cx, per); - affper(per); - } + + do { + cx = hazard(1, 8); + test = (((cx == 1) && (bh2 || bh9)) || + ((cx == 2) && bh8) || + ((cx == 3) && bh4) || + ((cx == 4) && bf4) || + ((cx == 5) && bh6) || + ((cx == 6) && bh1) || + ((cx == 7) && bf1) || + ((cx == 8) && bh5)); + } while (!(! test)); + + conv(cx, per); + affper(per); } void quelq20(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq20'); */ - if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); + if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) + chlm(per); else { if ((h > 9) && (h < 12)) { min = 3; max = 7; - } - if ((h > 11) && (h < 18)) { + } else if ((h > 11) && (h < 18)) { min = 1; max = 2; - } - if (h == 18) { + } else if (h == 18) { min = 2; max = 4; } @@ -847,61 +906,86 @@ void frap() { /* debug('o1 frap'); */ calch(j, h, m); - if ((h >= 0) && (h < 8)) crep = 190; + if ((h >= 0) && (h < 8)) + crep = 190; else { haz = hazard(1, 100); - if (haz > 70) crep = 190; - else crep = 147; + if (haz > 70) + crep = 190; + else + crep = 147; } } void nouvp(int l, int &p) { - /* debug('o1 nouvp'); */ p = 0; if (l == 1) { - if (bh1) p = 4; - if (bf1) p = 2; - } - if (((l == 2) && (bh2)) || ((l == 9) && (bh9))) p = 128; - if (l == 4) { - if (bh4) p = 32; - if (bf4) p = 16; - } - if ((l == 5) && (bh5)) p = 1; - if ((l == 6) && (bh6)) p = 8; - if ((l == 8) && (bh8)) p = 64; - if (((l == 3) && (bt3)) || ((l == 7) && (bt7))) p = 9; - if (p != 9) affper(p); + if (bh1) + p = 4; + if (bf1) + p = 2; + } else if (((l == 2) && (bh2)) || ((l == 9) && (bh9))) + p = 128; + else if (l == 4) { + if (bh4) + p = 32; + if (bf4) + p = 16; + } else if ((l == 5) && (bh5)) + p = 1; + else if ((l == 6) && (bh6)) + p = 8; + else if ((l == 8) && (bh8)) + p = 64; + else if (((l == 3) && (bt3)) || ((l == 7) && (bt7))) + p = 9; + + if (p != 9) + affper(p); } void tip(int ip, int &cx) { - /* debug('o1 tip'); */ - if (ip == 128) cx = 1; - else if (ip == 64) cx = 2; - else if (ip == 32) cx = 3; - else if (ip == 16) cx = 4; - else if (ip == 8) cx = 5; - else if (ip == 4) cx = 6; - else if (ip == 2) cx = 7; - else if (ip == 1) cx = 8; + if (ip == 128) + cx = 1; + else if (ip == 64) + cx = 2; + else if (ip == 32) + cx = 3; + else if (ip == 16) + cx = 4; + else if (ip == 8) + cx = 5; + else if (ip == 4) + cx = 6; + else if (ip == 2) + cx = 7; + else if (ip == 1) + cx = 8; } void ecfren(int &p, int &haz, int cf, int l) { /* debug('o1 ecfren'); */ - if (l == 0) person(); + if (l == 0) + person(); p = -500; haz = 0; - if (((l == 1) && (! bh1) && (! bf1)) - || ((l == 4) && (! bh4) && (! bf4))) cpl1(p); - if ((l == 2) && (! bh2) && (! bh9)) cpl2(p); - if (((l == 3) && (! bt3)) || ((l == 7) && (! bt7))) cpl3(p); - if ((l == 5) && (! bh5)) cpl5(p); - if (((l == 6) && (! bh6)) || ((l == 8) && (! bh8))) cpl6(p); - if ((l == 9) && (! bh9) && (! bh2)) p = 10; - if (((l == 2) && (bh9)) || ((l == 9) && (bh2))) p = -400; + if (((l == 1) && (! bh1) && (! bf1)) || ((l == 4) && (! bh4) && (! bf4))) + cpl1(p); + if ((l == 2) && (! bh2) && (! bh9)) + cpl2(p); + if (((l == 3) && (! bt3)) || ((l == 7) && (! bt7))) + cpl3(p); + if ((l == 5) && (! bh5)) + cpl5(p); + if (((l == 6) && (! bh6)) || ((l == 8) && (! bh8))) + cpl6(p); + if ((l == 9) && (! bh9) && (! bh2)) + p = 10; + if (((l == 2) && (bh9)) || ((l == 9) && (bh2))) + p = -400; if (p != -500) { p = p + cf; haz = hazard(1, 100); @@ -915,19 +999,29 @@ void becfren(int l) { if ((l == 1) || (l == 4)) { haz = hazard(1, 2); if (l == 1) - if (haz == 1) bh1 = true; - else bf1 = true; + if (haz == 1) + bh1 = true; + else + bf1 = true; if (l == 4) - if (haz == 1) bh4 = true; - else bf4 = true; - } - if (l == 2) bh2 = true; - else if (l == 3) bt3 = true; - else if (l == 5) bh5 = true; - else if (l == 6) bh6 = true; - else if (l == 7) bt7 = true; - else if (l == 8) bh8 = true; - else if (l == 9) bh9 = true; + if (haz == 1) + bh4 = true; + else + bf4 = true; + } else if (l == 2) + bh2 = true; + else if (l == 3) + bt3 = true; + else if (l == 5) + bh5 = true; + else if (l == 6) + bh6 = true; + else if (l == 7) + bt7 = true; + else if (l == 8) + bh8 = true; + else if (l == 9) + bh9 = true; } /* NIVEAU 10 */ @@ -941,7 +1035,7 @@ void init_nbrepm() { void phaz(int &haz, int &p, int cf) { /* debug('phaz'); */ - p = p + cf; + p += cf; haz = hazard(1, 100); } @@ -950,29 +1044,45 @@ void inzon() { /* debug('o2 inzon'); */ copcha(); - { - s.ipre = false; - s.derobj = 0; - s.icave = 0; - s.iboul = 0; - s.ibag = 0; - s.ipuit = 0; - s.ivier = 0; - s.iloic = 136; - s.icryp = 141; - s.conf = hazard(4, 10); - s.mlieu = 21; - for (cx = 2; cx <= 6; cx ++) s.sjer[cx] = chr(0); - s.sjer[1] = chr(113); - s.heure = chr(20); - for (cx = 1; cx <= 10; cx ++) s.pourc[cx] = ' '; - for (cx = 1; cx <= 6; cx ++) s.teauto[cx] = '*'; - for (cx = 7; cx <= 9; cx ++) s.teauto[cx] = ' '; - for (cx = 10; cx <= 28; cx ++) s.teauto[cx] = '*'; - for (cx = 29; cx <= 42; cx ++) s.teauto[cx] = ' '; - s.teauto[33] = '*'; - } - for (cx = 1; cx <= 8; cx ++) nbrep[cx] = 0; + + s.ipre = false; + s.derobj = 0; + s.icave = 0; + s.iboul = 0; + s.ibag = 0; + s.ipuit = 0; + s.ivier = 0; + s.iloic = 136; + s.icryp = 141; + s.conf = hazard(4, 10); + s.mlieu = 21; + + for (cx = 2; cx <= 6; cx ++) + s.sjer[cx] = chr(0); + + s.sjer[1] = chr(113); + s.heure = chr(20); + + for (cx = 1; cx <= 10; cx ++) + s.pourc[cx] = ' '; + + for (cx = 1; cx <= 6; cx ++) + s.teauto[cx] = '*'; + + for (cx = 7; cx <= 9; cx ++) + s.teauto[cx] = ' '; + + for (cx = 10; cx <= 28; cx ++) + s.teauto[cx] = '*'; + + for (cx = 29; cx <= 42; cx ++) + s.teauto[cx] = ' '; + + s.teauto[33] = '*'; + + for (cx = 1; cx <= 8; cx ++) + nbrep[cx] = 0; + init_nbrepm(); } @@ -981,7 +1091,8 @@ void dprog() { li = 21; /* jh:= t_settime(0);*/ jh = 0; - if (! s.ipre) blo = true; + if (! s.ipre) + blo = true; t = ti1; mh = readclock(); } @@ -990,12 +1101,13 @@ void pl1(int cf) { int p, haz; /* debug('o2 pl1'); */ - if (((li == 1) && (! bh1) && (! bf1)) - || ((li == 4) && (! bh4) && (! bf4))) { + if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { cpl1(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq1(li); + if (haz > p) + person(); + else + quelq1(li); } } @@ -1006,8 +1118,10 @@ void pl2(int cf) { if (! bh2) { cpl2(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq2(); + if (haz > p) + person(); + else + quelq2(); } } @@ -1018,8 +1132,10 @@ void pl5(int cf) { if (! bh5) { cpl5(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq5(); + if (haz > p) + person(); + else + quelq5(); } } @@ -1030,8 +1146,10 @@ void pl6(int cf) { if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { cpl6(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq6(li); + if (haz > p) + person(); + else + quelq6(li); } } @@ -1042,8 +1160,10 @@ void pl9(int cf) { if (! bh9) { cf = -10; phaz(haz, p, cf); - if (haz > p) person(); - else quelq2(); + if (haz > p) + person(); + else + quelq2(); } } @@ -1053,8 +1173,10 @@ void pl10(int cf) { /* debug('o2 pl10'); */ cpl10(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq10(h, p); + if (haz > p) + person(); + else + quelq10(h, p); } void pl11(int cf) { @@ -1063,8 +1185,10 @@ void pl11(int cf) { /* debug('o2 pl11'); */ cpl11(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq11(h, p); + if (haz > p) + person(); + else + quelq11(h, p); } void pl12(int cf) { @@ -1073,8 +1197,10 @@ void pl12(int cf) { /* debug('o2 pl12'); */ cpl12(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq12(p); + if (haz > p) + person(); + else + quelq12(p); } void pl13(int cf) { @@ -1083,8 +1209,10 @@ void pl13(int cf) { /* debug('o2 pl13'); */ cpl13(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq12(p); + if (haz > p) + person(); + else + quelq12(p); } void pl15(int cf) { @@ -1093,8 +1221,10 @@ void pl15(int cf) { /* debug('o2 pl15'); */ cpl15(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq15(p); + if (haz > p) + person(); + else + quelq15(p); } void pl20(int cf) { @@ -1103,8 +1233,10 @@ void pl20(int cf) { /* debug('o2 pl20'); */ cpl20(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq20(h, p); + if (haz > p) + person(); + else + quelq20(h, p); } void t11(int l11, int &a) { @@ -1113,7 +1245,7 @@ void t11(int l11, int &a) { /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); li = l11; - if ((l11 > 0) && (l11 < 10)) + if ((l11 > 0) && (l11 < 10)) { if (p != -500) { if (haz > p) { person(); @@ -1122,46 +1254,63 @@ void t11(int l11, int &a) { becfren(li); nouvp(li, a); } - } else nouvp(li, a); - if (l11 > 9) - if ((l11 > 15) && (l11 != 20) && (l11 != 26)) person(); + } else + nouvp(li, a); + } + + if (l11 > 9) { + if ((l11 > 15) && (l11 != 20) && (l11 != 26)) + person(); else { - if (l11 == 10) cpl10(p, h); - if (l11 == 11) cpl11(p, h); - if (l11 == 12) cpl12(p); - if ((l11 == 13) || (l11 == 14)) cpl13(p); - if ((l11 == 15) || (l11 == 26)) cpl15(p); - if (l11 == 20) cpl20(p, h); + if (l11 == 10) + cpl10(p, h); + if (l11 == 11) + cpl11(p, h); + if (l11 == 12) + cpl12(p); + if ((l11 == 13) || (l11 == 14)) + cpl13(p); + if ((l11 == 15) || (l11 == 26)) + cpl15(p); + if (l11 == 20) + cpl20(p, h); p = p + s.conf; haz = hazard(1, 100); if (haz > p) { person(); a = 0; } else { - if (l11 == 10) quelq10(h, p); - if (l11 == 11) quelq11(h, p); - if ((l11 == 12) || (l11 == 13) || (l11 == 14)) quelq12(p); - if ((l11 == 15) || (l11 == 26)) quelq15(p); - if (l11 == 20) quelq20(h, p); + if (l11 == 10) + quelq10(h, p); + if (l11 == 11) + quelq11(h, p); + if ((l11 == 12) || (l11 == 13) || (l11 == 14)) + quelq12(p); + if ((l11 == 15) || (l11 == 26)) + quelq15(p); + if (l11 == 20) + quelq20(h, p); a = p; } } + } } -void cavegre() - -{ +void cavegre() { int haz; /* debug('cavegre'); */ s.conf = s.conf + 2; - if (s.conf > 69) s.conf = s.conf + (s.conf / 10); + if (s.conf > 69) + s.conf += (s.conf / 10); clsf3(); ecrf2(); ecr3(g_vm->getString(S_SOMEONE_ENTERS)); haz = (hazard(0, 4)) - 2; parole(2, haz, 1); - for (haz = 0; haz <= 3000; haz ++); + + // Useless? + for (haz = 0; haz <= 3000; haz++); clsf3(); person(); } @@ -1183,15 +1332,21 @@ void messint(int nu) { } void aniof(int ouf, int num) { - int ad, offset; + if ((caff == 7) && ((num == 4) || (num == 5))) + return; + + if ((caff == 10) && (num == 7)) + num = 6; + + if (caff == 12) { + if (num == 3) + num = 4; + else if (num == 4) + num = 3; + } - /* debug('aniof'); */ - if ((caff == 7) && ((num == 4) || (num == 5))) return; - if ((caff == 10) && (num == 7)) num = 6; - if (caff == 12) if (num == 3) num = 4; - else if (num == 4) num = 3; - ad = adani; - offset = animof(ouf, num); + int ad = adani; + int offset = animof(ouf, num); GfxSurface surface; surface.decode(&mem[ad * 16 + offset]); @@ -1209,7 +1364,7 @@ void musique(int so) { ; } else if ((prebru == 0) && (! s.ipre)) { parole(10, 1, 1); - prebru = prebru + 1; + ++prebru; } else { i = false; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) { @@ -1247,15 +1402,13 @@ void musique(int so) { /* NIVEAU 9 */ void dessin(int ad) { - int cx; - - /* debug('dessin'); */ - if (ad != 0) dessine(ades, ((ad % 160) * 2), (ad / 160)); + if (ad != 0) + dessine(ades, ((ad % 160) * 2), (ad / 160)); else { clsf1(); if (caff > 99) { dessine(ades, 60, 33); - g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); /* cadre moyen */ //Translation: Medium box + g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (caff > 69) { dessine(ades, 112, 48); /* tˆtes */ //Translation: Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); @@ -1263,17 +1416,30 @@ void dessin(int ad) { dessine(ades, 0, 12); ecrf1(); if ((caff < 30) || (caff > 32)) { - for (cx = 1; cx <= 6; cx ++) - if (ord(touv[cx]) != 0) aniof(1, ord(touv[cx])); + for (int cx = 1; cx <= 6; cx ++) { + if (ord(touv[cx]) != 0) + aniof(1, ord(touv[cx])); + } + if (caff == 13) { - if (s.iboul == 141) aniof(1, 7); - if (s.ibag == 159) aniof(1, 6); + if (s.iboul == 141) + aniof(1, 7); + + if (s.ibag == 159) + aniof(1, 6); } - if ((caff == 14) && (s.icave == 151)) aniof(1, 2); - if ((caff == 17) && (s.ivier == 143)) aniof(1, 1); - if ((caff == 24) && (s.ipuit != 0)) aniof(1, 1); + if ((caff == 14) && (s.icave == 151)) + aniof(1, 2); + + if ((caff == 17) && (s.ivier == 143)) + aniof(1, 1); + + if ((caff == 24) && (s.ipuit != 0)) + aniof(1, 1); } - if (caff < 26) musique(1); + + if (caff < 26) + musique(1); } } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 15d413d119..73259aa7a0 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -62,8 +62,9 @@ void tinke() { jou = j; cx = 0; do { - cx = cx + 1; - if (nbrepm[cx] != 0) nbrepm[cx] = nbrepm[cx] - 1; + ++cx; + if (nbrepm[cx] != 0) + --nbrepm[cx]; nbrep[cx] = 0; } while (!(cx == 8)); } @@ -72,9 +73,15 @@ void tinke() { min = 0; pendule(); cf = 0; - for (cx = 1; cx <= 10; cx ++) if (s.pourc[cx] == '*') cf = cf + 1; - if (cf == 10) stpo = "10"; - else stpo = chr(cf + 48); + for (cx = 1; cx <= 10; cx ++) { + if (s.pourc[cx] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); stpou = Common::String(d3); stpou += d5; @@ -93,14 +100,21 @@ void tinke() { min = 30; pendule(); } - if (y_s < 12) return; + if (y_s < 12) + return; + if (! blo) { if ((h == 12) || ((h > 18) && (h < 21)) || ((h >= 0) && (h < 7))) t = ti2; - else t = ti1; + else + t = ti1; cf = s.conf; - if ((cf > 33) && (cf < 66)) t = t - (t / 3); - if (cf > 65) t = t - ((t / 3) * 2); + if ((cf > 33) && (cf < 66)) + t = t - (t / 3); + + if (cf > 65) + t = t - ((t / 3) * 2); + nh = readclock(); if ((nh - mh) > t) { am = g_vm->_menu._menuActive; @@ -146,9 +160,12 @@ void tinke() { pl20(cf); break; } - if ((mpers != 0) && (ipers != 10)) mpers = ipers; + if ((mpers != 0) && (ipers != 10)) + mpers = ipers; + if ((mpers == 0) && (ipers > 0)) - if ((s.mlieu == 13) || (s.mlieu == 14)) cavegre(); + if ((s.mlieu == 13) || (s.mlieu == 14)) + cavegre(); else if (ipers == 10) { ipers = 0; if (! brt) { @@ -174,7 +191,8 @@ void tinke() { nouvp(li, cx); brt = false; hdb = 0; - if ((s.mlieu > 0) && (s.mlieu < 10)) anyone = true; + if ((s.mlieu > 0) && (s.mlieu < 10)) + anyone = true; } } @@ -209,14 +227,18 @@ void tkey1(bool d) { hideMouse(); fenat('K'); - while (keypressed()) key = testou(); + while (keypressed()) + key = testou(); + do { - if (d) tinke(); + if (d) + tinke(); quest = keypressed(); getMousePos(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); - if (quest) key = testou(); + if (quest) + key = testou(); g_vm->setMouseClick(false); showMouse(); } @@ -227,18 +249,21 @@ void tmlieu(int mli) { char st[1410]; - if (mli == 26) mli = 15; + if (mli == 26) + mli = 15; + i = 1; while ((i < 8) && (v_lieu[i][mli] != 0)) { cx = v_lieu[i][mli]; deline(cx + c_tmlieu, st, tail); nomp = delig; - while (nomp.size() < 20) nomp = nomp + ' '; + while (nomp.size() < 20) + nomp += ' '; g_vm->_menu.menut(g_vm->_menu._depl[i], nomp); - i = i + 1; + ++i; } nomp = "* "; - for (cx = 7; cx >= i; cx --) + for (cx = 7; cx >= i; cx--) g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); } @@ -267,9 +292,7 @@ void affrep() { crep = s.mlieu; } -void mfouen() - -{ +void mfouen() { int cx; tmlieu(s.mlieu); @@ -304,12 +327,16 @@ void tperd() { } void tsort() { - int cx; - if ((iouv > 0) && (s.mlieu != 0)) - if (s.conf < 50) s.conf = s.conf + 2; - else s.conf = s.conf + (s.conf / 10); - for (cx = 1; cx <= 7; cx ++) touv[cx] = chr(0); + if ((iouv > 0) && (s.mlieu != 0)) { + if (s.conf < 50) + s.conf += 2; + else + s.conf += (s.conf / 10); + } + + for (int cx = 1; cx <= 7; cx ++) + touv[cx] = chr(0); ment = 0; iouv = 0; mchai = 0; @@ -318,6 +345,7 @@ void tsort() { void st4(int ob) { crep = 997; + switch (ob) { case 114 : crep = 109; @@ -340,6 +368,8 @@ void st4(int ob) { case 161 : tlu(caff, ob); break; + default: + break; } } @@ -347,8 +377,11 @@ void cherjer(int ob, bool &d) { int cx; d = false; - for (cx = 1; cx <= 6; cx ++) d = (d || (ord(s.sjer[cx]) == ob)); - if (s.derobj == ob) d = true; + for (cx = 1; cx <= 6; cx++) + d = (d || (ord(s.sjer[cx]) == ob)); + + if (s.derobj == ob) + d = true; } void st1sama() { @@ -357,12 +390,12 @@ void st1sama() { } void modinv() { - int cx, cy, tay, r; + int tay, r; char nom[1410]; Common::String nomp; - cy = 0; - for (cx = 1; cx <= 6; cx ++) + int cy = 0; + for (int cx = 1; cx <= 6; cx++) if (s.sjer[cx] != chr(0)) { cy = succ(int, cy); r = (ord(s.sjer[cx]) + 400); @@ -372,7 +405,7 @@ void modinv() { g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); } if (cy < 6) - for (cx = cy + 1; cx <= 6; cx ++) { + for (int cx = cy + 1; cx <= 6; cx++) { g_vm->_menu.menut(g_vm->_menu._invt[cx], " "); g_vm->_menu.disableMenuItem(g_vm->_menu._invt[cx]); } @@ -408,11 +441,10 @@ void finfouil() { } void mfoudi() { - int cx; - - for (cx = 1; cx <= 7; cx ++) + for (int cx = 1; cx <= 7; cx++) g_vm->_menu.disableMenuItem(g_vm->_menu._depl[cx]); - for (cx = 1; cx <= 11; cx ++) + + for (int cx = 1; cx <= 11; cx++) g_vm->_menu.disableMenuItem(men[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); @@ -430,45 +462,47 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - int cx, cy, lderobj; - cy = (acha + pred(int, pred(int, mchai) * 10)); - cx = 0; + int cy = (acha + pred(int, pred(int, mchai) * 10)); + int cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 9) || (tabdon[cy + cx] == 0))); + if (tabdon[cy + cx] == 0) { - lderobj = s.derobj; + int lderobj = s.derobj; tabdon[cy + cx] = lderobj; - } else crep = 192; + } else + crep = 192; } void ajjer(int ob) { - int cx; - - cx = 0; + int cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 5) || (ord(s.sjer[cx]) == 0))); + if (ord(s.sjer[cx]) == 0) { s.sjer[(cx)] = chr(ob); modinv(); - } else crep = 139; + } else + crep = 139; } -void t1sama() { /* On entre dans le manoir */ //Translation: Entering manor +void t1sama() { //Entering manor int j, h, m; bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { cherjer(137, d); - if (! d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late + if (!d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late crep = 1511; tperd(); - } else st1sama(); - } else if (! s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? + } else + st1sama(); + } else if (!s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? ipers = 255; affper(ipers); caff = 77; @@ -487,12 +521,14 @@ void t1sama() { /* On entre dans le manoir */ //Translation: s.mlieu = 0; affrep(); t5(10); - if (! blo) t11(0, m); + if (! blo) + t11(0, m); ipers = 0; mpers = 0; s.ipre = true; /*chech;*/ - } else st1sama(); + } else + st1sama(); } void t1vier() { @@ -501,7 +537,7 @@ void t1vier() { } void t1neig() { - inei = inei + 1; + ++inei; if (inei > 2) { crep = 1506; tperd(); @@ -543,20 +579,26 @@ void quelquun() { crep = 997; L1: if (! cache) { - if (crep == 997) crep = 138; + if (crep == 997) + crep = 138; repon(2, crep); - if (crep == 138) parole(5, 2, 1); - else parole(4, 4, 1); - if (iouv == 0) s.conf = s.conf + 2; - else if (s.conf < 50) s.conf = s.conf + 4; + if (crep == 138) + parole(5, 2, 1); else - s.conf = s.conf + (3 * (s.conf / 10)); + parole(4, 4, 1); + + if (iouv == 0) + s.conf += 2; + else if (s.conf < 50) + s.conf += 4; + else + s.conf += 3 * (s.conf / 10); tsort(); tmlieu(15); tip(ipers, cx); caff = 69 + cx; crep = caff; - msg[3] = discut; + msg[3] = MENU_DISCUSS; msg[4] = g_vm->_menu._disc[cx]; syn = true; col = true; @@ -581,35 +623,39 @@ L1: } void tsuiv() { - int cx, tbcl; - int cl, cy; + int tbcl; + int cl; - cy = acha + ((mchai - 1) * 10) - 1; - cx = 0; + int cy = acha + ((mchai - 1) * 10) - 1; + int cx = 0; do { cx = cx + 1; cs = cs + 1; cl = cy + cs; tbcl = tabdon[cl]; } while (!((tbcl != 0) || (cs > 9))); + if ((tbcl != 0) && (cs < 11)) { is = is + 1; caff = tbcl; crep = caff + 400; - if (ipers != 0) s.conf = s.conf + 2; + if (ipers != 0) + s.conf = s.conf + 2; } else { affrep(); finfouil(); - if (cx > 9) crep = 131; + if (cx > 9) + crep = 131; } } void tfleche() { bool qust; char touch; - int dummy; - if (num == 9999) return; + if (num == 9999) + return; + fenat(chr(152)); rect = false; do { @@ -624,19 +670,20 @@ void tfleche() { tinke(); } while (!(qust || rect || anyone)); - if (qust && (touch == '\103')) dummy = Alert::show(stpou, 1); - } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || - (anyone) || (rect))); - if (touch == '\73') iesc = true; + if (qust && (touch == '\103')) + Alert::show(stpou, 1); + } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); + + if (touch == '\73') + iesc = true; + if (rect) { x = x_s; y = y_s; } } -void tcoord(int sx) - -{ +void tcoord(int sx) { int sy, ix, iy, cb, cy, ib; int a, b, atdon; @@ -647,50 +694,65 @@ void tcoord(int sx) atdon = amzon + 3; cy = 0; while (cy < caff) { - a = a + tabdon[atdon]; - atdon = atdon + 4; + a += tabdon[atdon]; + atdon += 4; cy = succ(int, cy); } b = tabdon[atdon]; - if (b == 0) goto L1; - a = a + fleche; + if (b == 0) + goto L1; + a += fleche; cb = 0; - for (cy = 0; cy <= (sx - 2); cy ++) { + for (cy = 0; cy <= (sx - 2); cy++) { ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; - cb = cb + (ib * 4) + 2; + cb += (ib * 4) + 2; } ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; - if (ib == 0) goto L1; + if (ib == 0) + goto L1; + cy = 1; do { - cb = cb + 2; + cb += 2; sx = tabdon[a + cb] * res; sy = tabdon[succ(int, a + cb)]; - cb = cb + 2; + cb += 2; ix = tabdon[a + cb] * res; iy = tabdon[succ(int, a + cb)]; - cy = cy + 1; - } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) - || (cy > ib))); - if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) + ++cy; + } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); - { + if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) { num = cy - 1; return; } + L1: crep = 997; } void st7(int ob) { - crep = 183; - if ((ob == 116) || (ob == 144)) crep = 104; - if ((ob == 126) || (ob == 111)) crep = 108; - if (ob == 132) crep = 111; - if (ob == 142) crep = 112; - if (crep == 183) st4(ob); + switch (ob) { + case 116: + case 144: + crep = 104; + break; + case 126: + case 111: + crep = 108; + break; + case 132: + crep = 111; + break; + case 142: + crep = 112; + break; + default: + crep = 183; + st4(ob); + } } void treg(int ob) { @@ -698,11 +760,12 @@ void treg(int ob) { mdes = caff; caff = ob; - if (((caff > 29) && (caff < 33)) || (caff == 144) || - (caff == 147) || (caff == 149) || (msg[4] == sregarder)) { + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == sregarder)) { afdes(0); - if ((caff > 29) && (caff < 33)) repon(2, caff); - else repon(2, (caff + 400)); + if ((caff > 29) && (caff < 33)) + repon(2, caff); + else + repon(2, (caff + 400)); tkey1(true); caff = mdes; msg[3] = 0; @@ -716,7 +779,8 @@ void treg(int ob) { void avpoing(int &ob) { crep = 999; - if (s.derobj != 0) ajjer(s.derobj); + if (s.derobj != 0) + ajjer(s.derobj); if (crep != 139) { modobj(ob + 400); s.derobj = ob; @@ -728,7 +792,8 @@ void rechai(int &ch) { int cx; cx = s.mlieu; - if (s.mlieu == 16) cx = 14; + if (s.mlieu == 16) + cx = 14; ch = tabdon[achai + (cx * 7) + pred(int, num)]; } @@ -737,7 +802,7 @@ void t23coul(int &l) { cherjer(143, d); l = 14; - if (! d) { + if (!d) { crep = 1512; tperd(); } @@ -750,17 +815,17 @@ void maivid() { void st13(int ob) { if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || - (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || - (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || - (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || - (ob == 150) || (ob == 152)) crep = 999; - else crep = 105; + (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || + (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || + (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || + (ob == 150) || (ob == 152)) + crep = 999; + else + crep = 105; } void aldepl() { - int dummy; - - dummy = Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); + Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4f2cadef74..82b8ad37fd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -129,6 +129,11 @@ void deline(int num, char *l , int &tl) { byte ps, k; bool the_end; + if (num < 0) { + warning("deline: num < 0! Skipping"); + return; + } + /* DETEX */ /*debug(' => DeLine');*/ delig = ""; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 2ee26a9392..f478fc0d39 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -163,7 +163,8 @@ void tsitu() } if (msg[3] == MENU_MOVE) fctMove(); - if (msg[3] == discut) tparler(); //Translation: talk + if (msg[3] == MENU_DISCUSS) + fctDiscuss(); if (msg[3] == invent) tsprendre(); //Translation: inventory/take if (msg[4] == OPCODE_ATTACH) fctAttach(); @@ -213,7 +214,8 @@ void tsitu() } if (msg[4] == sfouiller) tsfouiller();//Translation: search if (msg[4] == slire) tslire(); //Translation: read - if (msg[4] == sposer) tposer(); //Translation: put + if (msg[4] == OPCODE_PUT) + fctPut(); if (msg[4] == sregarder) tsregarder();//Translation: look cache = false; L1: diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 7a3249dee0..e8f9282df3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -136,11 +136,10 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, OPCODE_TURN = 0x315}; -enum verbs2 {OPCODE_HIDE_SELF = 0x401}; +enum verbs2 {OPCODE_HIDE_SELF = 0x401, OPCODE_PUT = 0x404}; const int sfouiller = 0x402; const int slire = 0x403; -const int sposer = 0x404; const int sregarder = 0x405; const int max_patt = 20; |