aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2011-12-23 19:02:50 +0000
committerStrangerke2012-04-06 08:18:12 +0200
commit816e53c1f87365cb351fe3dbdf4a8636954d1773 (patch)
tree7e6cdc9ebb3a5e83d461695651677f21997a4ec1 /engines
parent8c57c71e3a81edf03905b549c70599ab5247f969 (diff)
downloadscummvm-rg350-816e53c1f87365cb351fe3dbdf4a8636954d1773.tar.gz
scummvm-rg350-816e53c1f87365cb351fe3dbdf4a8636954d1773.tar.bz2
scummvm-rg350-816e53c1f87365cb351fe3dbdf4a8636954d1773.zip
MORTEVIELLE: Initial ptoc output
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/actions.h1372
-rw-r--r--engines/mortevielle/alert.h214
-rw-r--r--engines/mortevielle/boite.h30
-rw-r--r--engines/mortevielle/disk.h80
-rw-r--r--engines/mortevielle/droite.h35
-rw-r--r--engines/mortevielle/keyboard.h59
-rw-r--r--engines/mortevielle/level15.h186
-rw-r--r--engines/mortevielle/menu.h306
-rw-r--r--engines/mortevielle/mor.h1457
-rw-r--r--engines/mortevielle/mor2.h764
-rw-r--r--engines/mortevielle/mort.cpp124
-rw-r--r--engines/mortevielle/mouse.h469
-rw-r--r--engines/mortevielle/outtext.h205
-rw-r--r--engines/mortevielle/ovd1.h347
-rw-r--r--engines/mortevielle/parole.h432
-rw-r--r--engines/mortevielle/parole2.h103
-rw-r--r--engines/mortevielle/prog.h346
-rw-r--r--engines/mortevielle/ques.h121
-rw-r--r--engines/mortevielle/sprint.h55
-rw-r--r--engines/mortevielle/taffich.h216
-rw-r--r--engines/mortevielle/var_mor.h485
21 files changed, 7406 insertions, 0 deletions
diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h
new file mode 100644
index 0000000000..fd4ae2e0b6
--- /dev/null
+++ b/engines/mortevielle/actions.h
@@ -0,0 +1,1372 @@
+/* NIVEAU 4 */
+const char stouinon[] = "[2][ ][OUI][NON]";
+
+/* overlay */ void taller()
+
+{
+ integer mx,cx,cy;
+
+ if ((s.mlieu== 26) && (msg[4]== depl[6]))
+ {
+ s.mlieu= 15;
+ caff= s.mlieu;
+ afdes(0);
+ repon(2,s.mlieu);
+ }
+ if ((s.mlieu== 15) && (msg[4]== depl[6]))
+ {
+ if (! syn) ecr3("aller");
+ tfleche();
+ if (iesc) okdes= false;
+ if ((anyone) || (iesc)) return;
+ tcoord(1);
+ if (num== 0) return;
+ if (num== 1)
+ {
+ s.mlieu= 0;
+ tmlieu(0);
+ }
+ else
+ if (num== 7)
+ {
+ s.mlieu= 13;
+ tmlieu(13);
+ }
+ else
+ if (num!= 6) s.mlieu= 26;
+ if ((num> 1) && (num< 6)) ment= num- 1;
+ if (num> 7) ment= num- 3;
+ if (num!= 6) affrep(); else aldepl();
+ return;
+ }
+ tsort();
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!(depl[cx]== msg[4]));
+ if (s.mlieu== 19)
+ {
+ if (cx== 1) t1deva();
+ if (cx== 2) t1neig();
+ goto L2;
+ }
+ if (s.mlieu== 23)
+ {
+ if (cx== 1) t1deau();
+ if (cx== 2) t1derr();
+ goto L2;
+ }
+ if ((s.mlieu== 11) && (cx== 1)) cx= 6;
+ if (s.mlieu== 12)
+ {
+ if (cx== 2) cx= 6;
+ if (cx== 5) cx= 16;
+ }
+ if ((s.mlieu== 14) && (cx== 3)) cx= 6;
+ if (((s.mlieu== 15) || (s.mlieu== 26)) && (cx== 4)) cx= 6;
+ if ((s.mlieu> 19) && (s.mlieu!= 26)) cx= cx+ 10;
+ if ((s.mlieu== 20) && (cx== 13)) cx= 16;
+ if (s.mlieu== 21)
+ {
+ if (cx== 12) cx= 16; else
+ if (cx> 13) cx= 15;
+ }
+ if ((s.mlieu== 22) && (cx> 14)) cx= 15;
+ if ((s.mlieu== 24) && (cx!= 17))
+ if (cx> 13) cx= 15;
+ if (cx== 1) s.mlieu= 11; else
+ if (cx== 2) s.mlieu= 12; else
+ if (cx== 3) s.mlieu= 14; else
+ if (cx== 4) s.mlieu= 15; else
+ if (cx== 5) cx= 12;
+ if (cx== 6) cx= 11;
+ if (cx== 11) t1sama(); else
+ if (cx== 12) t1deva(); else
+ if (cx== 13) s.mlieu= 20; else
+ if (cx== 14) s.mlieu= 24; else
+ if (cx== 15) t1neig(); else
+ if (cx== 16) t1derr(); else
+ if (cx== 17)
+ {
+ if ((s.ipuit!= 120) && (s.ipuit!= 140)) crep= 997; else
+ if (s.ipuit== 120) crep= 181; else
+ if (s.conf> 80)
+ {
+ crep= 1505;
+ tperd();
+ }
+ else
+ {
+ s.mlieu= 23;
+ affrep();
+ }
+ }
+ if ((cx< 5) || (cx== 13) || (cx== 14)) affrep();
+ debloc(s.mlieu);
+L2:
+ tmlieu(s.mlieu);
+}
+
+/* overlay */ void tprendre()
+{
+ integer cx, cy, cz;
+
+ if (caff> 99)
+ {
+ cx= caff;
+ avpoing(cx);
+ if (crep!= 139)
+ {
+ if (ipers> 0) s.conf= s.conf+ 3;
+ if (obpart)
+ {
+ if (s.mlieu== 2) s.iloic= 0;
+ if (s.mlieu== 13)
+ {
+ if (s.iboul== caff) s.iboul= 0;
+ if (s.ibag== caff) s.ibag= 0;
+ }
+ if (s.mlieu== 14) s.icave= 0;
+ if (s.mlieu== 16) s.icryp= 0;
+ if (s.mlieu== 17) s.ivier= 0;
+ if (s.mlieu== 24) s.ipuit= 0;
+ mfouen();
+ obpart= false;
+ affrep();
+ }
+ else
+ {
+ tabdon[acha+ (pred(integer,mchai)* 10)+ pred(integer,cs)]=0;
+ tsuiv();
+ dobj= dobj+ 1;
+ if (dobj> 6)
+ {
+ s.conf= s.conf+ 2;
+ dobj= 0;
+ }
+ }
+ }
+ return;
+ }
+ if (! syn) ecr3("prendre");
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ if (caff== 3)
+ {
+ tcoord(2);
+ if (num== 1)
+ {
+ crep= 152;
+ return;
+ }
+ }
+ tcoord(5);
+ if ((num== 0) || ((num== 1) && (s.mlieu== 16)))
+ {
+ tcoord(8);
+ if (num!= 0)
+ {
+ if (ipers> 0) s.conf= s.conf+ 3;
+ crep= 997;
+ if ((s.mlieu== 2) && (s.iloic!= 0)) avpoing(s.iloic);
+ if ((s.mlieu==13) && (num==1) && (s.iboul!=0))
+ {
+ avpoing(s.iboul);
+ if ((crep!= 997) && (crep!= 139)) aniof(2,7);
+ }
+ if ((s.mlieu==13) && (num==2) && (s.ibag!=0))
+ {
+ avpoing(s.ibag);
+ if ((crep!= 997) && (crep!= 139)) aniof(2,6);
+ }
+ if ((s.mlieu== 14) && (s.icave!= 0))
+ {
+ avpoing(s.icave);
+ if ((crep!= 997) && (crep!= 139)) aniof(2,2);
+ }
+ if ((s.mlieu== 16) && (s.icryp!= 0)) avpoing(s.icryp);
+ if ((s.mlieu== 17) && (s.ivier!= 0))
+ {
+ avpoing(s.ivier);
+ if ((crep!= 997) && (crep!= 139))
+ {
+ crep= 182;
+ aniof(2,1);
+ }
+ }
+ if ((s.mlieu== 24) && (s.ipuit!= 0))
+ {
+ avpoing(s.ipuit);
+ if ((crep!= 997) && (crep!= 139)) aniof(2,1);
+ }
+ if ((crep!= 997) && (crep!= 182) && (crep!= 139)) crep= 999;
+ }
+ }
+ else
+ {
+ if (((s.mlieu== 0) && (num== 3)) || ((s.mlieu== 1) && (num== 4))
+ || ((s.mlieu== 2) && (num== 1)) || ((s.mlieu== 4) && (num== 3))
+ || ((s.mlieu== 5) && (num== 6)) || ((s.mlieu== 6) && (num== 2))
+ || ((s.mlieu== 7) && (num== 6)) || ((s.mlieu== 8) && (num== 4))
+ || ((s.mlieu== 9) && (num== 4)) || ((s.mlieu== 10) && (num> 2))
+ || ((s.mlieu== 11) && (num== 7)) || ((s.mlieu== 12) && (num== 6))
+ || ((s.mlieu== 13) && (num> 4)) || ((s.mlieu> 13)
+ && (s.mlieu!= 23))) crep= 997; else
+ {
+ if (s.mlieu== 23)
+ {
+ crep= 1504;
+ tperd();
+ }
+ else crep= 120;
+ }
+ }
+}
+
+/* overlay */ void tsprendre()
+{
+ integer cx,cy,cz;
+
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!(invt[cx]== msg[4]));
+ cz= 0;
+ cy= 0;
+ do {
+ cy= cy+ 1;
+ if (ord(s.sjer[cy])!= 0) cz= cz+ 1;
+ } while (!(cz== cx));
+ cz= ord(s.sjer[cy]);
+ s.sjer[cy]= chr(0);
+ modinv();
+ avpoing(cz);
+ crep= 998;
+ clsf2();
+}
+
+/* overlay */ void tsoulever()
+
+{
+ integer cx;
+
+ if (! syn) ecr3("soulever");
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ tcoord(3);
+ if (num== 0)
+ {
+ tcoord(8);
+ if (num!= 0)
+ {
+ if (ipers> 0) s.conf= s.conf+ 1;
+ crep= 997;
+ if ((s.mlieu== 2) && (s.iloic!= 0)) treg(s.iloic);
+ }
+ return;
+ }
+ if (ipers> 0) s.conf= s.conf+ 1;
+ cx= s.mlieu;
+ if (s.mlieu== 16) cx= 14;
+ if (s.mlieu== 19) cx= 15;
+ crep= tabdon[asoul+(cx << 3)+pred(integer,num)];
+ if (crep== 255) crep= 997;
+}
+
+/* overlay */ void tlire()
+{
+ integer iaff;
+
+ if (caff> 99) st4(caff); else
+ {
+ if (! syn) ecr3("lire");
+ tfleche();
+ if (! (anyone) && ! (iesc))
+ {
+ tcoord(4);
+ if (num!= 0) crep= 107;
+ }
+ }
+}
+
+/* overlay */ void tslire()
+{
+ if (s.derobj== 0) crep= 186; else st4(s.derobj);
+}
+
+/* overlay */ void tregarder()
+{
+ integer cx;
+
+ if (caff> 99)
+ {
+ crep= 103;
+ return;
+ }
+ if (! syn) ecr3("regarder");
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ tcoord(5);
+ if (num== 0)
+ {
+ tcoord(8);
+ crep= 131;
+ if (num!= 0)
+ {
+ if (s.mlieu== 13)
+ {
+ if (num== 1)
+ {
+ crep= 164;
+ if (s.ibag!= 0) treg(s.ibag); else
+ if (s.iboul!= 0) treg(s.iboul);
+ }
+ else
+ {
+ crep= 193;
+ if (s.ibag!= 0) treg(s.ibag);
+ }
+ }
+ if (s.mlieu== 14)
+ {
+ crep= 164;
+ if (s.icave!= 0) treg(s.icave);
+ }
+ if (s.mlieu== 17)
+ {
+ crep= 174;
+ if (s.ivier!= 0) treg(s.ivier);
+ }
+ if (s.mlieu== 24)
+ {
+ crep= 131;
+ if (s.ipuit!= 0) treg(s.ipuit);
+ }
+ }
+ return;
+ }
+ cx= s.mlieu;
+ if (s.mlieu== 20) cx= 17;
+ if ((s.mlieu> 21) && (s.mlieu< 25)) cx= cx- 4;
+ if (s.mlieu== 26) cx= 21;
+ crep= tabdon[arega+(cx*7)+pred(integer,num)];
+ if ((s.mlieu== 13) && (num== 8)) crep= 126;
+ if (s.mlieu== 19) crep= 103;
+ if (crep== 255) crep= 131;
+ if ((s.mlieu== 1) && (num== 1)) treg(144);
+ if ((s.mlieu== 5) && (num== 3)) treg(147);
+ if ((s.mlieu== 8) && (num== 3)) treg(149);
+ if ((s.mlieu== 9) && (num== 2)) treg(30);
+ if ((s.mlieu== 10) && (num== 3)) treg(31);
+}
+
+/* overlay */ void tsregarder()
+{
+ if (s.derobj!= 0) treg(s.derobj); else crep= 186;
+}
+
+/* overlay */ void tfouiller()
+{
+ const array<0,13,byte> r = {{123,104,123,131,131,123,104,131,123,123,106,123,123,107}};
+ integer cx;
+
+ if (caff> 99)
+ {
+ st7(caff);
+ return;
+ }
+ if (! syn) ecr3("fouiller");
+ tfleche();
+ if (anyone || iesc) return;
+ if (s.mlieu==23)
+ {
+ crep= 1504;
+ tperd();
+ return;
+ }
+ tcoord(6);
+ if (num== 0)
+ {
+ tcoord(7);
+ if (num!=0)
+ {
+ cx=0;
+ do {
+ cx=cx+1;
+ } while (!((cx>6) || (num== ord(touv[cx]))));
+ if (num!=ord(touv[cx])) crep=187; else
+ {
+ if (ipers>0) s.conf= s.conf+3;
+ rechai(mchai);
+ if (mchai!=0)
+ {
+ cs=0;
+ is=0;
+ fouil=true;
+ mfoudi();
+ tsuiv();
+ }
+ else crep=997;
+ }
+ }
+ else
+ {
+ tcoord(8);
+ crep= 997;
+ if (num!=0)
+ {
+ if (ipers>0) s.conf=s.conf+3;
+ if ((s.mlieu!=24) && (s.mlieu!=17) && (s.mlieu!=13))
+ {
+ if (s.mlieu==2)
+ {
+ crep= 123;
+ if (s.iloic!=0) treg(s.iloic);
+ }
+ if (s.mlieu==16)
+ {
+ crep= 123;
+ if (s.icryp!=0) treg(s.icryp);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if (ipers>0) s.conf=s.conf+ 3;
+ crep= 997;
+ if (s.mlieu < 14) crep= r[s.mlieu];
+ if ((s.mlieu== 3) && (num== 2)) crep=162;
+ if (s.mlieu== 12)
+ {
+ if ((num== 3) || (num== 4)) crep=162;
+ if (num== 5) crep= 159;
+ }
+ if (s.mlieu==19) crep=104;
+ if (s.mlieu==16) crep=155;
+ }
+}
+
+/* overlay */ void tsfouiller()
+{
+ if (s.derobj!=0) st7(s.derobj); else crep= 186;
+}
+
+/* overlay */ void touvrir()
+{
+ integer cx,haz;
+
+ if (! syn) ecr3("ouvrir");
+ if (caff== 26)
+ {
+ if (ment!= 0)
+ {
+ msg[4]= entrer;
+ syn= true;
+ }
+ else crep= 997;
+ return;
+ }
+ if (caff== 15)
+ {
+ aldepl();
+ return;
+ }
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ tcoord(7);
+ if (num!= 0)
+ {
+ if (ipers> 0) s.conf= s.conf+ 2;
+ iouv= iouv+ 1;
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!((cx> 6) || (ord(touv[cx])== 0) || (ord(touv[cx])== num)));
+ if (ord(touv[cx])!= num)
+ {
+ if (!
+ (
+ ( (num== 3) && ((s.mlieu== 0) || (s.mlieu== 9) || (s.mlieu== 5) || (s.mlieu== 7)) )
+ ||
+ ((num== 4) && ((s.mlieu== 1) || (s.mlieu== 2) || (s.mlieu== 6))) ||
+ ((s.mlieu== 4) && (num== 5)) ||
+ ((num== 6) && ((s.mlieu== 7) || (s.mlieu== 10) ||
+ (s.mlieu== 8) || (s.mlieu== 13))) ||
+ ((s.mlieu== 8) && (num== 2)) ||
+ ((s.mlieu== 12) && (num== 7))))
+ {
+ if (((s.mlieu> 10) && (s.mlieu< 14)) ||
+ ((s.mlieu> 6) && (s.mlieu< 10)) ||
+ (s.mlieu== 0) || (s.mlieu== 2) || (s.mlieu== 5))
+ {
+ haz= hazard(1, 4);
+ if (haz== 3) parole(7, 9, 1);
+ }
+ touv[cx]= chr(num);
+ aniof(1,num);
+ }
+ cx= s.mlieu;
+ if (s.mlieu== 16) cx= 14;
+ crep= tabdon[aouvr+ (cx* 7)+ pred(integer,num)];
+ if (crep== 254) crep= 999;
+ }
+ else crep= 18;
+ }
+}
+
+/* overlay */ void tmettre()
+{
+ integer quel;
+ boolean entre;
+ phrase st;
+ str255 str_;
+ integer i,tay;
+
+ if (s.derobj== 0)
+ {
+ crep= 186;
+ return;
+ }
+ if (! syn) ecr3("mettre");
+ tfleche();
+ if (iesc) crep= 998;
+ if ((anyone) || (iesc)) return;
+ tcoord(8);
+ if (num!= 0)
+ {
+ crep= 999;
+ if (caff== 13)
+ {
+ if (num== 1)
+ {
+ if (s.iboul!= 0) crep= 188; else
+ {
+ s.iboul= s.derobj;
+ if (s.derobj== 141) aniof(1,7);
+ }
+ }
+ else
+ if (s.ibag!= 0) crep= 188; else
+ {
+ s.ibag= s.derobj;
+ if (s.derobj== 159) aniof(1,6);
+ }
+ }
+ if (caff== 14)
+ if (s.icave!=0) crep= 188; else
+ {
+ s.icave= s.derobj;
+ if (s.derobj== 151)
+ {
+ aniof(1,2);
+ aniof(1,1);
+ repon(2,165);
+ maivid();
+ parole(6, -9, 1);
+ quel= do_alert(stouinon,1);
+ if (quel==1) {
+ deline(582,st,tay);
+ i= do_alert(delig,1);
+ tesok=false;
+ entre= ques();
+ hide_mouse();
+ hirs();
+ dessine_rouleau();
+ clsf2();
+ clsf3();
+ show_mouse();
+ tinke();
+ pendule();
+ if (ipers!=0) affper(ipers);
+ else person();
+ menu_aff();
+ if (entre)
+ {
+ s.mlieu= 17;
+ tmlieu(17);
+ }
+ else
+ {
+ tmlieu(s.mlieu);
+ writepal(14);
+ dessin(0);
+ aniof(1,2);
+ aniof(1,1);
+ deline(577,st,tay);
+ i= do_alert(delig,1);
+ aniof(2,1);
+ crep= 166;
+ }
+ affrep();
+ }
+ else {
+ aniof(2,1);
+ crep= 166;
+ tesok=true;
+ }
+ return;
+ }
+ }
+ if (caff== 16)
+ if (s.icryp== 0) s.icryp= s.derobj; else crep= 188;
+ if (caff== 17)
+ if (s.ivier!=0) crep= 188; else
+ if (s.derobj== 143)
+ {
+ s.ivier= 143;
+ aniof(1,1);
+ }
+ else
+ {
+ crep= 1512;
+ tperd();
+ }
+ if (caff== 24)
+ if (s.ipuit!= 0) crep= 188; else
+ if ((s.derobj== 140) || (s.derobj== 120))
+ {
+ s.ipuit= s.derobj;
+ aniof(1,1);
+ }
+ else crep= 185;
+ if (crep!= 188) maivid();
+ }
+}
+
+/* overlay */ void ttourner()
+{
+ integer quel;
+
+ if (caff> 99)
+ {
+ crep= 149;
+ return;
+ }
+ if (! syn) ecr3("tourner");
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ tcoord(9);
+ if (num!= 0)
+ {
+ crep= 997;
+ if ((s.mlieu== 13) && (s.ibag== 159) && (s.iboul== 141))
+ {
+ repon(2,167);
+ parole(7, 9, 1);
+ quel= do_alert(stouinon,1);
+ if (quel== 1) solu= true; else crep= 168;
+ }
+ if ((s.mlieu== 17) && (s.ivier== 143))
+ {
+ repon(2, 175);
+ clsf3();
+ parole(6, -9, 1);
+ quel= do_alert(stouinon,1);
+ if (quel== 1)
+ {
+ s.mlieu= 16;
+ affrep();
+ }
+ else crep= 176;
+ }
+ }
+}
+
+/* overlay */ void tcacher()
+{
+ if (! syn) ecr3("se cacher");
+ tfleche();
+ if (! (anyone) && ! (iesc))
+ {
+ tcoord(10);
+ if (num== 0) cache= false; else
+ {
+ cache= true;
+ crep= 999;
+ }
+ }
+}
+
+/* overlay */ void tattacher()
+{
+ if (s.derobj== 0) crep= 186; else
+ {
+ if (! syn) ecr3("attacher");
+ tfleche();
+ if (! (anyone) && ! (iesc))
+ {
+ tcoord(8);
+ crep= 997;
+ if ((num!= 0) && (s.mlieu== 24))
+ {
+ crep= 999;
+ if ((s.derobj== 120) || (s.derobj== 140))
+ {
+ s.ipuit= s.derobj;
+ aniof(1,1);
+ }
+ else crep= 185;
+ maivid();
+ }
+ }
+ }
+}
+
+/* overlay */ void tfermer()
+{
+ integer cx,chai;
+
+ if (! syn) ecr3("fermer");
+ if (caff< 26)
+ {
+ tfleche();
+ if (iesc) crep= 998;
+ if ((anyone) || (iesc)) return;
+ tcoord(7);
+ if (num!= 0)
+ {
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!((cx> 6) || (num== ord(touv[cx]))));
+ if (num== ord(touv[cx]))
+ {
+ aniof(2,num);
+ crep= 998;
+ touv[cx]= chr(0);
+ iouv= iouv- 1;
+ if (iouv< 0) iouv= 0;
+ chai= 9999;
+ rechai(chai);
+ if (mchai== chai) mchai= 0;
+ }
+ else crep= 187;
+ }
+ }
+ if (caff== 26) crep= 999;
+}
+
+/* overlay */ void tfrapper()
+{
+ integer l,p,haz;
+
+ if (! syn) ecr3("frapper");
+ if (s.mlieu== 15)
+ {
+ l= do_alert("[1][ | Avant, utilisez le menu DEP...][ok]",1);
+ return;
+ }
+ if (s.mlieu< 25)
+ {
+ tfleche();
+ if (! (anyone) && ! (iesc))
+ if ((s.mlieu< 19) && (s.mlieu!= 15)) crep= 133; else crep= 997;
+ return;
+ }
+ if (s.mlieu== 26)
+ {
+ haz= (hazard(0, 8))- 4;
+ parole(11, haz, 1);
+ ecfren(p,haz,s.conf,ment);
+ l= ment;
+ if (l!= 0)
+ if (p!= -500)
+ {
+ if (haz> p) crep= 190; else
+ {
+ becfren(l);
+ frap();
+ }
+ }
+ else frap();
+ if (ment== 8) crep= 190;
+ }
+}
+
+/* overlay */ void tposer()
+{
+ integer cx,chai;
+
+ if (! syn) ecr3("poser");
+ if (s.derobj== 0) crep= 186; else
+ {
+ if (caff> 99)
+ {
+ crep= 999;
+ ajchai();
+ if (crep!= 192) maivid();
+ return;
+ }
+ tfleche();
+ if ((anyone) || (iesc)) return;
+ tcoord(7);
+ crep= 124;
+ if (num!= 0)
+ {
+ rechai(chai);
+ if (chai== 0) crep= 997; else
+ {
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!((cx> 6) || (num== ord(touv[cx]))));
+ if (num!= ord(touv[cx])) crep= 187; else
+ {
+ mchai= chai;
+ crep= 999;
+ }
+ }
+ }
+ else
+ {
+ tcoord(8);
+ if (num!= 0)
+ {
+ crep= 998;
+ if (caff== 2)
+ if (s.iloic!= 0) crep= 188; else s.iloic= s.derobj;
+ if (caff== 13)
+ {
+ if (num== 1)
+ {
+ if (s.iboul!= 0) crep= 188; else s.iboul= s.derobj;
+ }
+ else
+ if (s.ibag!= 0) crep= 188; else s.ibag= s.derobj;
+ }
+ if (caff== 16)
+ if (s.icryp!= 0) crep= 188; else s.icryp= s.derobj;
+ if (caff== 24) crep= 185;
+ if ((caff== 14) || (caff== 17)) crep= 124;
+ }
+ else
+ {
+ crep= 124;
+ if (caff== 24)
+ {
+ tcoord(5);
+ if (num!= 0) crep= 185;
+ }
+ }
+ }
+ if (caff== 23) crep= 185;
+ if ((crep== 999) || (crep== 185) || (crep== 998))
+ {
+ if (crep== 999) ajchai();
+ if (crep!= 192) maivid();
+ }
+ }
+}
+
+/* overlay */ void tecouter()
+{
+ integer l,p,haz,j,h,m;
+
+ if (s.mlieu!= 26) crep= 101; else
+ {
+ if (ipers!= 0) s.conf= s.conf+ 1;
+ ecfren(p,haz,s.conf,ment);
+ l= ment;
+ if (l!= 0)
+ if (p!= -500)
+ {
+ if (haz> p) crep= 101; else
+ {
+ becfren(l);
+ calch(j,h,m);
+ haz= hazard(1,100);
+ if ((h>= 0) && (h< 8))
+ {
+ if (haz> 30) crep= 101; else crep= 178;
+ }
+ else
+ if (haz> 70) crep= 101; else crep= 178;
+ }
+ }
+ else crep= 178;
+ }
+}
+
+/* overlay */ void tmanger()
+{
+ integer j,h,m;
+
+ if ((s.mlieu> 15) && (s.mlieu< 26))
+ crep= 148;
+ else
+ {
+ tsort();
+ s.mlieu= 10;
+ caff= 10;
+ debloc(s.mlieu);
+ tmlieu(s.mlieu);
+ calch(j,h,m);
+ if ((h== 12) || (h== 13) || (h== 19))
+ {
+ s.conf= s.conf- (s.conf / 7);
+ if (h== 12)
+ if (m== 0) h= 4; else h= 3;
+ if ((h== 13) || (h== 19))
+ if (m== 0) h= 2; else h= 1;
+ jh= jh+ h;
+ crep= 135;
+ tinke();
+ }
+ else crep= 134;
+ }
+}
+
+/* overlay */ void tentrer()
+{
+ integer x, z;
+
+ if ((s.mlieu== 21) || (s.mlieu== 22))
+ {
+ t1sama();
+ tmlieu(s.mlieu);
+ }
+ else
+ if (s.mlieu== 15) aldepl(); else
+ if (ment== 0) crep= 997; else
+ {
+ if ((ment== 9) && (s.derobj!= 136))
+ {
+ crep= 189;
+ s.teauto[8]= '*';
+ }
+ else
+ {
+ if (! blo) t11(ment, z);
+ if (z!= 0)
+ {
+ if ((ment== 3) || (ment== 7)) crep= 179; else
+ {
+ x= (hazard(0, 10))- 5;
+ parole(7, x, 1);
+ aniof(1,1);
+/* tkey(5,32000);*/
+ tip(z,x);
+ s.conf= s.conf+ 1;
+ s.mlieu= 15;
+ msg[3]= discut;
+ msg[4]= disc[x];
+ syn= true;
+ if (ment== 9)
+ {
+ col= true;
+ caff= 70;
+ afdes(0);
+ repon(2,caff);
+ }
+ else col= false;
+ debloc(ment);
+ ment= 0;
+ }
+ }
+ else
+ {
+ x= (hazard(0, 10))- 5;
+ parole(7, x, 1);
+ aniof(1,1);
+/* tkey(1,32000);*/
+ s.mlieu= ment;
+ affrep();
+ debloc(s.mlieu);
+ tmlieu(s.mlieu);
+ ment= 0;
+ mpers= 0;
+ ipers= 0;
+ }
+ }
+ }
+}
+
+/* overlay */ void tdormir()
+{
+ const char m1[] = "D‚sirez-vous vous r‚veiller?";
+ integer z,j,h,m,quel;
+
+ if ((s.mlieu> 15) && (s.mlieu< 26))
+ {
+ crep= 148;
+ return;
+ }
+ if (s.mlieu != 0)
+ {
+ tsort();
+ s.mlieu= 0;
+ affrep();
+ afdes(0);
+ debloc(s.mlieu);
+ tmlieu(s.mlieu);
+ }
+ clsf3();
+ clsf2();
+ ecrf2();
+ ecr2(m1);
+ calch(j,h,m);
+ do {
+ if (h< 8)
+ {
+ s.conf= s.conf- (s.conf / 20);
+ z= (7- h)* 2;
+ if (m== 30) z= z- 1;
+ jh= jh+ z;
+ h= 7;
+ }
+ jh= jh+ 2;
+ h= h+ 1;
+ if (h> 23) h= 0;
+ tinke();
+ quel= do_alert(stouinon,1);
+ anyone= false;
+ } while (!(quel== 1));
+ crep= 998;
+ num= 0;
+}
+
+/* overlay */ void tdefoncer()
+{
+ if (! syn) ecr3("d‚foncer");
+ if (caff< 25) tfleche();
+ if ((! anyone) && (! iesc))
+ if (s.mlieu!= 26) crep= 997; else
+ {
+ crep= 143;
+ s.conf= s.conf+ 2;
+ }
+}
+
+/* overlay */ void tsortir()
+{
+ integer lx;
+
+ tsort();
+ crep= 0;
+ if ((s.mlieu== 19) || (s.mlieu== 21) || (s.mlieu== 22)
+ || (s.mlieu== 24)) crep= 997; else
+ {
+ if ((s.mlieu< 16) || (s.mlieu== 26)) lx= 10;
+ if ((s.mlieu== 10) || (s.mlieu== 20)) lx= 21;
+ if ((s.mlieu< 10) || (s.mlieu== 13)) lx= 15;
+ if (s.mlieu== 16)
+ {
+ lx= 17;
+ crep= 176;
+ }
+ if (s.mlieu== 17) t23coul(lx);
+ if (s.mlieu== 23) lx= 24;
+ if (crep!= 997) s.mlieu= lx;
+ caff= lx;
+ if (crep== 0) crep= lx;
+ debloc(lx);
+ tmlieu(lx);
+ }
+}
+
+/* overlay */ void tattendre()
+{
+ integer quel;
+
+ mpers= 0;
+ clsf3();
+ do {
+ jh= jh+ 1;
+ tinke();
+ if (! blo) t11(s.mlieu, quel);
+ if ((ipers!= 0) && (mpers== 0))
+ {
+ crep= 998;
+ if ((s.mlieu== 13) || (s.mlieu== 14)) cavegre();
+ if ((s.mlieu> 0) && (s.mlieu< 10)) anyone= true;
+ mpers= ipers;
+ if (! anyone) tinke();
+ return;
+ }
+ repon(2,102);
+ quel= do_alert(stouinon,1);
+ } while (!(quel== 2));
+ crep= 998;
+ if (! anyone) tinke();
+}
+
+/* overlay */ void tsonder()
+{
+ if (! syn) ecr3("sonder");
+ if (caff< 27)
+ {
+ tfleche();
+ if (! (anyone) && (! iesc)) crep= 145;
+ num= 0;
+ }
+}
+
+/* overlay */ void tparler()
+
+{
+ array<1,46,boolean> te;
+ integer ix, cy, cx, max, haz, suj, co,lig,icm,
+ i, tay, choi, x, y, c;
+ char tou;
+ array<1,46,varying_string<40> > lib;
+ phrase st;
+ boolean f;
+
+
+
+ finfouil();
+ if (col) suj= 128; else
+ {
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!(disc[cx]== msg[4]));
+ caff= 69+ cx;
+ afdes(0);
+ repon(2,caff);
+ suj= caff+ 60;
+ }
+ tkey1(false);
+ mennor();
+ hide_mouse();
+ hirs();
+ premtet();
+ sparl(0,suj);
+ hirs();
+ for( ix= 1; ix <= 46; ix ++) te[ix]= false;
+ for( ix=1; ix <= 45; ix ++)
+ {
+ deline(ix+c_tparler,st,tay);
+ lib[ix]= delig;
+ for( i=tay; i <= 40; i ++) lib[ix]=lib[ix]+' ';
+ }
+ lib[46]=lib[45];
+ lib[45]=' ';
+ show_mouse();
+ do {
+ choi= 0;
+ icm= 0;
+ co= 0;
+ lig= 0;
+ do {
+ icm= succ(integer, icm );
+ putxy(co,lig);
+ if (s.teauto[icm]=='*')
+ if (te[icm]) writetp(lib[icm],1);
+ else writetp(lib[icm],0);
+ if (icm==23) {
+ lig= 0;
+ co= 320;
+ }
+ else lig= lig + 8;
+ } while (!(icm==42));
+ putxy(320,176);
+ writetp(lib[46],0);
+ tou= '\0';
+ do {
+ mov_mouse(f,tou);
+/* if keypressed then read(kbd,tou);*/
+ read_pos_mouse(x,y,c);
+ x= x *(3-res);
+ if (x>319) cx= 41; else cx= 1;
+ cy= succ(integer,(cardinal)y >> 3); /* 0-199 => 1-25 */
+ if ((cy>23) || ((cx==41) && (set::of(range(20,22), eos).has(cy))))
+ {
+ if (choi!=0)
+ {
+ lig= ((choi-1) % 23) << 3;
+ if (choi>23) co= 320; else co= 0;
+ putxy(co,lig);
+ if (te[choi]) writetp(lib[choi],0);
+ else writetp(lib[choi],1);
+ te[choi]= ! te[choi];
+ choi= 0;
+ }
+ }
+ else {
+ ix= cy;
+ if (cx==41) ix= ix+23;
+ if (ix!=choi)
+ {
+ if (choi!=0)
+ {
+ lig= ((choi-1) % 23) << 3;
+ if (choi>23) co= 320; else co= 0;
+ putxy(co,lig);
+ if (te[choi]) writetp(lib[choi],0);
+ else writetp(lib[choi],1);
+ te[choi]= ! te[choi];
+ }
+ if ((s.teauto[ix]=='*') || (ix==46))
+ {
+ lig= ((ix-1) % 23) << 3;
+ if (ix>23) co= 320; else co= 0;
+ putxy(co,lig);
+ if (te[ix]) writetp(lib[ix],0);
+ else writetp(lib[ix],1);
+ te[ix]= ! te[ix];
+ choi= ix;
+ }
+ else choi= 0;
+ }
+ }
+ } while (!((tou=='\15') || ( ((c!=0) || clic) && (choi!=0))));
+ clic=false;
+ if (choi!=46)
+ {
+ ix= choi-1;
+ if (col)
+ {
+ col= false;
+ s.mlieu= 15;
+ if (iouv> 0) max= 8; else max= 4;
+ haz= hazard(1,max);
+ if (haz== 2) suj= 129; else
+ {
+ suj= 138;
+ s.conf= s.conf+ (3* (s.conf / 10));
+ }
+ }
+ else
+ if (nbrep[caff- 69]< nbrepm[caff- 69])
+ {
+ suj= tabdon[arep+ (ix << 3)+ (caff- 70)];
+ s.conf= s.conf+ tabdon[arcf+ ix];
+ nbrep[caff- 69]= nbrep[caff- 69]+ 1;
+ }
+ else
+ {
+ s.conf= s.conf+ 3;
+ suj= 139;
+ }
+ hide_mouse();
+ hirs();
+ premtet();
+ sparl(0, suj);
+ show_mouse();
+ if ((suj== 84) || (suj== 86))
+ {
+ s.pourc[5]= '*';
+ s.teauto[7]= '*';
+ }
+ if ((suj== 106) || (suj== 108) || (suj== 94))
+ {
+ for( ix= 29; ix <= 31; ix ++) s.teauto[ix]= '*';
+ s.pourc[7]= '*';
+ }
+ if (suj== 70)
+ {
+ s.pourc[8]= '*';
+ s.teauto[32]= '*';
+ }
+ hide_mouse();
+ hirs();
+ show_mouse();
+ }
+ } while (!((choi== 46) || (suj== 138)));
+ if (col)
+ {
+ s.conf= s.conf+ (3* (s.conf / 10));
+ hide_mouse();
+ hirs();
+ premtet();
+ sparl(0, 138);
+ show_mouse();
+ col= false;
+ s.mlieu= 15;
+ }
+ ctrm= 0;
+ hide_mouse();
+ hirs();
+ dessine_rouleau();
+ show_mouse();
+ affper(ipers);
+ tinke();
+ pendule();
+ affrep();
+/* chech;*/
+ tmlieu(s.mlieu);
+ clsf3();
+}
+
+/* overlay */ void tsentir()
+{
+ crep= 119;
+ if (caff< 26)
+ {
+ if (! syn) ecr3("sentir");
+ tfleche();
+ if (! (anyone) && ! (iesc))
+ if (caff== 16) crep= 153;
+ }
+ else
+ if (caff== 123) crep= 110;
+ num= 0;
+}
+
+/* overlay */ void tgratter()
+{
+ crep= 155;
+ if (caff< 27)
+ {
+ if (! syn) ecr3("gratter");
+ tfleche();
+ }
+ num= 0;
+}
+
+/* NIVEAU 2 */
+/* overlay */ void tmaj1() /* Le jeu est termin‚ !!! */
+{
+ arret= true;
+ tlu(13,152);
+ maivid();
+ clsf1();
+ clsf2();
+ clsf3();
+ repon(9,1509);
+ tkey1(false);
+ hide_mouse();
+ caff= 70;
+ taffich();
+ hirs();
+ premtet();
+ sparl(0,141);
+ show_mouse();
+ clsf1();
+ repon(9,1509);
+ repon(2,142);
+ tkey1(false);
+ caff= 32;
+ afdes(0);
+ repon(6,34);
+ repon(2,35);
+ musique(0);
+ tkey1(false);
+ messint(2036);
+ tkey1(false);
+ inzon();
+}
+
+/* overlay */ void tencore() /* Perdu !!! */
+{
+ integer quel;
+
+ clsf2();
+ musique(0);
+ tkey1(false);
+ maivid();
+ inzon();
+ dprog();
+ vh= 10;
+ vm= 0;
+ vj= 0;
+ min= 0;
+ heu= 10;
+ jou= 0;
+ repon(2,180);
+ quel= do_alert(stouinon,1);
+ arret= (quel!=1);
+}
diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h
new file mode 100644
index 0000000000..c3a45fe529
--- /dev/null
+++ b/engines/mortevielle/alert.h
@@ -0,0 +1,214 @@
+/* overlay */ integer do_alert(str255 str_, integer n);
+
+
+const integer nligne = 7;
+const matrix<1,2,1,3,integer> coord
+ = {{ {{150, 72, 103}},
+ {{143, 107, 183}} }};
+
+
+
+static void decod(str255 s, integer& nbc,integer& nbl,integer& col, str255& c, str30& cs)
+ {
+ integer i,k;
+ boolean v;
+
+ val(s[2],nbc,i);
+ c= "";
+ nbl= 0; i= 5; k= 0;
+ v=true; col=0;
+
+ while (s[i]!=']')
+ {
+ c=c+s[i];
+ if ((s[i]=='|') || (s[i+1]==']'))
+ {
+ if (k>col) col=k;
+ k= 0;
+ nbl=nbl+1;
+ }
+ else if (s[i]!=' ') v=false;
+ i=i+1;
+ k=k+1;
+ }
+ if (v) {
+ c="";
+ col=20;
+ }
+ else {
+ c=c+']';
+ col=col+6;
+ }
+ i=i+1;
+ cs=copy(s,i,30);
+ if (res==2) col= col*6;
+ else col= col*10;
+ }
+
+
+
+static void posit(integer ji, integer& coldep, integer& esp)
+ {
+ putxy(coldep + (40+esp) *pred(integer,ji),98);
+ }
+
+
+
+static void fait_boite(integer lidep,integer nli,integer tx)
+ {
+ integer x,y,xx,yy;
+
+ if (tx>640) tx=640;
+ x= 320- ((cardinal)tx >> 1);
+ y=pred(integer,lidep) << 3;
+ xx=x+ tx;
+ yy=y + (nli << 3);
+ box(15,gd,x,y,xx,yy,255);
+ box(0,gd,x,y+2,xx,y+4,255);
+ box(0,gd,x,yy-4,xx,yy-2,255);
+ }
+
+
+
+static void fait_choix(str30 c, integer& coldep, integer& nbcase, array<1,2,varying_string<3> >& s, integer& esp)
+ {
+ integer i,l,x;
+ char ch;
+
+ i=1;
+ x=coldep;
+ for( l=1; l <= nbcase; l ++)
+ {
+ s[l]="";
+ do {
+ i=i+1;
+ ch=c[i];
+ s[l]=s[l]+ch;
+ } while (!(c[i+1]==']'));
+ i=i+2;
+ while (length(s[l])<3) s[l]=s[l]+' ';
+ putxy(x,98);
+ writeg(string(' ')+s[l]+' ',0);
+ x= x+esp+40;
+ }
+ }
+
+ integer do_alert(str255 str_, integer n)
+{
+ integer coldep,esp,i,l,nbcase,quoi,ix;
+ str255 st, chaine;
+ matrix<1,2,1,2,integer> limit;
+ char c,dumi;
+ array<1,2,varying_string<3> > s;
+ integer cx,cy,cd,nbcol,nblig;
+ boolean touch,newaff,test,test1,test2,test3,dum;
+ str30 cas;
+
+
+ /*debug('** do_alert **');*/
+ integer do_alert_result;
+ hide_mouse();
+ while (keypressed()) input >> kbd >> dumi;
+ clic=false;
+ decod(str_,nbcase,nblig,nbcol,chaine,cas);
+ sauvecr(50,succ(integer,nligne) << 4);
+
+ i=0;
+ if (chaine=="")
+ {
+ fait_boite(10,5,nbcol);
+ }
+ else
+ {
+ fait_boite(8,7,nbcol);
+ i=0;
+ ywhere=70;
+ do {
+ cx= 320;
+ st= "";
+ while (! (set::of('\174','\135', eos).has(chaine[i+1])))
+ {
+ i=i+1;
+ st=st+chaine[i];
+ if (res==2) cx=cx-3;
+ else cx=cx-5;
+ }
+ putxy(cx,ywhere);
+ ywhere=ywhere+6;
+ writeg(st,4);
+ i=i+1;
+ } while (!(chaine[i]==']'));
+ }
+ if (nbcase==1) esp= nbcol- 40;
+ else esp= (cardinal)(nbcol-nbcase*40) >> 1;
+ coldep=320-((cardinal)nbcol >> 1)+((cardinal)esp >> 1);
+ fait_choix(cas, coldep, nbcase, s, esp);
+ limit[1][1]=((cardinal)(coldep) >> 1)*res;
+ limit[1][2]=limit[1][1]+40;
+ if (nbcase==1)
+ {
+ limit[2][1]=limit[2][2];
+ }
+ else
+ {
+ limit[2][1]=((cardinal)(320+((cardinal)esp >> 1)) >> 1)*res;
+ limit[2][2]=(limit[2][1])+40;
+ }
+ show_mouse();
+ quoi=0;
+ dum=false;
+ do {
+ dumi='\377';
+ mov_mouse(dum,dumi);
+ cx= x_s;
+ cy= y_s;
+ test=(cy>95) && (cy<105);
+ newaff=false;
+ 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 (test2)
+ {
+ newaff=true;
+ if (test1) ix=1;
+ else ix=2;
+ if (ix!=quoi)
+ {
+ hide_mouse();
+ if (quoi!=0)
+ {
+ posit(quoi, coldep, esp);
+ writeg(string(' ')+s[quoi]+' ',0);
+ }
+ posit(ix, coldep, esp);
+ writeg(string(' ')+s[ix]+' ',1);
+ quoi=ix;
+ show_mouse();
+ }
+ }
+ }
+ if ((quoi!=0) && ! newaff)
+ {
+ hide_mouse();
+ posit(quoi, coldep, esp);
+ writeg(string(' ')+s[quoi]+' ',0);
+ quoi=0;
+ show_mouse();
+ }
+ test3=(cy>95) && (cy<105) && (((cx>limit[1][1]) && (cx<limit[1][2]))
+ || ((cx>limit[2][1]) && (cx<limit[2][2])));
+ } while (!clic);
+ clic=false;
+ hide_mouse();
+ if (! test3) {
+ quoi=n;
+ posit(n, coldep, esp);
+ writeg(string(' ')+s[n]+' ',1);
+ }
+ charecr(50,succ(integer,nligne) << 4);
+ show_mouse();
+ do_alert_result=quoi;
+ return do_alert_result;
+}
diff --git a/engines/mortevielle/boite.h b/engines/mortevielle/boite.h
new file mode 100644
index 0000000000..0819490bfc
--- /dev/null
+++ b/engines/mortevielle/boite.h
@@ -0,0 +1,30 @@
+void boite(integer x,integer y,integer dx,integer dy,integer coul)
+ {
+ integer i;
+ integer xi,yi,xo,yo;
+
+ /* debug('boite'); */
+ hide_mouse();
+ if (res==1)
+ {
+ x= (cardinal)x >> 1;
+ dx= (cardinal)dx >> 1;
+ }
+ xi=x; yi=y; xo=x; yo=y;
+ for( i=0; i <= dx+dy; i ++)
+ {
+ putpix(gd,xi,yi,coul);
+ if (xi==x+dx) {
+ if (gd!=cga) putpix(gd,pred(integer,xi),yi,coul);
+ yi=succ(integer,yi);
+ }
+ else xi=succ(integer,xi);
+ putpix(gd,xo,yo,coul);
+ if (yo==y+dy) xo=succ(integer,xo);
+ else {
+ if (gd!=cga) putpix(gd,succ(integer,xo),yo,coul);
+ yo=succ(integer,yo);
+ }
+ }
+ show_mouse();
+ }
diff --git a/engines/mortevielle/disk.h b/engines/mortevielle/disk.h
new file mode 100644
index 0000000000..28a2dbe6a5
--- /dev/null
+++ b/engines/mortevielle/disk.h
@@ -0,0 +1,80 @@
+
+void dem1()
+{
+ untyped_file f;
+ integer k;
+
+ /* -- demande de disk 1 -- */
+ assign(f,"mort.005");
+ /*$i-*/
+ k=ioresult;
+ reset(f);
+ while (ioresult!=0)
+ {
+ show_mouse();
+ k= do_alert(al_mess,1);
+ hide_mouse();
+ reset(f);
+ }
+ close(f);
+}
+
+void takesav(integer n)
+{
+ untyped_file f;
+ integer i;
+ varying_string<10> st;
+
+ dem1();
+ /* -- chargement du fichier 'sauve#n.mor' -- */
+ st= string("sav")+chr(n+48)+".mor";
+ assign(f,st);
+ reset(f,497);
+ blockread(f,s1,1);
+ if (ioresult!=0)
+ {
+ i=do_alert(err_mess,1);
+ exit(0);
+ }
+ s=s1;
+ for( i=0; i <= 389; i ++) tabdon[i+acha]=bufcha[i];
+ close(f);
+}
+
+void ld_game(integer n)
+{
+ hide_mouse();
+ maivid();
+ takesav(n);
+ /* -- disquette 2 -- */
+ dem2();
+ /* -- mises en place -- */
+ theure();
+ dprog();
+ antegame();
+ show_mouse();
+}
+
+void sv_game(integer n)
+{
+ untyped_file f;
+ integer i;
+
+ hide_mouse();
+ tmaj3();
+ dem1();
+ /* -- sauvegarde du fichier 'sauve#n.mor' -- */
+ for( i=0; i <= 389; i ++) bufcha[i]=tabdon[i+acha];
+ s1=s;
+ if (s1.mlieu== 26) s1.mlieu= 15;
+ assign(f,string("sav")+chr(n+48)+".mor");
+ rewrite(f,497);
+ blockwrite(f,s1,1);
+ close(f);
+ dem2();
+ show_mouse();
+}
+
+
+
+
diff --git a/engines/mortevielle/droite.h b/engines/mortevielle/droite.h
new file mode 100644
index 0000000000..7dd029e2ec
--- /dev/null
+++ b/engines/mortevielle/droite.h
@@ -0,0 +1,35 @@
+void droite( integer x, integer y, integer xx, integer yy, integer coul )
+ {
+ integer step,i;
+ real a,b;
+ real xr,yr,xro,yro;
+
+ xr=x; yr=y; xro=xx; yro=yy;
+ /*writeln(le_file,'(',x:4,',',y:4,') ==> (',xx:4,',',yy:4,')');*/
+ if (abs(y-yy) > abs(x-xx))
+ {
+ a= (real)((x-xx)) / (y-yy);
+ b= ( yr*xro - yro*xr) / (y-yy);
+ i=y;
+ if (y>yy) step=-1;
+ else step=1;
+ do {
+ putpix(gd, trunc(a*i+b), i, coul);
+ i=i+step;
+ } while (!(i==yy));
+ /*writeln(le_file,'X == ',a:3:3,' * Y + ',b:3:3);*/
+ }
+ else
+ {
+ a= (real)((y-yy)) / (x-xx);
+ b= ((yro*xr) - (yr*xro)) / (x-xx);
+ i=x;
+ if (x>xx) step=-1;
+ else step=1;
+ do {
+ putpix(gd,i, trunc(a*i+b), coul);
+ i=i+step;
+ } while (!(i==xx));
+ /*writeln(le_file,'Y == ',a:3:3,' * X + ',b:3:3);*/
+ }
+ } \ No newline at end of file
diff --git a/engines/mortevielle/keyboard.h b/engines/mortevielle/keyboard.h
new file mode 100644
index 0000000000..9f8423a41f
--- /dev/null
+++ b/engines/mortevielle/keyboard.h
@@ -0,0 +1,59 @@
+char readkey1()
+ {
+ char c;
+
+ char readkey1_result;
+ input >> kbd >> c;
+ readkey1_result= c;
+ return readkey1_result;
+ }
+
+integer testou()
+ {
+ char ch;
+
+ integer testou_result;
+ input >> kbd >> ch;
+ switch (ch) {
+ case '\23' : sonoff= ! sonoff; break;
+ case '\1':
+ case '\3':
+ case '\5' : {
+ newgd= (cardinal)pred(integer,ord(ch)) >> 1;
+ testou_result= 61;
+ return testou_result;
+ }
+ break;
+ case '\10' : {
+ newgd= her;
+ testou_result= 61;
+ return testou_result;
+ }
+ break;
+ case '\24' : {
+ newgd= tan;
+ testou_result= 61;
+ return testou_result;
+ }
+ break;
+ case '\26' : if (set::of(1,2, eos).has(c_zzz))
+ {
+ zzuul(adcfiec+161,0,1644);
+ c_zzz=succ(integer,c_zzz);
+ testou_result=61;
+ return testou_result;
+ }
+ break;
+ case '\33' : if (keypressed()) input >> kbd >> ch; break;
+ }
+ testou_result=ord(ch);
+ return testou_result;
+ }
+
+void teskbd()
+ {
+ integer dum;
+
+ if (keypressed()) dum=testou();
+ }
+
diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h
new file mode 100644
index 0000000000..be92e8dca2
--- /dev/null
+++ b/engines/mortevielle/level15.h
@@ -0,0 +1,186 @@
+
+/* NIVEAU 15 */
+void copcha()
+{
+ integer i;
+
+ i= acha;
+ do {
+ tabdon[i]=tabdon[i+390];
+ i=succ(integer,i);
+ } while (!(i==acha +390));
+}
+
+boolean dans_rect( rectangle r )
+ {
+ integer x, y, c;
+
+ boolean dans_rect_result;
+ read_pos_mouse(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;
+ }
+
+void outbloc(integer n, pattern p, t_nhom pal)
+ {
+ integer i,j,ad;
+
+ ad=n*404+0xd700;
+ {
+ memw[0x6000+ad]= p.tax;
+ memw[0x6000+ad+2]= p.tay;
+ ad=ad+4;
+ for( i=1; i <= p.tax; i ++)
+ for( j=1; j <= p.tay; j ++)
+ mem[0x6000+ad+pred(integer,j)*p.tax+pred(integer,i)]= pal[n].hom[p.des[i][j]];
+ }
+ }
+
+
+void writepal(integer n)
+ {
+ integer i;
+ t_nhom pal;
+
+
+ switch (gd) {
+ case tan:
+ case ega:
+ case ams : for( i=1; i <= 16; i ++)
+ {
+ mem[0x7000+2*i]= tabpal[n][i].x;
+ mem[0x7000+succ(integer,2*i)]= tabpal[n][i].y;
+ }
+ break;
+ case cga : {
+ pal= palcga[n].a;
+ if (n<89) palette(palcga[n].p);
+ for( i=0; i <= 15; i ++) outbloc(i, tpt[pal[i].n],pal);
+ }
+ break;
+ }
+ }
+
+
+void pictout(integer seg,integer dep,integer x,integer y)
+ {
+ decomp(seg,dep);
+ if (gd==her)
+ {
+ mem[0x7000+2]=0;
+ mem[0x7000+32]=15;
+ }
+ if ((caff!=51) && (memw[0x7000+0x4138]>0x100)) memw[0x7000+0x4138]=0x100;
+ afff(gd,seg,dep,x,y);
+ }
+
+void putxy(integer x,integer y)
+{
+ xwhere=x;
+ ywhere=y;
+}
+/*
+function calad(x,y:integer):integer;
+ begin
+ calad:=pred(x)+320*pred(y)
+ end;
+ */
+void sauvecr(integer y,integer dy)
+ {
+ hide_mouse();
+ s_sauv(gd,y,dy);
+ show_mouse();
+ }
+
+void charecr(integer y,integer dy)
+ {
+ hide_mouse();
+ s_char(gd,y,dy);
+ show_mouse();
+ }
+/*
+function peek(ad:integer):integer;
+begin
+ peek:=tabdon[ad];
+end;
+
+function peekw(ad:integer):integer;
+begin
+ peekw:=tabdon[ad] shl 8+tabdon[succ(ad)];
+end;
+
+function peekl(ad:integer):real;
+begin
+ peekl:=tabdon[ad+3]+tabdon[ad+2] shl 8;
+end;
+
+
+procedure poke (ad,n:integer);
+begin
+ tabdon[ad]:=lo(n);
+end;
+ */
+
+void adzon()
+ {
+ untyped_file f;
+ file<byte> g;
+ byte a;
+ integer i;
+
+ assign(f,"don.mor");
+ reset(f,256);
+ blockread(f,tabdon,7);
+ close(f);
+ assign(f,"bmor.mor");
+ reset(f,1916);
+ blockread(f,tabdon[fleche],1);
+ /*i:=fleche;
+ repeat
+ read(g,a);
+ tabdon[i]:=a;
+ i:=succ(i);
+ until i=fleche + 1916;*/
+ close(f);
+ assign(f,"dec.mor");
+ reset(f,1664);
+ blockread(f,mem[0x73a2+0],1);
+ /*i:=0;
+ repeat
+ read(g,a);
+ mem[$73A2:i]:=a;
+ i:=succ(i);
+ until eof(g);*/
+ close(f);
+ }
+
+integer animof (integer ouf,integer num)
+ {
+ integer nani, aux;
+
+ integer animof_result;
+ nani= mem[adani+1];
+ aux= num;
+ if (ouf!=1) aux= aux+nani;
+ animof_result=(nani << 2) + 2+swap(memw[adani+ (aux << 1)]);
+ /*aux:= nani shl 2 + 2;
+ if ouf=1 then aux:= aux+ swap(memw[adani: num shl 1])
+ else aux:= aux+ swap(memw[adani: (nani+num) shl 1]);
+ animof:=aux;*/
+ return animof_result;
+ }
+
+/*procedure affgd(offs,dep,x,y:integer);
+begin
+ case Gd of
+ Ams : affams(offs,dep,x,y);
+ Cga : affcga(offs,dep,x,y);
+ Ega : affega(offs,dep,x,y);
+ Her : affher(offs,dep,x,y);
+ Tan : afftan(offs,dep,x,y);
+ end;
+end;*/
diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h
new file mode 100644
index 0000000000..9256182280
--- /dev/null
+++ b/engines/mortevielle/menu.h
@@ -0,0 +1,306 @@
+/* NIVEAU 14*/
+
+/* overlay */ void menut(integer no, str30 nom)
+ {
+ byte h,l;
+ str30 s;
+
+
+ /* debug('menut'); */
+ h=hi(no);
+ l=lo(no);
+ s=nom;
+ if (! tesok)
+ {
+ clrscr;
+ exit(0);
+ }
+ while (length(s)<30) s=s+' ';
+ switch (h) {
+ case invent : if (l!=7) inv[l]= string(' ')+s; break;
+ case depla : dep[l]= s; break;
+ case action : act[l]= s; break;
+ case saction : self_[l]= s; break;
+ case discut : dis[l]= s; break;
+ }
+ }
+
+/* overlay */ void menu_disable(integer no)
+ {
+ byte h,l;
+
+ /* debug('menu_disable'); */
+ h=hi(no);
+ l=lo(no);
+ switch (h) {
+ case invent : {
+ if (l>6) {
+ inv[l][1]='<';
+ inv[l][22]='>';
+ }
+ else inv[l][1]='*';
+ }
+ break;
+ case depla : dep[l][1]='*'; break;
+ case action : act[l][1]='*'; break;
+ case saction : self_[l][1]='*'; break;
+ case discut : dis[l][1]='*'; break;
+ }
+ }
+
+/* overlay */ void menu_enable(integer no)
+ {
+ byte h,l;
+
+ /* debug('menu_disable'); */
+ h=hi(no);
+ l=lo(no);
+ switch (h) {
+ case invent : {
+ inv[l][1]=' ';
+ inv[l][22]=' ';
+ }
+ break;
+ case depla : dep[l][1]=' '; break;
+ case action : act[l][1]=' '; break;
+ case saction : {
+ self_[l][1]=' ';
+ self_[l][1]=' ';
+ }
+ break;
+ case discut : dis[l][1]=' '; break;
+ }
+ }
+
+void menu_aff()
+ {
+ integer ind_tabl,k,col;
+ char c;
+ integer pt,x,y,color,msk,
+ num_letr;
+
+ /* debug('menu_aff'); */
+ hide_mouse();
+ /*if not tesok then
+ begin
+ clrscr;
+ halt;
+ end;*/
+ box( 7, gd, 0,0, 639,10, 255);
+ col= 28*res;
+ if (gd == cga) color=1;
+ else color=9;
+ num_letr=0;
+ do { /* lettre par lettre */
+ num_letr= num_letr +1;
+ ind_tabl=0;
+ y= 1;
+ do { /* colonne par colonne */
+ k=0;
+ x= col;
+ do { /* ligne par ligne */
+ msk=0x80;
+ for( pt=0; pt <= 7; pt ++)
+ {
+ if ((lettres[num_letr][ind_tabl] & msk)!=0)
+ {
+ putpix(gd,x+1,y+1,0);
+ putpix(gd,x,y+1,0);
+ putpix(gd,x,y,color);
+ }
+ msk= (cardinal)msk >> 1;
+ x=x +1;
+ }
+ ind_tabl=succ(integer,ind_tabl);
+ k=succ(integer,k);
+ } while (!(k==3));
+ y=y+1;
+ } while (!(y==9));
+ col=col+48*res;
+ } while (!(num_letr==6));
+ show_mouse();
+ }
+
+
+void draw_menu()
+ {
+ /* debug('draw_menu'); */
+ menu_aff();
+ active_menu=true;
+ msg4=no_choice;
+ msg3=no_choice;
+ choisi=false;
+ clic=false;
+ test0=false;
+ }
+
+void invers(integer ix)
+ {
+ varying_string<23> s;
+
+ /* debug('invers'); */
+ if (msg4==no_choice) return;
+ putxy(don[msg3][1] << 3,succ(void,lo(msg4)) << 3);
+ switch (msg3) {
+ case 1 : s= inv[lo(msg4)]; break;
+ case 2 : s= dep[lo(msg4)]; break;
+ case 3 : s= act[lo(msg4)]; break;
+ case 4 : s= self_[lo(msg4)]; break;
+ case 5 : s= dis[lo(msg4)]; break;
+ case 6 : s= fic[lo(msg4)]; break;
+ case 7 : s= fic[1]+' '+chr(48+lo(msg4)); break;
+ case 8 : if (lo(msg4)==1) s=recom;
+ else s= fic[2]+' '+chr(47+lo(msg4));
+ break;
+ }
+ if ((s[1]!='*') && (s[1]!='<')) writeg(s,ix);
+ else msg4=no_choice;
+ }
+
+void util(integer x,integer y)
+ {
+ integer ymx, dxcar, xmn, xmx, ix;
+
+ /* debug('util'); */
+ ymx= (don[msg3][4] << 3)+16;
+ dxcar= don[msg3][3];
+ xmn= (don[msg3][1] << 2)*res;
+ 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(integer,(cardinal)y >> 3)+ (msg3 << 8);
+ if (ix!=msg4)
+ {
+ invers(1);
+ msg4=ix;
+ invers(0);
+ }
+ }
+ else if (msg4!=no_choice)
+ {
+ invers(1);
+ msg4=no_choice;
+ }
+ }
+
+void menu_down( integer ii)
+ {
+ integer cx, xcc;
+ integer xco, nb_lig;
+
+ /* debug('menu_down'); */
+ xco=don[ii][1];
+ nb_lig= don[ii][4];
+ hide_mouse();
+ sauvecr(10,succ(byte,don[ii][2]) << 1);
+ xco= xco << 3;
+ if (res==1) cx=10; else cx=6;
+ xcc= xco+ (don[ii][3]*cx)+6;
+ box(15, gd, xco,12, xcc, 10 + (don[ii][2] << 1), 255);
+ box(0, gd, xcc, 12, xcc+4, 10 + (don[ii][2] << 1),255);
+ box(0,gd,xco, 8 + (don[ii][2] << 1), xcc+4, 12 + (don[ii][2] << 1),255);
+ putxy(xco,16);
+ cx=0;
+ do {
+ cx= succ(integer,cx);
+ switch (ii) {
+ case 1 : if (inv[cx][1]!= '*') writeg(inv[cx],4); break;
+ case 2 : if (dep[cx][1]!= '*') writeg(dep[cx],4); break;
+ case 3 : if (act[cx][1]!= '*') writeg(act[cx],4); break;
+ case 4 : if (self_[cx][1]!='*') writeg(self_[cx],4); break;
+ case 5 : if (dis[cx][1]!= '*') writeg(dis[cx],4); break;
+ case 6 : writeg(fic[cx],4); break;
+ case 7 : writeg(fic[1]+' '+chr(48+cx),4); break;
+ case 8 : if (cx==1) writeg( recom,4);
+ else writeg(fic[2]+' '+chr(47+cx),4);
+ break;
+ }
+ putxy(xco,ywhere+8);
+ } while (!(cx==nb_lig));
+ test0=true;
+ show_mouse();
+ }
+
+void menu_up(integer xx)
+ {
+ /* debug('menu_up'); */
+ if (test0)
+ {
+ charecr(10,succ(byte,don[xx][2]) << 1);
+ test0=false;
+ }
+ }
+
+void erase_menu()
+ {
+ /* debug('erase_menu'); */
+ active_menu=false;
+ clic=false;
+ menu_up(msg3);
+ }
+
+void mdn()
+ {
+ integer x,y,c,a,ix;
+ boolean tes;
+
+ /* debug('mdn'); */
+ if (! active_menu) return;
+ x=x_s; y=y_s;
+ if (! clic)
+ {
+ if ((x==xprec) &&
+ (y==yprec)) return;
+ else {
+ xprec=x;
+ yprec=y;
+ }
+ tes=(y<11) && ((set::of(range(28*res,28*res+24),range(76*res,76*res+24), eos).has(x))
+ || ((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;
+ else if (x<124*res) ix=depla;
+ 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 ((ix!=msg3) || (! test0))
+ if (! ((ix==fichier) && (set::of(sauve, charge, eos).has(msg3))))
+ {
+ menu_up(msg3);
+ menu_down(ix);
+ msg3=ix;
+ msg4=no_choice;
+ }
+ }
+ else /* Not in the MenuTitle line */
+ {
+ if ((y>11) && (test0)) util(x,y);
+ }
+ }
+ else /* il y a eu 'clic' */
+ if ((msg3==fichier) && (msg4!=no_choice))
+ {
+ clic=false;
+ menu_up(msg3);
+ if (lo(msg4)==1) msg3=7;
+ else msg3=8;
+ menu_down(msg3);
+ }
+ else /* il y a eu clic sur un autre menu */
+ {
+ choisi=(test0) && (msg4!=no_choice);
+ menu_up(msg3);
+ msg[4]=msg4;
+ msg[3]=msg3;
+ msg3=no_choice;
+ msg4=no_choice;
+ clic=false;
+ }
+ }
+
diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h
new file mode 100644
index 0000000000..a4fe1e1b6b
--- /dev/null
+++ b/engines/mortevielle/mor.h
@@ -0,0 +1,1457 @@
+/* Niveau 14 suite */
+const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien";
+
+
+void testfi()
+ {
+ if (ioresult!= 0)
+ {
+ caff= do_alert(err_mess,1);
+ exit(0);
+ }
+ }
+
+
+integer readclock()
+{
+ registres r;
+ integer s, m, h;
+
+/* debug('readclock');*/
+ integer readclock_result;
+ r.ax = 0x2c00;
+ intr(0x21,r);
+ {
+ h=(cardinal)r.cx >> 8;
+ m=r.cx % 256;
+ s=(cardinal)r.dx >> 8;
+ }
+ m= m * 60;
+ h= h* 3600;
+ readclock_result= h+ m+ s;
+ return readclock_result;
+}
+
+void modif(integer& 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;
+}
+
+
+void dessine(integer ad, integer x, integer y)
+{
+ /* debug('dessine'); */
+ hide_mouse();
+ writepal(numpal);
+ pictout(ad,0,x,y);
+ show_mouse();
+}
+
+void dessine_rouleau()
+{
+ /* debug('dessine_rouleau'); */
+ writepal(89);
+ if (gd==her)
+ {
+ mem[0x7000+14]=15;
+ }
+ hide_mouse();
+ pictout(0x73a2,0,0,0);
+ show_mouse();
+}
+
+
+void text_color(integer c)
+{
+ color_txt= c;
+}
+
+/* NIVEAU 13 */
+
+
+void text1(integer x,integer y,integer nb,integer m)
+{
+ phrase st;
+ integer tay;
+ integer co;
+
+
+ /* debug('text'); */
+ if (res==1) co=10; else co=6;
+ deline(m,st,tay);
+ if ((y==182) && (tay*co>nb*6)) y=176;
+ afftex(st,x,y,nb,20,color_txt);
+}
+
+void initouv()
+ {
+ integer cx;
+
+ /* debug('initouv'); */
+ for( cx= 1; cx <= 7; cx ++) touv[cx]= chr(0);
+ }
+
+void ecrf1()
+{
+ boite(0, 11, 512, 163, 15); /* grand dessin */
+}
+
+void clsf1()
+{
+ integer i,j;
+
+ /* debug('clsf1'); */
+ hide_mouse();
+ box(0,gd, 0,11, 514,175, 255);
+/* if Gd=ams then port[$3DD]:=15;
+ case Gd of
+ ams,
+ cga : begin
+ for j:=0 to 63 do
+ begin
+ for i:=6 to 86 do
+ begin
+ mem[$B800:i*80+j]:=0;
+ mem[$Ba00:i*80+j]:=0;
+ end;
+ mem[$b800:6960+j]:=0;
+ mem[$ba00:400+j]:=0;
+ end;
+ end;
+ ega : begin
+ port[$3C4]:= 2;
+ port[$3C5]:= 15;
+ port[$3CE]:= 8;
+ port[$3CF]:= 255;
+ for j:=0 to 63 do
+ for i:=11 to 174 do
+ mem[$A000:i*80+j]:=0;
+ end;
+ tan : begin
+ for j:=0 to 128 do
+ begin
+ for i:=3 to 43 do
+ begin
+ mem[$B800:i*160+j]:=0;
+ mem[$Ba00:i*160+j]:=0;
+ mem[$bc00:i*160+j]:=0;
+ if i<>43 then mem[$be00:i*160+j]:=0;
+ end;
+ mem[$be00:320+j]:=0;
+ end;
+ end;
+ end;
+ droite(256*res,11,256*res,175,0);*/
+ show_mouse();
+}
+
+void clsf2()
+{
+ integer i,j;
+
+ /* debug('clsf2'); */
+ hide_mouse();
+ if (f2_all)
+ {
+ box(0,gd,1,176,633,199,255);
+ boite(0,175,634,24,15);
+ f2_all=false;
+ }
+ else
+ {
+ box(0,gd,1,176,633,190,255);
+ boite(0,175,634,15,15);
+ }
+ show_mouse();
+}
+
+void ecrf2()
+{
+ /* debug('ecrf2'); */
+ text_color(5);
+ /*boite(0,175,630,15,15);*/
+}
+
+void ecr2(str255 str_)
+{
+ integer tab;
+ integer tlig;
+
+ /* debug('ecr2 : '+str_);*/
+ if (res==1) tab=10; else tab=6;
+ putxy(8,177);
+ tlig=59+pred(integer,res)*36;
+ if (length(str_)<tlig) writeg(str_,5);
+ else if (length(str_)<(tlig << 1))
+ {
+ putxy(8,176);
+ writeg(copy(str_,1,pred(integer,tlig)),5);
+ putxy(8,182);
+ writeg(copy(str_,tlig,tlig << 1),5);
+ }
+ else {
+ f2_all=true;
+ clsf2();
+ putxy(8,176);
+ writeg(copy(str_,1,pred(integer,tlig)),5);
+ putxy(8,182);
+ writeg(copy(str_,tlig,pred(integer,tlig << 1)),5);
+ putxy(8,190);
+ writeg(copy(str_,tlig << 1,tlig*3),5);
+ }
+}
+
+void clsf3()
+{
+ integer i,j;
+
+ /* debug('clsf3'); */
+ hide_mouse();
+ box(0,gd,1,192,633,199,255);
+ boite(0,191,634,8,15);
+ show_mouse();
+}
+
+void ecr3(str255 text)
+{
+ /* debug('ecr3 : '+text);*/
+ clsf3();
+ putxy(8,192);
+ writeg(text,5);
+}
+
+void ecrf6()
+{
+ /* debug('ecrf6'); */
+ text_color(5);
+ boite(62, 33, 363, 80, 15);
+}
+
+void ecrf7()
+{
+ text_color(4);
+/* draw_mode(2);
+ text_height(4*res);
+ text_style(normal);*/
+}
+
+void clsf10()
+{
+ integer co,cod;
+ varying_string<8> st;
+
+ /* debug('clsf10'); */
+ hide_mouse();
+ if (res==1)
+ {
+ co=634;
+ cod=534;
+ }
+ else
+ {
+ co=600;
+ cod=544;
+ }
+ box(15,gd, cod, 93, co, 98, 255);
+ if (s.conf< 33) st="Cool";
+ else
+ if (s.conf< 66) st=" Lourde ";
+ else
+ if (s.conf> 65) st="Malsaine";
+ if (res==1) co=10; else co=6;
+ co= 574-((cardinal)co*length(st) >> 1);
+ putxy(co,92);
+ writeg(st,4);
+ if (res==1) co=620; else co=584;
+ box(15,gd, 560, 24, co, 86, 255);
+/* rempli(69,12,32,5,255);*/
+ show_mouse();
+}
+
+ void stop()
+ {
+ clrscr;
+ hirs();
+ gd=ams;
+ hirs();
+ exit(0);
+ }
+
+void paint_rect(integer x, integer y, integer dx, integer dy)
+ {
+ integer co;
+
+ /* debug('paint_rect'); */
+ if (gd==cga) co= 3;
+ else co=11;
+ box(co,gd,x,y,x+dx,y+dy,255);
+ }
+
+integer hazard(integer min,integer max)
+ {
+ integer ha1;
+ real ha2;
+
+ /* debug('hazard'); */
+ integer hazard_result;
+ ha2= Random();
+ ha1= trunc(ha2*(max-min));
+ hazard_result= min+ ha1;
+ return hazard_result;
+ }
+
+void calch(integer& j,integer& h,integer& m)
+{
+ integer th,nh;
+
+/* debug('calch');*/
+ nh= readclock();
+ th= jh+ ((nh- mh) / t);
+ m= ((th % 2)+ vm)* 30;
+ h= ((cardinal)th >> 1)+ vh;
+ if (m== 60)
+ {
+ m= 0;
+ h= h+ 1;
+ }
+ j= (h / 24)+ vj;
+ h= h- ((j- vj)* 24);
+}
+
+void conv(integer x, integer& y)
+{
+ integer cx;
+
+ /* debug('conv'); */
+ cx= 1;
+ y= 128;
+ while (cx< x)
+ {
+ y= (cardinal)y >> 1;
+ cx= succ(integer,cx);
+ }
+}
+
+/* NIVEAU 12 */
+void okpas()
+{
+ tesok=true;
+}
+
+void modobj(integer m)
+{
+ phrase str_;
+ str30 strp;
+ integer i,tay;
+
+ /* debug('modobj'); */
+ strp=' ';
+ if (m!= 500)
+ {
+ deline(m- 501+ c_st41,str_,tay);
+ strp= delig;
+ }
+ menut( invt[8], strp);
+ menu_disable( invt[8]);
+}
+
+void modobj2(integer m,boolean t1,boolean t2)
+{
+ phrase str_;
+ str30 strp;
+ integer i,tay;
+
+ /* debug('modobj'); */
+ strp=' ';
+ if (t1 || t2) okpas();
+ else tesok=false;;
+ if (m!= 500)
+ {
+ deline(m- 501+ c_st41,str_,tay);
+ strp= delig;
+ }
+ menut( invt[8], strp);
+ menu_disable( invt[8]);
+}
+
+
+void repon(integer f,integer m)
+{
+ str255 str_;
+ varying_string<40> str1;
+ phrase st;
+ text1 fic;
+ integer 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(integer,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== 2)
+ {
+ clsf2();
+ ecrf2();
+ text1(8, 182, 103, m);
+ if ((m== 68) || (m== 69)) s.teauto[40]= '*';
+ if ((m== 104) && (caff== 14))
+ {
+ s.teauto[36]= '*';
+ if (s.teauto[39]== '*')
+ {
+ s.pourc[3]= '*';
+ s.teauto[38]= '*';
+ }
+ }
+ }
+ if (set::of(6,9, eos).has(f))
+ {
+ deline(m,st,tay);
+ 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 (f== 7) /* messint */
+ {
+ ecrf7();
+ deline(m,st,tay);
+ if (res==1)
+ {
+ xco=252-tay*5;
+ caspe= 100;
+ dx= 80;
+ }
+ else
+ {
+ xco=252-tay*3;
+ caspe= 144;
+ dx=50;
+ }
+ if (tay<40) afftex(st,xco,86,dx,3,5);
+ else afftex(st,caspe,86,dx,3,5);
+ }
+ }
+}
+
+void f3f8()
+{
+ integer co;
+
+ if (res==1) co=107; else co=64;
+ putxy(3,44);
+ writeg(f3,5);
+ ywhere= 51;
+ writeg(f8,5);
+ boite(0,42,co,16,7);
+}
+
+void t5(integer cx)
+{
+ /* debug('t5'); */
+ if (cx== 10) blo= false;
+ if (cx!= 1)
+ {
+ bh1= false;
+ bf1= 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;
+}
+
+void affper(integer per)
+{
+ integer cx;
+
+ /* debug('affper'); */
+ for( cx= 1; cx <= 8; cx ++) menu_disable( disc[cx]);
+ clsf10();
+ if ((per & 128)== 128)
+ {
+ putxy(560,24);
+ writeg("LEO",4);
+ menu_enable( disc[1]);
+ }
+ if ((per & 64)== 64)
+ {
+ putxy(560, 32);
+ writeg("PAT",4);
+ menu_enable( disc[2]);
+ }
+ if ((per & 32)== 32)
+ {
+ putxy(560, 40);
+ writeg("GUY",4);
+ menu_enable( disc[3]);
+ }
+ if ((per & 16)== 16)
+ {
+ putxy(560,48);
+ writeg("EVA",4);
+ menu_enable( disc[4]);
+ }
+ if ((per & 8)== 8)
+ {
+ putxy(560,56);
+ writeg("BOB",4);
+ menu_enable( disc[5]);
+ }
+ if ((per & 4)== 4)
+ {
+ putxy(560, 64);
+ writeg("LUC",4);
+ menu_enable( disc[6]);
+ }
+ if ((per & 2)== 2)
+ {
+ putxy(560, 72);
+ writeg("IDA",4);
+ menu_enable( disc[7]);
+ }
+ if ((per & 1)== 1)
+ {
+ putxy(560, 80);
+ writeg("MAX",4);
+ menu_enable( disc[8]);
+ }
+ ipers= per;
+}
+
+/* overlay */ void choix(integer min,integer max, integer& per)
+{
+ boolean i;
+ integer haz,cx,cy,cz;
+ long_integer per2,cz2;
+
+ /* debug('o0 choix'); */
+ haz= hazard(min,max);
+ if (haz> 4)
+ {
+ haz= 8- haz;
+ i= true;
+ }
+ else i= false;
+ cx= 0;
+ per= 0;
+ while (cx< haz)
+ {
+ cy= hazard(1,8);
+ conv(cy,cz);
+ if ((per & cz)!= cz)
+ {
+ cx= cx+ 1;
+ per= (per | cz);
+ }
+ }
+ if (i) per= 255- per;
+ i= false;
+}
+
+/* overlay */ void cpl1(integer& p)
+{
+ integer 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;
+ mdn();
+}
+
+/* overlay */ void cpl2(integer& p)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl3(integer& p)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl5(integer& p)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl6(integer& p)
+{
+ integer 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;
+}
+
+void person()
+{
+ const char m1[] = "Vous";
+ const char m2[] = "ˆtes";
+ const char m3[] = "SEUL";
+ integer cf;
+ str255 str_;
+
+ /* debug('person'); */
+ for( cf= 1; cf <= 8; cf ++) menu_disable( disc[cf]);
+ clsf10();
+ putxy(560, 30);
+ writeg(m1,4);
+ putxy(560, 50);
+ writeg(m2,4);
+ putxy(560, 70);
+ writeg(m3,4);
+ ipers= 0;
+}
+
+void chlm(integer& per)
+{
+ /* debug('chlm'); */
+ per= hazard(1,2);
+ if (per== 2) per= 128;
+}
+
+void pendule()
+{
+ const matrix<1,2,1,12,integer> cv
+ = {{{{ 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0}},
+ {{-5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6}} }};
+ const integer x = 580;
+ const integer y = 123;
+ const integer rg = 9;
+ integer h,co;
+
+
+ /* debug('pendule'); */
+ hide_mouse();
+ /*paint_rect(572,114,18,20);
+ paint_rect(577,114,6,20);*/
+ paint_rect(570,118,20,10);
+ paint_rect(578,114,6,18);
+ if (set::of(cga,her, eos).has(gd)) co=0; else co=1;
+ if (min== 0) droite(((cardinal)x >> 1)*res, y, ((cardinal)x >> 1)*res, (y- rg), co);
+ else droite(((cardinal)x >> 1)*res, y, ((cardinal)x >> 1)*res, (y+ rg), co);
+ h= heu;
+ if (h> 12) h= h- 12;
+ if (h== 0) h= 12;
+ droite(((cardinal)x >> 1)*res, y, ((cardinal)(x+ cv[1][h]) >> 1)*res, y+ cv[2][h], co);
+ show_mouse();
+ putxy( 568, 154);
+ if (heu> 11) writeg( "PM ",1);
+ else writeg( "AM ",1);
+ putxy( 550, 160);
+ if (set::of(range(0,8), eos).has(jou)) writeg(string(chr(jou+49))+"& jour",1);
+}
+
+/*************
+ * NIVEAU 11 *
+ *************/
+
+void debloc(integer l)
+{
+/* debug('debloc'); */
+ num= 0;
+ x= 0;
+ y= 0;
+ if ((l!= 26) && (l!= 15)) t5(l);
+ mpers= ipers;
+}
+
+/* overlay */ void cpl10(integer& p,integer& h)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl11(integer& p,integer& h)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl12(integer& p)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl13(integer& p)
+{
+/* debug('o1 cpl13'); */
+ p= 0;
+}
+
+/* overlay */ void cpl15(integer& p)
+{
+ integer 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;
+}
+
+/* overlay */ void cpl20(integer& p,integer& h)
+{
+ integer 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;
+}
+
+/* overlay */ void quelq1(integer l)
+{
+ integer 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;
+ ipers= 10;
+}
+
+/* overlay */ void quelq2()
+{
+/* debug('o1 quelq2'); */
+ if (li== 2) bh2= true; else bh9= true;
+ ipers= 10;
+}
+
+/* overlay */ void quelq5()
+{
+/* debug('o1 quelq5'); */
+ bh5= true;
+ ipers= 10;
+}
+
+/* overlay */ void quelq6(integer l)
+{
+ integer per;
+
+/* debug('o1 quelq6'); */
+ if (l== 6) bh6= true;
+ if (l== 8) bh8= true;
+ ipers= 10;
+}
+
+/* overlay */ void quelq10(integer h, integer& per)
+{
+ integer min,max;
+
+/* debug('o1 quelq10'); */
+ if ((h>= 0) && (h< 8)) chlm(per); else
+ {
+ if ((h> 7) && (h< 10))
+ {
+ min= 5;
+ max= 7;
+ }
+ if ((h> 9) && (h< 12))
+ {
+ min= 1;
+ max= 4;
+ }
+ if (((h> 11) && (h< 15)) || ((h> 18) && (h< 21)))
+ {
+ min= 6;
+ max= 8;
+ }
+ if (((h> 14) && (h< 19)) || ((h> 20) && (h< 24)))
+ {
+ min= 1;
+ max= 5;
+ }
+ choix(min,max,per);
+ }
+ affper(per);
+}
+
+/* overlay */ void quelq11(integer h, integer& per)
+{
+ integer min,max;
+
+/* debug('o1 quelq11'); */
+ 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)))
+ {
+ min= 1;
+ max= 4;
+ }
+ if (((h> 11) && (h< 14)) || ((h> 18) && (h< 21)))
+ {
+ min= 1;
+ max= 2;
+ }
+ choix(min,max,per);
+ }
+ affper(per);
+}
+
+/* overlay */ void quelq12(integer& per)
+{
+/* debug('o1 quelq12'); */
+ chlm(per);
+ affper(per);
+}
+
+/* overlay */ void quelq15(integer& per)
+{
+ integer cx;
+ boolean 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);
+ }
+}
+
+/* overlay */ void quelq20(integer h, integer& per)
+{
+ integer min,max;
+
+/* debug('o1 quelq20'); */
+ 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))
+ {
+ min= 1;
+ max= 2;
+ }
+ if (h== 18)
+ {
+ min= 2;
+ max= 4;
+ }
+ choix(min,max,per);
+ }
+ affper(per);
+}
+
+
+/* overlay */void frap()
+{
+ integer j,h,m,haz;
+
+/* debug('o1 frap'); */
+ calch(j,h,m);
+ if ((h>= 0) && (h< 8)) crep= 190; else
+ {
+ haz= hazard(1,100);
+ if (haz> 70) crep= 190; else crep= 147;
+ }
+}
+
+/* overlay */ void nouvp(integer l, integer& 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);
+}
+
+
+
+/* overlay */ void tip(integer ip, integer& 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;
+}
+
+
+/* overlay */ void ecfren(integer& p,integer& haz, integer cf,integer l)
+{
+/* debug('o1 ecfren'); */
+ 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 (p!= -500)
+ {
+ p= p+ cf;
+ haz= hazard(1,100);
+ }
+}
+
+/* overlay */ void becfren(integer l)
+{
+ integer haz;
+
+/* debug('o1 becfren'); */
+ if ((l== 1) || (l== 4))
+ {
+ haz= hazard(1,2);
+ if (l== 1)
+ 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;
+}
+
+/* NIVEAU 10 */
+void init_nbrepm()
+{
+ const array<1,8,byte> ipm
+ = {{4,5,6,7,5,6,5,8}};
+ integer i;
+
+/* debug('init_nbrepm'); */
+ i= 0;
+ do {
+ i= succ(integer,i);
+ nbrepm[i]= ipm[i];
+ } while (!(i==8));
+}
+
+void phaz(integer& haz,integer& p, integer cf)
+{
+/* debug('phaz'); */
+ p= p+ cf;
+ haz= hazard(1,100);
+}
+
+/* overlay */ void inzon()
+{
+ integer cx;
+
+/* 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;
+ init_nbrepm();
+}
+
+/* overlay */ void dprog()
+{
+/* debug('o2 dprog'); */
+ li= 21;
+ /* jh:= t_settime(0);*/
+ jh= 0;
+ if (! s.ipre) blo= true;
+ t= ti1;
+ mh= readclock();
+}
+
+/* overlay */ void pl1(integer cf)
+{
+ integer p, haz;
+
+/* debug('o2 pl1'); */
+ if (((li== 1) && (! bh1) && (! bf1))
+ || ((li== 4) && (! bh4) && (! bf4)))
+ {
+ cpl1(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq1(li);
+ }
+}
+
+/* overlay */ void pl2(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl2'); */
+ if (! bh2)
+ {
+ cpl2(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq2();
+ }
+}
+
+/* overlay */ void pl5(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl5'); */
+ if (! bh5)
+ {
+ cpl5(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq5();
+ }
+}
+
+/* overlay */ void pl6(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl6'); */
+ if (((li== 6) && (! bh6)) || ((li== 8) && (! bh8)))
+ {
+ cpl6(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq6(li);
+ }
+}
+
+/* overlayi */ void pl9(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl9'); */
+ if (! bh9)
+ {
+ cf= -10;
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq2();
+ }
+}
+
+/* overlayi */ void pl10(integer cf)
+{
+ integer p,h,haz;
+
+/* debug('o2 pl10'); */
+ cpl10(p,h);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq10(h,p);
+}
+
+/* overlay */ void pl11(integer cf)
+{
+ integer p,h,haz;
+
+/* debug('o2 pl11'); */
+ cpl11(p,h);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq11(h,p);
+}
+
+/* overlay */ void pl12(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl12'); */
+ cpl12(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq12(p);
+}
+
+/* overlay */ void pl13(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl13'); */
+ cpl13(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq12(p);
+}
+
+/* overlay */ void pl15(integer cf)
+{
+ integer p,haz;
+
+/* debug('o2 pl15'); */
+ cpl15(p);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq15(p);
+}
+
+/* overlay */ void pl20(integer cf)
+{
+ integer p,h,haz;
+
+/* debug('o2 pl20'); */
+ cpl20(p,h);
+ phaz(haz,p,cf);
+ if (haz> p) person(); else quelq20(h,p);
+}
+
+/* overlay */ void t11(integer l11, integer& a)
+{
+ integer p,haz,h;
+
+/* debug('o2 t11'); */
+ ecfren(p,haz,s.conf,l11);
+ li= l11;
+ if ((l11> 0) && (l11< 10))
+ if (p!= -500)
+ {
+ if (haz> p)
+ {
+ person();
+ a= 0;
+ }
+ else
+ {
+ becfren(li);
+ nouvp(li,a);
+ }
+ }
+ 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);
+ 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);
+ a= p;
+ }
+ }
+}
+
+/* overlay */ void cavegre()
+
+{
+ integer haz;
+
+/* debug('cavegre'); */
+ s.conf= s.conf+ 2;
+ if (s.conf> 69) s.conf= s.conf+ (s.conf / 10);
+ clsf3();
+ ecrf2();
+ ecr3(m1);
+ haz= (hazard(0, 4))- 2;
+ parole(2, haz, 1);
+ for( haz=0; haz <= 3000; haz ++);
+ clsf3();
+ person();
+}
+
+void writetp(str255 s,integer t)
+{
+ if (res==2) writeg(s,t);
+ else writeg(copy(s,1,25),t);
+}
+
+void messint(integer nu)
+{
+/* debug('messint'); */
+ clsf1();
+ clsf2();
+ clsf3();
+ decomp( 0x73a2, 1008);
+ memw[0x7413+12]= 80;
+ memw[0x7413+14]= 40;
+ writepal(90);
+ afff(gd,0x73a2, 1008,0,0);
+ afff(gd,0x73a2, 1008,0,70);
+ repon(7,nu);
+}
+
+void aniof(integer ouf,integer num)
+ {
+ integer ad, offset;
+ char c;
+
+ /* 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);
+ decomp(ad,offset);
+ hide_mouse();
+ afff(gd,ad,offset,0,12);
+ ecrf1();
+ show_mouse();
+ }
+
+void musique(integer so)
+{
+ boolean i;
+ integer haz;
+/* dep: array[1..5] of long_integer;*/
+
+/* debug('musique'); */
+ if (so== 0) /*musik(0)*/ {; }
+ else
+ if ((prebru== 0) && (! s.ipre))
+ {
+ parole(10, 1, 1);
+ prebru= prebru+ 1;
+ }
+ else
+ {
+ i= false;
+ if ((s.mlieu== 19) || (s.mlieu== 21) || (s.mlieu== 22))
+ {
+ haz= hazard(1,3);
+ if (haz== 2)
+ {
+ haz= hazard(2,4);
+ parole(9,haz,1);
+ i= true;
+ }
+ }
+ if (s.mlieu== 20)
+ {
+ haz= hazard(1,2);
+ if (haz== 1)
+ {
+ parole(8,1,1);
+ i= true;
+ }
+ }
+ if (s.mlieu== 24)
+ {
+ haz= hazard(1,2);
+ if (haz== 2)
+ {
+ parole(12,1,1);
+ i= true;
+ }
+ }
+ if (s.mlieu== 23)
+ {
+ parole(13,1,1);
+ i= true;
+ }
+ if (! i)
+ {
+ /* dep[1]:= 1416;
+ dep[2]:= 1512;
+ dep[3]:= 1692;
+ dep[4]:= 1884;
+ dep[5]:= 2046;
+ haz:= hazard(1,5);
+ musik(dep[haz]);*/
+ haz= hazard(1,17);
+ parole(haz,1,2);
+ }
+ }
+}
+
+/* NIVEAU 9 */
+void dessin(integer ad)
+{
+ integer cx;
+
+/* debug('dessin'); */
+ if (ad!= 0) dessine(ades,((ad % 160)* 2),(ad / 160));
+ else
+ {
+ clsf1();
+ if (caff> 99)
+ {
+ dessine(ades,60,33);
+ boite(118, 32, 291, 121, 15); /* cadre moyen */
+ }
+ else
+ if (caff> 69)
+ {
+ dessine(ades,112,48); /* tˆtes */
+ boite(222, 47, 155, 91, 15);
+ }
+ else
+ {
+ 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]));
+ if (caff== 13)
+ {
+ 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< 26) musique(1);
+ }
+ }
+}
+
+
+
diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h
new file mode 100644
index 0000000000..8edf601458
--- /dev/null
+++ b/engines/mortevielle/mor2.h
@@ -0,0 +1,764 @@
+const array<1,11,integer> men
+ = {{ scacher, attacher, defoncer, dormir,
+ entrer, fermer, frapper, manger,
+ mettre, ouvrir, sortir }};
+
+void tinke()
+{
+ const char m1[] = "Mince! Vous entendez du bruit...";
+ const char d1[] = " | Vous devriez avoir remarqu‚| ";
+ const char d2[] = "% des indices...";
+ const char d3 = '[';
+ const char d4 = ']';
+ const char d5 = '1';
+ const char d6[] = "OK";
+ integer cx,cy,haz,nh,cf,j,h,m,cd;
+ varying_string<3> stpo;
+ boolean am;
+
+ anyone= false;
+ calch(j,h,m);
+ if (j!= jou)
+ {
+ jou= j;
+ cx=0;
+ do {
+ cx=cx+1;
+ if (nbrepm[cx]!= 0) nbrepm[cx]= nbrepm[cx]- 1;
+ nbrep[cx]= 0;
+ } while (!(cx==8));
+ }
+ if ((h> heu) || ((h== 0) && (heu== 23)))
+ {
+ heu= h;
+ 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);
+ stpou= string(d3)+ d5+ d4+ d3+ d1+ stpo+ '0'+ d2+ d4+ d3+ d6+ d4;
+ }
+ if (m> min)
+ {
+ min= 30;
+ pendule();
+ }
+ if (y_s<12) return;
+ if (! blo)
+ {
+ if ((h== 12) || ((h> 18) && (h< 21)) || ((h>= 0) && (h< 7)))
+ t= ti2; else t= ti1;
+ cf= s.conf;
+ if ((cf> 33) && (cf< 66)) t= t- (t / 3);
+ if (cf> 65) t= t- ((t / 3)* 2);
+ nh= readclock();
+ if ((nh- mh)> t)
+ {
+ am= active_menu;
+ erase_menu();
+ jh= jh+ ((nh- mh)/ t);
+ mh= nh;
+ switch (li) {
+ case 1:case 4 : pl1(cf); break;
+ case 2 : pl2(cf); break;
+ case 5 : pl5(cf); break;
+ case 6:case 8 : pl6(cf); break;
+ case 9 : pl9(cf); break;
+ case 10 : pl10(cf); break;
+ case 11 : pl11(cf); break;
+ case 12 : pl12(cf); break;
+ case 13:case 14 : pl13(cf); break;
+ case 15:case 26 : pl15(cf); break;
+ case 20 : pl20(cf); break;
+ }
+ if ((mpers!= 0) && (ipers!= 10)) mpers= ipers;
+ if ((mpers== 0) && (ipers> 0))
+ if ((s.mlieu== 13) || (s.mlieu== 14)) cavegre(); else
+ if (ipers== 10)
+ {
+ ipers= 0;
+ if (! brt)
+ {
+ brt= true;
+ hdb= readclock();
+ haz= hazard(1,5);
+ if (haz< 5)
+ {
+ clsf3();
+ ecrf2();
+ ecr3(m1);
+ haz= (hazard(0, 4))- 2;
+ parole(1, haz, 1);
+ clsf3();
+ }
+ }
+ }
+ if (am) draw_menu();
+ }
+ }
+ hfb= readclock();
+ if ((brt) && ((hfb- hdb)> 17))
+ {
+ nouvp(li,cx);
+ brt= false;
+ hdb= 0;
+ if ((s.mlieu> 0) && (s.mlieu< 10)) anyone= true;
+ }
+}
+
+void fenat(char ans)
+{
+ integer coul;
+
+ hide_mouse();
+ if (gd==cga) coul=2;
+ else if (gd==her) coul=1; else coul=12;
+ affcar(gd,306,193,coul,ord(ans));
+ boite(300, 191, 16, 8, 15);
+ show_mouse();
+}
+
+
+/* NIVEAU 8 */
+void afdes(integer ad)
+{
+ taffich();
+ dessin(ad);
+ okdes= false;
+}
+
+void tkey1(boolean d)
+{
+ boolean quest;
+ integer x,y,c;
+ integer key;
+
+ hide_mouse();
+ fenat('K');
+ while (keypressed()) key=testou();
+ do {
+ if (d) tinke();
+ quest=keypressed();
+ read_pos_mouse(x,y,c);
+ } while (!(quest || (c!=0) || (d && anyone)));
+ if (quest) key=testou();
+ clic=false;
+ show_mouse();
+}
+
+void tmlieu(integer mli)
+{
+ integer cx, j, i, tail;
+ str30 nomp;
+ phrase st;
+
+
+ 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 (length(nomp)<30) nomp=nomp+' ';
+ menut( depl[i], nomp);
+ i=i+1;
+ }
+ nomp= "* ";
+ for( cx= 7; cx >= i; cx --) menut( depl[cx], nomp);
+}
+
+
+/* NIVEAU 7 */
+void tlu(integer af,integer ob)
+{
+ caff= 32;
+ afdes(0);
+ repon(6,ob+ 4000);
+ repon(2,999);
+ tkey1(true);
+ caff= af;
+ msg[3]= no_choice;
+ crep= 998;
+}
+
+void delin(integer n)
+ {
+ phrase s;
+ integer t;
+
+ deline(n,s,t);
+ }
+
+void affrep()
+{
+ caff= s.mlieu;
+ crep= s.mlieu;
+}
+
+void mfouen()
+
+{
+ integer cx;
+
+ tmlieu(s.mlieu);
+ for( cx=1; cx <= 11; cx ++) menu_enable( men[cx]);
+/* menu_enable( scacher);
+ menu_enable(menup, attacher);
+ menu_enable(menup, defoncer);
+ menu_enable(menup, dormir);
+ menu_enable(menup, entrer);
+ menu_enable(menup, fermer);
+ menu_enable(menup, frapper);
+ menu_enable(menup, manger);
+ menu_enable(menup, mettre);
+ menu_enable(menup, ouvrir);
+ menu_enable(menup, sortir); */
+ menut( sonder, " sonder ");
+ menut( soulever, " soulever ");
+}
+
+void atf3f8(integer& key)
+ {
+ do {
+ key= testou();
+ } while (!((key==61) || (key==66)));
+ }
+
+/* NIVEAU 6 */
+
+void tperd()
+{
+ integer cx;
+
+ initouv();
+ ment= 0;
+ iouv= 0;
+ mchai= 0;
+ mfouen();
+ if (! blo) t11(21, cx);
+ perdu= true;
+ clsf1();
+ boite( 60, 35, 400, 50, 15);
+ repon(9,crep);
+ clsf2();
+ clsf3();
+ col= false;
+ syn= false;
+ okdes= false;
+}
+
+void tsort()
+{
+ integer 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);
+ ment= 0;
+ iouv= 0;
+ mchai= 0;
+ debloc(s.mlieu);
+}
+
+void st4(integer ob)
+{
+ crep= 997;
+ switch (ob) {
+ case 114 : crep=109; break;
+ case 110 : crep=107; break;
+ case 158 : crep=113; break;
+ case RANGE_5(152,156):case 150:
+ case 100:case 157:case 160:case 161 : tlu(caff,ob);
+ break;
+ }
+}
+
+void cherjer(integer ob, boolean& d)
+{
+ integer cx;
+
+ d= false;
+ for( cx= 1; cx <= 6; cx ++) d=(d || (ord(s.sjer[cx])== ob));
+ if (s.derobj== ob) d= true;
+}
+
+void st1sama()
+{
+ s.mlieu= 10;
+ affrep();
+}
+
+void modinv()
+{
+ integer cx, cy, tay, i, r;
+ phrase nom;
+ str30 nomp;
+
+ cy= 0;
+ for( cx=1; cx <= 6; cx ++)
+ if (s.sjer[cx]!= chr(0))
+ {
+ cy= succ(integer,cy);
+ r= (ord(s.sjer[cx])+ 400);
+ deline(r-501+c_st41,nom,tay);
+ nomp= delig;
+ menut( invt[cy], nomp);
+ menu_enable( invt[cx]);
+ }
+ if (cy<6)
+ for( cx=cy+1; cx <= 6; cx ++)
+ {
+ menut( invt[cx], " ");
+ menu_disable( invt[cx]);
+ }
+}
+
+void sparl(long_integer adr, long_integer rep)
+{
+ const array<1,8,integer> haut
+ = {{0,1,-3,6,-2,2,7,-1}};
+ integer key, ad, tay, repint;
+ phrase st;
+
+ repint=trunc(rep);
+ hide_mouse();
+ deline( repint+c_paroles,st,tay);
+ afftex(st,230,4,65,24,5);
+ f3f8();
+ /*boite(43,30,90,19,15);
+ gotoxy(7,5);
+ write('F3: Encore');
+ gotoxy(7,6);
+ write('F8: Stop');*/
+ key= 0;
+ do {
+ parole(repint, haut[caff- 69], 0);
+ atf3f8(key);
+ } while (!(key== 66));
+ hirs();
+ show_mouse();
+}
+
+void finfouil()
+ {
+ fouil= false;
+ obpart= false;
+ cs= 0;
+ is= 0;
+ mfouen();
+ }
+
+void mfoudi()
+{
+ integer cx;
+
+ for( cx= 1; cx <= 7; cx ++) menu_disable( depl[cx]);
+ for( cx=1; cx <= 11; cx ++) menu_disable( men[cx]);
+/* menu_disable(menup, scacher);
+ menu_disable(menup, attacher);
+ menu_disable(menup, defoncer);
+ menu_disable(menup, dormir);
+ menu_disable(menup, entrer);
+ menu_disable(menup, fermer);
+ menu_disable(menup, frapper);
+ menu_disable(menup, manger);
+ menu_disable(menup, mettre);
+ menu_disable(menup, ouvrir);
+ menu_disable(menup, sortir); */
+ menut( sonder, " -SUITE- ");
+ menut( soulever, " -STOP- ");
+}
+
+void mennor()
+{
+ menu_up(msg[3]);
+}
+
+void premtet()
+{
+ dessine(ades, 10, 80);
+ boite(18, 79, 155, 91, 15);
+}
+
+/* NIVEAU 5 */
+void ajchai()
+{
+ integer cx,cy,lderobj;
+
+
+ cy= (acha+ pred(integer,pred(integer,mchai)* 10));
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!((cx> 9) || (tabdon[cy+ cx]== 0)));
+ if (tabdon[cy+ cx]== 0)
+ {
+ lderobj= s.derobj;
+ tabdon[cy+ cx]=lderobj;
+ }
+ else crep= 192;
+}
+
+void ajjer(integer ob)
+{
+ integer cx;
+
+ cx= 0;
+ do {
+ cx= cx+ 1;
+ } while (!((cx> 5) || (ord(s.sjer[cx])== 0)));
+ if (ord(s.sjer[cx])== 0)
+ {
+ s.sjer[(cx)]= chr(ob);
+ modinv();
+ }
+ else crep= 139;
+}
+
+void t1sama() /* On entre dans le manoir */
+{
+ integer j,h,m;
+ boolean 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 */
+ {
+ crep= 1511;
+ tperd();
+ }
+ else st1sama();
+ }
+ else
+ if (! s.ipre) /* c'est votre premiŠre fois ? */
+ {
+ ipers= 255;
+ affper(ipers);
+ caff= 77;
+ afdes(0);
+ boite(223, 47, 155, 91, 15);
+ repon(2,33);
+ tkey1(false);
+ mennor();
+ hide_mouse();
+ hirs();
+ premtet();
+ sparl(0,140);
+ dessine_rouleau();
+ pendule();
+ show_mouse();
+ s.mlieu= 0;
+ affrep();
+ t5(10);
+ if (! blo) t11(0, m);
+ ipers= 0;
+ mpers= 0;
+ s.ipre= true;
+ /*chech;*/
+ }
+ else st1sama();
+}
+
+void t1vier()
+{
+ s.mlieu= 17;
+ affrep();
+}
+
+void t1neig()
+{
+ inei= inei+ 1;
+ if (inei> 2)
+ {
+ crep= 1506;
+ tperd();
+ }
+ else
+ {
+ okdes= true;
+ s.mlieu= 19;
+ affrep();
+ }
+}
+
+void t1deva()
+{
+ inei= 0;
+ s.mlieu= 21;
+ affrep();
+}
+
+void t1derr()
+{
+ s.mlieu = 22;
+ affrep();
+}
+
+void t1deau()
+{
+ crep = 1503;
+ tperd();
+}
+
+void tctrm()
+{
+ repon(2,(3000+ ctrm));
+ ctrm= 0;
+}
+
+
+void quelquun()
+
+{
+ integer haz,cx;
+
+ if (imen) erase_menu();
+ finfouil();
+ crep= 997;
+L1:
+ if (! cache)
+ {
+ 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; else
+ s.conf= s.conf+ (3* (s.conf / 10));
+ tsort();
+ tmlieu(15);
+ tip(ipers,cx);
+ caff= 69+ cx;
+ crep= caff;
+ msg[3]= discut;
+ msg[4]= disc[cx];
+ syn= true;
+ col= true;
+ }
+ else
+ {
+ haz= hazard(1, 3);
+ if (haz== 2)
+ {
+ cache= false;
+ crep= 137;
+ goto L1;
+ }
+ else
+ {
+ repon(2, 136);
+ haz= (hazard(0, 4))- 2;
+ parole(3, haz, 1);
+ clsf2();
+ person();
+ debloc(21);
+ affrep();
+ }
+ }
+ if (imen) draw_menu();
+}
+
+void tsuiv()
+{
+ integer cx,tbcl;
+ integer cl,cy;
+
+ cy= acha+ ((mchai- 1)* 10)- 1;
+ 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;
+ }
+ else
+ {
+ affrep();
+ finfouil();
+ if (cx> 9) crep= 131;
+ }
+}
+
+void tfleche()
+{
+ boolean qust;
+ char touch;
+ integer dummy,cd,xmo,ymo;
+
+ if (num== 9999) return;
+ fenat(chr(152));
+ rect= false;
+ do {
+ touch='\0';
+
+ do {
+ mov_mouse(qust,touch);
+ if (clic) rect=(x_s<256*res) && (y_s<176) && (y_s>12);
+ tinke();
+ } while (!(qust || rect || anyone));
+
+ if (qust && (touch=='\103')) dummy=do_alert(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(integer sx)
+
+ {
+ integer sy,ix,iy,cb,cy,ib;
+ integer a, b, atdon;
+
+
+ num= 0;
+ crep= 999;
+ a=0;
+ atdon=amzon+3;
+ cy= 0;
+ while (cy<caff)
+ {
+ a=a+tabdon[atdon];
+ atdon=atdon+4;
+ cy= succ(integer,cy);
+ }
+/* for cy:=0 to caff-1 do
+ a:=a+ tabdon[amzon+3+4*cy];
+ b:= peek(amzon+3+4*caff); */
+ b= tabdon[atdon];
+ if (b== 0) goto L1;
+ a= a+ fleche;
+ cb= 0;
+ for( cy= 0; cy <= (sx-2); cy ++)
+ {
+ ib= (tabdon[a+cb] << 8)+ tabdon[succ(integer,a+ cb)];
+ cb= cb+ (ib* 4)+ 2;
+ }
+ ib= (tabdon[a+cb] << 8)+ tabdon[succ(integer,a+ cb)];
+ if (ib== 0) goto L1;
+ cy= 1;
+ do {
+ cb= cb+ 2;
+ sx= tabdon[a+ cb] * res;
+ sy= tabdon[succ(integer,a+ cb)];
+ cb= cb+ 2;
+ ix= tabdon[a+ cb] * res;
+ iy= tabdon[succ(integer,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))
+
+ {
+ num= cy- 1;
+ return;
+ }
+L1:
+ crep= 997;
+ }
+
+
+void st7(integer 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);
+}
+
+void treg(integer ob)
+{
+ integer mdes;
+
+ mdes= caff;
+ caff= ob;
+ 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));
+ tkey1(true);
+ caff= mdes;
+ msg[3]= 0;
+ crep= 998;
+ }
+ else
+ {
+ obpart= true;
+ crep= caff+ 400;
+ mfoudi();
+ }
+}
+
+void avpoing(integer& ob)
+{
+ crep= 999;
+ if (s.derobj!= 0) ajjer(s.derobj);
+ if (crep!= 139)
+ {
+ modobj(ob+ 400);
+ s.derobj= ob;
+ ob= 0;
+ }
+}
+
+void rechai(integer& ch)
+{
+ integer cx;
+
+ cx= s.mlieu;
+ if (s.mlieu== 16) cx= 14;
+ ch= tabdon[achai+ (cx* 7)+ pred(integer,num)];
+}
+
+void t23coul(integer& l)
+{
+ boolean d;
+
+ cherjer(143,d);
+ l= 14;
+ if (! d)
+ {
+ crep= 1512;
+ tperd();
+ }
+}
+
+void maivid()
+{
+ s.derobj= 0;
+ modobj(500);
+}
+
+void st13(integer 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;
+}
+
+void aldepl()
+{
+ integer dummy;
+
+ dummy=do_alert("[1][Alors, utilisez le menu DEP...][ok]",1);
+}
diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp
new file mode 100644
index 0000000000..1fbd91c648
--- /dev/null
+++ b/engines/mortevielle/mort.cpp
@@ -0,0 +1,124 @@
+#include "ptoc.h"
+
+
+
+ /*$v-*/
+ /*$k-*/
+ /*$x-*/
+ /*$c-*/
+
+#include "var_mor.h" /* les variables */
+#include "keyboard.h" /* la gestion du clavier */
+#include "mouse.h" /* la souris */
+#include "level15.h" /* les fonctions de base */
+#include "droite.h" /* pour faire une droite */
+#include "boite.h"
+#include "sprint.h" /* l'affichage des textes */
+#include "outtext.h" /* fonctions sup‚rieures d'affichage */
+#include "parole.h" /* les fonctions de la parole */
+#include "alert.h"
+#include "parole2.h" /* les fonctions de la parole */
+ /* debug le debugging */
+#include "ques.h" /* les questions */
+#include "menu.h" /* les fonctions du menu */
+#include "mor.h" /* divers */
+#include "taffich.h" /* chargement des dessins */
+#include "ovd1.h" /* les fonctions sur disque 1 */
+#include "mor2.h" /* divers */
+#include "actions.h" /* les actions */
+#include "prog.h" /* fonctions toplevel */
+#include "disk.h" /* chargements et sauvegardes */
+
+/* ecrihexa utilitaire */
+
+void divers(integer np,boolean b)
+{
+ teskbd();
+ do {
+ parole(np, 0, 0);
+ atf3f8(key);
+ if (newgd!=gd)
+ {
+ gd=newgd;
+ hirs();
+ aff50(b);
+ }
+ } while (!(key== 66));
+}
+
+/* NIVEAU 0 */
+
+int main(int argc, const char* argv[])
+{
+/*init_debug;*/
+/* ecri_seg;*/
+ pio_initialize(argc, argv);
+ gd=cga;
+ newgd= gd;
+ zuul= false;
+ tesok= false;
+ chartex();
+ charpal();
+ charge_cfiph();
+ charge_cfiec();
+ zzuul(adcfiec+161,0,1644);
+ c_zzz= 1;
+ init_nbrepm();
+ init_mouse();
+/* crep:=memw[$7f00:0];
+ memw[$7f00:0]:= crep+1;
+ if (memw[$7f00:0]<> crep+1) then
+ begin
+ hirs;
+ show_mouse;
+ crep:=do_alert('[1][ 512 k minimum requis !!][OK]',1);
+ clrscr;
+ halt;
+ end;
+ if (Dseg+$1000>adbruit5) then
+ begin
+ hirs;
+ show_mouse;
+ crep:=do_alert('[1][ Il ne reste pas assez de |place m‚moire !!][OK]',1);
+ clrscr;
+ halt;
+ end;*/
+ init_lieu();
+ arret= false;
+ sonoff= false;
+ f2_all= false;
+ textcolor(9);
+ teskbd();
+ dialpre();
+ newgd= gd;
+ teskbd();
+ if (newgd!=gd) gd=newgd;
+ hirs();
+ ades= 0x7000;
+ aff50(false);
+ mlec= 0;
+ divers(142,false);
+
+ ani50();
+ divers(143,true);
+ suite();
+ music();
+ adzon();
+ takesav(0);
+ if (rech_cfiec) charge_cfiec();
+ for( crep=1; crep <= c_zzz; crep ++) zzuul(adcfiec+161,0,1644);
+ charge_bruit5();
+ init_menu();
+
+ theure();
+ dprog();
+ hirs();
+ dessine_rouleau();
+ show_mouse();
+ do { tjouer(); } while (!arret);
+ hide_mouse();
+ clrscr;
+/*out_debug;*/
+ return EXIT_SUCCESS;
+}
+
diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h
new file mode 100644
index 0000000000..3f250d91e4
--- /dev/null
+++ b/engines/mortevielle/mouse.h
@@ -0,0 +1,469 @@
+const integer m_arrow = 0;
+const integer m_point_hand = 1;
+
+boolean int_m,
+clic;
+
+integer m_show,
+x_s,
+y_s,
+p_o_s,
+mouse_shwn;
+
+matrix<0,5,0,11,integer> s_s;
+
+
+void init_mouse()
+{
+ integer i, j;
+ registres reg;
+
+ mouse_shwn= 0;
+ x_s= 0;
+ y_s= 0;
+ p_o_s= 0;
+ /*int_m:= False;*/
+ clic= false;
+ m_show= m_arrow;
+ if ((memw[0xcc]==0) && (memw[0xce]==0)) int_m= false;
+ if (int_m)
+ {
+ reg.ax= 0;
+ intr(0x33,reg);
+ int_m= (reg.ax==-1);
+ if (int_m)
+ {
+ {
+ reg.ax=4;
+ reg.cx=0;
+ reg.dx=0;
+ }
+ intr(0x33,reg);
+ }
+ }
+}
+
+/*procedure change_mouse( t : integer );
+begin
+ m_show:= t;
+end;*/
+
+/*procedure dessine_souris(xf,yf:integer);
+ var x, xx, y :integer;
+begin
+ case m_show of
+ m_arrow : begin
+ affput(2,Gd,xf,yf,0,0);
+ end;
+ end;
+end; */
+
+void hide_mouse()
+{
+ integer i,j,k,ps,ds;
+ boolean imp;
+
+ mouse_shwn = pred(integer,mouse_shwn);
+ if (mouse_shwn==0)
+ {
+ imp= odd(y_s);
+ j=p_o_s;
+ switch (gd) {
+ case cga : {
+ k=0;
+ j=((cardinal)y_s >> 1) * 80+ ((cardinal)x_s >> 2);
+ do {
+ memw[0xb000+j]=s_s[0][k];
+ memw[0xb800+j+2]=s_s[1][k];
+ memw[0xba00+j]=s_s[2][k];
+ memw[0xba00+j+2]=s_s[3][k];
+ j=j+80;
+ k= succ(integer,k);
+ } while (!(k>=5));
+ }
+ break;
+ case ams : {
+ for( i=0; i <= 3; i ++)
+ {
+ port[0x3dd]= 1 << i;
+ k=0;
+ j=p_o_s;
+ do {
+ if (imp)
+ {
+ memw[0xb800+j]=s_s[i][k];
+ j=j+80-0x2000;
+ }
+ else
+ {
+ memw[0xb800+j]=s_s[i][k];
+ j=j+0x2000;
+ }
+ imp=! imp;
+ k= succ(integer,k);
+ } while (!(k>=8));
+ }
+ }
+ break;
+ case ega : {
+ port[0x3c4]=2;
+ port[0x3ce]=8;
+ port[0x3cf]=255;
+ i= 0;
+ do {
+ port[0x3c5]= 1 << i;
+ k=0;
+ j=p_o_s;
+ do {
+ ps=mem[0xa000+j];
+ mem[0xa000+j]=lo(s_s[i][k]);
+ ps=mem[0xa000+j+1];
+ mem[0xa000+j+1]=hi(s_s[i][k]);
+ j=j+80;
+ k= succ(integer,k);
+ } while (!(k>=8));
+ i= i+1;
+ } while (!(i==4));
+ }
+ break;
+ case her : {
+ j= ((cardinal)y_s >> 1) *80+((cardinal)x_s >> 3);
+ for( i=0; i <= 5; i ++)
+ {
+ for( k=0; k <= 3; k ++) memw[0xb000+k*0x200+j]=s_s[i][k];
+ j=j+80;
+ }
+ }
+ break;
+ case tan : {
+ j= ((cardinal)y_s >> 2) *160+((cardinal)x_s >> 1);
+ k=0;
+ do {
+ for( i=0; i <= 3; i ++)
+ {
+ memw[0xb800+0x200*i+j]=s_s[k][i+(k << 2)];
+ memw[0xb800+0x200*i+j+2]=s_s[k+3][i+(k << 2)];
+ }
+ j=j+160;
+ k= succ(integer,k);
+ } while (!(k==3));
+ }
+ break;
+
+ } /* case Gd */
+ }
+}
+
+void show_mouse()
+{
+ integer i, j, k, l,
+ ps,ds;
+ boolean imp;
+ char c;
+
+ mouse_shwn = mouse_shwn +1;
+ if (mouse_shwn!=1) return;
+ j=p_o_s;
+ imp= odd(y_s);
+ i=x_s & 7;
+ switch (gd) {
+ case cga : {
+ k=0;
+ j=((cardinal)y_s >> 1) * 80+ ((cardinal)x_s >> 2);
+ do {
+ s_s[0][k]=memw[0xb800+j];
+ s_s[1][k]=memw[0xb800+j+2];
+ s_s[2][k]=memw[0xba00+j];
+ s_s[3][k]=memw[0xba00+j+2];
+ j=j+80;
+ k= succ(integer,k);
+ } while (!(k>=5));
+ }
+ break;
+ case ams : {
+ for( i=0; i <= 3; i ++)
+ {
+ j=p_o_s;
+ imp= odd(y_s);
+ port[0x3de]= i;
+ k=0;
+ do {
+ if (imp)
+ {
+ s_s[i][k]=memw[0xb800+j];
+ j=j+80-0x2000;
+ }
+ else
+ {
+ s_s[i][k]=memw[0xb800+j];
+ j=j+0x2000;
+ }
+ imp=! imp;
+ k= succ(integer,k);
+ } while (!(k>=8));
+ }
+ }
+ break;
+ case ega : {
+ port[0x3ce]=4;
+ l= 0;
+ do {
+ port[0x3cf]= l;
+ k=0;
+ j=p_o_s;
+ do {
+ s_s[l][k]= mem[0xa000+j]+(mem[0xa000+succ(integer,j)] << 8);
+ j=j+80;
+ k= succ(integer,k);
+ } while (!(k>=8));
+ l= l+1;
+ } while (!(l==4));
+ }
+ break;
+ case her : {
+ j= ((cardinal)y_s >> 1) *80+((cardinal)x_s >> 3);
+ for( i=0; i <= 5; i ++)
+ {
+ for( k=0; k <= 3; k ++) s_s[i][k]=memw[0xb000+k*0x200+j];
+ j=j+80;
+ }
+ }
+ break;
+ case tan : {
+ j= ((cardinal)y_s >> 2)*160+((cardinal)x_s >> 1);
+ k=0;
+ do {
+ for( i=0; i <= 3; i ++)
+ {
+ s_s[k][i+(k << 2)]=memw[0xb800+0x200*i+j];
+ s_s[k+3][i+(k << 2)]=memw[0xb800+0x200*i+j+2];
+ }
+ j=j+160;
+ k= succ(integer,k);
+ } while (!(k==3));
+ }
+ break;
+ } /* case Gd */
+ affput(2,gd,x_s,y_s,0,0);
+}
+
+void pos_mouse(integer x,integer y)
+{
+ registres reg;
+
+ if (x>314*res) x=314*res;
+ else if (x<0) x=0;
+ if (y>199) y=199;
+ else if (y<0) y=0;
+ if ((x==x_s) && (y==y_s)) return;
+ if (int_m)
+ {
+ {
+ reg.ax=4;
+ reg.cx=x;
+ reg.dx=y;
+ }
+ intr(0x33,reg);
+ }
+ hide_mouse();
+ x_s=x;
+ y_s=y;
+ switch (gd) {
+ case ams : {
+ p_o_s=((cardinal)y_s >> 1)*80+((cardinal)x_s >> 3)+(y_s & 1)*0x2000;
+ }
+ break;
+ /*cga : begin
+ P_O_S:=(Y_S shr 1)*80+X_S shr 2+(Y_S and 1)*$2000;
+ end;*/
+ case ega : {
+ p_o_s=y_s*80+((cardinal)x_s >> 3);
+ }
+ break;
+ } /* case Gd */
+ show_mouse();
+}
+
+void read_pos_mouse(integer& x,integer& y,integer& c)
+{
+ registres reg;
+
+ if (int_m)
+ {
+ reg.ax=3;
+ intr(0x33,reg);
+ x=reg.cx;
+ y=reg.dx;
+ c=reg.bx;
+ }
+ else
+ {
+ c=0;
+ x=x_s;
+ y=y_s;
+ }
+}
+
+void mov_mouse(boolean& funct, char& key)
+ {
+ boolean p_key;
+ char in1, in2;
+ integer x,y,cx,cy,cd;
+ registres reg;
+
+ if (int_m)
+ {
+ reg.ax=3;
+ intr(0x33,reg);
+ x=reg.cx;
+ y=reg.dx;
+ cd=reg.bx;
+ pos_mouse(x,y);
+ if (cd!=0)
+ {
+ clic=true;
+ return;
+ }
+ }
+ funct=false;
+ key='\377';
+ p_key=keypressed();
+ while (p_key)
+ {
+ input >> kbd >> in1;
+ read_pos_mouse(cx, cy, cd);
+ switch (upcase(in1)) {
+ case '4' : cx= cx - 8; break;
+ case '2' : cy= cy + 8; break;
+ case '6' : cx= cx + 8; break;
+ case '8' : cy= cy - 8; break;
+ case '7' : {
+ cy=1;
+ cx=1;
+ }
+ break;
+ case '1' : {
+ cx=1;
+ cy=190;
+ }
+ break;
+ case '9' : {
+ cx=315*res;
+ cy=1;
+ }
+ break;
+ case '3' : {
+ cy=190;
+ cx=315*res;
+ }
+ break;
+ case '5' : {
+ cy=100;
+ cx=155*res;
+ }
+ break;
+ case ' ': case '\15' : {
+ clic=true;
+ return;
+ }
+ break;
+ case '\33' : {
+ p_key=keypressed();
+ if (p_key)
+ {
+ input >> kbd >> in2;
+ switch (in2) {
+ case 'K' : cx= pred(integer,cx); break;
+ case 'P' : cy= succ(integer,cy); break;
+ case 'M' : cx= cx + 2; break;
+ case 'H' : cy= pred(integer,cy); break;
+ case RANGE_10(';','D') : {
+ funct= true;
+ key=in2;
+ return;
+ }
+ break;
+ case 'G' : {
+ cx=cx-1;
+ cy=cy-1;
+ }
+ 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;
+ case 'I' : {
+ cx= res*32;
+ cy= 8;
+ }
+ break;
+ case 'D' : {
+ cx= 80*res;
+ cy= 8;
+ }
+ break;
+ case 'A' : {
+ cx= 126*res;
+ cy= 8;
+ }
+ break;
+ case 'S' : {
+ cx= 174*res;
+ cy= 8;
+ }
+ break;
+ case 'P' : {
+ cx= 222*res;
+ cy= 8;
+ }
+ break;
+ case 'F' : {
+ cx= res*270;
+ cy= 8;
+ }
+ break;
+ case '\23' : {
+ sonoff= ! sonoff;
+ return;
+ }
+ break;
+ case '\26' : {
+ zuul=true;
+ return;
+ }
+ break;
+ case '\24' : { /* ^T => mode tandy */
+ funct= true;
+ key= '\11';
+ }
+ break;
+ case '\10' : { /* ^H => mode Hercule */
+ funct= true;
+ key= '\7';
+ }
+ break;
+ case '\1':case '\3':case '\5' : {
+ funct= true;
+ key=in1;
+ }
+ break;
+ }
+ pos_mouse(cx, cy);
+ p_key=keypressed();
+ }
+ }
diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h
new file mode 100644
index 0000000000..5bd4fd2809
--- /dev/null
+++ b/engines/mortevielle/outtext.h
@@ -0,0 +1,205 @@
+str255 delig;
+const array<0,31,byte> tabdr
+ = {{ 32, 101, 115, 97, 114, 105, 110,
+ 117, 116, 111, 108, 13, 100, 99,
+ 112, 109, 46, 118, 130, 39, 102,
+ 98, 44, 113, 104, 103, 33, 76,
+ 85, 106, 30, 31 }};
+
+
+const array<0,31,byte> tab30
+ = {{ 69, 67, 74, 138, 133, 120, 77, 122,
+ 121, 68, 65, 63, 73, 80, 83, 82,
+ 156, 45, 58, 79, 49, 86, 78, 84,
+ 71, 81, 64, 66, 135, 34, 136, 91 }};
+
+
+
+const array<0,31,byte> tab31
+ = {{ 93, 47, 48, 53, 50, 70, 124, 75,
+ 72, 147, 140, 150, 151, 57, 56, 51,
+ 107, 139, 55, 89, 131, 37, 54, 88,
+ 119, 0, 0, 0, 0, 0, 0, 0 }};
+
+void deline( integer num , phrase& l , integer& tl );
+
+static void cinq_huit( char& c, integer& ind, byte& pt, boolean& the_end)
+ {
+ const array<0,31,char> rap
+ = {{ ',', ':', '@', '!', '?', '-', '‡',
+ ' ', '…', 'ƒ', '‚', 'Š', 'ˆ', '/',
+ '‹', 'Œ', '¢', '\47', '“', '"', '—',
+ '–', '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9'}};
+ integer oct,ocd;
+
+ /* 5-8 */
+ oct=t_mot[ind];
+ oct=(cardinal)(oct << (16-pt)) >> (16-pt);
+ if (pt<6)
+ {
+ ind=ind+1;
+ oct=oct << (5-pt);
+ pt=pt+11;
+ oct=oct | ((cardinal)t_mot[ind] >> pt);
+ }
+ else
+ {
+ pt=pt-5;
+ oct=(cardinal)oct >> pt;
+ }
+
+ switch (oct) {
+ case 11 : {
+ c= '$';
+ the_end= true;
+ }
+ break;
+ case 30:case 31 : {
+ ocd=t_mot[ind];
+ ocd=(cardinal)(ocd << (16-pt)) >> (16-pt);
+ if (pt<6)
+ {
+ ind=ind+1;
+ ocd=ocd << (5-pt);
+ pt=pt+11;
+ ocd=ocd | ((cardinal)t_mot[ind] >> pt);
+ }
+ else
+ {
+ pt=pt-5;
+ ocd=(cardinal)ocd >> pt;
+ }
+ if (oct==30) c=chr(tab30[ocd]);
+ else c=chr(tab31[ocd]);
+ if (c=='\0')
+ {
+ the_end=true;
+ c='#';
+ }
+ }
+ break;
+ default: c=chr(tabdr[oct]);
+ }
+ } /* 5-8 */
+
+void deline( integer num , phrase& l , integer& tl )
+ {
+ integer i,j,ts;
+ char let;
+ byte ps, k;
+ boolean the_end;
+
+ /* DETEX */
+ /*debug(' => DeLine');*/
+ delig="";
+ ts= t_rec[num].indis;
+ ps= t_rec[num].point;
+ i=ts;
+ tl=1;
+ j=1;
+ k=ps;
+ the_end=false;
+ do {
+ cinq_huit(let,i,k, the_end);
+ l[j]=let;
+ if (j<254) delig=delig+let;
+ j=j+1;
+ } while (!the_end);
+ tl=j-1;
+ if (tl<255) delig=copy(delig,1,tl-1); /* enleve le $ */
+ } /* DETEX */
+
+
+void afftex( phrase ch, integer x,integer y,integer dx,integer dy, integer typ);
+
+
+static integer l_motsuiv(integer p, phrase& ch, integer& tab)
+ {
+ integer c;
+
+ integer l_motsuiv_result;
+ c=p;
+ while (! (set::of(' ','$','@', eos).has(ch[p]))) p=p+1;
+ l_motsuiv_result=tab*(p-c);
+ return l_motsuiv_result;
+ }
+
+void afftex( phrase ch, integer x,integer y,integer dx,integer dy, integer typ)
+ {
+ boolean the_end;
+ char touch;
+ integer xf,yf;
+ integer xc,yc;
+ integer tab, p;
+ varying_string<255> s;
+ integer i,j,nt;
+
+
+/* debug(' .. Afftex');*/
+ 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;
+ the_end=(ch[p]=='$');
+ s="";
+ while (! the_end)
+ {
+ switch (ch[p]) {
+ case '@' : {
+ writeg(s,typ);
+ s="";
+ p=p+1;
+ xc=x;
+ yc=yc+6;
+ putxy(xc,yc);
+ }
+ break;
+ case ' ' : {
+ s=s+' ';
+ xc=xc+tab;
+ p=p+1;
+ if (l_motsuiv(p, ch, tab)+xc > xf)
+ {
+ writeg(s,typ);
+ s="";
+ xc=x;
+ yc=yc+6;
+ if (yc>yf)
+ {
+ do {; } while (!keypressed());
+ i=y;
+ do {
+ j=x;
+ do {
+ putxy(j,i);
+ writeg(" ",0);
+ j=j+6;
+ } while (!(j>xf));
+ i=i+6;
+ } while (!(i>yf));
+ yc=y;
+ }
+ putxy(xc,yc);
+ }
+ }
+ break;
+ case '$' : {
+ the_end= true;
+ writeg(s,typ);
+ }
+ break;
+ default:
+ {
+ s=s+ch[p];
+ p=p+1;
+ xc=xc+tab;
+ }
+ } /* case */
+ }
+ }
diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h
new file mode 100644
index 0000000000..b2f5f7962c
--- /dev/null
+++ b/engines/mortevielle/ovd1.h
@@ -0,0 +1,347 @@
+void dem2()
+{
+ untyped_file f;
+ integer k;
+
+ /* -- demande de disk 2 -- */
+ while (ioresult!=0);
+ assign(f,"mort.001");
+ /*$i-*/
+ reset(f);
+ while (ioresult!=0)
+ {
+ show_mouse();
+ k= do_alert(al_mess2,1);
+ hide_mouse();
+ reset(f);
+ }
+ close(f);
+}
+
+void ani50()
+ {
+ crep= animof(1,1);
+ pictout(adani,crep,63,12);
+ crep= animof(2,1);
+ pictout(adani,crep,63,12);
+ f2_all= (res==1);
+ repon(2, c_paroles+143);
+ }
+
+/*overlay procedure apzuul;
+ begin
+ if (c_zzz=1) or (c_zzz=2) then
+ begin
+ zzuul(adcfiec+161,0,1644);
+ c_zzz:=succ(c_zzz);
+ end;
+ end;*/
+
+/* overlay */ void aff50(boolean c)
+ {
+ integer k;
+
+ caff= 50;
+ maff=0;
+ taffich();
+ dessine(ades,63,12);
+ if (c) ani50();
+ else repon(2, c_paroles+142);
+ f3f8();
+ }
+
+/* overlay */ void init_menu()
+ {
+ integer i, j, tai;
+ phrase st;
+ untyped_file f;
+
+ assign(f,"menufr.mor");
+ /*$i-*/
+ reset(f,144);
+ blockread(f,lettres,1);
+ close(f);
+ /* ---- Demande de changement de disquette ---- */
+ dem2();
+
+
+ for( i= 1; i <= 8; i ++)
+ inv[i]= "* ";
+ inv[7]= "< -*-*-*-*-*-*-*-*-*- ";
+ for( i= 1; i <= 7; i ++)
+ dep[i]= "* ";
+ i= 1;
+ do {
+ deline(i+c_action,st,tai);
+ act[i]= delig + " ";
+ if (i<9)
+ {
+ if (i<6)
+ {
+ deline(i+c_saction,st,tai);
+ self_[i]= delig + " ";
+ }
+ deline(i+c_dis,st,tai);
+ dis[i]= delig+ ' ';
+ }
+ i= succ(integer,i);
+ } while (!(i== 22));
+ for( i= 1; i <= 8; i ++)
+ {
+ disc[i]=0x500+i;
+ if (i<8) depl[i]=0x200+i;
+ invt[i]=0x100+i;
+ if (i>6) menu_disable(invt[i]);
+ }
+ msg3=no_choice;
+ msg4=no_choice;
+ msg[3]=no_choice;
+ msg[4]=no_choice;
+ clic=false;
+ }
+
+
+/* overlay */ void charpal()
+{
+ file<tabdb> f;
+ file<tfxx> ft;
+ integer i,j,k;
+ file<byte> fb;
+ byte b;
+
+ assign(ft,"fxx.mor");
+ /*$i-*/
+ reset(ft);
+ if (ioresult!=0)
+ {
+ caff=do_alert(err_mess,1);
+ exit(0);
+ }
+ ft >> l;
+ close(ft);
+ assign(f,"plxx.mor");
+ reset(f);
+ for( i= 0; i <= 90; i ++) f >> tabpal[i];
+ close(f);
+ assign(fb, "cxx.mor");
+ reset(fb);
+ for( j=0; j <= 90; j ++)
+ {
+ fb >> palcga[j].p;
+ for( i=0; i <= 15; i ++)
+ {
+ nhom& with = palcga[j].a[i];
+
+ fb >> b;
+ with.n=(cardinal)b >> 4;
+ with.hom[0]= ((cardinal)b >> 2) & 3;
+ with.hom[1]= b & 3;
+ }
+ }
+ palcga[10].a[9]= palcga[10].a[5];
+ for( j=0; j <= 14; j ++)
+ {
+ fb >> tpt[j].tax;
+ fb >> tpt[j].tay;
+ for( i=1; i <= 20; i ++)
+ for( k=1; k <= 20; k ++)
+ fb >> tpt[j].des[i][k];
+ }
+ close(fb);
+}
+
+/* overlay */ void chartex()
+{
+ integer i;
+ untyped_file fibyte;
+ phrase s;
+
+/* debug('o3 chartex'); */
+ i=0;
+ assign(fibyte,"TXX.INP");
+ /*$i-*/
+ reset(fibyte);
+ blockread(fibyte,t_mot,125);
+ close(fibyte);
+ assign(sauv_t,"TXX.NTP");
+ reset(sauv_t);
+ do {
+ sauv_t >> t_rec[i];
+ i=i+1;
+ } while (!(eof(sauv_t)));
+ close(sauv_t);
+ deline(578,s,i);
+ al_mess= delig;
+ deline(579,s,i);
+ err_mess= delig;
+ deline(580,s,i);
+ ind_mess= delig;
+ deline(581,s,i);
+ al_mess2= delig;
+}
+
+/* overlay */ void dialpre()
+
+{
+ integer cy, tay;
+ phrase st;
+ real ix;
+ char ch;
+
+
+ /* debug('o3 dialpre'); */
+ cy=0;
+ clrscr;
+ textcolor(9);
+ do {
+ cy= cy+1;
+ deline( cy+c_dialpre,st,tay);
+ gotoxy(40-tay / 2,wherey+1);
+ output << delig;
+ } while (!(cy==20));
+ ix=0;
+ do {
+ ix= ix+1;
+ } while (!(keypressed() | (ix==5e5)));
+ crep= 998;
+ textcolor(1);
+ gotoxy(1,21); clreol;
+ gotoxy(1,23);
+ output << "CARTE GRAPHIQUE CGA EGA HERCULE/AT&T400 TANDY AMSTRAD1512";
+ gotoxy(12,24);
+ output << "Ctrl C E H T A";
+ do {
+ input >> kbd >> ch;
+ } while (!(set::of('\1','\3','\5','\24','\10', eos).has(ch)));
+ switch (ch) {
+ case '\1':case '\3':case '\5' : gd= (cardinal)ord(ch) >> 1; break;
+ case '\10' : gd= her; break;
+ case '\24' : gd= tan; break;
+ }
+ gotoxy(1,24);
+ clreol;
+ gotoxy(1,23);
+ clreol;
+ gotoxy(26,23);
+ output << "Jeu au Clavier / … la Souris";
+ textcolor(4);
+ gotoxy(33,23); output << 'C';
+ gotoxy(48,23); output << 'S';
+ do {
+ input >> kbd >> ch;
+ } while (!(set::of('C','S', eos).has(upcase(ch))));
+ int_m= (upcase(ch)=='S');
+}
+
+/* overlay */ void init_lieu()
+{
+ file<tab_mlieu> f_lieu;
+
+/* debug('o3 init_lieu'); */
+ assign(f_lieu,"MXX.mor");
+ /*$i-*/
+ reset(f_lieu);
+ f_lieu >> v_lieu;
+ close(f_lieu);
+}
+
+
+/* overlay */ void music()
+{
+ untyped_file fic;
+ integer k;
+ boolean fin;
+ char ch;
+ real x,y;
+
+
+ /* debug('o3 music'); */
+ if (sonoff) return;
+ rech_cfiec= true;
+ assign(fic,"mort.img");
+ /*$i-*/
+ reset(fic);
+ blockread(fic,mem[0x3800+0],500);
+ blockread(fic,mem[0x47a0+0],123);
+ close(fic);
+ demus(0x3800,0x5000,623);
+ addfix= (real)((tempo_mus-addv[1]))/256;
+ cctable(tbi);
+
+ fin=false;
+ k=0;
+ do {
+ fin= keypressed();
+ musyc( tbi, 9958 , tempo_mus);
+ k= k+1;
+ fin= fin | keypressed() | (k>=5);
+ } while (!fin);
+ while (keypressed()) input >> kbd >> ch;
+}
+
+
+/* overlay */ void charge_bruit5()
+ {
+ untyped_file f;
+
+ assign(f,"bruit5");
+ /*$i-*/
+ reset(f);
+ if (ioresult!=0)
+ {
+ caff=do_alert(err_mess,1);
+ exit(0);
+ }
+ blockread(f,mem[adbruit5+0],149);
+ /*blockread(f,mem[$5CB0:0],100);
+ blockread(f,mem[$3D1F:0],49);*/
+ close(f);
+ }
+
+/* overlay */ void charge_cfiec()
+ {
+ untyped_file f;
+
+ assign(f,"cfiec.mor");
+ /*$i-*/
+ reset(f);
+ blockread(f,mem[adcfiec+0],511);
+ blockread(f,mem[adcfiec+4088+0],311);
+ close(f);
+ rech_cfiec= false;
+ }
+
+
+/* overlay */ void charge_cfiph()
+ {
+ untyped_file f;
+
+ assign(f,"cfiph.mor");
+ /*$i-*/
+ reset(f,256);
+ blockread(f,t_cph,50);
+ close(f);
+ }
+
+
+/* overlay */ void suite()
+{
+ varying_string<25> cpr;
+
+ hirs();
+ repon(7,2035);
+ caff= 51;
+ taffich();
+ teskbd();
+ if (newgd!=gd) gd=newgd;
+ hirs();
+ dessine(ades,0,0);
+ gotoxy(20*pred(integer,res)+8,24);
+ textcolor(7);
+ cpr="COPYRIGHT 1989 : LANKHOR";
+ if (set::of(ega,ams,cga, eos).has(gd)) output << cpr;
+ else {
+ putxy(104+72*res,190);
+ writeg(cpr,0);
+ }
+}
diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h
new file mode 100644
index 0000000000..0630c9b2b3
--- /dev/null
+++ b/engines/mortevielle/parole.h
@@ -0,0 +1,432 @@
+
+ void spfrac(integer wor)
+ {
+ c3.rep= (cardinal)wor >> 12;
+ if ((typlec==0) && (c3.code!=9))
+ if (((c3.code>4) && (c3.val!=20) && ! (set::of(3,6,9, eos).has(c3.rep))) ||
+ ((c3.code<5) && ! (set::of(19,22, eos).has(c3.val)) && ! (set::of(4,9, eos).has(c3.rep))))
+ c3.rep= c3.rep + 1;
+ c3.freq= ((cardinal)wor >> 6) & 7;
+ c3.acc= ((cardinal)wor >> 9) & 7;
+ }
+
+ void charg_car()
+ {
+ integer wor, int_;
+
+ 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) : {
+ int_= int_-22;
+ c3.val= int_;
+ c3.code= typcon[int_];
+ }
+ break;
+ case RANGE_9(48,56) : {
+ c3.val= int_-22;
+ c3.code= 4;
+ }
+ 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;
+ }
+
+
+ void entroct( byte o)
+ {
+ mem[adtroct+ptr_oct]= o;
+ ptr_oct= ptr_oct+1;
+ }
+
+ void veracf(byte b)
+ {;
+ }
+
+/* overlay */ void cctable (tablint& t)
+ {
+ integer k;
+ array<0,256,real> tb;
+
+
+ tb[0]=0;
+ for( k=0; k <= 255; k ++)
+ {
+ tb[k+1]= addfix + tb[k];
+ t[255-k]=trunc(tb[k])+1;
+ }
+ }
+
+/* overlay */ void regenbruit()
+ {
+ integer i,j;
+
+ i= offsetb3+8590;
+ j= 0;
+ do {
+ t_cph[j]=memw[adbruit3+i];
+ i= i+2;
+ j= j+1;
+ } while (!(i>= offsetb3+8790));
+ }
+
+/* overlay */ void charge_son()
+ {
+ untyped_file f;
+
+ assign(f,"sonmus.mor");
+ reset(f);
+ blockread(f,mem[0x7414+0],273);
+ /*blockread(f,mem[adson+0],300);
+ blockread(f,mem[adson+2400+0],245);*/
+ demus(0x7414,adson,273);
+ close(f);
+ }
+
+/* overlay */ void charge_phbruit()
+ {
+ untyped_file f;
+
+ assign(f,"phbrui.mor");
+ reset(f);
+ blockread(f,t_cph,3);
+ close(f);
+ }
+
+/* overlay */ void charge_bruit()
+ {
+ untyped_file f;
+ integer j,i;
+
+ assign(f,"bruits");
+ reset(f);
+ blockread(f,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);
+ }
+
+/* overlay */ void trait_car()
+ {
+ byte d3;
+ integer d2, i;
+
+ switch (c2.code) {
+ 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;
+ if (c1.code>=5)
+ {
+ veracf(c2.acc);
+ if (c1.code==9)
+ {
+ entroct(4);
+ if (d3==null) entroct(c2.val);
+ else entroct(d3);
+ entroct(22);
+ }
+ }
+ switch (c2.rep) {
+ 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;
+ case 4:case 5:case 6 : {
+ if (c2.rep!=4)
+ {
+ i= c2.rep-5;
+ do {
+ i= i-1;
+ entroct(0);
+ if (d3==null) entroct(c2.val);
+ else entroct(d3);
+ entroct(3);
+ } while (!(i<0));
+ }
+ if (d3==null)
+ {
+ entroct(4);
+ entroct(c2.val);
+ entroct(0);
+ }
+ else
+ {
+ entroct(0);
+ entroct(c2.val);
+ entroct(3);
+ }
+ }
+ break;
+ case 7:case 8:case 9 : {
+ if (c2.rep!=7)
+ {
+ i= c2.rep-8;
+ do {
+ i= i-1;
+ entroct(0);
+ if (d3==null) entroct(c2.val);
+ else entroct(d3);
+ entroct(3);
+ } while (!(i<0));
+ }
+ if (d3==null)
+ {
+ entroct(0);
+ entroct(c2.val);
+ entroct(2);
+ }
+ else
+ {
+ entroct(0);
+ entroct(c2.val);
+ entroct(0);
+ }
+ }
+ break;
+ case 1:case 2:case 3 : {
+ if (c2.rep!=1)
+ {
+ i= c2.rep-2;
+ do {
+ i= i-1;
+ entroct(0);
+ 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);
+ }
+ break;
+ } /* case c2.rep */
+ }
+ break;
+
+ case 2:case 3 : {
+ d3= c2.code+5; /* 7 ou 8 => voyelle correspondante */
+ if (c1.code>4)
+ {
+ veracf(c2.acc);
+ if (c1.code==9)
+ {
+ entroct(4);
+ entroct(d3);
+ entroct(22);
+ }
+ }
+ i=c2.rep;
+ if (i!=0)
+ {
+ do {
+ i=i-1;
+ entroct(0);
+ entroct(d3);
+ entroct(3);
+ } while (!(i<=0));
+ }
+ veracf(c3.acc);
+ if (c3.code==6)
+ {
+ entroct(4);
+ entroct(tabdph[(c3.val-14) << 1]);
+ entroct(c2.val);
+ }
+ else
+ {
+ entroct(4);
+ if (c3.val==4) entroct(3);
+ else entroct(c3.val);
+ entroct(c2.val);
+ }
+ }
+ break;
+ case 0:case 1 : {
+ veracf(c2.acc);
+ switch (c3.code) {
+ case 2 : d2= 7; break;
+ case 3 : d2= 8; break;
+ case 6 : d2= tabdph[(c3.val-14) << 1]; break;
+ case 5 : d2= c3.val; break;
+ default: d2=10;
+ } /* case c3.code */
+ d2= d2 *26 + c2.val;
+ 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 */
+ }
+ if (c2.code==0)
+ {
+ i=c2.rep;
+ if (i!=0)
+ {
+ do {
+ i=i-1;
+ entroct(d3);
+ entroct(c2.val);
+ entroct(3);
+ } while (!(i<=0));
+ }
+ entroct(d3);
+ entroct(c2.val);
+ entroct(4);
+ }
+ else
+ {
+ entroct(d3);
+ entroct(c2.val);
+ entroct(3);
+ i=c2.rep;
+ if (i!=0)
+ {
+ do {
+ i=i-1;
+ entroct(d3);
+ entroct(c2.val);
+ entroct(4);
+ } while (!(i<=0));
+ }
+ }
+ if (c3.code==9)
+ {
+ entroct(d3);
+ entroct(c2.val);
+ entroct(5);
+ }
+ else
+ if (! (set::of(range(0,1),4, eos).has(c3.code)))
+ {
+ veracf(c3.acc);
+ switch (c3.code) {
+ case 3 : d2= 8; break;
+ case 6 : d2= tabdph[(c3.val-14) << 1]; break;
+ 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;
+ entroct(4);
+ entroct(d2);
+ entroct(c2.val);
+ }
+ }
+ break;
+ case 4 : {
+ veracf(c2.acc);
+ i=c2.rep;
+ if (i!=0)
+ {
+ do {
+ i=i-1;
+ entroct(2);
+ entroct(c2.val);
+ entroct(3);
+ } while (!(i<=0));
+ }
+ entroct(2);
+ entroct(c2.val);
+ entroct(4);
+ if (c3.code==9)
+ {
+ entroct(2);
+ entroct(c2.val);
+ entroct(5);
+ }
+ else
+ if (! (set::of(range(0,1),4, eos).has(c3.code)))
+ {
+ veracf(c3.acc);
+ switch (c3.code) {
+ case 3 : d2= 8; break;
+ case 6 : d2= tabdph[(c3.val-14) << 1]; break;
+ 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;
+ entroct(4);
+ entroct(d2);
+ entroct(tabdbc[((c2.val-26) << 1)+1]);
+ }
+ }
+ break;
+ } /* case c2.code */
+ }
+
+/*overlay function testprot : boolean;
+var
+ regs : registres;
+ buffer : array[0..511] of char;
+ i,j,k : integer;
+ st : phrase;
+ tay : integer;
+ test : array[0..2] of boolean;
+const
+ chaine : array[0..7] of char
+ = (' ','M','A','S','T','E','R',' ');
+
+begin
+ test[0]:= false;test[1]:=false;test[2]:=false;k:=0;
+ with regs do
+ begin
+ while (test[k]=false) and (k<2) do
+ begin
+ k:=k+1;
+ ax:=0;intr(19,regs);
+ ax:=$0201;cx:=$0001;dx:=$0100+k-1;es:=seg(buffer);bx:=ofs(buffer);
+ intr(19,regs);
+ test[k]:=true;
+ tesok:= true;
+ i:=0;
+ while (test[k]) and (i<19) do
+ begin
+ ax:=$0201;cx:=$2700+i;dx:=$0100+k-1;es:=seg(buffer);bx:=ofs(buffer);
+ intr(19,regs);if lo(flags) mod 2=1 then test[k]:=false;i:=i+1;
+ end;
+ for j:=0 to 7 do
+ if buffer[j+504]<>chaine[j] then test[k]:=false;
+ end;
+ end;
+ testprot:=(test[1] or test[2]);
+end;
+*/
+
diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h
new file mode 100644
index 0000000000..6cdaa3e2b4
--- /dev/null
+++ b/engines/mortevielle/parole2.h
@@ -0,0 +1,103 @@
+ void rot_chariot()
+ {
+ c1= c2;
+ c2= c3;
+ {
+ c3.val= 32;
+ c3.code= 9;
+ }
+ }
+
+ void init_chariot()
+ {
+ {
+ c3.rep= 0;
+ c3.freq= 0;
+ c3.acc= 0;
+ }
+ rot_chariot();
+ rot_chariot();
+ }
+
+
+void trait_ph()
+ {
+ const array<0,2,integer> deca
+ = {{300,30,40}};
+
+ ptr_tcph= pred(integer,num_ph);
+ ledeb=swap(t_cph[ptr_tcph]) + deca[typlec];
+ lefin=swap(t_cph[ptr_tcph+1]) + deca[typlec];
+ nb_word= lefin - ledeb;
+ ptr_tcph=(cardinal)ledeb >> 1;
+ ptr_word = 0;
+ do {
+ memw[adword+ ptr_word]= t_cph[ptr_tcph];
+ ptr_word = ptr_word +2;
+ ptr_tcph = ptr_tcph+1;
+ } while (!(ptr_tcph>=((cardinal)lefin >> 1)));
+
+ ptr_oct= 0;
+ ptr_word= 0;
+ init_chariot();
+
+ do {
+ rot_chariot();
+ charg_car();
+ trait_car();
+ } while (!(ptr_word >= nb_word));
+
+ rot_chariot();
+ trait_car();
+ entroct(ord('#'));
+ }
+
+
+
+ void parole(integer rep, integer ht, integer typ)
+ {
+ array<0,500,integer> savph;
+ integer i;
+ integer tempo;
+
+
+ if (sonoff) return;
+ num_ph= rep;
+ haut= ht;
+ typlec= typ;
+ if (typlec!=0)
+ {
+ for( i=0; i <= 500; i ++) savph[i]=t_cph[i];
+ tempo= tempo_bruit;
+ }
+ else
+ if (haut>5) tempo= tempo_f;
+ else tempo= tempo_m;
+ addfix= (real)((tempo-addv[0]))/256;
+ cctable(tbi);
+ switch (typ) {
+ case 1 : {
+ charge_bruit();
+ /*if zuul then zzuul(adbruit,0,1095);*/
+ regenbruit();
+ }
+ break;
+ case 2 : {
+ charge_son();
+ charge_phbruit();
+ }
+ break;
+ }
+ trait_ph();
+ litph(tbi,typ,tempo);
+ if (typlec!=0)
+ for( i=0; i <= 500; i ++)
+ {
+ t_cph[i]=savph[i];
+ mlec=typlec;
+ }
+ writepal(numpal);
+ }
+
+
+
diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h
new file mode 100644
index 0000000000..a3ba1896ae
--- /dev/null
+++ b/engines/mortevielle/prog.h
@@ -0,0 +1,346 @@
+/* overlay */ void change_gd(integer ngd)
+{
+ integer i;
+
+ hide_mouse();
+ gd= ngd;
+ hirs();
+ init_mouse();
+ show_mouse();
+ dessine_rouleau();
+ tinke();
+ pendule();
+ if (ipers!=0) affper(ipers); else person();
+ clsf2();
+ clsf3();
+ maff= 68;
+ afdes(0);
+ repon(2,crep);
+ menu_aff();
+}
+
+/* overlay */ void antegame()
+{
+ integer cx;
+ registres regs;
+ array<0,511,char> buffer;
+ integer i,j,k;
+ array<0,2,boolean> test;
+ array<0,7,char> g;
+
+
+ hide_mouse();
+ imen= false;
+ g[1]='M';
+perdu= true;
+ anyone= false;
+okdes= true;
+ test[0]= false;
+ test[1]=false;
+ g[0]='\40';
+ col= false;
+ tesok= true;
+ test[2]=false;
+ g[7]=g[0];
+ g[2]='A';
+ cache= false;
+ brt= false;
+ maff= 68;
+ g[5]='E';
+ mnumo= 0;
+ prebru= 0;
+ g[4]='T';
+ x= 0;
+ y= 0;
+ num= 0;
+ hdb= 0;
+ hfb= 0;
+ cs= 0;
+ is= 0;
+ k= 0;
+ ment= 0;
+syn= true;
+fouil= true;
+ mchai= 0;
+ inei= 0;
+ initouv();
+ g[3]='S';
+ g[6]='R';
+ iouv= 0;
+ dobj= 0;
+ affrep();
+ stpou= ind_mess;
+ while ((test[k]==false) && (k<2))
+ {
+ regs.ax=0;
+ k=succ(integer,k);
+ intr(19,regs);
+ {
+ regs.ax=0x201;regs.cx=0x1;regs.dx=0x100+k-1;regs.es=seg(buffer);regs.bx=ofs(buffer);
+ intr(19,regs);
+ test[k]=! imen;
+ i=0;
+ while ((test[k]) && (i<19))
+ {
+ regs.ax=0x201;
+ syn= false;regs.cx=0x2700+i;regs.dx=0x100+k-1;regs.es=seg(buffer);regs.bx=ofs(buffer);
+ intr(19,regs);if (lo(regs.flags) % 2==1) test[k]=false;i=i+1;
+ }
+ okdes= false;
+ solu= true;
+ for( j=0; j <= 7; j ++) if (buffer[j+504]!=g[j]) test[k]=false;
+ }
+ perdu= false;
+ fouil= false;
+ }
+ person();
+ tinke();
+ pendule();
+ afdes(0);
+ repon(2,crep);
+ clsf3();
+ solu= false;
+ tmlieu(s.mlieu);
+ modinv();
+ if (s.derobj!= 0) modobj2(s.derobj+ 400,test[1],test[2]);
+ else tesok=test[1] || test[2];
+ show_mouse();
+}
+
+
+/* NIVEAU 3 */
+/* procedure PROGRAMME */
+void tmaj3()
+{
+ integer j,h,m;
+
+ calch(j,h,m);
+ if (m== 30) m= 1;
+ h= h+ (j* 24);
+ m= m+ (h* 2);
+ s.heure= chr(m);
+}
+
+void tsitu()
+
+{
+ integer h,j,m;
+
+ if (! col) clsf2();
+ syn= false;
+ iesc= false;
+ if (anyone) goto L1;
+ if (brt)
+ if ((msg[3]== depla) || (msg[4]== sortir) || (msg[4]== dormir) ||
+ (msg[4]== manger))
+ {
+ ctrm= 4;
+ goto L2;
+ }
+ if (msg[3]== depla) taller();
+ if (msg[3]== discut) tparler();
+ if (msg[3]== invent) tsprendre();
+ if (msg[4]== attacher) tattacher();
+ if (msg[4]== attendre) tattendre();
+ if (msg[4]== defoncer) tdefoncer();
+ if (msg[4]== dormir) tdormir();
+ if (msg[4]== ecouter) tecouter();
+ if (msg[4]== entrer) tentrer();
+ if (msg[4]== fermer) tfermer();
+ if (msg[4]== fouiller) tfouiller();
+ if (msg[4]== frapper) tfrapper();
+ if (msg[4]== gratter) tgratter();
+ if (msg[4]== lire) tlire();
+ if (msg[4]== manger) tmanger();
+ if (msg[4]== mettre) tmettre();
+ if (msg[4]== ouvrir) touvrir();
+ if (msg[4]== prendre) tprendre();
+ if (msg[4]== regarder) tregarder();
+ if (msg[4]== sentir) tsentir();
+ if (msg[4]== sonder) tsonder();
+ if (msg[4]== sortir) tsortir();
+ if (msg[4]== soulever) tsoulever();
+ if (msg[4]== tourner) ttourner();
+ if (msg[4]== scacher)
+ {
+ tcacher();
+ goto L1;
+ }
+ if (msg[4]== sfouiller) tsfouiller();
+ if (msg[4]== slire) tslire();
+ if (msg[4]== sposer) tposer();
+ if (msg[4]== sregarder) tsregarder();
+ cache= false;
+L1:
+ if (anyone)
+ {
+ quelquun();
+ anyone= false;
+ goto L2;
+ }
+ 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;
+ if (((s.mlieu< 16) || (s.mlieu> 19)) && (s.mlieu!= 23)
+ && (s.mlieu!= 0) && (s.derobj!= 152) && (! perdu))
+ {
+ if ((s.conf> 99) && (h> 8) && (h< 16))
+ {
+ crep= 1501;
+ tperd();
+ }
+ if ((s.conf> 99) && (h> 0) && (h< 9))
+ {
+ crep= 1508;
+ tperd();
+ }
+ if ((j> 1) && (h> 8) && (! perdu))
+ {
+ crep= 1502;
+ tperd();
+ }
+ }
+L2:
+ mennor();
+}
+
+void sv_game(integer n);
+
+void ld_game(integer n);
+
+void tecran()
+{
+ const char idem[] = "Idem";
+ const integer lim = 20000;
+ integer temps;
+ char inkey;
+ boolean oo, funct;
+
+ clsf3();
+ oo= false;
+ ctrm= 0;
+ if (! iesc)
+ {
+ draw_menu();
+ imen= true;
+ temps= 0;
+ key= 0;
+ funct= false;
+ inkey='.';
+
+ do {
+ mdn();
+ tinke();
+ mov_mouse(funct,inkey);
+ temps= temps+ 1;
+ } while (!((choisi) || (temps > lim) || (funct) || (anyone)));
+
+ erase_menu();
+ imen= false;
+ if (set::of('\1','\3','\5','\7','\11', eos).has(inkey))
+ {
+ change_gd((cardinal)pred(integer,ord(inkey)) >> 1);
+ return;
+ }
+ if (choisi && (msg[3]==sauve)) sv_game(msg[4] & 7);
+ if (choisi && (msg[3]==charge)) ld_game(pred(integer,msg[4] & 7));
+ if (inkey== '\103') /* F9 */
+ {
+ temps = do_alert(stpou,1);
+ return;
+ }
+ else
+ if (inkey== '\77')
+ {
+ if ((mnumo!= no_choice) && ((msg[3]== action) || (msg[3]== saction)))
+ {
+ msg[4]= mnumo;
+ ecr3(idem);
+ }
+ else return;
+ }
+ else
+ if (inkey== '\104')
+ {
+ if ((x!= 0) && (y!= 0)) num= 9999;
+ return;
+ }
+ }
+ if (inkey== '\73')
+ {
+ arret= true;
+ tmaj3();
+ }
+ else
+ {
+ if ((funct) && (inkey!= '\77')) return;
+ if (temps> lim)
+ {
+ repon(2,141);
+ if (num== 9999) num= 0;
+ }
+ else
+ {
+ mnumo= msg[3];
+ if ((msg[3]== action) || (msg[3]== saction)) mnumo= msg[4];
+ if (! anyone)
+ {
+ if ((fouil) || (obpart))
+ {
+ if (y_s< 12) return;
+ if ((msg[4]== sonder) || (msg[4]== soulever))
+ {
+ oo= true;
+ if ((msg[4]== soulever) || (obpart))
+ {
+ finfouil();
+ caff= s.mlieu;
+ crep= 998;
+ }
+ else tsuiv();
+ mennor();
+ }
+ }
+ }
+ do {
+ if (! oo) tsitu();
+ if ((ctrm== 0) && (! perdu) && (! solu))
+ {
+ taffich();
+ if (okdes)
+ {
+ okdes= false;
+ dessin(0);
+ }
+ if ((! syn) || (col)) repon(2,crep);
+ }
+ } while (!(! syn));
+ if (ctrm!= 0) tctrm();
+ }
+ }
+}
+
+/* NIVEAU 1 */
+
+void theure()
+{
+ vj= ord(s.heure);
+ vh= vj % 48;
+ vj= vj / 48;
+ vm= vh % 2;
+ vh= vh / 2;
+ heu= vh;
+ if (vm== 1) min= 30; else min= 0;
+}
+
+
+void tjouer()
+{
+ antegame();
+ do {
+ tecran();
+ } while (!((arret) || (solu) || (perdu)));
+ if (solu) tmaj1(); else
+ if (perdu) tencore();
+}
+
diff --git a/engines/mortevielle/ques.h b/engines/mortevielle/ques.h
new file mode 100644
index 0000000000..66584d5d3c
--- /dev/null
+++ b/engines/mortevielle/ques.h
@@ -0,0 +1,121 @@
+
+/* overlay */ boolean ques()
+{
+ const array<1,10,integer> ta
+ = {{ 511, 516, 524, 531, 545,
+ 552, 559, 563, 570, 576}};
+ const array<1,10,integer> ok
+ = {{ 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }};
+
+ boolean q, func, test;
+ integer i,j,k,y,memk;
+ integer tay , tmax;
+ integer rep, prem, der;
+ phrase st;
+ char key;
+ mult_rect coor;
+ array<1,14,str40> chaines;
+ integer compte;
+
+
+ boolean ques_result;
+ test=false;
+ i=0;
+ compte= 0;
+
+ do {
+ hide_mouse();
+ hirs();
+ show_mouse();
+ i= i+1;
+ deline(ta[i],st,tay);
+ if (res==1) y=29; else y=23;
+ box(15,gd,0,14,630,y,255);
+ afftex(st,20,15,100,2,0);
+ if (i!=10)
+ {
+ prem= ta[i]+1;
+ der= ta[i+1]-1;
+ }
+ else
+ {
+ prem= 503;
+ der= 510;
+ }
+ y=35;
+ tmax= 0;
+ memk= 1;
+ for( j= prem; j <= der; j ++)
+ {
+ deline(j,st,tay);
+ if (tay>tmax) tmax= tay;
+ afftex(st,100,y,100,1,0);
+ chaines[memk]= delig;
+ memk= memk+1;
+ y= y+8;
+ }
+ for( j= 1; j <= succ(integer,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 (length(chaines[j] )<tmax)
+ {
+ chaines[j]= chaines[j] +' ';
+ }
+ }
+ coor[j+1].etat= false;
+ if (res==1) rep=10; else rep=6;
+ boite(80, 33, 40+tmax*rep, (der-prem)*8+ 16, 15);
+ rep= 0;
+ j= 0;
+ memk= 0;
+ do {
+ clic= false;
+ tesok=false;
+ mov_mouse(func,key);
+ k= 1;
+ while (coor[k].etat && ! dans_rect(coor[k])) k= k+1;
+ if (coor[k].etat)
+ {
+ if ((memk!=0) && (memk!=k))
+ {
+ /*DeLine(T_rec[ta[i]+memk].indis,T_rec[ta[i]+memk].point,st,tay);*/
+ for( j= 1; j <= tmax; j ++) st[j]= chaines[memk][j];
+ st[1+tmax]= '$';
+ afftex(st,100,27+memk*8,100,1,0);
+ }
+ if (memk!=k)
+ {
+ /*DeLine(T_rec[pred(prem)+k].indis,T_rec[pred(prem)+k].point,st,tay);*/
+ for( j= 1; j <= tmax; j ++) st[j]= chaines[k][j];
+ 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];
+ st[1+tmax]= '$';
+ afftex(st,100,27+memk*8,100,1,0);
+ memk=0;
+ }
+ } while (!((memk!=0) && clic));
+ if (memk==ok[i]) compte=compte+1;
+ else {
+ if (i==5) i=i +1;
+ if ((i==7) || (i==8)) i= 10;
+ }
+ if (i==10) q= /*testprot*/ true;
+ } while (!(i==10));
+ ques_result= (compte==10) && q;
+ return ques_result;
+}
diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h
new file mode 100644
index 0000000000..b54e2ba51c
--- /dev/null
+++ b/engines/mortevielle/sprint.h
@@ -0,0 +1,55 @@
+void fill_box(integer x,integer y,integer dx)
+{
+ box(15,gd,pred(integer,x) << 3, pred(integer,y) << 3, pred(integer,x+dx) << 3, y << 3, 255);
+}
+
+void clear_box(integer x,integer y,integer dx)
+{
+ box(0,gd,pred(integer,x) << 3, pred(integer,y) << 3, pred(integer,x+dx) << 3, y << 3, 255);
+}
+
+void writeg(str255 l,integer c)
+
+{
+ integer i, x, xo, yo;
+ integer cecr;
+ boolean t;
+
+/* debug('writeg : '+l);*/
+
+ if (l=="") return;
+ hide_mouse();
+ xo=xwhere;
+ yo=ywhere;
+ if (res==2) i=6;
+ else i=10;
+ x=xo+i*length(l);
+ switch (c) {
+ case 1:case 3 : {
+ cecr=0;
+ box(15,gd,xo,yo,x,yo+7,255);
+ }
+ break;
+ case 4 : {
+ cecr=0;
+ }
+ break;
+ case 5 : {
+ cecr=15;
+ }
+ break;
+ case 0:case 2 : {
+ cecr=15;
+ box(0,gd,xo,yo,x,yo+7,255);
+ }
+ break;
+ }
+ xo=xo+1;
+ yo=yo+1;
+ for( x=1; x <= length(l); x ++)
+ {
+ affcar(gd,xo,yo,cecr,ord(l[x]));
+ xo=xo+i;
+ }
+ show_mouse();
+}
diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h
new file mode 100644
index 0000000000..8f8cb1e460
--- /dev/null
+++ b/engines/mortevielle/taffich.h
@@ -0,0 +1,216 @@
+void chardes( str11 nom, long_integer passe, integer long_)
+ {
+ integer i, p, l;
+ byte b;
+ untyped_file f;
+
+ /* debug('chardes'); */
+ assign(f,nom);
+ /*$i-*/
+ reset(f);
+ testfi();
+ p= 0;
+ while (passe>127)
+ {
+ p=p+1;
+ passe=passe-128;
+ }
+ if (p!=0) seek(f,p);
+ p= trunc(passe);
+ l= long_+p;
+ i= 0;
+ while (l>0)
+ {
+ blockread(f,mem[0x6000+i],1);
+ testfi();
+ l= l-128;
+ i= i+128;
+ }
+ close(f);
+ for( i=p; i <= long_+p; i ++) mem[0x7000+i-p]=mem[0x6000+i];
+ /*$i+*/
+ }
+
+void charani( str11 nom, long_integer passe, integer long_)
+ {
+ integer i, p, l;
+ byte b;
+ untyped_file f;
+
+ /* debug('charani'); */
+ assign(f,nom);
+ /*$i-*/
+ reset(f);
+ testfi();
+ p= 0;
+ while (passe>127)
+ {
+ passe=passe-128;
+ p=p+1;
+ }
+ if (p!=0) seek(f,p);
+ p= trunc(passe);
+ l=long_+p;
+ i= 0;
+ while (l>0)
+ {
+ blockread(f,mem[0x6000+i],1);
+ testfi();
+ l=l-128;
+ i=i+128;
+ }
+ close(f);
+ for( i=p; i <= long_+p; i ++) mem[0x7314+i-p]=mem[0x6000+i];
+ /*$i+*/
+ }
+
+void taffich()
+{
+ const array<136,140,byte> tran1
+ = {{ 121, 121, 138, 139, 120 }};
+ const array<153,161,byte> tran2
+ = {{ 150, 150, 152, 152, 100,
+ 110, 159, 100, 100 }};
+ integer i, m, a, b, cx, handle,
+ npal;
+ long_integer lgt, lhandle;
+ str11 nom;
+ integer palh,k,j;
+ array<0,15,integer> alllum;
+
+
+ a= caff;
+ if (set::of(range(153,161), eos).has(a)) a= tran2[a];
+ else if (set::of(range(136,140), eos).has(a)) a= tran1[a];
+ b= a;
+ if (maff== a) return;
+ if (a== 16)
+ {
+ s.pourc[9]= '*';
+ s.teauto[42]= '*';
+ }
+ if (a== 20)
+ {
+ s.teauto[39]= '*';
+ if (s.teauto[36]== '*')
+ {
+ s.pourc[3]= '*';
+ s.teauto[38]= '*';
+ }
+ }
+ if (a== 24) s.teauto[37]= '*';
+ if (a== 30) s.teauto[9]= '*';
+ if (a== 31)
+ {
+ s.pourc[4]= '*';
+ s.teauto[35]= '*';
+ }
+ if (a== 118) s.teauto[41]= '*';
+ if (a== 143) s.pourc[1]= '*';
+ if (a== 150) s.teauto[34]= '*';
+ if (a== 151) s.pourc[2]= '*';
+ okdes= true;
+ hide_mouse();
+ lgt= 0;
+ if ((a!=50) && (a!=51))
+ {
+ m= a+ 2000;
+ if ((m> 2001) && (m< 2010)) m= 2001;
+ if (m== 2011) m= 2010;
+ if (a== 32) m= 2034;
+ if ((a== 17) && (maff== 14)) m= 2018;
+ if (a> 99)
+ if ((is== 1) || (is== 0)) m= 2031; else m= 2032;
+ if (((a> 69) && (a< 80)) || (a== 30) || (a== 31) || (a== 144)
+ || (a== 147) || (a== 149)) m= 2030;
+ if (((a< 27) && (((maff> 69) && (! s.ipre)) || (maff> 99)))
+ || ((maff> 29) && (maff< 33))) m= 2033;
+ messint(m);
+ maff= a;
+ if (a== 159) a= 86; else
+ if (a> 140) a= a- 67; else
+ if (a> 137) a= a- 66; else
+ if (a> 99) a= a- 64; else
+ if (a> 69) a= a- 42; else
+ if (a> 29) a= a- 5; else
+ if (a== 26) a= 24; else
+ if (a> 18) a= a- 1;
+ npal= a;
+ for( cx= 0; cx <= (a- 1); cx ++) lgt= lgt+l[cx];
+ handle=l[a];
+ nom= "DXX.mor";
+ }
+ else
+ {
+ nom= "DZZ.mor";
+ handle= l[87];
+ if (a== 51)
+ {
+ lgt= handle;
+ handle= l[88];
+ }
+ maff= a;
+ npal= a+37;
+ }
+ chardes(nom,lgt,handle);
+ if (gd==her)
+ {
+ for( i=0; i <= 15; i ++)
+ {
+ palh=memw[0x7000+(succ(integer,i) << 1)];
+ alllum[i]=(palh & 15) + (((cardinal)palh >> 12) & 15) + (((cardinal)palh >> 8) & 15);
+ }
+ for( i=0; i <= 15; i ++)
+ {
+ k=0;
+ for( j=0; j <= 15; j ++) if (alllum[j]>alllum[k]) k=j;
+ mem[0x7000+2+(k << 1)]= rang[i];
+ alllum[k]=-1;
+ }
+ }
+ numpal=npal;
+ writepal(npal);
+
+ if ((b< 15) || (b== 16) || (b== 17) || (b== 24) || (b== 26) || (b== 50))
+ {
+ lgt= 0;
+ if ((b< 15) || (b== 16) || (b== 17) || (b== 24) || (b== 26))
+ {
+ if (b== 26) b= 18; 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];
+ handle=l[b+89];
+ nom= "AXX.mor";
+ }
+ else
+ if (b== 50)
+ {
+ nom= "AZZ.mor";
+ handle= 1260;
+ }
+ charani(nom,lgt,handle);
+ }
+ show_mouse();
+ if ((a< 27) && ((maff< 27) || (s.mlieu== 15)) && (msg[4]!= entrer))
+ {
+ if ((a== 13) || (a== 14)) person();
+ else if (! blo) t11(s.mlieu, cx);
+ mpers= 0;
+ }
+}
+
+/* begin
+ for i:=0 to 15 do
+ begin
+ PalH:=memw[$7000:succ(i) shl 1];
+ Alllum[i]:=PalH and 15 + PalH shr 4 and 15 + PalH shr 8 and 15;
+ end;
+ for i:=0 to 15 do
+ begin
+ k:=0;
+ for j:=0 to 15 do if Alllum[j]>Alllum[k] then k:=j;
+ mem[$7000:2+k shl 1]:= Rang[i];
+ Alllum[k]:=-1;
+ end;
+ end;*/
diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h
new file mode 100644
index 0000000000..c1881be6fe
--- /dev/null
+++ b/engines/mortevielle/var_mor.h
@@ -0,0 +1,485 @@
+
+/* Constantes, Types et Variables pour le
+
+ M A N O I R DE M O R T E V I E L L E
+
+ ( version Nov 1988
+ +
+ musique & paroles Oct 88 )
+ */
+
+
+/*---------------------------------------------------------------------------*/
+/*------------------------- CONSTANTES ----------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+const real freq0 = 1.19318e6;
+
+const integer seg_syst = 0x6fed;
+const integer segmou = 0x6f00;
+const integer segdon = 0x6c00;
+const integer adani = 0x7314;
+const integer adword = 0x4000;
+const integer adtroct = 0x406b;
+const integer adcfiec = 0x4300;
+const integer adbruit = 0x5cb0;/*2C00;*/
+const integer adbruit1 = 0x6924;/*3874;*/
+const integer adbruit2 = 0x6b30;/*3A80;*/
+const integer adbruit3 = 0x6ba6;/*3AF6;*/
+const integer adbruit5 = 0x3b50;
+const integer adson = 0x5cb0;/*2C00;*/
+const integer adson2 = 0x60b0;/*3000;*/
+const integer offsetb1 = 6;
+const integer offsetb2 = 4;
+const integer offsetb3 = 6;
+
+const integer null = 255;
+
+const integer tempo_mus = 71;
+const integer tempo_bruit = 78;
+const integer tempo_f = 80;
+const integer tempo_m = 89;
+
+const integer ti1 = 410;
+const integer ti2 = 250;
+const integer maxti = 7975;
+const integer maxtd = 600;
+const integer max_rect = 14;
+
+const integer ams = 0;
+const integer cga = 1;
+const integer ega = 2;
+const integer her = 3;
+const integer tan = 4;
+
+const integer c_repon = 0;
+const integer c_st41 = 186;
+const integer c_tparler = 247;
+const integer c_paroles = 292;
+const integer c_tmlieu = 435;
+const integer c_dialpre = 456;
+const integer c_action = 476;
+const integer c_saction = 497;
+const integer c_dis = 502;
+const integer c_fin = 510; /* => n'existe pas ; si !! */
+
+const integer arega = 0;
+const integer asoul = 154;
+const integer aouvr = 282;
+const integer achai = 387;
+const integer acha = 492;
+const integer arcf = 1272;
+const integer arep = 1314;
+const integer amzon = 1650;
+const integer fleche = 1758;
+
+const integer no_choice = 0;
+const integer invent = 1;
+const integer depla = 2;
+const integer action = 3;
+const integer saction = 4;
+const integer discut = 5;
+const integer fichier = 6;
+const integer sauve = 7;
+const integer charge = 8;
+
+const integer attacher = 0x301;
+const integer attendre = 0x302;
+const integer defoncer = 0x303;
+const integer dormir = 0x304;
+const integer ecouter = 0x305;
+const integer entrer = 0x306;
+const integer fermer = 0x307;
+const integer fouiller = 0x308;
+const integer frapper = 0x309;
+const integer gratter = 0x30a;
+const integer lire = 0x30b;
+const integer manger = 0x30c;
+const integer mettre = 0x30d;
+const integer ouvrir = 0x30e;
+const integer prendre = 0x30f;
+const integer regarder = 0x310;
+const integer sentir = 0x311;
+const integer sonder = 0x312;
+const integer sortir = 0x313;
+const integer soulever = 0x314;
+const integer tourner = 0x315;
+
+const integer scacher = 0x401;
+const integer sfouiller = 0x402;
+const integer slire = 0x403;
+const integer sposer = 0x404;
+const integer sregarder = 0x405;
+
+ const array<0,17,byte> tabdbc
+ = {{7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}};
+ const array<0,15,byte> tabdph
+ = {{0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}};
+ const array<0,25,byte> typcon
+ = {{0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}};
+ const array<0,25,byte> intcon
+ = {{1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}};
+ const array<0,363,byte> tnocon
+ = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0}};
+
+
+const matrix<1,8,1,4,byte> don
+ = {{{{ 7, 37, 22, 8}},
+ {{19, 33, 23, 7}},
+ {{31, 89, 10, 21}},
+ {{43, 25, 11, 5}},
+ {{55, 37, 5, 8}},
+ {{64, 13, 11, 2}},
+ {{62, 22, 13, 4}},
+ {{62, 25, 13, 5}}}};
+
+const array<1,2,varying_string<11> > fic
+ = {{ " Sauvegarde",
+ " Chargement" }};
+
+const array<0,1,byte> addv
+ = {{8,8}};
+
+const char recom[] = " Recommence ";
+
+ const char f3[] = "F3: Encore";
+ const char f8[] = "F8: Suite";
+
+ const integer max_patt = 20;
+
+
+ const array<0,15,byte> rang
+ = {{15,14,11,7,13,12,10,6,9,5,3,1,2,4,8,0}};
+
+
+/*---------------------------------------------------------------------------*/
+/*-------------------------------- TYPES --------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+typedef varying_string<11> path_chars;
+typedef real long_integer;
+typedef varying_string<255> str255;
+typedef varying_string<125> str125;
+typedef varying_string<30> str30;
+typedef varying_string<11> str11;
+typedef file<byte> fichier_byte;
+struct sav_chaine {
+ integer conf;
+ array<0,10,char> pourc;
+ array<0,42,char> teauto;
+ array<0,30,char> sjer;
+ integer mlieu,iboul,ibag,icave,ivier,ipuit;
+ integer derobj,iloic,icryp;
+ boolean ipre;
+ char heure;
+};
+struct registres {
+ integer ax,bx,cx,dx,bp,si,di,ds,es,flags;
+};
+typedef array<1,1410,char> phrase;
+typedef array<0,maxti,integer> tabint;
+ struct ind {
+ integer indis;
+ byte point;
+ };
+typedef array<0,maxtd,ind> tabind;
+
+typedef matrix<1,7,0,24,byte> tab_mlieu;
+
+ typedef array<0,255,real> table;
+typedef array<0,255,integer> tablint;
+
+ typedef integer word1;
+struct chariot {
+ integer val,
+ code,
+ acc,
+ freq,
+ rep;
+};
+
+struct doublet {
+ byte x,y;
+};
+typedef array<1,16,doublet> tabdb;
+typedef array<0,107,integer> tfxx;
+struct rectangle {
+ integer x1, x2, y1, y2;
+ boolean etat;
+};
+
+typedef array<1,max_rect,rectangle> mult_rect;
+typedef varying_string<40> str40;
+
+ struct pattern {
+ byte tay, tax;
+ matrix<1,max_patt, 1,max_patt,byte> des;
+ };
+
+
+ struct nhom {
+ byte n; /* numero entre 0 et 32 */
+ array<0,3,byte> hom;
+ };
+
+ typedef array<0,15,nhom> t_nhom;
+
+ struct t_pcga {
+ byte p;
+ t_nhom a;
+ };
+
+ typedef array<0,90,t_pcga> pal_cga;
+
+
+/*---------------------------------------------------------------------------*/
+/*------------------------------ VARIABLES ------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+boolean blo,
+bh1,
+bf1,
+bh2,
+bh4,
+bf4,
+bh5,
+bh6,
+bh8,
+bt3,
+bt7,
+bh9,
+
+sonoff,
+main1,
+choisi,
+test0,
+f2_all,
+imen,
+cache,
+iesc,
+perdu,
+col,
+syn,
+fouil,
+zuul,
+tesok,
+obpart,
+okdes,
+solu,
+arret,
+anyone,
+brt,
+rect,
+rech_cfiec,
+active_menu;
+
+
+integer x,
+y,
+t,
+vj,
+li,
+vh,
+vm,
+jh,
+mh,
+cs,
+gd, /* Gd = graph device */
+hdb,
+hfb,
+heu,
+jou,
+key,
+min,
+num,
+max,
+res,
+ment,
+haut,
+caff,
+maff,
+crep,
+ades,
+iouv,
+inei,
+ctrm,
+dobj,
+msg3,
+msg4,
+mlec,
+newgd,
+c_zzz,
+mchai,
+menup,
+ipers,
+ledeb,
+lefin,
+mpers,
+mnumo,
+xprec,
+yprec,
+perdep,
+prebru,
+typlec,
+num_ph,
+xwhere,
+ywhere,
+numpal,
+lderobj,
+nb_word,
+ptr_oct,
+k_tempo,
+ptr_tcph,
+ptr_word,
+color_txt;
+
+array<0,6400,integer> t_cph;
+array<0,4000,byte> tabdon;
+/* t_dxx : array[0..121] of integer;*/
+str125 stpou; /* donne le % d'indices */
+byte is;
+char mode;
+fichier_byte ficdes;
+str125 al_mess,
+err_mess,
+ind_mess,
+al_mess2;
+
+ array<1,8,integer> invt,
+nbrep,
+nbrepm,
+ disc;
+ array<0,4,integer> msg;
+ array<1,7,integer> depl;
+ array<1,8,varying_string<22> > inv;
+ array<1,7,varying_string<23> > dep;
+ array<1,21,varying_string<10> > act;
+ array<1,5,varying_string<11> > self_;
+ array<1,8,varying_string<5> > dis;
+ array<1,7,char> touv;
+ sav_chaine s,s1;
+array<0,390,byte> bufcha;
+
+matrix<1,6,0,23,byte> lettres;
+
+array<0,15,byte> palher;
+
+ tabint t_mot;
+integer tay_tchar;
+ tabind t_rec;
+ file<ind> sauv_t;
+ untyped_file fibyte;
+ tab_mlieu v_lieu;
+ tfxx l;
+ tablint tbi;
+chariot c1, c2, c3;
+ real addfix;
+ pal_cga palsav;
+ array<0,90,tabdb> tabpal;
+ pal_cga palcga;
+ array<0,14,pattern> tpt;
+
+
+
+/*---------------------------------------------------------------------------*/
+/*-------------------- PROCEDURES ET FONCTIONS ------------------------*/
+/*---------------------------------------------------------------------------*/
+
+/* procedure box(c,Gd,xo,yo,xi,yi,patt:integer); external 'c:\mc\boite.com'; */
+
+void hirs()
+{
+ const array<0,13,byte> tandy
+ = {{113,80,90,14,63,6,50,56,2,3,6,7,0,0}};
+ const array<0,12,byte> herc
+ = {{50,40,41,9,103,3,100,100,2,3,0,0,0}};
+ integer i, j;
+
+ switch (gd) {
+ case cga :
+ {
+ graphcolormode;
+ graphbackground(0);
+ palette(1);
+ res=1;
+ }
+ break;
+ case ams :
+ {
+ hires;
+ inline_((real)(0xb8)/6/0/ /* => mov ax,6 */
+ 0xcd/0x10); /* => int 16 */
+ port[0x3d9]=15;
+ port[0x3df]=0;
+ port[0x3dd]=15;
+ res=2;
+ }
+ break;
+ case ega :
+ {
+ inline_((real)(0xb8) / 14 / 0 / /* MOV AX, 14 ; mode video 14 = 640*200 16 couleurs */
+ 0xcd / 0x10); /* INT 16 */
+ res=2;
+ }
+ break;
+ case her :
+ {
+ port[0x3bf]=3;
+ port[0x3b8]=2;
+ for( i=0; i <= 12; i ++)
+ {
+ port[0x3b4]=i;
+ port[0x3b5]=herc[i];
+ }
+ inline_((real)(0xfc)/0xb9/0/0x80/0xb8/0/0xb0/0x8e/0xc0/0x31/0xff/0x31/0xc0/0xf3/0xab);
+ port[0x3b8]=10;
+ res=2;
+ }
+ break;
+ case tan :
+ {
+ port[0x3d8]=0;
+ port[0x3da]=3;
+ port[0x3de]=0x14;
+ for( i=0; i <= 13; i ++)
+ {
+ port[0x3d4]=i;
+ port[0x3d5]=tandy[i];
+ }
+ port[0x3da]=2;
+ port[0x3de]=0;
+ port[0x3d8]=port[0x3d8] | (11 & 0xef);
+ port[0x3dd]=port[0x3dd] | 1;
+ port[0x3df]=port[0x3df] | 0xc0;
+ box(0,gd,0,0,640,200,255);
+ res=1;
+ }
+ break;
+ }
+}
+
+/* procedure affput(Chx,Gd,x,y,coul,char:integer); external 'c:\mc\divaf.com'; */
+
+void affcar(integer gd,integer x,integer y,integer coul,integer char)
+{
+ if (res==1) affput(1,gd,((cardinal)x >> 1),y,coul,char);
+ else affput(1,gd,x,y,coul,char);
+}
+
+void putpix(integer gd,integer x,integer y,integer coul)
+{
+ affput(0,gd,x,y,coul,0);
+}