diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mortevielle/dialogs.cpp | 12 | ||||
-rw-r--r-- | engines/mortevielle/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/mortevielle/keyboard.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/level15.cpp | 54 | ||||
-rw-r--r-- | engines/mortevielle/menu.cpp | 87 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/mouse.cpp | 18 | ||||
-rw-r--r-- | engines/mortevielle/outtext.cpp | 141 | ||||
-rw-r--r-- | engines/mortevielle/outtext.h | 2 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.cpp | 32 | ||||
-rw-r--r-- | engines/mortevielle/parole.cpp | 231 | ||||
-rw-r--r-- | engines/mortevielle/parole2.cpp | 41 | ||||
-rw-r--r-- | engines/mortevielle/prog.cpp | 51 | ||||
-rw-r--r-- | engines/mortevielle/saveload.cpp | 5 | ||||
-rw-r--r-- | engines/mortevielle/taffich.cpp | 27 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.h | 2 |
17 files changed, 378 insertions, 335 deletions
diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 89658452e8..9f90f4c48a 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -258,7 +258,7 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String i = 1; x = coldep; - for (l = 1; l <= nbcase; l ++) { + for (l = 1; l <= nbcase; ++l) { str[l] = ""; do { ++i; @@ -323,7 +323,7 @@ bool Ques::show() { y = 35; tmax = 0; memk = 1; - for (j = prem; j <= der; j ++) { + for (j = prem; j <= der; ++j) { deline(j, st, tay); if (tay > tmax) tmax = tay; @@ -332,7 +332,7 @@ bool Ques::show() { ++memk; y += 8; } - for (j = 1; j <= succ(int, der - prem); j++) { + for (j = 1; j <= succ(int, der - prem); ++j) { rectangle &with = coor[j]; with.x1 = 45 * res; @@ -364,7 +364,7 @@ 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 ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[memk][j]; strncpy(st, chaines[memk].c_str(), tmax); // @@ -372,7 +372,7 @@ bool Ques::show() { afftex(st, 100, 27 + memk * 8, 100, 1, 0); } if (memk != k) { -// for (j = 1; j <= tmax; j ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[k][j]; strncpy(st, chaines[k].c_str(), tmax); st[1 + tmax] = '$'; @@ -380,7 +380,7 @@ bool Ques::show() { memk = k; } } else if (memk != 0) { -// for (j = 1; j <= tmax; j ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[memk][j]; strncpy(st, chaines[memk].c_str(), tmax); st[1 + tmax] = '$'; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e26901bc8e..acc2bb0d34 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -45,11 +45,11 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { byte egaPalette[64 * 3]; byte *p = &egaPalette[0]; - for (int i = 0; i < 64; i++) { + for (int i = 0; i < 64; ++i) { *p++ = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; *p++ = (i >> 1 & 1) * 0xaa + (i >> 4 & 1) * 0x55; *p++ = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; - } + } // Loop through setting palette colours based on the passed indexes for (; size > 0; --size, ++idx) { diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index abf8c26346..bd7ad2c8aa 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -42,7 +42,7 @@ int testou() { switch (ch) { case '\23' : - sonoff = !sonoff; + _soundOff = !_soundOff; break; case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 571abfa18d..d297529470 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -47,54 +47,47 @@ void copcha() { bool dans_rect(rectangle r) { int x, y, c; - bool dans_rect_result; getMousePos(x, y, c); - if ((x > r.x1) && - (x < r.x2) && - (y > r.y1) && - (y < r.y2)) - dans_rect_result = true; - else - dans_rect_result = false; - - return dans_rect_result; + if ((x > r.x1) && (x < r.x2) && (y > r.y1) && (y < r.y2)) + return true; + + return false; } void outbloc(int n, pattern p, t_nhom pal) { - int i, j, ad; - - ad = n * 404 + 0xd700; + int 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 ++) + ad += 4; + for (int i = 1; i <= p.tax; ++i) + for (int 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++) { + case ams: + for (int 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; } break; - case cga : { + 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++) + + for (int i = 0; i <= 15; ++i) outbloc(i, tpt[pal[i].n], pal); - } - break; + break; + default: + break; } } @@ -107,8 +100,10 @@ void pictout(int seg, int dep, int x, int y) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } + if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); + g_vm->_screenSurface.drawPicture(surface, x, y); } @@ -129,16 +124,19 @@ void adzon() { if (!f.open("don.mor")) error("Missing file - don.mor"); + f.read(tabdon, 7 * 256); f.close(); if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); + f.read(&tabdon[fleche], 1 * 1916); f.close(); if (!f.open("dec.mor")) error("Missing file - dec.mor"); + f.read(&mem[0x73a2 * 16 + 0], 1 * 1664); f.close(); } @@ -147,14 +145,12 @@ void adzon() { * Returns the offset within the compressed image data resource of the desired image */ int animof(int ouf, int num) { - int nani, aux; - - int animof_result; - nani = mem[adani * 16 + 1]; - aux = num; + int nani = mem[adani * 16 + 1]; + int aux = num; if (ouf != 1) aux += nani; - animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); + + int 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 97ba083d77..b585177f19 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,9 +48,9 @@ void Menu::menut(int no, Common::String nom) { byte l = lo(no); Common::String s = nom; - if (! tesok) { + if (! tesok) g_vm->quitGame(); - } + while (s.size() < 20) s += ' '; @@ -74,6 +74,8 @@ void Menu::menut(int no, Common::String nom) { case MENU_DISCUSS: _dis[l] = s; break; + default: + break; } } @@ -86,14 +88,13 @@ void Menu::disableMenuItem(int no) { byte l = lo(no); switch (h) { - case invent : { + case invent: if (l > 6) { _inv[l].setChar('<', 0); _inv[l].setChar('>', 21); } else _inv[l].setChar('*', 0); - } - break; + break; case MENU_MOVE: _dep[l].setChar('*', 0); break; @@ -106,6 +107,8 @@ void Menu::disableMenuItem(int no) { case MENU_DISCUSS: _dis[l].setChar('*', 0); break; + default: + break; } } @@ -135,6 +138,8 @@ void Menu::enableMenuItem(int no) { case MENU_DISCUSS: _dis[l].setChar(' ', 0); break; + default: + break; } } @@ -161,7 +166,7 @@ void Menu::menu_aff() { x = col; do { // One line after the other msk = 0x80; - for (pt = 0; pt <= 7; pt ++) { + for (pt = 0; pt <= 7; ++pt) { if ((lettres[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); @@ -201,30 +206,30 @@ void Menu::invers(int ix) { g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { - case 1 : + case 1: s = _inv[lo(msg4)]; break; - case 2 : + case 2: s = _dep[lo(msg4)]; break; - case 3 : + case 3: s = _act[lo(msg4)]; break; - case 4 : + case 4: s = _self[lo(msg4)]; break; - case 5 : + case 5: s = _dis[lo(msg4)]; break; - case 6 : + case 6: s = g_vm->getString(S_SAVE_LOAD + lo(msg4)); break; - case 7 : + case 7: s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + lo(msg4)); break; - case 8 : + case 8: if (lo(msg4) == 1) { s = g_vm->getString(S_RESTART); } else { @@ -233,6 +238,8 @@ void Menu::invers(int ix) { s += (char)(47 + lo(msg4)); } break; + default: + break; } if ((s[0] != '*') && (s[0] != '<')) g_vm->_screenSurface.writeg(s, ix); @@ -241,17 +248,17 @@ void Menu::invers(int ix) { } void Menu::util(int x, int y) { - int ymx, dxcar, xmn, xmx, ix; - /* debug('util'); */ - ymx = (don[msg3][4] << 3) + 16; - dxcar = don[msg3][3]; - xmn = (don[msg3][1] << 2) * res; + int ymx = (don[msg3][4] << 3) + 16; + int dxcar = don[msg3][3]; + int xmn = (don[msg3][1] << 2) * res; + + int ix; if (res == 1) ix = 5; else ix = 3; - xmx = dxcar * ix * res + xmn + 2; + int xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); if (ix != msg4) { @@ -296,37 +303,37 @@ void Menu::menuDown(int ii) { do { cx = succ(int, cx); switch (ii) { - case 1 : + case 1: if (_inv[cx][0] != '*') g_vm->_screenSurface.writeg(_inv[cx], 4); break; - case 2 : + case 2: if (_dep[cx][0] != '*') g_vm->_screenSurface.writeg(_dep[cx], 4); break; - case 3 : + case 3: if (_act[cx][0] != '*') g_vm->_screenSurface.writeg(_act[cx], 4); break; - case 4 : + case 4: if (_self[cx][0] != '*') g_vm->_screenSurface.writeg(_self[cx], 4); break; - case 5 : + case 5: if (_dis[cx][0] != '*') g_vm->_screenSurface.writeg(_dis[cx], 4); break; - case 6 : + case 6: g_vm->_screenSurface.writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); break; - case 7 : { + case 7: { Common::String s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); g_vm->_screenSurface.writeg(s, 4); + } break; - } - case 8 : + case 8: if (cx == 1) g_vm->_screenSurface.writeg(g_vm->getString(S_RESTART), 4); else { @@ -336,6 +343,8 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.writeg(s, 4); } break; + default: + break; } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (!(cx == nb_lig)); @@ -397,12 +406,14 @@ void Menu::mdn() { xprec = x; yprec = y; } - tes = (y < 11) && ((x >= (28 * res) && x <= (28 * res + 24)) - || (x >= (76 * res) && x <= (76 * res + 24)) - || ((x > 124 * res) && (x < 124 * res + 24)) - || ((x > 172 * res) && (x < 172 * res + 24)) - || ((x > 220 * res) && (x < 220 * res + 24)) - || ((x > 268 * res) && (x < 268 * res + 24))); + + tes = (y < 11) + && ((x >= (28 * res) && x <= (28 * res + 24)) + || (x >= (76 * res) && x <= (76 * res + 24)) + || ((x > 124 * res) && (x < 124 * res + 24)) + || ((x > 172 * res) && (x < 172 * res + 24)) + || ((x > 220 * res) && (x < 220 * res + 24)) + || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { if (x < 76 * res) ix = invent; @@ -468,10 +479,10 @@ void Menu::initMenu() { // Ask to swap floppy dem2(); - for (i = 1; i <= 8; i ++) + for (i = 1; i <= 8; ++i) _inv[i] = "* "; _inv[7] = "< -*-*-*-*-*-*-*-*-*- "; - for (i = 1; i <= 7; i ++) + for (i = 1; i <= 7; ++i) _dep[i] = "* "; i = 1; do { @@ -492,7 +503,7 @@ void Menu::initMenu() { } i = succ(int, i); } while (!(i == 22)); - for (i = 1; i <= 8; i ++) { + for (i = 1; i <= 8; ++i) { _disc[i] = 0x500 + i; if (i < 8) _depl[i] = 0x200 + i; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 82eb1179f1..4112073cde 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -148,7 +148,7 @@ Common::ErrorCode MortevielleEngine::initialise() { initMouse(); init_lieu(); - sonoff = false; + _soundOff = false; f2_all = false; teskbd(); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d724fe652b..44b254fe41 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -103,7 +103,7 @@ void hideMouse() { } while (!(k >= 5)); break; case ams: - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { port[0x3dd] = 1 << i; k = 0; j = p_o_s; @@ -142,8 +142,8 @@ void hideMouse() { break; case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) + for (i = 0; i <= 5; ++i) { + for (k = 0; k <= 3; ++k) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } @@ -152,7 +152,7 @@ void hideMouse() { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { - for (i = 0; i <= 3; i ++) { + for (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)]); } @@ -194,7 +194,7 @@ void showMouse() { } while (!(k >= 5)); break; case ams: - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { j = p_o_s; imp = odd(y_s); port[0x3de] = i; @@ -229,8 +229,8 @@ void showMouse() { break; case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) + for (i = 0; i <= 5; ++i) { + for (k = 0; k <= 3; ++k) s_s[i][k] = READ_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j]); j += 80; } @@ -239,7 +239,7 @@ void showMouse() { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]); s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); } @@ -415,7 +415,7 @@ void moveMouse(bool &funct, char &key) { cy = 8; break; case '\23': - sonoff = !sonoff; + _soundOff = !_soundOff; return; break; case '\26': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 82b8ad37fd..95ccc3baef 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -79,44 +79,47 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { oct = t_mot[idx]; oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { - idx = idx + 1; + ++idx; oct = oct << (5 - pt); - pt = pt + 11; + pt += 11; oct = oct | ((uint)t_mot[idx] >> pt); } else { - pt = pt - 5; + pt -= 5; oct = (uint)oct >> pt; } switch (oct) { - case 11 : { + case 11: c = '$'; the_end = true; - } - break; + break; case 30: - case 31 : { + case 31: ocd = t_mot[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { - idx = idx + 1; + ++idx; ocd = ocd << (5 - pt); - pt = pt + 11; + pt += 11; ocd = ocd | ((uint)t_mot[idx] >> pt); } else { - pt = pt - 5; + pt -= 5; ocd = (uint)ocd >> pt; } - if (oct == 30) c = chr(tab30[ocd]); - else c = chr(tab31[ocd]); + + if (oct == 30) + c = chr(tab30[ocd]); + else + c = chr(tab31[ocd]); + if (c == '\0') { the_end = true; c = '#'; } - } - break; + break; default: c = chr(tabdr[oct]); + break; } } /* 5-8 */ @@ -124,94 +127,88 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { * Decode and extract the line with the given Id */ void deline(int num, char *l , int &tl) { - int i, j, ts; - char let; - byte ps, k; - bool the_end; - if (num < 0) { warning("deline: num < 0! Skipping"); return; } - /* DETEX */ - /*debug(' => DeLine');*/ + // DETEX delig = ""; - ts = t_rec[num].indis; - ps = t_rec[num].point; - i = ts; + int ts = t_rec[num].indis; + byte ps = t_rec[num].point; + int i = ts; tl = 1; - j = 1; - k = ps; - the_end = false; + int j = 1; + byte k = ps; + bool endFl = false; + char let; do { - cinq_huit(let, i, k, the_end); + cinq_huit(let, i, k, endFl); l[j] = let; - if (j < 254) delig = delig + let; - j = j + 1; - } while (!the_end); + if (j < 254) + delig += let; + ++j; + } while (!endFl); tl = j - 1; if (tl < 255) - delig.deleteLastChar(); // Remove trailing '$' -} /* DETEX */ + // Remove trailing '$' + delig.deleteLastChar(); +} void afftex(char *ch, int x, int y, int dx, int dy, int typ); static int l_motsuiv(int p, char *ch, int &tab) { - int c; + int c = p; - int l_motsuiv_result; - c = p; while ((ch[p] != ' ') && (ch[p] != '$') && (ch[p] != '@')) ++p; - l_motsuiv_result = tab * (p - c); - return l_motsuiv_result; + + return tab * (p - c); } void afftex(char *ch, int x, int y, int dx, int dy, int typ) { bool the_end; - int xf, yf; - int xc, yc; - int tab, p; + int tab; Common::String s; int i, j; /* debug(' .. Afftex');*/ g_vm->_screenSurface.putxy(x, y); - if (res == 1) tab = 10; - else tab = 6; - dx = dx * 6; - dy = dy * 6; - xc = x; - yc = y; - xf = x + dx; - yf = y + dy; - p = 1; + if (res == 1) + tab = 10; + else + tab = 6; + dx *= 6; + dy *= 6; + int xc = x; + int yc = y; + int xf = x + dx; + int yf = y + dy; + int p = 1; the_end = (ch[p] == '$'); s = ""; - while (! the_end) { + while (!the_end) { switch (ch[p]) { - case '@' : { + case '@': g_vm->_screenSurface.writeg(s, typ); s = ""; - p = p + 1; + ++p; xc = x; - yc = yc + 6; + yc += 6; g_vm->_screenSurface.putxy(xc, yc); - } - break; - case ' ' : { - s = s + ' '; - xc = xc + tab; - p = p + 1; + break; + case ' ': + s += ' '; + xc += tab; + ++p; if (l_motsuiv(p, ch, tab) + xc > xf) { g_vm->_screenSurface.writeg(s, typ); s = ""; xc = x; - yc = yc + 6; + yc += 6; if (yc > yf) { do { ; @@ -222,26 +219,24 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { do { g_vm->_screenSurface.putxy(j, i); g_vm->_screenSurface.writeg(" ", 0); - j = j + 6; + j += 6; } while (!(j > xf)); - i = i + 6; + i += 6; } while (!(i > yf)); yc = y; } g_vm->_screenSurface.putxy(xc, yc); } - } - break; - case '$' : { + break; + case '$': the_end = true; g_vm->_screenSurface.writeg(s, typ); - } - break; - default: { - s = s + ch[p]; - p = p + 1; - xc = xc + tab; - } + break; + default: + s += ch[p]; + ++p; + xc += tab; + break; } /* case */ } } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index ad69ca9109..470479a81b 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -34,9 +34,7 @@ namespace Mortevielle { extern Common::String delig; -//static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); extern void deline(int num , char *l , int &tl); -//static int l_motsuiv(int p, char *ch, int &tab); extern void afftex(char *ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 33f879d61b..0177d3e5c1 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -55,7 +55,6 @@ void dem2() { void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx - int i, j, k; Common::File fb; // byte values byte b; @@ -67,8 +66,8 @@ void charpal() { if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); - for (i = 0; i <= 90; ++i) { - for (j = 1; j <= 16; ++j) { + for (int i = 0; i <= 90; ++i) { + for (int j = 1; j <= 16; ++j) { tabpal[i][j].x = f.readByte(); tabpal[i][j].y = f.readByte(); } @@ -78,9 +77,9 @@ void charpal() { if (!fb.open("cxx.mor")) error("Missing file - cxx.mor"); - for (j = 0; j <= 90; j ++) { + for (int j = 0; j <= 90; ++j) { palcga[j].p = fb.readByte(); - for (i = 0; i <= 15; i ++) { + for (int i = 0; i <= 15; ++i) { nhom &with = palcga[j].a[i]; b = fb.readByte(); @@ -90,28 +89,26 @@ void charpal() { } } palcga[10].a[9] = palcga[10].a[5]; - for (j = 0; j <= 14; j ++) { + for (int j = 0; j <= 14; ++j) { tpt[j].tax = fb.readByte(); tpt[j].tay = fb.readByte(); - for (i = 1; i <= 20; i ++) - for (k = 1; k <= 20; k ++) + for (int i = 1; i <= 20; ++i) + for (int k = 1; k <= 20; ++k) tpt[j].des[i][k] = fb.readByte(); } fb.close(); } void chartex() { - int i; Common::File f; char s[1410]; /* debug('o3 chartex'); */ - i = 0; if (!f.open("TXX.INP")) error("Missing file - TXX.INP"); assert(f.size() <= (maxti * 2)); - for (i = 0; i < f.size() / 2; ++i) + for (int i = 0; i < f.size() / 2; ++i) t_mot[i] = f.readUint16LE(); f.close(); @@ -120,6 +117,7 @@ void chartex() { error("Missing file - TXX.NTP"); assert(f.size() <= (maxtd * 3)); + int i; for (i = 0; i < (f.size() / 3); ++i) { t_rec[i].indis = f.readSint16LE(); t_rec[i].point = f.readByte(); @@ -171,7 +169,9 @@ void music() { /* debug('o3 music'); */ - if (sonoff) return; + if (_soundOff) + return; + rech_cfiec = true; if (!fic.open("mort.img")) @@ -190,10 +190,11 @@ void music() { do { fin = keypressed(); g_vm->_soundManager.musyc(tbi, 9958 , tempo_mus); - k = k + 1; + ++k; fin = fin | keypressed() | (k >= 5); } while (!fin); - while (keypressed()) ch = get_ch(); // input >> kbd >> ch; + while (keypressed()) + ch = get_ch(); // input >> kbd >> ch; } @@ -238,7 +239,8 @@ void suite() { caff = 51; taffich(); teskbd(); - if (newgd != gd) gd = newgd; + if (newgd != gd) + gd = newgd; hirs(); dessine(ades, 0, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 70bbd72e06..02f298e8f6 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -37,7 +37,7 @@ void spfrac(int wor) { if ((typlec == 0) && (c3.code != 9)) if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || ((c3.code < 5) && ((c3.rep != 19) && (c3.rep != 22) && (c3.rep != 4) && (c3.rep != 9))))) { - c3.rep = c3.rep + 1; + ++c3.rep; } c3.freq = ((uint)wor >> 6) & 7; @@ -65,21 +65,19 @@ void charg_car() { c3.code = 4; } else { switch (int_) { - case 60 : { + case 60: c3.val = 32; /* " " */ c3.code = 9; - } - break; - case 61 : { + break; + case 61: c3.val = 46; /* "." */ c3.code = 9; - } - break; - case 62 : { + break; + case 62: c3.val = 35; /* "#" */ c3.code = 9; - } - break; + default: + break; } } @@ -90,7 +88,7 @@ void charg_car() { void entroct(byte o) { mem[adtroct * 16 + ptr_oct] = o; - ptr_oct = ptr_oct + 1; + ++ptr_oct; } void veracf(byte b) { @@ -98,30 +96,26 @@ void veracf(byte b) { } void cctable(tablint &t) { - int k; float tb[257]; - tb[0] = 0; - for (k = 0; k <= 255; k ++) { + for (int k = 0; k <= 255; ++k) { tb[k + 1] = addfix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } void regenbruit() { - int i, j; - - i = offsetb3 + 8590; - j = 0; + int i = offsetb3 + 8590; + int j = 0; do { t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); - i = i + 2; - j = j + 1; + i += 2; + ++j; } while (!(i >= offsetb3 + 8790)); } - void charge_son() { +void charge_son() { Common::File f; if (!f.open("sonmus.mor")) @@ -133,7 +127,7 @@ void regenbruit() { f.close(); } - void charge_phbruit() { +void charge_phbruit() { Common::File f; if (!f.open("phbrui.mor")) @@ -145,7 +139,7 @@ void regenbruit() { f.close(); } - void charge_bruit() { +void charge_bruit() { Common::File f; int i; @@ -153,54 +147,67 @@ void regenbruit() { error("Missing file - bruits"); f.read(&mem[adbruit * 16 + 0], 250); - for (i = 0; i <= 19013; i ++) mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; + for (i = 0; i <= 19013; ++i) + mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; f.read(&mem[adbruit1 * 16 + offsetb1], 149); f.close(); } - void trait_car() { +void trait_car() { byte d3; int d2, i; switch (c2.code) { - case 9 : - if (c2.val != ord('#')) for (i = 0; i <= c2.rep; i ++) entroct(c2.val); + case 9: + if (c2.val != ord('#')) + for (i = 0; i <= c2.rep; ++i) + entroct(c2.val); break; - case 5: - case 6 : { - if (c2.code == 6) d3 = tabdph[(c2.val - 14) << 1]; - else d3 = null; + case 6: + if (c2.code == 6) + d3 = tabdph[(c2.val - 14) << 1]; + else + d3 = null; if (c1.code >= 5) { veracf(c2.acc); if (c1.code == 9) { entroct(4); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(22); } } + switch (c2.rep) { - case 0 : { + case 0: entroct(0); entroct(c2.val); - if (d3 == null) if (c3.code == 9) entroct(2); - else entroct(4); - else if (c3.code == 9) entroct(0); - else entroct(1); - } - break; + if (d3 == null) + if (c3.code == 9) + entroct(2); + else + entroct(4); + else if (c3.code == 9) + entroct(0); + else + entroct(1); + break; case 4: case 5: - case 6 : { + case 6: if (c2.rep != 4) { i = c2.rep - 5; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } @@ -213,18 +220,19 @@ void regenbruit() { entroct(c2.val); entroct(3); } - } - break; + break; case 7: case 8: - case 9 : { + case 9: if (c2.rep != 7) { i = c2.rep - 8; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } @@ -237,34 +245,37 @@ void regenbruit() { entroct(c2.val); entroct(0); } - } - break; + break; case 1: case 2: - case 3 : { + case 3: if (c2.rep != 1) { i = c2.rep - 2; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } entroct(0); entroct(c2.val); - if (c3.code == 9) entroct(0); - else entroct(1); - } + if (c3.code == 9) + entroct(0); + else + entroct(1); + break; + default: + break; + } // switch c2.rep break; - } /* case c2.rep */ - } - break; case 2: - case 3 : { - d3 = c2.code + 5; /* 7 ou 8 => voyelle correspondante */ //Translation: Corresponding vowel + case 3: + d3 = c2.code + 5; // 7 ou 8 => Corresponding vowel if (c1.code > 4) { veracf(c2.acc); if (c1.code == 9) { @@ -274,9 +285,10 @@ void regenbruit() { } } i = c2.rep; + assert(i >= 0); if (i != 0) { do { - i = i - 1; + --i; entroct(0); entroct(d3); entroct(3); @@ -289,43 +301,47 @@ void regenbruit() { entroct(c2.val); } else { entroct(4); - if (c3.val == 4) entroct(3); - else entroct(c3.val); + if (c3.val == 4) + entroct(3); + else + entroct(c3.val); entroct(c2.val); } - } - break; + break; case 0: - case 1 : { + case 1: veracf(c2.acc); switch (c3.code) { - case 2 : + case 2: d2 = 7; break; - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 10; - } /* case c3.code */ + break; + } // switch c3.code d2 = d2 * 26 + c2.val; - if (tnocon[d2] == 0) d3 = 2; - else d3 = 6; + if (tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; if (c2.rep >= 5) { c2.rep = c2.rep - 5; - d3 = 8 - d3; /* echange 2 et 6 */ //Translation: swap 2 and 6 + d3 = 8 - d3; // Swap 2 and 6 } if (c2.code == 0) { i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(d3); entroct(c2.val); entroct(3); @@ -341,7 +357,7 @@ void regenbruit() { i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(d3); entroct(c2.val); entroct(4); @@ -355,33 +371,40 @@ void regenbruit() { } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 7; - } /* case c3.code */ - if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) c2.val = c2.val + 1; - if ((c2.val == 17) || (c2.val == 18)) c2.val = 16; + break; + } // switch c3.code + if (d2 == 4) + d2 = 3; + + if (intcon[c2.val] != 0) + ++c2.val; + + if ((c2.val == 17) || (c2.val == 18)) + c2.val = 16; + entroct(4); entroct(d2); entroct(c2.val); } - } - break; - case 4 : { + + break; + case 4: veracf(c2.acc); i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(2); entroct(c2.val); entroct(3); @@ -397,27 +420,35 @@ void regenbruit() { } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 7; - } /* case c3.code */ - if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) c2.val = c2.val + 1; + break; + } // switch c3.code + + if (d2 == 4) + d2 = 3; + + if (intcon[c2.val] != 0) + ++c2.val; + entroct(4); entroct(d2); entroct(tabdbc[((c2.val - 26) << 1) + 1]); } - } - break; - } /* case c2.code */ + + break; + default: + break; + } // switch c2.code } } // End of namespace Mortevielle diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index e0aaf83af0..785e49acaa 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -38,18 +38,14 @@ namespace Mortevielle { void rot_chariot() { c1 = c2; c2 = c3; - { - c3.val = 32; - c3.code = 9; - } + c3.val = 32; + c3.code = 9; } void init_chariot() { - { - c3.rep = 0; - c3.freq = 0; - c3.acc = 0; - } + c3.rep = 0; + c3.freq = 0; + c3.acc = 0; rot_chariot(); rot_chariot(); } @@ -89,38 +85,41 @@ void trait_ph() { void parole(int rep, int ht, int typ) { int savph[501]; - int i; int tempo; + if (_soundOff) + return; - if (sonoff) return; num_ph = rep; haut = ht; typlec = typ; if (typlec != 0) { - for (i = 0; i <= 500; i ++) savph[i] = t_cph[i]; + for (int i = 0; i <= 500; ++i) + savph[i] = t_cph[i]; tempo = tempo_bruit; - } else if (haut > 5) tempo = tempo_f; - else tempo = tempo_m; + } else if (haut > 5) + tempo = tempo_f; + else + tempo = tempo_m; addfix = (float)((tempo - addv[0])) / 256; cctable(tbi); switch (typ) { - case 1 : { + case 1: charge_bruit(); /*if zuul then zzuul(adbruit,0,1095);*/ regenbruit(); - } - break; - case 2 : { + break; + case 2: charge_son(); charge_phbruit(); - } - break; + break; + default: + break; } trait_ph(); g_vm->_soundManager.litph(tbi, typ, tempo); if (typlec != 0) - for (i = 0; i <= 500; i ++) { + for (int i = 0; i <= 500; ++i) { t_cph[i] = savph[i]; mlec = typlec; } diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index e6fd9b7f45..fa83b822d0 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -47,8 +47,10 @@ void change_gd(int ngd) { dessine_rouleau(); tinke(); drawClock(); - if (ipers != 0) affper(ipers); - else person(); + if (ipers != 0) + affper(ipers); + else + person(); clsf2(); clsf3(); _maff = 68; @@ -66,7 +68,6 @@ void MortevielleEngine::gameLoaded() { bool test[3]; char g[8]; - hideMouse(); imen = false; g[1] = 'M'; @@ -129,8 +130,10 @@ void MortevielleEngine::gameLoaded() { _endGame = false; tmlieu(s.mlieu); modinv(); - if (s.derobj != 0) modobj2(s.derobj + 400, test[1], test[2]); - else tesok = test[1] || test[2]; + if (s.derobj != 0) + modobj2(s.derobj + 400, test[1], test[2]); + else + tesok = test[1] || test[2]; showMouse(); } @@ -141,21 +144,22 @@ void tmaj3() { int j, h, m; calch(j, h, m); - if (m == 30) m = 1; - h = h + (j * 24); - m = m + (h * 2); + if (m == 30) + m = 1; + h += j * 24; + m += h * 2; s.heure = chr(m); } -void tsitu() - -{ +void tsitu() { int h, j, m; - if (! col) clsf2(); + if (! col) + clsf2(); syn = false; iesc = false; - if (anyone) goto L1; + if (anyone) + goto L1; if (brt) if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { ctrm = 4; @@ -165,7 +169,8 @@ void tsitu() fctMove(); if (msg[3] == MENU_DISCUSS) fctDiscuss(); - if (msg[3] == invent) tsprendre(); //Translation: inventory/take + if (msg[3] == invent) + tsprendre(); //Translation: inventory/take if (msg[4] == OPCODE_ATTACH) fctAttach(); if (msg[4] == OPCODE_WAIT) @@ -208,15 +213,18 @@ void tsitu() fctLift(); if (msg[4] == OPCODE_TURN) fctTurn(); - if (msg[4] == OPCODE_HIDE_SELF) { //Translation: hide + if (msg[4] == OPCODE_HIDE_SELF) { fctHideSelf(); goto L1; } - if (msg[4] == sfouiller) tsfouiller();//Translation: search - if (msg[4] == slire) tslire(); //Translation: read + if (msg[4] == sfouiller) + tsfouiller();//Translation: search + if (msg[4] == slire) + tslire(); //Translation: read if (msg[4] == OPCODE_PUT) fctPut(); - if (msg[4] == sregarder) tsregarder();//Translation: look + if (msg[4] == sregarder) + tsregarder();//Translation: look cache = false; L1: if (anyone) { @@ -226,7 +234,8 @@ L1: } calch(j, h, m); if ((((h == 12) || (h == 13) || (h == 19)) && (s.mlieu != 10)) || - ((h > 0) && (h < 6) && (s.mlieu != 0))) s.conf = s.conf + 1; + ((h > 0) && (h < 6) && (s.mlieu != 0))) + s.conf = s.conf + 1; if (((s.mlieu < 16) || (s.mlieu > 19)) && (s.mlieu != 23) && (s.mlieu != 0) && (s.derobj != 152) && (!g_vm->_loseGame)) { if ((s.conf > 99) && (h > 8) && (h < 16)) { @@ -251,9 +260,9 @@ L2: void theure() { vj = ord(s.heure); vh = vj % 48; - vj = vj / 48; + vj /= 48; vm = vh % 2; - vh = vh / 2; + vh /= 2; _hour = vh; if (vm == 1) _minute = 30; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c2c43953d0..929b0880f6 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -108,7 +108,8 @@ void SavegameManager::takesav(int n) { sync_save(sz); s = s1; - for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; + for (i = 0; i <= 389; ++i) + tabdon[i + acha] = bufcha[i]; // Close the stream delete stream; @@ -140,7 +141,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { hideMouse(); tmaj3(); - for (i = 0; i <= 389; i ++) + for (i = 0; i <= 389; ++i) bufcha[i] = tabdon[i + acha]; s1 = s; if (s1.mlieu == 26) diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 08aaa2a1f1..4da3ef0c32 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -59,7 +59,7 @@ void chardes(Common::String filename, int32 skipSize, int length) { } f.close(); - for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) mem[0x7000 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } @@ -87,7 +87,7 @@ void charani(Common::String filename, int32 skipSize, int length) { } f.close(); - for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) mem[0x7314 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } @@ -95,19 +95,18 @@ 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, a, b, cx, handle, - npal; + int i, m, cx, handle, npal; int32 lgt; int palh, k, j; int alllum[16]; - a = caff; + int a = caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; - b = a; + int b = a; if (_maff == a) return; @@ -193,7 +192,7 @@ void taffich() { a = a - 1; npal = a; - for (cx = 0; cx <= (a - 1); cx ++) + for (cx = 0; cx <= (a - 1); ++cx) lgt = lgt + l[cx]; handle = l[a]; @@ -210,13 +209,15 @@ void taffich() { } chardes(filename, lgt, handle); if (gd == her) { - for (i = 0; i <= 15; i ++) { + for (i = 0; i <= 15; ++i) { palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } - for (i = 0; i <= 15; i ++) { + for (i = 0; i <= 15; ++i) { k = 0; - for (j = 0; j <= 15; j ++) if (alllum[j] > alllum[k]) k = j; + for (j = 0; j <= 15; ++j) + if (alllum[j] > alllum[k]) + k = j; mem[0x7000 * 16 + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } @@ -232,9 +233,9 @@ void taffich() { else if (b == 24) b = 17; else if (b > 15) - b = b - 1; - for (cx = 0; cx <= (b - 1); cx ++) - lgt = lgt + l[cx + 89]; + --b; + for (cx = 0; cx <= (b - 1); ++cx) + lgt += l[cx + 89]; handle = l[b + 89]; filename = "AXX.mor"; } else if (b == 50) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 6f88d8db9a..efd84cca76 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -92,7 +92,7 @@ bool blo, bt7, bh9, - sonoff, + _soundOff, main1, choisi, test0, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index f5cd3afdc3..a77586ca2b 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -242,7 +242,7 @@ extern bool blo, bt7, bh9, - sonoff, + _soundOff, main1, choisi, test0, |