diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 5f35e6ef655..804e0f41f0a 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -133,20 +133,23 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin } int do_alert(Common::String str_, int n) { - int coldep, esp, i, l, nbcase, quoi, ix; + int coldep, esp, i, nbcase, quoi, ix; Common::String st, chaine; int limit[3][3]; - char c, dumi; + char dumi; Common::String s[3]; - int cx, cy, cd, nbcol, nblig; - bool touch, newaff, test, test1, test2, test3, dum; + int cx, cy, nbcol, nblig; + bool newaff, test, test1, test2, test3, dum; Common::String cas; /*debug('** do_alert **');*/ + memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; hide_mouse(); - while (keypressed()) input >> kbd >> dumi; + while (keypressed()) + dumi = get_ch(); // input >> kbd >> dumi; + clic = false; decod(str_, nbcase, nblig, nbcol, chaine, cas); sauvecr(50, succ(int, nligne) << 4); diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 701f99cec73..992a268b018 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -34,7 +34,7 @@ char readkey1() { char c; char readkey1_result; - input >> kbd >> c; + c = get_ch(); // input >> kbd >> c; readkey1_result = c; return readkey1_result; } @@ -43,7 +43,7 @@ int testou() { char ch; int testou_result; - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; switch (ch) { case '\23' : sonoff = ! sonoff; @@ -77,7 +77,7 @@ int testou() { } break; case '\33' : - if (keypressed()) input >> kbd >> ch; + if (keypressed()) ch = get_ch(); // input >> kbd >> ch; break; } testou_result = ord(ch); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6518f20f8c0..556c7b4e148 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -150,7 +150,7 @@ void ecrf1() { } void clsf1() { - int i, j; +// int i, j; /* debug('clsf1'); */ hide_mouse(); @@ -198,7 +198,7 @@ void clsf1() { } void clsf2() { - int i, j; +// int i, j; /* debug('clsf2'); */ hide_mouse(); @@ -247,7 +247,7 @@ void ecr2(Common::String str_) { } void clsf3() { - int i, j; +// int i, j; /* debug('clsf3'); */ hide_mouse(); @@ -323,15 +323,8 @@ void paint_rect(int x, int y, int dx, int dy) { } int hazard(int min, int max) { - int ha1; - float ha2; - /* debug('hazard'); */ - int hazard_result; - ha2 = Random(); - ha1 = abs((int)(ha2 * (max - min))); - hazard_result = min + ha1; - return hazard_result; + return get_random_number(min, max); } void calch(int &j, int &h, int &m) { @@ -370,7 +363,7 @@ void okpas() { void modobj(int m) { char str_[1410]; Common::String strp; - int i, tay; + int tay; /* debug('modobj'); */ strp = ' '; @@ -385,7 +378,7 @@ void modobj(int m) { void modobj2(int m, bool t1, bool t2) { char str_[1410]; Common::String strp; - int i, tay; + int tay; /* debug('modobj'); */ strp = ' '; @@ -541,7 +534,6 @@ void affper(int per) { /* overlay */ void choix(int min, int max, int &per) { bool i; int haz, cx, cy, cz; - float per2, cz2; /* debug('o0 choix'); */ haz = hazard(min, max); @@ -793,8 +785,6 @@ void debloc(int l) { } /* overlay */ void quelq6(int l) { - int per; - /* debug('o1 quelq6'); */ if (l == 6) bh6 = true; if (l == 8) bh8 = true; @@ -802,7 +792,7 @@ void debloc(int l) { } /* overlay */ void quelq10(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq10'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -829,7 +819,7 @@ void debloc(int l) { } /* overlay */ void quelq11(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq11'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -882,7 +872,7 @@ void debloc(int l) { } /* overlay */ void quelq20(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq20'); */ if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); @@ -1175,7 +1165,7 @@ void phaz(int &haz, int &p, int cf) { } /* overlay */ void t11(int l11, int &a) { - int p, haz, h; + int p, haz, h = 0; /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); @@ -1254,7 +1244,6 @@ void messint(int nu) { void aniof(int ouf, int num) { int ad, offset; - char c; /* debug('aniof'); */ if ((caff == 7) && ((num == 4) || (num == 5))) return; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 42f679a0c6b..c650002a57c 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -206,7 +206,7 @@ void tkey1(bool d) { } void tmlieu(int mli) { - int cx, j, i, tail; + int cx, i, tail; Common::String nomp; char st[1410]; @@ -354,7 +354,7 @@ void st1sama() { } void modinv() { - int cx, cy, tay, i, r; + int cx, cy, tay, r; char nom[1410]; Common::String nomp; @@ -377,7 +377,7 @@ void modinv() { void sparl(float adr, float rep) { const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, ad, tay, repint; + int key, tay, repint; char st[1410]; repint = abs((int)rep); @@ -615,7 +615,7 @@ void tsuiv() { void tfleche() { bool qust; char touch; - int dummy, cd, xmo, ymo; + int dummy; if (num == 9999) return; fenat(chr(152)); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 926a7bfceba..1aaea06d685 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -332,7 +332,7 @@ void mov_mouse(bool &funct, char &key) { key = '\377'; p_key = keypressed(); while (p_key) { - input >> kbd >> in1; + in1 = get_ch(); // input >> kbd >> in1; read_pos_mouse(cx, cy, cd); switch (toupper(in1)) { case '4' : @@ -381,48 +381,49 @@ void mov_mouse(bool &funct, char &key) { case '\33' : { p_key = keypressed(); - if ((in2 >= ';') && (in2 <= 'D')) { - funct = true; - key = in2; - return; - } - if (p_key) { - input >> kbd >> in2; - switch (in2) { - case 'K' : - cx = pred(int, cx); + in2 = get_ch(); // input >> kbd >> in2; + + if ((in2 >= ';') && (in2 <= 'D')) { + funct = true; + key = in2; + return; + } else { + switch (in2) { + case 'K' : + cx = pred(int, cx); + break; + case 'P' : + cy = succ(int, cy); + break; + case 'M' : + cx = cx + 2; + break; + case 'H' : + cy = pred(int, cy); + break; + case 'G' : { + cx = cx - 1; + cy = cy - 1; + } break; - case 'P' : - cy = succ(int, cy); + case 'I' : { + cx = cx + 1; + cy = cy - 1; + } break; - case 'M' : - cx = cx + 2; + case 'O' : { + cx = cx - 1; + cy = cy + 1; + } break; - case 'H' : - cy = pred(int, cy); + case 'Q' : { + cx = cx + 1; + cy = cy + 1; + } break; - case 'G' : { - cx = cx - 1; - cy = cy - 1; + } /* case */ } - break; - case 'I' : { - cx = cx + 1; - cy = cy - 1; - } - break; - case 'O' : { - cx = cx - 1; - cy = cy + 1; - } - break; - case 'Q' : { - cx = cx + 1; - cy = cy + 1; - } - break; - } /* case */ } } break; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6048efb02ac..c9bdcc72922 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -162,12 +162,11 @@ static int l_motsuiv(int p, char *ch, int &tab) { void afftex(char *ch, int x, int y, int dx, int dy, int typ) { bool the_end; - char touch; int xf, yf; int xc, yc; int tab, p; Common::String s; - int i, j, nt; + int i, j; /* debug(' .. Afftex');*/ diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index b30acea8b96..e33f3e406af 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -35,6 +35,7 @@ #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole.h" +#include "mortevielle/sprint.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -155,8 +156,12 @@ void ani50() { if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); - for (i = 0; i <= 90; i ++) - tabpal[i] = f.readSint16LE(); + for (i = 0; i <= 90; ++i) { + for (j = 1; j <= 16; ++j) { + tabpal[i][j].x = f.readByte(); + tabpal[i][j].y = f.readByte(); + } + } f.close(); if (!fb.open("cxx.mor")) @@ -234,7 +239,7 @@ void ani50() { cy = cy + 1; deline(cy + c_dialpre, st, tay); gotoxy(40 - tay / 2, wherey + 1); - output << delig; + output(delig); } while (!(cy == 20)); ix = 0; do { @@ -249,7 +254,7 @@ void ani50() { gotoxy(12, 24); output("Ctrl C E H T A"); do { - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); switch (ch) { case '\1': @@ -276,7 +281,7 @@ void ani50() { gotoxy(48, 23); output("S"); do { - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; } while ((ch != 'C') && (ch != 'S')); int_m = (toupper(ch) == 'S'); } @@ -291,7 +296,7 @@ void ani50() { for (int i = 1; i < 8; ++i) f_lieu.read(&v_lieu[i][1], 24); - f.close(); + f_lieu.close(); } @@ -300,19 +305,19 @@ void ani50() { int k; bool fin; char ch; - float x, y; +// float x, y; /* debug('o3 music'); */ if (sonoff) return; rech_cfiec = true; - if (!f.open("mort.img")) + if (!fic.open("mort.img")) error("Missing file - mort.img"); fic.read(&mem[0x3800 + 0], 500); fic.read(&mem[0x47a0 + 0], 123); - f.close(); + fic.close(); demus(0x3800, 0x5000, 623); addfix = (float)((tempo_mus - addv[1])) / 256; @@ -326,7 +331,7 @@ void ani50() { k = k + 1; fin = fin | keypressed() | (k >= 5); } while (!fin); - while (keypressed()) input >> kbd >> ch; + while (keypressed()) ch = get_ch(); // input >> kbd >> ch; } diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 4a3734f3631..3c78b04f00f 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" #include "mortevielle/parole.h" namespace Mortevielle { @@ -46,44 +47,40 @@ void charg_car() { wor = swap(memw[adword + ptr_word]); int_ = wor & 0x3f; - switch (int_) { - case 60 : { - c3.val = 32; /* " " */ - c3.code = 9; - } - break; - case 61 : { - c3.val = 46; /* "." */ - c3.code = 9; - } - break; - case 62 : { - c3.val = 35; /* "#" */ - c3.code = 9; - } - break; - case RANGE_26(22, 47) : { + + if ((int_ >= 0) && (int_ <= 13)) { + c3.val = int_; + c3.code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + c3.val = int_; + c3.code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; c3.val = int_; c3.code = typcon[int_]; - } - break; - case RANGE_9(48, 56) : { + } else if ((int_ >= 48) && (int_ <= 56)) { c3.val = int_ - 22; c3.code = 4; + } else { + switch (int_) { + case 60 : { + c3.val = 32; /* " " */ + c3.code = 9; + } + break; + case 61 : { + c3.val = 46; /* "." */ + c3.code = 9; + } + break; + case 62 : { + c3.val = 35; /* "#" */ + c3.code = 9; + } + break; + } } - break; - case RANGE_8(14, 21) : { - c3.val = int_; - c3.code = 6; - } - break; - case RANGE_14(0, 13) : { - c3.val = int_; - c3.code = 5; - } - break; - } + spfrac(wor); ptr_word = ptr_word + 2; } @@ -106,7 +103,7 @@ void veracf(byte b) { tb[0] = 0; for (k = 0; k <= 255; k ++) { tb[k + 1] = addfix + tb[k]; - t[255 - k] = trunc(tb[k]) + 1; + t[255 - k] = abs((int)tb[k] + 1); } } @@ -123,36 +120,42 @@ void veracf(byte b) { } /* overlay */ void charge_son() { - untyped_file f; + Common::File f; - assign(f, "sonmus.mor"); - reset(f); - blockread(f, mem[0x7414 + 0], 273); + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + f.read(&mem[0x7414 + 0], 273); /*blockread(f,mem[adson+0],300); blockread(f,mem[adson+2400+0],245);*/ demus(0x7414, adson, 273); - close(f); + f.close(); } /* overlay */ void charge_phbruit() { - untyped_file f; + Common::File f; - assign(f, "phbrui.mor"); - reset(f); - blockread(f, t_cph, 3); - close(f); + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= 3; ++i) + t_cph[i] = f.readSint16LE(); + + f.close(); } /* overlay */ void charge_bruit() { - untyped_file f; - int j, i; + Common::File f; + int i; - assign(f, "bruits"); - reset(f); - blockread(f, mem[adbruit + 0], 250); + if (!f.open("bruits")) + error("Missing file - bruits"); + + f.read(&mem[adbruit + 0], 250); for (i = 0; i <= 19013; i ++) mem[adbruit + 32000 + i] = mem[adbruit5 + i]; - blockread(f, mem[adbruit1 + offsetb1], 149); - close(f); + f.read(&mem[adbruit1 + offsetb1], 149); + + f.close(); } /* overlay */ void trait_car() { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 22ed01c0b5d..be8c17bf3b6 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/level15.h" #include "mortevielle/parole2.h" #include "mortevielle/parole.h" #include "mortevielle/var_mor.h" @@ -64,7 +65,7 @@ void trait_ph() { memw[adword + ptr_word] = t_cph[ptr_tcph]; ptr_word = ptr_word + 2; ptr_tcph = ptr_tcph + 1; - } while (!(ptr_tcph >= ((uint)lefin >> 1))); + } while (!(ptr_tcph >= (int)((uint)lefin >> 1))); ptr_oct = 0; ptr_word = 0; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index e493e760e81..760560eb539 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -38,8 +38,6 @@ namespace Mortevielle { /* overlay */ void change_gd(int ngd) { - int i; - hide_mouse(); gd = ngd; hirs(); @@ -59,7 +57,6 @@ namespace Mortevielle { } /* overlay */ void antegame() { - int cx; registres regs; char buffer[512]; int i, j, k; @@ -249,9 +246,9 @@ void ld_game(int n); void tecran() { const char idem[] = "Idem"; const int lim = 20000; - int temps; - char inkey; - bool oo, funct; + int temps = 0; + char inkey = '\0'; + bool oo, funct = 0; clsf3(); oo = false; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 4ee0342a66a..c9154acc599 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -27,6 +27,7 @@ #include "common/str.h" #include "mortevielle/boite.h" +#include "mortevielle/level15.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" @@ -92,7 +93,7 @@ namespace Mortevielle { with.y2 = 34 + j * 8; with.etat = true; } - while (chaines[j].size() < tmax) { + while ((int)chaines[j].size() < tmax) { chaines[j] = chaines[j] + ' '; } } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index d98a600c923..3cde8eb0151 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -27,6 +27,7 @@ #include "common/file.h" #include "common/str.h" +#include "mortevielle/level15.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/taffich.h" @@ -36,7 +37,7 @@ namespace Mortevielle { void chardes(Common::String nom, float passe, int long_) { int i, p, l; - byte b; +// byte b; Common::File f; /* debug('chardes'); */ @@ -51,11 +52,11 @@ void chardes(Common::String nom, float passe, int long_) { } if (p != 0) f.seek(p); - p = trunc(passe); + p = abs((int)passe); l = long_ + p; i = 0; while (l > 0) { - f.read(mem[0x6000 + i], 1); + f.read(&mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; @@ -68,7 +69,7 @@ void chardes(Common::String nom, float passe, int long_) { void charani(Common::String nom, float passe, int long_) { int i, p, l; - byte b; +// byte b; Common::File f; /* debug('charani'); */ @@ -84,11 +85,11 @@ void charani(Common::String nom, float passe, int long_) { if (p != 0) f.seek(p); - p = trunc(passe); + p = abs((int)passe); l = long_ + p; i = 0; while (l > 0) { - f.read(mem[0x6000 + i], 1); + f.read(&mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index f92202c3649..33ddfe64cc8 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -227,7 +227,7 @@ int tbi[256]; chariot c1, c2, c3; float addfix; t_pcga palsav[91]; -doublet tabpal[91][16]; +doublet tabpal[91][17]; t_pcga palcga[91]; pattern tpt[15]; @@ -238,7 +238,7 @@ pattern tpt[15]; void hirs() { const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; - int i, j; + int i; switch (gd) { case cga : { @@ -261,8 +261,10 @@ void hirs() { } break; case ega : { - inline_((float)(0xb8) / 14 / 0 / /* MOV AX, 14 ; mode video 14 = 640*200 16 couleurs */ - 0xcd / 0x10); /* INT 16 */ + /* + inline_((float)(0xb8) / 14 / 0 / // MOV AX, 14 ; mode video 14 = 640*200 16 couleurs + 0xcd / 0x10); // INT 16 + */ res = 2; } break; @@ -273,7 +275,9 @@ void hirs() { port[0x3b4] = i; port[0x3b5] = herc[i]; } + /* inline_((float)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); + */ port[0x3b8] = 10; res = 2; } @@ -344,9 +348,24 @@ void textcolor(int c) { } void output(const Common::String &s) { } +void graphbackground(int c) { +} + void intr(int intNum, registres ®s) { } +int get_random_number(int minval, int maxval) { + // TODO: Replace with a proper random source in the engine + return minval; +} + +bool keypressed() { + return false; // Hardcoded currently for no keypress pending +} +char get_ch() { + return '\0'; // hardcoded currently for no keypress +} + void palette(int v1) { warning("TODO: s_sauv"); } @@ -380,9 +399,20 @@ void decomp(int seg, int dep) { void afff(int Gd, int seg, int dep, int x, int y) { warning("TODO: afff"); } + // (* external 'c:\mc\reusint.com'; *) void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } +// (* external 'c:\mc\demus.com'; *) +void demus(int Src, int Dst, int Tay) { + warning("TODO: demus"); +} + +// (* external 'c:\mc\phint.com'; *) +void litph(tablint &t, int typ, int tempo) { + warning("TODO: litph"); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 4cb40caaaaa..4427bc03bfa 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -383,7 +383,7 @@ extern int tbi[256]; extern chariot c1, c2, c3; extern float addfix; extern t_pcga palsav[91]; -extern doublet tabpal[91][16]; +extern doublet tabpal[91][17]; extern t_pcga palcga[91]; extern pattern tpt[15]; @@ -413,13 +413,20 @@ extern int memw[0xffff]; // Text screen functions not relevant for ScummVM #define clrscr {} #define clreol {} +#define graphcolormode {} extern void gotoxy(int x, int y); extern void textcolor(int c); extern void output(const Common::String &s); +extern void graphbackground(int c); extern int wherey; +// Stubs for input functions +extern bool keypressed(); +extern char get_ch(); + extern void palette(int v1); extern void intr(int intNum, registres ®s); +extern int get_random_number(int minval, int maxval); // (* external 'c:\mc\charecr.com'; *) extern void s_char(int Gd, int y, int dy); @@ -435,6 +442,10 @@ extern void decomp(int seg, int dep); extern void afff(int Gd, int seg, int dep, int x, int y); // (* external 'c:\mc\reusint.com'; *) extern void musyc(tablint &tb, int nbseg, int att); +// (* external 'c:\mc\demus.com'; *) +extern void demus(int Src, int Dst, int Tay); +// (* external 'c:\mc\phint.com'; *) +extern void litph(tablint &t, int typ, int tempo); } // End of namespace Mortevielle