diff options
-rw-r--r-- | engines/mortevielle/mor.cpp | 74 | ||||
-rw-r--r-- | engines/mortevielle/mor2.cpp | 29 | ||||
-rw-r--r-- | engines/mortevielle/mouse.cpp | 41 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.cpp | 5 | ||||
-rw-r--r-- | engines/mortevielle/taffich.cpp | 15 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.cpp | 2 |
6 files changed, 80 insertions, 86 deletions
diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 12df21ea9c..d54312a97f 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -178,14 +178,10 @@ void ecrf2() { } void ecr2(Common::String str_) { - int tab; - - if (res == 1) - tab = 10; - else - tab = 6; + // Some dead code was present in the original: removed g_vm->_screenSurface.putxy(8, 177); int tlig = 59 + (res - 1) * 36; + if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { @@ -339,7 +335,6 @@ void repon(int f, int m) { Common::String str_; Common::String str1; Common::String tmpStr; - int i, xco, dx, caspe; if ((m > 499) && (m < 563)) { tmpStr = deline(m - 501 + c_st41); @@ -372,6 +367,7 @@ void repon(int f, int m) { } } if ((f == 6) || (f == 9)) { + int i; if (f == 6) i = 4; else @@ -389,6 +385,8 @@ void repon(int f, int m) { if (f == 7) { /* messint */ ecrf7(); tmpStr = deline(m); + + int xco, dx, caspe; if (res == 1) { xco = 252 - tmpStr.size() * 5; caspe = 100; @@ -516,7 +514,11 @@ void cpl1(int &p) { int j, h, m; calch(j, h, m); - if ((h > 7) || (h < 11)) + // The original uses an || instead of an &&, resulting + // in an always true condition. Based on the other tests, + // and on other scenes, we use an && instead. + // if ((h > 7) || (h < 11)) + if ((h > 7) && (h < 11)) p = 25; else if ((h > 10) && (h < 14)) p = 35; @@ -810,11 +812,10 @@ void quelq6(int l) { } void quelq10(int h, int &per) { - int min = 0, max = 0; - if ((h >= 0) && (h < 8)) chlm(per); else { + int min = 0, max = 0; if ((h > 7) && (h < 10)) { min = 5; max = 7; @@ -834,11 +835,10 @@ void quelq10(int h, int &per) { } void quelq11(int h, int &per) { - int min = 0, max = 0; - if ((h >= 0) && (h < 8)) chlm(per); else { + int min = 0, max = 0; if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { min = 1; max = 3; @@ -882,11 +882,10 @@ void quelq15(int &per) { } void quelq20(int h, int &per) { - int min = 0, max = 0; - if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); else { + int min = 0, max = 0; if ((h > 9) && (h < 12)) { min = 3; max = 7; @@ -904,13 +903,13 @@ void quelq20(int h, int &per) { void frap() { - int j, h, m, haz; + int j, h, m; calch(j, h, m); if ((h >= 0) && (h < 8)) crep = 190; else { - haz = hazard(1, 100); + int haz = hazard(1, 100); if (haz > 70) crep = 190; else @@ -993,10 +992,8 @@ void ecfren(int &p, int &haz, int cf, int l) { } void becfren(int l) { - int haz; - if ((l == 1) || (l == 4)) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (l == 1) if (haz == 1) bh1 = true; @@ -1092,11 +1089,11 @@ void dprog() { } void pl1(int cf) { - int p, haz; - if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { + int p, haz; cpl1(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1105,11 +1102,11 @@ void pl1(int cf) { } void pl2(int cf) { - int p, haz; - if (! bh2) { + int p, haz; cpl2(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1118,11 +1115,11 @@ void pl2(int cf) { } void pl5(int cf) { - int p, haz; - if (! bh5) { + int p, haz; cpl5(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1131,11 +1128,11 @@ void pl5(int cf) { } void pl6(int cf) { - int p, haz; - if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { + int p, haz; cpl6(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1144,11 +1141,11 @@ void pl6(int cf) { } void pl9(int cf) { - int p, haz; - if (! bh9) { cf = -10; + int p, haz; phaz(haz, p, cf); + if (haz > p) person(); else @@ -1158,9 +1155,9 @@ void pl9(int cf) { void pl10(int cf) { int p, h, haz; - cpl10(p, h); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1223,7 +1220,7 @@ void pl20(int cf) { } void t11(int l11, int &a) { - int p, haz, h = 0; + int p, haz; ecfren(p, haz, s.conf, l11); li = l11; @@ -1244,6 +1241,7 @@ void t11(int l11, int &a) { if ((l11 > 15) && (l11 != 20) && (l11 != 26)) person(); else { + int h = 0; if (l11 == 10) cpl10(p, h); if (l11 == 11) @@ -1312,6 +1310,7 @@ void writetp(Common::String s, int t) { */ void messint(int nu) { // Method is deprecated + warning("DEPRECATED: messint"); } void aniof(int ouf, int num) { @@ -1339,9 +1338,6 @@ void aniof(int ouf, int num) { } void musique(int so) { - bool i; - int haz; - if (so == 0) { /* musik(0) */ ; @@ -1349,9 +1345,9 @@ void musique(int so) { parole(10, 1, 1); ++prebru; } else { - i = false; + bool i = false; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) { - haz = hazard(1, 3); + int haz = hazard(1, 3); if (haz == 2) { haz = hazard(2, 4); parole(9, haz, 1); @@ -1359,14 +1355,14 @@ void musique(int so) { } } if (s.mlieu == 20) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (haz == 1) { parole(8, 1, 1); i = true; } } if (s.mlieu == 24) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (haz == 2) { parole(12, 1, 1); i = true; @@ -1377,7 +1373,7 @@ void musique(int so) { i = true; } if (! i) { - haz = hazard(1, 17); + int haz = hazard(1, 17); parole(haz, 1, 2); } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 2a80cecee1..ed5ed494eb 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -46,9 +46,8 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; Common::String d6 = g_vm->getEngineString(S_OK); - int cx, haz, nh, cf, j, h, m; + int cx, cf, j, h, m; Common::String stpo; - bool am; anyone = false; calch(j, h, m); @@ -109,9 +108,9 @@ void tinke() { if (cf > 65) t -= ((t / 3) * 2); - nh = readclock(); + int nh = readclock(); if ((nh - mh) > t) { - am = g_vm->_menu._menuActive; + bool activeMenu = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); jh += ((nh - mh) / t); mh = nh; @@ -165,7 +164,7 @@ void tinke() { if (! brt) { brt = true; hdb = readclock(); - haz = hazard(1, 5); + int haz = hazard(1, 5); if (haz < 5) { clsf3(); ecrf2(); @@ -176,7 +175,7 @@ void tinke() { } } } - if (am) + if (activeMenu) g_vm->_menu.drawMenu(); } } @@ -217,7 +216,6 @@ void afdes(int ad) { void tkey1(bool d) { bool quest; int x, y, c; - int key; hideMouse(); fenat('K'); @@ -232,7 +230,7 @@ void tkey1(bool d) { CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); if (quest) - key = testou(); + testou(); g_vm->setMouseClick(false); showMouse(); } @@ -288,15 +286,16 @@ void mfouen() { /* NIVEAU 6 */ void tperd() { - int cx; - initouv(); ment = 0; iouv = 0; mchai = 0; mfouen(); - if (!blo) + if (!blo) { + int cx; t11(21, cx); + } + g_vm->_loseGame = true; clsf1(); g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); @@ -469,10 +468,10 @@ void ajjer(int ob) { void t1sama() { //Entering manor int j, h, m; - bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { + bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late crep = 1511; @@ -548,10 +547,9 @@ void tctrm() { void quelquun() { - int haz, cx; - if (imen) g_vm->_menu.eraseMenu(); + finfouil(); crep = 997; L1: @@ -572,6 +570,7 @@ L1: s.conf += 3 * (s.conf / 10); tsort(); tmlieu(15); + int cx; tip(ipers, cx); caff = 69 + cx; crep = caff; @@ -580,7 +579,7 @@ L1: syn = true; col = true; } else { - haz = hazard(1, 3); + int haz = hazard(1, 3); if (haz == 2) { cache = false; crep = 137; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e7da3c3074..d607b0597b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -82,16 +82,13 @@ void initMouse() { * @remarks Originally called 'hide_mouse' */ void hideMouse() { - int i, j, k, ps;; - bool imp; - --mouse_shwn; if (mouse_shwn == 0) { - imp = odd(y_s); - j = p_o_s; + bool imp = odd(y_s); + int j = p_o_s; switch (_currGraphicalDevice) { - case MODE_CGA: - k = 0; + case MODE_CGA: { + int k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { WRITE_LE_UINT16(&mem[0xb000 * 16 + j], s_s[0][k]); @@ -101,11 +98,12 @@ void hideMouse() { j += 80; ++k; } while (k < 5); + } break; case MODE_AMSTRAD1512: - for (i = 0; i <= 3; ++i) { + for (int i = 0; i <= 3; ++i) { port[0x3dd] = 1 << i; - k = 0; + int k = 0; j = p_o_s; do { if (imp) { @@ -120,45 +118,50 @@ void hideMouse() { } while (k < 8); } break; - case MODE_EGA: + case MODE_EGA: { port[0x3c4] = 2; port[0x3ce] = 8; port[0x3cf] = 255; - i = 0; + int i = 0; do { port[0x3c5] = 1 << i; - k = 0; + int k = 0; j = p_o_s; do { - ps = mem[0xa000 * 16 + j]; + // Useless ? + // ps = mem[0xa000 * 16 + j]; mem[0xa000 * 16 + j] = lo(s_s[i][k]); - ps = mem[0xa000 * 16 + j + 1]; + + // Useless ?? + // ps = mem[0xa000 * 16 + j + 1]; mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; } while (k < 8); ++i; } while (i != 4); + } break; case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; ++i) { - for (k = 0; k <= 3; ++k) + for (int i = 0; i <= 5; ++i) { + for (int k = 0; k <= 3; ++k) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } break; - case MODE_TANDY: + case MODE_TANDY: { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); - k = 0; + int k = 0; do { - for (i = 0; i <= 3; ++i) { + for (int i = 0; i <= 3; ++i) { WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; ++k; } while (k != 3); + } break; default: break; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 1ea8d509ed..e1374d4f04 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -172,9 +172,6 @@ void music() { Common::File fic; int k; bool fin; - char ch; -// float x, y; - /* debug('o3 music'); */ if (_soundOff) @@ -202,7 +199,7 @@ void music() { fin = fin | keypressed() | (k >= 5); } while (!fin); while (keypressed()) - ch = get_ch(); // input >> kbd >> ch; + get_ch(); // input >> kbd >> ch; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 52ed011604..82abc27989 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -95,9 +95,8 @@ void taffich() { byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> - int i, m, cx, handle, npal; + int cx, handle, npal; int32 lgt; - int palh, k, j; int alllum[16]; @@ -154,7 +153,7 @@ void taffich() { Common::String filename; if ((a != 50) && (a != 51)) { - m = a + 2000; + int m = a + 2000; if ((m > 2001) && (m < 2010)) m = 2001; if (m == 2011) @@ -209,13 +208,13 @@ void taffich() { } chardes(filename, lgt, handle); if (_currGraphicalDevice == MODE_HERCULES) { - for (i = 0; i <= 15; ++i) { - palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); + for (int i = 0; i <= 15; ++i) { + int palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } - for (i = 0; i <= 15; ++i) { - k = 0; - for (j = 0; j <= 15; ++j) + for (int i = 0; i <= 15; ++i) { + int k = 0; + for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; mem[(0x7000 * 16) + 2 + (k << 1)] = rang[i]; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index d63d9aa808..42fab06f7c 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -231,7 +231,7 @@ Common::String copy(const Common::String &s, int idx, size_t size) { tmp[size] = '\0'; Common::String result(tmp); - delete tmp; + delete[] tmp; return result; } |