From 816e53c1f87365cb351fe3dbdf4a8636954d1773 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 Dec 2011 19:02:50 +0000 Subject: MORTEVIELLE: Initial ptoc output --- engines/mortevielle/actions.h | 1372 +++++++++++++++++++++++++++++++++++++ engines/mortevielle/alert.h | 214 ++++++ engines/mortevielle/boite.h | 30 + engines/mortevielle/disk.h | 80 +++ engines/mortevielle/droite.h | 35 + engines/mortevielle/keyboard.h | 59 ++ engines/mortevielle/level15.h | 186 +++++ engines/mortevielle/menu.h | 306 +++++++++ engines/mortevielle/mor.h | 1457 ++++++++++++++++++++++++++++++++++++++++ engines/mortevielle/mor2.h | 764 +++++++++++++++++++++ engines/mortevielle/mort.cpp | 124 ++++ engines/mortevielle/mouse.h | 469 +++++++++++++ engines/mortevielle/outtext.h | 205 ++++++ engines/mortevielle/ovd1.h | 347 ++++++++++ engines/mortevielle/parole.h | 432 ++++++++++++ engines/mortevielle/parole2.h | 103 +++ engines/mortevielle/prog.h | 346 ++++++++++ engines/mortevielle/ques.h | 121 ++++ engines/mortevielle/sprint.h | 55 ++ engines/mortevielle/taffich.h | 216 ++++++ engines/mortevielle/var_mor.h | 485 +++++++++++++ 21 files changed, 7406 insertions(+) create mode 100644 engines/mortevielle/actions.h create mode 100644 engines/mortevielle/alert.h create mode 100644 engines/mortevielle/boite.h create mode 100644 engines/mortevielle/disk.h create mode 100644 engines/mortevielle/droite.h create mode 100644 engines/mortevielle/keyboard.h create mode 100644 engines/mortevielle/level15.h create mode 100644 engines/mortevielle/menu.h create mode 100644 engines/mortevielle/mor.h create mode 100644 engines/mortevielle/mor2.h create mode 100644 engines/mortevielle/mort.cpp create mode 100644 engines/mortevielle/mouse.h create mode 100644 engines/mortevielle/outtext.h create mode 100644 engines/mortevielle/ovd1.h create mode 100644 engines/mortevielle/parole.h create mode 100644 engines/mortevielle/parole2.h create mode 100644 engines/mortevielle/prog.h create mode 100644 engines/mortevielle/ques.h create mode 100644 engines/mortevielle/sprint.h create mode 100644 engines/mortevielle/taffich.h create mode 100644 engines/mortevielle/var_mor.h 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]) && (cx1) test2= test1 || ((cx>limit[2][1]) && (cx95) && (cy<105) && (((cx>limit[1][1]) && (cxlimit[2][1]) && (cx> 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) && + (xr.y1) && + (y0x100)) 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 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) && (x15)) + { + 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_) 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); /* ttes */ + 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= 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 f; + file ft; + integer i,j,k; + file 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 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] )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 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 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); +} -- cgit v1.2.3 From 9b6a4264dcaa26d87fa099c0a0dadbb8e37a6241 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 Dec 2011 22:15:35 +0000 Subject: MORTEVIELLE: Ran astyle over generated files --- engines/mortevielle/actions.h | 2371 ++++++++++++++++------------------- engines/mortevielle/alert.h | 401 +++--- engines/mortevielle/boite.h | 57 +- engines/mortevielle/disk.h | 124 +- engines/mortevielle/droite.h | 67 +- engines/mortevielle/keyboard.h | 107 +- engines/mortevielle/level15.h | 271 ++-- engines/mortevielle/menu.h | 594 ++++----- engines/mortevielle/mor.h | 2690 +++++++++++++++++++--------------------- engines/mortevielle/mor2.h | 1376 ++++++++++---------- engines/mortevielle/mort.cpp | 175 ++- engines/mortevielle/mouse.h | 846 +++++++------ engines/mortevielle/outtext.h | 409 +++--- engines/mortevielle/ovd1.h | 628 +++++----- engines/mortevielle/parole.h | 736 ++++++----- engines/mortevielle/parole2.h | 168 ++- engines/mortevielle/prog.h | 595 +++++---- engines/mortevielle/ques.h | 220 ++-- engines/mortevielle/sprint.h | 91 +- engines/mortevielle/taffich.h | 366 +++--- engines/mortevielle/var_mor.h | 591 +++++---- 21 files changed, 6210 insertions(+), 6673 deletions(-) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index fd4ae2e0b6..1dd3abe08f 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -1,1372 +1,1193 @@ /* NIVEAU 4 */ const char stouinon[] = "[2][ ][OUI][NON]"; -/* overlay */ void taller() +/* overlay */ +void taller() { - integer mx,cx,cy; + 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); + 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); + tmlieu(s.mlieu); } -/* overlay */ void tprendre() -{ - integer cx, cy, cz; +/* 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; - } - } + 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; +/* 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(); + 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; + 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; + 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; +/* 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; - } - } + 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 tslire() { + if (s.derobj == 0) crep = 186; + else st4(s.derobj); } -/* overlay */ void tregarder() -{ - integer cx; +/* 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); + 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 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; +/* 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; - } + 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 tsfouiller() { + if (s.derobj != 0) st7(s.derobj); + else crep = 186; } -/* overlay */ void touvrir() -{ - integer cx,haz; +/* 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; - } + 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; +/* 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(); - } + 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; +/* 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; - } - } + 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 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 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; +/* 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; + 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; +/* 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; - } + 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; +/* 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(); - } - } + 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; +/* 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; - } + 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; +/* 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; - } + 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; +/* 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; - } - } - } + 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; +/* 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; + 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 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; +/* 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); - } + 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; +/* 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(); + 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 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; + 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(); + 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 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; +/* 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 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; +/* 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); + 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 index c3a45fe529..d059fc3ef3 100644 --- a/engines/mortevielle/alert.h +++ b/engines/mortevielle/alert.h @@ -2,213 +2,196 @@ 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]) && (cx1) test2= test1 || ((cx>limit[2][1]) && (cx95) && (cy<105) && (((cx>limit[1][1]) && (cxlimit[2][1]) && (cx 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 index 0819490bfc..4120f7337f 100644 --- a/engines/mortevielle/boite.h +++ b/engines/mortevielle/boite.h @@ -1,30 +1,29 @@ -void boite(integer x,integer y,integer dx,integer dy,integer coul) - { - integer i; - integer xi,yi,xo,yo; +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(); - } + /* 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 index 28a2dbe6a5..517d408c87 100644 --- a/engines/mortevielle/disk.h +++ b/engines/mortevielle/disk.h @@ -1,78 +1,72 @@ -void dem1() -{ - untyped_file f; - integer k; +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); + /* -- 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; +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); + 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 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; +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(); + 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 index 7dd029e2ec..8d254a4afc 100644 --- a/engines/mortevielle/droite.h +++ b/engines/mortevielle/droite.h @@ -1,35 +1,34 @@ -void droite( integer x, integer y, integer xx, integer yy, integer coul ) - { - integer step,i; - real a,b; - real xr,yr,xro,yro; +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 + 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 index 9f8423a41f..b450e074c1 100644 --- a/engines/mortevielle/keyboard.h +++ b/engines/mortevielle/keyboard.h @@ -1,59 +1,60 @@ -char readkey1() - { - char c; +char readkey1() { + char c; - char readkey1_result; - input >> kbd >> c; - readkey1_result= c; - return readkey1_result; - } + char readkey1_result; + input >> kbd >> c; + readkey1_result = c; + return readkey1_result; +} -integer testou() - { - char ch; +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; - } + 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; +void teskbd() { + integer dum; - if (keypressed()) dum=testou(); - } + if (keypressed()) dum = testou(); +} diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h index be92e8dca2..2c9b8cdcf4 100644 --- a/engines/mortevielle/level15.h +++ b/engines/mortevielle/level15.h @@ -1,87 +1,80 @@ /* NIVEAU 15 */ -void copcha() -{ - integer i; - - i= acha; - do { - tabdon[i]=tabdon[i+390]; - i=succ(integer,i); - } while (!(i==acha +390)); +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) && - (xr.y1) && - (y0x100)) memw[0x7000+0x4138]=0x100; - afff(gd,seg,dep,x,y); - } - -void putxy(integer x,integer y) -{ - xwhere=x; - ywhere=y; +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; @@ -89,19 +82,17 @@ function calad(x,y:integer):integer; 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(); - } +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 @@ -125,54 +116,52 @@ begin end; */ -void adzon() - { - untyped_file f; - file 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; - } +void adzon() { + untyped_file f; + file 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 diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 9256182280..691ef7c852 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -1,306 +1,334 @@ /* NIVEAU 14*/ -/* overlay */ void menut(integer no, str30 nom) - { - byte h,l; - str30 s; +/* 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; - } - } + /* 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; +/* 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; - } - } + /* 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; +/* 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; - } - } + /* 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; +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(); - } + /* 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 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; +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; - } + /* 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; +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) && (x15)) - { - 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; - } - } + /* 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; +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(); - } + /* 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 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 erase_menu() { + /* debug('erase_menu'); */ + active_menu = false; + clic = false; + menu_up(msg3); +} -void mdn() - { - integer x,y,c,a,ix; - boolean tes; +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; - } - } + /* 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 index a4fe1e1b6b..fd4e2f5ffa 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -2,1455 +2,1309 @@ 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; +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_) 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); - } +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); +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; +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; +/* 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; + /* 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; +/* overlay */ void cpl11(integer &p, integer &h) { + integer j, 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; + /* 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; - } - } +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); - } - } + 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); /* ttes */ - 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); - } - } +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); /* ttes */ + 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 index 8edf601458..734cb4806c 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -1,764 +1,728 @@ -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(); +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); +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 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; +void delin(integer n) { + phrase s; + integer t; - deline(n,s,t); - } + deline(n, s, t); +} -void affrep() -{ - caff= s.mlieu; - crep= s.mlieu; +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))); - } + integer cx; -/* 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); + 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 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 atf3f8(integer &key) { + do { + key = testou(); + } while (!((key == 61) || (key == 66))); } -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]); -} +/* NIVEAU 6 */ -void premtet() -{ - dessine(ades, 10, 80); - boite(18, 79, 155, 91, 15); +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 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 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 quelquun() -void t1deau() { - crep = 1503; - tperd(); -} + integer haz, cx; -void tctrm() -{ - repon(2,(3000+ ctrm)); - ctrm= 0; + 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 quelquun() +void tcoord(integer sx) { - integer haz,cx; - - if (imen) erase_menu(); - finfouil(); - crep= 997; + 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: - 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; - } + crep = 997; } -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= 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; -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); + 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 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 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; +void rechai(integer &ch) { + integer cx; - cx= s.mlieu; - if (s.mlieu== 16) cx= 14; - ch= tabdon[achai+ (cx* 7)+ pred(integer,num)]; + cx = s.mlieu; + if (s.mlieu == 16) cx = 14; + ch = tabdon[achai + (cx * 7) + pred(integer, num)]; } -void t23coul(integer& l) -{ - boolean d; +void t23coul(integer &l) { + boolean d; - cherjer(143,d); - l= 14; - if (! d) - { - crep= 1512; - tperd(); - } + cherjer(143, d); + l = 14; + if (! d) { + crep = 1512; + tperd(); + } } -void maivid() -{ - s.derobj= 0; - modobj(500); +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 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; +void aldepl() { + integer dummy; - dummy=do_alert("[1][Alors, utilisez le menu DEP...][ok]",1); + dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); } diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 1fbd91c648..7d5f33c2ab 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -2,10 +2,10 @@ - /*$v-*/ - /*$k-*/ - /*$x-*/ - /*$c-*/ +/*$v-*/ +/*$k-*/ +/*$x-*/ +/*$c-*/ #include "var_mor.h" /* les variables */ #include "keyboard.h" /* la gestion du clavier */ @@ -18,7 +18,7 @@ #include "parole.h" /* les fonctions de la parole */ #include "alert.h" #include "parole2.h" /* les fonctions de la parole */ - /* debug le debugging */ +/* debug le debugging */ #include "ques.h" /* les questions */ #include "menu.h" /* les fonctions du menu */ #include "mor.h" /* divers */ @@ -31,94 +31,93 @@ /* 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)); +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); +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(); + 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; + 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 index 3f250d91e4..d1de4b79d2 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -2,45 +2,42 @@ const integer m_arrow = 0; const integer m_point_hand = 1; boolean int_m, -clic; + clic; integer m_show, -x_s, -y_s, -p_o_s, -mouse_shwn; + x_s, + y_s, + p_o_s, + mouse_shwn; -matrix<0,5,0,11,integer> s_s; +matrix<0, 5, 0, 11, integer> s_s; -void init_mouse() -{ - integer i, j; - registres reg; +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); - } - } + 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 ); @@ -58,412 +55,405 @@ begin end; end; */ -void hide_mouse() -{ - integer i,j,k,ps,ds; - boolean imp; +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; + 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 */ - } + } /* case Gd */ + } } -void show_mouse() -{ - integer i, j, k, l, - ps,ds; - boolean imp; - char c; +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); + 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; +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(); + 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; +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; - } + 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; +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(); - } - } + 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 index 5bd4fd2809..7c8f1c9f5c 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -1,205 +1,206 @@ 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 */ - } - } +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 index b2f5f7962c..d40f8d39bc 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -1,32 +1,29 @@ -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 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); - } +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 @@ -37,311 +34,304 @@ void ani50() 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 f; - file ft; - integer i,j,k; - file 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 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 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 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 f; + file ft; + integer i, j, k; + file 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'); + 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 f_lieu; - -/* debug('o3 init_lieu'); */ - assign(f_lieu,"MXX.mor"); - /*$i-*/ - reset(f_lieu); - f_lieu >> v_lieu; - close(f_lieu); +/* overlay */ void init_lieu() { + file 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 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); - } +/* 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 index 0630c9b2b3..3b777c3770 100644 --- a/engines/mortevielle/parole.h +++ b/engines/mortevielle/parole.h @@ -1,396 +1,388 @@ - 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 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_; +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; - } + 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 entroct(byte o) { + mem[adtroct + ptr_oct] = o; + ptr_oct = ptr_oct + 1; +} - void veracf(byte b) - {; - } +void veracf(byte b) { + ; +} -/* overlay */ void cctable (tablint& t) - { - integer k; - array<0,256,real> tb; +/* 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; - } - } + 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; +/* 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)); - } + 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; +/* 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); - } + 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; +/* overlay */ void charge_phbruit() { + untyped_file f; - assign(f,"phbrui.mor"); - reset(f); - blockread(f,t_cph,3); - close(f); - } + assign(f, "phbrui.mor"); + reset(f); + blockread(f, t_cph, 3); + close(f); +} -/* overlay */ void charge_bruit() - { - untyped_file f; - integer j,i; +/* 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); - } + 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; +/* 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; + 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 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 */ - } + 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 diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h index 6cdaa3e2b4..07ac757d77 100644 --- a/engines/mortevielle/parole2.h +++ b/engines/mortevielle/parole2.h @@ -1,103 +1,95 @@ - void rot_chariot() - { - c1= c2; - c2= c3; - { - c3.val= 32; - c3.code= 9; - } - } +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 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}}; +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_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(); + ptr_oct = 0; + ptr_word = 0; + init_chariot(); - do { - rot_chariot(); - charg_car(); - trait_car(); - } while (!(ptr_word >= nb_word)); + do { + rot_chariot(); + charg_car(); + trait_car(); + } while (!(ptr_word >= nb_word)); - rot_chariot(); - trait_car(); - entroct(ord('#')); - } + rot_chariot(); + trait_car(); + entroct(ord('#')); +} - void parole(integer rep, integer ht, integer typ) - { - array<0,500,integer> savph; - integer i; - integer tempo; +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); - } + 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 index a3ba1896ae..7bdea5b850 100644 --- a/engines/mortevielle/prog.h +++ b/engines/mortevielle/prog.h @@ -1,346 +1,319 @@ -/* overlay */ void change_gd(integer ngd) -{ - integer i; +/* 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(); + 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; +/* 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(); + 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; +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); + 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; + 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; + 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(); - } - } + 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(); + mennor(); } -void sv_game(integer n); +void sv_game(integer n); -void ld_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; +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='.'; + 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))); + 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(); - } - } + 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 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(); +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 index 66584d5d3c..87d0c87cd1 100644 --- a/engines/mortevielle/ques.h +++ b/engines/mortevielle/ques.h @@ -1,121 +1,113 @@ -/* 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 }}; +/* 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 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; + 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]; + 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] )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+*/ - } + /* 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; +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+*/ - } + /* 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; +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); + 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; - } + 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 diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index c1881be6fe..bdc6b59eb7 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -111,58 +111,65 @@ 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 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 char f3[] = "F3: Encore"; +const char f8[] = "F8: Suite"; - const integer max_patt = 20; +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}}; +const array<0, 15, byte> rang += {{15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}}; /*---------------------------------------------------------------------------*/ @@ -177,72 +184,72 @@ typedef varying_string<30> str30; typedef varying_string<11> str11; typedef file 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; + 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; + 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<1,1410,char> phrase; -typedef array<0,maxti,integer> tabint; - struct ind { - integer indis; - byte point; - }; -typedef array<0,maxtd,ind> tabind; +typedef array<0, maxtd, ind> tabind; -typedef matrix<1,7,0,24,byte> tab_mlieu; +typedef matrix<1, 7, 0, 24, byte> tab_mlieu; - typedef array<0,255,real> table; -typedef array<0,255,integer> tablint; +typedef array<0, 255, real> table; +typedef array<0, 255, integer> tablint; - typedef integer word1; +typedef integer word1; struct chariot { - integer val, - code, - acc, - freq, - rep; + integer val, + code, + acc, + freq, + rep; }; struct doublet { - byte x,y; + byte x, y; }; -typedef array<1,16,doublet> tabdb; -typedef array<0,107,integer> tfxx; +typedef array<1, 16, doublet> tabdb; +typedef array<0, 107, integer> tfxx; struct rectangle { - integer x1, x2, y1, y2; - boolean etat; + integer x1, x2, y1, y2; + boolean etat; }; -typedef array<1,max_rect,rectangle> mult_rect; +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 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; - }; +struct nhom { + byte n; /* numero entre 0 et 32 */ + array<0, 3, byte> hom; +}; - typedef array<0,15,nhom> t_nhom; +typedef array<0, 15, nhom> t_nhom; - struct t_pcga { - byte p; - t_nhom a; - }; +struct t_pcga { + byte p; + t_nhom a; +}; - typedef array<0,90,t_pcga> pal_cga; +typedef array<0, 90, t_pcga> pal_cga; /*---------------------------------------------------------------------------*/ @@ -250,147 +257,147 @@ typedef varying_string<40> str40; /*---------------------------------------------------------------------------*/ 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; + 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; + 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; + 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 sauv_t; - untyped_file fibyte; - tab_mlieu v_lieu; - tfxx l; - tablint tbi; +tabind t_rec; +file 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; +real addfix; +pal_cga palsav; +array<0, 90, tabdb> tabpal; +pal_cga palcga; +array<0, 14, pattern> tpt; @@ -400,86 +407,76 @@ chariot c1, c2, c3; /* 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; - } +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 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); +void putpix(integer gd, integer x, integer y, integer coul) { + affput(0, gd, x, y, coul, 0); } -- cgit v1.2.3 From e6a0c23d2c57461305906cb4c62b2b6962915264 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 17:32:59 +0000 Subject: MORTEVIELLE: Rename *.h -> *.cpp where they really belong --- engines/mortevielle/actions.cpp | 1193 ++++++++++++++++++++++++++++++++++ engines/mortevielle/actions.h | 1193 ---------------------------------- engines/mortevielle/alert.cpp | 197 ++++++ engines/mortevielle/alert.h | 197 ------ engines/mortevielle/boite.cpp | 29 + engines/mortevielle/boite.h | 29 - engines/mortevielle/disk.cpp | 74 +++ engines/mortevielle/disk.h | 74 --- engines/mortevielle/droite.cpp | 34 + engines/mortevielle/droite.h | 34 - engines/mortevielle/keyboard.cpp | 60 ++ engines/mortevielle/keyboard.h | 60 -- engines/mortevielle/level15.cpp | 175 +++++ engines/mortevielle/level15.h | 175 ----- engines/mortevielle/menu.cpp | 334 ++++++++++ engines/mortevielle/menu.h | 334 ---------- engines/mortevielle/mor.cpp | 1311 ++++++++++++++++++++++++++++++++++++++ engines/mortevielle/mor.h | 1311 -------------------------------------- engines/mortevielle/mor2.cpp | 728 +++++++++++++++++++++ engines/mortevielle/mor2.h | 728 --------------------- engines/mortevielle/mouse.cpp | 459 +++++++++++++ engines/mortevielle/mouse.h | 459 ------------- engines/mortevielle/outtext.cpp | 206 ++++++ engines/mortevielle/outtext.h | 206 ------ engines/mortevielle/ovd1.cpp | 337 ++++++++++ engines/mortevielle/ovd1.h | 337 ---------- engines/mortevielle/parole.cpp | 424 ++++++++++++ engines/mortevielle/parole.h | 424 ------------ engines/mortevielle/parole2.cpp | 95 +++ engines/mortevielle/parole2.h | 95 --- engines/mortevielle/prog.cpp | 319 ++++++++++ engines/mortevielle/prog.h | 319 ---------- engines/mortevielle/ques.cpp | 113 ++++ engines/mortevielle/ques.h | 113 ---- engines/mortevielle/sprint.cpp | 54 ++ engines/mortevielle/sprint.h | 54 -- engines/mortevielle/taffich.cpp | 196 ++++++ engines/mortevielle/taffich.h | 196 ------ engines/mortevielle/var_mor.cpp | 482 ++++++++++++++ engines/mortevielle/var_mor.h | 482 -------------- 40 files changed, 6820 insertions(+), 6820 deletions(-) create mode 100644 engines/mortevielle/actions.cpp delete mode 100644 engines/mortevielle/actions.h create mode 100644 engines/mortevielle/alert.cpp delete mode 100644 engines/mortevielle/alert.h create mode 100644 engines/mortevielle/boite.cpp delete mode 100644 engines/mortevielle/boite.h create mode 100644 engines/mortevielle/disk.cpp delete mode 100644 engines/mortevielle/disk.h create mode 100644 engines/mortevielle/droite.cpp delete mode 100644 engines/mortevielle/droite.h create mode 100644 engines/mortevielle/keyboard.cpp delete mode 100644 engines/mortevielle/keyboard.h create mode 100644 engines/mortevielle/level15.cpp delete mode 100644 engines/mortevielle/level15.h create mode 100644 engines/mortevielle/menu.cpp delete mode 100644 engines/mortevielle/menu.h create mode 100644 engines/mortevielle/mor.cpp delete mode 100644 engines/mortevielle/mor.h create mode 100644 engines/mortevielle/mor2.cpp delete mode 100644 engines/mortevielle/mor2.h create mode 100644 engines/mortevielle/mouse.cpp delete mode 100644 engines/mortevielle/mouse.h create mode 100644 engines/mortevielle/outtext.cpp delete mode 100644 engines/mortevielle/outtext.h create mode 100644 engines/mortevielle/ovd1.cpp delete mode 100644 engines/mortevielle/ovd1.h create mode 100644 engines/mortevielle/parole.cpp delete mode 100644 engines/mortevielle/parole.h create mode 100644 engines/mortevielle/parole2.cpp delete mode 100644 engines/mortevielle/parole2.h create mode 100644 engines/mortevielle/prog.cpp delete mode 100644 engines/mortevielle/prog.h create mode 100644 engines/mortevielle/ques.cpp delete mode 100644 engines/mortevielle/ques.h create mode 100644 engines/mortevielle/sprint.cpp delete mode 100644 engines/mortevielle/sprint.h create mode 100644 engines/mortevielle/taffich.cpp delete mode 100644 engines/mortevielle/taffich.h create mode 100644 engines/mortevielle/var_mor.cpp delete mode 100644 engines/mortevielle/var_mor.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp new file mode 100644 index 0000000000..1dd3abe08f --- /dev/null +++ b/engines/mortevielle/actions.cpp @@ -0,0 +1,1193 @@ +/* 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/actions.h b/engines/mortevielle/actions.h deleted file mode 100644 index 1dd3abe08f..0000000000 --- a/engines/mortevielle/actions.h +++ /dev/null @@ -1,1193 +0,0 @@ -/* 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.cpp b/engines/mortevielle/alert.cpp new file mode 100644 index 0000000000..d059fc3ef3 --- /dev/null +++ b/engines/mortevielle/alert.cpp @@ -0,0 +1,197 @@ +/* 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/alert.h b/engines/mortevielle/alert.h deleted file mode 100644 index d059fc3ef3..0000000000 --- a/engines/mortevielle/alert.h +++ /dev/null @@ -1,197 +0,0 @@ -/* 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.cpp b/engines/mortevielle/boite.cpp new file mode 100644 index 0000000000..4120f7337f --- /dev/null +++ b/engines/mortevielle/boite.cpp @@ -0,0 +1,29 @@ +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/boite.h b/engines/mortevielle/boite.h deleted file mode 100644 index 4120f7337f..0000000000 --- a/engines/mortevielle/boite.h +++ /dev/null @@ -1,29 +0,0 @@ -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.cpp b/engines/mortevielle/disk.cpp new file mode 100644 index 0000000000..517d408c87 --- /dev/null +++ b/engines/mortevielle/disk.cpp @@ -0,0 +1,74 @@ + +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/disk.h b/engines/mortevielle/disk.h deleted file mode 100644 index 517d408c87..0000000000 --- a/engines/mortevielle/disk.h +++ /dev/null @@ -1,74 +0,0 @@ - -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.cpp b/engines/mortevielle/droite.cpp new file mode 100644 index 0000000000..8d254a4afc --- /dev/null +++ b/engines/mortevielle/droite.cpp @@ -0,0 +1,34 @@ +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/droite.h b/engines/mortevielle/droite.h deleted file mode 100644 index 8d254a4afc..0000000000 --- a/engines/mortevielle/droite.h +++ /dev/null @@ -1,34 +0,0 @@ -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.cpp b/engines/mortevielle/keyboard.cpp new file mode 100644 index 0000000000..b450e074c1 --- /dev/null +++ b/engines/mortevielle/keyboard.cpp @@ -0,0 +1,60 @@ +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/keyboard.h b/engines/mortevielle/keyboard.h deleted file mode 100644 index b450e074c1..0000000000 --- a/engines/mortevielle/keyboard.h +++ /dev/null @@ -1,60 +0,0 @@ -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.cpp b/engines/mortevielle/level15.cpp new file mode 100644 index 0000000000..2c9b8cdcf4 --- /dev/null +++ b/engines/mortevielle/level15.cpp @@ -0,0 +1,175 @@ + +/* 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 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/level15.h b/engines/mortevielle/level15.h deleted file mode 100644 index 2c9b8cdcf4..0000000000 --- a/engines/mortevielle/level15.h +++ /dev/null @@ -1,175 +0,0 @@ - -/* 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 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.cpp b/engines/mortevielle/menu.cpp new file mode 100644 index 0000000000..691ef7c852 --- /dev/null +++ b/engines/mortevielle/menu.cpp @@ -0,0 +1,334 @@ +/* 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/menu.h b/engines/mortevielle/menu.h deleted file mode 100644 index 691ef7c852..0000000000 --- a/engines/mortevielle/menu.h +++ /dev/null @@ -1,334 +0,0 @@ -/* 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.cpp b/engines/mortevielle/mor.cpp new file mode 100644 index 0000000000..fd4e2f5ffa --- /dev/null +++ b/engines/mortevielle/mor.cpp @@ -0,0 +1,1311 @@ +/* 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); /* ttes */ + 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/mor.h b/engines/mortevielle/mor.h deleted file mode 100644 index fd4e2f5ffa..0000000000 --- a/engines/mortevielle/mor.h +++ /dev/null @@ -1,1311 +0,0 @@ -/* 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); /* ttes */ - 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.cpp b/engines/mortevielle/mor2.cpp new file mode 100644 index 0000000000..734cb4806c --- /dev/null +++ b/engines/mortevielle/mor2.cpp @@ -0,0 +1,728 @@ +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/mor2.h b/engines/mortevielle/mor2.h deleted file mode 100644 index 734cb4806c..0000000000 --- a/engines/mortevielle/mor2.h +++ /dev/null @@ -1,728 +0,0 @@ -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/mouse.cpp b/engines/mortevielle/mouse.cpp new file mode 100644 index 0000000000..d1de4b79d2 --- /dev/null +++ b/engines/mortevielle/mouse.cpp @@ -0,0 +1,459 @@ +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/mouse.h b/engines/mortevielle/mouse.h deleted file mode 100644 index d1de4b79d2..0000000000 --- a/engines/mortevielle/mouse.h +++ /dev/null @@ -1,459 +0,0 @@ -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.cpp b/engines/mortevielle/outtext.cpp new file mode 100644 index 0000000000..7c8f1c9f5c --- /dev/null +++ b/engines/mortevielle/outtext.cpp @@ -0,0 +1,206 @@ +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/outtext.h b/engines/mortevielle/outtext.h deleted file mode 100644 index 7c8f1c9f5c..0000000000 --- a/engines/mortevielle/outtext.h +++ /dev/null @@ -1,206 +0,0 @@ -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.cpp b/engines/mortevielle/ovd1.cpp new file mode 100644 index 0000000000..d40f8d39bc --- /dev/null +++ b/engines/mortevielle/ovd1.cpp @@ -0,0 +1,337 @@ +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 f; + file ft; + integer i, j, k; + file 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 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/ovd1.h b/engines/mortevielle/ovd1.h deleted file mode 100644 index d40f8d39bc..0000000000 --- a/engines/mortevielle/ovd1.h +++ /dev/null @@ -1,337 +0,0 @@ -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 f; - file ft; - integer i, j, k; - file 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 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.cpp b/engines/mortevielle/parole.cpp new file mode 100644 index 0000000000..3b777c3770 --- /dev/null +++ b/engines/mortevielle/parole.cpp @@ -0,0 +1,424 @@ + +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/parole.h b/engines/mortevielle/parole.h deleted file mode 100644 index 3b777c3770..0000000000 --- a/engines/mortevielle/parole.h +++ /dev/null @@ -1,424 +0,0 @@ - -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.cpp b/engines/mortevielle/parole2.cpp new file mode 100644 index 0000000000..07ac757d77 --- /dev/null +++ b/engines/mortevielle/parole2.cpp @@ -0,0 +1,95 @@ +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/parole2.h b/engines/mortevielle/parole2.h deleted file mode 100644 index 07ac757d77..0000000000 --- a/engines/mortevielle/parole2.h +++ /dev/null @@ -1,95 +0,0 @@ -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.cpp b/engines/mortevielle/prog.cpp new file mode 100644 index 0000000000..7bdea5b850 --- /dev/null +++ b/engines/mortevielle/prog.cpp @@ -0,0 +1,319 @@ +/* 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/prog.h b/engines/mortevielle/prog.h deleted file mode 100644 index 7bdea5b850..0000000000 --- a/engines/mortevielle/prog.h +++ /dev/null @@ -1,319 +0,0 @@ -/* 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.cpp b/engines/mortevielle/ques.cpp new file mode 100644 index 0000000000..87d0c87cd1 --- /dev/null +++ b/engines/mortevielle/ques.cpp @@ -0,0 +1,113 @@ + +/* 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/ques.h b/engines/mortevielle/ques.h deleted file mode 100644 index 87d0c87cd1..0000000000 --- a/engines/mortevielle/ques.h +++ /dev/null @@ -1,113 +0,0 @@ - -/* 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.cpp b/engines/mortevielle/sprint.cpp new file mode 100644 index 0000000000..854fdd6359 --- /dev/null +++ b/engines/mortevielle/sprint.cpp @@ -0,0 +1,54 @@ +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/sprint.h b/engines/mortevielle/sprint.h deleted file mode 100644 index 854fdd6359..0000000000 --- a/engines/mortevielle/sprint.h +++ /dev/null @@ -1,54 +0,0 @@ -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.cpp b/engines/mortevielle/taffich.cpp new file mode 100644 index 0000000000..00203118d8 --- /dev/null +++ b/engines/mortevielle/taffich.cpp @@ -0,0 +1,196 @@ +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/taffich.h b/engines/mortevielle/taffich.h deleted file mode 100644 index 00203118d8..0000000000 --- a/engines/mortevielle/taffich.h +++ /dev/null @@ -1,196 +0,0 @@ -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.cpp b/engines/mortevielle/var_mor.cpp new file mode 100644 index 0000000000..bdc6b59eb7 --- /dev/null +++ b/engines/mortevielle/var_mor.cpp @@ -0,0 +1,482 @@ + +/* 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 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 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); +} diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h deleted file mode 100644 index bdc6b59eb7..0000000000 --- a/engines/mortevielle/var_mor.h +++ /dev/null @@ -1,482 +0,0 @@ - -/* 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 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 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); -} -- cgit v1.2.3 From b193c92a6e9e181ecc84fdd0eb652c901d3b27ec Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 17:37:43 +0000 Subject: MORTEVIELLE: Plug the engine into makefiles --- base/plugins.cpp | 3 +++ configure | 1 + engines/mortevielle/module.mk | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 engines/mortevielle/module.mk diff --git a/base/plugins.cpp b/base/plugins.cpp index db8a5d8817..1c4e6f1934 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -139,6 +139,9 @@ public: #if PLUGIN_ENABLED_STATIC(MOHAWK) LINK_PLUGIN(MOHAWK) #endif + #if PLUGIN_ENABLED_STATIC(MORTEVIELLE) + LINK_PLUGIN(MORTEVIELLE) + #endif #if PLUGIN_ENABLED_STATIC(PARALLACTION) LINK_PLUGIN(PARALLACTION) #endif diff --git a/configure b/configure index 82620f3afd..7a557df59e 100755 --- a/configure +++ b/configure @@ -101,6 +101,7 @@ add_engine lastexpress "The Last Express" no add_engine lure "Lure of the Temptress" yes add_engine made "MADE" yes add_engine mohawk "Mohawk" yes "cstime myst riven" +add_engine mortevielle "Mortevielle" no add_engine cstime "Where in Time is Carmen Sandiego?" no add_engine riven "Riven: The Sequel to Myst" no add_engine myst "Myst" no diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk new file mode 100644 index 0000000000..6569d7038c --- /dev/null +++ b/engines/mortevielle/module.mk @@ -0,0 +1,32 @@ +MODULE := engines/mortevielle + +MODULE_OBJS := \ + actions.o \ + alert.o \ + boite.o \ + disk.o \ + droite.o \ + keyboard.o \ + level15.o \ + menu.o \ + mor.o \ + mor2.o \ + mort.o \ + mouse.o \ + outtext.o \ + ovd1.o \ + parole.o \ + parole2.o \ + prog.o \ + ques.o \ + sprint.o \ + taffich.o \ + var_mor.o + +# This module can be built as a plugin +ifeq ($(ENABLE_MORTEVIELLE), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk -- cgit v1.2.3 From 56d8f2b39c380213e848bb9efc08f4bfa69a3880 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 17:57:54 +0000 Subject: MORTEVIELLE: integer -> int --- engines/mortevielle/actions.cpp | 56 ++++----- engines/mortevielle/alert.cpp | 38 +++--- engines/mortevielle/boite.cpp | 18 +-- engines/mortevielle/disk.cpp | 12 +- engines/mortevielle/droite.cpp | 6 +- engines/mortevielle/keyboard.cpp | 10 +- engines/mortevielle/level15.cpp | 46 +++---- engines/mortevielle/menu.cpp | 34 ++--- engines/mortevielle/mor.cpp | 260 +++++++++++++++++++-------------------- engines/mortevielle/mor2.cpp | 102 +++++++-------- engines/mortevielle/mort.cpp | 2 +- engines/mortevielle/mouse.cpp | 52 ++++---- engines/mortevielle/outtext.cpp | 28 ++--- engines/mortevielle/ovd1.cpp | 18 +-- engines/mortevielle/parole.cpp | 16 +-- engines/mortevielle/parole2.cpp | 12 +- engines/mortevielle/prog.cpp | 26 ++-- engines/mortevielle/ques.cpp | 14 +-- engines/mortevielle/sprint.cpp | 14 +-- engines/mortevielle/taffich.cpp | 18 +-- engines/mortevielle/var_mor.cpp | 240 ++++++++++++++++++------------------ 21 files changed, 511 insertions(+), 511 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1dd3abe08f..83ad8d4f6b 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -5,7 +5,7 @@ const char stouinon[] = "[2][ ][OUI][NON]"; void taller() { - integer mx, cx, cy; + int mx, cx, cy; if ((s.mlieu == 26) && (msg[4] == depl[6])) { s.mlieu = 15; @@ -94,7 +94,7 @@ L2: } /* overlay */ void tprendre() { - integer cx, cy, cz; + int cx, cy, cz; if (caff > 99) { cx = caff; @@ -115,7 +115,7 @@ L2: obpart = false; affrep(); } else { - tabdon[acha + (pred(integer, mchai) * 10) + pred(integer, cs)] = 0; + tabdon[acha + (pred(int, mchai) * 10) + pred(int, cs)] = 0; tsuiv(); dobj = dobj + 1; if (dobj > 6) { @@ -188,7 +188,7 @@ L2: } /* overlay */ void tsprendre() { - integer cx, cy, cz; + int cx, cy, cz; cx = 0; do { @@ -211,7 +211,7 @@ L2: /* overlay */ void tsoulever() { - integer cx; + int cx; if (! syn) ecr3("soulever"); tfleche(); @@ -230,12 +230,12 @@ L2: cx = s.mlieu; if (s.mlieu == 16) cx = 14; if (s.mlieu == 19) cx = 15; - crep = tabdon[asoul + (cx << 3) + pred(integer, num)]; + crep = tabdon[asoul + (cx << 3) + pred(int, num)]; if (crep == 255) crep = 997; } /* overlay */ void tlire() { - integer iaff; + int iaff; if (caff > 99) st4(caff); else { @@ -254,7 +254,7 @@ L2: } /* overlay */ void tregarder() { - integer cx; + int cx; if (caff > 99) { crep = 103; @@ -297,7 +297,7 @@ L2: 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)]; + crep = tabdon[arega + (cx * 7) + pred(int, num)]; if ((s.mlieu == 13) && (num == 8)) crep = 126; if (s.mlieu == 19) crep = 103; if (crep == 255) crep = 131; @@ -315,7 +315,7 @@ L2: /* 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; + int cx; if (caff > 99) { st7(caff); @@ -386,7 +386,7 @@ L2: } /* overlay */ void touvrir() { - integer cx, haz; + int cx, haz; if (! syn) ecr3("ouvrir"); if (caff == 26) { @@ -432,18 +432,18 @@ L2: } cx = s.mlieu; if (s.mlieu == 16) cx = 14; - crep = tabdon[aouvr + (cx * 7) + pred(integer, num)]; + crep = tabdon[aouvr + (cx * 7) + pred(int, num)]; if (crep == 254) crep = 999; } else crep = 18; } } /* overlay */ void tmettre() { - integer quel; + int quel; boolean entre; phrase st; str255 str_; - integer i, tay; + int i, tay; if (s.derobj == 0) { crep = 186; @@ -542,7 +542,7 @@ L2: } /* overlay */ void ttourner() { - integer quel; + int quel; if (caff > 99) { crep = 149; @@ -608,7 +608,7 @@ L2: } /* overlay */ void tfermer() { - integer cx, chai; + int cx, chai; if (! syn) ecr3("fermer"); if (caff < 26) { @@ -637,7 +637,7 @@ L2: } /* overlay */ void tfrapper() { - integer l, p, haz; + int l, p, haz; if (! syn) ecr3("frapper"); if (s.mlieu == 15) { @@ -669,7 +669,7 @@ L2: } /* overlay */ void tposer() { - integer cx, chai; + int cx, chai; if (! syn) ecr3("poser"); if (s.derobj == 0) crep = 186; @@ -734,7 +734,7 @@ L2: } /* overlay */ void tecouter() { - integer l, p, haz, j, h, m; + int l, p, haz, j, h, m; if (s.mlieu != 26) crep = 101; else { @@ -759,7 +759,7 @@ L2: } /* overlay */ void tmanger() { - integer j, h, m; + int j, h, m; if ((s.mlieu > 15) && (s.mlieu < 26)) crep = 148; @@ -786,7 +786,7 @@ L2: } /* overlay */ void tentrer() { - integer x, z; + int x, z; if ((s.mlieu == 21) || (s.mlieu == 22)) { t1sama(); @@ -840,7 +840,7 @@ L2: /* overlay */ void tdormir() { const char m1[] = "D‚sirez-vous vous r‚veiller?"; - integer z, j, h, m, quel; + int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { crep = 148; @@ -890,7 +890,7 @@ L2: } /* overlay */ void tsortir() { - integer lx; + int lx; tsort(); crep = 0; @@ -915,7 +915,7 @@ L2: } /* overlay */ void tattendre() { - integer quel; + int quel; mpers = 0; clsf3(); @@ -951,7 +951,7 @@ L2: { array<1, 46, boolean> te; - integer ix, cy, cx, max, haz, suj, co, lig, icm, + int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; char tou; array<1, 46, varying_string<40> > lib; @@ -994,7 +994,7 @@ L2: co = 0; lig = 0; do { - icm = succ(integer, icm); + icm = succ(int, icm); putxy(co, lig); if (s.teauto[icm] == '*') if (te[icm]) writetp(lib[icm], 1); @@ -1014,7 +1014,7 @@ L2: x = x * (3 - res); if (x > 319) cx = 41; else cx = 1; - cy = succ(integer, (cardinal)y >> 3); /* 0-199 => 1-25 */ + cy = succ(int, (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; @@ -1173,7 +1173,7 @@ L2: } /* overlay */ void tencore() { /* Perdu !!! */ - integer quel; + int quel; clsf2(); musique(0); diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index d059fc3ef3..cec339e29a 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -1,8 +1,8 @@ -/* overlay */ integer do_alert(str255 str_, integer n); +/* overlay */ int do_alert(str255 str_, int n); -const integer nligne = 7; -const matrix<1, 2, 1, 3, integer> coord +const int nligne = 7; +const matrix<1, 2, 1, 3, int> coord = {{ {{150, 72, 103}}, {{143, 107, 183}} } @@ -10,8 +10,8 @@ const matrix<1, 2, 1, 3, integer> coord -static void decod(str255 s, integer &nbc, integer &nbl, integer &col, str255 &c, str30 &cs) { - integer i, k; +static void decod(str255 s, int &nbc, int &nbl, int &col, str255 &c, str30 &cs) { + int i, k; boolean v; val(s[2], nbc, i); @@ -47,18 +47,18 @@ static void decod(str255 s, integer &nbc, integer &nbl, integer &col, str255 &c, -static void posit(integer ji, integer &coldep, integer &esp) { - putxy(coldep + (40 + esp) *pred(integer, ji), 98); +static void posit(int ji, int &coldep, int &esp) { + putxy(coldep + (40 + esp) *pred(int, ji), 98); } -static void fait_boite(integer lidep, integer nli, integer tx) { - integer x, y, xx, yy; +static void fait_boite(int lidep, int nli, int tx) { + int x, y, xx, yy; if (tx > 640) tx = 640; x = 320 - ((cardinal)tx >> 1); - y = pred(integer, lidep) << 3; + y = pred(int, lidep) << 3; xx = x + tx; yy = y + (nli << 3); box(15, gd, x, y, xx, yy, 255); @@ -68,8 +68,8 @@ static void fait_boite(integer lidep, integer nli, integer tx) { -static void fait_choix(str30 c, integer &coldep, integer &nbcase, array<1, 2, varying_string<3> > &s, integer &esp) { - integer i, l, x; +static void fait_choix(str30 c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp) { + int i, l, x; char ch; i = 1; @@ -89,24 +89,24 @@ static void fait_choix(str30 c, integer &coldep, integer &nbcase, array<1, 2, va } } -integer do_alert(str255 str_, integer n) { - integer coldep, esp, i, l, nbcase, quoi, ix; +int do_alert(str255 str_, int n) { + int coldep, esp, i, l, nbcase, quoi, ix; str255 st, chaine; - matrix<1, 2, 1, 2, integer> limit; + matrix<1, 2, 1, 2, int> limit; char c, dumi; array<1, 2, varying_string<3> > s; - integer cx, cy, cd, nbcol, nblig; + int cx, cy, cd, nbcol, nblig; boolean touch, newaff, test, test1, test2, test3, dum; str30 cas; /*debug('** do_alert **');*/ - integer do_alert_result; + int 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); + sauvecr(50, succ(int, nligne) << 4); i = 0; if (chaine == "") { @@ -190,7 +190,7 @@ integer do_alert(str255 str_, integer n) { posit(n, coldep, esp); writeg(string(' ') + s[n] + ' ', 1); } - charecr(50, succ(integer, nligne) << 4); + charecr(50, succ(int, nligne) << 4); show_mouse(); do_alert_result = quoi; return do_alert_result; diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 4120f7337f..d1ebe4da38 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -1,6 +1,6 @@ -void boite(integer x, integer y, integer dx, integer dy, integer coul) { - integer i; - integer xi, yi, xo, yo; +void boite(int x, int y, int dx, int dy, int coul) { + int i; + int xi, yi, xo, yo; /* debug('boite'); */ hide_mouse(); @@ -15,14 +15,14 @@ void boite(integer x, integer y, integer dx, integer dy, integer coul) { 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); + if (gd != cga) putpix(gd, pred(int, xi), yi, coul); + yi = succ(int, yi); + } else xi = succ(int, xi); putpix(gd, xo, yo, coul); - if (yo == y + dy) xo = succ(integer, xo); + if (yo == y + dy) xo = succ(int, xo); else { - if (gd != cga) putpix(gd, succ(integer, xo), yo, coul); - yo = succ(integer, yo); + if (gd != cga) putpix(gd, succ(int, xo), yo, coul); + yo = succ(int, yo); } } show_mouse(); diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 517d408c87..0e458a5033 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -1,7 +1,7 @@ void dem1() { untyped_file f; - integer k; + int k; /* -- demande de disk 1 -- */ assign(f, "mort.005"); @@ -17,9 +17,9 @@ void dem1() { close(f); } -void takesav(integer n) { +void takesav(int n) { untyped_file f; - integer i; + int i; varying_string<10> st; dem1(); @@ -37,7 +37,7 @@ void takesav(integer n) { close(f); } -void ld_game(integer n) { +void ld_game(int n) { hide_mouse(); maivid(); takesav(n); @@ -50,9 +50,9 @@ void ld_game(integer n) { show_mouse(); } -void sv_game(integer n) { +void sv_game(int n) { untyped_file f; - integer i; + int i; hide_mouse(); tmaj3(); diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 8d254a4afc..0ad212dec1 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -1,5 +1,5 @@ -void droite(integer x, integer y, integer xx, integer yy, integer coul) { - integer step, i; +void droite(int x, int y, int xx, int yy, int coul) { + int step, i; real a, b; real xr, yr, xro, yro; @@ -31,4 +31,4 @@ void droite(integer x, integer y, integer xx, integer yy, integer coul) { } 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.cpp b/engines/mortevielle/keyboard.cpp index b450e074c1..199d43862f 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -7,10 +7,10 @@ char readkey1() { return readkey1_result; } -integer testou() { +int testou() { char ch; - integer testou_result; + int testou_result; input >> kbd >> ch; switch (ch) { case '\23' : @@ -19,7 +19,7 @@ integer testou() { case '\1': case '\3': case '\5' : { - newgd = (cardinal)pred(integer, ord(ch)) >> 1; + newgd = (cardinal)pred(int, ord(ch)) >> 1; testou_result = 61; return testou_result; } @@ -39,7 +39,7 @@ integer testou() { case '\26' : if (set::of(1, 2, eos).has(c_zzz)) { zzuul(adcfiec + 161, 0, 1644); - c_zzz = succ(integer, c_zzz); + c_zzz = succ(int, c_zzz); testou_result = 61; return testou_result; } @@ -53,7 +53,7 @@ integer testou() { } void teskbd() { - integer dum; + int dum; if (keypressed()) dum = testou(); } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 2c9b8cdcf4..35de7f439f 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -1,17 +1,17 @@ /* NIVEAU 15 */ void copcha() { - integer i; + int i; i = acha; do { tabdon[i] = tabdon[i + 390]; - i = succ(integer, i); + i = succ(int, i); } while (!(i == acha + 390)); } boolean dans_rect(rectangle r) { - integer x, y, c; + int x, y, c; boolean dans_rect_result; read_pos_mouse(x, y, c); @@ -23,8 +23,8 @@ boolean dans_rect(rectangle r) { return dans_rect_result; } -void outbloc(integer n, pattern p, t_nhom pal) { - integer i, j, ad; +void outbloc(int n, pattern p, t_nhom pal) { + int i, j, ad; ad = n * 404 + 0xd700; { @@ -33,13 +33,13 @@ void outbloc(integer n, pattern p, t_nhom pal) { 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]]; + mem[0x6000 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; } } -void writepal(integer n) { - integer i; +void writepal(int n) { + int i; t_nhom pal; @@ -49,7 +49,7 @@ void writepal(integer n) { 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; + mem[0x7000 + succ(int, 2 * i)] = tabpal[n][i].y; } break; case cga : { @@ -62,7 +62,7 @@ void writepal(integer n) { } -void pictout(integer seg, integer dep, integer x, integer y) { +void pictout(int seg, int dep, int x, int y) { decomp(seg, dep); if (gd == her) { mem[0x7000 + 2] = 0; @@ -72,45 +72,45 @@ void pictout(integer seg, integer dep, integer x, integer y) { afff(gd, seg, dep, x, y); } -void putxy(integer x, integer y) { +void putxy(int x, int y) { xwhere = x; ywhere = y; } /* -function calad(x,y:integer):integer; +function calad(x,y:int):int; begin calad:=pred(x)+320*pred(y) end; */ -void sauvecr(integer y, integer dy) { +void sauvecr(int y, int dy) { hide_mouse(); s_sauv(gd, y, dy); show_mouse(); } -void charecr(integer y, integer dy) { +void charecr(int y, int dy) { hide_mouse(); s_char(gd, y, dy); show_mouse(); } /* -function peek(ad:integer):integer; +function peek(ad:int):int; begin peek:=tabdon[ad]; end; -function peekw(ad:integer):integer; +function peekw(ad:int):int; begin peekw:=tabdon[ad] shl 8+tabdon[succ(ad)]; end; -function peekl(ad:integer):real; +function peekl(ad:int):real; begin peekl:=tabdon[ad+3]+tabdon[ad+2] shl 8; end; -procedure poke (ad,n:integer); +procedure poke (ad,n:int); begin tabdon[ad]:=lo(n); end; @@ -120,7 +120,7 @@ void adzon() { untyped_file f; file g; byte a; - integer i; + int i; assign(f, "don.mor"); reset(f, 256); @@ -148,10 +148,10 @@ void adzon() { close(f); } -integer animof(integer ouf, integer num) { - integer nani, aux; +int animof(int ouf, int num) { + int nani, aux; - integer animof_result; + int animof_result; nani = mem[adani + 1]; aux = num; if (ouf != 1) aux = aux + nani; @@ -163,7 +163,7 @@ integer animof(integer ouf, integer num) { return animof_result; } -/*procedure affgd(offs,dep,x,y:integer); +/*procedure affgd(offs,dep,x,y:int); begin case Gd of Ams : affams(offs,dep,x,y); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 691ef7c852..9018414d28 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -1,6 +1,6 @@ /* NIVEAU 14*/ -/* overlay */ void menut(integer no, str30 nom) { +/* overlay */ void menut(int no, str30 nom) { byte h, l; str30 s; @@ -33,7 +33,7 @@ } } -/* overlay */ void menu_disable(integer no) { +/* overlay */ void menu_disable(int no) { byte h, l; /* debug('menu_disable'); */ @@ -62,7 +62,7 @@ } } -/* overlay */ void menu_enable(integer no) { +/* overlay */ void menu_enable(int no) { byte h, l; /* debug('menu_disable'); */ @@ -92,9 +92,9 @@ } void menu_aff() { - integer ind_tabl, k, col; + int ind_tabl, k, col; char c; - integer pt, x, y, color, msk, + int pt, x, y, color, msk, num_letr; /* debug('menu_aff'); */ @@ -127,8 +127,8 @@ void menu_aff() { msk = (cardinal)msk >> 1; x = x + 1; } - ind_tabl = succ(integer, ind_tabl); - k = succ(integer, k); + ind_tabl = succ(int, ind_tabl); + k = succ(int, k); } while (!(k == 3)); y = y + 1; } while (!(y == 9)); @@ -149,7 +149,7 @@ void draw_menu() { test0 = false; } -void invers(integer ix) { +void invers(int ix) { varying_string<23> s; /* debug('invers'); */ @@ -186,8 +186,8 @@ void invers(integer ix) { else msg4 = no_choice; } -void util(integer x, integer y) { - integer ymx, dxcar, xmn, xmx, ix; +void util(int x, int y) { + int ymx, dxcar, xmn, xmx, ix; /* debug('util'); */ ymx = (don[msg3][4] << 3) + 16; @@ -197,7 +197,7 @@ void util(integer x, integer y) { 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); + ix = pred(int, (cardinal)y >> 3) + (msg3 << 8); if (ix != msg4) { invers(1); msg4 = ix; @@ -209,9 +209,9 @@ void util(integer x, integer y) { } } -void menu_down(integer ii) { - integer cx, xcc; - integer xco, nb_lig; +void menu_down(int ii) { + int cx, xcc; + int xco, nb_lig; /* debug('menu_down'); */ xco = don[ii][1]; @@ -228,7 +228,7 @@ void menu_down(integer ii) { putxy(xco, 16); cx = 0; do { - cx = succ(integer, cx); + cx = succ(int, cx); switch (ii) { case 1 : if (inv[cx][1] != '*') writeg(inv[cx], 4); @@ -262,7 +262,7 @@ void menu_down(integer ii) { show_mouse(); } -void menu_up(integer xx) { +void menu_up(int xx) { /* debug('menu_up'); */ if (test0) { charecr(10, succ(byte, don[xx][2]) << 1); @@ -278,7 +278,7 @@ void erase_menu() { } void mdn() { - integer x, y, c, a, ix; + int x, y, c, a, ix; boolean tes; /* debug('mdn'); */ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index fd4e2f5ffa..cee4e31b93 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -10,12 +10,12 @@ void testfi() { } -integer readclock() { +int readclock() { registres r; - integer s, m, h; + int s, m, h; /* debug('readclock');*/ - integer readclock_result; + int readclock_result; r.ax = 0x2c00; intr(0x21, r); { @@ -29,7 +29,7 @@ integer readclock() { return readclock_result; } -void modif(integer &nu) { +void modif(int &nu) { /* debug('modif'); */ if (nu == 26) nu = 25; if ((nu > 29) && (nu < 36)) nu = nu - 4; @@ -52,7 +52,7 @@ void modif(integer &nu) { } -void dessine(integer ad, integer x, integer y) { +void dessine(int ad, int x, int y) { /* debug('dessine'); */ hide_mouse(); writepal(numpal); @@ -72,17 +72,17 @@ void dessine_rouleau() { } -void text_color(integer c) { +void text_color(int c) { color_txt = c; } /* NIVEAU 13 */ -void text1(integer x, integer y, integer nb, integer m) { +void text1(int x, int y, int nb, int m) { phrase st; - integer tay; - integer co; + int tay; + int co; /* debug('text'); */ @@ -94,7 +94,7 @@ void text1(integer x, integer y, integer nb, integer m) { } void initouv() { - integer cx; + int cx; /* debug('initouv'); */ for (cx = 1; cx <= 7; cx ++) touv[cx] = chr(0); @@ -105,7 +105,7 @@ void ecrf1() { } void clsf1() { - integer i, j; + int i, j; /* debug('clsf1'); */ hide_mouse(); @@ -153,7 +153,7 @@ void clsf1() { } void clsf2() { - integer i, j; + int i, j; /* debug('clsf2'); */ hide_mouse(); @@ -175,34 +175,34 @@ void ecrf2() { } void ecr2(str255 str_) { - integer tab; - integer tlig; + int tab; + int tlig; /* debug('ecr2 : '+str_);*/ if (res == 1) tab = 10; else tab = 6; putxy(8, 177); - tlig = 59 + pred(integer, res) * 36; + tlig = 59 + pred(int, 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); + writeg(copy(str_, 1, pred(int, 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); + writeg(copy(str_, 1, pred(int, tlig)), 5); putxy(8, 182); - writeg(copy(str_, tlig, pred(integer, tlig << 1)), 5); + writeg(copy(str_, tlig, pred(int, tlig << 1)), 5); putxy(8, 190); writeg(copy(str_, tlig << 1, tlig * 3), 5); } } void clsf3() { - integer i, j; + int i, j; /* debug('clsf3'); */ hide_mouse(); @@ -232,7 +232,7 @@ void ecrf7() { } void clsf10() { - integer co, cod; + int co, cod; varying_string<8> st; /* debug('clsf10'); */ @@ -268,8 +268,8 @@ void stop() { exit(0); } -void paint_rect(integer x, integer y, integer dx, integer dy) { - integer co; +void paint_rect(int x, int y, int dx, int dy) { + int co; /* debug('paint_rect'); */ if (gd == cga) co = 3; @@ -277,20 +277,20 @@ void paint_rect(integer x, integer y, integer dx, integer dy) { box(co, gd, x, y, x + dx, y + dy, 255); } -integer hazard(integer min, integer max) { - integer ha1; +int hazard(int min, int max) { + int ha1; real ha2; /* debug('hazard'); */ - integer hazard_result; + int 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; +void calch(int &j, int &h, int &m) { + int th, nh; /* debug('calch');*/ nh = readclock(); @@ -305,15 +305,15 @@ void calch(integer &j, integer &h, integer &m) { h = h - ((j - vj) * 24); } -void conv(integer x, integer &y) { - integer cx; +void conv(int x, int &y) { + int cx; /* debug('conv'); */ cx = 1; y = 128; while (cx < x) { y = (cardinal)y >> 1; - cx = succ(integer, cx); + cx = succ(int, cx); } } @@ -322,10 +322,10 @@ void okpas() { tesok = true; } -void modobj(integer m) { +void modobj(int m) { phrase str_; str30 strp; - integer i, tay; + int i, tay; /* debug('modobj'); */ strp = ' '; @@ -337,10 +337,10 @@ void modobj(integer m) { menu_disable(invt[8]); } -void modobj2(integer m, boolean t1, boolean t2) { +void modobj2(int m, boolean t1, boolean t2) { phrase str_; str30 strp; - integer i, tay; + int i, tay; /* debug('modobj'); */ strp = ' '; @@ -355,17 +355,17 @@ void modobj2(integer m, boolean t1, boolean t2) { } -void repon(integer f, integer m) { +void repon(int f, int m) { str255 str_; varying_string<40> str1; phrase st; text1 fic; - integer i, xco, dx, caspe, tay; + int i, xco, dx, caspe, tay; /* debug('repon fenetre nř'+chr(f+48));*/ if ((m > 499) && (m < 563)) { deline(m - 501 + c_st41, st, tay); - if (tay > ((58 + pred(integer, res) * 37) << 1)) f2_all = true; + if (tay > ((58 + pred(int, res) * 37) << 1)) f2_all = true; else f2_all = false; clsf2(); afftex(st, 8, 176, 85, 3, 5); @@ -413,7 +413,7 @@ void repon(integer f, integer m) { } void f3f8() { - integer co; + int co; if (res == 1) co = 107; else co = 64; @@ -424,7 +424,7 @@ void f3f8() { boite(0, 42, co, 16, 7); } -void t5(integer cx) { +void t5(int cx) { /* debug('t5'); */ if (cx == 10) blo = false; if (cx != 1) { @@ -444,8 +444,8 @@ void t5(integer cx) { if (cx != 9) bh9 = false; } -void affper(integer per) { - integer cx; +void affper(int per) { + int cx; /* debug('affper'); */ for (cx = 1; cx <= 8; cx ++) menu_disable(disc[cx]); @@ -493,10 +493,10 @@ void affper(integer per) { ipers = per; } -/* overlay */ void choix(integer min, integer max, integer &per) { +/* overlay */ void choix(int min, int max, int &per) { boolean i; - integer haz, cx, cy, cz; - long_integer per2, cz2; + int haz, cx, cy, cz; + long_int per2, cz2; /* debug('o0 choix'); */ haz = hazard(min, max); @@ -518,8 +518,8 @@ void affper(integer per) { i = false; } -/* overlay */ void cpl1(integer &p) { - integer j, h, m; +/* overlay */ void cpl1(int &p) { + int j, h, m; /* debug('o0 cpl1'); */ calch(j, h, m); @@ -533,8 +533,8 @@ void affper(integer per) { mdn(); } -/* overlay */ void cpl2(integer &p) { - integer j, h, m; +/* overlay */ void cpl2(int &p) { + int j, h, m; /* debug('o0 cpl2'); */ calch(j, h, m); @@ -545,8 +545,8 @@ void affper(integer per) { if ((h >= 0) && (h < 8)) p = 50; } -/* overlay */ void cpl3(integer &p) { - integer j, h, m; +/* overlay */ void cpl3(int &p) { + int j, h, m; /* debug('o0 cpl3'); */ calch(j, h, m); @@ -554,8 +554,8 @@ void affper(integer per) { if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) p = 0; } -/* overlay */ void cpl5(integer &p) { - integer j, h, m; +/* overlay */ void cpl5(int &p) { + int j, h, m; /* debug('o0 cpl5'); */ calch(j, h, m); @@ -565,8 +565,8 @@ void affper(integer per) { if ((h >= 0) && (h < 7)) p = 50; } -/* overlay */ void cpl6(integer &p) { - integer j, h, m; +/* overlay */ void cpl6(int &p) { + int j, h, m; /* debug('o0 cpl6'); */ calch(j, h, m); @@ -580,7 +580,7 @@ void person() { const char m1[] = "Vous"; const char m2[] = "tes"; const char m3[] = "SEUL"; - integer cf; + int cf; str255 str_; /* debug('person'); */ @@ -595,22 +595,22 @@ void person() { ipers = 0; } -void chlm(integer &per) { +void chlm(int &per) { /* debug('chlm'); */ per = hazard(1, 2); if (per == 2) per = 128; } void pendule() { - const matrix<1, 2, 1, 12, integer> cv + const matrix<1, 2, 1, 12, int> 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; + const int x = 580; + const int y = 123; + const int rg = 9; + int h, co; /* debug('pendule'); */ @@ -639,7 +639,7 @@ void pendule() { * NIVEAU 11 * *************/ -void debloc(integer l) { +void debloc(int l) { /* debug('debloc'); */ num = 0; x = 0; @@ -648,8 +648,8 @@ void debloc(integer l) { mpers = ipers; } -/* overlay */ void cpl10(integer &p, integer &h) { - integer j, m; +/* overlay */ void cpl10(int &p, int &h) { + int j, m; /* debug('o1 cpl10'); */ calch(j, h, m); @@ -661,8 +661,8 @@ void debloc(integer l) { if ((h >= 0) && (h < 8)) p = 5; } -/* overlay */ void cpl11(integer &p, integer &h) { - integer j, m; +/* overlay */ void cpl11(int &p, int &h) { + int j, m; /* debug('o1 cpl11'); */ calch(j, h, m); @@ -673,8 +673,8 @@ void debloc(integer l) { if ((h >= 0) && (h < 9)) p = 0; } -/* overlay */ void cpl12(integer &p) { - integer j, h, m; +/* overlay */ void cpl12(int &p) { + int j, h, m; /* debug('o1 cpl12'); */ calch(j, h, m); @@ -684,13 +684,13 @@ void debloc(integer l) { if ((h > 4) && (h < 9)) p = 15; } -/* overlay */ void cpl13(integer &p) { +/* overlay */ void cpl13(int &p) { /* debug('o1 cpl13'); */ p = 0; } -/* overlay */ void cpl15(integer &p) { - integer j, h, m; +/* overlay */ void cpl15(int &p) { + int j, h, m; /* debug('o1 cpl15'); */ calch(j, h, m); @@ -703,8 +703,8 @@ void debloc(integer l) { if ((h >= 0) && (h < 8)) p = -15; } -/* overlay */ void cpl20(integer &p, integer &h) { - integer j, m; +/* overlay */ void cpl20(int &p, int &h) { + int j, m; /* debug('o1 cpl20'); */ calch(j, h, m); @@ -715,8 +715,8 @@ void debloc(integer l) { if ((h > 4) && (h < 10)) p = -5; } -/* overlay */ void quelq1(integer l) { - integer per; +/* overlay */ void quelq1(int l) { + int per; /* debug('o1 quelq1'); */ per = hazard(1, 2); @@ -742,8 +742,8 @@ void debloc(integer l) { ipers = 10; } -/* overlay */ void quelq6(integer l) { - integer per; +/* overlay */ void quelq6(int l) { + int per; /* debug('o1 quelq6'); */ if (l == 6) bh6 = true; @@ -751,8 +751,8 @@ void debloc(integer l) { ipers = 10; } -/* overlay */ void quelq10(integer h, integer &per) { - integer min, max; +/* overlay */ void quelq10(int h, int &per) { + int min, max; /* debug('o1 quelq10'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -778,8 +778,8 @@ void debloc(integer l) { affper(per); } -/* overlay */ void quelq11(integer h, integer &per) { - integer min, max; +/* overlay */ void quelq11(int h, int &per) { + int min, max; /* debug('o1 quelq11'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -801,14 +801,14 @@ void debloc(integer l) { affper(per); } -/* overlay */ void quelq12(integer &per) { +/* overlay */ void quelq12(int &per) { /* debug('o1 quelq12'); */ chlm(per); affper(per); } -/* overlay */ void quelq15(integer &per) { - integer cx; +/* overlay */ void quelq15(int &per) { + int cx; boolean test; @@ -831,8 +831,8 @@ void debloc(integer l) { } } -/* overlay */ void quelq20(integer h, integer &per) { - integer min, max; +/* overlay */ void quelq20(int h, int &per) { + int min, max; /* debug('o1 quelq20'); */ if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); @@ -856,7 +856,7 @@ void debloc(integer l) { /* overlay */void frap() { - integer j, h, m, haz; + int j, h, m, haz; /* debug('o1 frap'); */ calch(j, h, m); @@ -868,7 +868,7 @@ void debloc(integer l) { } } -/* overlay */ void nouvp(integer l, integer &p) { +/* overlay */ void nouvp(int l, int &p) { /* debug('o1 nouvp'); */ p = 0; if (l == 1) { @@ -889,7 +889,7 @@ void debloc(integer l) { -/* overlay */ void tip(integer ip, integer &cx) { +/* overlay */ void tip(int ip, int &cx) { /* debug('o1 tip'); */ if (ip == 128) cx = 1; else if (ip == 64) cx = 2; @@ -902,7 +902,7 @@ void debloc(integer l) { } -/* overlay */ void ecfren(integer &p, integer &haz, integer cf, integer l) { +/* overlay */ void ecfren(int &p, int &haz, int cf, int l) { /* debug('o1 ecfren'); */ if (l == 0) person(); p = -500; @@ -921,8 +921,8 @@ void debloc(integer l) { } } -/* overlay */ void becfren(integer l) { - integer haz; +/* overlay */ void becfren(int l) { + int haz; /* debug('o1 becfren'); */ if ((l == 1) || (l == 4)) { @@ -947,24 +947,24 @@ void debloc(integer l) { void init_nbrepm() { const array<1, 8, byte> ipm = {{4, 5, 6, 7, 5, 6, 5, 8}}; - integer i; + int i; /* debug('init_nbrepm'); */ i = 0; do { - i = succ(integer, i); + i = succ(int, i); nbrepm[i] = ipm[i]; } while (!(i == 8)); } -void phaz(integer &haz, integer &p, integer cf) { +void phaz(int &haz, int &p, int cf) { /* debug('phaz'); */ p = p + cf; haz = hazard(1, 100); } /* overlay */ void inzon() { - integer cx; + int cx; /* debug('o2 inzon'); */ copcha(); @@ -1004,8 +1004,8 @@ void phaz(integer &haz, integer &p, integer cf) { mh = readclock(); } -/* overlay */ void pl1(integer cf) { - integer p, haz; +/* overlay */ void pl1(int cf) { + int p, haz; /* debug('o2 pl1'); */ if (((li == 1) && (! bh1) && (! bf1)) @@ -1017,8 +1017,8 @@ void phaz(integer &haz, integer &p, integer cf) { } } -/* overlay */ void pl2(integer cf) { - integer p, haz; +/* overlay */ void pl2(int cf) { + int p, haz; /* debug('o2 pl2'); */ if (! bh2) { @@ -1029,8 +1029,8 @@ void phaz(integer &haz, integer &p, integer cf) { } } -/* overlay */ void pl5(integer cf) { - integer p, haz; +/* overlay */ void pl5(int cf) { + int p, haz; /* debug('o2 pl5'); */ if (! bh5) { @@ -1041,8 +1041,8 @@ void phaz(integer &haz, integer &p, integer cf) { } } -/* overlay */ void pl6(integer cf) { - integer p, haz; +/* overlay */ void pl6(int cf) { + int p, haz; /* debug('o2 pl6'); */ if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { @@ -1053,8 +1053,8 @@ void phaz(integer &haz, integer &p, integer cf) { } } -/* overlayi */ void pl9(integer cf) { - integer p, haz; +/* overlayi */ void pl9(int cf) { + int p, haz; /* debug('o2 pl9'); */ if (! bh9) { @@ -1065,8 +1065,8 @@ void phaz(integer &haz, integer &p, integer cf) { } } -/* overlayi */ void pl10(integer cf) { - integer p, h, haz; +/* overlayi */ void pl10(int cf) { + int p, h, haz; /* debug('o2 pl10'); */ cpl10(p, h); @@ -1075,8 +1075,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq10(h, p); } -/* overlay */ void pl11(integer cf) { - integer p, h, haz; +/* overlay */ void pl11(int cf) { + int p, h, haz; /* debug('o2 pl11'); */ cpl11(p, h); @@ -1085,8 +1085,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq11(h, p); } -/* overlay */ void pl12(integer cf) { - integer p, haz; +/* overlay */ void pl12(int cf) { + int p, haz; /* debug('o2 pl12'); */ cpl12(p); @@ -1095,8 +1095,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq12(p); } -/* overlay */ void pl13(integer cf) { - integer p, haz; +/* overlay */ void pl13(int cf) { + int p, haz; /* debug('o2 pl13'); */ cpl13(p); @@ -1105,8 +1105,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq12(p); } -/* overlay */ void pl15(integer cf) { - integer p, haz; +/* overlay */ void pl15(int cf) { + int p, haz; /* debug('o2 pl15'); */ cpl15(p); @@ -1115,8 +1115,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq15(p); } -/* overlay */ void pl20(integer cf) { - integer p, h, haz; +/* overlay */ void pl20(int cf) { + int p, h, haz; /* debug('o2 pl20'); */ cpl20(p, h); @@ -1125,8 +1125,8 @@ void phaz(integer &haz, integer &p, integer cf) { else quelq20(h, p); } -/* overlay */ void t11(integer l11, integer &a) { - integer p, haz, h; +/* overlay */ void t11(int l11, int &a) { + int p, haz, h; /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); @@ -1169,7 +1169,7 @@ void phaz(integer &haz, integer &p, integer cf) { /* overlay */ void cavegre() { - integer haz; + int haz; /* debug('cavegre'); */ s.conf = s.conf + 2; @@ -1184,12 +1184,12 @@ void phaz(integer &haz, integer &p, integer cf) { person(); } -void writetp(str255 s, integer t) { +void writetp(str255 s, int t) { if (res == 2) writeg(s, t); else writeg(copy(s, 1, 25), t); } -void messint(integer nu) { +void messint(int nu) { /* debug('messint'); */ clsf1(); clsf2(); @@ -1203,8 +1203,8 @@ void messint(integer nu) { repon(7, nu); } -void aniof(integer ouf, integer num) { - integer ad, offset; +void aniof(int ouf, int num) { + int ad, offset; char c; /* debug('aniof'); */ @@ -1221,10 +1221,10 @@ void aniof(integer ouf, integer num) { show_mouse(); } -void musique(integer so) { +void musique(int so) { boolean i; - integer haz; - /* dep: array[1..5] of long_integer;*/ + int haz; + /* dep: array[1..5] of long_int;*/ /* debug('musique'); */ if (so == 0) { /*musik(0)*/ @@ -1275,8 +1275,8 @@ void musique(integer so) { } /* NIVEAU 9 */ -void dessin(integer ad) { - integer cx; +void dessin(int ad) { + int cx; /* debug('dessin'); */ if (ad != 0) dessine(ades, ((ad % 160) * 2), (ad / 160)); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 734cb4806c..48db49b6da 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -1,4 +1,4 @@ -const array<1, 11, integer> men +const array<1, 11, int> men = {{ scacher, attacher, defoncer, dormir, entrer, fermer, frapper, manger, @@ -14,7 +14,7 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; const char d6[] = "OK"; - integer cx, cy, haz, nh, cf, j, h, m, cd; + int cx, cy, haz, nh, cf, j, h, m, cd; varying_string<3> stpo; boolean am; @@ -128,7 +128,7 @@ void tinke() { } void fenat(char ans) { - integer coul; + int coul; hide_mouse(); if (gd == cga) coul = 2; @@ -141,7 +141,7 @@ void fenat(char ans) { /* NIVEAU 8 */ -void afdes(integer ad) { +void afdes(int ad) { taffich(); dessin(ad); okdes = false; @@ -149,8 +149,8 @@ void afdes(integer ad) { void tkey1(boolean d) { boolean quest; - integer x, y, c; - integer key; + int x, y, c; + int key; hide_mouse(); fenat('K'); @@ -165,8 +165,8 @@ void tkey1(boolean d) { show_mouse(); } -void tmlieu(integer mli) { - integer cx, j, i, tail; +void tmlieu(int mli) { + int cx, j, i, tail; str30 nomp; phrase st; @@ -187,7 +187,7 @@ void tmlieu(integer mli) { /* NIVEAU 7 */ -void tlu(integer af, integer ob) { +void tlu(int af, int ob) { caff = 32; afdes(0); repon(6, ob + 4000); @@ -198,9 +198,9 @@ void tlu(integer af, integer ob) { crep = 998; } -void delin(integer n) { +void delin(int n) { phrase s; - integer t; + int t; deline(n, s, t); } @@ -213,7 +213,7 @@ void affrep() { void mfouen() { - integer cx; + int cx; tmlieu(s.mlieu); for (cx = 1; cx <= 11; cx ++) menu_enable(men[cx]); @@ -232,7 +232,7 @@ void mfouen() menut(soulever, " soulever "); } -void atf3f8(integer &key) { +void atf3f8(int &key) { do { key = testou(); } while (!((key == 61) || (key == 66))); @@ -241,7 +241,7 @@ void atf3f8(integer &key) { /* NIVEAU 6 */ void tperd() { - integer cx; + int cx; initouv(); ment = 0; @@ -261,7 +261,7 @@ void tperd() { } void tsort() { - integer cx; + int cx; if ((iouv > 0) && (s.mlieu != 0)) if (s.conf < 50) s.conf = s.conf + 2; @@ -273,7 +273,7 @@ void tsort() { debloc(s.mlieu); } -void st4(integer ob) { +void st4(int ob) { crep = 997; switch (ob) { case 114 : @@ -296,8 +296,8 @@ void st4(integer ob) { } } -void cherjer(integer ob, boolean &d) { - integer cx; +void cherjer(int ob, boolean &d) { + int cx; d = false; for (cx = 1; cx <= 6; cx ++) d = (d || (ord(s.sjer[cx]) == ob)); @@ -310,14 +310,14 @@ void st1sama() { } void modinv() { - integer cx, cy, tay, i, r; + int 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); + cy = succ(int, cy); r = (ord(s.sjer[cx]) + 400); deline(r - 501 + c_st41, nom, tay); nomp = delig; @@ -331,10 +331,10 @@ void modinv() { } } -void sparl(long_integer adr, long_integer rep) { - const array<1, 8, integer> haut +void sparl(long_int adr, long_int rep) { + const array<1, 8, int> haut = {{0, 1, -3, 6, -2, 2, 7, -1}}; - integer key, ad, tay, repint; + int key, ad, tay, repint; phrase st; repint = trunc(rep); @@ -365,7 +365,7 @@ void finfouil() { } void mfoudi() { - integer cx; + int cx; for (cx = 1; cx <= 7; cx ++) menu_disable(depl[cx]); for (cx = 1; cx <= 11; cx ++) menu_disable(men[cx]); @@ -395,10 +395,10 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - integer cx, cy, lderobj; + int cx, cy, lderobj; - cy = (acha + pred(integer, pred(integer, mchai) * 10)); + cy = (acha + pred(int, pred(int, mchai) * 10)); cx = 0; do { cx = cx + 1; @@ -409,8 +409,8 @@ void ajchai() { } else crep = 192; } -void ajjer(integer ob) { - integer cx; +void ajjer(int ob) { + int cx; cx = 0; do { @@ -423,7 +423,7 @@ void ajjer(integer ob) { } void t1sama() { /* On entre dans le manoir */ - integer j, h, m; + int j, h, m; boolean d; calch(j, h, m); @@ -502,7 +502,7 @@ void tctrm() { void quelquun() { - integer haz, cx; + int haz, cx; if (imen) erase_menu(); finfouil(); @@ -546,8 +546,8 @@ L1: } void tsuiv() { - integer cx, tbcl; - integer cl, cy; + int cx, tbcl; + int cl, cy; cy = acha + ((mchai - 1) * 10) - 1; cx = 0; @@ -572,7 +572,7 @@ void tsuiv() { void tfleche() { boolean qust; char touch; - integer dummy, cd, xmo, ymo; + int dummy, cd, xmo, ymo; if (num == 9999) return; fenat(chr(152)); @@ -596,11 +596,11 @@ void tfleche() { } } -void tcoord(integer sx) +void tcoord(int sx) { - integer sy, ix, iy, cb, cy, ib; - integer a, b, atdon; + int sy, ix, iy, cb, cy, ib; + int a, b, atdon; num = 0; @@ -611,7 +611,7 @@ void tcoord(integer sx) while (cy < caff) { a = a + tabdon[atdon]; atdon = atdon + 4; - cy = succ(integer, cy); + cy = succ(int, cy); } /* for cy:=0 to caff-1 do a:=a+ tabdon[amzon+3+4*cy]; @@ -621,19 +621,19 @@ void tcoord(integer sx) a = a + fleche; cb = 0; for (cy = 0; cy <= (sx - 2); cy ++) { - ib = (tabdon[a + cb] << 8) + tabdon[succ(integer, a + cb)]; + ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; cb = cb + (ib * 4) + 2; } - ib = (tabdon[a + cb] << 8) + tabdon[succ(integer, a + cb)]; + ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; if (ib == 0) goto L1; cy = 1; do { cb = cb + 2; sx = tabdon[a + cb] * res; - sy = tabdon[succ(integer, a + cb)]; + sy = tabdon[succ(int, a + cb)]; cb = cb + 2; ix = tabdon[a + cb] * res; - iy = tabdon[succ(integer, a + cb)]; + iy = tabdon[succ(int, a + cb)]; cy = cy + 1; } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); @@ -648,7 +648,7 @@ L1: } -void st7(integer ob) { +void st7(int ob) { crep = 183; if ((ob == 116) || (ob == 144)) crep = 104; if ((ob == 126) || (ob == 111)) crep = 108; @@ -657,8 +657,8 @@ void st7(integer ob) { if (crep == 183) st4(ob); } -void treg(integer ob) { - integer mdes; +void treg(int ob) { + int mdes; mdes = caff; caff = ob; @@ -678,7 +678,7 @@ void treg(integer ob) { } } -void avpoing(integer &ob) { +void avpoing(int &ob) { crep = 999; if (s.derobj != 0) ajjer(s.derobj); if (crep != 139) { @@ -688,15 +688,15 @@ void avpoing(integer &ob) { } } -void rechai(integer &ch) { - integer cx; +void rechai(int &ch) { + int cx; cx = s.mlieu; if (s.mlieu == 16) cx = 14; - ch = tabdon[achai + (cx * 7) + pred(integer, num)]; + ch = tabdon[achai + (cx * 7) + pred(int, num)]; } -void t23coul(integer &l) { +void t23coul(int &l) { boolean d; cherjer(143, d); @@ -712,7 +712,7 @@ void maivid() { modobj(500); } -void st13(integer ob) { +void st13(int ob) { if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || @@ -722,7 +722,7 @@ void st13(integer ob) { } void aldepl() { - integer dummy; + int dummy; dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); } diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 7d5f33c2ab..c9e1d25d7e 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -31,7 +31,7 @@ /* ecrihexa utilitaire */ -void divers(integer np, boolean b) { +void divers(int np, boolean b) { teskbd(); do { parole(np, 0, 0); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d1de4b79d2..9ce1788b2c 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -1,20 +1,20 @@ -const integer m_arrow = 0; -const integer m_point_hand = 1; +const int m_arrow = 0; +const int m_point_hand = 1; boolean int_m, clic; -integer m_show, +int m_show, x_s, y_s, p_o_s, mouse_shwn; -matrix<0, 5, 0, 11, integer> s_s; +matrix<0, 5, 0, 11, int> s_s; void init_mouse() { - integer i, j; + int i, j; registres reg; mouse_shwn = 0; @@ -40,13 +40,13 @@ void init_mouse() { } } -/*procedure change_mouse( t : integer ); +/*procedure change_mouse( t : int ); begin m_show:= t; end;*/ -/*procedure dessine_souris(xf,yf:integer); - var x, xx, y :integer; +/*procedure dessine_souris(xf,yf:int); + var x, xx, y :int; begin case m_show of m_arrow : begin @@ -56,10 +56,10 @@ begin end; */ void hide_mouse() { - integer i, j, k, ps, ds; + int i, j, k, ps, ds; boolean imp; - mouse_shwn = pred(integer, mouse_shwn); + mouse_shwn = pred(int, mouse_shwn); if (mouse_shwn == 0) { imp = odd(y_s); j = p_o_s; @@ -73,7 +73,7 @@ void hide_mouse() { memw[0xba00 + j] = s_s[2][k]; memw[0xba00 + j + 2] = s_s[3][k]; j = j + 80; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 5)); } break; @@ -91,7 +91,7 @@ void hide_mouse() { j = j + 0x2000; } imp = ! imp; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 8)); } } @@ -111,7 +111,7 @@ void hide_mouse() { ps = mem[0xa000 + j + 1]; mem[0xa000 + j + 1] = hi(s_s[i][k]); j = j + 80; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 8)); i = i + 1; } while (!(i == 4)); @@ -134,7 +134,7 @@ void hide_mouse() { memw[0xb800 + 0x200 * i + j + 2] = s_s[k + 3][i + (k << 2)]; } j = j + 160; - k = succ(integer, k); + k = succ(int, k); } while (!(k == 3)); } break; @@ -144,7 +144,7 @@ void hide_mouse() { } void show_mouse() { - integer i, j, k, l, + int i, j, k, l, ps, ds; boolean imp; char c; @@ -164,7 +164,7 @@ void show_mouse() { s_s[2][k] = memw[0xba00 + j]; s_s[3][k] = memw[0xba00 + j + 2]; j = j + 80; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 5)); } break; @@ -183,7 +183,7 @@ void show_mouse() { j = j + 0x2000; } imp = ! imp; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 8)); } } @@ -196,9 +196,9 @@ void show_mouse() { k = 0; j = p_o_s; do { - s_s[l][k] = mem[0xa000 + j] + (mem[0xa000 + succ(integer, j)] << 8); + s_s[l][k] = mem[0xa000 + j] + (mem[0xa000 + succ(int, j)] << 8); j = j + 80; - k = succ(integer, k); + k = succ(int, k); } while (!(k >= 8)); l = l + 1; } while (!(l == 4)); @@ -221,7 +221,7 @@ void show_mouse() { s_s[k + 3][i + (k << 2)] = memw[0xb800 + 0x200 * i + j + 2]; } j = j + 160; - k = succ(integer, k); + k = succ(int, k); } while (!(k == 3)); } break; @@ -229,7 +229,7 @@ void show_mouse() { affput(2, gd, x_s, y_s, 0, 0); } -void pos_mouse(integer x, integer y) { +void pos_mouse(int x, int y) { registres reg; if (x > 314 * res) x = 314 * res; @@ -264,7 +264,7 @@ void pos_mouse(integer x, integer y) { show_mouse(); } -void read_pos_mouse(integer &x, integer &y, integer &c) { +void read_pos_mouse(int &x, int &y, int &c) { registres reg; if (int_m) { @@ -283,7 +283,7 @@ void read_pos_mouse(integer &x, integer &y, integer &c) { void mov_mouse(boolean &funct, char &key) { boolean p_key; char in1, in2; - integer x, y, cx, cy, cd; + int x, y, cx, cy, cd; registres reg; if (int_m) { @@ -354,16 +354,16 @@ void mov_mouse(boolean &funct, char &key) { input >> kbd >> in2; switch (in2) { case 'K' : - cx = pred(integer, cx); + cx = pred(int, cx); break; case 'P' : - cy = succ(integer, cy); + cy = succ(int, cy); break; case 'M' : cx = cx + 2; break; case 'H' : - cy = pred(integer, cy); + cy = pred(int, cy); break; case RANGE_10(';', 'D') : { funct = true; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 7c8f1c9f5c..ec7728745d 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -30,9 +30,9 @@ const array<0, 31, byte> tab31 } }; -void deline(integer num , phrase &l , integer &tl); +void deline(int num , phrase &l , int &tl); -static void cinq_huit(char &c, integer &ind, byte &pt, boolean &the_end) { +static void cinq_huit(char &c, int &ind, byte &pt, boolean &the_end) { const array<0, 31, char> rap = {{ ',', ':', '@', '!', '?', '-', '‡', ' ', '…', '', '‚', 'Š', '', '/', @@ -41,7 +41,7 @@ static void cinq_huit(char &c, integer &ind, byte &pt, boolean &the_end) { '6', '7', '8', '9' } }; - integer oct, ocd; + int oct, ocd; /* 5-8 */ oct = t_mot[ind]; @@ -88,8 +88,8 @@ static void cinq_huit(char &c, integer &ind, byte &pt, boolean &the_end) { } } /* 5-8 */ -void deline(integer num , phrase &l , integer &tl) { - integer i, j, ts; +void deline(int num , phrase &l , int &tl) { + int i, j, ts; char let; byte ps, k; boolean the_end; @@ -115,27 +115,27 @@ void deline(integer num , phrase &l , integer &tl) { } /* DETEX */ -void afftex(phrase ch, integer x, integer y, integer dx, integer dy, integer typ); +void afftex(phrase ch, int x, int y, int dx, int dy, int typ); -static integer l_motsuiv(integer p, phrase &ch, integer &tab) { - integer c; +static int l_motsuiv(int p, phrase &ch, int &tab) { + int c; - integer l_motsuiv_result; + int 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) { +void afftex(phrase ch, int x, int y, int dx, int dy, int typ) { boolean the_end; char touch; - integer xf, yf; - integer xc, yc; - integer tab, p; + int xf, yf; + int xc, yc; + int tab, p; varying_string<255> s; - integer i, j, nt; + int i, j, nt; /* debug(' .. Afftex');*/ diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index d40f8d39bc..c2384273f2 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -1,6 +1,6 @@ void dem2() { untyped_file f; - integer k; + int k; /* -- demande de disk 2 -- */ while (ioresult != 0); @@ -35,7 +35,7 @@ void ani50() { end;*/ /* overlay */ void aff50(boolean c) { - integer k; + int k; caff = 50; maff = 0; @@ -47,7 +47,7 @@ void ani50() { } /* overlay */ void init_menu() { - integer i, j, tai; + int i, j, tai; phrase st; untyped_file f; @@ -77,7 +77,7 @@ void ani50() { deline(i + c_dis, st, tai); dis[i] = delig + ' '; } - i = succ(integer, i); + i = succ(int, i); } while (!(i == 22)); for (i = 1; i <= 8; i ++) { disc[i] = 0x500 + i; @@ -96,7 +96,7 @@ void ani50() { /* overlay */ void charpal() { file f; file ft; - integer i, j, k; + int i, j, k; file fb; byte b; @@ -138,7 +138,7 @@ void ani50() { } /* overlay */ void chartex() { - integer i; + int i; untyped_file fibyte; phrase s; @@ -169,7 +169,7 @@ void ani50() { /* overlay */ void dialpre() { - integer cy, tay; + int cy, tay; phrase st; real ix; char ch; @@ -244,7 +244,7 @@ void ani50() { /* overlay */ void music() { untyped_file fic; - integer k; + int k; boolean fin; char ch; real x, y; @@ -326,7 +326,7 @@ void ani50() { if (newgd != gd) gd = newgd; hirs(); dessine(ades, 0, 0); - gotoxy(20 * pred(integer, res) + 8, 24); + gotoxy(20 * pred(int, res) + 8, 24); textcolor(7); cpr = "COPYRIGHT 1989 : LANKHOR"; if (set::of(ega, ams, cga, eos).has(gd)) output << cpr; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 3b777c3770..42a46e1209 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -1,5 +1,5 @@ -void spfrac(integer wor) { +void spfrac(int 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))) || @@ -10,7 +10,7 @@ void spfrac(integer wor) { } void charg_car() { - integer wor, int_; + int wor, int_; wor = swap(memw[adword + ptr_word]); int_ = wor & 0x3f; @@ -67,7 +67,7 @@ void veracf(byte b) { } /* overlay */ void cctable(tablint &t) { - integer k; + int k; array<0, 256, real> tb; @@ -79,7 +79,7 @@ void veracf(byte b) { } /* overlay */ void regenbruit() { - integer i, j; + int i, j; i = offsetb3 + 8590; j = 0; @@ -113,7 +113,7 @@ void veracf(byte b) { /* overlay */ void charge_bruit() { untyped_file f; - integer j, i; + int j, i; assign(f, "bruits"); reset(f); @@ -125,7 +125,7 @@ void veracf(byte b) { /* overlay */ void trait_car() { byte d3; - integer d2, i; + int d2, i; switch (c2.code) { case 9 : @@ -388,9 +388,9 @@ void veracf(byte b) { var regs : registres; buffer : array[0..511] of char; - i,j,k : integer; + i,j,k : int; st : phrase; - tay : integer; + tay : int; test : array[0..2] of boolean; const chaine : array[0..7] of char diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 07ac757d77..02ec4fb908 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -19,10 +19,10 @@ void init_chariot() { void trait_ph() { - const array<0, 2, integer> deca + const array<0, 2, int> deca = {{300, 30, 40}}; - ptr_tcph = pred(integer, num_ph); + ptr_tcph = pred(int, num_ph); ledeb = swap(t_cph[ptr_tcph]) + deca[typlec]; lefin = swap(t_cph[ptr_tcph + 1]) + deca[typlec]; nb_word = lefin - ledeb; @@ -51,10 +51,10 @@ void trait_ph() { -void parole(integer rep, integer ht, integer typ) { - array<0, 500, integer> savph; - integer i; - integer tempo; +void parole(int rep, int ht, int typ) { + array<0, 500, int> savph; + int i; + int tempo; if (sonoff) return; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 7bdea5b850..62dc99f479 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -1,5 +1,5 @@ -/* overlay */ void change_gd(integer ngd) { - integer i; +/* overlay */ void change_gd(int ngd) { + int i; hide_mouse(); gd = ngd; @@ -20,10 +20,10 @@ } /* overlay */ void antegame() { - integer cx; + int cx; registres regs; array<0, 511, char> buffer; - integer i, j, k; + int i, j, k; array<0, 2, boolean> test; array<0, 7, char> g; @@ -71,7 +71,7 @@ stpou = ind_mess; while ((test[k] == false) && (k < 2)) { regs.ax = 0; - k = succ(integer, k); + k = succ(int, k); intr(19, regs); { regs.ax = 0x201; @@ -118,7 +118,7 @@ /* NIVEAU 3 */ /* procedure PROGRAMME */ void tmaj3() { - integer j, h, m; + int j, h, m; calch(j, h, m); if (m == 30) m = 1; @@ -130,7 +130,7 @@ void tmaj3() { void tsitu() { - integer h, j, m; + int h, j, m; if (! col) clsf2(); syn = false; @@ -203,14 +203,14 @@ L2: mennor(); } -void sv_game(integer n); +void sv_game(int n); -void ld_game(integer n); +void ld_game(int n); void tecran() { const char idem[] = "Idem"; - const integer lim = 20000; - integer temps; + const int lim = 20000; + int temps; char inkey; boolean oo, funct; @@ -235,11 +235,11 @@ void tecran() { erase_menu(); imen = false; if (set::of('\1', '\3', '\5', '\7', '\11', eos).has(inkey)) { - change_gd((cardinal)pred(integer, ord(inkey)) >> 1); + change_gd((cardinal)pred(int, 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 (choisi && (msg[3] == charge)) ld_game(pred(int, msg[4] & 7)); if (inkey == '\103') { /* F9 */ temps = do_alert(stpou, 1); return; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 87d0c87cd1..6f7a05e0c7 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -1,23 +1,23 @@ /* overlay */ boolean ques() { - const array<1, 10, integer> ta + const array<1, 10, int> ta = {{ 511, 516, 524, 531, 545, 552, 559, 563, 570, 576 } }; - const array<1, 10, integer> ok + const array<1, 10, int> 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; + int i, j, k, y, memk; + int tay , tmax; + int rep, prem, der; phrase st; char key; mult_rect coor; array<1, 14, str40> chaines; - integer compte; + int compte; boolean ques_result; @@ -53,7 +53,7 @@ memk = memk + 1; y = y + 8; } - for (j = 1; j <= succ(integer, der - prem); j ++) { + for (j = 1; j <= succ(int, der - prem); j ++) { { rectangle &with = coor[j]; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 854fdd6359..bdb0a1b2fd 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -1,16 +1,16 @@ -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 fill_box(int x, int y, int dx) { + box(15, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, 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 clear_box(int x, int y, int dx) { + box(0, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); } -void writeg(str255 l, integer c) +void writeg(str255 l, int c) { - integer i, x, xo, yo; - integer cecr; + int i, x, xo, yo; + int cecr; boolean t; /* debug('writeg : '+l);*/ diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 00203118d8..d1e447de71 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -1,5 +1,5 @@ -void chardes(str11 nom, long_integer passe, integer long_) { - integer i, p, l; +void chardes(str11 nom, long_int passe, int long_) { + int i, p, l; byte b; untyped_file f; @@ -28,8 +28,8 @@ void chardes(str11 nom, long_integer passe, integer long_) { /*$i+*/ } -void charani(str11 nom, long_integer passe, integer long_) { - integer i, p, l; +void charani(str11 nom, long_int passe, int long_) { + int i, p, l; byte b; untyped_file f; @@ -67,12 +67,12 @@ void taffich() { 110, 159, 100, 100 } }; - integer i, m, a, b, cx, handle, + int i, m, a, b, cx, handle, npal; - long_integer lgt, lhandle; + long_int lgt, lhandle; str11 nom; - integer palh, k, j; - array<0, 15, integer> alllum; + int palh, k, j; + array<0, 15, int> alllum; a = caff; @@ -144,7 +144,7 @@ void taffich() { chardes(nom, lgt, handle); if (gd == her) { for (i = 0; i <= 15; i ++) { - palh = memw[0x7000 + (succ(integer, i) << 1)]; + palh = memw[0x7000 + (succ(int, i) << 1)]; alllum[i] = (palh & 15) + (((cardinal)palh >> 12) & 15) + (((cardinal)palh >> 8) & 15); } for (i = 0; i <= 15; i ++) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index bdc6b59eb7..d0edc2e8c8 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -15,101 +15,101 @@ 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 int seg_syst = 0x6fed; +const int segmou = 0x6f00; +const int segdon = 0x6c00; +const int adani = 0x7314; +const int adword = 0x4000; +const int adtroct = 0x406b; +const int adcfiec = 0x4300; +const int adbruit = 0x5cb0;/*2C00;*/ +const int adbruit1 = 0x6924;/*3874;*/ +const int adbruit2 = 0x6b30;/*3A80;*/ +const int adbruit3 = 0x6ba6;/*3AF6;*/ +const int adbruit5 = 0x3b50; +const int adson = 0x5cb0;/*2C00;*/ +const int adson2 = 0x60b0;/*3000;*/ +const int offsetb1 = 6; +const int offsetb2 = 4; +const int offsetb3 = 6; + +const int null = 255; + +const int tempo_mus = 71; +const int tempo_bruit = 78; +const int tempo_f = 80; +const int tempo_m = 89; + +const int ti1 = 410; +const int ti2 = 250; +const int maxti = 7975; +const int maxtd = 600; +const int max_rect = 14; + +const int ams = 0; +const int cga = 1; +const int ega = 2; +const int her = 3; +const int tan = 4; + +const int c_repon = 0; +const int c_st41 = 186; +const int c_tparler = 247; +const int c_paroles = 292; +const int c_tmlieu = 435; +const int c_dialpre = 456; +const int c_action = 476; +const int c_saction = 497; +const int c_dis = 502; +const int c_fin = 510; /* => n'existe pas ; si !! */ + +const int arega = 0; +const int asoul = 154; +const int aouvr = 282; +const int achai = 387; +const int acha = 492; +const int arcf = 1272; +const int arep = 1314; +const int amzon = 1650; +const int fleche = 1758; + +const int no_choice = 0; +const int invent = 1; +const int depla = 2; +const int action = 3; +const int saction = 4; +const int discut = 5; +const int fichier = 6; +const int sauve = 7; +const int charge = 8; + +const int attacher = 0x301; +const int attendre = 0x302; +const int defoncer = 0x303; +const int dormir = 0x304; +const int ecouter = 0x305; +const int entrer = 0x306; +const int fermer = 0x307; +const int fouiller = 0x308; +const int frapper = 0x309; +const int gratter = 0x30a; +const int lire = 0x30b; +const int manger = 0x30c; +const int mettre = 0x30d; +const int ouvrir = 0x30e; +const int prendre = 0x30f; +const int regarder = 0x310; +const int sentir = 0x311; +const int sonder = 0x312; +const int sortir = 0x313; +const int soulever = 0x314; +const int tourner = 0x315; + +const int scacher = 0x401; +const int sfouiller = 0x402; +const int slire = 0x403; +const int sposer = 0x404; +const int 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}}; @@ -165,7 +165,7 @@ const char recom[] = " Recommence "; const char f3[] = "F3: Encore"; const char f8[] = "F8: Suite"; -const integer max_patt = 20; +const int max_patt = 20; const array<0, 15, byte> rang @@ -177,29 +177,29 @@ const array<0, 15, byte> rang /*---------------------------------------------------------------------------*/ typedef varying_string<11> path_chars; -typedef real long_integer; +typedef real long_int; typedef varying_string<255> str255; typedef varying_string<125> str125; typedef varying_string<30> str30; typedef varying_string<11> str11; typedef file fichier_byte; struct sav_chaine { - integer conf; + int 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; + int mlieu, iboul, ibag, icave, ivier, ipuit; + int derobj, iloic, icryp; boolean ipre; char heure; }; struct registres { - integer ax, bx, cx, dx, bp, si, di, ds, es, flags; + int ax, bx, cx, dx, bp, si, di, ds, es, flags; }; typedef array<1, 1410, char> phrase; -typedef array<0, maxti, integer> tabint; +typedef array<0, maxti, int> tabint; struct ind { - integer indis; + int indis; byte point; }; typedef array<0, maxtd, ind> tabind; @@ -207,11 +207,11 @@ 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 array<0, 255, int> tablint; -typedef integer word1; +typedef int word1; struct chariot { - integer val, + int val, code, acc, freq, @@ -222,9 +222,9 @@ struct doublet { byte x, y; }; typedef array<1, 16, doublet> tabdb; -typedef array<0, 107, integer> tfxx; +typedef array<0, 107, int> tfxx; struct rectangle { - integer x1, x2, y1, y2; + int x1, x2, y1, y2; boolean etat; }; @@ -294,7 +294,7 @@ boolean blo, active_menu; -integer x, +int x, y, t, vj, @@ -353,9 +353,9 @@ integer x, ptr_word, color_txt; -array<0, 6400, integer> t_cph; +array<0, 6400, int> t_cph; array<0, 4000, byte> tabdon; -/* t_dxx : array[0..121] of integer;*/ +/* t_dxx : array[0..121] of int;*/ str125 stpou; /* donne le % d'indices */ byte is; char mode; @@ -365,12 +365,12 @@ str125 al_mess, ind_mess, al_mess2; -array<1, 8, integer> invt, +array<1, 8, int> invt, nbrep, nbrepm, disc; -array<0, 4, integer> msg; -array<1, 7, integer> depl; +array<0, 4, int> msg; +array<1, 7, int> depl; array<1, 8, varying_string<22> > inv; array<1, 7, varying_string<23> > dep; array<1, 21, varying_string<10> > act; @@ -385,7 +385,7 @@ matrix<1, 6, 0, 23, byte> lettres; array<0, 15, byte> palher; tabint t_mot; -integer tay_tchar; +int tay_tchar; tabind t_rec; file sauv_t; untyped_file fibyte; @@ -405,14 +405,14 @@ array<0, 14, pattern> tpt; /*-------------------- PROCEDURES ET FONCTIONS ------------------------*/ /*---------------------------------------------------------------------------*/ -/* procedure box(c,Gd,xo,yo,xi,yi,patt:integer); external 'c:\mc\boite.com'; */ +/* procedure box(c,Gd,xo,yo,xi,yi,patt:int); 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; + int i, j; switch (gd) { case cga : { @@ -470,13 +470,13 @@ void hirs() { } } -/* procedure affput(Chx,Gd,x,y,coul,char:integer); external 'c:\mc\divaf.com'; */ +/* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ -void affcar(integer gd, integer x, integer y, integer coul, integer char) { +void affcar(int gd, int x, int y, int coul, int 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) { +void putpix(int gd, int x, int y, int coul) { affput(0, gd, x, y, coul, 0); } -- cgit v1.2.3 From 321b86339fcad0b18f1c709692420b63bc4497ee Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 18:09:38 +0000 Subject: MORTEVIELLE: Register engine at engines.mk --- engines/engines.mk | 5 +++++ engines/mortevielle/module.mk | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/engines.mk b/engines/engines.mk index 9939506b86..ec5845df76 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -125,6 +125,11 @@ DEFINES += -DENABLE_RIVEN endif endif +ifdef ENABLE_MORTEVIELLE +DEFINES += -DENABLE_MORTEVIELLE=$(ENABLE_MORTEVIELLE) +MODULES += engines/mortevielle +endif + ifdef ENABLE_PARALLACTION DEFINES += -DENABLE_PARALLACTION=$(ENABLE_PARALLACTION) MODULES += engines/parallaction diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 6569d7038c..3213d15b49 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -1,5 +1,5 @@ MODULE := engines/mortevielle - + MODULE_OBJS := \ actions.o \ alert.o \ @@ -22,11 +22,11 @@ MODULE_OBJS := \ sprint.o \ taffich.o \ var_mor.o - + # This module can be built as a plugin ifeq ($(ENABLE_MORTEVIELLE), DYNAMIC_PLUGIN) PLUGIN := 1 endif - + # Include common rules include $(srcdir)/rules.mk -- cgit v1.2.3 From b36a336203e0f18278d72ded1974a0ddf911b783 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 18:18:34 +0000 Subject: MORTEVIELLE: real -> float --- engines/mortevielle/droite.cpp | 8 ++++---- engines/mortevielle/mor.cpp | 2 +- engines/mortevielle/ovd1.cpp | 6 +++--- engines/mortevielle/parole.cpp | 2 +- engines/mortevielle/parole2.cpp | 2 +- engines/mortevielle/var_mor.cpp | 14 +++++++------- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 0ad212dec1..20899ced8b 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -1,7 +1,7 @@ void droite(int x, int y, int xx, int yy, int coul) { int step, i; - real a, b; - real xr, yr, xro, yro; + float a, b; + float xr, yr, xro, yro; xr = x; yr = y; @@ -9,7 +9,7 @@ void droite(int x, int y, int xx, int yy, int coul) { 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); + a = (float)((x - xx)) / (y - yy); b = (yr * xro - yro * xr) / (y - yy); i = y; if (y > yy) step = -1; @@ -20,7 +20,7 @@ void droite(int x, int y, int xx, int yy, int coul) { } while (!(i == yy)); /*writeln(le_file,'X == ',a:3:3,' * Y + ',b:3:3);*/ } else { - a = (real)((y - yy)) / (x - xx); + a = (float)((y - yy)) / (x - xx); b = ((yro * xr) - (yr * xro)) / (x - xx); i = x; if (x > xx) step = -1; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index cee4e31b93..1ec2332edb 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -279,7 +279,7 @@ void paint_rect(int x, int y, int dx, int dy) { int hazard(int min, int max) { int ha1; - real ha2; + float ha2; /* debug('hazard'); */ int hazard_result; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index c2384273f2..8545fae233 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -171,7 +171,7 @@ void ani50() { { int cy, tay; phrase st; - real ix; + float ix; char ch; @@ -247,7 +247,7 @@ void ani50() { int k; boolean fin; char ch; - real x, y; + float x, y; /* debug('o3 music'); */ @@ -260,7 +260,7 @@ void ani50() { blockread(fic, mem[0x47a0 + 0], 123); close(fic); demus(0x3800, 0x5000, 623); - addfix = (real)((tempo_mus - addv[1])) / 256; + addfix = (float)((tempo_mus - addv[1])) / 256; cctable(tbi); fin = false; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 42a46e1209..03940f5235 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -68,7 +68,7 @@ void veracf(byte b) { /* overlay */ void cctable(tablint &t) { int k; - array<0, 256, real> tb; + array<0, 256, float> tb; tb[0] = 0; diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 02ec4fb908..eec9798ada 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -66,7 +66,7 @@ void parole(int rep, int ht, int typ) { tempo = tempo_bruit; } else if (haut > 5) tempo = tempo_f; else tempo = tempo_m; - addfix = (real)((tempo - addv[0])) / 256; + addfix = (float)((tempo - addv[0])) / 256; cctable(tbi); switch (typ) { case 1 : { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index d0edc2e8c8..ffd7dcb602 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -13,7 +13,7 @@ /*------------------------- CONSTANTES ----------------------------------*/ /*---------------------------------------------------------------------------*/ -const real freq0 = 1.19318e6; +const float freq0 = 1.19318e6; const int seg_syst = 0x6fed; const int segmou = 0x6f00; @@ -177,7 +177,7 @@ const array<0, 15, byte> rang /*---------------------------------------------------------------------------*/ typedef varying_string<11> path_chars; -typedef real long_int; +typedef float long_int; typedef varying_string<255> str255; typedef varying_string<125> str125; typedef varying_string<30> str30; @@ -206,7 +206,7 @@ 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, float> table; typedef array<0, 255, int> tablint; typedef int word1; @@ -393,7 +393,7 @@ tab_mlieu v_lieu; tfxx l; tablint tbi; chariot c1, c2, c3; -real addfix; +float addfix; pal_cga palsav; array<0, 90, tabdb> tabpal; pal_cga palcga; @@ -424,7 +424,7 @@ void hirs() { break; case ams : { hires; - inline_((real)(0xb8) / 6 / 0 / /* => mov ax,6 */ + inline_((float)(0xb8) / 6 / 0 / /* => mov ax,6 */ 0xcd / 0x10); /* => int 16 */ port[0x3d9] = 15; port[0x3df] = 0; @@ -433,7 +433,7 @@ void hirs() { } break; case ega : { - inline_((real)(0xb8) / 14 / 0 / /* MOV AX, 14 ; mode video 14 = 640*200 16 couleurs */ + inline_((float)(0xb8) / 14 / 0 / /* MOV AX, 14 ; mode video 14 = 640*200 16 couleurs */ 0xcd / 0x10); /* INT 16 */ res = 2; } @@ -445,7 +445,7 @@ void hirs() { port[0x3b4] = i; port[0x3b5] = herc[i]; } - inline_((real)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); + inline_((float)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); port[0x3b8] = 10; res = 2; } -- cgit v1.2.3 From fa3738db3249e13d472c1e974aa89c8d61e98ed7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 18:35:14 +0000 Subject: MORTEVIELLE: Transformed some array to C arrays --- engines/mortevielle/var_mor.cpp | 42 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index ffd7dcb602..0fb4eb0225 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -111,16 +111,11 @@ const int slire = 0x403; const int sposer = 0x404; const int 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 -= {{ +const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; +const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; +const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { 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, @@ -135,7 +130,6 @@ const array<0, 363, byte> tnocon 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 - } }; @@ -168,8 +162,7 @@ const char f8[] = "F8: Suite"; const int 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}}; +const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*---------------------------------------------------------------------------*/ @@ -185,9 +178,9 @@ typedef varying_string<11> str11; typedef file fichier_byte; struct sav_chaine { int conf; - array<0, 10, char> pourc; - array<0, 42, char> teauto; - array<0, 30, char> sjer; + char pourc[11]; + char teauto[43]; + char sjer[31]; int mlieu, iboul, ibag, icave, ivier, ipuit; int derobj, iloic, icryp; boolean ipre; @@ -197,7 +190,6 @@ struct registres { int ax, bx, cx, dx, bp, si, di, ds, es, flags; }; typedef array<1, 1410, char> phrase; -typedef array<0, maxti, int> tabint; struct ind { int indis; byte point; @@ -206,9 +198,6 @@ typedef array<0, maxtd, ind> tabind; typedef matrix<1, 7, 0, 24, byte> tab_mlieu; -typedef array<0, 255, float> table; -typedef array<0, 255, int> tablint; - typedef int word1; struct chariot { int val, @@ -222,7 +211,6 @@ struct doublet { byte x, y; }; typedef array<1, 16, doublet> tabdb; -typedef array<0, 107, int> tfxx; struct rectangle { int x1, x2, y1, y2; boolean etat; @@ -384,14 +372,14 @@ matrix<1, 6, 0, 23, byte> lettres; array<0, 15, byte> palher; -tabint t_mot; +int t_mot[maxti + 1]; int tay_tchar; tabind t_rec; file sauv_t; untyped_file fibyte; tab_mlieu v_lieu; -tfxx l; -tablint tbi; +int l[108]; +int tbi[256]; chariot c1, c2, c3; float addfix; pal_cga palsav; @@ -408,10 +396,8 @@ array<0, 14, pattern> tpt; /* procedure box(c,Gd,xo,yo,xi,yi,patt:int); 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}}; + const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; + const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; int i, j; switch (gd) { -- cgit v1.2.3 From cc3573bc018f1ef339365ff940072949bffb6996 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 18:38:38 +0000 Subject: MORTEVIELLE: str* -> Common::String --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/alert.cpp | 12 ++++++------ engines/mortevielle/menu.cpp | 4 ++-- engines/mortevielle/mor.cpp | 14 +++++++------- engines/mortevielle/mor2.cpp | 4 ++-- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/ques.cpp | 2 +- engines/mortevielle/sprint.cpp | 2 +- engines/mortevielle/taffich.cpp | 6 +++--- engines/mortevielle/var_mor.cpp | 10 ++-------- 10 files changed, 26 insertions(+), 32 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 83ad8d4f6b..bdb4827ee8 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -442,7 +442,7 @@ L2: int quel; boolean entre; phrase st; - str255 str_; + Common::String str_; int i, tay; if (s.derobj == 0) { diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index cec339e29a..f1c69efe64 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -1,4 +1,4 @@ -/* overlay */ int do_alert(str255 str_, int n); +/* overlay */ int do_alert(Common::String str_, int n); const int nligne = 7; @@ -10,7 +10,7 @@ const matrix<1, 2, 1, 3, int> coord -static void decod(str255 s, int &nbc, int &nbl, int &col, str255 &c, str30 &cs) { +static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { int i, k; boolean v; @@ -68,7 +68,7 @@ static void fait_boite(int lidep, int nli, int tx) { -static void fait_choix(str30 c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp) { +static void fait_choix(Common::String c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp) { int i, l, x; char ch; @@ -89,15 +89,15 @@ static void fait_choix(str30 c, int &coldep, int &nbcase, array<1, 2, varying_st } } -int do_alert(str255 str_, int n) { +int do_alert(Common::String str_, int n) { int coldep, esp, i, l, nbcase, quoi, ix; - str255 st, chaine; + Common::String st, chaine; matrix<1, 2, 1, 2, int> limit; char c, dumi; array<1, 2, varying_string<3> > s; int cx, cy, cd, nbcol, nblig; boolean touch, newaff, test, test1, test2, test3, dum; - str30 cas; + Common::String cas; /*debug('** do_alert **');*/ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9018414d28..cd72d7b87b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -1,8 +1,8 @@ /* NIVEAU 14*/ -/* overlay */ void menut(int no, str30 nom) { +/* overlay */ void menut(int no, Common::String nom) { byte h, l; - str30 s; + Common::String s; /* debug('menut'); */ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 1ec2332edb..f32ca9672e 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -174,7 +174,7 @@ void ecrf2() { /*boite(0,175,630,15,15);*/ } -void ecr2(str255 str_) { +void ecr2(Common::String str_) { int tab; int tlig; @@ -211,7 +211,7 @@ void clsf3() { show_mouse(); } -void ecr3(str255 text) { +void ecr3(Common::String text) { /* debug('ecr3 : '+text);*/ clsf3(); putxy(8, 192); @@ -324,7 +324,7 @@ void okpas() { void modobj(int m) { phrase str_; - str30 strp; + Common::String strp; int i, tay; /* debug('modobj'); */ @@ -339,7 +339,7 @@ void modobj(int m) { void modobj2(int m, boolean t1, boolean t2) { phrase str_; - str30 strp; + Common::String strp; int i, tay; /* debug('modobj'); */ @@ -356,7 +356,7 @@ void modobj2(int m, boolean t1, boolean t2) { void repon(int f, int m) { - str255 str_; + Common::String str_; varying_string<40> str1; phrase st; text1 fic; @@ -581,7 +581,7 @@ void person() { const char m2[] = "tes"; const char m3[] = "SEUL"; int cf; - str255 str_; + Common::String str_; /* debug('person'); */ for (cf = 1; cf <= 8; cf ++) menu_disable(disc[cf]); @@ -1184,7 +1184,7 @@ void phaz(int &haz, int &p, int cf) { person(); } -void writetp(str255 s, int t) { +void writetp(Common::String s, int t) { if (res == 2) writeg(s, t); else writeg(copy(s, 1, 25), t); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 48db49b6da..d4bb50b253 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -167,7 +167,7 @@ void tkey1(boolean d) { void tmlieu(int mli) { int cx, j, i, tail; - str30 nomp; + Common::String nomp; phrase st; @@ -312,7 +312,7 @@ void st1sama() { void modinv() { int cx, cy, tay, i, r; phrase nom; - str30 nomp; + Common::String nomp; cy = 0; for (cx = 1; cx <= 6; cx ++) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index ec7728745d..7c504232aa 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -1,4 +1,4 @@ -str255 delig; +Common::String delig; const array<0, 31, byte> tabdr = {{ 32, 101, 115, 97, 114, 105, 110, diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 6f7a05e0c7..b109340f96 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -16,7 +16,7 @@ phrase st; char key; mult_rect coor; - array<1, 14, str40> chaines; + array<1, 14, Common::String> chaines; int compte; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index bdb0a1b2fd..d0b1e7cf66 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -6,7 +6,7 @@ void clear_box(int x, int y, int dx) { box(0, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); } -void writeg(str255 l, int c) +void writeg(Common::String l, int c) { int i, x, xo, yo; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index d1e447de71..fad09df9f7 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -1,4 +1,4 @@ -void chardes(str11 nom, long_int passe, int long_) { +void chardes(Common::String nom, long_int passe, int long_) { int i, p, l; byte b; untyped_file f; @@ -28,7 +28,7 @@ void chardes(str11 nom, long_int passe, int long_) { /*$i+*/ } -void charani(str11 nom, long_int passe, int long_) { +void charani(Common::String nom, long_int passe, int long_) { int i, p, l; byte b; untyped_file f; @@ -70,7 +70,7 @@ void taffich() { int i, m, a, b, cx, handle, npal; long_int lgt, lhandle; - str11 nom; + Common::String nom; int palh, k, j; array<0, 15, int> alllum; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0fb4eb0225..fa897f515d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -169,12 +169,7 @@ const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ -typedef varying_string<11> path_chars; typedef float long_int; -typedef varying_string<255> str255; -typedef varying_string<125> str125; -typedef varying_string<30> str30; -typedef varying_string<11> str11; typedef file fichier_byte; struct sav_chaine { int conf; @@ -217,7 +212,6 @@ struct rectangle { }; typedef array<1, max_rect, rectangle> mult_rect; -typedef varying_string<40> str40; struct pattern { byte tay, tax; @@ -344,11 +338,11 @@ int x, array<0, 6400, int> t_cph; array<0, 4000, byte> tabdon; /* t_dxx : array[0..121] of int;*/ -str125 stpou; /* donne le % d'indices */ +Common::String stpou; /* donne le % d'indices */ byte is; char mode; fichier_byte ficdes; -str125 al_mess, +Common::String al_mess, err_mess, ind_mess, al_mess2; -- cgit v1.2.3 From 4edebbe11174e9cd82c9d4495aece84b65f0adcf Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2011 18:50:43 +0000 Subject: MORTEVIELLE: Converted more arrays into C style arrays --- engines/mortevielle/actions.cpp | 6 ++--- engines/mortevielle/outtext.cpp | 51 ++++++++++++++++++----------------------- engines/mortevielle/parole.cpp | 41 +-------------------------------- engines/mortevielle/parole2.cpp | 5 ++-- engines/mortevielle/prog.cpp | 8 +++---- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 28 +++++++++------------- 7 files changed, 43 insertions(+), 98 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index bdb4827ee8..712a1148f7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -2,9 +2,7 @@ const char stouinon[] = "[2][ ][OUI][NON]"; /* overlay */ -void taller() - -{ +void taller() { int mx, cx, cy; if ((s.mlieu == 26) && (msg[4] == depl[6])) { @@ -314,7 +312,7 @@ L2: } /* overlay */ void tfouiller() { - const array<0, 13, byte> r = {{123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}}; + const byte[14] r = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; int cx; if (caff > 99) { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 7c504232aa..4975185c37 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -1,45 +1,38 @@ Common::String 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 byte tabdr[32] = { + 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 byte tab30[32] = { + 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 - } +const byte tab31[32]= { + 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(int num , phrase &l , int &tl); static void cinq_huit(char &c, int &ind, byte &pt, boolean &the_end) { - const array<0, 31, char> rap - = {{ ',', ':', '@', '!', '?', '-', '‡', - ' ', '…', '', '‚', 'Š', '', '/', - '‹', 'Ś', '˘', '\47', '“', '"', '—', - '–', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9' - } + const unsigned char rap[32] = { + ',', ':', '@', '!', '?', '-', '\207', + '\240', '\205', '\203', '\202', '\212', '\210', '/', + '\213', '\214', '\242', '\047', '\223', '"', '\227', + '\226', '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9' }; int oct, ocd; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 03940f5235..082b53ec7b 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -68,7 +68,7 @@ void veracf(byte b) { /* overlay */ void cctable(tablint &t) { int k; - array<0, 256, float> tb; + float tb[257]; tb[0] = 0; @@ -383,42 +383,3 @@ void veracf(byte b) { break; } /* case c2.code */ } - -/*overlay function testprot : boolean; -var - regs : registres; - buffer : array[0..511] of char; - i,j,k : int; - st : phrase; - tay : int; - 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.cpp b/engines/mortevielle/parole2.cpp index eec9798ada..1b894ff6e6 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -19,8 +19,7 @@ void init_chariot() { void trait_ph() { - const array<0, 2, int> deca - = {{300, 30, 40}}; + const int deca[3] = {300, 30, 40}; ptr_tcph = pred(int, num_ph); ledeb = swap(t_cph[ptr_tcph]) + deca[typlec]; @@ -52,7 +51,7 @@ void trait_ph() { void parole(int rep, int ht, int typ) { - array<0, 500, int> savph; + int savph[501]; int i; int tempo; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 62dc99f479..fd909a3164 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -22,10 +22,10 @@ /* overlay */ void antegame() { int cx; registres regs; - array<0, 511, char> buffer; + char buffer[512]; int i, j, k; - array<0, 2, boolean> test; - array<0, 7, char> g; + boolean test[3]; + char g[8]; hide_mouse(); @@ -36,7 +36,7 @@ okdes = true; test[0] = false; test[1] = false; - g[0] = '\40'; + g[0] = '\040'; col = false; tesok = true; test[2] = false; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index fad09df9f7..058af875d7 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -72,7 +72,7 @@ void taffich() { long_int lgt, lhandle; Common::String nom; int palh, k, j; - array<0, 15, int> alllum; + int alllum[16]; a = caff; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index fa897f515d..e245781736 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -151,8 +151,7 @@ const array<1, 2, varying_string<11> > fic } }; -const array<0, 1, byte> addv -= {{8, 8}}; +const byte addv[2] = {8, 8}; const char recom[] = " Recommence "; @@ -221,19 +220,14 @@ struct pattern { struct nhom { byte n; /* numero entre 0 et 32 */ - array<0, 3, byte> hom; + byte hom[4]; }; -typedef array<0, 15, nhom> t_nhom; - struct t_pcga { byte p; - t_nhom a; + nhom a[16]; }; -typedef array<0, 90, t_pcga> pal_cga; - - /*---------------------------------------------------------------------------*/ /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -335,8 +329,8 @@ int x, ptr_word, color_txt; -array<0, 6400, int> t_cph; -array<0, 4000, byte> tabdon; +int t_cph[6401]; +byte tabdon[4001]; /* t_dxx : array[0..121] of int;*/ Common::String stpou; /* donne le % d'indices */ byte is; @@ -351,7 +345,7 @@ array<1, 8, int> invt, nbrep, nbrepm, disc; -array<0, 4, int> msg; +int msg[5]; array<1, 7, int> depl; array<1, 8, varying_string<22> > inv; array<1, 7, varying_string<23> > dep; @@ -360,11 +354,11 @@ 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; +byte bufcha[391]; matrix<1, 6, 0, 23, byte> lettres; -array<0, 15, byte> palher; +byte palher[16]; int t_mot[maxti + 1]; int tay_tchar; @@ -376,10 +370,10 @@ int l[108]; int tbi[256]; chariot c1, c2, c3; float addfix; -pal_cga palsav; +t_pcga palsav[91]; array<0, 90, tabdb> tabpal; -pal_cga palcga; -array<0, 14, pattern> tpt; +t_pcga palcga[91]; +pattern tpt[15]; -- cgit v1.2.3 From 1c441062a05c9ff256100179a746a84baa153c88 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 21:30:46 +0100 Subject: MORTEVIELLE: Add namespace and standard header --- engines/mortevielle/actions.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/alert.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/boite.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/disk.cpp | 32 +++++++++++++++++++++++++++++--- engines/mortevielle/droite.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/keyboard.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/level15.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/menu.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/mor.cpp | 32 ++++++++++++++++++++++++++++++-- engines/mortevielle/mor2.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/mort.cpp | 30 +++++++++++++++++++++++++++++- engines/mortevielle/mouse.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/outtext.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/ovd1.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/parole.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/parole2.cpp | 32 ++++++++++++++++++++++++++++++-- engines/mortevielle/prog.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/ques.cpp | 30 ++++++++++++++++++++++++++++++ engines/mortevielle/sprint.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/taffich.cpp | 31 +++++++++++++++++++++++++++++++ engines/mortevielle/var_mor.cpp | 30 ++++++++++++++++++++++++++++++ 21 files changed, 638 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 712a1148f7..e03a7a1627 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + /* NIVEAU 4 */ const char stouinon[] = "[2][ ][OUI][NON]"; @@ -1189,3 +1218,5 @@ L2: quel = do_alert(stouinon, 1); arret = (quel != 1); } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index f1c69efe64..8372c2f9e3 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + /* overlay */ int do_alert(Common::String str_, int n); @@ -195,3 +224,5 @@ int do_alert(Common::String str_, int n) { do_alert_result = quoi; return do_alert_result; } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index d1ebe4da38..20deae4950 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void boite(int x, int y, int dx, int dy, int coul) { int i; int xi, yi, xo, yo; @@ -27,3 +56,5 @@ void boite(int x, int y, int dx, int dy, int coul) { } show_mouse(); } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 0e458a5033..e81e905d25 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -1,3 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { void dem1() { untyped_file f; @@ -69,6 +97,4 @@ void sv_game(int n) { show_mouse(); } - - - +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 20899ced8b..fcdfaeddfe 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void droite(int x, int y, int xx, int yy, int coul) { int step, i; float a, b; @@ -32,3 +61,5 @@ void droite(int x, int y, int xx, int yy, int coul) { /*writeln(le_file,'Y == ',a:3:3,' * X + ',b:3:3);*/ } } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 199d43862f..f1d514bc68 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + char readkey1() { char c; @@ -58,3 +87,4 @@ void teskbd() { if (keypressed()) dum = testou(); } +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 35de7f439f..ce41c37f5c 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -1,3 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { /* NIVEAU 15 */ void copcha() { @@ -173,3 +201,5 @@ begin Tan : afftan(offs,dep,x,y); end; end;*/ + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index cd72d7b87b..655e635d6f 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + /* NIVEAU 14*/ /* overlay */ void menut(int no, Common::String nom) { @@ -332,3 +361,4 @@ void mdn() { } } +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index f32ca9672e..4129b24233 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + /* Niveau 14 suite */ const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; @@ -1307,5 +1336,4 @@ void dessin(int ad) { } } - - +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index d4bb50b253..cff21a5c10 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + const array<1, 11, int> men = {{ scacher, attacher, defoncer, dormir, @@ -726,3 +755,5 @@ void aldepl() { dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index c9e1d25d7e..5ed621f6b8 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -1,6 +1,33 @@ -#include "ptoc.h" +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "ptoc.h" +namespace MORTEVIELLE { /*$v-*/ /*$k-*/ @@ -121,3 +148,4 @@ int main(int argc, const char *argv[]) { return EXIT_SUCCESS; } +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 9ce1788b2c..a2102b6146 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + const int m_arrow = 0; const int m_point_hand = 1; @@ -457,3 +486,5 @@ void mov_mouse(boolean &funct, char &key) { p_key = keypressed(); } } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4975185c37..b2ef115704 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + Common::String delig; const byte tabdr[32] = { 32, 101, 115, 97, 114, 105, 110, @@ -197,3 +226,5 @@ void afftex(phrase ch, int x, int y, int dx, int dy, int typ) { } /* case */ } } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 8545fae233..f8c7bafb9c 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void dem2() { untyped_file f; int k; @@ -335,3 +364,5 @@ void ani50() { writeg(cpr, 0); } } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 082b53ec7b..63ede52cb2 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -1,3 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { void spfrac(int wor) { c3.rep = (cardinal)wor >> 12; @@ -383,3 +411,5 @@ void veracf(byte b) { break; } /* case c2.code */ } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 1b894ff6e6..c7516d17aa 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void rot_chariot() { c1 = c2; c2 = c3; @@ -90,5 +119,4 @@ void parole(int rep, int ht, int typ) { writepal(numpal); } - - +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index fd909a3164..b08be5cd3d 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + /* overlay */ void change_gd(int ngd) { int i; @@ -317,3 +346,4 @@ void tjouer() { else if (perdu) tencore(); } +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index b109340f96..40a6e87c57 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -1,3 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { /* overlay */ boolean ques() { const array<1, 10, int> ta @@ -111,3 +139,5 @@ ques_result = (compte == 10) && q; return ques_result; } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index d0b1e7cf66..2723d913ea 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void fill_box(int x, int y, int dx) { box(15, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); } @@ -52,3 +81,5 @@ void writeg(Common::String l, int c) } show_mouse(); } + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 058af875d7..8e4562e499 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -1,3 +1,32 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { + void chardes(Common::String nom, long_int passe, int long_) { int i, p, l; byte b; @@ -194,3 +223,5 @@ void taffich() { Alllum[k]:=-1; end; end;*/ + +} // End of namespace MORTEVIELLE diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index e245781736..027dfb2d68 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -1,3 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +namespace MORTEVIELLE { /* Constantes, Types et Variables pour le @@ -454,3 +482,5 @@ void affcar(int gd, int x, int y, int coul, int char) { void putpix(int gd, int x, int y, int coul) { affput(0, gd, x, y, coul, 0); } + +} // End of namespace MORTEVIELLE -- cgit v1.2.3 From 674e35d14ad27c5f6b9043a2d2256181b4e98f46 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 21:42:55 +0100 Subject: MORTEVIELLE: Add an an include for string, move boolean to bool --- engines/mortevielle/alert.cpp | 4 +++- engines/mortevielle/menu.cpp | 2 ++ engines/mortevielle/mor.cpp | 2 ++ engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/ques.cpp | 2 ++ engines/mortevielle/sprint.cpp | 4 +++- engines/mortevielle/taffich.cpp | 2 ++ engines/mortevielle/var_mor.cpp | 2 ++ 10 files changed, 19 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 8372c2f9e3..43ea6c09fb 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { /* overlay */ int do_alert(Common::String str_, int n); @@ -41,7 +43,7 @@ const matrix<1, 2, 1, 3, int> coord static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { int i, k; - boolean v; + bool v; val(s[2], nbc, i); c = ""; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 655e635d6f..54d8804d63 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { /* NIVEAU 14*/ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4129b24233..ba99ffc16c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { /* Niveau 14 suite */ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index cff21a5c10..bc14b61f27 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -45,7 +45,7 @@ void tinke() { const char d6[] = "OK"; int cx, cy, haz, nh, cf, j, h, m, cd; varying_string<3> stpo; - boolean am; + bool am; anyone = false; calch(j, h, m); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index b2ef115704..ec7fabd3da 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -114,7 +114,7 @@ void deline(int num , phrase &l , int &tl) { int i, j, ts; char let; byte ps, k; - boolean the_end; + bool the_end; /* DETEX */ /*debug(' => DeLine');*/ diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index b08be5cd3d..baf5883d81 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -53,7 +53,7 @@ namespace MORTEVIELLE { registres regs; char buffer[512]; int i, j, k; - boolean test[3]; + bool test[3]; char g[8]; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 40a6e87c57..86567f5209 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { /* overlay */ boolean ques() { diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 2723d913ea..03e6040b59 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { void fill_box(int x, int y, int dx) { @@ -40,7 +42,7 @@ void writeg(Common::String l, int c) { int i, x, xo, yo; int cecr; - boolean t; + bool t; /* debug('writeg : '+l);*/ diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 8e4562e499..d6fcdfd470 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { void chardes(Common::String nom, long_int passe, int long_) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 027dfb2d68..b4c17e651a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" + namespace MORTEVIELLE { /* Constantes, Types et Variables pour le -- cgit v1.2.3 From 7571d4e1868dc0cb867b9fe2d7f10a386b0820fe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 22:08:18 +0100 Subject: MORTEVIELLE: rename namespace --- engines/mortevielle/actions.cpp | 4 ++-- engines/mortevielle/alert.cpp | 4 ++-- engines/mortevielle/boite.cpp | 4 ++-- engines/mortevielle/disk.cpp | 4 ++-- engines/mortevielle/droite.cpp | 4 ++-- engines/mortevielle/keyboard.cpp | 4 ++-- engines/mortevielle/level15.cpp | 4 ++-- engines/mortevielle/menu.cpp | 4 ++-- engines/mortevielle/mor.cpp | 4 ++-- engines/mortevielle/mor2.cpp | 4 ++-- engines/mortevielle/mort.cpp | 4 ++-- engines/mortevielle/mouse.cpp | 4 ++-- engines/mortevielle/outtext.cpp | 4 ++-- engines/mortevielle/ovd1.cpp | 4 ++-- engines/mortevielle/parole.cpp | 4 ++-- engines/mortevielle/parole2.cpp | 4 ++-- engines/mortevielle/prog.cpp | 4 ++-- engines/mortevielle/ques.cpp | 4 ++-- engines/mortevielle/sprint.cpp | 4 ++-- engines/mortevielle/taffich.cpp | 4 ++-- engines/mortevielle/var_mor.cpp | 4 ++-- 21 files changed, 42 insertions(+), 42 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index e03a7a1627..6ad0cc0401 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { /* NIVEAU 4 */ const char stouinon[] = "[2][ ][OUI][NON]"; @@ -1219,4 +1219,4 @@ L2: arret = (quel != 1); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 43ea6c09fb..345867ff0d 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { /* overlay */ int do_alert(Common::String str_, int n); @@ -227,4 +227,4 @@ int do_alert(Common::String str_, int n) { return do_alert_result; } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 20deae4950..cc3230db4f 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void boite(int x, int y, int dx, int dy, int coul) { int i; @@ -57,4 +57,4 @@ void boite(int x, int y, int dx, int dy, int coul) { show_mouse(); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index e81e905d25..a88f63a1ce 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void dem1() { untyped_file f; @@ -97,4 +97,4 @@ void sv_game(int n) { show_mouse(); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index fcdfaeddfe..312ed69c1a 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void droite(int x, int y, int xx, int yy, int coul) { int step, i; @@ -62,4 +62,4 @@ void droite(int x, int y, int xx, int yy, int coul) { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index f1d514bc68..20fb38c870 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { char readkey1() { char c; @@ -87,4 +87,4 @@ void teskbd() { if (keypressed()) dum = testou(); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index ce41c37f5c..2da371b3c7 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { /* NIVEAU 15 */ void copcha() { @@ -202,4 +202,4 @@ begin end; end;*/ -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 54d8804d63..97b0cfcb71 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { /* NIVEAU 14*/ @@ -363,4 +363,4 @@ void mdn() { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ba99ffc16c..a0aad53cf1 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { /* Niveau 14 suite */ const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; @@ -1338,4 +1338,4 @@ void dessin(int ad) { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index bc14b61f27..94fcfde07e 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { const array<1, 11, int> men = {{ @@ -756,4 +756,4 @@ void aldepl() { dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 5ed621f6b8..928804b46e 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -27,7 +27,7 @@ #include "ptoc.h" -namespace MORTEVIELLE { +namespace Mortevielle { /*$v-*/ /*$k-*/ @@ -148,4 +148,4 @@ int main(int argc, const char *argv[]) { return EXIT_SUCCESS; } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index a2102b6146..6f4eaa2f4b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { const int m_arrow = 0; const int m_point_hand = 1; @@ -487,4 +487,4 @@ void mov_mouse(boolean &funct, char &key) { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index ec7fabd3da..047421941f 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { Common::String delig; const byte tabdr[32] = { @@ -227,4 +227,4 @@ void afftex(phrase ch, int x, int y, int dx, int dy, int typ) { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index f8c7bafb9c..608b429848 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void dem2() { untyped_file f; @@ -365,4 +365,4 @@ void ani50() { } } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 63ede52cb2..bfa36b06f3 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void spfrac(int wor) { c3.rep = (cardinal)wor >> 12; @@ -412,4 +412,4 @@ void veracf(byte b) { } /* case c2.code */ } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index c7516d17aa..90e9495477 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { void rot_chariot() { c1 = c2; @@ -119,4 +119,4 @@ void parole(int rep, int ht, int typ) { writepal(numpal); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index baf5883d81..43448691f3 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -25,7 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ -namespace MORTEVIELLE { +namespace Mortevielle { /* overlay */ void change_gd(int ngd) { int i; @@ -346,4 +346,4 @@ void tjouer() { else if (perdu) tencore(); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 86567f5209..583221c252 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { /* overlay */ boolean ques() { const array<1, 10, int> ta @@ -142,4 +142,4 @@ namespace MORTEVIELLE { return ques_result; } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 03e6040b59..a72ef12c16 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { void fill_box(int x, int y, int dx) { box(15, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); @@ -84,4 +84,4 @@ void writeg(Common::String l, int c) show_mouse(); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index d6fcdfd470..eab78c8f4c 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { void chardes(Common::String nom, long_int passe, int long_) { int i, p, l; @@ -226,4 +226,4 @@ void taffich() { end; end;*/ -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index b4c17e651a..25a8c59acc 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -27,7 +27,7 @@ #include "common/str.h" -namespace MORTEVIELLE { +namespace Mortevielle { /* Constantes, Types et Variables pour le @@ -485,4 +485,4 @@ void putpix(int gd, int x, int y, int coul) { affput(0, gd, x, y, coul, 0); } -} // End of namespace MORTEVIELLE +} // End of namespace Mortevielle -- cgit v1.2.3 From 911d136f9f5fb8d4b7eb1fa5d125a48e4af84e39 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 23:36:52 +0100 Subject: MORTEVIELLE: Add header files --- engines/mortevielle/actions.h | 68 ++++++++++++++++++++++ engines/mortevielle/alert.h | 41 ++++++++++++++ engines/mortevielle/boite.h | 36 ++++++++++++ engines/mortevielle/disk.h | 39 +++++++++++++ engines/mortevielle/droite.h | 36 ++++++++++++ engines/mortevielle/keyboard.h | 38 +++++++++++++ engines/mortevielle/level15.h | 52 +++++++++++++++++ engines/mortevielle/menu.h | 47 ++++++++++++++++ engines/mortevielle/mor.h | 125 +++++++++++++++++++++++++++++++++++++++++ engines/mortevielle/mor2.h | 81 ++++++++++++++++++++++++++ engines/mortevielle/mort.h | 38 +++++++++++++ engines/mortevielle/mouse.h | 43 ++++++++++++++ engines/mortevielle/outtext.h | 39 +++++++++++++ engines/mortevielle/ovd1.h | 49 ++++++++++++++++ engines/mortevielle/parole.h | 45 +++++++++++++++ engines/mortevielle/parole2.h | 40 +++++++++++++ engines/mortevielle/prog.h | 47 ++++++++++++++++ engines/mortevielle/ques.h | 38 +++++++++++++ engines/mortevielle/sprint.h | 39 +++++++++++++ engines/mortevielle/taffich.h | 40 +++++++++++++ engines/mortevielle/var_mor.h | 43 ++++++++++++++ 21 files changed, 1024 insertions(+) create mode 100644 engines/mortevielle/actions.h create mode 100644 engines/mortevielle/alert.h create mode 100644 engines/mortevielle/boite.h create mode 100644 engines/mortevielle/disk.h create mode 100644 engines/mortevielle/droite.h create mode 100644 engines/mortevielle/keyboard.h create mode 100644 engines/mortevielle/level15.h create mode 100644 engines/mortevielle/menu.h create mode 100644 engines/mortevielle/mor.h create mode 100644 engines/mortevielle/mor2.h create mode 100644 engines/mortevielle/mort.h create mode 100644 engines/mortevielle/mouse.h create mode 100644 engines/mortevielle/outtext.h create mode 100644 engines/mortevielle/ovd1.h create mode 100644 engines/mortevielle/parole.h create mode 100644 engines/mortevielle/parole2.h create mode 100644 engines/mortevielle/prog.h create mode 100644 engines/mortevielle/ques.h create mode 100644 engines/mortevielle/sprint.h create mode 100644 engines/mortevielle/taffich.h create mode 100644 engines/mortevielle/var_mor.h diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h new file mode 100644 index 0000000000..690de1d80e --- /dev/null +++ b/engines/mortevielle/actions.h @@ -0,0 +1,68 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_ACTIONS_H +#define MORTEVIELLE_ACTIONS_H + +namespace Mortevielle { + +/* NIVEAU 4 */ +void taller(); +void tprendre(); +void tsprendre(); +void tsoulever(); +void tlire(); +void tslire(); +void tregarder(); +void tsregarder(); +void tfouiller(); +void tsfouiller(); +void touvrir(); +void tmettre(); +void ttourner(); +void tcacher(); +void tattacher(); +void tfermer(); +void tfrapper(); +void tposer(); +void tecouter(); +void tmanger(); +void tentrer(); +void tdormir(); +void tdefoncer(); +void tsortir(); +void tattendre(); +void tsonder(); +void tparler(); +void tsentir(); +void tgratter(); +/* NIVEAU 2 */ +void tmaj1(); +void tencore(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h new file mode 100644 index 0000000000..23351318a5 --- /dev/null +++ b/engines/mortevielle/alert.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_ALERT_H +#define MORTEVIELLE_ALERT_H + +namespace Mortevielle { + +int do_alert(Common::String str_, int n); +void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); +static void posit(int ji, int &coldep, int &esp); +static void fait_boite(int lidep, int nli, int tx); +static void fait_choix(Common::String c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp); +int do_alert(Common::String str_, int n); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/boite.h b/engines/mortevielle/boite.h new file mode 100644 index 0000000000..d0e7b0e2e3 --- /dev/null +++ b/engines/mortevielle/boite.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_BOITE_H +#define MORTEVIELLE_BOITE_H + +namespace Mortevielle { + +void boite(int x, int y, int dx, int dy, int coul); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/disk.h b/engines/mortevielle/disk.h new file mode 100644 index 0000000000..464c3b7e1a --- /dev/null +++ b/engines/mortevielle/disk.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_DISK_H +#define MORTEVIELLE_DISK_H + +namespace Mortevielle { + +void dem1(); +void takesav(int n); +void ld_game(int n); +void sv_game(int n); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/droite.h b/engines/mortevielle/droite.h new file mode 100644 index 0000000000..73ed30d1ad --- /dev/null +++ b/engines/mortevielle/droite.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_DROITE_H +#define MORTEVIELLE_DROITE_H + +namespace Mortevielle { + +void droite(int x, int y, int xx, int yy, int coul); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/keyboard.h b/engines/mortevielle/keyboard.h new file mode 100644 index 0000000000..fbef23feb0 --- /dev/null +++ b/engines/mortevielle/keyboard.h @@ -0,0 +1,38 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_KEYBOARD_H +#define MORTEVIELLE_KEYBOARD_H + +namespace Mortevielle { + +char readkey1(); +int testou(); +void teskbd(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h new file mode 100644 index 0000000000..73a9d3f32b --- /dev/null +++ b/engines/mortevielle/level15.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_LEVEL15_H +#define MORTEVIELLE_LEVEL15_H + +namespace Mortevielle { + +/* NIVEAU 15 */ +void copcha(); +bool dans_rect(rectangle r); +void outbloc(int n, pattern p, t_nhom pal); +void writepal(int n); +void pictout(int seg, int dep, int x, int y); +void putxy(int x, int y); +// int calad(int x, int y); +void sauvecr(int y, int dy); +void charecr(int y, int dy); +// int peek(int ad); +// int peekw(int ad); +// real peekl(int ad); +// void procedure poke(int ad, int n); +void adzon(); +int animof(int ouf, int num); +// void affgd(int offs, int dep, int x, int y); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h new file mode 100644 index 0000000000..451e96718c --- /dev/null +++ b/engines/mortevielle/menu.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_MENU_H +#define MORTEVIELLE_MENU_H + +namespace Mortevielle { + +/* NIVEAU 14*/ +void menut(int no, Common::String nom); +void menu_disable(int no); +void menu_enable(int no); +void menu_aff(); +void draw_menu(); +void invers(int ix); +void util(int x, int y); +void menu_down(int ii); +void menu_up(int xx); +void erase_menu(); +void mdn(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h new file mode 100644 index 0000000000..1211d215ae --- /dev/null +++ b/engines/mortevielle/mor.h @@ -0,0 +1,125 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_MOR_H +#define MORTEVIELLE_MOR_H + +namespace Mortevielle { + +/* Niveau 14 suite */ +void testfi(); +int readclock(); +void modif(int &nu); +void dessine(int ad, int x, int y); +void dessine_rouleau(); +void text_color(int c); +/* NIVEAU 13 */ +void text1(int x, int y, int nb, int m); +void initouv(); +void ecrf1(); +void clsf1(); +void clsf2(); +void ecrf2(); +void ecr2(Common::String str_); +void clsf3(); +void ecr3(Common::String text); +void ecrf6(); +void ecrf7(); +void clsf10(); +void stop(); +void paint_rect(int x, int y, int dx, int dy); +int hazard(int min, int max); +void calch(int &j, int &h, int &m); +void conv(int x, int &y); +/* NIVEAU 12 */ +void okpas(); +void modobj(int m); +void modobj2(int m, boolean t1, boolean t2); +void repon(int f, int m); +void f3f8(); +void t5(int cx); +void affper(int per); +void choix(int min, int max, int &per); +void cpl1(int &p); +void cpl2(int &p); +void cpl3(int &p); +void cpl5(int &p); +void cpl6(int &p); +void person(); +void chlm(int &per); +void pendule(); +/************* + * NIVEAU 11 * + *************/ +void debloc(int l); +void cpl10(int &p, int &h); +void cpl11(int &p, int &h); +void cpl12(int &p); +void cpl13(int &p); +void cpl15(int &p); +void cpl20(int &p, int &h); +void quelq1(int l); +void quelq2(); +void quelq5(); +void quelq6(int l); +void quelq10(int h, int &per); +void quelq11(int h, int &per); +void quelq12(int &per); +void quelq15(int &per); +void quelq20(int h, int &per); +void frap(); +void nouvp(int l, int &p); +void tip(int ip, int &cx); +void ecfren(int &p, int &haz, int cf, int l); +void becfren(int l); +/* NIVEAU 10 */ +void init_nbrepm(); +void phaz(int &haz, int &p, int cf); +void inzon(); +void dprog(); +void pl1(int cf); +void pl2(int cf); +void pl5(int cf); +void pl6(int cf); +void pl9(int cf); +void pl10(int cf); +void pl11(int cf); +void pl12(int cf); +void pl13(int cf); +void pl15(int cf); +void pl20(int cf); +void t11(int l11, int &a); +void cavegre(); +void writetp(Common::String s, int t); +void messint(int nu); +void aniof(int ouf, int num); +void musique(int so); +/* NIVEAU 9 */ +void dessin(int ad); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h new file mode 100644 index 0000000000..bad43320c5 --- /dev/null +++ b/engines/mortevielle/mor2.h @@ -0,0 +1,81 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_MOR2_H +#define MORTEVIELLE_MOR2_H + +namespace Mortevielle { + +void tinke(); +void fenat(char ans); +/* NIVEAU 8 */ +void afdes(int ad); +void tkey1(bool d); +void tmlieu(int mli); +/* NIVEAU 7 */ +void tlu(int af, int ob); +void delin(int n); +void affrep(); +void mfouen() +void atf3f8(int &key); +/* NIVEAU 6 */ +void tperd(); +void tsort(); +void st4(int ob); +void cherjer(int ob, boolean &d); +void st1sama(); +void modinv(); +void sparl(long_int adr, long_int rep); +void finfouil(); +void mfoudi(); +void mennor(); +void premtet(); +/* NIVEAU 5 */ +void ajchai(); +void ajjer(int ob); +void t1sama(); +void t1vier(); +void t1neig(); +void t1deva(); +void t1derr(); +void t1deau(); +void tctrm(); +void quelquun(); +void tsuiv(); +void tfleche(); +void tcoord(int sx); +void st7(int ob); +void treg(int ob); +void avpoing(int &ob); +void rechai(int &ch); +void t23coul(int &l); +void maivid(); +void st13(int ob); +void aldepl(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/mort.h b/engines/mortevielle/mort.h new file mode 100644 index 0000000000..0b78deb028 --- /dev/null +++ b/engines/mortevielle/mort.h @@ -0,0 +1,38 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_MORT_H +#define MORTEVIELLE_MORT_H + +namespace Mortevielle { + +void divers(int np, bool b); +/* NIVEAU 0 */ +int main(int argc, const char *argv[]); +} // End of namespace Mortevielle + +#endif diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h new file mode 100644 index 0000000000..62fdf1bfe4 --- /dev/null +++ b/engines/mortevielle/mouse.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_MOUSE_H +#define MORTEVIELLE_MOUSE_H + +namespace Mortevielle { + +void init_mouse(); +//void change_mouse(int t); +//void dessine_souris(int xf, int yf); +void hide_mouse(); +void show_mouse(); +void pos_mouse(int x, int y); +void read_pos_mouse(int &x, int &y, int &c); +void mov_mouse(boolean &funct, char &key); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h new file mode 100644 index 0000000000..fcf4822ab5 --- /dev/null +++ b/engines/mortevielle/outtext.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_OUTTEXT_H +#define MORTEVIELLE_OUTTEXT_H + +namespace Mortevielle { + +static void cinq_huit(char &c, int &ind, byte &pt, boolean &the_end); +void deline(int num , phrase &l , int &tl); +static int l_motsuiv(int p, phrase &ch, int &tab); +void afftex(phrase ch, int x, int y, int dx, int dy, int typ); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h new file mode 100644 index 0000000000..339ee69f9f --- /dev/null +++ b/engines/mortevielle/ovd1.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_OVD1_H +#define MORTEVIELLE_OVD1_H + +namespace Mortevielle { + +void dem2(); +void ani50(); +//void apzuul(); +void aff50(boolean c); +void init_menu(); +void charpal(); +void chartex(); +void dialpre(); +void init_lieu(); +void music(); +void charge_bruit5(); +void charge_cfiec(); +void charge_cfiph(); +void suite(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h new file mode 100644 index 0000000000..b0282e15bd --- /dev/null +++ b/engines/mortevielle/parole.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_PAROLE_H +#define MORTEVIELLE_PAROLE_H + +namespace Mortevielle { + +void spfrac(int wor); +void charg_car(); +void entroct(byte o); +void veracf(byte b); +void cctable(tablint &t); +void regenbruit(); +void charge_son(); +void charge_phbruit(); +void charge_bruit(); +void trait_car(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h new file mode 100644 index 0000000000..ed7108f3b8 --- /dev/null +++ b/engines/mortevielle/parole2.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_PAROLE2_H +#define MORTEVIELLE_PAROLE2_H + +namespace Mortevielle { + +void rot_chariot(); +void init_chariot(); +void trait_ph(); +void parole(int rep, int ht, int typ); + +} // End of namespace Mortevielle + +#endif diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h new file mode 100644 index 0000000000..4fccca4f65 --- /dev/null +++ b/engines/mortevielle/prog.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_PROG_H +#define MORTEVIELLE_PROG_H + +namespace Mortevielle { + +void change_gd(int ngd); +void antegame(); + +/* NIVEAU 3 */ +/* procedure PROGRAMME */ +void tmaj3(); +void tsitu(); +void tecran(); + +/* NIVEAU 1 */ +void theure(); +void tjouer(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/ques.h b/engines/mortevielle/ques.h new file mode 100644 index 0000000000..f748d3e0b5 --- /dev/null +++ b/engines/mortevielle/ques.h @@ -0,0 +1,38 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_QUES_H +#define MORTEVIELLE_QUES_H + +#include "common/str.h" + +namespace Mortevielle { + +bool ques(); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h new file mode 100644 index 0000000000..42259f0593 --- /dev/null +++ b/engines/mortevielle/sprint.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_SPRINT_H +#define MORTEVIELLE_SPRINT_H + +#include "common/str.h" + +namespace Mortevielle { + +void fill_box(int x, int y, int dx); +void clear_box(int x, int y, int dx); +void writeg(Common::String l, int c); +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h new file mode 100644 index 0000000000..ccc64bf2c5 --- /dev/null +++ b/engines/mortevielle/taffich.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_TAFFICH_H +#define MORTEVIELLE_TAFFICH_H + +#include "common/str.h" + +namespace Mortevielle { + +void chardes(Common::String nom, long_int passe, int long_); +void charani(Common::String nom, long_int passe, int long_); +void taffich(); +} // End of namespace Mortevielle + +#endif \ No newline at end of file diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h new file mode 100644 index 0000000000..86bb296ee2 --- /dev/null +++ b/engines/mortevielle/var_mor.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_VAR_H +#define MORTEVIELLE_VAR_H + +namespace Mortevielle { + +/*---------------------------------------------------------------------------*/ +/*------------------- PROCEDURES AND FONCTIONS ------------------------*/ +/*---------------------------------------------------------------------------*/ + +void hirs(); +void affcar(int gd, int x, int y, int coul, int char); +void putpix(int gd, int x, int y, int coul); + +} // End of namespace Mortevielle + +#endif -- cgit v1.2.3 From d7a64060cafda862276047e95a83b6967defb565 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 23:50:26 +0100 Subject: MORTEVIELLE: Start including header files --- engines/mortevielle/actions.cpp | 2 ++ engines/mortevielle/alert.cpp | 1 + engines/mortevielle/boite.cpp | 2 ++ engines/mortevielle/disk.cpp | 2 ++ engines/mortevielle/droite.cpp | 2 ++ engines/mortevielle/keyboard.cpp | 2 ++ engines/mortevielle/level15.cpp | 2 ++ engines/mortevielle/menu.cpp | 1 + engines/mortevielle/mor.cpp | 1 + engines/mortevielle/mor2.cpp | 2 ++ engines/mortevielle/mort.cpp | 1 + engines/mortevielle/mouse.cpp | 2 ++ engines/mortevielle/outtext.cpp | 2 ++ engines/mortevielle/ovd1.cpp | 2 ++ engines/mortevielle/parole.cpp | 2 ++ engines/mortevielle/parole2.cpp | 2 ++ engines/mortevielle/prog.cpp | 2 ++ engines/mortevielle/ques.cpp | 1 + engines/mortevielle/sprint.cpp | 1 + engines/mortevielle/taffich.cpp | 1 + engines/mortevielle/var_mor.cpp | 1 + 21 files changed, 34 insertions(+) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6ad0cc0401..54f3972081 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/actions.h" + namespace Mortevielle { /* NIVEAU 4 */ diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 345867ff0d..614271356c 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/alert.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index cc3230db4f..cfda996e10 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/boite.h" + namespace Mortevielle { void boite(int x, int y, int dx, int dy, int coul) { diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index a88f63a1ce..a18bdd8a6f 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/disk.h" + namespace Mortevielle { void dem1() { diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 312ed69c1a..3f582e8cb2 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/droite.h" + namespace Mortevielle { void droite(int x, int y, int xx, int yy, int coul) { diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 20fb38c870..cce1bdeb32 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/keyboard.h" + namespace Mortevielle { char readkey1() { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 2da371b3c7..c7a8344230 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/level15.h" + namespace Mortevielle { /* NIVEAU 15 */ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 97b0cfcb71..f91eda12ee 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/menu.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index a0aad53cf1..bf417dbf7e 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mor.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 94fcfde07e..69637761d2 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mor2.h" + namespace Mortevielle { const array<1, 11, int> men diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 928804b46e..28562c774e 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mort.h" #include "ptoc.h" namespace Mortevielle { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 6f4eaa2f4b..e894e086af 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mouse.h" + namespace Mortevielle { const int m_arrow = 0; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 047421941f..072fe5cea1 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/outtext.h" + namespace Mortevielle { Common::String delig; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 608b429848..d18af48e96 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/ovd1.h" + namespace Mortevielle { void dem2() { diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index bfa36b06f3..3f92d78671 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/parole.h" + namespace Mortevielle { void spfrac(int wor) { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 90e9495477..8685feb39f 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/parole2.h" + namespace Mortevielle { void rot_chariot() { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 43448691f3..9ff2b665c3 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/prog.h" + namespace Mortevielle { /* overlay */ void change_gd(int ngd) { diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 583221c252..4080453083 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/ques.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index a72ef12c16..92ff49f768 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/sprint.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index eab78c8f4c..df5580786f 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/taffich.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 25a8c59acc..c2ce4b3a75 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/var_mor.h" #include "common/str.h" namespace Mortevielle { -- cgit v1.2.3 From 6e171f7de12d078c7f6c6a64c63eeb1625e84a53 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 23:54:01 +0100 Subject: MORTEVIELLE: fix several old includes --- engines/mortevielle/mort.cpp | 52 ++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 28562c774e..2d4f127b09 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -25,40 +25,34 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "mortevielle/mort.h" #include "ptoc.h" -namespace Mortevielle { - -/*$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 */ +#include "mortevielle/mort.h" +#include "mortevielle/var_mor.h" /* les variables */ +#include "mortevielle/keyboard.h" /* la gestion du clavier */ +#include "mortevielle/mouse.h" /* la souris */ +#include "mortevielle/level15.h" /* les fonctions de base */ +#include "mortevielle/droite.h" /* pour faire une droite */ +#include "mortevielle/boite.h" +#include "mortevielle/sprint.h" /* l'affichage des textes */ +#include "mortevielle/outtext.h" /* fonctions sup‚rieures d'affichage */ +#include "mortevielle/parole.h" /* les fonctions de la parole */ +#include "mortevielle/alert.h" +#include "mortevielle/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 */ - +#include "mortevielle/ques.h" /* les questions */ +#include "mortevielle/menu.h" /* les fonctions du menu */ +#include "mortevielle/mor.h" /* divers */ +#include "mortevielle/taffich.h" /* chargement des dessins */ +#include "mortevielle/ovd1.h" /* les fonctions sur disque 1 */ +#include "mortevielle/mor2.h" /* divers */ +#include "mortevielle/actions.h" /* les actions */ +#include "mortevielle/prog.h" /* fonctions toplevel */ +#include "mortevielle/disk.h" /* chargements et sauvegardes */ /* ecrihexa utilitaire */ +namespace Mortevielle { + void divers(int np, boolean b) { teskbd(); do { -- cgit v1.2.3 From 2792e4069d404f12f5329e1ce4989158096af860 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 23:56:30 +0100 Subject: MORTEVIELLE: use bool instead of boolean --- engines/mortevielle/actions.cpp | 6 +++--- engines/mortevielle/alert.cpp | 2 +- engines/mortevielle/level15.cpp | 4 ++-- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 8 ++++---- engines/mortevielle/mor.h | 2 +- engines/mortevielle/mor2.cpp | 12 ++++++------ engines/mortevielle/mor2.h | 2 +- engines/mortevielle/mort.cpp | 2 +- engines/mortevielle/mouse.cpp | 10 +++++----- engines/mortevielle/mouse.h | 2 +- engines/mortevielle/outtext.cpp | 4 ++-- engines/mortevielle/outtext.h | 2 +- engines/mortevielle/ovd1.cpp | 4 ++-- engines/mortevielle/ovd1.h | 2 +- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/ques.cpp | 6 +++--- engines/mortevielle/var_mor.cpp | 6 +++--- 18 files changed, 39 insertions(+), 39 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 54f3972081..27598feea9 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -469,7 +469,7 @@ L2: /* overlay */ void tmettre() { int quel; - boolean entre; + bool entre; phrase st; Common::String str_; int i, tay; @@ -979,13 +979,13 @@ L2: /* overlay */ void tparler() { - array<1, 46, boolean> te; + array<1, 46, bool> te; int 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; + bool f; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 614271356c..1d5901bcd1 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -128,7 +128,7 @@ int do_alert(Common::String str_, int n) { char c, dumi; array<1, 2, varying_string<3> > s; int cx, cy, cd, nbcol, nblig; - boolean touch, newaff, test, test1, test2, test3, dum; + bool touch, newaff, test, test1, test2, test3, dum; Common::String cas; diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index c7a8344230..6f5f001d74 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -40,10 +40,10 @@ void copcha() { } while (!(i == acha + 390)); } -boolean dans_rect(rectangle r) { +bool dans_rect(rectangle r) { int x, y, c; - boolean dans_rect_result; + bool dans_rect_result; read_pos_mouse(x, y, c); if ((x > r.x1) && (x < r.x2) && diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f91eda12ee..82783277ce 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -311,7 +311,7 @@ void erase_menu() { void mdn() { int x, y, c, a, ix; - boolean tes; + bool tes; /* debug('mdn'); */ if (! active_menu) return; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index bf417dbf7e..5b8058898d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -369,7 +369,7 @@ void modobj(int m) { menu_disable(invt[8]); } -void modobj2(int m, boolean t1, boolean t2) { +void modobj2(int m, bool t1, bool t2) { phrase str_; Common::String strp; int i, tay; @@ -526,7 +526,7 @@ void affper(int per) { } /* overlay */ void choix(int min, int max, int &per) { - boolean i; + bool i; int haz, cx, cy, cz; long_int per2, cz2; @@ -841,7 +841,7 @@ void debloc(int l) { /* overlay */ void quelq15(int &per) { int cx; - boolean test; + bool test; /* debug('o1 quelq15'); */ @@ -1254,7 +1254,7 @@ void aniof(int ouf, int num) { } void musique(int so) { - boolean i; + bool i; int haz; /* dep: array[1..5] of long_int;*/ diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 1211d215ae..82f8004400 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -58,7 +58,7 @@ void conv(int x, int &y); /* NIVEAU 12 */ void okpas(); void modobj(int m); -void modobj2(int m, boolean t1, boolean t2); +void modobj2(int m, bool t1, bool t2); void repon(int f, int m); void f3f8(); void t5(int cx); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 69637761d2..45146c1bce 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -178,8 +178,8 @@ void afdes(int ad) { okdes = false; } -void tkey1(boolean d) { - boolean quest; +void tkey1(bool d) { + bool quest; int x, y, c; int key; @@ -327,7 +327,7 @@ void st4(int ob) { } } -void cherjer(int ob, boolean &d) { +void cherjer(int ob, bool &d) { int cx; d = false; @@ -455,7 +455,7 @@ void ajjer(int ob) { void t1sama() { /* On entre dans le manoir */ int j, h, m; - boolean d; + bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { @@ -601,7 +601,7 @@ void tsuiv() { } void tfleche() { - boolean qust; + bool qust; char touch; int dummy, cd, xmo, ymo; @@ -728,7 +728,7 @@ void rechai(int &ch) { } void t23coul(int &l) { - boolean d; + bool d; cherjer(143, d); l = 14; diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index bad43320c5..46181c5e9a 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -46,7 +46,7 @@ void atf3f8(int &key); void tperd(); void tsort(); void st4(int ob); -void cherjer(int ob, boolean &d); +void cherjer(int ob, bool &d); void st1sama(); void modinv(); void sparl(long_int adr, long_int rep); diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 2d4f127b09..2555b83232 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -53,7 +53,7 @@ namespace Mortevielle { -void divers(int np, boolean b) { +void divers(int np, bool b) { teskbd(); do { parole(np, 0, 0); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e894e086af..8b4fcaa84a 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -32,7 +32,7 @@ namespace Mortevielle { const int m_arrow = 0; const int m_point_hand = 1; -boolean int_m, +bool int_m, clic; int m_show, @@ -88,7 +88,7 @@ end; */ void hide_mouse() { int i, j, k, ps, ds; - boolean imp; + bool imp; mouse_shwn = pred(int, mouse_shwn); if (mouse_shwn == 0) { @@ -177,7 +177,7 @@ void hide_mouse() { void show_mouse() { int i, j, k, l, ps, ds; - boolean imp; + bool imp; char c; mouse_shwn = mouse_shwn + 1; @@ -311,8 +311,8 @@ void read_pos_mouse(int &x, int &y, int &c) { } } -void mov_mouse(boolean &funct, char &key) { - boolean p_key; +void mov_mouse(bool &funct, char &key) { + bool p_key; char in1, in2; int x, y, cx, cy, cd; registres reg; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 62fdf1bfe4..90fe91e373 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -37,7 +37,7 @@ void hide_mouse(); void show_mouse(); void pos_mouse(int x, int y); void read_pos_mouse(int &x, int &y, int &c); -void mov_mouse(boolean &funct, char &key); +void mov_mouse(bool &funct, char &key); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 072fe5cea1..749bc13d1c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -57,7 +57,7 @@ const byte tab31[32]= { void deline(int num , phrase &l , int &tl); -static void cinq_huit(char &c, int &ind, byte &pt, boolean &the_end) { +static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { const unsigned char rap[32] = { ',', ':', '@', '!', '?', '-', '\207', '\240', '\205', '\203', '\202', '\212', '\210', '/', @@ -153,7 +153,7 @@ static int l_motsuiv(int p, phrase &ch, int &tab) { } void afftex(phrase ch, int x, int y, int dx, int dy, int typ) { - boolean the_end; + bool the_end; char touch; int xf, yf; int xc, yc; diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index fcf4822ab5..b9a239bff6 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -30,7 +30,7 @@ namespace Mortevielle { -static void cinq_huit(char &c, int &ind, byte &pt, boolean &the_end); +static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); void deline(int num , phrase &l , int &tl); static int l_motsuiv(int p, phrase &ch, int &tab); void afftex(phrase ch, int x, int y, int dx, int dy, int typ); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index d18af48e96..570d548887 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -65,7 +65,7 @@ void ani50() { end; end;*/ -/* overlay */ void aff50(boolean c) { +/* overlay */ void aff50(bool c) { int k; caff = 50; @@ -276,7 +276,7 @@ void ani50() { /* overlay */ void music() { untyped_file fic; int k; - boolean fin; + bool fin; char ch; float x, y; diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 339ee69f9f..4cad37c0ab 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -33,7 +33,7 @@ namespace Mortevielle { void dem2(); void ani50(); //void apzuul(); -void aff50(boolean c); +void aff50(bool c); void init_menu(); void charpal(); void chartex(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 9ff2b665c3..ddf9e4d36b 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -243,7 +243,7 @@ void tecran() { const int lim = 20000; int temps; char inkey; - boolean oo, funct; + bool oo, funct; clsf3(); oo = false; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 4080453083..a802516795 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -30,7 +30,7 @@ namespace Mortevielle { -/* overlay */ boolean ques() { +/* overlay */ bool ques() { const array<1, 10, int> ta = {{ 511, 516, 524, 531, 545, @@ -40,7 +40,7 @@ namespace Mortevielle { const array<1, 10, int> ok = {{ 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }}; - boolean q, func, test; + bool q, func, test; int i, j, k, y, memk; int tay , tmax; int rep, prem, der; @@ -51,7 +51,7 @@ namespace Mortevielle { int compte; - boolean ques_result; + bool ques_result; test = false; i = 0; compte = 0; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index c2ce4b3a75..2f9928738d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -208,7 +208,7 @@ struct sav_chaine { char sjer[31]; int mlieu, iboul, ibag, icave, ivier, ipuit; int derobj, iloic, icryp; - boolean ipre; + bool ipre; char heure; }; struct registres { @@ -238,7 +238,7 @@ struct doublet { typedef array<1, 16, doublet> tabdb; struct rectangle { int x1, x2, y1, y2; - boolean etat; + bool etat; }; typedef array<1, max_rect, rectangle> mult_rect; @@ -263,7 +263,7 @@ struct t_pcga { /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -boolean blo, +bool blo, bh1, bf1, bh2, -- cgit v1.2.3 From 4281423abbfb6b0d1bc878d0d85f5af2b8f950c2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Dec 2011 00:15:50 +0100 Subject: MORTEVIELLE: Fix some errors by including str.h --- engines/mortevielle/alert.h | 2 ++ engines/mortevielle/menu.h | 2 ++ engines/mortevielle/mor.h | 2 ++ engines/mortevielle/outtext.cpp | 1 + 4 files changed, 7 insertions(+) diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h index 23351318a5..6c66a20e6a 100644 --- a/engines/mortevielle/alert.h +++ b/engines/mortevielle/alert.h @@ -28,6 +28,8 @@ #ifndef MORTEVIELLE_ALERT_H #define MORTEVIELLE_ALERT_H +#include "common/str.h" + namespace Mortevielle { int do_alert(Common::String str_, int n); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 451e96718c..2b548a2f35 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -28,6 +28,8 @@ #ifndef MORTEVIELLE_MENU_H #define MORTEVIELLE_MENU_H +#include "common/str.h" + namespace Mortevielle { /* NIVEAU 14*/ diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 82f8004400..88e718b853 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -28,6 +28,8 @@ #ifndef MORTEVIELLE_MOR_H #define MORTEVIELLE_MOR_H +#include "common/str.h" + namespace Mortevielle { /* Niveau 14 suite */ diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 749bc13d1c..13dd824a5f 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/outtext.h" +#include "common/str.h" namespace Mortevielle { -- cgit v1.2.3 From 646408bb38e8144de06b43d571fb3f2f87b7e277 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Dec 2011 00:46:44 +0100 Subject: MORTEVIELLE: Fix several errors, add some includes --- engines/mortevielle/actions.cpp | 2 + engines/mortevielle/alert.h | 2 +- engines/mortevielle/boite.cpp | 2 + engines/mortevielle/droite.cpp | 1 + engines/mortevielle/level15.cpp | 1 + engines/mortevielle/mor2.h | 2 +- engines/mortevielle/prog.cpp | 1 + engines/mortevielle/ques.cpp | 10 +- engines/mortevielle/sprint.cpp | 1 + engines/mortevielle/var_mor.cpp | 382 +--------------------------------------- engines/mortevielle/var_mor.h | 380 +++++++++++++++++++++++++++++++++++++++ 11 files changed, 393 insertions(+), 391 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 27598feea9..6e28c173e6 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -26,6 +26,8 @@ */ #include "mortevielle/actions.h" +#include "mortevielle/mor.h" +#include "mortevielle/mor2.h" namespace Mortevielle { diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h index 6c66a20e6a..6419e814cf 100644 --- a/engines/mortevielle/alert.h +++ b/engines/mortevielle/alert.h @@ -33,7 +33,7 @@ namespace Mortevielle { int do_alert(Common::String str_, int n); -void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); +static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); static void posit(int ji, int &coldep, int &esp); static void fait_boite(int lidep, int nli, int tx); static void fait_choix(Common::String c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp); diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index cfda996e10..0a37cc7af2 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -26,6 +26,8 @@ */ #include "mortevielle/boite.h" +#include "mortevielle/mouse.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 3f582e8cb2..9def04add5 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/droite.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 6f5f001d74..42219ee943 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/level15.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 46181c5e9a..adfbff9d26 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -40,7 +40,7 @@ void tmlieu(int mli); void tlu(int af, int ob); void delin(int n); void affrep(); -void mfouen() +void mfouen(); void atf3f8(int &key); /* NIVEAU 6 */ void tperd(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index ddf9e4d36b..08b63fe3aa 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mor2.h" #include "mortevielle/prog.h" namespace Mortevielle { diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index a802516795..8ea4e4c49c 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -31,14 +31,8 @@ namespace Mortevielle { /* overlay */ bool ques() { - const array<1, 10, int> ta - = {{ - 511, 516, 524, 531, 545, - 552, 559, 563, 570, 576 - } - }; - const array<1, 10, int> ok - = {{ 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }}; + const int ta[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; + const int ok[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; bool q, func, test; int i, j, k, y, memk; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 92ff49f768..6209b08f7d 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mouse.h" #include "mortevielle/sprint.h" #include "common/str.h" diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 2f9928738d..25789e29b3 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -30,390 +30,10 @@ namespace Mortevielle { -/* 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 float freq0 = 1.19318e6; - -const int seg_syst = 0x6fed; -const int segmou = 0x6f00; -const int segdon = 0x6c00; -const int adani = 0x7314; -const int adword = 0x4000; -const int adtroct = 0x406b; -const int adcfiec = 0x4300; -const int adbruit = 0x5cb0;/*2C00;*/ -const int adbruit1 = 0x6924;/*3874;*/ -const int adbruit2 = 0x6b30;/*3A80;*/ -const int adbruit3 = 0x6ba6;/*3AF6;*/ -const int adbruit5 = 0x3b50; -const int adson = 0x5cb0;/*2C00;*/ -const int adson2 = 0x60b0;/*3000;*/ -const int offsetb1 = 6; -const int offsetb2 = 4; -const int offsetb3 = 6; - -const int null = 255; - -const int tempo_mus = 71; -const int tempo_bruit = 78; -const int tempo_f = 80; -const int tempo_m = 89; - -const int ti1 = 410; -const int ti2 = 250; -const int maxti = 7975; -const int maxtd = 600; -const int max_rect = 14; - -const int ams = 0; -const int cga = 1; -const int ega = 2; -const int her = 3; -const int tan = 4; - -const int c_repon = 0; -const int c_st41 = 186; -const int c_tparler = 247; -const int c_paroles = 292; -const int c_tmlieu = 435; -const int c_dialpre = 456; -const int c_action = 476; -const int c_saction = 497; -const int c_dis = 502; -const int c_fin = 510; /* => n'existe pas ; si !! */ - -const int arega = 0; -const int asoul = 154; -const int aouvr = 282; -const int achai = 387; -const int acha = 492; -const int arcf = 1272; -const int arep = 1314; -const int amzon = 1650; -const int fleche = 1758; - -const int no_choice = 0; -const int invent = 1; -const int depla = 2; -const int action = 3; -const int saction = 4; -const int discut = 5; -const int fichier = 6; -const int sauve = 7; -const int charge = 8; - -const int attacher = 0x301; -const int attendre = 0x302; -const int defoncer = 0x303; -const int dormir = 0x304; -const int ecouter = 0x305; -const int entrer = 0x306; -const int fermer = 0x307; -const int fouiller = 0x308; -const int frapper = 0x309; -const int gratter = 0x30a; -const int lire = 0x30b; -const int manger = 0x30c; -const int mettre = 0x30d; -const int ouvrir = 0x30e; -const int prendre = 0x30f; -const int regarder = 0x310; -const int sentir = 0x311; -const int sonder = 0x312; -const int sortir = 0x313; -const int soulever = 0x314; -const int tourner = 0x315; - -const int scacher = 0x401; -const int sfouiller = 0x402; -const int slire = 0x403; -const int sposer = 0x404; -const int sregarder = 0x405; - -const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { - 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 byte addv[2] = {8, 8}; - -const char recom[] = " Recommence "; - -const char f3[] = "F3: Encore"; -const char f8[] = "F8: Suite"; - -const int max_patt = 20; - - -const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; - - /*---------------------------------------------------------------------------*/ -/*-------------------------------- TYPES --------------------------------*/ +/*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ /*---------------------------------------------------------------------------*/ -typedef float long_int; -typedef file fichier_byte; -struct sav_chaine { - int conf; - char pourc[11]; - char teauto[43]; - char sjer[31]; - int mlieu, iboul, ibag, icave, ivier, ipuit; - int derobj, iloic, icryp; - bool ipre; - char heure; -}; -struct registres { - int ax, bx, cx, dx, bp, si, di, ds, es, flags; -}; -typedef array<1, 1410, char> phrase; -struct ind { - int indis; - byte point; -}; -typedef array<0, maxtd, ind> tabind; - -typedef matrix<1, 7, 0, 24, byte> tab_mlieu; - -typedef int word1; -struct chariot { - int val, - code, - acc, - freq, - rep; -}; - -struct doublet { - byte x, y; -}; -typedef array<1, 16, doublet> tabdb; -struct rectangle { - int x1, x2, y1, y2; - bool etat; -}; - -typedef array<1, max_rect, rectangle> mult_rect; - -struct pattern { - byte tay, tax; - matrix<1, max_patt, 1, max_patt, byte> des; -}; - - -struct nhom { - byte n; /* numero entre 0 et 32 */ - byte hom[4]; -}; - -struct t_pcga { - byte p; - nhom a[16]; -}; - -/*---------------------------------------------------------------------------*/ -/*------------------------------ VARIABLES ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -bool 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; - - -int 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; - -int t_cph[6401]; -byte tabdon[4001]; -/* t_dxx : array[0..121] of int;*/ -Common::String stpou; /* donne le % d'indices */ -byte is; -char mode; -fichier_byte ficdes; -Common::String al_mess, - err_mess, - ind_mess, - al_mess2; - -array<1, 8, int> invt, - nbrep, - nbrepm, - disc; -int msg[5]; -array<1, 7, int> 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; -byte bufcha[391]; - -matrix<1, 6, 0, 23, byte> lettres; - -byte palher[16]; - -int t_mot[maxti + 1]; -int tay_tchar; -tabind t_rec; -file sauv_t; -untyped_file fibyte; -tab_mlieu v_lieu; -int l[108]; -int tbi[256]; -chariot c1, c2, c3; -float addfix; -t_pcga palsav[91]; -array<0, 90, tabdb> tabpal; -t_pcga palcga[91]; -pattern tpt[15]; - - - -/*---------------------------------------------------------------------------*/ -/*-------------------- PROCEDURES ET FONCTIONS ------------------------*/ -/*---------------------------------------------------------------------------*/ - -/* procedure box(c,Gd,xo,yo,xi,yi,patt:int); external 'c:\mc\boite.com'; */ - void hirs() { const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 86bb296ee2..4a526a32f1 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -28,8 +28,388 @@ #ifndef MORTEVIELLE_VAR_H #define MORTEVIELLE_VAR_H +#include "common/str.h" + namespace Mortevielle { +/* 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 float freq0 = 1.19318e6; + +const int seg_syst = 0x6fed; +const int segmou = 0x6f00; +const int segdon = 0x6c00; +const int adani = 0x7314; +const int adword = 0x4000; +const int adtroct = 0x406b; +const int adcfiec = 0x4300; +const int adbruit = 0x5cb0;/*2C00;*/ +const int adbruit1 = 0x6924;/*3874;*/ +const int adbruit2 = 0x6b30;/*3A80;*/ +const int adbruit3 = 0x6ba6;/*3AF6;*/ +const int adbruit5 = 0x3b50; +const int adson = 0x5cb0;/*2C00;*/ +const int adson2 = 0x60b0;/*3000;*/ +const int offsetb1 = 6; +const int offsetb2 = 4; +const int offsetb3 = 6; + +const int null = 255; + +const int tempo_mus = 71; +const int tempo_bruit = 78; +const int tempo_f = 80; +const int tempo_m = 89; + +const int ti1 = 410; +const int ti2 = 250; +const int maxti = 7975; +const int maxtd = 600; +const int max_rect = 14; + +const int ams = 0; +const int cga = 1; +const int ega = 2; +const int her = 3; +const int tan = 4; + +const int c_repon = 0; +const int c_st41 = 186; +const int c_tparler = 247; +const int c_paroles = 292; +const int c_tmlieu = 435; +const int c_dialpre = 456; +const int c_action = 476; +const int c_saction = 497; +const int c_dis = 502; +const int c_fin = 510; /* => n'existe pas ; si !! */ + +const int arega = 0; +const int asoul = 154; +const int aouvr = 282; +const int achai = 387; +const int acha = 492; +const int arcf = 1272; +const int arep = 1314; +const int amzon = 1650; +const int fleche = 1758; + +const int no_choice = 0; +const int invent = 1; +const int depla = 2; +const int action = 3; +const int saction = 4; +const int discut = 5; +const int fichier = 6; +const int sauve = 7; +const int charge = 8; + +const int attacher = 0x301; +const int attendre = 0x302; +const int defoncer = 0x303; +const int dormir = 0x304; +const int ecouter = 0x305; +const int entrer = 0x306; +const int fermer = 0x307; +const int fouiller = 0x308; +const int frapper = 0x309; +const int gratter = 0x30a; +const int lire = 0x30b; +const int manger = 0x30c; +const int mettre = 0x30d; +const int ouvrir = 0x30e; +const int prendre = 0x30f; +const int regarder = 0x310; +const int sentir = 0x311; +const int sonder = 0x312; +const int sortir = 0x313; +const int soulever = 0x314; +const int tourner = 0x315; + +const int scacher = 0x401; +const int sfouiller = 0x402; +const int slire = 0x403; +const int sposer = 0x404; +const int sregarder = 0x405; + +const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; +const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; +const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { + 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 byte addv[2] = {8, 8}; + +const char recom[] = " Recommence "; + +const char f3[] = "F3: Encore"; +const char f8[] = "F8: Suite"; + +const int max_patt = 20; + + +const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; + + +/*---------------------------------------------------------------------------*/ +/*-------------------------------- TYPES --------------------------------*/ +/*---------------------------------------------------------------------------*/ + +typedef float long_int; +typedef file fichier_byte; +struct sav_chaine { + int conf; + char pourc[11]; + char teauto[43]; + char sjer[31]; + int mlieu, iboul, ibag, icave, ivier, ipuit; + int derobj, iloic, icryp; + bool ipre; + char heure; +}; +struct registres { + int ax, bx, cx, dx, bp, si, di, ds, es, flags; +}; +typedef char[1410] phrase; +struct ind { + int indis; + byte point; +}; +typedef ind[maxtd + 1] tabind; + +typedef matrix<1, 7, 0, 24, byte> tab_mlieu; + +typedef int word1; +struct chariot { + int val, + code, + acc, + freq, + rep; +}; + +struct doublet { + byte x, y; +}; + +typedef doublet[16] tabdb; + +struct rectangle { + int x1, x2, y1, y2; + bool etat; +}; + +typedef rectangle[max_rect] mult_rect; + +struct pattern { + byte tay, tax; + matrix<1, max_patt, 1, max_patt, byte> des; +}; + + +struct nhom { + byte n; /* numero entre 0 et 32 */ + byte hom[4]; +}; + +struct t_pcga { + byte p; + nhom a[16]; +}; + +/*---------------------------------------------------------------------------*/ +/*------------------------------ VARIABLES ------------------------------*/ +/*---------------------------------------------------------------------------*/ + +bool 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; + + +int 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; + +int t_cph[6401]; +byte tabdon[4001]; +/* t_dxx : array[0..121] of int;*/ +Common::String stpou; /* donne le % d'indices */ +byte is; +char mode; +fichier_byte ficdes; +Common::String al_mess, + err_mess, + ind_mess, + al_mess2; + +int invt[8]; +int nbrep[8]; +int nbrepm[8]; +int disc[8] +int msg[5]; +int depl[7]; +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; +char touv[7]; +sav_chaine s, s1; +byte bufcha[391]; + +matrix<1, 6, 0, 23, byte> lettres; + +byte palher[16]; + +int t_mot[maxti + 1]; +int tay_tchar; +tabind t_rec; +file sauv_t; +untyped_file fibyte; +tab_mlieu v_lieu; +int l[108]; +int tbi[256]; +chariot c1, c2, c3; +float addfix; +t_pcga palsav[91]; +tabdb tabpal[91]; +t_pcga palcga[91]; +pattern tpt[15]; + /*---------------------------------------------------------------------------*/ /*------------------- PROCEDURES AND FONCTIONS ------------------------*/ /*---------------------------------------------------------------------------*/ -- cgit v1.2.3 From 3cefe699949e00e9faf4e7d2a8af65daafc2f125 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Dec 2011 08:20:55 +0100 Subject: MORTEVIELLE: Enlarge two arrays in order to fix pascal access --- engines/mortevielle/ques.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 8ea4e4c49c..9a1280c769 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -31,8 +31,8 @@ namespace Mortevielle { /* overlay */ bool ques() { - const int ta[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; - const int ok[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; + const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; + const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; bool q, func, test; int i, j, k, y, memk; -- cgit v1.2.3 From cd596ffb9b43bc2b251eeade7c7e89a158856fb1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Dec 2011 08:34:47 +0100 Subject: MORTEVIELLE: Fix some more errors by adding includes --- engines/mortevielle/actions.cpp | 4 ++++ engines/mortevielle/mor.cpp | 3 +++ engines/mortevielle/outtext.cpp | 1 + engines/mortevielle/outtext.h | 2 ++ engines/mortevielle/ovd1.cpp | 1 + engines/mortevielle/ques.cpp | 1 + 6 files changed, 12 insertions(+) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6e28c173e6..4370947a09 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -26,8 +26,12 @@ */ #include "mortevielle/actions.h" +#include "mortevielle/alert.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" +#include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 5b8058898d..eca3021ec2 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -25,7 +25,10 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/alert.h" #include "mortevielle/mor.h" +#include "mortevielle/outtext.h" +#include "mortevielle/var_mor.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 13dd824a5f..f474766ee4 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/outtext.h" +#include "mortevielle/var_mor.h" #include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index b9a239bff6..27f9c6c617 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -28,6 +28,8 @@ #ifndef MORTEVIELLE_OUTTEXT_H #define MORTEVIELLE_OUTTEXT_H +#include "mortevielle/var_mor.h" + namespace Mortevielle { static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 570d548887..dbb0977c56 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/ovd1.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 9a1280c769..db44ce33ea 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/outtext.h" #include "mortevielle/ques.h" #include "common/str.h" -- cgit v1.2.3 From a61fb2cf25e49b03f99432b798855015c67d1efc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 27 Dec 2011 23:13:54 +0000 Subject: MORTEVIELLE: long_int -> float --- engines/mortevielle/mor.cpp | 4 ++-- engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/mor2.h | 2 +- engines/mortevielle/taffich.cpp | 6 +++--- engines/mortevielle/taffich.h | 6 +++--- engines/mortevielle/var_mor.h | 1 - 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index eca3021ec2..e55b4ed435 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -531,7 +531,7 @@ void affper(int per) { /* overlay */ void choix(int min, int max, int &per) { bool i; int haz, cx, cy, cz; - long_int per2, cz2; + float per2, cz2; /* debug('o0 choix'); */ haz = hazard(min, max); @@ -1259,7 +1259,7 @@ void aniof(int ouf, int num) { void musique(int so) { bool i; int haz; - /* dep: array[1..5] of long_int;*/ + /* dep: array[1..5] of float;*/ /* debug('musique'); */ if (so == 0) { /*musik(0)*/ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 45146c1bce..dea21bde0a 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -362,7 +362,7 @@ void modinv() { } } -void sparl(long_int adr, long_int rep) { +void sparl(float adr, float rep) { const array<1, 8, int> haut = {{0, 1, -3, 6, -2, 2, 7, -1}}; int key, ad, tay, repint; diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index adfbff9d26..a1732a16d4 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -49,7 +49,7 @@ void st4(int ob); void cherjer(int ob, bool &d); void st1sama(); void modinv(); -void sparl(long_int adr, long_int rep); +void sparl(float adr, float rep); void finfouil(); void mfoudi(); void mennor(); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index df5580786f..0a19301173 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -30,7 +30,7 @@ namespace Mortevielle { -void chardes(Common::String nom, long_int passe, int long_) { +void chardes(Common::String nom, float passe, int long_) { int i, p, l; byte b; untyped_file f; @@ -60,7 +60,7 @@ void chardes(Common::String nom, long_int passe, int long_) { /*$i+*/ } -void charani(Common::String nom, long_int passe, int long_) { +void charani(Common::String nom, float passe, int long_) { int i, p, l; byte b; untyped_file f; @@ -101,7 +101,7 @@ void taffich() { }; int i, m, a, b, cx, handle, npal; - long_int lgt, lhandle; + float lgt, lhandle; Common::String nom; int palh, k, j; int alllum[16]; diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h index ccc64bf2c5..41f0612a4f 100644 --- a/engines/mortevielle/taffich.h +++ b/engines/mortevielle/taffich.h @@ -32,9 +32,9 @@ namespace Mortevielle { -void chardes(Common::String nom, long_int passe, int long_); -void charani(Common::String nom, long_int passe, int long_); +void chardes(Common::String nom, float passe, int long_); +void charani(Common::String nom, float passe, int long_); void taffich(); } // End of namespace Mortevielle -#endif \ No newline at end of file +#endif diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 4a526a32f1..42f95d5615 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -201,7 +201,6 @@ const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ -typedef float long_int; typedef file fichier_byte; struct sav_chaine { int conf; -- cgit v1.2.3 From 34f9d3024549c1c9543a556ae423d88c1cc6bc7e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 27 Dec 2011 23:27:37 +0000 Subject: MORTEVIELLE: COnvert more arrays and data types --- engines/mortevielle/actions.cpp | 4 ++-- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 8 ++++---- engines/mortevielle/mor2.cpp | 8 ++++---- engines/mortevielle/outtext.cpp | 10 +++++----- engines/mortevielle/outtext.h | 6 +++--- engines/mortevielle/ovd1.cpp | 6 +++--- engines/mortevielle/ques.cpp | 2 +- engines/mortevielle/var_mor.h | 32 +++++++++++++++----------------- 9 files changed, 38 insertions(+), 40 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 4370947a09..25d9af0c24 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -476,7 +476,7 @@ L2: /* overlay */ void tmettre() { int quel; bool entre; - phrase st; + char st[1410]; Common::String str_; int i, tay; @@ -990,7 +990,7 @@ L2: i, tay, choi, x, y, c; char tou; array<1, 46, varying_string<40> > lib; - phrase st; + char st[1410]; bool f; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 82783277ce..d790bf25e8 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -182,7 +182,7 @@ void draw_menu() { } void invers(int ix) { - varying_string<23> s; + Common::String s; /* debug('invers'); */ if (msg4 == no_choice) return; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e55b4ed435..ea57e209ce 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -115,7 +115,7 @@ void text_color(int c) { void text1(int x, int y, int nb, int m) { - phrase st; + char st[1410]; int tay; int co; @@ -358,7 +358,7 @@ void okpas() { } void modobj(int m) { - phrase str_; + char str_[1410]; Common::String strp; int i, tay; @@ -373,7 +373,7 @@ void modobj(int m) { } void modobj2(int m, bool t1, bool t2) { - phrase str_; + char str_[1410]; Common::String strp; int i, tay; @@ -393,7 +393,7 @@ void modobj2(int m, bool t1, bool t2) { void repon(int f, int m) { Common::String str_; varying_string<40> str1; - phrase st; + char st[1410]; text1 fic; int i, xco, dx, caspe, tay; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index dea21bde0a..7fc280aeae 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -199,7 +199,7 @@ void tkey1(bool d) { void tmlieu(int mli) { int cx, j, i, tail; Common::String nomp; - phrase st; + char st[1410]; if (mli == 26) mli = 15; @@ -230,7 +230,7 @@ void tlu(int af, int ob) { } void delin(int n) { - phrase s; + char s[1410]; int t; deline(n, s, t); @@ -342,7 +342,7 @@ void st1sama() { void modinv() { int cx, cy, tay, i, r; - phrase nom; + char nom[1410]; Common::String nomp; cy = 0; @@ -366,7 +366,7 @@ void sparl(float adr, float rep) { const array<1, 8, int> haut = {{0, 1, -3, 6, -2, 2, 7, -1}}; int key, ad, tay, repint; - phrase st; + char st[1410]; repint = trunc(rep); hide_mouse(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index f474766ee4..1137f9001e 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -57,7 +57,7 @@ const byte tab31[32]= { 119, 0, 0, 0, 0, 0, 0, 0 }; -void deline(int num , phrase &l , int &tl); +void deline(int num , char *l , int &tl); static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { const unsigned char rap[32] = { @@ -114,7 +114,7 @@ static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { } } /* 5-8 */ -void deline(int num , phrase &l , int &tl) { +void deline(int num , char *l , int &tl) { int i, j, ts; char let; byte ps, k; @@ -141,10 +141,10 @@ void deline(int num , phrase &l , int &tl) { } /* DETEX */ -void afftex(phrase ch, int x, int y, int dx, int dy, int typ); +void afftex(char *ch, int x, int y, int dx, int dy, int typ); -static int l_motsuiv(int p, phrase &ch, int &tab) { +static int l_motsuiv(int p, char *ch, int &tab) { int c; int l_motsuiv_result; @@ -154,7 +154,7 @@ static int l_motsuiv(int p, phrase &ch, int &tab) { return l_motsuiv_result; } -void afftex(phrase ch, int x, int y, int dx, int dy, int typ) { +void afftex(char *ch, int x, int y, int dx, int dy, int typ) { bool the_end; char touch; int xf, yf; diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 27f9c6c617..14ef8c6c7e 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -33,9 +33,9 @@ namespace Mortevielle { static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); -void deline(int num , phrase &l , int &tl); -static int l_motsuiv(int p, phrase &ch, int &tab); -void afftex(phrase ch, int x, int y, int dx, int dy, int typ); +void deline(int num , char *l , int &tl); +static int l_motsuiv(int p, char *ch, int &tab); +void afftex(char *ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index dbb0977c56..ab669e121a 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -80,7 +80,7 @@ void ani50() { /* overlay */ void init_menu() { int i, j, tai; - phrase st; + char st[1410]; untyped_file f; assign(f, "menufr.mor"); @@ -172,7 +172,7 @@ void ani50() { /* overlay */ void chartex() { int i; untyped_file fibyte; - phrase s; + char s[1410]; /* debug('o3 chartex'); */ i = 0; @@ -202,7 +202,7 @@ void ani50() { { int cy, tay; - phrase st; + char st[1410]; float ix; char ch; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index db44ce33ea..50490dfd27 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -39,7 +39,7 @@ namespace Mortevielle { int i, j, k, y, memk; int tay , tmax; int rep, prem, der; - phrase st; + char st[1410]; char key; mult_rect coor; array<1, 14, Common::String> chaines; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 42f95d5615..44a78e1529 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -166,22 +166,22 @@ const byte tnocon[364] = { }; -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 byte don[9][5] = { + { 0, 0, 0, 0, 0}, + { 0, 7, 37, 22, 8}, + {0, 19, 33, 23, 7}, + {0, 31, 89, 10, 21}, + {0, 43, 25, 11, 5}, + {0, 55, 37, 5, 8}, + {0, 64, 13, 11, 2}, + {0, 62, 22, 13, 4}, + {0, 62, 25, 13, 5} }; -const array<1, 2, varying_string<11> > fic -= {{ " Sauvegarde", - " Chargement" - } +const char *fic[3] = { + "", + " Sauvegarde", + " Chargement" }; const byte addv[2] = {8, 8}; @@ -201,7 +201,6 @@ const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ -typedef file fichier_byte; struct sav_chaine { int conf; char pourc[11]; @@ -215,7 +214,7 @@ struct sav_chaine { struct registres { int ax, bx, cx, dx, bp, si, di, ds, es, flags; }; -typedef char[1410] phrase; + struct ind { int indis; byte point; @@ -369,7 +368,6 @@ byte tabdon[4001]; Common::String stpou; /* donne le % d'indices */ byte is; char mode; -fichier_byte ficdes; Common::String al_mess, err_mess, ind_mess, -- cgit v1.2.3 From 38b1cc473988db5f7f95e1a1c464844052171ca9 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Dec 2011 21:03:56 +0000 Subject: MORTEVIELLE: More compilation fixes --- engines/mortevielle/alert.h | 4 ---- engines/mortevielle/ques.cpp | 2 +- engines/mortevielle/var_mor.cpp | 6 +++--- engines/mortevielle/var_mor.h | 35 ++++++++++++++--------------------- 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h index 6419e814cf..4c53b14416 100644 --- a/engines/mortevielle/alert.h +++ b/engines/mortevielle/alert.h @@ -33,10 +33,6 @@ namespace Mortevielle { int do_alert(Common::String str_, int n); -static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); -static void posit(int ji, int &coldep, int &esp); -static void fait_boite(int lidep, int nli, int tx); -static void fait_choix(Common::String c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp); int do_alert(Common::String str_, int n); } // End of namespace Mortevielle diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 50490dfd27..d52d89e53e 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -41,7 +41,7 @@ namespace Mortevielle { int rep, prem, der; char st[1410]; char key; - mult_rect coor; + rectangle coor[max_rect]; array<1, 14, Common::String> chaines; int compte; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 25789e29b3..34c1607cbc 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -97,9 +97,9 @@ void hirs() { /* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ -void affcar(int gd, int x, int y, int coul, int char) { - if (res == 1) affput(1, gd, ((cardinal)x >> 1), y, coul, char); - else affput(1, gd, x, y, coul, char); +void affcar(int gd, int x, int y, int coul, int chr) { + if (res == 1) affput(1, gd, ((cardinal)x >> 1), y, coul, chr); + else affput(1, gd, x, y, coul, chr); } void putpix(int gd, int x, int y, int coul) { diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 44a78e1529..f912789b34 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -219,9 +219,6 @@ struct ind { int indis; byte point; }; -typedef ind[maxtd + 1] tabind; - -typedef matrix<1, 7, 0, 24, byte> tab_mlieu; typedef int word1; struct chariot { @@ -236,18 +233,14 @@ struct doublet { byte x, y; }; -typedef doublet[16] tabdb; - struct rectangle { int x1, x2, y1, y2; bool etat; }; -typedef rectangle[max_rect] mult_rect; - struct pattern { byte tay, tax; - matrix<1, max_patt, 1, max_patt, byte> des; + byte des[max_patt+1][max_patt+1]; }; @@ -376,34 +369,34 @@ Common::String al_mess, int invt[8]; int nbrep[8]; int nbrepm[8]; -int disc[8] +int disc[8]; int msg[5]; int depl[7]; -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; +Common::String inv[9]; +Common::String dep[8]; +Common::String act[22]; +Common::String self_[6]; +Common::String dis[9]; char touv[7]; sav_chaine s, s1; byte bufcha[391]; -matrix<1, 6, 0, 23, byte> lettres; +byte lettres[7][24]; byte palher[16]; int t_mot[maxti + 1]; int tay_tchar; -tabind t_rec; -file sauv_t; -untyped_file fibyte; -tab_mlieu v_lieu; +ind t_rec[maxtd + 1]; +//file sauv_t; +//untyped_file fibyte; +byte v_lieu[8][25]; int l[108]; int tbi[256]; chariot c1, c2, c3; float addfix; t_pcga palsav[91]; -tabdb tabpal[91]; +doublet tabpal[91][16]; t_pcga palcga[91]; pattern tpt[15]; @@ -412,7 +405,7 @@ pattern tpt[15]; /*---------------------------------------------------------------------------*/ void hirs(); -void affcar(int gd, int x, int y, int coul, int char); +void affcar(int gd, int x, int y, int coul, int chr); void putpix(int gd, int x, int y, int coul); } // End of namespace Mortevielle -- cgit v1.2.3 From 98ea43b7c58bf8c5dbc113dcdb8cc78366a167ba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 21:34:33 +1100 Subject: MORTEVIELLE: Converted remaining varying_string instances to Common::String --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/alert.cpp | 4 ++-- engines/mortevielle/disk.cpp | 2 +- engines/mortevielle/mor.cpp | 4 ++-- engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/ques.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 25d9af0c24..ab3481d2e3 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -989,7 +989,7 @@ L2: int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; char tou; - array<1, 46, varying_string<40> > lib; + Common::String lib[47]; char st[1410]; bool f; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 1d5901bcd1..ec7c5f0721 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -100,7 +100,7 @@ static void fait_boite(int lidep, int nli, int tx) { -static void fait_choix(Common::String c, int &coldep, int &nbcase, array<1, 2, varying_string<3> > &s, int &esp) { +static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String[] &s, int &esp) { int i, l, x; char ch; @@ -126,7 +126,7 @@ int do_alert(Common::String str_, int n) { Common::String st, chaine; matrix<1, 2, 1, 2, int> limit; char c, dumi; - array<1, 2, varying_string<3> > s; + Common::String s[3]; int cx, cy, cd, nbcol, nblig; bool touch, newaff, test, test1, test2, test3, dum; Common::String cas; diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index a18bdd8a6f..89d01c59c9 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -50,7 +50,7 @@ void dem1() { void takesav(int n) { untyped_file f; int i; - varying_string<10> st; + Common::String st; dem1(); /* -- chargement du fichier 'sauve#n.mor' -- */ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ea57e209ce..083187ea9d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -268,7 +268,7 @@ void ecrf7() { void clsf10() { int co, cod; - varying_string<8> st; + Common::String st; /* debug('clsf10'); */ hide_mouse(); @@ -392,7 +392,7 @@ void modobj2(int m, bool t1, bool t2) { void repon(int f, int m) { Common::String str_; - varying_string<40> str1; + Common::String str1; char st[1410]; text1 fic; int i, xco, dx, caspe, tay; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 7fc280aeae..d41f480246 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -46,7 +46,7 @@ void tinke() { const char d5 = '1'; const char d6[] = "OK"; int cx, cy, haz, nh, cf, j, h, m, cd; - varying_string<3> stpo; + Common::String stpo; bool am; anyone = false; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 1137f9001e..84149699fd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -160,7 +160,7 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { int xf, yf; int xc, yc; int tab, p; - varying_string<255> s; + Common::String s; int i, j, nt; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index ab669e121a..5198d7f6e8 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -348,7 +348,7 @@ void ani50() { /* overlay */ void suite() { - varying_string<25> cpr; + Common::String cpr; hirs(); repon(7, 2035); diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index d52d89e53e..870f8b7435 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -42,7 +42,7 @@ namespace Mortevielle { char st[1410]; char key; rectangle coor[max_rect]; - array<1, 14, Common::String> chaines; + Common::String chaines[15]; int compte; -- cgit v1.2.3 From c8774837efabfea71051fbffddfc715d0d9c6f9a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 22:04:20 +1100 Subject: MORTEVIELLE: Fixed variable usage in var_mor.h and var_mor.cpp --- engines/mortevielle/mor2.cpp | 1 + engines/mortevielle/mouse.cpp | 1 + engines/mortevielle/var_mor.cpp | 199 ++++++++++++++++++++++++++++++++++++++++ engines/mortevielle/var_mor.h | 149 ++++++++++++------------------ 4 files changed, 260 insertions(+), 90 deletions(-) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index d41f480246..b6c3ee93fe 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/mor2.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 8b4fcaa84a..0a00cc3c76 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/mouse.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 34c1607cbc..89ebda43e1 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -30,6 +30,205 @@ namespace Mortevielle { +/*---------------------------------------------------------------------------*/ +/*------------------------------ CONSTANTS ------------------------------*/ +/*---------------------------------------------------------------------------*/ + +const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; +const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; +const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { + 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 byte don[9][5] = { + { 0, 0, 0, 0, 0}, + { 0, 7, 37, 22, 8}, + {0, 19, 33, 23, 7}, + {0, 31, 89, 10, 21}, + {0, 43, 25, 11, 5}, + {0, 55, 37, 5, 8}, + {0, 64, 13, 11, 2}, + {0, 62, 22, 13, 4}, + {0, 62, 25, 13, 5} +}; + +const char *fic[3] = { + "", + " Sauvegarde", + " Chargement" +}; + +const byte addv[2] = {8, 8}; + +const char recom[] = " Recommence "; + +const char f3[] = "F3: Encore"; +const char f8[] = "F8: Suite"; + +const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; + +/*---------------------------------------------------------------------------*/ +/*------------------------------ VARIABLES ------------------------------*/ +/*---------------------------------------------------------------------------*/ + +bool 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; + + +int 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; + +int t_cph[6401]; +byte tabdon[4001]; +/* t_dxx : array[0..121] of int;*/ +Common::String stpou; /* donne le % d'indices */ +byte is; +char mode; +Common::String al_mess, + err_mess, + ind_mess, + al_mess2; + +int invt[8]; +int nbrep[8]; +int nbrepm[8]; +int disc[8]; +int msg[5]; +int depl[7]; +Common::String inv[9]; +Common::String dep[8]; +Common::String act[22]; +Common::String self_[6]; +Common::String dis[9]; +char touv[7]; +sav_chaine s, s1; +byte bufcha[391]; + +byte lettres[7][24]; + +byte palher[16]; + +int t_mot[maxti + 1]; +int tay_tchar; +ind t_rec[maxtd + 1]; +//file sauv_t; +//untyped_file fibyte; +byte v_lieu[8][25]; +int l[108]; +int tbi[256]; +chariot c1, c2, c3; +float addfix; +t_pcga palsav[91]; +doublet tabpal[91][16]; +t_pcga palcga[91]; +pattern tpt[15]; + /*---------------------------------------------------------------------------*/ /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ /*---------------------------------------------------------------------------*/ diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index f912789b34..59d98fe58e 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -43,7 +43,7 @@ namespace Mortevielle { /*---------------------------------------------------------------------------*/ -/*------------------------- CONSTANTES ----------------------------------*/ +/*------------------------- CONSTANTS ----------------------------------*/ /*---------------------------------------------------------------------------*/ const float freq0 = 1.19318e6; @@ -79,12 +79,6 @@ const int maxti = 7975; const int maxtd = 600; const int max_rect = 14; -const int ams = 0; -const int cga = 1; -const int ega = 2; -const int her = 3; -const int tan = 4; - const int c_repon = 0; const int c_st41 = 186; const int c_tparler = 247; @@ -144,57 +138,26 @@ const int slire = 0x403; const int sposer = 0x404; const int sregarder = 0x405; -const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { - 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 byte don[9][5] = { - { 0, 0, 0, 0, 0}, - { 0, 7, 37, 22, 8}, - {0, 19, 33, 23, 7}, - {0, 31, 89, 10, 21}, - {0, 43, 25, 11, 5}, - {0, 55, 37, 5, 8}, - {0, 64, 13, 11, 2}, - {0, 62, 22, 13, 4}, - {0, 62, 25, 13, 5} -}; +const int max_patt = 20; -const char *fic[3] = { - "", - " Sauvegarde", - " Chargement" -}; +extern const byte tabdbc[18]; +extern const byte tabdph[16]; +extern const byte typcon[26]; +extern const byte intcon[26]; +extern const byte tnocon[364]; -const byte addv[2] = {8, 8}; +extern const byte don[9][5]; -const char recom[] = " Recommence "; +extern const char *fic[3]; -const char f3[] = "F3: Encore"; -const char f8[] = "F8: Suite"; +extern const byte addv[2]; -const int max_patt = 20; +extern const char recom[]; +extern const char f3[]; +extern const char f8[]; -const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; +extern const byte rang[16]; /*---------------------------------------------------------------------------*/ @@ -254,11 +217,17 @@ struct t_pcga { nhom a[16]; }; +/*---------------------------------------------------------------------------*/ +/*------------------------------ ENUMS ------------------------------*/ +/*---------------------------------------------------------------------------*/ + +enum GraphicModes { ams = 0, cga = 1, ega = 2, her = 3, tan = 4 }; + /*---------------------------------------------------------------------------*/ /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool blo, +extern bool blo, bh1, bf1, bh2, @@ -296,7 +265,7 @@ bool blo, active_menu; -int x, +extern int x, y, t, vj, @@ -355,50 +324,50 @@ int x, ptr_word, color_txt; -int t_cph[6401]; -byte tabdon[4001]; +extern int t_cph[6401]; +extern byte tabdon[4001]; /* t_dxx : array[0..121] of int;*/ -Common::String stpou; /* donne le % d'indices */ -byte is; -char mode; -Common::String al_mess, +extern Common::String stpou; /* donne le % d'indices */ +extern byte is; +extern char mode; +extern Common::String al_mess, err_mess, ind_mess, al_mess2; -int invt[8]; -int nbrep[8]; -int nbrepm[8]; -int disc[8]; -int msg[5]; -int depl[7]; -Common::String inv[9]; -Common::String dep[8]; -Common::String act[22]; -Common::String self_[6]; -Common::String dis[9]; -char touv[7]; -sav_chaine s, s1; -byte bufcha[391]; - -byte lettres[7][24]; - -byte palher[16]; - -int t_mot[maxti + 1]; -int tay_tchar; -ind t_rec[maxtd + 1]; +extern int invt[8]; +extern int nbrep[8]; +extern int nbrepm[8]; +extern int disc[8]; +extern int msg[5]; +extern int depl[7]; +extern Common::String inv[9]; +extern Common::String dep[8]; +extern Common::String act[22]; +extern Common::String self_[6]; +extern Common::String dis[9]; +extern char touv[7]; +extern sav_chaine s, s1; +extern byte bufcha[391]; + +extern byte lettres[7][24]; + +extern byte palher[16]; + +extern int t_mot[maxti + 1]; +extern int tay_tchar; +extern ind t_rec[maxtd + 1]; //file sauv_t; //untyped_file fibyte; -byte v_lieu[8][25]; -int l[108]; -int tbi[256]; -chariot c1, c2, c3; -float addfix; -t_pcga palsav[91]; -doublet tabpal[91][16]; -t_pcga palcga[91]; -pattern tpt[15]; +extern byte v_lieu[8][25]; +extern int l[108]; +extern int tbi[256]; +extern chariot c1, c2, c3; +extern float addfix; +extern t_pcga palsav[91]; +extern doublet tabpal[91][16]; +extern t_pcga palcga[91]; +extern pattern tpt[15]; /*---------------------------------------------------------------------------*/ /*------------------- PROCEDURES AND FONCTIONS ------------------------*/ -- cgit v1.2.3 From c1ead19c5d68df4d4acb52426162cd67e84d003b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 22:09:59 +1100 Subject: MORTEVIELLE: cardinal -> uint --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/alert.cpp | 10 +++++----- engines/mortevielle/boite.cpp | 4 ++-- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/menu.cpp | 4 ++-- engines/mortevielle/mor.cpp | 16 ++++++++-------- engines/mortevielle/mouse.cpp | 16 ++++++++-------- engines/mortevielle/outtext.cpp | 12 ++++++------ engines/mortevielle/ovd1.cpp | 6 +++--- engines/mortevielle/parole.cpp | 6 +++--- engines/mortevielle/parole2.cpp | 4 ++-- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 2 +- 14 files changed, 44 insertions(+), 44 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index ab3481d2e3..ddfd432237 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1049,7 +1049,7 @@ L2: x = x * (3 - res); if (x > 319) cx = 41; else cx = 1; - cy = succ(int, (cardinal)y >> 3); /* 0-199 => 1-25 */ + cy = succ(int, (uint)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; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index ec7c5f0721..c939da6f9c 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -89,7 +89,7 @@ static void fait_boite(int lidep, int nli, int tx) { int x, y, xx, yy; if (tx > 640) tx = 640; - x = 320 - ((cardinal)tx >> 1); + x = 320 - ((uint)tx >> 1); y = pred(int, lidep) << 3; xx = x + tx; yy = y + (nli << 3); @@ -163,15 +163,15 @@ int do_alert(Common::String str_, int n) { } while (!(chaine[i] == ']')); } if (nbcase == 1) esp = nbcol - 40; - else esp = (cardinal)(nbcol - nbcase * 40) >> 1; - coldep = 320 - ((cardinal)nbcol >> 1) + ((cardinal)esp >> 1); + else esp = (uint)(nbcol - nbcase * 40) >> 1; + coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); fait_choix(cas, coldep, nbcase, s, esp); - limit[1][1] = ((cardinal)(coldep) >> 1) * res; + limit[1][1] = ((uint)(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][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; limit[2][2] = (limit[2][1]) + 40; } show_mouse(); diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 0a37cc7af2..0a3b5dac23 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -38,8 +38,8 @@ void boite(int x, int y, int dx, int dy, int coul) { /* debug('boite'); */ hide_mouse(); if (res == 1) { - x = (cardinal)x >> 1; - dx = (cardinal)dx >> 1; + x = (uint)x >> 1; + dx = (uint)dx >> 1; } xi = x; yi = y; diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index cce1bdeb32..ddb78cbf74 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -50,7 +50,7 @@ int testou() { case '\1': case '\3': case '\5' : { - newgd = (cardinal)pred(int, ord(ch)) >> 1; + newgd = (uint)pred(int, ord(ch)) >> 1; testou_result = 61; return testou_result; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d790bf25e8..e00d8b9fe3 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -156,7 +156,7 @@ void menu_aff() { putpix(gd, x, y + 1, 0); putpix(gd, x, y, color); } - msk = (cardinal)msk >> 1; + msk = (uint)msk >> 1; x = x + 1; } ind_tabl = succ(int, ind_tabl); @@ -229,7 +229,7 @@ void util(int x, int y) { else ix = 3; xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { - ix = pred(int, (cardinal)y >> 3) + (msg3 << 8); + ix = pred(int, (uint)y >> 3) + (msg3 << 8); if (ix != msg4) { invers(1); msg4 = ix; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 083187ea9d..75add66e6a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -54,9 +54,9 @@ int readclock() { r.ax = 0x2c00; intr(0x21, r); { - h = (cardinal)r.cx >> 8; + h = (uint)r.cx >> 8; m = r.cx % 256; - s = (cardinal)r.dx >> 8; + s = (uint)r.dx >> 8; } m = m * 60; h = h * 3600; @@ -285,7 +285,7 @@ void clsf10() { else if (s.conf > 65) st = "Malsaine"; if (res == 1) co = 10; else co = 6; - co = 574 - ((cardinal)co * length(st) >> 1); + co = 574 - ((uint)co * length(st) >> 1); putxy(co, 92); writeg(st, 4); if (res == 1) co = 620; @@ -331,7 +331,7 @@ void calch(int &j, int &h, int &m) { nh = readclock(); th = jh + ((nh - mh) / t); m = ((th % 2) + vm) * 30; - h = ((cardinal)th >> 1) + vh; + h = ((uint)th >> 1) + vh; if (m == 60) { m = 0; h = h + 1; @@ -347,7 +347,7 @@ void conv(int x, int &y) { cx = 1; y = 128; while (cx < x) { - y = (cardinal)y >> 1; + y = (uint)y >> 1; cx = succ(int, cx); } } @@ -656,12 +656,12 @@ void pendule() { 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); + if (min == 0) droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); + else droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); h = heu; if (h > 12) h = h - 12; if (h == 0) h = 12; - droite(((cardinal)x >> 1)*res, y, ((cardinal)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); + droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); show_mouse(); putxy(568, 154); if (heu > 11) writeg("PM ", 1); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 0a00cc3c76..791920f845 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -98,7 +98,7 @@ void hide_mouse() { switch (gd) { case cga : { k = 0; - j = ((cardinal)y_s >> 1) * 80 + ((cardinal)x_s >> 2); + j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { memw[0xb000 + j] = s_s[0][k]; memw[0xb800 + j + 2] = s_s[1][k]; @@ -150,7 +150,7 @@ void hide_mouse() { } break; case her : { - j = ((cardinal)y_s >> 1) * 80 + ((cardinal)x_s >> 3); + j = ((uint)y_s >> 1) * 80 + ((uint)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; @@ -158,7 +158,7 @@ void hide_mouse() { } break; case tan : { - j = ((cardinal)y_s >> 2) * 160 + ((cardinal)x_s >> 1); + j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { for (i = 0; i <= 3; i ++) { @@ -189,7 +189,7 @@ void show_mouse() { switch (gd) { case cga : { k = 0; - j = ((cardinal)y_s >> 1) * 80 + ((cardinal)x_s >> 2); + j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { s_s[0][k] = memw[0xb800 + j]; s_s[1][k] = memw[0xb800 + j + 2]; @@ -237,7 +237,7 @@ void show_mouse() { } break; case her : { - j = ((cardinal)y_s >> 1) * 80 + ((cardinal)x_s >> 3); + j = ((uint)y_s >> 1) * 80 + ((uint)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; @@ -245,7 +245,7 @@ void show_mouse() { } break; case tan : { - j = ((cardinal)y_s >> 2) * 160 + ((cardinal)x_s >> 1); + j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { for (i = 0; i <= 3; i ++) { @@ -282,14 +282,14 @@ void pos_mouse(int x, int y) { y_s = y; switch (gd) { case ams : { - p_o_s = ((cardinal)y_s >> 1) * 80 + ((cardinal)x_s >> 3) + (y_s & 1) * 0x2000; + p_o_s = ((uint)y_s >> 1) * 80 + ((uint)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); + p_o_s = y_s * 80 + ((uint)x_s >> 3); } break; } /* case Gd */ diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 84149699fd..adb094235b 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -71,15 +71,15 @@ static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { /* 5-8 */ oct = t_mot[ind]; - oct = (cardinal)(oct << (16 - pt)) >> (16 - pt); + oct = (uint)(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); + oct = oct | ((uint)t_mot[ind] >> pt); } else { pt = pt - 5; - oct = (cardinal)oct >> pt; + oct = (uint)oct >> pt; } switch (oct) { @@ -91,15 +91,15 @@ static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { case 30: case 31 : { ocd = t_mot[ind]; - ocd = (cardinal)(ocd << (16 - pt)) >> (16 - pt); + ocd = (uint)(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); + ocd = ocd | ((uint)t_mot[ind] >> pt); } else { pt = pt - 5; - ocd = (cardinal)ocd >> pt; + ocd = (uint)ocd >> pt; } if (oct == 30) c = chr(tab30[ocd]); else c = chr(tab31[ocd]); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 5198d7f6e8..09855440e5 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -153,8 +153,8 @@ void ani50() { nhom &with = palcga[j].a[i]; fb >> b; - with.n = (cardinal)b >> 4; - with.hom[0] = ((cardinal)b >> 2) & 3; + with.n = (uint)b >> 4; + with.hom[0] = ((uint)b >> 2) & 3; with.hom[1] = b & 3; } } @@ -236,7 +236,7 @@ void ani50() { case '\1': case '\3': case '\5' : - gd = (cardinal)ord(ch) >> 1; + gd = (uint)ord(ch) >> 1; break; case '\10' : gd = her; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 3f92d78671..c2c9222592 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -30,13 +30,13 @@ namespace Mortevielle { void spfrac(int wor) { - c3.rep = (cardinal)wor >> 12; + c3.rep = (uint)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; + c3.freq = ((uint)wor >> 6) & 7; + c3.acc = ((uint)wor >> 9) & 7; } void charg_car() { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 8685feb39f..ead95762eb 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -56,13 +56,13 @@ void trait_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_tcph = (uint)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))); + } while (!(ptr_tcph >= ((uint)lefin >> 1))); ptr_oct = 0; ptr_word = 0; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 08b63fe3aa..42977c47b5 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -267,7 +267,7 @@ void tecran() { erase_menu(); imen = false; if (set::of('\1', '\3', '\5', '\7', '\11', eos).has(inkey)) { - change_gd((cardinal)pred(int, ord(inkey)) >> 1); + change_gd((uint)pred(int, ord(inkey)) >> 1); return; } if (choisi && (msg[3] == sauve)) sv_game(msg[4] & 7); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 0a19301173..6a937e2e93 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -177,7 +177,7 @@ void taffich() { if (gd == her) { for (i = 0; i <= 15; i ++) { palh = memw[0x7000 + (succ(int, i) << 1)]; - alllum[i] = (palh & 15) + (((cardinal)palh >> 12) & 15) + (((cardinal)palh >> 8) & 15); + alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (i = 0; i <= 15; i ++) { k = 0; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 89ebda43e1..9bd43beb05 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -297,7 +297,7 @@ void hirs() { /* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ void affcar(int gd, int x, int y, int coul, int chr) { - if (res == 1) affput(1, gd, ((cardinal)x >> 1), y, coul, chr); + if (res == 1) affput(1, gd, ((uint)x >> 1), y, coul, chr); else affput(1, gd, x, y, coul, chr); } -- cgit v1.2.3 From b4934ea1bf3cdb6703749b33dddf758d8a399e0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 22:27:14 +1100 Subject: MORTEVIELLE: Compilation fixes and extern prefixes to header file method declarations --- engines/mortevielle/actions.h | 62 ++++++++-------- engines/mortevielle/alert.cpp | 3 +- engines/mortevielle/alert.h | 4 +- engines/mortevielle/boite.h | 2 +- engines/mortevielle/disk.h | 8 +- engines/mortevielle/droite.h | 2 +- engines/mortevielle/keyboard.h | 6 +- engines/mortevielle/level15.h | 34 +++++---- engines/mortevielle/menu.h | 22 +++--- engines/mortevielle/mor.h | 164 ++++++++++++++++++++--------------------- engines/mortevielle/mor2.h | 84 ++++++++++----------- engines/mortevielle/mort.h | 4 +- engines/mortevielle/mouse.cpp | 15 ++-- engines/mortevielle/mouse.h | 14 ++-- engines/mortevielle/outtext.h | 8 +- engines/mortevielle/ovd1.h | 28 +++---- engines/mortevielle/parole.h | 20 ++--- engines/mortevielle/parole2.h | 8 +- engines/mortevielle/prog.h | 14 ++-- engines/mortevielle/ques.h | 2 +- engines/mortevielle/sprint.h | 7 +- engines/mortevielle/taffich.h | 7 +- engines/mortevielle/var_mor.h | 6 ++ 23 files changed, 268 insertions(+), 256 deletions(-) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index 690de1d80e..904a58d87c 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -31,38 +31,38 @@ namespace Mortevielle { /* NIVEAU 4 */ -void taller(); -void tprendre(); -void tsprendre(); -void tsoulever(); -void tlire(); -void tslire(); -void tregarder(); -void tsregarder(); -void tfouiller(); -void tsfouiller(); -void touvrir(); -void tmettre(); -void ttourner(); -void tcacher(); -void tattacher(); -void tfermer(); -void tfrapper(); -void tposer(); -void tecouter(); -void tmanger(); -void tentrer(); -void tdormir(); -void tdefoncer(); -void tsortir(); -void tattendre(); -void tsonder(); -void tparler(); -void tsentir(); -void tgratter(); +extern void taller(); +extern void tprendre(); +extern void tsprendre(); +extern void tsoulever(); +extern void tlire(); +extern void tslire(); +extern void tregarder(); +extern void tsregarder(); +extern void tfouiller(); +extern void tsfouiller(); +extern void touvrir(); +extern void tmettre(); +extern void ttourner(); +extern void tcacher(); +extern void tattacher(); +extern void tfermer(); +extern void tfrapper(); +extern void tposer(); +extern void tecouter(); +extern void tmanger(); +extern void tentrer(); +extern void tdormir(); +extern void tdefoncer(); +extern void tsortir(); +extern void tattendre(); +extern void tsonder(); +extern void tparler(); +extern void tsentir(); +extern void tgratter(); /* NIVEAU 2 */ -void tmaj1(); -void tencore(); +extern void tmaj1(); +extern void tencore(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index c939da6f9c..45c1b355a2 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -25,8 +25,9 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "mortevielle/alert.h" #include "common/str.h" +#include "mortevielle/alert.h" +#include "mortevielle/level15.h" namespace Mortevielle { diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h index 4c53b14416..f7a9e7d1c1 100644 --- a/engines/mortevielle/alert.h +++ b/engines/mortevielle/alert.h @@ -32,8 +32,8 @@ namespace Mortevielle { -int do_alert(Common::String str_, int n); -int do_alert(Common::String str_, int n); +extern int do_alert(Common::String str_, int n); +extern int do_alert(Common::String str_, int n); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/boite.h b/engines/mortevielle/boite.h index d0e7b0e2e3..d4a1d1e45f 100644 --- a/engines/mortevielle/boite.h +++ b/engines/mortevielle/boite.h @@ -30,7 +30,7 @@ namespace Mortevielle { -void boite(int x, int y, int dx, int dy, int coul); +extern void boite(int x, int y, int dx, int dy, int coul); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/disk.h b/engines/mortevielle/disk.h index 464c3b7e1a..06df8e029a 100644 --- a/engines/mortevielle/disk.h +++ b/engines/mortevielle/disk.h @@ -30,10 +30,10 @@ namespace Mortevielle { -void dem1(); -void takesav(int n); -void ld_game(int n); -void sv_game(int n); +extern void dem1(); +extern void takesav(int n); +extern void ld_game(int n); +extern void sv_game(int n); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/droite.h b/engines/mortevielle/droite.h index 73ed30d1ad..6017f481cd 100644 --- a/engines/mortevielle/droite.h +++ b/engines/mortevielle/droite.h @@ -30,7 +30,7 @@ namespace Mortevielle { -void droite(int x, int y, int xx, int yy, int coul); +extern void droite(int x, int y, int xx, int yy, int coul); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/keyboard.h b/engines/mortevielle/keyboard.h index fbef23feb0..7b2510fe06 100644 --- a/engines/mortevielle/keyboard.h +++ b/engines/mortevielle/keyboard.h @@ -30,9 +30,9 @@ namespace Mortevielle { -char readkey1(); -int testou(); -void teskbd(); +extern char readkey1(); +extern int testou(); +extern void teskbd(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h index 73a9d3f32b..aee94c9c09 100644 --- a/engines/mortevielle/level15.h +++ b/engines/mortevielle/level15.h @@ -28,25 +28,27 @@ #ifndef MORTEVIELLE_LEVEL15_H #define MORTEVIELLE_LEVEL15_H +#include "mortevielle/var_mor.h" + namespace Mortevielle { /* NIVEAU 15 */ -void copcha(); -bool dans_rect(rectangle r); -void outbloc(int n, pattern p, t_nhom pal); -void writepal(int n); -void pictout(int seg, int dep, int x, int y); -void putxy(int x, int y); -// int calad(int x, int y); -void sauvecr(int y, int dy); -void charecr(int y, int dy); -// int peek(int ad); -// int peekw(int ad); -// real peekl(int ad); -// void procedure poke(int ad, int n); -void adzon(); -int animof(int ouf, int num); -// void affgd(int offs, int dep, int x, int y); +extern void copcha(); +extern bool dans_rect(rectangle r); +extern void outbloc(int n, pattern p, t_nhom pal); +extern void writepal(int n); +extern void pictout(int seg, int dep, int x, int y); +extern void putxy(int x, int y); +// extern int calad(int x, int y); +extern void sauvecr(int y, int dy); +extern void charecr(int y, int dy); +// extern int peek(int ad); +// extern int peekw(int ad); +// extern real peekl(int ad); +// extern void procedure poke(int ad, int n); +extern void adzon(); +extern int animof(int ouf, int num); +// extern void affgd(int offs, int dep, int x, int y); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 2b548a2f35..1ea6931c0e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -33,17 +33,17 @@ namespace Mortevielle { /* NIVEAU 14*/ -void menut(int no, Common::String nom); -void menu_disable(int no); -void menu_enable(int no); -void menu_aff(); -void draw_menu(); -void invers(int ix); -void util(int x, int y); -void menu_down(int ii); -void menu_up(int xx); -void erase_menu(); -void mdn(); +extern void menut(int no, Common::String nom); +extern void menu_disable(int no); +extern void menu_enable(int no); +extern void menu_aff(); +extern void draw_menu(); +extern void invers(int ix); +extern void util(int x, int y); +extern void menu_down(int ii); +extern void menu_up(int xx); +extern void erase_menu(); +extern void mdn(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 88e718b853..cabc3c4e92 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -33,95 +33,95 @@ namespace Mortevielle { /* Niveau 14 suite */ -void testfi(); -int readclock(); -void modif(int &nu); -void dessine(int ad, int x, int y); -void dessine_rouleau(); -void text_color(int c); +extern void testfi(); +extern int readclock(); +extern void modif(int &nu); +extern void dessine(int ad, int x, int y); +extern void dessine_rouleau(); +extern void text_color(int c); /* NIVEAU 13 */ -void text1(int x, int y, int nb, int m); -void initouv(); -void ecrf1(); -void clsf1(); -void clsf2(); -void ecrf2(); -void ecr2(Common::String str_); -void clsf3(); -void ecr3(Common::String text); -void ecrf6(); -void ecrf7(); -void clsf10(); -void stop(); -void paint_rect(int x, int y, int dx, int dy); -int hazard(int min, int max); -void calch(int &j, int &h, int &m); -void conv(int x, int &y); +extern void text1(int x, int y, int nb, int m); +extern void initouv(); +extern void ecrf1(); +extern void clsf1(); +extern void clsf2(); +extern void ecrf2(); +extern void ecr2(Common::String str_); +extern void clsf3(); +extern void ecr3(Common::String text); +extern void ecrf6(); +extern void ecrf7(); +extern void clsf10(); +extern void stop(); +extern void paint_rect(int x, int y, int dx, int dy); +extern int hazard(int min, int max); +extern void calch(int &j, int &h, int &m); +extern void conv(int x, int &y); /* NIVEAU 12 */ -void okpas(); -void modobj(int m); -void modobj2(int m, bool t1, bool t2); -void repon(int f, int m); -void f3f8(); -void t5(int cx); -void affper(int per); -void choix(int min, int max, int &per); -void cpl1(int &p); -void cpl2(int &p); -void cpl3(int &p); -void cpl5(int &p); -void cpl6(int &p); -void person(); -void chlm(int &per); -void pendule(); +extern void okpas(); +extern void modobj(int m); +extern void modobj2(int m, bool t1, bool t2); +extern void repon(int f, int m); +extern void f3f8(); +extern void t5(int cx); +extern void affper(int per); +extern void choix(int min, int max, int &per); +extern void cpl1(int &p); +extern void cpl2(int &p); +extern void cpl3(int &p); +extern void cpl5(int &p); +extern void cpl6(int &p); +extern void person(); +extern void chlm(int &per); +extern void pendule(); /************* * NIVEAU 11 * *************/ -void debloc(int l); -void cpl10(int &p, int &h); -void cpl11(int &p, int &h); -void cpl12(int &p); -void cpl13(int &p); -void cpl15(int &p); -void cpl20(int &p, int &h); -void quelq1(int l); -void quelq2(); -void quelq5(); -void quelq6(int l); -void quelq10(int h, int &per); -void quelq11(int h, int &per); -void quelq12(int &per); -void quelq15(int &per); -void quelq20(int h, int &per); -void frap(); -void nouvp(int l, int &p); -void tip(int ip, int &cx); -void ecfren(int &p, int &haz, int cf, int l); -void becfren(int l); +extern void debloc(int l); +extern void cpl10(int &p, int &h); +extern void cpl11(int &p, int &h); +extern void cpl12(int &p); +extern void cpl13(int &p); +extern void cpl15(int &p); +extern void cpl20(int &p, int &h); +extern void quelq1(int l); +extern void quelq2(); +extern void quelq5(); +extern void quelq6(int l); +extern void quelq10(int h, int &per); +extern void quelq11(int h, int &per); +extern void quelq12(int &per); +extern void quelq15(int &per); +extern void quelq20(int h, int &per); +extern void frap(); +extern void nouvp(int l, int &p); +extern void tip(int ip, int &cx); +extern void ecfren(int &p, int &haz, int cf, int l); +extern void becfren(int l); /* NIVEAU 10 */ -void init_nbrepm(); -void phaz(int &haz, int &p, int cf); -void inzon(); -void dprog(); -void pl1(int cf); -void pl2(int cf); -void pl5(int cf); -void pl6(int cf); -void pl9(int cf); -void pl10(int cf); -void pl11(int cf); -void pl12(int cf); -void pl13(int cf); -void pl15(int cf); -void pl20(int cf); -void t11(int l11, int &a); -void cavegre(); -void writetp(Common::String s, int t); -void messint(int nu); -void aniof(int ouf, int num); -void musique(int so); +extern void init_nbrepm(); +extern void phaz(int &haz, int &p, int cf); +extern void inzon(); +extern void dprog(); +extern void pl1(int cf); +extern void pl2(int cf); +extern void pl5(int cf); +extern void pl6(int cf); +extern void pl9(int cf); +extern void pl10(int cf); +extern void pl11(int cf); +extern void pl12(int cf); +extern void pl13(int cf); +extern void pl15(int cf); +extern void pl20(int cf); +extern void t11(int l11, int &a); +extern void cavegre(); +extern void writetp(Common::String s, int t); +extern void messint(int nu); +extern void aniof(int ouf, int num); +extern void musique(int so); /* NIVEAU 9 */ -void dessin(int ad); +extern void dessin(int ad); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index a1732a16d4..6668d54113 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -30,52 +30,52 @@ namespace Mortevielle { -void tinke(); -void fenat(char ans); +extern void tinke(); +extern void fenat(char ans); /* NIVEAU 8 */ -void afdes(int ad); -void tkey1(bool d); -void tmlieu(int mli); +extern void afdes(int ad); +extern void tkey1(bool d); +extern void tmlieu(int mli); /* NIVEAU 7 */ -void tlu(int af, int ob); -void delin(int n); -void affrep(); -void mfouen(); -void atf3f8(int &key); +extern void tlu(int af, int ob); +extern void delin(int n); +extern void affrep(); +extern void mfouen(); +extern void atf3f8(int &key); /* NIVEAU 6 */ -void tperd(); -void tsort(); -void st4(int ob); -void cherjer(int ob, bool &d); -void st1sama(); -void modinv(); -void sparl(float adr, float rep); -void finfouil(); -void mfoudi(); -void mennor(); -void premtet(); +extern void tperd(); +extern void tsort(); +extern void st4(int ob); +extern void cherjer(int ob, bool &d); +extern void st1sama(); +extern void modinv(); +extern void sparl(float adr, float rep); +extern void finfouil(); +extern void mfoudi(); +extern void mennor(); +extern void premtet(); /* NIVEAU 5 */ -void ajchai(); -void ajjer(int ob); -void t1sama(); -void t1vier(); -void t1neig(); -void t1deva(); -void t1derr(); -void t1deau(); -void tctrm(); -void quelquun(); -void tsuiv(); -void tfleche(); -void tcoord(int sx); -void st7(int ob); -void treg(int ob); -void avpoing(int &ob); -void rechai(int &ch); -void t23coul(int &l); -void maivid(); -void st13(int ob); -void aldepl(); +extern void ajchai(); +extern void ajjer(int ob); +extern void t1sama(); +extern void t1vier(); +extern void t1neig(); +extern void t1deva(); +extern void t1derr(); +extern void t1deau(); +extern void tctrm(); +extern void quelquun(); +extern void tsuiv(); +extern void tfleche(); +extern void tcoord(int sx); +extern void st7(int ob); +extern void treg(int ob); +extern void avpoing(int &ob); +extern void rechai(int &ch); +extern void t23coul(int &l); +extern void maivid(); +extern void st13(int ob); +extern void aldepl(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mort.h b/engines/mortevielle/mort.h index 0b78deb028..fa42288963 100644 --- a/engines/mortevielle/mort.h +++ b/engines/mortevielle/mort.h @@ -30,9 +30,9 @@ namespace Mortevielle { -void divers(int np, bool b); +extern void divers(int np, bool b); /* NIVEAU 0 */ -int main(int argc, const char *argv[]); +extern int main(int argc, const char *argv[]); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 791920f845..a6b1768b96 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -336,7 +336,7 @@ void mov_mouse(bool &funct, char &key) { while (p_key) { input >> kbd >> in1; read_pos_mouse(cx, cy, cd); - switch (upcase(in1)) { + switch (toupper(in1)) { case '4' : cx = cx - 8; break; @@ -382,6 +382,13 @@ void mov_mouse(bool &funct, char &key) { break; case '\33' : { p_key = keypressed(); + + if ((p_key >= ';') && (p_key <= 'D')) { + funct = true; + key = in2; + return; + } + if (p_key) { input >> kbd >> in2; switch (in2) { @@ -397,12 +404,6 @@ void mov_mouse(bool &funct, char &key) { case 'H' : cy = pred(int, cy); break; - case RANGE_10(';', 'D') : { - funct = true; - key = in2; - return; - } - break; case 'G' : { cx = cx - 1; cy = cy - 1; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 90fe91e373..33fd280561 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -31,13 +31,13 @@ namespace Mortevielle { void init_mouse(); -//void change_mouse(int t); -//void dessine_souris(int xf, int yf); -void hide_mouse(); -void show_mouse(); -void pos_mouse(int x, int y); -void read_pos_mouse(int &x, int &y, int &c); -void mov_mouse(bool &funct, char &key); +//extern void change_mouse(int t); +//extern void dessine_souris(int xf, int yf); +extern void hide_mouse(); +extern void show_mouse(); +extern void pos_mouse(int x, int y); +extern void read_pos_mouse(int &x, int &y, int &c); +extern void mov_mouse(bool &funct, char &key); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 14ef8c6c7e..45b5745bbf 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -32,10 +32,10 @@ namespace Mortevielle { -static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); -void deline(int num , char *l , int &tl); -static int l_motsuiv(int p, char *ch, int &tab); -void afftex(char *ch, int x, int y, int dx, int dy, int typ); +//static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); +extern void deline(int num , char *l , int &tl); +//static int l_motsuiv(int p, char *ch, int &tab); +extern void afftex(char *ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 4cad37c0ab..96239ed3d5 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -30,20 +30,20 @@ namespace Mortevielle { -void dem2(); -void ani50(); -//void apzuul(); -void aff50(bool c); -void init_menu(); -void charpal(); -void chartex(); -void dialpre(); -void init_lieu(); -void music(); -void charge_bruit5(); -void charge_cfiec(); -void charge_cfiph(); -void suite(); +extern void dem2(); +extern void ani50(); +//extern void apzuul(); +extern void aff50(bool c); +extern void init_menu(); +extern void charpal(); +extern void chartex(); +extern void dialpre(); +extern void init_lieu(); +extern void music(); +extern void charge_bruit5(); +extern void charge_cfiec(); +extern void charge_cfiph(); +extern void suite(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h index b0282e15bd..daea40cbf0 100644 --- a/engines/mortevielle/parole.h +++ b/engines/mortevielle/parole.h @@ -30,16 +30,16 @@ namespace Mortevielle { -void spfrac(int wor); -void charg_car(); -void entroct(byte o); -void veracf(byte b); -void cctable(tablint &t); -void regenbruit(); -void charge_son(); -void charge_phbruit(); -void charge_bruit(); -void trait_car(); +extern void spfrac(int wor); +extern void charg_car(); +extern void entroct(byte o); +extern void veracf(byte b); +extern void cctable(tablint &t); +extern void regenbruit(); +extern void charge_son(); +extern void charge_phbruit(); +extern void charge_bruit(); +extern void trait_car(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h index ed7108f3b8..01cf277422 100644 --- a/engines/mortevielle/parole2.h +++ b/engines/mortevielle/parole2.h @@ -30,10 +30,10 @@ namespace Mortevielle { -void rot_chariot(); -void init_chariot(); -void trait_ph(); -void parole(int rep, int ht, int typ); +extern void rot_chariot(); +extern void init_chariot(); +extern void trait_ph(); +extern void parole(int rep, int ht, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h index 4fccca4f65..fbcd92f469 100644 --- a/engines/mortevielle/prog.h +++ b/engines/mortevielle/prog.h @@ -30,18 +30,18 @@ namespace Mortevielle { -void change_gd(int ngd); -void antegame(); +extern void change_gd(int ngd); +extern void antegame(); /* NIVEAU 3 */ /* procedure PROGRAMME */ -void tmaj3(); -void tsitu(); -void tecran(); +extern void tmaj3(); +extern void tsitu(); +extern void tecran(); /* NIVEAU 1 */ -void theure(); -void tjouer(); +extern void theure(); +extern void tjouer(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ques.h b/engines/mortevielle/ques.h index f748d3e0b5..7260bfa6a2 100644 --- a/engines/mortevielle/ques.h +++ b/engines/mortevielle/ques.h @@ -32,7 +32,7 @@ namespace Mortevielle { -bool ques(); +extern bool ques(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h index 42259f0593..8484214fa3 100644 --- a/engines/mortevielle/sprint.h +++ b/engines/mortevielle/sprint.h @@ -32,8 +32,9 @@ namespace Mortevielle { -void fill_box(int x, int y, int dx); -void clear_box(int x, int y, int dx); -void writeg(Common::String l, int c); +extern void fill_box(int x, int y, int dx); +extern void clear_box(int x, int y, int dx); +extern void writeg(Common::String l, int c); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h index 41f0612a4f..bea3c09f2a 100644 --- a/engines/mortevielle/taffich.h +++ b/engines/mortevielle/taffich.h @@ -32,9 +32,10 @@ namespace Mortevielle { -void chardes(Common::String nom, float passe, int long_); -void charani(Common::String nom, float passe, int long_); -void taffich(); +extern void chardes(Common::String nom, float passe, int long_); +extern void charani(Common::String nom, float passe, int long_); +extern void taffich(); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 59d98fe58e..6b4ae2f70a 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -41,6 +41,12 @@ namespace Mortevielle { musique & paroles Oct 88 ) */ +/*---------------------------------------------------------------------------*/ +/*------------------------- DEFINES ----------------------------------*/ +/*---------------------------------------------------------------------------*/ + +#define pred(type, v) (v - 1) +#define succ(type, v) (v + 1) /*---------------------------------------------------------------------------*/ /*------------------------- CONSTANTS ----------------------------------*/ -- cgit v1.2.3 From 1a0e3b571af1f21c6a03b0e789c3fea7dc8a93d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 22:40:45 +1100 Subject: MORTEVIELLE: Compilation fixes based on adding appropriate #include files --- engines/mortevielle/actions.cpp | 3 ++- engines/mortevielle/alert.cpp | 10 +++++----- engines/mortevielle/keyboard.cpp | 1 + engines/mortevielle/menu.cpp | 7 +++++-- engines/mortevielle/mor.cpp | 7 ++++--- engines/mortevielle/parole.h | 2 ++ engines/mortevielle/parole2.cpp | 1 + engines/mortevielle/prog.cpp | 1 + engines/mortevielle/sprint.cpp | 3 ++- engines/mortevielle/var_mor.h | 4 ++++ 10 files changed, 27 insertions(+), 12 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index ddfd432237..146542a5f7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/scummsys.h" #include "mortevielle/actions.h" #include "mortevielle/alert.h" #include "mortevielle/mor.h" @@ -349,7 +350,7 @@ L2: } /* overlay */ void tfouiller() { - const byte[14] r = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; + const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; int cx; if (caff > 99) { diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 45c1b355a2..1c7ae91995 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -101,23 +101,23 @@ static void fait_boite(int lidep, int nli, int tx) { -static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String[] &s, int &esp) { +static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String *&str, int &esp) { int i, l, x; char ch; i = 1; x = coldep; for (l = 1; l <= nbcase; l ++) { - s[l] = ""; + str[l] = ""; do { i = i + 1; ch = c[i]; - s[l] = s[l] + ch; + str[l] = str[l] + ch; } while (!(c[i + 1] == ']')); i = i + 2; - while (length(s[l]) < 3) s[l] = s[l] + ' '; + while (length(str[l]) < 3) str[l] = str[l] + ' '; putxy(x, 98); - writeg(string(' ') + s[l] + ' ', 0); + writeg(string(' ') + str[l] + ' ', 0); x = x + esp + 40; } } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index ddb78cbf74..44af5223a1 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/keyboard.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index e00d8b9fe3..69fc651e70 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -25,8 +25,11 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "mortevielle/menu.h" +#include "common/scummsys.h" #include "common/str.h" +#include "common/textconsole.h" +#include "mortevielle/menu.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { @@ -43,7 +46,7 @@ namespace Mortevielle { s = nom; if (! tesok) { clrscr; - exit(0); + mortevielle_exit(0); } while (length(s) < 30) s = s + ' '; switch (h) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 75add66e6a..195c626e95 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -25,11 +25,12 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" +#include "common/textconsole.h" #include "mortevielle/alert.h" #include "mortevielle/mor.h" #include "mortevielle/outtext.h" #include "mortevielle/var_mor.h" -#include "common/str.h" namespace Mortevielle { @@ -40,7 +41,7 @@ const char m1[] = "quelqu'un entre, parait void testfi() { if (ioresult != 0) { caff = do_alert(err_mess, 1); - exit(0); + mortevielle_exit(0); } } @@ -300,7 +301,7 @@ void stop() { hirs(); gd = ams; hirs(); - exit(0); + mortevielle_exit(0); } void paint_rect(int x, int y, int dx, int dy) { diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h index daea40cbf0..a1467dcad8 100644 --- a/engines/mortevielle/parole.h +++ b/engines/mortevielle/parole.h @@ -28,6 +28,8 @@ #ifndef MORTEVIELLE_PAROLE_H #define MORTEVIELLE_PAROLE_H +#include "common/scummsys.h" + namespace Mortevielle { extern void spfrac(int wor); diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index ead95762eb..b5079f957d 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/parole2.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 42977c47b5..f7f1e0e818 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -27,6 +27,7 @@ #include "mortevielle/mor2.h" #include "mortevielle/prog.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 6209b08f7d..9df1a1894c 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -25,9 +25,10 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" #include "mortevielle/mouse.h" #include "mortevielle/sprint.h" -#include "common/str.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 6b4ae2f70a..fa25962909 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -47,6 +47,10 @@ namespace Mortevielle { #define pred(type, v) (v - 1) #define succ(type, v) (v + 1) +#define ord(v) ((int) v) + +// TODO: Replace with a cleaner shutdown mechanism +#define mortevielle_exit(ret) error("Exit the game") /*---------------------------------------------------------------------------*/ /*------------------------- CONSTANTS ----------------------------------*/ -- cgit v1.2.3 From 6998d530dcf5e691c2624dcb401345743e4c7ed7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 22:52:56 +1100 Subject: MORTEVIELLE: Further bugfixes to include files and added includes --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/mor2.cpp | 2 ++ engines/mortevielle/mouse.h | 2 ++ engines/mortevielle/outtext.h | 2 ++ engines/mortevielle/taffich.cpp | 3 ++- engines/mortevielle/var_mor.h | 5 ++++- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 146542a5f7..359857eeb4 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -986,7 +986,7 @@ L2: /* overlay */ void tparler() { - array<1, 46, bool> te; + bool te[47]; int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; char tou; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index b6c3ee93fe..50d12452a5 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -27,6 +27,8 @@ #include "mortevielle/mor2.h" #include "mortevielle/var_mor.h" +#include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" namespace Mortevielle { diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 33fd280561..2a22d04e4c 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -30,6 +30,8 @@ namespace Mortevielle { +extern bool clic; + void init_mouse(); //extern void change_mouse(int t); //extern void dessine_souris(int xf, int yf); diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 45b5745bbf..ad69ca9109 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -32,6 +32,8 @@ namespace Mortevielle { +extern Common::String delig; + //static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); extern void deline(int num , char *l , int &tl); //static int l_motsuiv(int p, char *ch, int &tab); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 6a937e2e93..85b2157b6e 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -25,8 +25,9 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "mortevielle/taffich.h" #include "common/str.h" +#include "mortevielle/taffich.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index fa25962909..88b42a845f 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -49,8 +49,9 @@ namespace Mortevielle { #define succ(type, v) (v + 1) #define ord(v) ((int) v) -// TODO: Replace with a cleaner shutdown mechanism +// TODO: Replace the following with proper implementations #define mortevielle_exit(ret) error("Exit the game") +#define clrscr {} /*---------------------------------------------------------------------------*/ /*------------------------- CONSTANTS ----------------------------------*/ @@ -222,6 +223,8 @@ struct nhom { byte hom[4]; }; +typedef nhom t_nhom[16]; + struct t_pcga { byte p; nhom a[16]; -- cgit v1.2.3 From c7a1bd48bd3226cfb8ccd92ff7bea1a43210b44b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 23:09:21 +1100 Subject: MORTEVIELLE: Replaced all set::of forms with proper C if statements --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/alert.cpp | 2 +- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/menu.cpp | 5 +++-- engines/mortevielle/mor.cpp | 8 +++++--- engines/mortevielle/outtext.cpp | 3 ++- engines/mortevielle/ovd1.cpp | 7 ++++--- engines/mortevielle/parole.cpp | 8 ++++---- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/taffich.cpp | 6 ++++-- 10 files changed, 26 insertions(+), 19 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 359857eeb4..ff986a946a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1051,7 +1051,7 @@ L2: if (x > 319) cx = 41; else cx = 1; cy = succ(int, (uint)y >> 3); /* 0-199 => 1-25 */ - if ((cy > 23) || ((cx == 41) && (set::of(range(20, 22), eos).has(cy)))) { + if ((cy > 23) || ((cx == 41) && ((cy >= 20) && (cy <= 22)))) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; if (choi > 23) co = 320; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 1c7ae91995..d003ccbc12 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -151,7 +151,7 @@ int do_alert(Common::String str_, int n) { do { cx = 320; st = ""; - while (!(set::of('\174', '\135', eos).has(chaine[i + 1]))) { + while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { i = i + 1; st = st + chaine[i]; if (res == 2) cx = cx - 3; diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 44af5223a1..701f99cec7 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -69,7 +69,7 @@ int testou() { } break; case '\26' : - if (set::of(1, 2, eos).has(c_zzz)) { + if ((c_zzz == 1) && (c_zzz == 2)) { zzuul(adcfiec + 161, 0, 1644); c_zzz = succ(int, c_zzz); testou_result = 61; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 69fc651e70..df4085671b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -327,7 +327,8 @@ void mdn() { xprec = x; yprec = y; } - tes = (y < 11) && ((set::of(range(28 * res, 28 * res + 24), range(76 * res, 76 * res + 24), eos).has(x)) + tes = (y < 11) && ((x >= (28 * res) && x <= (28 * res + 24)) + || (x >= (76 * res) && x <= (76 * res + 24)) || ((x > 124 * res) && (x < 124 * res + 24)) || ((x > 172 * res) && (x < 172 * res + 24)) || ((x > 220 * res) && (x < 220 * res + 24)) @@ -340,7 +341,7 @@ void mdn() { else if (x < 268 * res) ix = discut; else ix = fichier; if ((ix != msg3) || (! test0)) - if (!((ix == fichier) && (set::of(sauve, charge, eos).has(msg3)))) { + if (!((ix == fichier) && ((msg3 == sauve) || (msg3 == charge)))) { menu_up(msg3); menu_down(ix); msg3 = ix; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 195c626e95..f8454e6446 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -422,7 +422,7 @@ void repon(int f, int m) { } } } - if (set::of(6, 9, eos).has(f)) { + if ((f >= 6) && (f <= 9)) { deline(m, st, tay); if (f == 6) i = 4; else i = 5; @@ -655,7 +655,8 @@ void pendule() { 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; + if ((gd == cga) || (gd == her)) + co = 0; else co = 1; if (min == 0) droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); else droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); @@ -668,7 +669,8 @@ void pendule() { 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); + if ((jou >= 0) && (jou <= 8)) + writeg(string(chr(jou + 49)) + "& jour", 1); } /************* diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index adb094235b..ba0c956c1a 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -149,7 +149,8 @@ static int l_motsuiv(int p, char *ch, int &tab) { int l_motsuiv_result; c = p; - while (!(set::of(' ', '$', '@', eos).has(ch[p]))) p = p + 1; + while ((ch[p] != ' ') && (ch[p] != '$') && (ch[p] != '@')) + ++p; l_motsuiv_result = tab * (p - c); return l_motsuiv_result; } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 09855440e5..906600f44c 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -231,7 +231,7 @@ void ani50() { output << "Ctrl C E H T A"; do { input >> kbd >> ch; - } while (!(set::of('\1', '\3', '\5', '\24', '\10', eos).has(ch))); + } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); switch (ch) { case '\1': case '\3': @@ -258,7 +258,7 @@ void ani50() { output << 'S'; do { input >> kbd >> ch; - } while (!(set::of('C', 'S', eos).has(upcase(ch)))); + } while ((ch != 'C') && (ch != 'S')); int_m = (upcase(ch) == 'S'); } @@ -361,7 +361,8 @@ void ani50() { gotoxy(20 * pred(int, res) + 8, 24); textcolor(7); cpr = "COPYRIGHT 1989 : LANKHOR"; - if (set::of(ega, ams, cga, eos).has(gd)) output << cpr; + if ((gd == ega) || (gd == ams) || (gd == cga)) + output << cpr; else { putxy(104 + 72 * res, 190); writeg(cpr, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index c2c9222592..6c8f598fd4 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -32,8 +32,8 @@ namespace Mortevielle { void spfrac(int wor) { c3.rep = (uint)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)))) + if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || + ((c3.code < 5) && ((c3.rep != 19) && (c3.rep != 22) && (c3.rep != 4) && (c3.rep != 9))))) { c3.rep = c3.rep + 1; c3.freq = ((uint)wor >> 6) & 7; c3.acc = ((uint)wor >> 9) & 7; @@ -346,7 +346,7 @@ void veracf(byte b) { entroct(d3); entroct(c2.val); entroct(5); - } else if (!(set::of(range(0, 1), 4, eos).has(c3.code))) { + } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { case 3 : @@ -388,7 +388,7 @@ void veracf(byte b) { entroct(2); entroct(c2.val); entroct(5); - } else if (!(set::of(range(0, 1), 4, eos).has(c3.code))) { + } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { case 3 : diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index f7f1e0e818..d5004cdec8 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -267,7 +267,7 @@ void tecran() { erase_menu(); imen = false; - if (set::of('\1', '\3', '\5', '\7', '\11', eos).has(inkey)) { + if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { change_gd((uint)pred(int, ord(inkey)) >> 1); return; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 85b2157b6e..6d6df692cd 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -109,8 +109,10 @@ void taffich() { 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]; + if ((a >= 153) && (a <= 161)) + a = tran2[a]; + else if ((a >= 136) && (a <= 140)) + a = tran1[a]; b = a; if (maff == a) return; if (a == 16) { -- cgit v1.2.3 From fd243358d3e2aaa48da4d4ea8a1080b1ecdd6f15 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 30 Dec 2011 23:42:28 +1100 Subject: MORTEVIELLE: More addition of needed #include lines and other compilation fixes --- engines/mortevielle/actions.cpp | 2 ++ engines/mortevielle/alert.cpp | 13 +++++++------ engines/mortevielle/level15.cpp | 1 + engines/mortevielle/menu.cpp | 4 +++- engines/mortevielle/mor.cpp | 23 ++++++++++++++--------- engines/mortevielle/mor2.cpp | 8 +++++++- engines/mortevielle/mouse.cpp | 2 +- engines/mortevielle/mouse.h | 6 ++++++ engines/mortevielle/outtext.cpp | 1 + engines/mortevielle/prog.cpp | 4 ++++ engines/mortevielle/ques.cpp | 3 ++- engines/mortevielle/sprint.cpp | 4 ++-- engines/mortevielle/taffich.cpp | 1 + engines/mortevielle/var_mor.h | 4 ++++ 14 files changed, 55 insertions(+), 21 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index ff986a946a..b9626b3e6b 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -28,10 +28,12 @@ #include "common/scummsys.h" #include "mortevielle/actions.h" #include "mortevielle/alert.h" +#include "mortevielle/level15.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" +#include "mortevielle/parole2.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index d003ccbc12..c35ba4f62e 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -28,6 +28,7 @@ #include "common/str.h" #include "mortevielle/alert.h" #include "mortevielle/level15.h" +#include "mortevielle/mouse.h" namespace Mortevielle { @@ -35,12 +36,12 @@ namespace Mortevielle { const int nligne = 7; -const matrix<1, 2, 1, 3, int> coord -= {{ {{150, 72, 103}}, - {{143, 107, 183}} - } -}; +const int coord[3][4] = { + {0, 0, 0, 0}, + {0, 150, 72, 103), + {0, 143, 107, 183} +}; static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { @@ -115,7 +116,7 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin str[l] = str[l] + ch; } while (!(c[i + 1] == ']')); i = i + 2; - while (length(str[l]) < 3) str[l] = str[l] + ' '; + while (str[l].size() < 3) str[l] = str[l] + ' '; putxy(x, 98); writeg(string(' ') + str[l] + ' ', 0); x = x + esp + 40; diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 42219ee943..e7a9c2116b 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -27,6 +27,7 @@ #include "mortevielle/level15.h" #include "mortevielle/var_mor.h" +#include "mortevielle/mouse.h" namespace Mortevielle { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index df4085671b..083a16d07a 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -28,7 +28,9 @@ #include "common/scummsys.h" #include "common/str.h" #include "common/textconsole.h" +#include "mortevielle/level15.h" #include "mortevielle/menu.h" +#include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -48,7 +50,7 @@ namespace Mortevielle { clrscr; mortevielle_exit(0); } - while (length(s) < 30) s = s + ' '; + while (s.size() < 30) s = s + ' '; switch (h) { case invent : if (l != 7) inv[l] = string(' ') + s; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index f8454e6446..b4e3fb3082 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -28,8 +28,14 @@ #include "common/str.h" #include "common/textconsole.h" #include "mortevielle/alert.h" +#include "mortevielle/boite.h" +#include "mortevielle/droite.h +#include "mortevielle/level15.h" +#include "mortevielle/menu.h" #include "mortevielle/mor.h" +#include "mortevielle/mouse.h" #include "mortevielle/outtext.h" +#include "mortevielle/parole2.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -219,8 +225,8 @@ void ecr2(Common::String str_) { else tab = 6; putxy(8, 177); tlig = 59 + pred(int, res) * 36; - if (length(str_) < tlig) writeg(str_, 5); - else if (length(str_) < (tlig << 1)) { + if (str_.size() < tlig) writeg(str_, 5); + else if (str_.size() < (tlig << 1)) { putxy(8, 176); writeg(copy(str_, 1, pred(int, tlig)), 5); putxy(8, 182); @@ -286,7 +292,7 @@ void clsf10() { else if (s.conf > 65) st = "Malsaine"; if (res == 1) co = 10; else co = 6; - co = 574 - ((uint)co * length(st) >> 1); + co = 574 - ((uint)co * st.size() >> 1); putxy(co, 92); writeg(st, 4); if (res == 1) co = 620; @@ -638,10 +644,10 @@ void chlm(int &per) { } void pendule() { - const matrix<1, 2, 1, 12, int> 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 int cv[3][13] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 }, + { 0, -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 } }; const int x = 580; const int y = 123; @@ -983,8 +989,7 @@ void debloc(int l) { /* NIVEAU 10 */ void init_nbrepm() { - const array<1, 8, byte> ipm - = {{4, 5, 6, 7, 5, 6, 5, 8}}; + const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; int i; /* debug('init_nbrepm'); */ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 50d12452a5..9b9fa68768 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -26,9 +26,15 @@ */ #include "mortevielle/mor2.h" +#include "mortevielle/alert.h" +#include "mortevielle/boite.h" #include "mortevielle/var_mor.h" +#include "mortevielle/menu.h" +#include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" +#include "mortevielle/parole2.h" +#include "mortevielle/taffich.h" namespace Mortevielle { @@ -211,7 +217,7 @@ void tmlieu(int mli) { cx = v_lieu[i][mli]; deline(cx + c_tmlieu, st, tail); nomp = delig; - while (length(nomp) < 30) nomp = nomp + ' '; + while (nomp.size() < 30) nomp = nomp + ' '; menut(depl[i], nomp); i = i + 1; } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index a6b1768b96..708865ee1a 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -42,7 +42,7 @@ int m_show, p_o_s, mouse_shwn; -matrix<0, 5, 0, 11, int> s_s; +int s_s[12][6]; void init_mouse() { diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 2a22d04e4c..0923c71866 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -32,6 +32,12 @@ namespace Mortevielle { extern bool clic; +extern int m_show, + x_s, + y_s, + p_o_s, + mouse_shwn; + void init_mouse(); //extern void change_mouse(int t); //extern void dessine_souris(int xf, int yf); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index ba0c956c1a..6ec3f8930e 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/outtext.h" +#include "mortevielle/level15.h" #include "mortevielle/var_mor.h" #include "common/str.h" diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index d5004cdec8..d7f95f49eb 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -25,9 +25,13 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/actions.h" +#include "mortevielle/menu.h" +#include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/prog.h" #include "mortevielle/var_mor.h" +#include "mortevielle/mouse.h" namespace Mortevielle { diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 870f8b7435..2a200fb823 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" #include "common/str.h" @@ -89,7 +90,7 @@ namespace Mortevielle { with.y2 = 34 + j * 8; with.etat = true; } - while (length(chaines[j]) < tmax) { + while (chaines[j].size() < tmax) { chaines[j] = chaines[j] + ' '; } } diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 9df1a1894c..406d7bccb4 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -55,7 +55,7 @@ void writeg(Common::String l, int c) yo = ywhere; if (res == 2) i = 6; else i = 10; - x = xo + i * length(l); + x = xo + i * l.size(); switch (c) { case 1: case 3 : { @@ -80,7 +80,7 @@ void writeg(Common::String l, int c) } xo = xo + 1; yo = yo + 1; - for (x = 1; x <= length(l); x ++) { + for (x = 1; x <= l.size(); x ++) { affcar(gd, xo, yo, cecr, ord(l[x])); xo = xo + i; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 6d6df692cd..6969cf6aea 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -26,6 +26,7 @@ */ #include "common/str.h" +#include "mortevielle/mouse.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 88b42a845f..4f8e0fe523 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -48,6 +48,10 @@ namespace Mortevielle { #define pred(type, v) (v - 1) #define succ(type, v) (v + 1) #define ord(v) ((int) v) +#define chr(v) ((char) v) +#define lo(v) (v & 0xff) +#define hi(v) ((v >> 8) & 0xff) +#define odd(v) ((v % 2) == 1) // TODO: Replace the following with proper implementations #define mortevielle_exit(ret) error("Exit the game") -- cgit v1.2.3 From 4837636386e1bcad9fb33e1b16d7345c28047d3c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 16:36:09 +1100 Subject: MORTEVIELLE: Converted some of the file accesses to use Common::File --- engines/mortevielle/alert.cpp | 4 +- engines/mortevielle/disk.cpp | 69 ++++++++++++++++++++++++-------- engines/mortevielle/level15.cpp | 31 ++++++++------- engines/mortevielle/mor.cpp | 2 +- engines/mortevielle/mor2.cpp | 6 ++- engines/mortevielle/ovd1.cpp | 88 ++++++++++++++++++++++------------------- engines/mortevielle/taffich.cpp | 35 +++++++++------- 7 files changed, 144 insertions(+), 91 deletions(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index c35ba4f62e..1a1356747a 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -39,7 +39,7 @@ const int nligne = 7; const int coord[3][4] = { {0, 0, 0, 0}, - {0, 150, 72, 103), + {0, 150, 72, 103}, {0, 143, 107, 183} }; @@ -126,7 +126,7 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin int do_alert(Common::String str_, int n) { int coldep, esp, i, l, nbcase, quoi, ix; Common::String st, chaine; - matrix<1, 2, 1, 2, int> limit; + int limit[3][3]; char c, dumi; Common::String s[3]; int cx, cy, cd, nbcol, nblig; diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 89d01c59c9..daf25d21e9 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -25,17 +25,25 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" +#include "common/system.h" +#include "common/savefile.h" +#include "common/serializer.h" #include "mortevielle/disk.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { +/** + * Ensure disk 1 data is available + */ void dem1() { - untyped_file f; int k; - /* -- demande de disk 1 -- */ +/* Deprecated in ScummVM + // -- demande de disk 1 -- assign(f, "mort.005"); - /*$i-*/ + //*$i-* k = ioresult; reset(f); while (ioresult != 0) { @@ -45,26 +53,47 @@ void dem1() { reset(f); } close(f); + */ +} + +static void sync_save(Common::Serializer &sz) { + sz.syncAsSint16LE(s1.conf); + sz.syncBytes((byte *)&s1.pourc[0], 11); + sz.syncBytes((byte *)&s1.teauto[0], 43); + sz.syncBytes((byte *)&s1.sjer[0], 31); + sz.syncAsSint16LE(s1.mlieu); + sz.syncAsSint16LE(s1.iboul); + sz.syncAsSint16LE(s1.ibag); + sz.syncAsSint16LE(s1.icave); + sz.syncAsSint16LE(s1.ivier); + sz.syncAsSint16LE(s1.ipuit); + sz.syncAsSint16LE(s1.derobj); + sz.syncAsSint16LE(s1.iloic); + sz.syncAsSint16LE(s1.icryp); + sz.syncAsSint16LE(s1.ipre); + sz.syncAsSint16LE(s1.heure); } void takesav(int n) { - untyped_file f; int i; Common::String 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) { + // -- Load the file 'sauve#n.mor' + Common::String saveName = Common::String::format("sav%d.mor", n); + Common::InSaveFile *f = g_system->getSaveManager().openForLoading(st); + + Common::Serializer sz(f, NULL); + sync_save(sz); + + if (f.err()) { i = do_alert(err_mess, 1); - exit(0); + mortevielle_exit(0); } s = s1; for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; - close(f); + + delete f; } void ld_game(int n) { @@ -81,7 +110,7 @@ void ld_game(int n) { } void sv_game(int n) { - untyped_file f; + Common::OutSaveFile *f; int i; hide_mouse(); @@ -91,10 +120,16 @@ void sv_game(int n) { 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); + + Common::String saveName = Common::String::format("sav%d.mor", n); + f = g_system->getSaveFileManager().openForSaving(saveName); + + Common::Serializer sz(NULL, f); + sync_save(sz); + + f->finalize(); + delete f; + dem2(); show_mouse(); } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index e7a9c2116b..b655b7a23e 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" #include "mortevielle/level15.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" @@ -149,35 +150,37 @@ end; */ void adzon() { - untyped_file f; - file g; + Common::File f; +// Common::File g; byte a; int 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); + if (!f.open("don.mor")) + error("Missing file - don.mor"); + f.read(tabdon, 7); + f.close(); + + if (!f.open("bmor.mor")) + error("Missing file - bmor.mor"); + f.read(&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); + f.close(); + + if (!f.open("dec.mor")) + error("Missing files - dec.moir"); + f.read(mem[0x73a2 + 0], 1); /*i:=0; repeat read(g,a); mem[$73A2:i]:=a; i:=succ(i); until eof(g);*/ - close(f); + f.close(); } int animof(int ouf, int num) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index b4e3fb3082..2938834f9e 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -29,7 +29,7 @@ #include "common/textconsole.h" #include "mortevielle/alert.h" #include "mortevielle/boite.h" -#include "mortevielle/droite.h +#include "mortevielle/droite.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 9b9fa68768..bdf207fb5c 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -325,7 +325,11 @@ void st4(int ob) { case 158 : crep = 113; break; - case RANGE_5(152, 156): + case 152: + case 153: + case 154: + case 155: + case 156: case 150: case 100: case 157: diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 906600f44c..1a73b34267 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -25,19 +25,22 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" #include "mortevielle/ovd1.h" #include "mortevielle/var_mor.h" namespace Mortevielle { void dem2() { + /* Deprecated check for disk 2 + untyped_file f; int k; - /* -- demande de disk 2 -- */ + // -- demande de disk 2 -- while (ioresult != 0); assign(f, "mort.001"); - /*$i-*/ + //$i- reset(f); while (ioresult != 0) { show_mouse(); @@ -46,6 +49,7 @@ void dem2() { reset(f); } close(f); + */ } void ani50() { @@ -81,13 +85,14 @@ void ani50() { /* overlay */ void init_menu() { int i, j, tai; char st[1410]; - untyped_file f; + Common::File f; + + if (!f.open("menufr.mor")) + error("Missing file - menufr.mor"); + + f.read(lettres, 7 * 24); + f.close(); - assign(f, "menufr.mor"); - /*$i-*/ - reset(f, 144); - blockread(f, lettres, 1); - close(f); /* ---- Demande de changement de disquette ---- */ dem2(); @@ -171,15 +176,16 @@ void ani50() { /* overlay */ void chartex() { int i; - untyped_file fibyte; + Common::File fibyte; char s[1410]; /* debug('o3 chartex'); */ i = 0; - assign(fibyte, "TXX.INP"); - /*$i-*/ - reset(fibyte); - blockread(fibyte, t_mot, 125); + if (!fibyte.open("TXX.INP")) + error("missing file - TXX.INP"); + + fibyte.read(&t_mot, 125); + close(fibyte); assign(sauv_t, "TXX.NTP"); reset(sauv_t); @@ -275,7 +281,7 @@ void ani50() { /* overlay */ void music() { - untyped_file fic; + Common::File fic; int k; bool fin; char ch; @@ -285,12 +291,14 @@ void ani50() { /* 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); + + if (!f.open("mort.img")) + error("Missing file - mort.img"); + + fic.read(mem[0x3800 + 0], 500); + fic.read(mem[0x47a0 + 0], 123); + f.close(); + demus(0x3800, 0x5000, 623); addfix = (float)((tempo_mus - addv[1])) / 256; cctable(tbi); @@ -308,41 +316,39 @@ void ani50() { /* overlay */ void charge_bruit5() { - untyped_file f; + Common::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); + if (!f.open("bruit5")) + error("Missing file - bruit5"); + + f.read(mem[adbruit5 + 0], 149); /*blockread(f,mem[$5CB0:0],100); blockread(f,mem[$3D1F:0],49);*/ - close(f); + f.close(); } /* overlay */ void charge_cfiec() { - untyped_file f; + Common::File f; + + if (!f.open("cfiec.mor")) + error("Missing file - cfiec.mor"); - assign(f, "cfiec.mor"); /*$i-*/ - reset(f); - blockread(f, mem[adcfiec + 0], 511); - blockread(f, mem[adcfiec + 4088 + 0], 311); - close(f); + f.read(mem[adcfiec + 0], 511); + f.read(mem[adcfiec + 4088 + 0], 311); + f.close(); + rech_cfiec = false; } /* overlay */ void charge_cfiph() { - untyped_file f; + Common::File f; - assign(f, "cfiph.mor"); - /*$i-*/ - reset(f, 256); - blockread(f, t_cph, 50); + if (!f.open("cfiph.mor")) + error("Missing file - cfiph.mor"); + + f.read(t_cph, 50); close(f); } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 6969cf6aea..1a20a1b9f9 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" #include "common/str.h" #include "mortevielle/mouse.h" #include "mortevielle/taffich.h" @@ -35,29 +36,31 @@ namespace Mortevielle { void chardes(Common::String nom, float passe, int long_) { int i, p, l; byte b; - untyped_file f; + Common::File f; /* debug('chardes'); */ - assign(f, nom); - /*$i-*/ - reset(f); + if (!f.open(nom)) + error("Missing file %s", nom.c_str()); + testfi(); p = 0; while (passe > 127) { p = p + 1; passe = passe - 128; } - if (p != 0) seek(f, p); + if (p != 0) + f.seek(p); p = trunc(passe); l = long_ + p; i = 0; while (l > 0) { - blockread(f, mem[0x6000 + i], 1); + f.read(mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; } - close(f); + f.close(); + for (i = p; i <= long_ + p; i ++) mem[0x7000 + i - p] = mem[0x6000 + i]; /*$i+*/ } @@ -65,31 +68,33 @@ void chardes(Common::String nom, float passe, int long_) { void charani(Common::String nom, float passe, int long_) { int i, p, l; byte b; - untyped_file f; + Common::File f; /* debug('charani'); */ - assign(f, nom); - /*$i-*/ - reset(f); + if (!f.open(nom)) + error("Missing file - %s", nom.c_str()); + testfi(); p = 0; while (passe > 127) { passe = passe - 128; p = p + 1; } - if (p != 0) seek(f, p); + if (p != 0) + f.seek(p); + p = trunc(passe); l = long_ + p; i = 0; while (l > 0) { - blockread(f, mem[0x6000 + i], 1); + f.read(mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; } - close(f); + f.close(); + for (i = p; i <= long_ + p; i ++) mem[0x7314 + i - p] = mem[0x6000 + i]; - /*$i+*/ } void taffich() { -- cgit v1.2.3 From 4dd8bce651f43f4f84dccc3655eb598cb9de97cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 17:11:37 +1100 Subject: MORTEVIELLE: Converted string() usage to Common::String --- engines/mortevielle/alert.cpp | 32 +++++++++++++++++++++++++++----- engines/mortevielle/menu.cpp | 5 ++++- engines/mortevielle/mor.cpp | 7 +++++-- engines/mortevielle/mor2.cpp | 3 ++- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 1a1356747a..c088502284 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -118,7 +118,12 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin i = i + 2; while (str[l].size() < 3) str[l] = str[l] + ' '; putxy(x, 98); - writeg(string(' ') + str[l] + ' ', 0); + + Common::String tmp(" "); + tmp += str[l]; + tmp += " "; + + writeg(tmp, 0); x = x + esp + 40; } } @@ -198,10 +203,19 @@ int do_alert(Common::String str_, int n) { hide_mouse(); if (quoi != 0) { posit(quoi, coldep, esp); - writeg(string(' ') + s[quoi] + ' ', 0); + + Common::String tmp(" "); + tmp += s[quoi]; + tmp += " "; + writeg(tmp, 0); } posit(ix, coldep, esp); - writeg(string(' ') + s[ix] + ' ', 1); + + Common::String tmp2 = " "; + tmp2 += s[ix]; + tmp2 += " "; + writeg(tmp2, 1); + quoi = ix; show_mouse(); } @@ -210,7 +224,12 @@ int do_alert(Common::String str_, int n) { if ((quoi != 0) && ! newaff) { hide_mouse(); posit(quoi, coldep, esp); - writeg(string(' ') + s[quoi] + ' ', 0); + + Common::String tmp3(" "); + tmp3 += s[quoi]; + tmp3 += " "; + writeg(tmp3, 0); + quoi = 0; show_mouse(); } @@ -222,7 +241,10 @@ int do_alert(Common::String str_, int n) { if (! test3) { quoi = n; posit(n, coldep, esp); - writeg(string(' ') + s[n] + ' ', 1); + Common::String tmp4(" "); + tmp4 += s[n]; + tmp4 += " "; + writeg(tmp4, 1); } charecr(50, succ(int, nligne) << 4); show_mouse(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 083a16d07a..412ab551f7 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -53,7 +53,10 @@ namespace Mortevielle { while (s.size() < 30) s = s + ' '; switch (h) { case invent : - if (l != 7) inv[l] = string(' ') + s; + if (l != 7) { + inv[l] = s; + inv[l].insertChar(' ', 0); + } break; case depla : dep[l] = s; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 2938834f9e..83cd3595f3 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -675,8 +675,11 @@ void pendule() { if (heu > 11) writeg("PM ", 1); else writeg("AM ", 1); putxy(550, 160); - if ((jou >= 0) && (jou <= 8)) - writeg(string(chr(jou + 49)) + "& jour", 1); + if ((jou >= 0) && (jou <= 8)) { + Common::String tmp("& jour"); + tmp.insertChar((char)(jou + 49), 0); + writeg(tmp, 1); + } } /************* diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index bdf207fb5c..3a895939d2 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -77,7 +77,8 @@ void tinke() { 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; + + stpou = Common::String(d3) + d5 + d4 + d3 + d1 + stpo + '0' + d2 + d4 + d3 + d6 + d4; } if (m > min) { min = 30; -- cgit v1.2.3 From ab089af889567e54fa3dda7483c42a294e1aa2f9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 18:21:02 +1100 Subject: MORTEVIELLE: More compilation fixes --- engines/mortevielle/actions.cpp | 9 ++++++--- engines/mortevielle/alert.cpp | 8 ++++++-- engines/mortevielle/boite.h | 1 + engines/mortevielle/disk.cpp | 3 +++ engines/mortevielle/level15.cpp | 2 +- engines/mortevielle/menu.cpp | 36 +++++++++++++++++++----------------- engines/mortevielle/mor.cpp | 9 ++++++--- engines/mortevielle/mor2.cpp | 12 +++++------- engines/mortevielle/mort.cpp | 2 -- engines/mortevielle/outtext.cpp | 14 ++++++++------ engines/mortevielle/ovd1.cpp | 35 +++++++++++++++++++++++------------ engines/mortevielle/parole2.cpp | 1 + engines/mortevielle/prog.cpp | 2 ++ engines/mortevielle/ques.cpp | 4 +++- engines/mortevielle/sprint.cpp | 6 ++++++ engines/mortevielle/sprint.h | 1 + engines/mortevielle/taffich.cpp | 16 ++++++---------- engines/mortevielle/var_mor.cpp | 36 +++++++++++++++++++++++++++++++++--- engines/mortevielle/var_mor.h | 22 ++++++++++++++++++---- 19 files changed, 148 insertions(+), 71 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b9626b3e6b..8e4a5fe229 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -33,6 +33,7 @@ #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" +#include "mortevielle/ques.h" #include "mortevielle/parole2.h" #include "mortevielle/var_mor.h" @@ -43,7 +44,8 @@ const char stouinon[] = "[2][ ][OUI][NON]"; /* overlay */ void taller() { - int mx, cx, cy; + //int mx, cx, cy; + int cx; if ((s.mlieu == 26) && (msg[4] == depl[6])) { s.mlieu = 15; @@ -132,7 +134,8 @@ L2: } /* overlay */ void tprendre() { - int cx, cy, cz; + //int cx, cy, cz; + int cx; if (caff > 99) { cx = caff; @@ -273,7 +276,7 @@ L2: } /* overlay */ void tlire() { - int iaff; +// int iaff; if (caff > 99) st4(caff); else { diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index c088502284..4ba287dcde 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -29,6 +29,7 @@ #include "mortevielle/alert.h" #include "mortevielle/level15.h" #include "mortevielle/mouse.h" +#include "mortevielle/sprint.h" namespace Mortevielle { @@ -48,7 +49,10 @@ static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String int i, k; bool v; - val(s[2], nbc, i); + //val(s[2], nbc, i); + sscanf(s.c_str() + 1, "%d", nbc); + i = 0; + c = ""; nbl = 0; i = 5; @@ -102,7 +106,7 @@ static void fait_boite(int lidep, int nli, int tx) { -static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String *&str, int &esp) { +static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String[3] &str, int &esp) { int i, l, x; char ch; diff --git a/engines/mortevielle/boite.h b/engines/mortevielle/boite.h index d4a1d1e45f..bff3e82d55 100644 --- a/engines/mortevielle/boite.h +++ b/engines/mortevielle/boite.h @@ -32,5 +32,6 @@ namespace Mortevielle { extern void boite(int x, int y, int dx, int dy, int coul); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index daf25d21e9..0c19bddf6e 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -29,7 +29,10 @@ #include "common/system.h" #include "common/savefile.h" #include "common/serializer.h" +#include "mortevielle/alert.h" +#include "mortevielle/ovd1.h" #include "mortevielle/disk.h" +#include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index b655b7a23e..882bea57c5 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -27,8 +27,8 @@ #include "common/file.h" #include "mortevielle/level15.h" -#include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 412ab551f7..2a055767f2 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -31,6 +31,7 @@ #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mouse.h" +#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -82,22 +83,22 @@ namespace Mortevielle { switch (h) { case invent : { if (l > 6) { - inv[l][1] = '<'; - inv[l][22] = '>'; - } else inv[l][1] = '*'; + inv[l].setChar('<', 1); + inv[l].setChar('>', 22); + } else inv[l].setChar('*', 1); } break; case depla : - dep[l][1] = '*'; + dep[l].setChar('*', 1); break; case action : - act[l][1] = '*'; + act[l].setChar('*', 1); break; case saction : - self_[l][1] = '*'; + self_[l].setChar('*', 1); break; case discut : - dis[l][1] = '*'; + dis[l].setChar('*', 1); break; } } @@ -110,30 +111,30 @@ namespace Mortevielle { l = lo(no); switch (h) { case invent : { - inv[l][1] = ' '; - inv[l][22] = ' '; + inv[l].setChar(' ', 1); + inv[l].setChar(' ', 22); } break; case depla : - dep[l][1] = ' '; + dep[l].setChar(' ', 1); break; case action : - act[l][1] = ' '; + act[l].setChar(' ', 1); break; case saction : { - self_[l][1] = ' '; - self_[l][1] = ' '; + self_[l].setChar(' ', 1); + self_[l].setChar(' ', 1); } break; case discut : - dis[l][1] = ' '; + dis[l].setChar(' ', 1); break; } } void menu_aff() { int ind_tabl, k, col; - char c; +// char c; int pt, x, y, color, msk, num_letr; @@ -237,7 +238,7 @@ void util(int x, int y) { else ix = 3; xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { - ix = pred(int, (uint)y >> 3) + (msg3 << 8); + ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); if (ix != msg4) { invers(1); msg4 = ix; @@ -318,7 +319,8 @@ void erase_menu() { } void mdn() { - int x, y, c, a, ix; + //int x, y, c, a, ix; + int x, y, ix; bool tes; /* debug('mdn'); */ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 83cd3595f3..39a45d4665 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -36,6 +36,7 @@ #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/parole2.h" +#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -43,6 +44,8 @@ namespace Mortevielle { /* Niveau 14 suite */ const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; +// For ScummVM, we need to do check for file errors where we do the file access +const int ioresult = 0; void testfi() { if (ioresult != 0) { @@ -225,8 +228,8 @@ void ecr2(Common::String str_) { else tab = 6; putxy(8, 177); tlig = 59 + pred(int, res) * 36; - if (str_.size() < tlig) writeg(str_, 5); - else if (str_.size() < (tlig << 1)) { + if ((int)str_.size() < tlig) writeg(str_, 5); + else if ((int)str_.size() < (tlig << 1)) { putxy(8, 176); writeg(copy(str_, 1, pred(int, tlig)), 5); putxy(8, 182); @@ -237,7 +240,7 @@ void ecr2(Common::String str_) { putxy(8, 176); writeg(copy(str_, 1, pred(int, tlig)), 5); putxy(8, 182); - writeg(copy(str_, tlig, pred(int, tlig << 1)), 5); + writeg(copy(str_, tlig, pred(int, (tlig << 1))), 5); putxy(8, 190); writeg(copy(str_, tlig << 1, tlig * 3), 5); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 3a895939d2..649d770fcf 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -28,22 +28,21 @@ #include "mortevielle/mor2.h" #include "mortevielle/alert.h" #include "mortevielle/boite.h" -#include "mortevielle/var_mor.h" +#include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/parole2.h" #include "mortevielle/taffich.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { -const array<1, 11, int> men -= {{ - scacher, attacher, defoncer, dormir, +const int men[12] = { 0, + scacher, attacher, defoncer, dormir, entrer, fermer, frapper, manger, mettre, ouvrir, sortir - } }; void tinke() { @@ -377,8 +376,7 @@ void modinv() { } void sparl(float adr, float rep) { - const array<1, 8, int> haut - = {{0, 1, -3, 6, -2, 2, 7, -1}}; + const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; int key, ad, tay, repint; char st[1410]; diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 2555b83232..68eb2178f2 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -25,8 +25,6 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "ptoc.h" - #include "mortevielle/mort.h" #include "mortevielle/var_mor.h" /* les variables */ #include "mortevielle/keyboard.h" /* la gestion du clavier */ diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6ec3f8930e..08fb9db053 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -27,6 +27,7 @@ #include "mortevielle/outtext.h" #include "mortevielle/level15.h" +#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" #include "common/str.h" @@ -59,14 +60,15 @@ const byte tab31[32]= { }; void deline(int num , char *l , int &tl); +typedef unsigned char uchar; static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { - const unsigned char rap[32] = { - ',', ':', '@', '!', '?', '-', '\207', - '\240', '\205', '\203', '\202', '\212', '\210', '/', - '\213', '\214', '\242', '\047', '\223', '"', '\227', - '\226', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9' + const uchar rap[32] = { + (uchar)',', (uchar)':', (uchar)'@', (uchar)'!', (uchar)'?', (uchar)'-', (uchar)'\207', + (uchar)'\240', (uchar)'\205', (uchar)'\203', (uchar)'\202', (uchar)'\212', (uchar)'\210', (uchar)'/', + (uchar)'\213', (uchar)'\214', (uchar)'\242', (uchar)'\047', (uchar)'\223', (uchar)'"', (uchar)'\227', + (uchar)'\226', (uchar)'0', (uchar)'1', (uchar)'2', (uchar)'3', (uchar)'4', (uchar)'5', + (uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9' }; int oct, ocd; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 1a73b34267..d34a6eea16 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -26,11 +26,19 @@ */ #include "common/file.h" +#include "mortevielle/alert.h" +#include "mortevielle/level15.h" +#include "mortevielle/mor.h" +#include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" +#include "mortevielle/traffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { +// For ScummVM, we need to do check for file errors where we do the file access +const int ioresult = 0; + void dem2() { /* Deprecated check for disk 2 @@ -142,7 +150,7 @@ void ani50() { reset(ft); if (ioresult != 0) { caff = do_alert(err_mess, 1); - exit(0); + mortevielle_exit(0); } ft >> l; close(ft); @@ -176,24 +184,27 @@ void ani50() { /* overlay */ void chartex() { int i; - Common::File fibyte; + Common::File f; char s[1410]; /* debug('o3 chartex'); */ i = 0; - if (!fibyte.open("TXX.INP")) - error("missing file - TXX.INP"); + if (!f.open("TXX.INP")) + error("Missing file - TXX.INP"); - fibyte.read(&t_mot, 125); + f.read(&t_mot, 125); + f.close(); - close(fibyte); - assign(sauv_t, "TXX.NTP"); - reset(sauv_t); + if (!f.open("TXX.NTP")) + error("Missing file - TXX.NTP"); do { - sauv_t >> t_rec[i]; + t_rec[i].indis = f.readSint16LE(); + t_rec[i].point = f.readByte(); + i = i + 1; - } while (!(eof(sauv_t))); - close(sauv_t); + } while (!f.eos()); + f.close(); + deline(578, s, i); al_mess = delig; deline(579, s, i); @@ -265,7 +276,7 @@ void ani50() { do { input >> kbd >> ch; } while ((ch != 'C') && (ch != 'S')); - int_m = (upcase(ch) == 'S'); + int_m = (toupper(ch) == 'S'); } /* overlay */ void init_lieu() { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index b5079f957d..22ed01c0b5 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/parole2.h" +#include "mortevielle/parole.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index d7f95f49eb..3366e56db7 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -26,10 +26,12 @@ */ #include "mortevielle/actions.h" +#include "mortevielle/alert.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/prog.h" +#include "mortevielle/traffich.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 2a200fb823..4ee0342a66 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -25,10 +25,12 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/str.h" +#include "mortevielle/boite.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" -#include "common/str.h" +#include "mortevielle/sprint.h" namespace Mortevielle { diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 406d7bccb4..374ac24b3e 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -26,6 +26,7 @@ */ #include "common/str.h" +#include "common/textconsole.h" #include "mortevielle/mouse.h" #include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" @@ -87,4 +88,9 @@ void writeg(Common::String l, int c) show_mouse(); } +void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { + warning("TODO: box method not yet implemented"); +} + + } // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h index 8484214fa3..60614bfda5 100644 --- a/engines/mortevielle/sprint.h +++ b/engines/mortevielle/sprint.h @@ -35,6 +35,7 @@ namespace Mortevielle { extern void fill_box(int x, int y, int dx); extern void clear_box(int x, int y, int dx); extern void writeg(Common::String l, int c); +extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 1a20a1b9f9..d98a600c92 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -27,6 +27,7 @@ #include "common/file.h" #include "common/str.h" +#include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -98,14 +99,9 @@ void charani(Common::String nom, float passe, int long_) { } 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 - } - }; + byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> + byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> + int i, m, a, b, cx, handle, npal; float lgt, lhandle; @@ -116,9 +112,9 @@ void taffich() { a = caff; if ((a >= 153) && (a <= 161)) - a = tran2[a]; + a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) - a = tran1[a]; + a = tran1[a - 136]; b = a; if (maff == a) return; if (a == 16) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 9bd43beb05..8ab06e8c79 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -25,8 +25,10 @@ * Copyright (c) 1988-1989 Lankhor */ -#include "mortevielle/var_mor.h" #include "common/str.h" +#include "common/textconsole.h" +#include "mortevielle/sprint.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { @@ -248,11 +250,13 @@ void hirs() { break; case ams : { hires; - inline_((float)(0xb8) / 6 / 0 / /* => mov ax,6 */ - 0xcd / 0x10); /* => int 16 */ + /* + inline_((float)(0xb8) / 6 / 0 / // => mov ax,6 + 0xcd / 0x10); // => int 16 port[0x3d9] = 15; port[0x3df] = 0; port[0x3dd] = 15; + */ res = 2; } break; @@ -295,6 +299,9 @@ void hirs() { } /* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ +void affput(int Chx, int Gd, int x, int y, int coul, int char_) { + warning("TODO: Implement affput"); +} void affcar(int gd, int x, int y, int coul, int chr) { if (res == 1) affput(1, gd, ((uint)x >> 1), y, coul, chr); @@ -305,4 +312,27 @@ void putpix(int gd, int x, int y, int coul) { affput(0, gd, x, y, coul, 0); } +/** + * Returns a substring of the given string + * @param s Source string + * @param idx Starting index (1 based) + * @param size Number of characters to return + */ +Common::String copy(const Common::String &s, int idx, size_t size) { + // Copy the substring into a temporary buffer + char *tmp = new char[size + 1]; + strncpy(tmp, s.c_str() + idx - 1, size); + tmp[size] = '\0'; + + Common::String result(tmp); + delete tmp; + return result; +} + +/*---------------------------------------------------------------------------*/ +/*------------------------------ STUBS ------------------------------*/ +/*---------------------------------------------------------------------------*/ + +int port[0xfff]; + } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 4f8e0fe523..fe0c3c5b67 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -51,12 +51,9 @@ namespace Mortevielle { #define chr(v) ((char) v) #define lo(v) (v & 0xff) #define hi(v) ((v >> 8) & 0xff) +#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) #define odd(v) ((v % 2) == 1) -// TODO: Replace the following with proper implementations -#define mortevielle_exit(ret) error("Exit the game") -#define clrscr {} - /*---------------------------------------------------------------------------*/ /*------------------------- CONSTANTS ----------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -393,6 +390,23 @@ extern pattern tpt[15]; void hirs(); void affcar(int gd, int x, int y, int coul, int chr); void putpix(int gd, int x, int y, int coul); +Common::String copy(const Common::String &s, int idx, size_t size); +void Val(const Common::String &s, int &V, int Code); +void affput(int Chx, int Gd, int x, int y, int coul, int char_); + +/*---------------------------------------------------------------------------*/ +/*------------------------------ STUBS ------------------------------*/ +/*---------------------------------------------------------------------------*/ +// TODO: Replace the following with proper implementations, or refactor out the code using them + +extern int port[0xfff]; + +#define hires {} + +#define mortevielle_exit(ret) error("Exit the game") +// Text screen functions not relevant for ScummVM +#define clrscr {} +#define gotoxy(x,y) {} } // End of namespace Mortevielle -- cgit v1.2.3 From ef3c2715440d8a842f18d4c92ade17d319c5448e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 21:29:41 +1100 Subject: MORTEVIELLE: Lots of compilation fixes --- engines/mortevielle/actions.cpp | 8 ++-- engines/mortevielle/alert.cpp | 4 +- engines/mortevielle/disk.cpp | 15 ++++--- engines/mortevielle/droite.cpp | 4 +- engines/mortevielle/level15.cpp | 9 ++-- engines/mortevielle/mor.cpp | 4 +- engines/mortevielle/mor2.cpp | 4 +- engines/mortevielle/mort.cpp | 2 +- engines/mortevielle/mouse.cpp | 10 ++--- engines/mortevielle/mouse.h | 2 +- engines/mortevielle/outtext.cpp | 16 ++++--- engines/mortevielle/ovd1.cpp | 96 +++++++++++++++++++++-------------------- engines/mortevielle/parole.cpp | 2 + engines/mortevielle/parole.h | 1 + engines/mortevielle/prog.cpp | 10 ++--- engines/mortevielle/sprint.cpp | 5 --- engines/mortevielle/sprint.h | 1 - engines/mortevielle/var_mor.cpp | 50 +++++++++++++++++++++ engines/mortevielle/var_mor.h | 32 +++++++++++++- 19 files changed, 180 insertions(+), 95 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 8e4a5fe229..5b420fba22 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -29,12 +29,14 @@ #include "mortevielle/actions.h" #include "mortevielle/alert.h" #include "mortevielle/level15.h" +#include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" #include "mortevielle/parole2.h" +#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -827,7 +829,7 @@ L2: } /* overlay */ void tentrer() { - int x, z; + int x, z = 0; if ((s.mlieu == 21) || (s.mlieu == 22)) { t1sama(); @@ -931,7 +933,7 @@ L2: } /* overlay */ void tsortir() { - int lx; + int lx = 0; tsort(); crep = 0; @@ -1055,7 +1057,7 @@ L2: x = x * (3 - res); if (x > 319) cx = 41; else cx = 1; - cy = succ(int, (uint)y >> 3); /* 0-199 => 1-25 */ + cy = succ(int, ((uint)y >> 3)); /* 0-199 => 1-25 */ if ((cy > 23) || ((cx == 41) && ((cy >= 20) && (cy <= 22)))) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 4ba287dcde..5f35e6ef65 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -106,7 +106,7 @@ static void fait_boite(int lidep, int nli, int tx) { -static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String[3] &str, int &esp) { +static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String *str, int &esp) { int i, l, x; char ch; @@ -176,7 +176,7 @@ int do_alert(Common::String str_, int n) { if (nbcase == 1) esp = nbcol - 40; else esp = (uint)(nbcol - nbcase * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); - fait_choix(cas, coldep, nbcase, s, esp); + fait_choix(cas, coldep, nbcase, &s[0], esp); limit[1][1] = ((uint)(coldep) >> 1) * res; limit[1][2] = limit[1][1] + 40; if (nbcase == 1) { diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 0c19bddf6e..e2b1b9ab2b 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -30,9 +30,12 @@ #include "common/savefile.h" #include "common/serializer.h" #include "mortevielle/alert.h" -#include "mortevielle/ovd1.h" #include "mortevielle/disk.h" +#include "mortevielle/mor.h" +#include "mortevielle/mor2.h" #include "mortevielle/mouse.h" +#include "mortevielle/ovd1.h" +#include "mortevielle/prog.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -41,9 +44,9 @@ namespace Mortevielle { * Ensure disk 1 data is available */ void dem1() { +/* Deprecated in ScummVM int k; -/* Deprecated in ScummVM // -- demande de disk 1 -- assign(f, "mort.005"); //*$i-* @@ -83,13 +86,13 @@ void takesav(int n) { dem1(); // -- Load the file 'sauve#n.mor' - Common::String saveName = Common::String::format("sav%d.mor", n); - Common::InSaveFile *f = g_system->getSaveManager().openForLoading(st); + Common::String saveName = Common::String::format("sav%d.mor", n); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(saveName); Common::Serializer sz(f, NULL); sync_save(sz); - if (f.err()) { + if (f->err()) { i = do_alert(err_mess, 1); mortevielle_exit(0); } @@ -125,7 +128,7 @@ void sv_game(int n) { if (s1.mlieu == 26) s1.mlieu = 15; Common::String saveName = Common::String::format("sav%d.mor", n); - f = g_system->getSaveFileManager().openForSaving(saveName); + f = g_system->getSavefileManager()->openForSaving(saveName); Common::Serializer sz(NULL, f); sync_save(sz); diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 9def04add5..54d788b6eb 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -47,7 +47,7 @@ void droite(int x, int y, int xx, int yy, int coul) { if (y > yy) step = -1; else step = 1; do { - putpix(gd, trunc(a * i + b), i, coul); + putpix(gd, abs((int)(a * i + b)), i, coul); i = i + step; } while (!(i == yy)); /*writeln(le_file,'X == ',a:3:3,' * Y + ',b:3:3);*/ @@ -58,7 +58,7 @@ void droite(int x, int y, int xx, int yy, int coul) { if (x > xx) step = -1; else step = 1; do { - putpix(gd, i, trunc(a * i + b), coul); + putpix(gd, i, abs((int)(a * i + b)), coul); i = i + step; } while (!(i == xx)); /*writeln(le_file,'Y == ',a:3:3,' * X + ',b:3:3);*/ diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 882bea57c5..a2d5432b50 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -86,7 +86,8 @@ void writepal(int n) { } break; case cga : { - pal = palcga[n].a; + warning("TODO: If this code is needed, resolve the incompatible types"); +// pal = palcga[n].a; if (n < 89) palette(palcga[n].p); for (i = 0; i <= 15; i ++) outbloc(i, tpt[pal[i].n], pal); } @@ -152,8 +153,8 @@ end; void adzon() { Common::File f; // Common::File g; - byte a; - int i; +// byte a; +// int i; if (!f.open("don.mor")) error("Missing file - don.mor"); @@ -173,7 +174,7 @@ void adzon() { if (!f.open("dec.mor")) error("Missing files - dec.moir"); - f.read(mem[0x73a2 + 0], 1); + f.read(&mem[0x73a2 + 0], 1); /*i:=0; repeat read(g,a); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 39a45d4665..6518f20f8c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -329,7 +329,7 @@ int hazard(int min, int max) { /* debug('hazard'); */ int hazard_result; ha2 = Random(); - ha1 = trunc(ha2 * (max - min)); + ha1 = abs((int)(ha2 * (max - min))); hazard_result = min + ha1; return hazard_result; } @@ -404,7 +404,7 @@ void repon(int f, int m) { Common::String str_; Common::String str1; char st[1410]; - text1 fic; +// text1 fic; int i, xco, dx, caspe, tay; /* debug('repon fenetre nř'+chr(f+48));*/ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 649d770fcf..42f679a0c6 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -53,7 +53,7 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; const char d6[] = "OK"; - int cx, cy, haz, nh, cf, j, h, m, cd; + int cx, haz, nh, cf, j, h, m; Common::String stpo; bool am; @@ -380,7 +380,7 @@ void sparl(float adr, float rep) { int key, ad, tay, repint; char st[1410]; - repint = trunc(rep); + repint = abs((int)rep); hide_mouse(); deline(repint + c_paroles, st, tay); afftex(st, 230, 4, 65, 24, 5); diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 68eb2178f2..f3b0ac73ab 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -69,7 +69,7 @@ void divers(int np, bool b) { int main(int argc, const char *argv[]) { /*init_debug;*/ /* ecri_seg;*/ - pio_initialize(argc, argv); + //pio_initialize(argc, argv); gd = cga; newgd = gd; zuul = false; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 708865ee1a..926a7bfceb 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -46,7 +46,7 @@ int s_s[12][6]; void init_mouse() { - int i, j; +// int i, j; registres reg; mouse_shwn = 0; @@ -88,7 +88,7 @@ begin end; */ void hide_mouse() { - int i, j, k, ps, ds; + int i, j, k, ps;; bool imp; mouse_shwn = pred(int, mouse_shwn); @@ -176,10 +176,8 @@ void hide_mouse() { } void show_mouse() { - int i, j, k, l, - ps, ds; + int i, j, k, l; bool imp; - char c; mouse_shwn = mouse_shwn + 1; if (mouse_shwn != 1) return; @@ -383,7 +381,7 @@ void mov_mouse(bool &funct, char &key) { case '\33' : { p_key = keypressed(); - if ((p_key >= ';') && (p_key <= 'D')) { + if ((in2 >= ';') && (in2 <= 'D')) { funct = true; key = in2; return; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 0923c71866..a981d521ac 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -30,7 +30,7 @@ namespace Mortevielle { -extern bool clic; +extern bool clic, int_m; extern int m_show, x_s, diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 08fb9db053..6048efb02a 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -62,7 +62,8 @@ const byte tab31[32]= { void deline(int num , char *l , int &tl); typedef unsigned char uchar; -static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { +static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { +/* const uchar rap[32] = { (uchar)',', (uchar)':', (uchar)'@', (uchar)'!', (uchar)'?', (uchar)'-', (uchar)'\207', (uchar)'\240', (uchar)'\205', (uchar)'\203', (uchar)'\202', (uchar)'\212', (uchar)'\210', (uchar)'/', @@ -70,16 +71,17 @@ static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { (uchar)'\226', (uchar)'0', (uchar)'1', (uchar)'2', (uchar)'3', (uchar)'4', (uchar)'5', (uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9' }; +*/ int oct, ocd; /* 5-8 */ - oct = t_mot[ind]; + oct = t_mot[idx]; oct = (uint)(oct << (16 - pt)) >> (16 - pt); if (pt < 6) { - ind = ind + 1; + idx = idx + 1; oct = oct << (5 - pt); pt = pt + 11; - oct = oct | ((uint)t_mot[ind] >> pt); + oct = oct | ((uint)t_mot[idx] >> pt); } else { pt = pt - 5; oct = (uint)oct >> pt; @@ -93,13 +95,13 @@ static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end) { break; case 30: case 31 : { - ocd = t_mot[ind]; + ocd = t_mot[idx]; ocd = (uint)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { - ind = ind + 1; + idx = idx + 1; ocd = ocd << (5 - pt); pt = pt + 11; - ocd = ocd | ((uint)t_mot[ind] >> pt); + ocd = ocd | ((uint)t_mot[idx] >> pt); } else { pt = pt - 5; ocd = (uint)ocd >> pt; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index d34a6eea16..b30acea8b9 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -27,11 +27,15 @@ #include "common/file.h" #include "mortevielle/alert.h" +#include "mortevielle/keyboard.h" #include "mortevielle/level15.h" +#include "mortevielle/menu.h" #include "mortevielle/mor.h" +#include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/traffich.h" +#include "mortevielle/parole.h" +#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -79,8 +83,6 @@ void ani50() { end;*/ /* overlay */ void aff50(bool c) { - int k; - caff = 50; maff = 0; taffich(); @@ -91,7 +93,7 @@ void ani50() { } /* overlay */ void init_menu() { - int i, j, tai; + int i, tai; char st[1410]; Common::File f; @@ -139,33 +141,33 @@ void ani50() { /* overlay */ void charpal() { - file f; - file ft; + Common::File f; // tabdb records + Common::File ft; // tfxx int i, j, k; - file fb; + Common::File fb; // byte values byte b; - assign(ft, "fxx.mor"); - /*$i-*/ - reset(ft); - if (ioresult != 0) { - caff = do_alert(err_mess, 1); - mortevielle_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); + if (!ft.open("fxx.mor")) + error("Missing file - fxx.mor"); + for (int i = 1; i < 108; ++i) + l[i] = ft.readSint16LE(); + ft.close(); + + if (!f.open("plxx.mor")) + error("Missing file - plxx.mor"); + for (i = 0; i <= 90; i ++) + tabpal[i] = f.readSint16LE(); + f.close(); + + if (!fb.open("cxx.mor")) + error("Missing file - cxx.mor"); + for (j = 0; j <= 90; j ++) { - fb >> palcga[j].p; + palcga[j].p = fb.readByte(); for (i = 0; i <= 15; i ++) { nhom &with = palcga[j].a[i]; - fb >> b; + b = fb.readByte(); with.n = (uint)b >> 4; with.hom[0] = ((uint)b >> 2) & 3; with.hom[1] = b & 3; @@ -173,13 +175,13 @@ void ani50() { } palcga[10].a[9] = palcga[10].a[5]; for (j = 0; j <= 14; j ++) { - fb >> tpt[j].tax; - fb >> tpt[j].tay; + tpt[j].tax = fb.readByte(); + tpt[j].tay = fb.readByte(); for (i = 1; i <= 20; i ++) for (k = 1; k <= 20; k ++) - fb >> tpt[j].des[i][k]; + tpt[j].des[i][k] = fb.readByte(); } - close(fb); + fb.close(); } /* overlay */ void chartex() { @@ -243,9 +245,9 @@ void ani50() { gotoxy(1, 21); clreol; gotoxy(1, 23); - output << "CARTE GRAPHIQUE CGA EGA HERCULE/AT&T400 TANDY AMSTRAD1512"; + output("CARTE GRAPHIQUE CGA EGA HERCULE/AT&T400 TANDY AMSTRAD1512"); gotoxy(12, 24); - output << "Ctrl C E H T A"; + output("Ctrl C E H T A"); do { input >> kbd >> ch; } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); @@ -267,12 +269,12 @@ void ani50() { gotoxy(1, 23); clreol; gotoxy(26, 23); - output << "Jeu au Clavier / … la Souris"; + output("Jeu au Clavier / … la Souris"); textcolor(4); gotoxy(33, 23); - output << 'C'; + output("C"); gotoxy(48, 23); - output << 'S'; + output("S"); do { input >> kbd >> ch; } while ((ch != 'C') && (ch != 'S')); @@ -280,14 +282,16 @@ void ani50() { } /* overlay */ void init_lieu() { - file f_lieu; + Common::File f_lieu; // tab_mlieu /* debug('o3 init_lieu'); */ - assign(f_lieu, "MXX.mor"); - /*$i-*/ - reset(f_lieu); - f_lieu >> v_lieu; - close(f_lieu); + if (!f_lieu.open("MXX.mor")) + error("Missing file - MXX.mor"); + + for (int i = 1; i < 8; ++i) + f_lieu.read(&v_lieu[i][1], 24); + + f.close(); } @@ -306,8 +310,8 @@ void ani50() { if (!f.open("mort.img")) error("Missing file - mort.img"); - fic.read(mem[0x3800 + 0], 500); - fic.read(mem[0x47a0 + 0], 123); + fic.read(&mem[0x3800 + 0], 500); + fic.read(&mem[0x47a0 + 0], 123); f.close(); demus(0x3800, 0x5000, 623); @@ -332,7 +336,7 @@ void ani50() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(mem[adbruit5 + 0], 149); + f.read(&mem[adbruit5 + 0], 149); /*blockread(f,mem[$5CB0:0],100); blockread(f,mem[$3D1F:0],49);*/ f.close(); @@ -345,8 +349,8 @@ void ani50() { error("Missing file - cfiec.mor"); /*$i-*/ - f.read(mem[adcfiec + 0], 511); - f.read(mem[adcfiec + 4088 + 0], 311); + f.read(&mem[adcfiec + 0], 511); + f.read(&mem[adcfiec + 4088 + 0], 311); f.close(); rech_cfiec = false; @@ -360,7 +364,7 @@ void ani50() { error("Missing file - cfiph.mor"); f.read(t_cph, 50); - close(f); + f.close(); } @@ -379,7 +383,7 @@ void ani50() { textcolor(7); cpr = "COPYRIGHT 1989 : LANKHOR"; if ((gd == ega) || (gd == ams) || (gd == cga)) - output << cpr; + output(cpr); else { putxy(104 + 72 * res, 190); writeg(cpr, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 6c8f598fd4..4a3734f363 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -35,6 +35,8 @@ void spfrac(int wor) { if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || ((c3.code < 5) && ((c3.rep != 19) && (c3.rep != 22) && (c3.rep != 4) && (c3.rep != 9))))) { c3.rep = c3.rep + 1; + } + c3.freq = ((uint)wor >> 6) & 7; c3.acc = ((uint)wor >> 9) & 7; } diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h index a1467dcad8..4168187a24 100644 --- a/engines/mortevielle/parole.h +++ b/engines/mortevielle/parole.h @@ -29,6 +29,7 @@ #define MORTEVIELLE_PAROLE_H #include "common/scummsys.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 3366e56db7..e493e760e8 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -31,7 +31,7 @@ #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/prog.h" -#include "mortevielle/traffich.h" +#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" @@ -116,8 +116,8 @@ namespace Mortevielle { regs.ax = 0x201; regs.cx = 0x1; regs.dx = 0x100 + k - 1; - regs.es = seg(buffer); - regs.bx = ofs(buffer); + //regs.es = seg(buffer); + //regs.bx = ofs(buffer); intr(19, regs); test[k] = ! imen; i = 0; @@ -126,8 +126,8 @@ namespace Mortevielle { syn = false; regs.cx = 0x2700 + i; regs.dx = 0x100 + k - 1; - regs.es = seg(buffer); - regs.bx = ofs(buffer); + //regs.es = seg(buffer); + //regs.bx = ofs(buffer); intr(19, regs); if (lo(regs.flags) % 2 == 1) test[k] = false; i = i + 1; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 374ac24b3e..0523651ad9 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -88,9 +88,4 @@ void writeg(Common::String l, int c) show_mouse(); } -void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { - warning("TODO: box method not yet implemented"); -} - - } // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h index 60614bfda5..8484214fa3 100644 --- a/engines/mortevielle/sprint.h +++ b/engines/mortevielle/sprint.h @@ -35,7 +35,6 @@ namespace Mortevielle { extern void fill_box(int x, int y, int dx); extern void clear_box(int x, int y, int dx); extern void writeg(Common::String l, int c); -extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 8ab06e8c79..f92202c364 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -334,5 +334,55 @@ Common::String copy(const Common::String &s, int idx, size_t size) { /*---------------------------------------------------------------------------*/ int port[0xfff]; +byte mem[0xffff]; +int memw[0xffff]; +int wherey; + +void gotoxy(int x, int y) { +} +void textcolor(int c) { +} +void output(const Common::String &s) { +} +void intr(int intNum, registres ®s) { +} + +void palette(int v1) { + warning("TODO: s_sauv"); +} + +// (* external 'c:\mc\charecr.com'; *) +void s_char(int Gd, int y, int dy) { + warning("TODO: s_char"); +} + +// (* external 'c:\mc\sauvecr.com'; *) +void s_sauv(int Gd, int y, int dy) { + warning("TODO: s_sauv"); +} + +// (* external 'c:\mc\boite.com'; *) +void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { + warning("TODO: box method not yet implemented"); +} + +// (* external 'c:\mc\zuul.com'; *) +void zzuul(int ad, int seg, int tai) { + warning("TODO: zzuul"); +} + +// (* external 'c:\mc\decomp.com'; *) +void decomp(int seg, int dep) { + warning("TODO: decomp"); +} + +// (* external 'c:\mc\affich.com'; *) +void afff(int Gd, int seg, int dep, int x, int y) { + warning("TODO: afff"); +} +// (* external 'c:\mc\reusint.com'; *) +void musyc(tablint &tb, int nbseg, int att) { + warning("TODO: musyc"); +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index fe0c3c5b67..4cb40caaaa 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -231,6 +231,10 @@ struct t_pcga { nhom a[16]; }; +typedef int tablint[256]; +typedef doublet tabdb[17]; +typedef int tfxx[108]; + /*---------------------------------------------------------------------------*/ /*------------------------------ ENUMS ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -400,13 +404,37 @@ void affput(int Chx, int Gd, int x, int y, int coul, int char_); // TODO: Replace the following with proper implementations, or refactor out the code using them extern int port[0xfff]; +extern byte mem[0xffff]; +extern int memw[0xffff]; #define hires {} - #define mortevielle_exit(ret) error("Exit the game") + // Text screen functions not relevant for ScummVM #define clrscr {} -#define gotoxy(x,y) {} +#define clreol {} +extern void gotoxy(int x, int y); +extern void textcolor(int c); +extern void output(const Common::String &s); +extern int wherey; + +extern void palette(int v1); +extern void intr(int intNum, registres ®s); + +// (* external 'c:\mc\charecr.com'; *) +extern void s_char(int Gd, int y, int dy); +// (* external 'c:\mc\sauvecr.com'; *) +extern void s_sauv(int Gd, int y, int dy); +// (* external 'c:\mc\boite.com'; *) +extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); +// (* external 'c:\mc\zuul.com'; *) +extern void zzuul(int ad, int seg, int tai); +// (* external 'c:\mc\decomp.com'; *) +extern void decomp(int seg, int dep); +// (* external 'c:\mc\affich.com'; *) +extern void afff(int Gd, int seg, int dep, int x, int y); +// (* external 'c:\mc\reusint.com'; *) +extern void musyc(tablint &tb, int nbseg, int att); } // End of namespace Mortevielle -- cgit v1.2.3 From 09928318f545f7b42bcf5bfba888ffc1c3761a69 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 22:07:25 +1100 Subject: MORTEVIELLE: Added stubs for remaining functions needed by the project --- engines/mortevielle/alert.cpp | 13 +++-- engines/mortevielle/keyboard.cpp | 6 +-- engines/mortevielle/mor.cpp | 31 ++++-------- engines/mortevielle/mor2.cpp | 8 +-- engines/mortevielle/mouse.cpp | 75 ++++++++++++++-------------- engines/mortevielle/outtext.cpp | 3 +- engines/mortevielle/ovd1.cpp | 25 ++++++---- engines/mortevielle/parole.cpp | 103 ++++++++++++++++++++------------------- engines/mortevielle/parole2.cpp | 3 +- engines/mortevielle/prog.cpp | 9 ++-- engines/mortevielle/ques.cpp | 3 +- engines/mortevielle/taffich.cpp | 13 ++--- engines/mortevielle/var_mor.cpp | 38 +++++++++++++-- engines/mortevielle/var_mor.h | 13 ++++- 14 files changed, 192 insertions(+), 151 deletions(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 5f35e6ef65..804e0f41f0 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -133,20 +133,23 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin } int do_alert(Common::String str_, int n) { - int coldep, esp, i, l, nbcase, quoi, ix; + int coldep, esp, i, nbcase, quoi, ix; Common::String st, chaine; int limit[3][3]; - char c, dumi; + char dumi; Common::String s[3]; - int cx, cy, cd, nbcol, nblig; - bool touch, newaff, test, test1, test2, test3, dum; + int cx, cy, nbcol, nblig; + bool newaff, test, test1, test2, test3, dum; Common::String cas; /*debug('** do_alert **');*/ + memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; hide_mouse(); - while (keypressed()) input >> kbd >> dumi; + while (keypressed()) + dumi = get_ch(); // input >> kbd >> dumi; + clic = false; decod(str_, nbcase, nblig, nbcol, chaine, cas); sauvecr(50, succ(int, nligne) << 4); diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 701f99cec7..992a268b01 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -34,7 +34,7 @@ char readkey1() { char c; char readkey1_result; - input >> kbd >> c; + c = get_ch(); // input >> kbd >> c; readkey1_result = c; return readkey1_result; } @@ -43,7 +43,7 @@ int testou() { char ch; int testou_result; - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; switch (ch) { case '\23' : sonoff = ! sonoff; @@ -77,7 +77,7 @@ int testou() { } break; case '\33' : - if (keypressed()) input >> kbd >> ch; + if (keypressed()) ch = get_ch(); // input >> kbd >> ch; break; } testou_result = ord(ch); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6518f20f8c..556c7b4e14 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -150,7 +150,7 @@ void ecrf1() { } void clsf1() { - int i, j; +// int i, j; /* debug('clsf1'); */ hide_mouse(); @@ -198,7 +198,7 @@ void clsf1() { } void clsf2() { - int i, j; +// int i, j; /* debug('clsf2'); */ hide_mouse(); @@ -247,7 +247,7 @@ void ecr2(Common::String str_) { } void clsf3() { - int i, j; +// int i, j; /* debug('clsf3'); */ hide_mouse(); @@ -323,15 +323,8 @@ void paint_rect(int x, int y, int dx, int dy) { } int hazard(int min, int max) { - int ha1; - float ha2; - /* debug('hazard'); */ - int hazard_result; - ha2 = Random(); - ha1 = abs((int)(ha2 * (max - min))); - hazard_result = min + ha1; - return hazard_result; + return get_random_number(min, max); } void calch(int &j, int &h, int &m) { @@ -370,7 +363,7 @@ void okpas() { void modobj(int m) { char str_[1410]; Common::String strp; - int i, tay; + int tay; /* debug('modobj'); */ strp = ' '; @@ -385,7 +378,7 @@ void modobj(int m) { void modobj2(int m, bool t1, bool t2) { char str_[1410]; Common::String strp; - int i, tay; + int tay; /* debug('modobj'); */ strp = ' '; @@ -541,7 +534,6 @@ void affper(int per) { /* overlay */ void choix(int min, int max, int &per) { bool i; int haz, cx, cy, cz; - float per2, cz2; /* debug('o0 choix'); */ haz = hazard(min, max); @@ -793,8 +785,6 @@ void debloc(int l) { } /* overlay */ void quelq6(int l) { - int per; - /* debug('o1 quelq6'); */ if (l == 6) bh6 = true; if (l == 8) bh8 = true; @@ -802,7 +792,7 @@ void debloc(int l) { } /* overlay */ void quelq10(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq10'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -829,7 +819,7 @@ void debloc(int l) { } /* overlay */ void quelq11(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq11'); */ if ((h >= 0) && (h < 8)) chlm(per); @@ -882,7 +872,7 @@ void debloc(int l) { } /* overlay */ void quelq20(int h, int &per) { - int min, max; + int min = 0, max = 0; /* debug('o1 quelq20'); */ if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); @@ -1175,7 +1165,7 @@ void phaz(int &haz, int &p, int cf) { } /* overlay */ void t11(int l11, int &a) { - int p, haz, h; + int p, haz, h = 0; /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); @@ -1254,7 +1244,6 @@ void messint(int nu) { void aniof(int ouf, int num) { int ad, offset; - char c; /* debug('aniof'); */ if ((caff == 7) && ((num == 4) || (num == 5))) return; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 42f679a0c6..c650002a57 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -206,7 +206,7 @@ void tkey1(bool d) { } void tmlieu(int mli) { - int cx, j, i, tail; + int cx, i, tail; Common::String nomp; char st[1410]; @@ -354,7 +354,7 @@ void st1sama() { } void modinv() { - int cx, cy, tay, i, r; + int cx, cy, tay, r; char nom[1410]; Common::String nomp; @@ -377,7 +377,7 @@ void modinv() { void sparl(float adr, float rep) { const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, ad, tay, repint; + int key, tay, repint; char st[1410]; repint = abs((int)rep); @@ -615,7 +615,7 @@ void tsuiv() { void tfleche() { bool qust; char touch; - int dummy, cd, xmo, ymo; + int dummy; if (num == 9999) return; fenat(chr(152)); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 926a7bfceb..1aaea06d68 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -332,7 +332,7 @@ void mov_mouse(bool &funct, char &key) { key = '\377'; p_key = keypressed(); while (p_key) { - input >> kbd >> in1; + in1 = get_ch(); // input >> kbd >> in1; read_pos_mouse(cx, cy, cd); switch (toupper(in1)) { case '4' : @@ -381,48 +381,49 @@ void mov_mouse(bool &funct, char &key) { case '\33' : { p_key = keypressed(); - if ((in2 >= ';') && (in2 <= 'D')) { - funct = true; - key = in2; - return; - } - if (p_key) { - input >> kbd >> in2; - switch (in2) { - case 'K' : - cx = pred(int, cx); + in2 = get_ch(); // input >> kbd >> in2; + + if ((in2 >= ';') && (in2 <= 'D')) { + funct = true; + key = in2; + return; + } else { + switch (in2) { + case 'K' : + cx = pred(int, cx); + break; + case 'P' : + cy = succ(int, cy); + break; + case 'M' : + cx = cx + 2; + break; + case 'H' : + cy = pred(int, cy); + break; + case 'G' : { + cx = cx - 1; + cy = cy - 1; + } break; - case 'P' : - cy = succ(int, cy); + case 'I' : { + cx = cx + 1; + cy = cy - 1; + } break; - case 'M' : - cx = cx + 2; + case 'O' : { + cx = cx - 1; + cy = cy + 1; + } break; - case 'H' : - cy = pred(int, cy); + case 'Q' : { + cx = cx + 1; + cy = cy + 1; + } break; - case 'G' : { - cx = cx - 1; - cy = cy - 1; - } - 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; + } /* case */ } - break; - } /* case */ } } break; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6048efb02a..c9bdcc7292 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -162,12 +162,11 @@ static int l_motsuiv(int p, char *ch, int &tab) { void afftex(char *ch, int x, int y, int dx, int dy, int typ) { bool the_end; - char touch; int xf, yf; int xc, yc; int tab, p; Common::String s; - int i, j, nt; + int i, j; /* debug(' .. Afftex');*/ diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index b30acea8b9..e33f3e406a 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -35,6 +35,7 @@ #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole.h" +#include "mortevielle/sprint.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -155,8 +156,12 @@ void ani50() { if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); - for (i = 0; i <= 90; i ++) - tabpal[i] = f.readSint16LE(); + for (i = 0; i <= 90; ++i) { + for (j = 1; j <= 16; ++j) { + tabpal[i][j].x = f.readByte(); + tabpal[i][j].y = f.readByte(); + } + } f.close(); if (!fb.open("cxx.mor")) @@ -234,7 +239,7 @@ void ani50() { cy = cy + 1; deline(cy + c_dialpre, st, tay); gotoxy(40 - tay / 2, wherey + 1); - output << delig; + output(delig); } while (!(cy == 20)); ix = 0; do { @@ -249,7 +254,7 @@ void ani50() { gotoxy(12, 24); output("Ctrl C E H T A"); do { - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); switch (ch) { case '\1': @@ -276,7 +281,7 @@ void ani50() { gotoxy(48, 23); output("S"); do { - input >> kbd >> ch; + ch = get_ch(); // input >> kbd >> ch; } while ((ch != 'C') && (ch != 'S')); int_m = (toupper(ch) == 'S'); } @@ -291,7 +296,7 @@ void ani50() { for (int i = 1; i < 8; ++i) f_lieu.read(&v_lieu[i][1], 24); - f.close(); + f_lieu.close(); } @@ -300,19 +305,19 @@ void ani50() { int k; bool fin; char ch; - float x, y; +// float x, y; /* debug('o3 music'); */ if (sonoff) return; rech_cfiec = true; - if (!f.open("mort.img")) + if (!fic.open("mort.img")) error("Missing file - mort.img"); fic.read(&mem[0x3800 + 0], 500); fic.read(&mem[0x47a0 + 0], 123); - f.close(); + fic.close(); demus(0x3800, 0x5000, 623); addfix = (float)((tempo_mus - addv[1])) / 256; @@ -326,7 +331,7 @@ void ani50() { k = k + 1; fin = fin | keypressed() | (k >= 5); } while (!fin); - while (keypressed()) input >> kbd >> ch; + while (keypressed()) ch = get_ch(); // input >> kbd >> ch; } diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 4a3734f363..3c78b04f00 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" #include "mortevielle/parole.h" namespace Mortevielle { @@ -46,44 +47,40 @@ void charg_car() { wor = swap(memw[adword + ptr_word]); int_ = wor & 0x3f; - switch (int_) { - case 60 : { - c3.val = 32; /* " " */ - c3.code = 9; - } - break; - case 61 : { - c3.val = 46; /* "." */ - c3.code = 9; - } - break; - case 62 : { - c3.val = 35; /* "#" */ - c3.code = 9; - } - break; - case RANGE_26(22, 47) : { + + if ((int_ >= 0) && (int_ <= 13)) { + c3.val = int_; + c3.code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + c3.val = int_; + c3.code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; c3.val = int_; c3.code = typcon[int_]; - } - break; - case RANGE_9(48, 56) : { + } else if ((int_ >= 48) && (int_ <= 56)) { c3.val = int_ - 22; c3.code = 4; + } else { + switch (int_) { + case 60 : { + c3.val = 32; /* " " */ + c3.code = 9; + } + break; + case 61 : { + c3.val = 46; /* "." */ + c3.code = 9; + } + break; + case 62 : { + c3.val = 35; /* "#" */ + c3.code = 9; + } + break; + } } - break; - case RANGE_8(14, 21) : { - c3.val = int_; - c3.code = 6; - } - break; - case RANGE_14(0, 13) : { - c3.val = int_; - c3.code = 5; - } - break; - } + spfrac(wor); ptr_word = ptr_word + 2; } @@ -106,7 +103,7 @@ void veracf(byte b) { tb[0] = 0; for (k = 0; k <= 255; k ++) { tb[k + 1] = addfix + tb[k]; - t[255 - k] = trunc(tb[k]) + 1; + t[255 - k] = abs((int)tb[k] + 1); } } @@ -123,36 +120,42 @@ void veracf(byte b) { } /* overlay */ void charge_son() { - untyped_file f; + Common::File f; - assign(f, "sonmus.mor"); - reset(f); - blockread(f, mem[0x7414 + 0], 273); + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + f.read(&mem[0x7414 + 0], 273); /*blockread(f,mem[adson+0],300); blockread(f,mem[adson+2400+0],245);*/ demus(0x7414, adson, 273); - close(f); + f.close(); } /* overlay */ void charge_phbruit() { - untyped_file f; + Common::File f; - assign(f, "phbrui.mor"); - reset(f); - blockread(f, t_cph, 3); - close(f); + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= 3; ++i) + t_cph[i] = f.readSint16LE(); + + f.close(); } /* overlay */ void charge_bruit() { - untyped_file f; - int j, i; + Common::File f; + int i; - assign(f, "bruits"); - reset(f); - blockread(f, mem[adbruit + 0], 250); + if (!f.open("bruits")) + error("Missing file - bruits"); + + f.read(&mem[adbruit + 0], 250); for (i = 0; i <= 19013; i ++) mem[adbruit + 32000 + i] = mem[adbruit5 + i]; - blockread(f, mem[adbruit1 + offsetb1], 149); - close(f); + f.read(&mem[adbruit1 + offsetb1], 149); + + f.close(); } /* overlay */ void trait_car() { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 22ed01c0b5..be8c17bf3b 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/level15.h" #include "mortevielle/parole2.h" #include "mortevielle/parole.h" #include "mortevielle/var_mor.h" @@ -64,7 +65,7 @@ void trait_ph() { memw[adword + ptr_word] = t_cph[ptr_tcph]; ptr_word = ptr_word + 2; ptr_tcph = ptr_tcph + 1; - } while (!(ptr_tcph >= ((uint)lefin >> 1))); + } while (!(ptr_tcph >= (int)((uint)lefin >> 1))); ptr_oct = 0; ptr_word = 0; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index e493e760e8..760560eb53 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -38,8 +38,6 @@ namespace Mortevielle { /* overlay */ void change_gd(int ngd) { - int i; - hide_mouse(); gd = ngd; hirs(); @@ -59,7 +57,6 @@ namespace Mortevielle { } /* overlay */ void antegame() { - int cx; registres regs; char buffer[512]; int i, j, k; @@ -249,9 +246,9 @@ void ld_game(int n); void tecran() { const char idem[] = "Idem"; const int lim = 20000; - int temps; - char inkey; - bool oo, funct; + int temps = 0; + char inkey = '\0'; + bool oo, funct = 0; clsf3(); oo = false; diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 4ee0342a66..c9154acc59 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -27,6 +27,7 @@ #include "common/str.h" #include "mortevielle/boite.h" +#include "mortevielle/level15.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" @@ -92,7 +93,7 @@ namespace Mortevielle { with.y2 = 34 + j * 8; with.etat = true; } - while (chaines[j].size() < tmax) { + while ((int)chaines[j].size() < tmax) { chaines[j] = chaines[j] + ' '; } } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index d98a600c92..3cde8eb015 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -27,6 +27,7 @@ #include "common/file.h" #include "common/str.h" +#include "mortevielle/level15.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/taffich.h" @@ -36,7 +37,7 @@ namespace Mortevielle { void chardes(Common::String nom, float passe, int long_) { int i, p, l; - byte b; +// byte b; Common::File f; /* debug('chardes'); */ @@ -51,11 +52,11 @@ void chardes(Common::String nom, float passe, int long_) { } if (p != 0) f.seek(p); - p = trunc(passe); + p = abs((int)passe); l = long_ + p; i = 0; while (l > 0) { - f.read(mem[0x6000 + i], 1); + f.read(&mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; @@ -68,7 +69,7 @@ void chardes(Common::String nom, float passe, int long_) { void charani(Common::String nom, float passe, int long_) { int i, p, l; - byte b; +// byte b; Common::File f; /* debug('charani'); */ @@ -84,11 +85,11 @@ void charani(Common::String nom, float passe, int long_) { if (p != 0) f.seek(p); - p = trunc(passe); + p = abs((int)passe); l = long_ + p; i = 0; while (l > 0) { - f.read(mem[0x6000 + i], 1); + f.read(&mem[0x6000 + i], 1); testfi(); l = l - 128; i = i + 128; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index f92202c364..33ddfe64cc 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -227,7 +227,7 @@ int tbi[256]; chariot c1, c2, c3; float addfix; t_pcga palsav[91]; -doublet tabpal[91][16]; +doublet tabpal[91][17]; t_pcga palcga[91]; pattern tpt[15]; @@ -238,7 +238,7 @@ pattern tpt[15]; void hirs() { const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; - int i, j; + int i; switch (gd) { case cga : { @@ -261,8 +261,10 @@ void hirs() { } break; case ega : { - inline_((float)(0xb8) / 14 / 0 / /* MOV AX, 14 ; mode video 14 = 640*200 16 couleurs */ - 0xcd / 0x10); /* INT 16 */ + /* + inline_((float)(0xb8) / 14 / 0 / // MOV AX, 14 ; mode video 14 = 640*200 16 couleurs + 0xcd / 0x10); // INT 16 + */ res = 2; } break; @@ -273,7 +275,9 @@ void hirs() { port[0x3b4] = i; port[0x3b5] = herc[i]; } + /* inline_((float)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); + */ port[0x3b8] = 10; res = 2; } @@ -344,9 +348,24 @@ void textcolor(int c) { } void output(const Common::String &s) { } +void graphbackground(int c) { +} + void intr(int intNum, registres ®s) { } +int get_random_number(int minval, int maxval) { + // TODO: Replace with a proper random source in the engine + return minval; +} + +bool keypressed() { + return false; // Hardcoded currently for no keypress pending +} +char get_ch() { + return '\0'; // hardcoded currently for no keypress +} + void palette(int v1) { warning("TODO: s_sauv"); } @@ -380,9 +399,20 @@ void decomp(int seg, int dep) { void afff(int Gd, int seg, int dep, int x, int y) { warning("TODO: afff"); } + // (* external 'c:\mc\reusint.com'; *) void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } +// (* external 'c:\mc\demus.com'; *) +void demus(int Src, int Dst, int Tay) { + warning("TODO: demus"); +} + +// (* external 'c:\mc\phint.com'; *) +void litph(tablint &t, int typ, int tempo) { + warning("TODO: litph"); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 4cb40caaaa..4427bc03bf 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -383,7 +383,7 @@ extern int tbi[256]; extern chariot c1, c2, c3; extern float addfix; extern t_pcga palsav[91]; -extern doublet tabpal[91][16]; +extern doublet tabpal[91][17]; extern t_pcga palcga[91]; extern pattern tpt[15]; @@ -413,13 +413,20 @@ extern int memw[0xffff]; // Text screen functions not relevant for ScummVM #define clrscr {} #define clreol {} +#define graphcolormode {} extern void gotoxy(int x, int y); extern void textcolor(int c); extern void output(const Common::String &s); +extern void graphbackground(int c); extern int wherey; +// Stubs for input functions +extern bool keypressed(); +extern char get_ch(); + extern void palette(int v1); extern void intr(int intNum, registres ®s); +extern int get_random_number(int minval, int maxval); // (* external 'c:\mc\charecr.com'; *) extern void s_char(int Gd, int y, int dy); @@ -435,6 +442,10 @@ extern void decomp(int seg, int dep); extern void afff(int Gd, int seg, int dep, int x, int y); // (* external 'c:\mc\reusint.com'; *) extern void musyc(tablint &tb, int nbseg, int att); +// (* external 'c:\mc\demus.com'; *) +extern void demus(int Src, int Dst, int Tay); +// (* external 'c:\mc\phint.com'; *) +extern void litph(tablint &t, int typ, int tempo); } // End of namespace Mortevielle -- cgit v1.2.3 From 0766140a4e3f6b4c8e3dc206e0b361d1cbf82f33 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Dec 2011 22:53:24 +1100 Subject: MORTEVIELLE: Added stub engine implementation. Engine is now compilable. --- engines/mortevielle/detection.cpp | 70 ++++++++++++++++++++++++++++++++++ engines/mortevielle/detection_tables.h | 38 ++++++++++++++++++ engines/mortevielle/module.mk | 2 + engines/mortevielle/mort.cpp | 2 +- engines/mortevielle/mort.h | 3 +- engines/mortevielle/mortevielle.cpp | 47 +++++++++++++++++++++++ engines/mortevielle/mortevielle.h | 55 ++++++++++++++++++++++++++ 7 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 engines/mortevielle/detection.cpp create mode 100644 engines/mortevielle/detection_tables.h create mode 100644 engines/mortevielle/mortevielle.cpp create mode 100644 engines/mortevielle/mortevielle.h diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp new file mode 100644 index 0000000000..df8a6df407 --- /dev/null +++ b/engines/mortevielle/detection.cpp @@ -0,0 +1,70 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "base/plugins.h" +#include "engines/advancedDetector.h" + +#include "mortevielle/mortevielle.h" +#include "mortevielle/detection_tables.h" + +namespace Mortevielle { +uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->flags; } +} + +static const PlainGameDescriptor MortevielleGame[] = { + {"mortevielle", "Mortville Manor"}, + {0, 0} +}; + +class MortevielleMetaEngine : public AdvancedMetaEngine { +public: + MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::gameDescriptions, sizeof(ADGameDescription), + MortevielleGame) { + } + virtual const char *getName() const { + return "Mortevielle"; + } + + virtual const char *getOriginalCopyright() const { + return "Mortville Manor (C) 1988 Lankhor"; + } + + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual bool hasFeature(MetaEngineFeature f) const; +}; + +bool MortevielleMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + if (desc) { + *engine = new Mortevielle::MortevielleEngine(syst, desc); + } + return desc != 0; +} + +bool MortevielleMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; +} + +#if PLUGIN_ENABLED_DYNAMIC(MORTEVIELLE) + REGISTER_PLUGIN_DYNAMIC(MORTEVIELLE, PLUGIN_TYPE_ENGINE, MortevielleMetaEngine); +#else + REGISTER_PLUGIN_STATIC(MORTEVIELLE, PLUGIN_TYPE_ENGINE, MortevielleMetaEngine); +#endif diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h new file mode 100644 index 0000000000..4ea062b2b2 --- /dev/null +++ b/engines/mortevielle/detection_tables.h @@ -0,0 +1,38 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +namespace Mortevielle { + +static const ADGameDescription gameDescriptions[] = { + { + "mortevielle", + "", + AD_ENTRY1s("mortvielle.txt", "d41d8cd98f00b204e9800998ecf8427e", 0), + Common::FR_FRA, + Common::kPlatformPC, + ADGF_UNSTABLE, + GUIO1(GUIO_NOASPECT) + }, + AD_TABLE_END_MARKER +}; + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 3213d15b49..50ec3f0197 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS := \ actions.o \ alert.o \ boite.o \ + detection.o \ disk.o \ droite.o \ keyboard.o \ @@ -12,6 +13,7 @@ MODULE_OBJS := \ mor.o \ mor2.o \ mort.o \ + mortevielle.o \ mouse.o \ outtext.o \ ovd1.o \ diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index f3b0ac73ab..3a4df46ea5 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -66,7 +66,7 @@ void divers(int np, bool b) { /* NIVEAU 0 */ -int main(int argc, const char *argv[]) { +int mortevielle_main(int argc, const char *argv[]) { /*init_debug;*/ /* ecri_seg;*/ //pio_initialize(argc, argv); diff --git a/engines/mortevielle/mort.h b/engines/mortevielle/mort.h index fa42288963..8523774da6 100644 --- a/engines/mortevielle/mort.h +++ b/engines/mortevielle/mort.h @@ -32,7 +32,8 @@ namespace Mortevielle { extern void divers(int np, bool b); /* NIVEAU 0 */ -extern int main(int argc, const char *argv[]); +extern int mortevielle_main(int argc, const char *argv[]); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp new file mode 100644 index 0000000000..dd93555ee3 --- /dev/null +++ b/engines/mortevielle/mortevielle.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "mortevielle/mortevielle.h" +#include "mortevielle/mort.h" + +namespace Mortevielle { + +MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): + Engine(system), _gameDescription(gameDesc) { +} + +MortevielleEngine::~MortevielleEngine() { +} + +bool MortevielleEngine::hasFeature(EngineFeature f) const { + return false; +} + +Common::Error MortevielleEngine::run() { + // Dispatch to the game's main routine + const char *argv[] = { "" }; + mortevielle_main(1, argv); + + return Common::kNoError; +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h new file mode 100644 index 0000000000..406f8fe6d2 --- /dev/null +++ b/engines/mortevielle/mortevielle.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MORTEVIELLE_H +#define MORTEVIELLE_H + +#include "engines/advancedDetector.h" +#include "engines/engine.h" +#include "common/error.h" + +namespace Mortevielle { + +enum { + kMortevielleCore = 1 << 0 +}; + +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 200 + +class MortevielleEngine : public Engine { +private: + const ADGameDescription *_gameDescription; +public: + MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); + ~MortevielleEngine(); + virtual bool hasFeature(EngineFeature f) const; + virtual Common::Error run(); + + uint32 getGameFlags() const; +}; + +extern MortevielleEngine *g_vm; + +} // End of namespace Mortevielle + +#endif -- cgit v1.2.3 From 44002e9293a023976535da62206763a1ff9aab0a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Jan 2012 01:01:20 +1100 Subject: MORTEVIELLE: Fix data loading in chartex method --- engines/mortevielle/ovd1.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index e33f3e406a..3c532d0f22 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -199,7 +199,9 @@ void ani50() { if (!f.open("TXX.INP")) error("Missing file - TXX.INP"); - f.read(&t_mot, 125); + for (int i = 0; i < 125; ++i) + t_mot[i] = f.readSint16LE(); + f.close(); if (!f.open("TXX.NTP")) -- cgit v1.2.3 From fb216b263c5d97f1dcb4df5b4b45357be27fc1b9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Jan 2012 03:51:29 +0100 Subject: MORTEVIELLE: Add a couple of detection entries --- engines/mortevielle/detection.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index df8a6df407..53d4292392 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -35,17 +35,49 @@ static const PlainGameDescriptor MortevielleGame[] = { {0, 0} }; +static const ADGameDescription MortevielleGameDescriptions[] = { + { + "mortevielle", + "", + { + {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO0() + }, + { + "mortevielle", + "", + { + {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO0() + }, + AD_TABLE_END_MARKER +}; + class MortevielleMetaEngine : public AdvancedMetaEngine { public: - MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::gameDescriptions, sizeof(ADGameDescription), + MortevielleMetaEngine() : AdvancedMetaEngine(MortevielleGameDescriptions, sizeof(ADGameDescription), MortevielleGame) { + _md5Bytes = 512; + _singleid = "mortevielle"; } virtual const char *getName() const { return "Mortevielle"; } virtual const char *getOriginalCopyright() const { - return "Mortville Manor (C) 1988 Lankhor"; + return "Mortville Manor (C) 1988-89 Lankhor"; } virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; -- cgit v1.2.3 From 015565677c743fdbe00df5d114e7d3aa3d90e485 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Jan 2012 21:17:45 +1100 Subject: MORTEVIELLE: Bugfix for loading data in chartex() --- engines/mortevielle/ovd1.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 3c532d0f22..99b2e28df1 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -199,19 +199,22 @@ void ani50() { if (!f.open("TXX.INP")) error("Missing file - TXX.INP"); - for (int i = 0; i < 125; ++i) + assert(f.size() <= (maxti * 2)); + for (i = 0; i < f.size() / 2; ++i) t_mot[i] = f.readSint16LE(); f.close(); if (!f.open("TXX.NTP")) error("Missing file - TXX.NTP"); - do { + + assert(f.size() <= (maxtd * 4)); + for (i = 0; i < (f.size() + 3) / 4; ++i) { t_rec[i].indis = f.readSint16LE(); t_rec[i].point = f.readByte(); + f.readByte(); + } - i = i + 1; - } while (!f.eos()); f.close(); deline(578, s, i); -- cgit v1.2.3 From e76460e3628fb2855fc27dbbf2e8c684bd74f552 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Jan 2012 22:31:38 +1100 Subject: MORTEVIELLE: Bugfix for loading data in charpal() --- engines/mortevielle/ovd1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 99b2e28df1..751a0993f8 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -150,7 +150,7 @@ void ani50() { if (!ft.open("fxx.mor")) error("Missing file - fxx.mor"); - for (int i = 1; i < 108; ++i) + for (int i = 0; i < 108; ++i) l[i] = ft.readSint16LE(); ft.close(); -- cgit v1.2.3 From e3facc3f6c1f325b02f36eee8c3db08634206d61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Jan 2012 22:38:50 +1100 Subject: MORTEVIELLE: Bugfix for loading data in charge_cfiph() --- engines/mortevielle/ovd1.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 751a0993f8..6d17fccf5a 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -373,7 +373,9 @@ void ani50() { if (!f.open("cfiph.mor")) error("Missing file - cfiph.mor"); - f.read(t_cph, 50); + for (int i = 0; i < (f.size() / 2); ++i) + t_cph[i] = f.readSint16LE(); + f.close(); } -- cgit v1.2.3 From 1d2460523969db2270efb8d1a2358c1eb36cb2ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Jan 2012 13:50:07 +0100 Subject: MORTEVIELLE: Add some comments with translated strings --- engines/mortevielle/actions.cpp | 44 +++++++++++++++---------------- engines/mortevielle/boite.cpp | 1 + engines/mortevielle/disk.cpp | 8 +++--- engines/mortevielle/mor.cpp | 16 ++++++------ engines/mortevielle/mor2.cpp | 14 +++++----- engines/mortevielle/mort.cpp | 42 ++++++++++++++--------------- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/ovd1.cpp | 3 ++- engines/mortevielle/parole.cpp | 6 ++--- engines/mortevielle/prog.cpp | 58 ++++++++++++++++++++--------------------- engines/mortevielle/var_mor.cpp | 12 ++++----- engines/mortevielle/var_mor.h | 7 +++-- 12 files changed, 109 insertions(+), 104 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5b420fba22..81042c4ce2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,7 +42,7 @@ namespace Mortevielle { /* NIVEAU 4 */ -const char stouinon[] = "[2][ ][OUI][NON]"; +const char stouinon[] = "[2][ ][OUI][NON]"; //Translation: [2] [ ] [YES] [NO] /* overlay */ void taller() { @@ -56,7 +56,7 @@ void taller() { repon(2, s.mlieu); } if ((s.mlieu == 15) && (msg[4] == depl[6])) { - if (! syn) ecr3("aller"); + if (! syn) ecr3("aller"); //Translation: Go to tfleche(); if (iesc) okdes = false; if ((anyone) || (iesc)) return; @@ -169,7 +169,7 @@ L2: } return; } - if (! syn) ecr3("prendre"); + if (! syn) ecr3("prendre"); //Translation: Take tfleche(); if ((anyone) || (iesc)) return; if (caff == 3) { @@ -256,7 +256,7 @@ L2: { int cx; - if (! syn) ecr3("soulever"); + if (! syn) ecr3("soulever"); //Translation: Lift tfleche(); if ((anyone) || (iesc)) return; tcoord(3); @@ -282,7 +282,7 @@ L2: if (caff > 99) st4(caff); else { - if (! syn) ecr3("lire"); + if (! syn) ecr3("lire"); //Translation: Read tfleche(); if (!(anyone) && !(iesc)) { tcoord(4); @@ -303,7 +303,7 @@ L2: crep = 103; return; } - if (! syn) ecr3("regarder"); + if (! syn) ecr3("regarder"); //Translation: Look tfleche(); if ((anyone) || (iesc)) return; tcoord(5); @@ -364,7 +364,7 @@ L2: st7(caff); return; } - if (! syn) ecr3("fouiller"); + if (! syn) ecr3("fouiller"); //Translation: Search tfleche(); if (anyone || iesc) return; if (s.mlieu == 23) { @@ -431,7 +431,7 @@ L2: /* overlay */ void touvrir() { int cx, haz; - if (! syn) ecr3("ouvrir"); + if (! syn) ecr3("ouvrir"); //Translation: Open if (caff == 26) { if (ment != 0) { msg[4] = entrer; @@ -492,7 +492,7 @@ L2: crep = 186; return; } - if (! syn) ecr3("mettre"); + if (! syn) ecr3("mettre"); //Translation: Put tfleche(); if (iesc) crep = 998; if ((anyone) || (iesc)) return; @@ -591,7 +591,7 @@ L2: crep = 149; return; } - if (! syn) ecr3("tourner"); + if (! syn) ecr3("tourner"); //Translation: Turn tfleche(); if ((anyone) || (iesc)) return; tcoord(9); @@ -618,7 +618,7 @@ L2: } /* overlay */ void tcacher() { - if (! syn) ecr3("se cacher"); + if (! syn) ecr3("se cacher"); //Translation: Hide self tfleche(); if (!(anyone) && !(iesc)) { tcoord(10); @@ -633,7 +633,7 @@ L2: /* overlay */ void tattacher() { if (s.derobj == 0) crep = 186; else { - if (! syn) ecr3("attacher"); + if (! syn) ecr3("attacher"); //Translation: Tie tfleche(); if (!(anyone) && !(iesc)) { tcoord(8); @@ -653,7 +653,7 @@ L2: /* overlay */ void tfermer() { int cx, chai; - if (! syn) ecr3("fermer"); + if (! syn) ecr3("fermer"); //Translation: Close if (caff < 26) { tfleche(); if (iesc) crep = 998; @@ -682,9 +682,9 @@ L2: /* overlay */ void tfrapper() { int l, p, haz; - if (! syn) ecr3("frapper"); + if (! syn) ecr3("frapper"); //Translation: Hit if (s.mlieu == 15) { - l = do_alert("[1][ | Avant, utilisez le menu DEP...][ok]", 1); + l = do_alert("[1][ | Avant, utilisez le menu DEP...][ok]", 1); //Translation: [1] [ | Before, use the DEP menu...] [Ok] return; } if (s.mlieu < 25) { @@ -882,7 +882,7 @@ L2: } /* overlay */ void tdormir() { - const char m1[] = "D‚sirez-vous vous r‚veiller?"; + const char m1[] = "D‚sirez-vous vous r‚veiller?"; //Translation: Do you want to wake up? int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { @@ -922,7 +922,7 @@ L2: } /* overlay */ void tdefoncer() { - if (! syn) ecr3("d‚foncer"); + if (! syn) ecr3("d‚foncer"); //Translation: Smash if (caff < 25) tfleche(); if ((! anyone) && (! iesc)) if (s.mlieu != 26) crep = 997; @@ -982,7 +982,7 @@ L2: } /* overlay */ void tsonder() { - if (! syn) ecr3("sonder"); + if (! syn) ecr3("sonder"); //Translation: Probe if (caff < 27) { tfleche(); if (!(anyone) && (! iesc)) crep = 145; @@ -1166,7 +1166,7 @@ L2: /* overlay */ void tsentir() { crep = 119; if (caff < 26) { - if (! syn) ecr3("sentir"); + if (! syn) ecr3("sentir"); //Translation: Smell tfleche(); if (!(anyone) && !(iesc)) if (caff == 16) crep = 153; @@ -1177,14 +1177,14 @@ L2: /* overlay */ void tgratter() { crep = 155; if (caff < 27) { - if (! syn) ecr3("gratter"); + if (! syn) ecr3("gratter"); //Translation: Scratch tfleche(); } num = 0; } /* NIVEAU 2 */ -/* overlay */ void tmaj1() { /* Le jeu est termin‚ !!! */ +/* overlay */ void tmaj1() { /* Le jeu est termin‚ !!! */ //Translation: The game is over!!! arret = true; tlu(13, 152); maivid(); @@ -1215,7 +1215,7 @@ L2: inzon(); } -/* overlay */ void tencore() { /* Perdu !!! */ +/* overlay */ void tencore() { /* Perdu !!! */ //Translation: You lost! int quel; clsf2(); diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 0a3b5dac23..6e2976964d 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -31,6 +31,7 @@ namespace Mortevielle { +//Translation: box() void boite(int x, int y, int dx, int dy, int coul) { int i; int xi, yi, xo, yo; diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index e2b1b9ab2b..8a889f2130 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -47,7 +47,7 @@ void dem1() { /* Deprecated in ScummVM int k; - // -- demande de disk 1 -- + // -- demande de disk 1 -- //Translation: Ask for disk #1 assign(f, "mort.005"); //*$i-* k = ioresult; @@ -106,9 +106,9 @@ void ld_game(int n) { hide_mouse(); maivid(); takesav(n); - /* -- disquette 2 -- */ + /* -- disquette 2 -- */ //Translation: Floppy #2 dem2(); - /* -- mises en place -- */ + /* -- mises en place -- */ //Translation: Initialization theure(); dprog(); antegame(); @@ -122,7 +122,7 @@ void sv_game(int n) { hide_mouse(); tmaj3(); dem1(); - /* -- sauvegarde du fichier 'sauve#n.mor' -- */ + /* -- sauvegarde du fichier 'sauve#n.mor' -- */ //Translation: save file 'sauve%d.mor' for (i = 0; i <= 389; i ++) bufcha[i] = tabdon[i + acha]; s1 = s; if (s1.mlieu == 26) s1.mlieu = 15; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 556c7b4e14..47430ba220 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -42,7 +42,7 @@ namespace Mortevielle { /* Niveau 14 suite */ -const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; +const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; //Translation: Someone enters, looks surised, but says nothing // For ScummVM, we need to do check for file errors where we do the file access const int ioresult = 0; @@ -146,7 +146,7 @@ void initouv() { } void ecrf1() { - boite(0, 11, 512, 163, 15); /* grand dessin */ + boite(0, 11, 512, 163, 15); /* grand dessin */ //Translation: Large drawing } void clsf1() { @@ -614,9 +614,9 @@ void affper(int per) { } void person() { - const char m1[] = "Vous"; - const char m2[] = "tes"; - const char m3[] = "SEUL"; + const char m1[] = "Vous"; //Translation: You + const char m2[] = "tes"; //Translation: are + const char m3[] = "SEUL"; //Translation: ALONE int cf; Common::String str_; @@ -671,7 +671,7 @@ void pendule() { else writeg("AM ", 1); putxy(550, 160); if ((jou >= 0) && (jou <= 8)) { - Common::String tmp("& jour"); + Common::String tmp("& jour"); //Translation: Day tmp.insertChar((char)(jou + 49), 0); writeg(tmp, 1); } @@ -1322,9 +1322,9 @@ void dessin(int ad) { clsf1(); if (caff > 99) { dessine(ades, 60, 33); - boite(118, 32, 291, 121, 15); /* cadre moyen */ + boite(118, 32, 291, 121, 15); /* cadre moyen */ //Translation: Medium box } else if (caff > 69) { - dessine(ades, 112, 48); /* ttes */ + dessine(ades, 112, 48); /* ttes */ //Translation: Heads boite(222, 47, 155, 91, 15); } else { dessine(ades, 0, 12); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c650002a57..1c2936d188 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -46,9 +46,9 @@ const int men[12] = { 0, }; void tinke() { - const char m1[] = "Mince! Vous entendez du bruit..."; - const char d1[] = " | Vous devriez avoir remarqu‚| "; - const char d2[] = "% des indices..."; + const char m1[] = "Mince! Vous entendez du bruit..."; //Translation: Gosh! You hear some noise... + const char d1[] = " | Vous devriez avoir remarqu‚| "; //Translation: You should have noticed + const char d2[] = "% des indices..."; //Translation: %s of hints const char d3 = '['; const char d4 = ']'; const char d5 = '1'; @@ -465,18 +465,18 @@ void ajjer(int ob) { } else crep = 139; } -void t1sama() { /* On entre dans le manoir */ +void t1sama() { /* On entre dans le manoir */ //Translation: Entering manor int j, h, m; bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { cherjer(137, d); - if (! d) { /* On n'a pas les cl‚s et il est tard */ + if (! d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late crep = 1511; tperd(); } else st1sama(); - } else if (! s.ipre) { /* c'est votre premiŠre fois ? */ + } else if (! s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? ipers = 255; affper(ipers); caff = 77; @@ -767,7 +767,7 @@ void st13(int ob) { void aldepl() { int dummy; - dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); + dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); //Translation: [1] [So, use the DEP menu] [Ok] } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 3a4df46ea5..5975bde459 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -26,28 +26,28 @@ */ #include "mortevielle/mort.h" -#include "mortevielle/var_mor.h" /* les variables */ -#include "mortevielle/keyboard.h" /* la gestion du clavier */ -#include "mortevielle/mouse.h" /* la souris */ -#include "mortevielle/level15.h" /* les fonctions de base */ -#include "mortevielle/droite.h" /* pour faire une droite */ -#include "mortevielle/boite.h" -#include "mortevielle/sprint.h" /* l'affichage des textes */ -#include "mortevielle/outtext.h" /* fonctions sup‚rieures d'affichage */ -#include "mortevielle/parole.h" /* les fonctions de la parole */ +#include "mortevielle/var_mor.h" /* les variables */ //Translation: Variables +#include "mortevielle/keyboard.h" /* la gestion du clavier */ //Translation: Keyboard manager +#include "mortevielle/mouse.h" /* la souris */ //Translation: Mouse +#include "mortevielle/level15.h" /* les fonctions de base */ //Translation: Lowlevel functions +#include "mortevielle/droite.h" /* pour faire une droite */ //Translation: Display a lign +#include "mortevielle/boite.h" //Translation: Box +#include "mortevielle/sprint.h" /* l'affichage des textes */ //Translation: Display texts +#include "mortevielle/outtext.h" /* fonctions sup‚rieures d'affichage */ //Translation: Highlevel display functions +#include "mortevielle/parole.h" /* les fonctions de la parole */ //Translation: Speech functions #include "mortevielle/alert.h" -#include "mortevielle/parole2.h" /* les fonctions de la parole */ -/* debug le debugging */ -#include "mortevielle/ques.h" /* les questions */ -#include "mortevielle/menu.h" /* les fonctions du menu */ -#include "mortevielle/mor.h" /* divers */ -#include "mortevielle/taffich.h" /* chargement des dessins */ -#include "mortevielle/ovd1.h" /* les fonctions sur disque 1 */ -#include "mortevielle/mor2.h" /* divers */ -#include "mortevielle/actions.h" /* les actions */ -#include "mortevielle/prog.h" /* fonctions toplevel */ -#include "mortevielle/disk.h" /* chargements et sauvegardes */ -/* ecrihexa utilitaire */ +#include "mortevielle/parole2.h" /* les fonctions de la parole */ //Translation: Speech functions +/* debug le debugging */ //Translation: Debugger +#include "mortevielle/ques.h" /* les questions */ //Translation: Questions +#include "mortevielle/menu.h" /* les fonctions du menu */ //Translation: Menu functions +#include "mortevielle/mor.h" /* divers */ //Translation: Misc +#include "mortevielle/taffich.h" /* chargement des dessins */ //Translation: pictures loader +#include "mortevielle/ovd1.h" /* les fonctions sur disque 1 */ //Translation: Disk functions +#include "mortevielle/mor2.h" /* divers */ //Translation: Misc +#include "mortevielle/actions.h" /* les actions */ //Translation: Actions +#include "mortevielle/prog.h" /* fonctions toplevel */ //Translation: toplevel functions +#include "mortevielle/disk.h" /* chargements et sauvegardes */ //Translation: Load/Save +/* ecrihexa utilitaire */ //Translation: Toolbox namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index c9bdcc7292..e70ee10c6e 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -142,7 +142,7 @@ void deline(int num , char *l , int &tl) { j = j + 1; } while (!the_end); tl = j - 1; - if (tl < 255) delig = copy(delig, 1, tl - 1); /* enleve le $ */ + if (tl < 255) delig = copy(delig, 1, tl - 1); /* enleve le $ */ //Translation: Remove '$' } /* DETEX */ diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 6d17fccf5a..cc094082c8 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -104,7 +104,7 @@ void ani50() { f.read(lettres, 7 * 24); f.close(); - /* ---- Demande de changement de disquette ---- */ + // Ask to swap floppy dem2(); @@ -279,6 +279,7 @@ void ani50() { gotoxy(1, 23); clreol; gotoxy(26, 23); + // "Play using keyboard / ... mouse" output("Jeu au Clavier / … la Souris"); textcolor(4); gotoxy(33, 23); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 3c78b04f00..fa71a1e500 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -148,7 +148,7 @@ void veracf(byte b) { Common::File f; int i; - if (!f.open("bruits")) + if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); f.read(&mem[adbruit + 0], 250); @@ -263,7 +263,7 @@ void veracf(byte b) { case 2: case 3 : { - d3 = c2.code + 5; /* 7 ou 8 => voyelle correspondante */ + d3 = c2.code + 5; /* 7 ou 8 => voyelle correspondante */ //Translation: Corresponding vowel if (c1.code > 4) { veracf(c2.acc); if (c1.code == 9) { @@ -318,7 +318,7 @@ void veracf(byte b) { else d3 = 6; if (c2.rep >= 5) { c2.rep = c2.rep - 5; - d3 = 8 - d3; /* echange 2 et 6 */ + d3 = 8 - d3; /* echange 2 et 6 */ //Translation: swap 2 and 6 } if (c2.code == 0) { i = c2.rep; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 760560eb53..236e785199 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -178,38 +178,38 @@ void tsitu() 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) { + if (msg[3] == depla) taller(); //Translation: go to + if (msg[3] == discut) tparler(); //Translation: talk + if (msg[3] == invent) tsprendre(); //Translation: inventory/take + if (msg[4] == attacher) tattacher(); //Translation: tie + if (msg[4] == attendre) tattendre(); //Translation: wait + if (msg[4] == defoncer) tdefoncer(); //Translation: smash + if (msg[4] == dormir) tdormir(); //Translation: sleep + if (msg[4] == ecouter) tecouter(); //Translation: listen + if (msg[4] == entrer) tentrer(); //Translation: enter + if (msg[4] == fermer) tfermer(); //Translation: close + if (msg[4] == fouiller) tfouiller(); //Translation: search + if (msg[4] == frapper) tfrapper(); //Translation: hit + if (msg[4] == gratter) tgratter(); //Translation: scratch + if (msg[4] == lire) tlire(); //Translation: read + if (msg[4] == manger) tmanger(); //Translation: eat + if (msg[4] == mettre) tmettre(); //Translation: put + if (msg[4] == ouvrir) touvrir(); //Translation: open + if (msg[4] == prendre) tprendre(); //Translation: take + if (msg[4] == regarder) tregarder(); //Translation: look + if (msg[4] == sentir) tsentir(); //Translation: smell + if (msg[4] == sonder) tsonder(); //Translation: probe + if (msg[4] == sortir) tsortir(); //Translation: exit + if (msg[4] == soulever) tsoulever(); //Translation: lift + if (msg[4] == tourner) ttourner(); //Translation: turn + if (msg[4] == scacher) { //Translation: hide tcacher(); goto L1; } - if (msg[4] == sfouiller) tsfouiller(); - if (msg[4] == slire) tslire(); - if (msg[4] == sposer) tposer(); - if (msg[4] == sregarder) tsregarder(); + if (msg[4] == sfouiller) tsfouiller();//Translation: search + if (msg[4] == slire) tslire(); //Translation: read + if (msg[4] == sposer) tposer(); //Translation: put + if (msg[4] == sregarder) tsregarder();//Translation: look cache = false; L1: if (anyone) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 33ddfe64cc..1a4a88e4ea 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -72,16 +72,16 @@ const byte don[9][5] = { const char *fic[3] = { "", - " Sauvegarde", - " Chargement" + " Sauvegarde", // Translation: "Save" + " Chargement" // Translation: "Load" }; const byte addv[2] = {8, 8}; -const char recom[] = " Recommence "; +const char recom[] = " Recommence "; // Translation: "Restart" -const char f3[] = "F3: Encore"; -const char f8[] = "F8: Suite"; +const char f3[] = "F3: Encore"; // Translation: "F3: More" +const char f8[] = "F8: Suite"; // Translation: "F8: Next" const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; @@ -189,7 +189,7 @@ int x, int t_cph[6401]; byte tabdon[4001]; /* t_dxx : array[0..121] of int;*/ -Common::String stpou; /* donne le % d'indices */ +Common::String stpou; /* donne le % d'indices */ //Translation: "Provides the % of hints" byte is; char mode; Common::String al_mess, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 4427bc03bf..5fda6ae2d9 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -32,6 +32,9 @@ namespace Mortevielle { +// Constants, types and variables used by Mortville Manor. +// version Nov.'88, Music and speech Oct.'88 + /* Constantes, Types et Variables pour le M A N O I R DE M O R T E V I E L L E @@ -100,7 +103,7 @@ const int c_dialpre = 456; const int c_action = 476; const int c_saction = 497; const int c_dis = 502; -const int c_fin = 510; /* => n'existe pas ; si !! */ +const int c_fin = 510; /* => n'existe pas ; si !! */ // Translation: "=> doesn't exist ; yes !!" const int arega = 0; const int asoul = 154; @@ -345,7 +348,7 @@ extern int x, extern int t_cph[6401]; extern byte tabdon[4001]; /* t_dxx : array[0..121] of int;*/ -extern Common::String stpou; /* donne le % d'indices */ +extern Common::String stpou; /* donne le % d'indices */ // Translation: "provides the % of hints" extern byte is; extern char mode; extern Common::String al_mess, -- cgit v1.2.3 From 2277f8f122f20227658d82b41b52bda8a2cdc85f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 12:18:57 +1100 Subject: MORTEVIELLE: Reimplemented the zzuul assembly routine in C code --- engines/mortevielle/asm.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++ engines/mortevielle/asm.h | 36 ++++++++++++++++++++++++++++++ engines/mortevielle/module.mk | 1 + 3 files changed, 89 insertions(+) create mode 100644 engines/mortevielle/asm.cpp create mode 100644 engines/mortevielle/asm.h diff --git a/engines/mortevielle/asm.cpp b/engines/mortevielle/asm.cpp new file mode 100644 index 0000000000..2d057a38f9 --- /dev/null +++ b/engines/mortevielle/asm.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/scummsys.h" + +namespace Mortevielle { + +/** + * Decodes a number of 64 byte blocks + * @param pStart Start of data + * @param count Number of 64 byte blocks + */ +void zzuul(byte *pStart, int count) { + while (count-- > 0) { + for (int idx = 0; idx < 64; ++pStart, ++idx) { + uint16 v = ((*pStart - 0x80) << 1) + 0x80; + + if (v & 0x8000) + *pStart = 0; + else if (v & 0xff00) + *pStart = 0xff; + else + *pStart = (byte)v; + } + } +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/asm.h b/engines/mortevielle/asm.h new file mode 100644 index 0000000000..11793b3d46 --- /dev/null +++ b/engines/mortevielle/asm.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_ASM_H +#define MORTEVIELLE_ASM_H + +namespace Mortevielle { + +extern void zzuul(byte *pStart, int count); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 50ec3f0197..21cb02587a 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -3,6 +3,7 @@ MODULE := engines/mortevielle MODULE_OBJS := \ actions.o \ alert.o \ + asm.o \ boite.o \ detection.o \ disk.o \ -- cgit v1.2.3 From 45f75c901cee61ffcc0c5f34de3d4399fb4dc877 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 12:20:34 +1100 Subject: MORTEVIELLE: Reimplemented the loading of cfiec.mor more cleanly This includes changing the absolute memory address loading to an array buffer, and changing calls to the zzuul method to use the reimplemented version. --- engines/mortevielle/keyboard.cpp | 3 ++- engines/mortevielle/mort.cpp | 6 ++++-- engines/mortevielle/ovd1.cpp | 4 +--- engines/mortevielle/var_mor.cpp | 7 ++----- engines/mortevielle/var_mor.h | 13 ++++--------- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 992a268b01..dae117e110 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -27,6 +27,7 @@ #include "mortevielle/keyboard.h" #include "mortevielle/var_mor.h" +#include "mortevielle/asm.h" namespace Mortevielle { @@ -70,7 +71,7 @@ int testou() { break; case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { - zzuul(adcfiec + 161, 0, 1644); + zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); c_zzz = succ(int, c_zzz); testou_result = 61; return testou_result; diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 5975bde459..ea8cbcb663 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -27,6 +27,7 @@ #include "mortevielle/mort.h" #include "mortevielle/var_mor.h" /* les variables */ //Translation: Variables +#include "mortevielle/asm.h" #include "mortevielle/keyboard.h" /* la gestion du clavier */ //Translation: Keyboard manager #include "mortevielle/mouse.h" /* la souris */ //Translation: Mouse #include "mortevielle/level15.h" /* les fonctions de base */ //Translation: Lowlevel functions @@ -78,7 +79,7 @@ int mortevielle_main(int argc, const char *argv[]) { charpal(); charge_cfiph(); charge_cfiec(); - zzuul(adcfiec + 161, 0, 1644); + zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); c_zzz = 1; init_nbrepm(); init_mouse(); @@ -123,7 +124,8 @@ int mortevielle_main(int argc, const char *argv[]) { adzon(); takesav(0); if (rech_cfiec) charge_cfiec(); - for (crep = 1; crep <= c_zzz; crep ++) zzuul(adcfiec + 161, 0, 1644); + for (crep = 1; crep <= c_zzz; crep ++) + zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); charge_bruit5(); init_menu(); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index cc094082c8..6400463a18 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -359,9 +359,7 @@ void ani50() { if (!f.open("cfiec.mor")) error("Missing file - cfiec.mor"); - /*$i-*/ - f.read(&mem[adcfiec + 0], 511); - f.read(&mem[adcfiec + 4088 + 0], 311); + f.read(&adcfiec[0], 822 * 128); f.close(); rech_cfiec = false; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 1a4a88e4ea..a017e55c0d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -231,6 +231,8 @@ doublet tabpal[91][17]; t_pcga palcga[91]; pattern tpt[15]; +byte adcfiec[(4088 * 16) + (311 * 0x80)]; + /*---------------------------------------------------------------------------*/ /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ /*---------------------------------------------------------------------------*/ @@ -385,11 +387,6 @@ void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { warning("TODO: box method not yet implemented"); } -// (* external 'c:\mc\zuul.com'; *) -void zzuul(int ad, int seg, int tai) { - warning("TODO: zzuul"); -} - // (* external 'c:\mc\decomp.com'; *) void decomp(int seg, int dep) { warning("TODO: decomp"); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5fda6ae2d9..c75fc78081 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -32,9 +32,6 @@ namespace Mortevielle { -// Constants, types and variables used by Mortville Manor. -// version Nov.'88, Music and speech Oct.'88 - /* Constantes, Types et Variables pour le M A N O I R DE M O R T E V I E L L E @@ -69,7 +66,6 @@ const int segdon = 0x6c00; const int adani = 0x7314; const int adword = 0x4000; const int adtroct = 0x406b; -const int adcfiec = 0x4300; const int adbruit = 0x5cb0;/*2C00;*/ const int adbruit1 = 0x6924;/*3874;*/ const int adbruit2 = 0x6b30;/*3A80;*/ @@ -103,7 +99,7 @@ const int c_dialpre = 456; const int c_action = 476; const int c_saction = 497; const int c_dis = 502; -const int c_fin = 510; /* => n'existe pas ; si !! */ // Translation: "=> doesn't exist ; yes !!" +const int c_fin = 510; /* => n'existe pas ; si !! */ const int arega = 0; const int asoul = 154; @@ -174,7 +170,6 @@ extern const char f8[]; extern const byte rang[16]; - /*---------------------------------------------------------------------------*/ /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -348,7 +343,7 @@ extern int x, extern int t_cph[6401]; extern byte tabdon[4001]; /* t_dxx : array[0..121] of int;*/ -extern Common::String stpou; /* donne le % d'indices */ // Translation: "provides the % of hints" +extern Common::String stpou; /* donne le % d'indices */ extern byte is; extern char mode; extern Common::String al_mess, @@ -390,6 +385,8 @@ extern doublet tabpal[91][17]; extern t_pcga palcga[91]; extern pattern tpt[15]; +extern byte adcfiec[822 * 128]; + /*---------------------------------------------------------------------------*/ /*------------------- PROCEDURES AND FONCTIONS ------------------------*/ /*---------------------------------------------------------------------------*/ @@ -437,8 +434,6 @@ extern void s_char(int Gd, int y, int dy); extern void s_sauv(int Gd, int y, int dy); // (* external 'c:\mc\boite.com'; *) extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); -// (* external 'c:\mc\zuul.com'; *) -extern void zzuul(int ad, int seg, int tai); // (* external 'c:\mc\decomp.com'; *) extern void decomp(int seg, int dep); // (* external 'c:\mc\affich.com'; *) -- cgit v1.2.3 From 39190ac009ba7139b170376b05e35048fcfe4cbb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 12:22:52 +1100 Subject: MORTEVIELLE: Fixed some compiler warnings --- engines/mortevielle/sprint.cpp | 5 ++--- engines/mortevielle/taffich.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 0523651ad9..b35bff9dc1 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -45,8 +45,7 @@ void writeg(Common::String l, int c) { int i, x, xo, yo; - int cecr; - bool t; + int cecr = 0; /* debug('writeg : '+l);*/ @@ -81,7 +80,7 @@ void writeg(Common::String l, int c) } xo = xo + 1; yo = yo + 1; - for (x = 1; x <= l.size(); x ++) { + for (x = 1; x <= (int)l.size(); x ++) { affcar(gd, xo, yo, cecr, ord(l[x])); xo = xo + i; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 3cde8eb015..1a126d02b1 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -105,7 +105,7 @@ void taffich() { int i, m, a, b, cx, handle, npal; - float lgt, lhandle; + float lgt; Common::String nom; int palh, k, j; int alllum[16]; -- cgit v1.2.3 From 3e0b4d3774c282ee2e31a3abb2b5d614da0ca311 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 12:29:22 +1100 Subject: MORTEVIELLE: Cleaned up the init_nbrepm method --- engines/mortevielle/mor.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 47430ba220..bfb8655df5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -989,11 +989,8 @@ void init_nbrepm() { int i; /* debug('init_nbrepm'); */ - i = 0; - do { - i = succ(int, i); - nbrepm[i] = ipm[i]; - } while (!(i == 8)); + for (int idx = 0; idx < 9; ++idx) + nbrepm[idx] = ipm[idx]; } void phaz(int &haz, int &p, int cf) { -- cgit v1.2.3 From 9957819311af589fd24958c66147b32e03b26c47 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 12:37:23 +1100 Subject: MORTEVIELLE: Bugfix for loading data in init_lieu method --- engines/mortevielle/ovd1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 6400463a18..eb0bd8b20b 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -300,7 +300,8 @@ void ani50() { error("Missing file - MXX.mor"); for (int i = 1; i < 8; ++i) - f_lieu.read(&v_lieu[i][1], 24); + for (int j = 0; j < 25; ++j) + v_lieu[i][j] = f_lieu.readByte(); f_lieu.close(); } -- cgit v1.2.3 From 2a6ec0eaa6d46b66ae05574f18ff79c0a0c18ed0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Jan 2012 21:29:11 +1100 Subject: MORTEVIELLE: Correct loading of the text data index, and fixed decoding of text lines --- engines/mortevielle/outtext.cpp | 14 +++++++++----- engines/mortevielle/ovd1.cpp | 7 +++---- engines/mortevielle/var_mor.cpp | 4 +++- engines/mortevielle/var_mor.h | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e70ee10c6e..b42aa481ba 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -72,11 +72,11 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { (uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9' }; */ - int oct, ocd; + uint16 oct, ocd; /* 5-8 */ oct = t_mot[idx]; - oct = (uint)(oct << (16 - pt)) >> (16 - pt); + oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { idx = idx + 1; oct = oct << (5 - pt); @@ -96,7 +96,7 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { case 30: case 31 : { ocd = t_mot[idx]; - ocd = (uint)(ocd << (16 - pt)) >> (16 - pt); + ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { idx = idx + 1; ocd = ocd << (5 - pt); @@ -119,7 +119,10 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { } } /* 5-8 */ -void deline(int num , char *l , int &tl) { +/** + * Decode and extract the line with the given Id + */ +void deline(int num, char *l , int &tl) { int i, j, ts; char let; byte ps, k; @@ -142,7 +145,8 @@ void deline(int num , char *l , int &tl) { j = j + 1; } while (!the_end); tl = j - 1; - if (tl < 255) delig = copy(delig, 1, tl - 1); /* enleve le $ */ //Translation: Remove '$' + if (tl < 255) + delig.deleteLastChar(); // Remove trailing '$' } /* DETEX */ diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index eb0bd8b20b..4eb990c7f6 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -201,18 +201,17 @@ void ani50() { assert(f.size() <= (maxti * 2)); for (i = 0; i < f.size() / 2; ++i) - t_mot[i] = f.readSint16LE(); + t_mot[i] = f.readUint16LE(); f.close(); if (!f.open("TXX.NTP")) error("Missing file - TXX.NTP"); - assert(f.size() <= (maxtd * 4)); - for (i = 0; i < (f.size() + 3) / 4; ++i) { + assert(f.size() <= (maxtd * 3)); + for (i = 0; i < (f.size() / 3); ++i) { t_rec[i].indis = f.readSint16LE(); t_rec[i].point = f.readByte(); - f.readByte(); } f.close(); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index a017e55c0d..0d3f88dcdc 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/debug.h" #include "common/str.h" #include "common/textconsole.h" #include "mortevielle/sprint.h" @@ -216,7 +217,7 @@ byte lettres[7][24]; byte palher[16]; -int t_mot[maxti + 1]; +uint16 t_mot[maxti + 1]; int tay_tchar; ind t_rec[maxtd + 1]; //file sauv_t; @@ -349,6 +350,7 @@ void gotoxy(int x, int y) { void textcolor(int c) { } void output(const Common::String &s) { + debug(s.c_str()); } void graphbackground(int c) { } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index c75fc78081..63d3112760 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -370,7 +370,7 @@ extern byte lettres[7][24]; extern byte palher[16]; -extern int t_mot[maxti + 1]; +extern uint16 t_mot[maxti + 1]; extern int tay_tchar; extern ind t_rec[maxtd + 1]; //file sauv_t; -- cgit v1.2.3 From de974c908feded56b39ff514e34f15b57b862ef2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 3 Jan 2012 20:47:05 +1100 Subject: MORTEVIELLE: Initialise graphics, and hardcode game mode to EGA graphics with mouse enabled --- engines/mortevielle/mortevielle.cpp | 4 ++++ engines/mortevielle/mortevielle.h | 4 ++-- engines/mortevielle/ovd1.cpp | 12 ++++++++++-- engines/mortevielle/var_mor.cpp | 23 ++++++++++++----------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index dd93555ee3..68b8dbeeb4 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -20,6 +20,7 @@ * */ +#include "engines/util.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mort.h" @@ -37,6 +38,9 @@ bool MortevielleEngine::hasFeature(EngineFeature f) const { } Common::Error MortevielleEngine::run() { + // Initialise graphics mode + initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); + // Dispatch to the game's main routine const char *argv[] = { "" }; mortevielle_main(1, argv); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 406f8fe6d2..14bee28a03 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -33,8 +33,8 @@ enum { kMortevielleCore = 1 << 0 }; -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 200 +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 400 class MortevielleEngine : public Engine { private: diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 4eb990c7f6..a1a47a2913 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -232,7 +232,7 @@ void ani50() { int cy, tay; char st[1410]; float ix; - char ch; +// char ch; /* debug('o3 dialpre'); */ @@ -257,6 +257,8 @@ void ani50() { output("CARTE GRAPHIQUE CGA EGA HERCULE/AT&T400 TANDY AMSTRAD1512"); gotoxy(12, 24); output("Ctrl C E H T A"); + +/* do { ch = get_ch(); // input >> kbd >> ch; } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); @@ -272,7 +274,10 @@ void ani50() { case '\24' : gd = tan; break; - } + }*/ + // Hardcode display mode to EGA + gd = ega; + gotoxy(1, 24); clreol; gotoxy(1, 23); @@ -285,10 +290,13 @@ void ani50() { output("C"); gotoxy(48, 23); output("S"); + /* do { ch = get_ch(); // input >> kbd >> ch; } while ((ch != 'C') && (ch != 'S')); int_m = (toupper(ch) == 'S'); + */ + int_m = true; } /* overlay */ void init_lieu() { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0d3f88dcdc..a8b10c1201 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -239,6 +239,8 @@ byte adcfiec[(4088 * 16) + (311 * 0x80)]; /*---------------------------------------------------------------------------*/ void hirs() { + /* Deprecated set graphics + const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; int i; @@ -253,21 +255,19 @@ void hirs() { break; case ams : { hires; - /* - inline_((float)(0xb8) / 6 / 0 / // => mov ax,6 - 0xcd / 0x10); // => int 16 + //inline_((float)(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_((float)(0xb8) / 14 / 0 / // MOV AX, 14 ; mode video 14 = 640*200 16 couleurs - 0xcd / 0x10); // INT 16 - */ + //inline_((float)(0xb8) / 14 / 0 / // MOV AX, 14 ; mode video 14 = 640*200 16 couleurs + // 0xcd / 0x10); // INT 16 + res = 2; } break; @@ -278,9 +278,9 @@ void hirs() { port[0x3b4] = i; port[0x3b5] = herc[i]; } - /* - inline_((float)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); - */ + + //inline_((float)(0xfc) / 0xb9 / 0 / 0x80 / 0xb8 / 0 / 0xb0 / 0x8e / 0xc0 / 0x31 / 0xff / 0x31 / 0xc0 / 0xf3 / 0xab); + port[0x3b8] = 10; res = 2; } @@ -303,6 +303,7 @@ void hirs() { } break; } + */ } /* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ -- cgit v1.2.3 From 2e95ac70b29ee420aebf532ae1b28e1803b91b0a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 3 Jan 2012 20:54:25 +1100 Subject: MORTEVIELLE: Fix character indexing in writeg() --- engines/mortevielle/sprint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index b35bff9dc1..e6a172b821 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -81,7 +81,7 @@ void writeg(Common::String l, int c) xo = xo + 1; yo = yo + 1; for (x = 1; x <= (int)l.size(); x ++) { - affcar(gd, xo, yo, cecr, ord(l[x])); + affcar(gd, xo, yo, cecr, ord(l[x - 1])); xo = xo + i; } show_mouse(); -- cgit v1.2.3 From 60f287c85d146c0bc8eca96fb9570036426c4ec1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 Jan 2012 22:59:21 +1100 Subject: MORTEVIELLE: New create_mortdat project to create a mort.dat data file At the moment, this extracts needed font data from the mort.com executable. --- devtools/create_mortdat/create_mortdat.cpp | 152 +++++++++++++++++++++++++++++ devtools/create_mortdat/module.mk | 11 +++ dists/engine-data/mort.dat | Bin 0 -> 736 bytes 3 files changed, 163 insertions(+) create mode 100644 devtools/create_mortdat/create_mortdat.cpp create mode 100644 devtools/create_mortdat/module.mk create mode 100644 dists/engine-data/mort.dat diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp new file mode 100644 index 0000000000..62b81806bc --- /dev/null +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -0,0 +1,152 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Lure of the Temptress lure.exe executable files into a new file + * lure.dat - this file is required for the ScummVM Lure of the Temptress module + * to work properly + */ + +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include +#include +#include + +#include "common/endian.h" + +enum AccessMode { + kFileReadMode = 1, + kFileWriteMode = 2 +}; + +class File { +private: + FILE *f; +public: + bool open(const char *filename, AccessMode mode = kFileReadMode) { + f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); + return (f != NULL); + } + void close() { + fclose(f); + f = NULL; + } + int seek(int32 offset, int whence = SEEK_SET) { + return fseek(f, offset, whence); + } + long read(void *buffer, int len) { + return fread(buffer, 1, len, f); + } + void write(const void *buffer, int len) { + fwrite(buffer, 1, len, f); + } + byte readByte() { + byte v; + read(&v, sizeof(byte)); + return v; + } + uint16 readWord() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); + } + uint32 readLong() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_LE_32(v); + } + void writeByte(byte v) { + write(&v, sizeof(byte)); + } + void writeWord(uint16 v) { + uint16 vTemp = TO_LE_16(v); + write(&vTemp, sizeof(uint16)); + } + void writeLong(uint32 v) { + uint32 vTemp = TO_LE_32(v); + write(&vTemp, sizeof(uint32)); + } + uint32 pos() { + return ftell(f); + } +}; + +File outputFile, mortCom; + +/*-------------------------------------------------------------------------*/ + +#define VERSION_MAJOR 1 +#define VERSION_MINOR 0 + +void openOutputFile(const char *outFilename) { + outputFile.open(outFilename, kFileWriteMode); + + // Write header + outputFile.write("mort", 4); + outputFile.writeByte(VERSION_MAJOR); + outputFile.writeByte(VERSION_MINOR); +} + +void process() { + byte checkBuffer[7]; + byte fontBuffer[121 * 6]; + + // Move to just prior the font data and verify that we're reading the known mort.com + mortCom.seek(0x36b0); + mortCom.read(checkBuffer, 7); + + if ((checkBuffer[0] != 0x59) || (checkBuffer[1] != 0x5B) || (checkBuffer[2] != 0x58) || + (checkBuffer[3] != 0xC3) || (checkBuffer[4] != 0xE8) || (checkBuffer[5] != 0xD6) || + (checkBuffer[6] != 0x02)) { + printf("Invalid mort.com input file"); + exit(0); + } + + // Read in the data + mortCom.read(fontBuffer, 121 * 6); + + // Write out a section header to the output file and the font data + char fontHeader[4] = { 'F', 'O', 'N', 'T' }; + outputFile.write(fontHeader, 4); + outputFile.write(fontBuffer, 121 * 6); +} + +int main(int argc, char *argv[]) { + if (argc != 3) { + printf("Format: input_filename output_filename\n", argv[0]); + exit(0); + } + + mortCom.open(argv[1], kFileReadMode); + openOutputFile(argv[2]); + + process(); + + mortCom.close(); + outputFile.close(); +} diff --git a/devtools/create_mortdat/module.mk b/devtools/create_mortdat/module.mk new file mode 100644 index 0000000000..86b14d8284 --- /dev/null +++ b/devtools/create_mortdat/module.mk @@ -0,0 +1,11 @@ + +MODULE := devtools/create_mortdat + +MODULE_OBJS := \ + create_mortdat.o \ + +# Set the name of the executable +TOOL_EXECUTABLE := create_mortdat + +# Include common rules +include $(srcdir)/rules.mk diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat new file mode 100644 index 0000000000..ce4e5bb1c8 Binary files /dev/null and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 1727798a8ea95574ecf6d43ec2fc071b6cb87d0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 Jan 2012 07:56:45 +1100 Subject: MORTEVIELLE: Implemented loading of the font data, and rewrote drawing routines to use it. --- devtools/create_mortdat/create_mortdat.cpp | 6 +- dists/engine-data/mort.dat | Bin 736 -> 738 bytes engines/mortevielle/mortevielle.cpp | 136 ++++++++++++++++++++++++++++- engines/mortevielle/mortevielle.h | 22 ++++- engines/mortevielle/mouse.cpp | 3 +- engines/mortevielle/ovd1.cpp | 2 - engines/mortevielle/sprint.cpp | 4 + engines/mortevielle/var_mor.cpp | 20 +++-- engines/mortevielle/var_mor.h | 3 +- 9 files changed, 182 insertions(+), 14 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 62b81806bc..aa7da0169a 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -107,7 +107,7 @@ void openOutputFile(const char *outFilename) { outputFile.open(outFilename, kFileWriteMode); // Write header - outputFile.write("mort", 4); + outputFile.write("MORT", 4); outputFile.writeByte(VERSION_MAJOR); outputFile.writeByte(VERSION_MINOR); } @@ -132,7 +132,9 @@ void process() { // Write out a section header to the output file and the font data char fontHeader[4] = { 'F', 'O', 'N', 'T' }; - outputFile.write(fontHeader, 4); + outputFile.write(fontHeader, 4); // Section Id + outputFile.writeWord(121 * 6); // Section size + outputFile.write(fontBuffer, 121 * 6); } diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index ce4e5bb1c8..ebfb8a8e0e 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 68b8dbeeb4..43534a6ae0 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -20,14 +20,22 @@ * */ +#include "common/system.h" #include "engines/util.h" +#include "engines/engine.h" +#include "graphics/palette.h" +#include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mort.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { +MortevielleEngine *g_vm; + MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): Engine(system), _gameDescription(gameDesc) { + g_vm = this; } MortevielleEngine::~MortevielleEngine() { @@ -37,10 +45,136 @@ bool MortevielleEngine::hasFeature(EngineFeature f) const { return false; } -Common::Error MortevielleEngine::run() { +Common::ErrorCode MortevielleEngine::initialise() { // Initialise graphics mode initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); + // Set up an intermediate screen surface + _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); + + // Set the screen mode + gd = ega; + res = 2; + + // Load the mort.dat resource + return loadMortDat(); +} + +/** + * Loads the contents of the Mort.dat data file + */ +Common::ErrorCode MortevielleEngine::loadMortDat() { + Common::File f; + + // Open the mort.dat file + if (!f.open(MORT_DAT)) { + GUIErrorMessage("Could not locate Mort.dat file"); + return Common::kReadingFailed; + } + + // Validate the data file header + char fileId[4]; + f.read(fileId, 4); + if (strncmp(fileId, "MORT", 4) != 0) { + GUIErrorMessage("The located mort.dat data file is invalid"); + return Common::kReadingFailed; + } + + // Check the version + if (f.readByte() < MORT_DAT_REQUIRED_VERSION) { + GUIErrorMessage("The located mort.dat data file is too a version"); + return Common::kReadingFailed; + } + f.readByte(); // Minor version + + // Loop to load resources from the data file + while (f.pos() < f.size()) { + // Get the Id and size of the next resource + char dataType[4]; + int dataSize; + f.read(dataType, 4); + dataSize = f.readUint16LE(); + + if (!strncmp(dataType, "FONT", 4)) { + // Font resource + assert(dataSize == (FONT_NUM_CHARS * FONT_HEIGHT)); + f.read(_fontData, FONT_NUM_CHARS * FONT_HEIGHT); + } else { + // Unknown section + f.skip(dataSize); + } + } + + f.close(); + return Common::kNoError; +} + +/*-------------------------------------------------------------------------*/ + +/** + * Update the physical screen + */ +void MortevielleEngine::updateScreen() { + g_system->copyRectToScreen((const byte *)_screenSurface.getBasePtr(0, 0), + SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + g_system->updateScreen(); +} +/** + * Draws a character at the specified co-ordinates + * @remarks Because the ScummVM surface is using a double height 640x200 surface to + * simulate the original 640x200 surface, all Y values have to be doubled + */ +void MortevielleEngine::writeCharacter(const Common::Point &pt, unsigned char ch, + int palIndex, Graphics::Surface *surface) { + if (surface == NULL) + surface = &_screenSurface; + + // Get the start of the character to use + assert((ch >= ' ') && (ch <= (unsigned char)(32 + FONT_NUM_CHARS))); + const byte *charData = &_fontData[((int)ch - 32) * FONT_HEIGHT]; + + // Loop through decoding each character's data + for (int yp = 0; yp < FONT_HEIGHT; ++yp) { + byte *lineP = (byte *)surface->getBasePtr(pt.x, (pt.y + yp) * 2); + byte byteVal = *charData++; + + for (int xp = 0; xp < 8; ++xp, ++lineP, byteVal <<= 1) { + if (byteVal & 0x80) { + *lineP = palIndex; + *(lineP + SCREEN_WIDTH) = palIndex; + } + } + } +} + +/** + * Sets a single pixel at the specified co-ordinates + * @remarks Because the ScummVM surface is using a double height 640x200 surface to + * simulate the original 640x200 surface, all Y values have to be doubled + */ +void MortevielleEngine::setPixel(const Common::Point &pt, int palIndex, + Graphics::Surface *surface) { + if (surface == NULL) + surface = &_screenSurface; + + byte *destP = (byte *)surface->getBasePtr(pt.x, pt.y * 2); + *destP = palIndex; + *(destP + SCREEN_WIDTH) = palIndex; +} + + +/*-------------------------------------------------------------------------*/ + +Common::Error MortevielleEngine::run() { + // Initialise the game + Common::ErrorCode err = initialise(); + if (err != Common::kNoError) + return err; + + // TODO: Remove once palette loading is correctly done + uint32 white = 0xffffffff; + g_system->getPaletteManager()->setPalette((const byte *)&white, 15, 1); + // Dispatch to the game's main routine const char *argv[] = { "" }; mortevielle_main(1, argv); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 14bee28a03..b9d8265385 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -23,9 +23,12 @@ #ifndef MORTEVIELLE_H #define MORTEVIELLE_H +#include "common/file.h" +#include "common/rect.h" #include "engines/advancedDetector.h" #include "engines/engine.h" #include "common/error.h" +#include "graphics/surface.h" namespace Mortevielle { @@ -35,17 +38,34 @@ enum { #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 +#define MORT_DAT_REQUIRED_VERSION 1 +#define MORT_DAT "mort.dat" + +#define FONT_WIDTH 8 +#define FONT_HEIGHT 6 +#define FONT_NUM_CHARS 121 class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; + + Common::ErrorCode initialise(); + Common::ErrorCode loadMortDat(); + void loadFont(Common::File &f); +public: + Graphics::Surface _screenSurface; + byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; virtual Common::Error run(); - uint32 getGameFlags() const; + + void updateScreen(); + void writeCharacter(const Common::Point &pt, + unsigned char ch, int palIndex, Graphics::Surface *surface = NULL); + void setPixel(const Common::Point &pt, int palIndex, Graphics::Surface *surface = NULL); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 1aaea06d68..d78b458816 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/rect.h" #include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" @@ -256,7 +257,7 @@ void show_mouse() { } break; } /* case Gd */ - affput(2, gd, x_s, y_s, 0, 0); + affput(Common::Point(x_s, y_s), 0, 0); } void pos_mouse(int x, int y) { diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index a1a47a2913..3aa942c7e2 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -275,8 +275,6 @@ void ani50() { gd = tan; break; }*/ - // Hardcode display mode to EGA - gd = ega; gotoxy(1, 24); clreol; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index e6a172b821..67bd3ab119 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -27,6 +27,7 @@ #include "common/str.h" #include "common/textconsole.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" @@ -85,6 +86,9 @@ void writeg(Common::String l, int c) xo = xo + i; } show_mouse(); + + // TODO: Move screen updates to main loop once constructed + g_vm->updateScreen(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index a8b10c1201..e07a7359ac 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -28,6 +28,7 @@ #include "common/debug.h" #include "common/str.h" #include "common/textconsole.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" @@ -306,18 +307,25 @@ void hirs() { */ } -/* procedure affput(Chx,Gd,x,y,coul,char:int); external 'c:\mc\divaf.com'; */ -void affput(int Chx, int Gd, int x, int y, int coul, int char_) { - warning("TODO: Implement affput"); +/** + * Draws either a single pixel or a character to the screen + */ +void affput(const Common::Point &pt, int palIndex, int ch) { + if (ch == 0) + g_vm->setPixel(pt, palIndex); + else + g_vm->writeCharacter(pt, ch, palIndex); } void affcar(int gd, int x, int y, int coul, int chr) { - if (res == 1) affput(1, gd, ((uint)x >> 1), y, coul, chr); - else affput(1, gd, x, y, coul, chr); + if (res == 1) + affput(Common::Point(((uint)x >> 1), y), coul, chr); + else + affput(Common::Point(x, y), coul, chr); } void putpix(int gd, int x, int y, int coul) { - affput(0, gd, x, y, coul, 0); + affput(Common::Point(x, y), coul, 0); } /** diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 63d3112760..f9c29e20f6 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -28,6 +28,7 @@ #ifndef MORTEVIELLE_VAR_H #define MORTEVIELLE_VAR_H +#include "common/rect.h" #include "common/str.h" namespace Mortevielle { @@ -396,7 +397,7 @@ void affcar(int gd, int x, int y, int coul, int chr); void putpix(int gd, int x, int y, int coul); Common::String copy(const Common::String &s, int idx, size_t size); void Val(const Common::String &s, int &V, int Code); -void affput(int Chx, int Gd, int x, int y, int coul, int char_); +void affput(const Common::Point &pt, int palIndex, int ch); /*---------------------------------------------------------------------------*/ /*------------------------------ STUBS ------------------------------*/ -- cgit v1.2.3 From c45e7c5d94fc5bee5b638029470aedd4b8f7eaf3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 Jan 2012 11:09:40 +1100 Subject: MORTEVIELLE: Change mem array to be 640Kb, and correct segment offsets using the array --- engines/mortevielle/level15.cpp | 14 +++++++------- engines/mortevielle/mor.cpp | 2 +- engines/mortevielle/mouse.cpp | 10 +++++----- engines/mortevielle/ovd1.cpp | 6 +++--- engines/mortevielle/parole.cpp | 14 +++++++------- engines/mortevielle/taffich.cpp | 10 +++++----- engines/mortevielle/var_mor.cpp | 2 +- engines/mortevielle/var_mor.h | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index a2d5432b50..5195e7c2a4 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -66,7 +66,7 @@ void outbloc(int n, pattern p, t_nhom pal) { ad = ad + 4; for (i = 1; i <= p.tax; i ++) for (j = 1; j <= p.tay; j ++) - mem[0x6000 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; + mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; } } @@ -81,8 +81,8 @@ void writepal(int n) { case ega: case ams : for (i = 1; i <= 16; i ++) { - mem[0x7000 + 2 * i] = tabpal[n][i].x; - mem[0x7000 + succ(int, 2 * i)] = tabpal[n][i].y; + mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; + mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; } break; case cga : { @@ -99,8 +99,8 @@ void writepal(int n) { void pictout(int seg, int dep, int x, int y) { decomp(seg, dep); if (gd == her) { - mem[0x7000 + 2] = 0; - mem[0x7000 + 32] = 15; + mem[0x7000 * 16 + 2] = 0; + mem[0x7000 * 16 + 32] = 15; } if ((caff != 51) && (memw[0x7000 + 0x4138] > 0x100)) memw[0x7000 + 0x4138] = 0x100; afff(gd, seg, dep, x, y); @@ -174,7 +174,7 @@ void adzon() { if (!f.open("dec.mor")) error("Missing files - dec.moir"); - f.read(&mem[0x73a2 + 0], 1); + f.read(&mem[0x73a2 * 16 + 0], 1); /*i:=0; repeat read(g,a); @@ -188,7 +188,7 @@ int animof(int ouf, int num) { int nani, aux; int animof_result; - nani = mem[adani + 1]; + nani = mem[adani * 16 + 1]; aux = num; if (ouf != 1) aux = aux + nani; animof_result = (nani << 2) + 2 + swap(memw[adani + (aux << 1)]); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index bfb8655df5..4af3967eae 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -109,7 +109,7 @@ void dessine_rouleau() { /* debug('dessine_rouleau'); */ writepal(89); if (gd == her) { - mem[0x7000 + 14] = 15; + mem[0x7000 * 16 + 14] = 15; } hide_mouse(); pictout(0x73a2, 0, 0, 0); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d78b458816..1ae04417bf 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -139,10 +139,10 @@ void hide_mouse() { 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]); + ps = mem[0xa000 * 16 + j]; + mem[0xa000 * 16 + j] = lo(s_s[i][k]); + ps = mem[0xa000 * 16 + j + 1]; + mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j = j + 80; k = succ(int, k); } while (!(k >= 8)); @@ -227,7 +227,7 @@ void show_mouse() { k = 0; j = p_o_s; do { - s_s[l][k] = mem[0xa000 + j] + (mem[0xa000 + succ(int, j)] << 8); + s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 + succ(int, j)] << 8); j = j + 80; k = succ(int, k); } while (!(k >= 8)); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 3aa942c7e2..89dde415df 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -327,8 +327,8 @@ void ani50() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&mem[0x3800 + 0], 500); - fic.read(&mem[0x47a0 + 0], 123); + fic.read(&mem[0x3800 * 16 + 0], 500); + fic.read(&mem[0x47a0 * 16 + 0], 123); fic.close(); demus(0x3800, 0x5000, 623); @@ -353,7 +353,7 @@ void ani50() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&mem[adbruit5 + 0], 149); + f.read(&mem[adbruit5 * 16 + 0], 149); /*blockread(f,mem[$5CB0:0],100); blockread(f,mem[$3D1F:0],49);*/ f.close(); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index fa71a1e500..7f8476da80 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -87,7 +87,7 @@ void charg_car() { void entroct(byte o) { - mem[adtroct + ptr_oct] = o; + mem[adtroct * 16 + ptr_oct] = o; ptr_oct = ptr_oct + 1; } @@ -125,9 +125,9 @@ void veracf(byte b) { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&mem[0x7414 + 0], 273); - /*blockread(f,mem[adson+0],300); - blockread(f,mem[adson+2400+0],245);*/ + f.read(&mem[0x7414 * 16 + 0], 273); + /*blockread(f,mem[adson * 16+0],300); + blockread(f,mem[adson * 16+2400+0],245);*/ demus(0x7414, adson, 273); f.close(); } @@ -151,9 +151,9 @@ void veracf(byte b) { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&mem[adbruit + 0], 250); - for (i = 0; i <= 19013; i ++) mem[adbruit + 32000 + i] = mem[adbruit5 + i]; - f.read(&mem[adbruit1 + offsetb1], 149); + f.read(&mem[adbruit * 16 + 0], 250); + for (i = 0; i <= 19013; i ++) mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; + f.read(&mem[adbruit1 * 16 + offsetb1], 149); f.close(); } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 1a126d02b1..449e003394 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -56,14 +56,14 @@ void chardes(Common::String nom, float passe, int long_) { l = long_ + p; i = 0; while (l > 0) { - f.read(&mem[0x6000 + i], 1); + f.read(&mem[0x6000 * 16 + i], 1); testfi(); l = l - 128; i = i + 128; } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7000 + i - p] = mem[0x6000 + i]; + for (i = p; i <= long_ + p; i ++) mem[0x7000 * 16 + i - p] = mem[0x6000 + i]; /*$i+*/ } @@ -89,14 +89,14 @@ void charani(Common::String nom, float passe, int long_) { l = long_ + p; i = 0; while (l > 0) { - f.read(&mem[0x6000 + i], 1); + f.read(&mem[0x6000 * 16 + i], 1); testfi(); l = l - 128; i = i + 128; } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7314 + i - p] = mem[0x6000 + i]; + for (i = p; i <= long_ + p; i ++) mem[0x7314 * 16 + i - p] = mem[0x6000 + i]; } void taffich() { @@ -188,7 +188,7 @@ void taffich() { 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]; + mem[0x7000 * 16 + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index e07a7359ac..589a0bbac5 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -350,7 +350,7 @@ Common::String copy(const Common::String &s, int idx, size_t size) { /*---------------------------------------------------------------------------*/ int port[0xfff]; -byte mem[0xffff]; +byte mem[65536 * 16]; int memw[0xffff]; int wherey; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index f9c29e20f6..fbd324b548 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -405,7 +405,7 @@ void affput(const Common::Point &pt, int palIndex, int ch); // TODO: Replace the following with proper implementations, or refactor out the code using them extern int port[0xfff]; -extern byte mem[0xffff]; +extern byte mem[65536 * 16]; extern int memw[0xffff]; #define hires {} -- cgit v1.2.3 From c72eed79806b0dca804b7cea6ae2ae73d6069ccd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 Jan 2012 11:21:11 +1100 Subject: MORTEVIELLE: Converted memw[] usage to use mem[] array with endian macros This is better for now, since mem and memw share the same memory space. --- engines/mortevielle/level15.cpp | 13 +++++++------ engines/mortevielle/mor.cpp | 5 +++-- engines/mortevielle/mort.cpp | 6 +++--- engines/mortevielle/mouse.cpp | 41 ++++++++++++++++++++++------------------- engines/mortevielle/parole.cpp | 4 ++-- engines/mortevielle/parole2.cpp | 3 ++- engines/mortevielle/taffich.cpp | 4 ++-- engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 1 - 9 files changed, 41 insertions(+), 37 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 5195e7c2a4..bd908b47c4 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -61,8 +61,8 @@ void outbloc(int n, pattern p, t_nhom pal) { ad = n * 404 + 0xd700; { - memw[0x6000 + ad] = p.tax; - memw[0x6000 + ad + 2] = p.tay; + WRITE_LE_UINT16(&mem[0x6000 + ad], p.tax); + WRITE_LE_UINT16(&mem[0x6000 + ad + 2], p.tay); ad = ad + 4; for (i = 1; i <= p.tax; i ++) for (j = 1; j <= p.tay; j ++) @@ -102,7 +102,8 @@ void pictout(int seg, int dep, int x, int y) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } - if ((caff != 51) && (memw[0x7000 + 0x4138] > 0x100)) memw[0x7000 + 0x4138] = 0x100; + if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&mem[0x7000 + 0x4138], 0x100); afff(gd, seg, dep, x, y); } @@ -191,10 +192,10 @@ int animof(int ouf, int num) { nani = mem[adani * 16 + 1]; aux = num; if (ouf != 1) aux = aux + nani; - animof_result = (nani << 2) + 2 + swap(memw[adani + (aux << 1)]); + animof_result = (nani << 2) + 2 + swap(READ_LE_UINT16(&mem[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]); + if ouf=1 then aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: num shl 1]) + else aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: (nani+num) shl 1]); animof:=aux;*/ return animof_result; } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4af3967eae..ede69a5765 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/endian.h" #include "common/str.h" #include "common/textconsole.h" #include "mortevielle/alert.h" @@ -1231,8 +1232,8 @@ void messint(int nu) { clsf2(); clsf3(); decomp(0x73a2, 1008); - memw[0x7413 + 12] = 80; - memw[0x7413 + 14] = 40; + WRITE_LE_UINT16(&mem[0x7413 + 12], 80); + WRITE_LE_UINT16(&mem[0x7413 + 14], 40); writepal(90); afff(gd, 0x73a2, 1008, 0, 0); afff(gd, 0x73a2, 1008, 0, 70); diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index ea8cbcb663..9b05196ab9 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -83,9 +83,9 @@ int mortevielle_main(int argc, const char *argv[]) { c_zzz = 1; init_nbrepm(); init_mouse(); - /* crep:=memw[$7f00:0]; - memw[$7f00:0]:= crep+1; - if (memw[$7f00:0]<> crep+1) then + /* crep:=WRITE_LE_UINT16(&mem[$7f00:0]; + WRITE_LE_UINT16(&mem[$7f00:0]:= crep+1; + if (WRITE_LE_UINT16(&mem[$7f00:0]<> crep+1) then begin hirs; show_mouse; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 1ae04417bf..e7eb225edf 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/endian.h" #include "common/rect.h" #include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" @@ -57,7 +58,7 @@ void init_mouse() { /*int_m:= False;*/ clic = false; m_show = m_arrow; - if ((memw[0xcc] == 0) && (memw[0xce] == 0)) int_m = false; + if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) int_m = false; if (int_m) { reg.ax = 0; intr(0x33, reg); @@ -101,10 +102,10 @@ void hide_mouse() { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)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]; + WRITE_LE_UINT16(&mem[0xb000 + j], s_s[0][k]); + WRITE_LE_UINT16(&mem[0xb800 + j + 2], s_s[1][k]); + WRITE_LE_UINT16(&mem[0xba00 + j], s_s[2][k]); + WRITE_LE_UINT16(&mem[0xba00 + j + 2], s_s[3][k]); j = j + 80; k = succ(int, k); } while (!(k >= 5)); @@ -117,10 +118,10 @@ void hide_mouse() { j = p_o_s; do { if (imp) { - memw[0xb800 + j] = s_s[i][k]; + WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]); j = j + 80 - 0x2000; } else { - memw[0xb800 + j] = s_s[i][k]; + WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]); j = j + 0x2000; } imp = ! imp; @@ -153,7 +154,8 @@ void hide_mouse() { case her : { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) memw[0xb000 + k * 0x200 + j] = s_s[i][k]; + for (k = 0; k <= 3; k ++) + WRITE_LE_UINT16(&mem[0xb000 + k * 0x200 + j], s_s[i][k]); j = j + 80; } } @@ -163,8 +165,8 @@ void hide_mouse() { 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)]; + WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j], s_s[k][i + (k << 2)]); + WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j = j + 160; k = succ(int, k); @@ -190,10 +192,10 @@ void show_mouse() { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)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]; + s_s[0][k] = READ_LE_UINT16(&mem[0xb800 + j]); + s_s[1][k] = READ_LE_UINT16(&mem[0xb800 + j + 2]); + s_s[2][k] = READ_LE_UINT16(&mem[0xba00 + j]); + s_s[3][k] = READ_LE_UINT16(&mem[0xba00 + j + 2]); j = j + 80; k = succ(int, k); } while (!(k >= 5)); @@ -207,10 +209,10 @@ void show_mouse() { k = 0; do { if (imp) { - s_s[i][k] = memw[0xb800 + j]; + s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]); j = j + 80 - 0x2000; } else { - s_s[i][k] = memw[0xb800 + j]; + s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]); j = j + 0x2000; } imp = ! imp; @@ -238,7 +240,8 @@ void show_mouse() { case her : { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) s_s[i][k] = memw[0xb000 + k * 0x200 + j]; + for (k = 0; k <= 3; k ++) + s_s[i][k] = READ_LE_UINT16(&mem[0xb000 + k * 0x200 + j]); j = j + 80; } } @@ -248,8 +251,8 @@ void show_mouse() { 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]; + s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j]); + s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2]); } j = j + 160; k = succ(int, k); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 7f8476da80..76d6c9a177 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -45,7 +45,7 @@ void spfrac(int wor) { void charg_car() { int wor, int_; - wor = swap(memw[adword + ptr_word]); + wor = swap(READ_LE_UINT16(&mem[adword + ptr_word])); int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { @@ -113,7 +113,7 @@ void veracf(byte b) { i = offsetb3 + 8590; j = 0; do { - t_cph[j] = memw[adbruit3 + i]; + t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); i = i + 2; j = j + 1; } while (!(i >= offsetb3 + 8790)); diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index be8c17bf3b..cba5588ffc 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/endian.h" #include "mortevielle/level15.h" #include "mortevielle/parole2.h" #include "mortevielle/parole.h" @@ -62,7 +63,7 @@ void trait_ph() { ptr_tcph = (uint)ledeb >> 1; ptr_word = 0; do { - memw[adword + ptr_word] = t_cph[ptr_tcph]; + WRITE_LE_UINT16(&mem[adword + ptr_word], t_cph[ptr_tcph]); ptr_word = ptr_word + 2; ptr_tcph = ptr_tcph + 1; } while (!(ptr_tcph >= (int)((uint)lefin >> 1))); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 449e003394..1cb0f76325 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -182,7 +182,7 @@ void taffich() { chardes(nom, lgt, handle); if (gd == her) { for (i = 0; i <= 15; i ++) { - palh = memw[0x7000 + (succ(int, i) << 1)]; + palh = READ_LE_UINT16(&mem[0x7000 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (i = 0; i <= 15; i ++) { @@ -221,7 +221,7 @@ void taffich() { /* begin for i:=0 to 15 do begin - PalH:=memw[$7000:succ(i) shl 1]; + PalH:=WRITE_LE_UINT16(&mem[$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 diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 589a0bbac5..5166f201c4 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -351,7 +351,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) { int port[0xfff]; byte mem[65536 * 16]; -int memw[0xffff]; int wherey; void gotoxy(int x, int y) { diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index fbd324b548..16ab044569 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -406,7 +406,6 @@ void affput(const Common::Point &pt, int palIndex, int ch); extern int port[0xfff]; extern byte mem[65536 * 16]; -extern int memw[0xffff]; #define hires {} #define mortevielle_exit(ret) error("Exit the game") -- cgit v1.2.3 From ca55d928b6cd39287ac37ab3b220ffc0d9e41035 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 Jan 2012 11:22:03 +1100 Subject: MORTEVIELLE: Fixed compiler warning --- engines/mortevielle/mor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ede69a5765..e9366b0506 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -987,7 +987,6 @@ void debloc(int l) { /* NIVEAU 10 */ void init_nbrepm() { const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - int i; /* debug('init_nbrepm'); */ for (int idx = 0; idx < 9; ++idx) -- cgit v1.2.3 From cd1c72cd9b831013a7c35163259b3ee8db9d6d84 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 8 Jan 2012 10:55:13 +0000 Subject: MORTEVIELLE: Fix memory offsets in rest of the places --- engines/mortevielle/level15.cpp | 10 +++++----- engines/mortevielle/mor.cpp | 4 ++-- engines/mortevielle/mouse.cpp | 38 +++++++++++++++++++------------------- engines/mortevielle/taffich.cpp | 6 +++--- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index bd908b47c4..d7193bfc61 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -61,8 +61,8 @@ void outbloc(int n, pattern p, t_nhom pal) { ad = n * 404 + 0xd700; { - WRITE_LE_UINT16(&mem[0x6000 + ad], p.tax); - WRITE_LE_UINT16(&mem[0x6000 + ad + 2], p.tay); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); ad = ad + 4; for (i = 1; i <= p.tax; i ++) for (j = 1; j <= p.tay; j ++) @@ -102,8 +102,8 @@ void pictout(int seg, int dep, int x, int y) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } - if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&mem[0x7000 + 0x4138], 0x100); + if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); afff(gd, seg, dep, x, y); } @@ -192,7 +192,7 @@ int animof(int ouf, int num) { nani = mem[adani * 16 + 1]; aux = num; if (ouf != 1) aux = aux + nani; - animof_result = (nani << 2) + 2 + swap(READ_LE_UINT16(&mem[adani + (aux << 1)])); + animof_result = (nani << 2) + 2 + swap(READ_LE_UINT16(&mem[adani * 16 + (aux << 1)])); /*aux:= nani shl 2 + 2; if ouf=1 then aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: num shl 1]) else aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: (nani+num) shl 1]); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e9366b0506..373a80029a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1231,8 +1231,8 @@ void messint(int nu) { clsf2(); clsf3(); decomp(0x73a2, 1008); - WRITE_LE_UINT16(&mem[0x7413 + 12], 80); - WRITE_LE_UINT16(&mem[0x7413 + 14], 40); + WRITE_LE_UINT16(&mem[0x7413 * 16 + 12], 80); + WRITE_LE_UINT16(&mem[0x7413 * 16 + 14], 40); writepal(90); afff(gd, 0x73a2, 1008, 0, 0); afff(gd, 0x73a2, 1008, 0, 70); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e7eb225edf..2fc6e1033b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -102,10 +102,10 @@ void hide_mouse() { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { - WRITE_LE_UINT16(&mem[0xb000 + j], s_s[0][k]); - WRITE_LE_UINT16(&mem[0xb800 + j + 2], s_s[1][k]); - WRITE_LE_UINT16(&mem[0xba00 + j], s_s[2][k]); - WRITE_LE_UINT16(&mem[0xba00 + j + 2], s_s[3][k]); + WRITE_LE_UINT16(&mem[0xb000 * 16 + j], s_s[0][k]); + WRITE_LE_UINT16(&mem[0xb800 * 16 + j + 2], s_s[1][k]); + WRITE_LE_UINT16(&mem[0xba00 * 16 + j], s_s[2][k]); + WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]); j = j + 80; k = succ(int, k); } while (!(k >= 5)); @@ -118,10 +118,10 @@ void hide_mouse() { j = p_o_s; do { if (imp) { - WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]); + WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); j = j + 80 - 0x2000; } else { - WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]); + WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); j = j + 0x2000; } imp = ! imp; @@ -155,7 +155,7 @@ void hide_mouse() { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) - WRITE_LE_UINT16(&mem[0xb000 + k * 0x200 + j], s_s[i][k]); + WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j = j + 80; } } @@ -165,8 +165,8 @@ void hide_mouse() { k = 0; do { for (i = 0; i <= 3; i ++) { - WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j], s_s[k][i + (k << 2)]); - WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); + WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); + WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j = j + 160; k = succ(int, k); @@ -192,10 +192,10 @@ void show_mouse() { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { - s_s[0][k] = READ_LE_UINT16(&mem[0xb800 + j]); - s_s[1][k] = READ_LE_UINT16(&mem[0xb800 + j + 2]); - s_s[2][k] = READ_LE_UINT16(&mem[0xba00 + j]); - s_s[3][k] = READ_LE_UINT16(&mem[0xba00 + j + 2]); + s_s[0][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); + s_s[1][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j + 2]); + s_s[2][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j]); + s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]); j = j + 80; k = succ(int, k); } while (!(k >= 5)); @@ -209,10 +209,10 @@ void show_mouse() { k = 0; do { if (imp) { - s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]); + s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); j = j + 80 - 0x2000; } else { - s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]); + s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); j = j + 0x2000; } imp = ! imp; @@ -229,7 +229,7 @@ void show_mouse() { k = 0; j = p_o_s; do { - s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 + succ(int, j)] << 8); + s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 * 16 + succ(int, j)] << 8); j = j + 80; k = succ(int, k); } while (!(k >= 8)); @@ -241,7 +241,7 @@ void show_mouse() { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) - s_s[i][k] = READ_LE_UINT16(&mem[0xb000 + k * 0x200 + j]); + s_s[i][k] = READ_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j]); j = j + 80; } } @@ -251,8 +251,8 @@ void show_mouse() { k = 0; do { for (i = 0; i <= 3; i ++) { - s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j]); - s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2]); + s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]); + s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); } j = j + 160; k = succ(int, k); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 1cb0f76325..619cf7a89a 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -63,7 +63,7 @@ void chardes(Common::String nom, float passe, int long_) { } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7000 * 16 + i - p] = mem[0x6000 + i]; + for (i = p; i <= long_ + p; i ++) mem[0x7000 * 16 + i - p] = mem[0x6000 * 16 + i]; /*$i+*/ } @@ -96,7 +96,7 @@ void charani(Common::String nom, float passe, int long_) { } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7314 * 16 + i - p] = mem[0x6000 + i]; + for (i = p; i <= long_ + p; i ++) mem[0x7314 * 16 + i - p] = mem[0x6000 * 16 + i]; } void taffich() { @@ -182,7 +182,7 @@ void taffich() { chardes(nom, lgt, handle); if (gd == her) { for (i = 0; i <= 15; i ++) { - palh = READ_LE_UINT16(&mem[0x7000 + (succ(int, i) << 1)]); + palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (i = 0; i <= 15; i ++) { -- cgit v1.2.3 From fd490f3aebabc99a225bcd25b67770abe6caf032 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 Jan 2012 20:41:06 +1100 Subject: MORTEVIELLE: Fixed loading in chardes() method --- engines/mortevielle/taffich.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 619cf7a89a..8e8e3de6b6 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -56,14 +56,15 @@ void chardes(Common::String nom, float passe, int long_) { l = long_ + p; i = 0; while (l > 0) { - f.read(&mem[0x6000 * 16 + i], 1); + f.read(&mem[0x6000 * 16 + i], 128); testfi(); l = l - 128; i = i + 128; } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7000 * 16 + i - p] = mem[0x6000 * 16 + i]; + for (i = p; i <= long_ + p; i ++) + mem[0x7000 * 16 + i - p] = mem[0x6000 * 16 + i]; /*$i+*/ } -- cgit v1.2.3 From 41ddc9958ae4d1256f392b9e92fff241566ab930 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 Jan 2012 20:42:07 +1100 Subject: MORTEVIELLE: Fix data loading in charani() method --- engines/mortevielle/level15.cpp | 5 +++++ engines/mortevielle/taffich.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index d7193bfc61..86319e0e07 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -26,6 +26,7 @@ */ #include "common/file.h" +#include "mortevielle/graphics.h" #include "mortevielle/level15.h" #include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" @@ -97,6 +98,10 @@ void writepal(int n) { void pictout(int seg, int dep, int x, int y) { + GfxSurface surface; + surface.decode(&mem[0x7000 * 16]); + +warning("TODO: complete picture decoding"); decomp(seg, dep); if (gd == her) { mem[0x7000 * 16 + 2] = 0; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 8e8e3de6b6..78eccbbaf1 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -90,7 +90,7 @@ void charani(Common::String nom, float passe, int long_) { l = long_ + p; i = 0; while (l > 0) { - f.read(&mem[0x6000 * 16 + i], 1); + f.read(&mem[0x6000 * 16 + i], 128); testfi(); l = l - 128; i = i + 128; -- cgit v1.2.3 From e183f9f055c121d745a130d84dea0fa84a58fc66 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 Jan 2012 22:23:57 +1100 Subject: MORTEVIELLE: Beginnings of code for picture decoding --- engines/mortevielle/graphics.cpp | 261 +++++++++++++++++++++++++++++++++++++++ engines/mortevielle/graphics.h | 54 ++++++++ engines/mortevielle/level15.cpp | 3 +- engines/mortevielle/module.mk | 1 + engines/mortevielle/mort.cpp | 2 +- 5 files changed, 319 insertions(+), 2 deletions(-) create mode 100644 engines/mortevielle/graphics.cpp create mode 100644 engines/mortevielle/graphics.h diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp new file mode 100644 index 0000000000..3df9001c3b --- /dev/null +++ b/engines/mortevielle/graphics.cpp @@ -0,0 +1,261 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "mortevielle/graphics.h" + +namespace Mortevielle { + +#define INCR_TAIX { if (_xSize & 1) ++_xSize; } + +void GfxSurface::decode(const byte *pSrc) { + _width = _height = 0; + _var1 = *pSrc++; + _entryCount = *pSrc++; + pSrc += 2; + + if (!_var1) + pSrc += 30; + + // First run through the data to calculate starting offsets + const byte *p = pSrc; + int xOffset = 0xffff, yOffset = 0xffff; + + for (int idx = 0; idx < _entryCount; ++idx) { + _xp = READ_BE_UINT16(p + 4); + if (_xp < xOffset) + _xOffset = _xp; + + _yp = READ_BE_UINT16(p + 6); + if (_yp < _yOffset) + _yOffset = _yp; + + // Move to next entry + int size = READ_BE_UINT16(p) + READ_BE_UINT16(p + 2); + if ((size % 2) == 1) + ++size; + + p += size + 14; + } + + // Temporary output buffer + byte outputBuffer[65536]; + byte *pDest = &outputBuffer[0]; + const byte *pSrcStart = pSrc; + + byte table4140[256]; + byte table7110[256]; + + // Main processing loop + do { + _var4 = READ_BE_UINT16(pSrc); + _var6 = READ_BE_UINT16(pSrc + 2); + _xp = READ_BE_UINT16(pSrc + 4) - _xOffset; + _yp = READ_BE_UINT16(pSrc + 6) - _yOffset; + pSrc += 8; + + _varC = READ_BE_UINT16(pSrc); + _xSize = READ_BE_UINT16(pSrc + 2) + 1; + _ySize = READ_BE_UINT16(pSrc + 4) + 1; + majTtxTty(); + + _var15 = _var18 = 0; + + int decomIndex = 0; + if (_varC >> 8) { + // Build up reference table + int tableOffset = 0; + + if (_varC & 1) { + do { + _var12 = desanalyse(pSrc); + _var14 = desanalyse(pSrc); + + int savedVar15 = _var15; + int savedVar18 = _var18; + + do { + const byte *pTemp = pSrc; + _var15 = savedVar15; + _var18 = savedVar18; + + assert(_var14 < 256); + for (int idx = 0; idx < _var14; ++idx, ++tableOffset) + table4140[tableOffset] = suiv(pTemp); + } while (--_var12 > 0); + } while (_var18 < (_var4 - 1)); + + } else { + assert(_var4 < 256); + for (int idx = 0; idx < _var4; ++idx) + table4140[idx] = suiv(pSrc); + } + + if (_var15) { + ++pSrc; + _var15 = 0; + } + if ((_var4 + _var6) & 1) + ++pSrc; + + tableOffset = 0; + _var18 = 0; + + if (_varC & 2) { + do { + _var12 = desanalyse(pSrc); + _var18 = _var14 = desanalyse(pSrc); + if (_var15 & 1) { + ++pSrc; + ++_var18; + _var15 = 0; + } + + const byte *pStart = pSrc; + do { + pSrc = pStart; + for (int idx = 0; idx < _var14; ++idx) { + table7110[tableOffset++] = *pSrc++; + } + } while (--_var12 > 0); + } while (_var18 < (_var6 - 1)); + } else { + assert(_var6 < 256); + for (int idx = 0; idx < _var4; ++idx) + table7110[idx] = *pSrc++; + } + + if (_var15) + ++pSrc; + + pSrcStart = pSrc; + pDest = &outputBuffer[_yp * SCREEN_WIDTH + _xp]; + pSrc = &table7110[0]; + _var1A = _var18 = _var15 = 0; + decomIndex = _varC; + } + + // Main decompression switch + switch (decomIndex) { + case 0: + // Draw rect at pos + pDest = &outputBuffer[_yp * SCREEN_WIDTH + _xp]; + pSrcStart = pSrc; + INCR_TAIX; + + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += SCREEN_WIDTH) { + byte *pDestLine = pDest; + for (int xCtr = 0; xCtr < _xSize; ++xCtr) { + *pDestLine++ = suiv(pSrc); + } + } + + pSrc = pSrcStart + _var4 + ((_var4 & 1) ? 1 : 0); + break; + + case 1: + // Draw rect alternating left to right, right to left + INCR_TAIX; + for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + if (yCtr % 2) { + for (int xCtr = 0; xCtr < _xSize; ++xCtr) { + *pDest++ = suiv(pSrc); + } + } else { + for (int xCtr = 0; xCtr < _xSize; ++xCtr) { + *--pDest = suiv(pSrc); + } + } + pDest += SCREEN_WIDTH; + } + break; + + case 2: + // Draw rect alternating top to bottom, bottom to top + INCR_TAIX; + for (int xCtr = 0; xCtr < _xSize; ++xCtr) { + if (xCtr % 2) { + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += SCREEN_WIDTH) { + *pDest = suiv(pSrc); + } + } else { + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest -= SCREEN_WIDTH) { + *pDest = suiv(pSrc); + } + } + ++pDest; + } + break; + + case 3: + // Draw horizontal line? + _var1C = 2; + horizontal(pSrc, pDest); + break; + } + + pSrc = pSrcStart; + } while (--_entryCount > 0); +} + +void GfxSurface::majTtxTty() { + if (!_yp) + _width += _xSize; + + if (!_xp) + _height += _ySize; +} + +byte GfxSurface::suiv(const byte *&pSrc) { + int v = *pSrc; + if (_var15) { + ++pSrc; + ++_var18; + _var15 = 0; + return v & 0xf; + } else { + _var15 = ~(v >> 8); + return v >> 4; + } +} + +int GfxSurface::desanalyse(const byte *&pSrc) { + int total = 0; + int v = suiv(pSrc); + if (!v) { + int v2; + do { + v2 = suiv(pSrc); + } while (v2 == 15); + + total *= 15; + v = suiv(pSrc); + } + + total += v; + return total; +} + +void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest) { + +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h new file mode 100644 index 0000000000..d3f64a01fe --- /dev/null +++ b/engines/mortevielle/graphics.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MORTEVIELLE_GRAPHICS_H +#define MORTEVIELLE_GRAPHICS_H + +#include "graphics/surface.h" +#include "mortevielle/mortevielle.h" + +namespace Mortevielle { + +class GfxSurface: public Graphics::Surface { +private: + int _var1; + int _entryCount; + int _var4, _var6; + int _xp, _yp; + int _varC, _xSize, _ySize, _var12; + int _var14, _var15, _var18, _var1A; + int _var1C, _var1E, _var20, _var22; + int _var24, _var26, _var28; + int _width, _height; + int _xOffset, _yOffset; + + void majTtxTty(); + byte suiv(const byte *&pSrc); + int desanalyse(const byte *&pSrc); + void horizontal(const byte *&pSrc, byte *&pDest); +public: + void decode(const byte *pSrc); +}; + +} // End of namespace Mortevielle + +#endif diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 86319e0e07..073b93fd96 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -98,10 +98,11 @@ void writepal(int n) { void pictout(int seg, int dep, int x, int y) { +#ifdef DEBUG GfxSurface surface; surface.decode(&mem[0x7000 * 16]); +#endif -warning("TODO: complete picture decoding"); decomp(seg, dep); if (gd == her) { mem[0x7000 * 16 + 2] = 0; diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 21cb02587a..327c4ba3c9 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ detection.o \ disk.o \ droite.o \ + graphics.o \ keyboard.o \ level15.o \ menu.o \ diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index 9b05196ab9..e24e9b58f9 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -71,7 +71,7 @@ int mortevielle_main(int argc, const char *argv[]) { /*init_debug;*/ /* ecri_seg;*/ //pio_initialize(argc, argv); - gd = cga; + gd = ega; newgd = gd; zuul = false; tesok = false; -- cgit v1.2.3 From abc2f60edfc0f3dca8d5a871a70728998045a5e5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Jan 2012 11:35:08 +1100 Subject: MORTEVIELLE: Implemented more of the image decompression code --- engines/mortevielle/graphics.cpp | 417 +++++++++++++++++++++++++++++++++----- engines/mortevielle/graphics.h | 16 +- engines/mortevielle/mortevielle.h | 3 +- 3 files changed, 372 insertions(+), 64 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3df9001c3b..9b06972232 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -25,11 +25,13 @@ namespace Mortevielle { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } +#define DEFAULT_WIDTH 320 +#define BUFFER_SIZE 8192 void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; _var1 = *pSrc++; - _entryCount = *pSrc++; + int entryCount = *pSrc++; pSrc += 2; if (!_var1) @@ -37,11 +39,12 @@ void GfxSurface::decode(const byte *pSrc) { // First run through the data to calculate starting offsets const byte *p = pSrc; - int xOffset = 0xffff, yOffset = 0xffff; + _xOffset = _yOffset = 0xffff; - for (int idx = 0; idx < _entryCount; ++idx) { + assert(entryCount > 0); + for (int idx = 0; idx < entryCount; ++idx) { _xp = READ_BE_UINT16(p + 4); - if (_xp < xOffset) + if (_xp < _xOffset) _xOffset = _xp; _yp = READ_BE_UINT16(p + 6); @@ -60,131 +63,146 @@ void GfxSurface::decode(const byte *pSrc) { byte outputBuffer[65536]; byte *pDest = &outputBuffer[0]; const byte *pSrcStart = pSrc; + const byte *pLookup = NULL; - byte table4140[256]; - byte table7110[256]; + byte lookupTable[BUFFER_SIZE]; + byte srcBuffer[BUFFER_SIZE]; // Main processing loop do { - _var4 = READ_BE_UINT16(pSrc); - _var6 = READ_BE_UINT16(pSrc + 2); + int lookupBytes = READ_BE_UINT16(pSrc); + int srcSize = READ_BE_UINT16(pSrc + 2); _xp = READ_BE_UINT16(pSrc + 4) - _xOffset; _yp = READ_BE_UINT16(pSrc + 6) - _yOffset; pSrc += 8; - _varC = READ_BE_UINT16(pSrc); + int decomCode = READ_BE_UINT16(pSrc); _xSize = READ_BE_UINT16(pSrc + 2) + 1; _ySize = READ_BE_UINT16(pSrc + 4) + 1; majTtxTty(); + + pSrc += 6; + pDest = &outputBuffer[0]; - _var15 = _var18 = 0; + _var18 = 0; + _nibbleFlag = false; int decomIndex = 0; - if (_varC >> 8) { + if (decomCode >> 8) { // Build up reference table int tableOffset = 0; - if (_varC & 1) { + if (decomCode & 1) { + // Handle decompression of the pattern lookup table do { _var12 = desanalyse(pSrc); _var14 = desanalyse(pSrc); - int savedVar15 = _var15; + bool savedVar15 = _nibbleFlag; int savedVar18 = _var18; do { const byte *pTemp = pSrc; - _var15 = savedVar15; + _nibbleFlag = savedVar15; _var18 = savedVar18; assert(_var14 < 256); for (int idx = 0; idx < _var14; ++idx, ++tableOffset) - table4140[tableOffset] = suiv(pTemp); + assert(tableOffset < BUFFER_SIZE); + lookupTable[tableOffset] = suiv(pTemp); } while (--_var12 > 0); - } while (_var18 < (_var4 - 1)); + } while (_var18 < (lookupBytes - 1)); } else { - assert(_var4 < 256); - for (int idx = 0; idx < _var4; ++idx) - table4140[idx] = suiv(pSrc); + assert(lookupBytes < BUFFER_SIZE); + for (int idx = 0; idx < (lookupBytes * 2); ++idx) + lookupTable[idx] = suiv(pSrc); } - if (_var15) { + if (_nibbleFlag) { ++pSrc; - _var15 = 0; + _nibbleFlag = false; } - if ((_var4 + _var6) & 1) + if ((lookupBytes + srcSize) & 1) ++pSrc; tableOffset = 0; _var18 = 0; - if (_varC & 2) { + if (decomCode & 2) { + // Handle decompression of the temporary source buffer do { _var12 = desanalyse(pSrc); - _var18 = _var14 = desanalyse(pSrc); - if (_var15 & 1) { + _var14 = desanalyse(pSrc); + _var18 += _var14; + + if (_nibbleFlag) { ++pSrc; ++_var18; - _var15 = 0; + _nibbleFlag = false; } const byte *pStart = pSrc; do { pSrc = pStart; for (int idx = 0; idx < _var14; ++idx) { - table7110[tableOffset++] = *pSrc++; + assert(tableOffset < BUFFER_SIZE); + srcBuffer[tableOffset++] = *pSrc++; } } while (--_var12 > 0); - } while (_var18 < (_var6 - 1)); + } while (_var18 < (srcSize - 1)); } else { - assert(_var6 < 256); - for (int idx = 0; idx < _var4; ++idx) - table7110[idx] = *pSrc++; + assert(srcSize < BUFFER_SIZE); + for (int idx = 0; idx < srcSize; ++idx) + srcBuffer[idx] = *pSrc++; } - if (_var15) + if (_nibbleFlag) ++pSrc; + // Switch over to using the decompressed source and lookup buffers pSrcStart = pSrc; - pDest = &outputBuffer[_yp * SCREEN_WIDTH + _xp]; - pSrc = &table7110[0]; - _var1A = _var18 = _var15 = 0; - decomIndex = _varC; + pDest = &outputBuffer[_yp * DEFAULT_WIDTH + _xp]; + pSrc = &srcBuffer[0]; + pLookup = &lookupTable[0] - 1; + + _lookupValue = _var18 = 0; + _nibbleFlag = false; + decomIndex = decomCode >> 8; } // Main decompression switch switch (decomIndex) { case 0: // Draw rect at pos - pDest = &outputBuffer[_yp * SCREEN_WIDTH + _xp]; + pDest = &outputBuffer[_yp * DEFAULT_WIDTH + _xp]; pSrcStart = pSrc; INCR_TAIX; - for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += SCREEN_WIDTH) { + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { *pDestLine++ = suiv(pSrc); } } - pSrc = pSrcStart + _var4 + ((_var4 & 1) ? 1 : 0); + pSrc = pSrcStart + lookupBytes + ((lookupBytes & 1) ? 1 : 0); break; case 1: // Draw rect alternating left to right, right to left INCR_TAIX; for (int yCtr = 0; yCtr < _ySize; ++yCtr) { - if (yCtr % 2) { + if ((yCtr % 2) == 0) { for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - *pDest++ = suiv(pSrc); + *pDest++ = csuiv(pSrc, pLookup); } } else { for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - *--pDest = suiv(pSrc); + *--pDest = csuiv(pSrc, pLookup); } } - pDest += SCREEN_WIDTH; + pDest += DEFAULT_WIDTH; } break; @@ -193,12 +211,12 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { if (xCtr % 2) { - for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += SCREEN_WIDTH) { - *pDest = suiv(pSrc); + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { + *pDest = csuiv(pSrc, pLookup); } } else { - for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest -= SCREEN_WIDTH) { - *pDest = suiv(pSrc); + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest -= DEFAULT_WIDTH) { + *pDest = csuiv(pSrc, pLookup); } } ++pDest; @@ -206,14 +224,141 @@ void GfxSurface::decode(const byte *pSrc) { break; case 3: - // Draw horizontal line? - _var1C = 2; - horizontal(pSrc, pDest); + // Draw horizontal area? + _thickness = 2; + horizontal(pSrc, pDest, pLookup); + break; + + case 4: + // Draw vertical area? + _thickness = 2; + vertical(pSrc, pDest, pLookup); + break; + + case 5: + _thickness = 3; + horizontal(pSrc, pDest, pLookup); + break; + + case 6: + _thickness = 4; + vertical(pSrc, pDest, pLookup); + break; + + case 7: + // Draw box + INCR_TAIX; + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { + byte *pDestLine = pDest; + for (int xCtr = 0; xCtr < _xSize; ++xCtr, ++pDestLine) + *pDestLine++ = csuiv(pSrc, pLookup); + } + break; + + case 8: + // Draw box + for (int xCtr = 0; xCtr < _xSize; ++xCtr, ++pDest) { + byte *pDestLine = pDest; + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDestLine += DEFAULT_WIDTH) + *pDestLine = csuiv(pSrc, pLookup); + } + break; + + case 9: + _thickness = 4; + horizontal(pSrc, pDest, pLookup); + break; + + case 10: + _thickness = 6; + horizontal(pSrc, pDest, pLookup); + break; + + case 11: + warning("TODO: Switch 11"); + break; + + case 12: + INCR_TAIX; + _thickness = _var22 = 1; + _var1E = 320; + _var20 = _ySize; + _var24 = _xSize; + diag(); + break; + + case 13: + INCR_TAIX; + _thickness = _xSize; + _var1E = 1; + _var20 = _xSize; + _var22 = 320; + _var24 = _ySize; + diag(); + break; + + case 14: + _thickness = _var1E = 1; + _var20 = _xSize; + _var22 = 320; + _var24 = _ySize; + diag(); + break; + + case 15: + INCR_TAIX; + _thickness = 2; + _var1E = 320; + _var20 = _ySize; + _var22 = 1; + _var24 = _xSize; + diag(); + break; + + case 16: + _thickness = 3; + _var1E = 1; + _var20 = _xSize; + _var22 = 320; + _var24 = _ySize; + diag(); + break; + + case 17: + INCR_TAIX; + _thickness = 3; + _var1E = 320; + _var20 = _ySize; + _var22 = 1; + _var24 = _xSize; + diag(); + break; + + case 18: + INCR_TAIX; + _thickness = 5; + _var1E = 320; + _var20 = _ySize; + _var22 = 1; + _var24 = _xSize; + diag(); break; } pSrc = pSrcStart; - } while (--_entryCount > 0); + } while (--entryCount > 0); + + // At this point, the outputBuffer has the data for the image. The pitch is + // 320 pixels, the _xOffset and _yOffset represent the top left of the image data, + // and the _xSize and _ySize fields indicate the image size + create(_xOffset + _xSize, _yOffset + _ySize, Graphics::PixelFormat::createFormatCLUT8()); + + for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + const byte *copySrc = &outputBuffer[yCtr * DEFAULT_WIDTH]; + byte *copyDest = (byte *)getBasePtr(_xOffset, yCtr + _yOffset); + + Common::copy(copySrc, copySrc + _xSize, copyDest); + } } void GfxSurface::majTtxTty() { @@ -226,24 +371,41 @@ void GfxSurface::majTtxTty() { byte GfxSurface::suiv(const byte *&pSrc) { int v = *pSrc; - if (_var15) { + if (_nibbleFlag) { ++pSrc; ++_var18; - _var15 = 0; + _nibbleFlag = false; return v & 0xf; } else { - _var15 = ~(v >> 8); + _nibbleFlag = !_nibbleFlag; return v >> 4; } } +byte GfxSurface::csuiv(const byte *&pSrc, const byte *&pLookup) { + assert(pLookup); + + while (!_lookupValue) { + int v; + do { + v = suiv(pSrc) & 0xff; + _lookupValue += v; + } while (v == 0xf); + ++pLookup; + } + + --_lookupValue; + return *pLookup; +} + int GfxSurface::desanalyse(const byte *&pSrc) { int total = 0; int v = suiv(pSrc); - if (!v) { + if (v == 15) { int v2; do { v2 = suiv(pSrc); + total += v2; } while (v2 == 15); total *= 15; @@ -254,8 +416,151 @@ int GfxSurface::desanalyse(const byte *&pSrc) { return total; } -void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest) { +void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { + INCR_TAIX; + byte *pDestEnd = pDest + (_ySize - 1) * DEFAULT_WIDTH + _xSize; + + for (;;) { + // If position is past end point, then skip this line + if (((_thickness - 1) * DEFAULT_WIDTH) + pDest >= pDestEnd) { + if (--_thickness == 0) break; + continue; + } + + bool continueFlag = false; + do { + for (int xIndex = 0; xIndex < _xSize; ++xIndex, ++pDest) { + if ((xIndex % 2) == 0) { + // Write out vertical slice top to bottom + for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH) + *pDest = csuiv(pSrc, pLookup); + } else { + // Write out vertical slice bottom to top + for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH) + *pDest = csuiv(pSrc, pLookup); + } + } + + if ((_xSize % 2) == 0) { + int blockSize = _thickness * DEFAULT_WIDTH; + pDest += blockSize; + blockSize -= DEFAULT_WIDTH; + + if (pDestEnd < (pDest + blockSize)) { + do { + if (--_thickness == 0) + return; + } while ((pDest + (_thickness - 1) * DEFAULT_WIDTH) >= pDestEnd); + } + } else { + while ((pDest + (_thickness - 1) * DEFAULT_WIDTH) >= pDestEnd) { + if (--_thickness == 0) + return; + } + } + + for (int xIndex = 0; xIndex < _xSize; ++xIndex, --pDest) { + if ((xIndex % 2) == 0) { + // Write out vertical slice top to bottom + for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH) + *pDest = csuiv(pSrc, pLookup); + } else { + // Write out vertical slice top to bottom + for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH) + *pDest = csuiv(pSrc, pLookup); + } + } + + if ((_xSize % 2) == 1) { + ++pDest; + + if ((pDest + (_thickness - 1) * DEFAULT_WIDTH) < pDestEnd) { + continueFlag = true; + break; + } + } else { + pDest += _thickness * DEFAULT_WIDTH + 1; + continueFlag = true; + break; + } + + ++pDest; + } while (((_thickness - 1) * DEFAULT_WIDTH + pDest) < pDestEnd); + + if (continueFlag) + continue; + + // Move to next line + if (--_thickness == 0) + break; + } +} + +void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { +// byte *pDestEnd = pDest + (_ySize - 1) * DEFAULT_WIDTH + _xSize; + int var28 = 0; + + for (;;) { + // Reduce thickness as necessary + while ((var28 + _thickness) >= _xSize) { + if (--_thickness == 0) + return; + } + + // Loop + for (int idx = 0; idx < _thickness; ++idx) { + if ((idx % 2) == 0) { + if (idx > 0) + pDest -= DEFAULT_WIDTH; + + // Write out horizontal slice left to right + var28 += _thickness; + for (int xIndex = 0; xIndex < _thickness; ++xIndex) + *pDest++ = suiv(pSrc); + } else { + // Write out horizontal slice right to left + pDest += DEFAULT_WIDTH; + var28 -= _thickness; + for (int xIndex = 0; xIndex < _thickness; ++xIndex) + *pDest-- = csuiv(pSrc, pLookup); + } + } + if ((_thickness % 2) == 0) { + pDest += _thickness; + var28 += _thickness; + } + + // Reduce thickness as necessary + while ((var28 + _thickness) < _xSize) { + if (--_thickness == 0) + return; + } + + for (int yIndex = 0; yIndex < _ySize; ++yIndex) { + if ((yIndex % 2) == 0) { + if (yIndex > 0) + pDest -= DEFAULT_WIDTH; + + // Draw horizontal slice + var28 += _thickness; + + for (int xIndex = 0; xIndex < _thickness; ++xIndex) + *pDest++ = suiv(pSrc); + } else { + pDest -= DEFAULT_WIDTH; + var28 -= _thickness; + + for (int xIndex = 0; xIndex < _thickness; ++xIndex) + *pDest-- = csuiv(pSrc, pLookup); + } + } + } +} +void GfxSurface::diag() { + // The diag method in the original source doesn't seem to have any exit point, + // which if the case, means the routine may not be used by the game + error("Non-exitable method diag() called"); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index d3f64a01fe..4e7db305ca 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -31,20 +31,22 @@ namespace Mortevielle { class GfxSurface: public Graphics::Surface { private: int _var1; - int _entryCount; - int _var4, _var6; int _xp, _yp; - int _varC, _xSize, _ySize, _var12; - int _var14, _var15, _var18, _var1A; - int _var1C, _var1E, _var20, _var22; - int _var24, _var26, _var28; + int _xSize, _ySize, _var12; + int _var14, _var18, _lookupValue; + bool _nibbleFlag; + int _thickness, _var1E, _var20, _var22; + int _var24, _var26; int _width, _height; int _xOffset, _yOffset; void majTtxTty(); byte suiv(const byte *&pSrc); + byte csuiv(const byte *&pSrc, const byte *&pLookup); int desanalyse(const byte *&pSrc); - void horizontal(const byte *&pSrc, byte *&pDest); + void horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup); + void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup); + void diag(); public: void decode(const byte *pSrc); }; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b9d8265385..0e72090ec3 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -33,7 +33,8 @@ namespace Mortevielle { enum { - kMortevielleCore = 1 << 0 + kMortevielleCore = 1 << 0, + kMortevielleGraphics = 1 << 1 }; #define SCREEN_WIDTH 640 -- cgit v1.2.3 From 6c6c0f0ce5ffa2046fdd89f38f91582874d70799 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Jan 2012 22:41:30 +1100 Subject: MORTEVIELLE: Bugfixes for image decoding. Decoding types 1 and 7 are now working, so the first scene is partially decoding correctly. --- engines/mortevielle/graphics.cpp | 31 ++++++++++++++++--------------- engines/mortevielle/level15.cpp | 6 ++++++ engines/mortevielle/mortevielle.cpp | 6 ++++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 9b06972232..86cce5de9d 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -25,7 +25,7 @@ namespace Mortevielle { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } -#define DEFAULT_WIDTH 320 +#define DEFAULT_WIDTH (SCREEN_WIDTH / 2) #define BUFFER_SIZE 8192 void GfxSurface::decode(const byte *pSrc) { @@ -98,18 +98,20 @@ void GfxSurface::decode(const byte *pSrc) { _var12 = desanalyse(pSrc); _var14 = desanalyse(pSrc); - bool savedVar15 = _nibbleFlag; + const byte *pSrcSaved = pSrc; + bool savedNibbleFlag = _nibbleFlag; int savedVar18 = _var18; do { - const byte *pTemp = pSrc; - _nibbleFlag = savedVar15; + pSrc = pSrcSaved; + _nibbleFlag = savedNibbleFlag; _var18 = savedVar18; assert(_var14 < 256); - for (int idx = 0; idx < _var14; ++idx, ++tableOffset) + for (int idx = 0; idx < _var14; ++idx, ++tableOffset) { assert(tableOffset < BUFFER_SIZE); - lookupTable[tableOffset] = suiv(pTemp); + lookupTable[tableOffset] = suiv(pSrc); + } } while (--_var12 > 0); } while (_var18 < (lookupBytes - 1)); @@ -190,7 +192,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 1: - // Draw rect alternating left to right, right to left + // Draw rect using horizontal lines alternating left to right, then right to left INCR_TAIX; for (int yCtr = 0; yCtr < _ySize; ++yCtr) { if ((yCtr % 2) == 0) { @@ -246,11 +248,11 @@ void GfxSurface::decode(const byte *pSrc) { break; case 7: - // Draw box + // Draw rect using horizontal lines left to right INCR_TAIX; for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; - for (int xCtr = 0; xCtr < _xSize; ++xCtr, ++pDestLine) + for (int xCtr = 0; xCtr < _xSize; ++xCtr) *pDestLine++ = csuiv(pSrc, pLookup); } break; @@ -348,16 +350,15 @@ void GfxSurface::decode(const byte *pSrc) { pSrc = pSrcStart; } while (--entryCount > 0); - // At this point, the outputBuffer has the data for the image. The pitch is - // 320 pixels, the _xOffset and _yOffset represent the top left of the image data, - // and the _xSize and _ySize fields indicate the image size - create(_xOffset + _xSize, _yOffset + _ySize, Graphics::PixelFormat::createFormatCLUT8()); + // At this point, the outputBuffer has the data for the image. Initialise the surface + // with the calculated size for the full image, and copy the lines to the surface + create(_xOffset + _width, _yOffset + _height, Graphics::PixelFormat::createFormatCLUT8()); - for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + for (int yCtr = 0; yCtr < _height; ++yCtr) { const byte *copySrc = &outputBuffer[yCtr * DEFAULT_WIDTH]; byte *copyDest = (byte *)getBasePtr(_xOffset, yCtr + _yOffset); - Common::copy(copySrc, copySrc + _xSize, copyDest); + Common::copy(copySrc, copySrc + _width, copyDest); } } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 073b93fd96..7e1f47d668 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/system.h" #include "common/file.h" #include "mortevielle/graphics.h" #include "mortevielle/level15.h" @@ -101,6 +102,11 @@ void pictout(int seg, int dep, int x, int y) { #ifdef DEBUG GfxSurface surface; surface.decode(&mem[0x7000 * 16]); + + g_system->copyRectToScreen((const byte *)surface.pixels, surface.pitch, 0, 0, + surface.w, surface.h); + g_system->updateScreen(); + #endif decomp(seg, dep); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 43534a6ae0..bba22f1ba5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -172,8 +172,10 @@ Common::Error MortevielleEngine::run() { return err; // TODO: Remove once palette loading is correctly done - uint32 white = 0xffffffff; - g_system->getPaletteManager()->setPalette((const byte *)&white, 15, 1); + for (int idx = 0; idx < 16; ++idx) { + uint32 c = 0x111111 * idx; + g_system->getPaletteManager()->setPalette((const byte *)&c, idx, 1); + } // Dispatch to the game's main routine const char *argv[] = { "" }; -- cgit v1.2.3 From 7698c8c523c91b84d24cce8d64e11276bc3c8878 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 Jan 2012 00:58:24 +1100 Subject: MORTEVIELLE: Implemented the remaining image decoding mode 11 --- engines/mortevielle/graphics.cpp | 115 ++++++++++++++++++++++++++++++++++++++- engines/mortevielle/graphics.h | 6 +- 2 files changed, 117 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 86cce5de9d..f0dfdd2c8c 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -212,7 +212,7 @@ void GfxSurface::decode(const byte *pSrc) { // Draw rect alternating top to bottom, bottom to top INCR_TAIX; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - if (xCtr % 2) { + if ((xCtr % 2) == 0) { for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { *pDest = csuiv(pSrc, pLookup); } @@ -277,7 +277,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 11: - warning("TODO: Switch 11"); + decom11(pSrc, pDest, pLookup); break; case 12: @@ -430,11 +430,16 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku bool continueFlag = false; do { - for (int xIndex = 0; xIndex < _xSize; ++xIndex, ++pDest) { + for (int xIndex = 0; xIndex < _xSize; ++xIndex) { if ((xIndex % 2) == 0) { + if (xIndex != 0) + ++pDest; + // Write out vertical slice top to bottom for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH) *pDest = csuiv(pSrc, pLookup); + + ++pDest; } else { // Write out vertical slice bottom to top for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH) @@ -558,6 +563,110 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) } } +void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { + int var26 = 0, var28 = 0; + _var1E = DEFAULT_WIDTH; + _var22 = -1; + --_xSize; + --_ySize; + + int areaNum = 0; + while (areaNum != -1) { + switch (areaNum) { + case 0: + *pDest = csuiv(pSrc, pLookup); + areaNum = 1; + break; + + case 1: + increments(pDest); + + if (!var28) { + NIH(); + NIV(); + + if (var26 == _ySize) { + increments(pDest); + ++var28; + } else { + ++var26; + } + + *++pDest = csuiv(pSrc, pLookup); + areaNum = 2; + } else if (var26 != _ySize) { + ++var26; + --var28; + areaNum = 0; + } else { + NIH(); + NIV(); + increments(pDest); + ++var28; + + *++pDest = csuiv(pSrc, pLookup); + + if (var28 == _xSize) { + areaNum = -1; + } else { + areaNum = 2; + } + } + break; + + case 2: + increments(pDest); + + if (!var26) { + NIH(); + NIV(); + + if (var28 == _xSize) { + increments(pDest); + ++var26; + } else { + ++var28; + } + + pDest += DEFAULT_WIDTH; + areaNum = 0; + } else if (var28 != _xSize) { + ++var28; + --var26; + + *pDest = csuiv(pSrc, pLookup); + areaNum = 2; + } else { + pDest += DEFAULT_WIDTH; + ++var26; + NIH(); + NIV(); + increments(pDest); + + *pDest = csuiv(pSrc, pLookup); + + if (var26 == _ySize) + areaNum = -1; + else + areaNum = 1; + } + break; + } + } +} + +void GfxSurface::increments(byte *&pDest) { + pDest += _var22 + _var1E; +} + +void GfxSurface::NIH() { + _var22 = -_var22; +} + +void GfxSurface::NIV() { + _var1E = -_var1E; +} + void GfxSurface::diag() { // The diag method in the original source doesn't seem to have any exit point, // which if the case, means the routine may not be used by the game diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 4e7db305ca..0c322df732 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -36,7 +36,7 @@ private: int _var14, _var18, _lookupValue; bool _nibbleFlag; int _thickness, _var1E, _var20, _var22; - int _var24, _var26; + int _var24; int _width, _height; int _xOffset, _yOffset; @@ -46,6 +46,10 @@ private: int desanalyse(const byte *&pSrc); void horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup); + void decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup); + void increments(byte *&pDest); + void NIH(); + void NIV(); void diag(); public: void decode(const byte *pSrc); -- cgit v1.2.3 From 833e46d18a963054949944571e5b07d3e74f2953 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 Jan 2012 09:13:40 +1100 Subject: MORTEVIELLE: Completed the diag() method used in image decoding. The first image now completely decodes. --- engines/mortevielle/graphics.cpp | 123 +++++++++++++++++++++++++++++++++++---- engines/mortevielle/graphics.h | 5 +- 2 files changed, 116 insertions(+), 12 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index f0dfdd2c8c..2d09b6b7fc 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -286,7 +286,7 @@ void GfxSurface::decode(const byte *pSrc) { _var1E = 320; _var20 = _ySize; _var24 = _xSize; - diag(); + diag(pSrc, pDest, pLookup); break; case 13: @@ -296,7 +296,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _xSize; _var22 = 320; _var24 = _ySize; - diag(); + diag(pSrc, pDest, pLookup); break; case 14: @@ -304,7 +304,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _xSize; _var22 = 320; _var24 = _ySize; - diag(); + diag(pSrc, pDest, pLookup); break; case 15: @@ -314,7 +314,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _ySize; _var22 = 1; _var24 = _xSize; - diag(); + diag(pSrc, pDest, pLookup); break; case 16: @@ -323,7 +323,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _xSize; _var22 = 320; _var24 = _ySize; - diag(); + diag(pSrc, pDest, pLookup); break; case 17: @@ -333,7 +333,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _ySize; _var22 = 1; _var24 = _xSize; - diag(); + diag(pSrc, pDest, pLookup); break; case 18: @@ -343,7 +343,7 @@ void GfxSurface::decode(const byte *pSrc) { _var20 = _ySize; _var22 = 1; _var24 = _xSize; - diag(); + diag(pSrc, pDest, pLookup); break; } @@ -655,6 +655,87 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) } } +void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { + int var26 = 0, var28 = 0; + --_var24; + + while (!TFP(var26)) { + for (;;) { + NIH(); + for (int idx = 0; idx <= _thickness; ++idx) { + *pDest = csuiv(pSrc, pLookup); + NIH(); + increments(pDest); + } + + NIV(); + pDest += _var1E; + + for (int idx = 0; idx <= _thickness; ++idx) { + *pDest = csuiv(pSrc, pLookup); + NIH(); + increments(pDest); + } + + NIH(); + NIV(); + increments(pDest); + + ++var28; + if (_var24 < (var28 + 1)) { + TF1(pDest, var26); + break; + } + + pDest += _var22; + if (_var24 < (var28 + 1)) { + TF2(pSrc, pDest, pLookup, var26); + break; + } + } + + if (TFP(var26)) + return; + + for (;;) { + for (int idx = 0; idx <= _thickness; ++idx) { + *pDest = csuiv(pSrc, pLookup); + NIH(); + increments(pDest); + } + + NIV(); + + for (int idx = 0; idx <= _thickness; ++idx) { + *pDest = csuiv(pSrc, pLookup); + NIH(); + increments(pDest); + } + + NIH(); + NIV(); + increments(pDest); + + if (--var28 == 0) { + TF1(pDest, var26); + NIH(); + break; + } else { + pDest += _var22; + + if (--var28 == 0) { + TF2(pSrc, pDest, pLookup, var26); + NIH(); + break; + } + } + + NIH(); + } + } +} + + void GfxSurface::increments(byte *&pDest) { pDest += _var22 + _var1E; } @@ -667,10 +748,30 @@ void GfxSurface::NIV() { _var1E = -_var1E; } -void GfxSurface::diag() { - // The diag method in the original source doesn't seem to have any exit point, - // which if the case, means the routine may not be used by the game - error("Non-exitable method diag() called"); +bool GfxSurface::TFP(int v) { + int diff = _var20 - v; + if (!diff) + // Time to finish loop in outer method + return true; + + if (diff < (_thickness + 1)) + _thickness = diff - 1; + + return false; +} + +void GfxSurface::TF1(byte *&pDest, int &v) { + v += _thickness + 1; + pDest += (_thickness + 1) * _var1E; +} + +void GfxSurface::TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v) { + v += _thickness + 1; + + for (int idx = 0; idx <= _thickness; ++idx) { + *pDest = csuiv(pSrc, pLookup); + pDest += _var1E; + } } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 0c322df732..ce11fd8245 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -47,10 +47,13 @@ private: void horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup); + void diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void increments(byte *&pDest); void NIH(); void NIV(); - void diag(); + bool TFP(int v); + void TF1(byte *&pDest, int &v); + void TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v); public: void decode(const byte *pSrc); }; -- cgit v1.2.3 From 2416583449699ea6940acdfaac77d15bc1b012d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 Jan 2012 09:19:50 +1100 Subject: MORTEVIELLE: Implemented a screen surface class to hold all the graphics functionality. This includes moving the already created pixel and character functions into it, as well as a new method for drawing decoded graphic images. --- engines/mortevielle/graphics.cpp | 144 ++++++++++++++++++++++++++++++++++++ engines/mortevielle/graphics.h | 25 ++++++- engines/mortevielle/level15.cpp | 12 +-- engines/mortevielle/mortevielle.cpp | 57 +------------- engines/mortevielle/mortevielle.h | 13 +--- engines/mortevielle/sprint.cpp | 2 +- engines/mortevielle/var_mor.cpp | 4 +- 7 files changed, 177 insertions(+), 80 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 2d09b6b7fc..5099504536 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -20,10 +20,21 @@ * */ +#include "common/endian.h" +#include "common/system.h" #include "mortevielle/graphics.h" +#include "mortevielle/mortevielle.h" namespace Mortevielle { +/*-------------------------------------------------------------------------* + * Image decoding + * + * The code in this section is responsible for decoding image resources. + * Images are broken down into rectangular sections, which can use one + * of 18 different encoding methods. + *-------------------------------------------------------------------------*/ + #define INCR_TAIX { if (_xSize & 1) ++_xSize; } #define DEFAULT_WIDTH (SCREEN_WIDTH / 2) #define BUFFER_SIZE 8192 @@ -774,4 +785,137 @@ void GfxSurface::TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int } } +/*-------------------------------------------------------------------------*/ + +GfxSurface::~GfxSurface() { + free(); +} + +/*-------------------------------------------------------------------------* + * Screen surface + *-------------------------------------------------------------------------*/ + +/** + * Called to populate the font data from the passed file + */ +void ScreenSurface::readFontData(Common::File &f, int dataSize) { + assert(dataSize == (FONT_NUM_CHARS * FONT_HEIGHT)); + f.read(_fontData, FONT_NUM_CHARS * FONT_HEIGHT); +} + +/** + * Returns a graphics surface representing a subset of the screen. The affected area + * is also marked as dirty + */ +Graphics::Surface ScreenSurface::lockArea(const Common::Rect &bounds) { + _dirtyRects.push_back(bounds); + + Graphics::Surface s; + s.pixels = getBasePtr(bounds.left, bounds.top); + s.pitch = pitch; + s.w = bounds.width(); + s.h = bounds.height(); + + return s; +} + +/** + * Updates the affected areas of the surface to the underlying physical screen + */ +void ScreenSurface::updateScreen() { + // Iterate through copying dirty areas to the screen + for (Common::List::iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) { + Common::Rect r = *i; + g_system->copyRectToScreen((const byte *)getBasePtr(r.left, r.top), pitch, + r.left, r.top, r.width(), r.height()); + } + _dirtyRects.clear(); + + // Update the screen + g_system->updateScreen(); +} + +/** + * Draws a decoded picture on the screen + * @remarks Because the ScummVM surface is using a double height 640x200 surface to + * simulate the original 640x200 surface, all Y values have to be doubled. + * Also, image resources are stored at 320x200, so when drawn onto the screen every + * other column is interpolated. + */ +void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { + // Lock the affected area of the surface to write to + Graphics::Surface destSurface = lockArea(Common::Rect(x, y, + x + surface.w * 2, y + surface.h * 2)); + + // Loop through writing + for (int yp = 0; yp < surface.h; ++yp) { + if (((y + yp) < 0) || ((y + yp) >= 200)) + continue; + + const byte *pSrc = (const byte *)surface.getBasePtr(0, yp); + byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2); + + for (int xp = 0; xp < surface.w; ++xp, ++pSrc) { + // Draw pixel from source image + *pDest = *pSrc; + *(pDest + SCREEN_WIDTH) = *pSrc; + ++pDest; + + // TODO: I'm not sure what algorithm the original uses to calculate + // which pixel to use on the alternate columns, so for now I'm doing + // a simple output of null values. This should be revisited once we've + // got the palette loading so we can compare palettes. In fact, the + // original had the alternate columns very noticablely striped. With + // the larger 256 colour palette, it may be worthwhile to offer a + // better blended graphics mode as an option. + *pDest = 0; + *(pDest + SCREEN_WIDTH) = 0; + ++pDest; + } + } + + // TODO: Remove this once we have a proper game loop + updateScreen(); +} + +/** + * Draws a character at the specified co-ordinates + * @remarks Because the ScummVM surface is using a double height 640x200 surface to + * simulate the original 640x200 surface, all Y values have to be doubled + */ +void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex) { + Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, + pt.x + FONT_WIDTH, (pt.y + FONT_HEIGHT) * 2)); + + // Get the start of the character to use + assert((ch >= ' ') && (ch <= (unsigned char)(32 + FONT_NUM_CHARS))); + const byte *charData = &_fontData[((int)ch - 32) * FONT_HEIGHT]; + + // Loop through decoding each character's data + for (int yp = 0; yp < FONT_HEIGHT; ++yp) { + byte *lineP = (byte *)destSurface.getBasePtr(0, yp * 2); + byte byteVal = *charData++; + + for (int xp = 0; xp < FONT_WIDTH; ++xp, ++lineP, byteVal <<= 1) { + if (byteVal & 0x80) { + *lineP = palIndex; + *(lineP + SCREEN_WIDTH) = palIndex; + } + } + } +} + +/** + * Sets a single pixel at the specified co-ordinates + * @remarks Because the ScummVM surface is using a double height 640x200 surface to + * simulate the original 640x200 surface, all Y values have to be doubled + */ +void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { + Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); + + byte *destP = (byte *)destSurface.pixels; + *destP = palIndex; + *(destP + SCREEN_WIDTH) = palIndex; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index ce11fd8245..c733cbc501 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -23,11 +23,17 @@ #ifndef MORTEVIELLE_GRAPHICS_H #define MORTEVIELLE_GRAPHICS_H +#include "common/file.h" +#include "common/list.h" +#include "common/rect.h" #include "graphics/surface.h" -#include "mortevielle/mortevielle.h" namespace Mortevielle { +#define FONT_WIDTH 8 +#define FONT_HEIGHT 6 +#define FONT_NUM_CHARS 121 + class GfxSurface: public Graphics::Surface { private: int _var1; @@ -55,9 +61,26 @@ private: void TF1(byte *&pDest, int &v); void TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v); public: + ~GfxSurface(); + void decode(const byte *pSrc); }; +class ScreenSurface: public Graphics::Surface { +private: + Common::List _dirtyRects; + byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; +public: + void readFontData(Common::File &f, int dataSize); + Graphics::Surface lockArea(const Common::Rect &bounds); + void updateScreen(); + void drawPicture(GfxSurface &surface, int x, int y); + void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); + + // TODO: Refactor code to remove this method, for increased performance + void setPixel(const Common::Point &pt, int palIndex); +}; + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 7e1f47d668..8b8dbcf02f 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -29,6 +29,7 @@ #include "common/file.h" #include "mortevielle/graphics.h" #include "mortevielle/level15.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" @@ -99,15 +100,8 @@ void writepal(int n) { void pictout(int seg, int dep, int x, int y) { -#ifdef DEBUG GfxSurface surface; - surface.decode(&mem[0x7000 * 16]); - - g_system->copyRectToScreen((const byte *)surface.pixels, surface.pitch, 0, 0, - surface.w, surface.h); - g_system->updateScreen(); - -#endif + surface.decode(&mem[seg * 16 + dep]); decomp(seg, dep); if (gd == her) { @@ -116,7 +110,7 @@ void pictout(int seg, int dep, int x, int y) { } if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); - afff(gd, seg, dep, x, y); + g_vm->_screenSurface.drawPicture(surface, x, y); } void putxy(int x, int y) { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index bba22f1ba5..cdeb412625 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -97,8 +97,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (!strncmp(dataType, "FONT", 4)) { // Font resource - assert(dataSize == (FONT_NUM_CHARS * FONT_HEIGHT)); - f.read(_fontData, FONT_NUM_CHARS * FONT_HEIGHT); + _screenSurface.readFontData(f, dataSize); } else { // Unknown section f.skip(dataSize); @@ -109,60 +108,6 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { return Common::kNoError; } -/*-------------------------------------------------------------------------*/ - -/** - * Update the physical screen - */ -void MortevielleEngine::updateScreen() { - g_system->copyRectToScreen((const byte *)_screenSurface.getBasePtr(0, 0), - SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - g_system->updateScreen(); -} -/** - * Draws a character at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled - */ -void MortevielleEngine::writeCharacter(const Common::Point &pt, unsigned char ch, - int palIndex, Graphics::Surface *surface) { - if (surface == NULL) - surface = &_screenSurface; - - // Get the start of the character to use - assert((ch >= ' ') && (ch <= (unsigned char)(32 + FONT_NUM_CHARS))); - const byte *charData = &_fontData[((int)ch - 32) * FONT_HEIGHT]; - - // Loop through decoding each character's data - for (int yp = 0; yp < FONT_HEIGHT; ++yp) { - byte *lineP = (byte *)surface->getBasePtr(pt.x, (pt.y + yp) * 2); - byte byteVal = *charData++; - - for (int xp = 0; xp < 8; ++xp, ++lineP, byteVal <<= 1) { - if (byteVal & 0x80) { - *lineP = palIndex; - *(lineP + SCREEN_WIDTH) = palIndex; - } - } - } -} - -/** - * Sets a single pixel at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled - */ -void MortevielleEngine::setPixel(const Common::Point &pt, int palIndex, - Graphics::Surface *surface) { - if (surface == NULL) - surface = &_screenSurface; - - byte *destP = (byte *)surface->getBasePtr(pt.x, pt.y * 2); - *destP = palIndex; - *(destP + SCREEN_WIDTH) = palIndex; -} - - /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0e72090ec3..bcd6f666d0 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -29,6 +29,7 @@ #include "engines/engine.h" #include "common/error.h" #include "graphics/surface.h" +#include "mortevielle/graphics.h" namespace Mortevielle { @@ -42,10 +43,6 @@ enum { #define MORT_DAT_REQUIRED_VERSION 1 #define MORT_DAT "mort.dat" -#define FONT_WIDTH 8 -#define FONT_HEIGHT 6 -#define FONT_NUM_CHARS 121 - class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; @@ -54,19 +51,13 @@ private: Common::ErrorCode loadMortDat(); void loadFont(Common::File &f); public: - Graphics::Surface _screenSurface; - byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; + ScreenSurface _screenSurface; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; virtual Common::Error run(); uint32 getGameFlags() const; - - void updateScreen(); - void writeCharacter(const Common::Point &pt, - unsigned char ch, int palIndex, Graphics::Surface *surface = NULL); - void setPixel(const Common::Point &pt, int palIndex, Graphics::Surface *surface = NULL); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 67bd3ab119..027d74791a 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -88,7 +88,7 @@ void writeg(Common::String l, int c) show_mouse(); // TODO: Move screen updates to main loop once constructed - g_vm->updateScreen(); + g_vm->_screenSurface.updateScreen(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 5166f201c4..5cca06f011 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -312,9 +312,9 @@ void hirs() { */ void affput(const Common::Point &pt, int palIndex, int ch) { if (ch == 0) - g_vm->setPixel(pt, palIndex); + g_vm->_screenSurface.setPixel(pt, palIndex); else - g_vm->writeCharacter(pt, ch, palIndex); + g_vm->_screenSurface.writeCharacter(pt, ch, palIndex); } void affcar(int gd, int x, int y, int coul, int chr) { -- cgit v1.2.3 From c33f25cffbfab2a0875ee27e0e931b776cda9ff6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2012 01:09:11 +1100 Subject: MORTEVIELLE: Fix remaining issues when decoding first image --- engines/mortevielle/graphics.cpp | 110 +++++++++++++++++++----------------- engines/mortevielle/graphics.h | 2 +- engines/mortevielle/mortevielle.cpp | 5 ++ 3 files changed, 65 insertions(+), 52 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 5099504536..4be270ffa6 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -72,6 +72,8 @@ void GfxSurface::decode(const byte *pSrc) { // Temporary output buffer byte outputBuffer[65536]; + Common::fill(&outputBuffer[0], &outputBuffer[65536], 0); + byte *pDest = &outputBuffer[0]; const byte *pSrcStart = pSrc; const byte *pLookup = NULL; @@ -80,7 +82,7 @@ void GfxSurface::decode(const byte *pSrc) { byte srcBuffer[BUFFER_SIZE]; // Main processing loop - do { + for (int entryIndex = 0; entryIndex < entryCount; ++entryIndex) { int lookupBytes = READ_BE_UINT16(pSrc); int srcSize = READ_BE_UINT16(pSrc + 2); _xp = READ_BE_UINT16(pSrc + 4) - _xOffset; @@ -228,7 +230,8 @@ void GfxSurface::decode(const byte *pSrc) { *pDest = csuiv(pSrc, pLookup); } } else { - for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest -= DEFAULT_WIDTH) { + for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + pDest -= DEFAULT_WIDTH; *pDest = csuiv(pSrc, pLookup); } } @@ -293,8 +296,8 @@ void GfxSurface::decode(const byte *pSrc) { case 12: INCR_TAIX; - _thickness = _var22 = 1; - _var1E = 320; + _thickness = _xInc = 1; + _yInc = DEFAULT_WIDTH; _var20 = _ySize; _var24 = _xSize; diag(pSrc, pDest, pLookup); @@ -303,17 +306,17 @@ void GfxSurface::decode(const byte *pSrc) { case 13: INCR_TAIX; _thickness = _xSize; - _var1E = 1; + _yInc = 1; _var20 = _xSize; - _var22 = 320; + _xInc = DEFAULT_WIDTH; _var24 = _ySize; diag(pSrc, pDest, pLookup); break; case 14: - _thickness = _var1E = 1; + _thickness = _yInc = 1; _var20 = _xSize; - _var22 = 320; + _xInc = DEFAULT_WIDTH; _var24 = _ySize; diag(pSrc, pDest, pLookup); break; @@ -321,18 +324,18 @@ void GfxSurface::decode(const byte *pSrc) { case 15: INCR_TAIX; _thickness = 2; - _var1E = 320; + _yInc = DEFAULT_WIDTH; _var20 = _ySize; - _var22 = 1; + _xInc = 1; _var24 = _xSize; diag(pSrc, pDest, pLookup); break; case 16: _thickness = 3; - _var1E = 1; + _yInc = 1; _var20 = _xSize; - _var22 = 320; + _xInc = DEFAULT_WIDTH; _var24 = _ySize; diag(pSrc, pDest, pLookup); break; @@ -340,9 +343,9 @@ void GfxSurface::decode(const byte *pSrc) { case 17: INCR_TAIX; _thickness = 3; - _var1E = 320; + _yInc = DEFAULT_WIDTH; _var20 = _ySize; - _var22 = 1; + _xInc = 1; _var24 = _xSize; diag(pSrc, pDest, pLookup); break; @@ -350,16 +353,18 @@ void GfxSurface::decode(const byte *pSrc) { case 18: INCR_TAIX; _thickness = 5; - _var1E = 320; + _yInc = DEFAULT_WIDTH; _var20 = _ySize; - _var22 = 1; + _xInc = 1; _var24 = _xSize; diag(pSrc, pDest, pLookup); break; } pSrc = pSrcStart; - } while (--entryCount > 0); + debugC(1, kMortevielleGraphics, "Decoding image block %d position %d,%d size %d,%d method %d", + entryIndex + 1, _xp, _yp, _width, _height, decomIndex); + } // At this point, the outputBuffer has the data for the image. Initialise the surface // with the calculated size for the full image, and copy the lines to the surface @@ -519,65 +524,66 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) for (;;) { // Reduce thickness as necessary - while ((var28 + _thickness) >= _xSize) { + while ((var28 + _thickness) > _xSize) { if (--_thickness == 0) return; } // Loop - for (int idx = 0; idx < _thickness; ++idx) { - if ((idx % 2) == 0) { - if (idx > 0) - pDest -= DEFAULT_WIDTH; + for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + if ((yCtr % 2) == 0) { + if (yCtr > 0) + pDest += DEFAULT_WIDTH; - // Write out horizontal slice left to right var28 += _thickness; - for (int xIndex = 0; xIndex < _thickness; ++xIndex) - *pDest++ = suiv(pSrc); + for (int xCtr = 0; xCtr < _thickness; ++xCtr) + *pDest++ = csuiv(pSrc, pLookup); } else { - // Write out horizontal slice right to left pDest += DEFAULT_WIDTH; var28 -= _thickness; - for (int xIndex = 0; xIndex < _thickness; ++xIndex) - *pDest-- = csuiv(pSrc, pLookup); + for (int xCtr = 0; xCtr < _thickness; ++xCtr) + *--pDest = csuiv(pSrc, pLookup); } } - if ((_thickness % 2) == 0) { + if ((_ySize % 2) == 0) { pDest += _thickness; var28 += _thickness; } - - // Reduce thickness as necessary - while ((var28 + _thickness) < _xSize) { + + while (_xSize < (var28 + _thickness)) { if (--_thickness == 0) return; } - for (int yIndex = 0; yIndex < _ySize; ++yIndex) { - if ((yIndex % 2) == 0) { - if (yIndex > 0) + // Loop + for (int yCtr = 0; yCtr < _ySize; ++yCtr) { + if ((yCtr % 2) == 0) { + if (yCtr > 0) pDest -= DEFAULT_WIDTH; - // Draw horizontal slice var28 += _thickness; - for (int xIndex = 0; xIndex < _thickness; ++xIndex) - *pDest++ = suiv(pSrc); + for (int xCtr = 0; xCtr < _thickness; ++xCtr) + *pDest++ = csuiv(pSrc, pLookup); } else { pDest -= DEFAULT_WIDTH; var28 -= _thickness; - for (int xIndex = 0; xIndex < _thickness; ++xIndex) - *pDest-- = csuiv(pSrc, pLookup); + for (int xCtr = 0; xCtr < _thickness; ++xCtr) + *--pDest = csuiv(pSrc, pLookup); } + } + if ((_ySize % 2) == 0) { + pDest += _thickness; + var28 += _thickness; } } } void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { int var26 = 0, var28 = 0; - _var1E = DEFAULT_WIDTH; - _var22 = -1; + _yInc = DEFAULT_WIDTH; + _xInc = -1; --_xSize; --_ySize; @@ -680,7 +686,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { } NIV(); - pDest += _var1E; + pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { *pDest = csuiv(pSrc, pLookup); @@ -698,7 +704,8 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { break; } - pDest += _var22; + pDest += _xInc; + ++var28; if (_var24 < (var28 + 1)) { TF2(pSrc, pDest, pLookup, var26); break; @@ -706,7 +713,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { } if (TFP(var26)) - return; + break; for (;;) { for (int idx = 0; idx <= _thickness; ++idx) { @@ -716,6 +723,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { } NIV(); + pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { *pDest = csuiv(pSrc, pLookup); @@ -732,7 +740,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { NIH(); break; } else { - pDest += _var22; + pDest += _xInc; if (--var28 == 0) { TF2(pSrc, pDest, pLookup, var26); @@ -748,15 +756,15 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { void GfxSurface::increments(byte *&pDest) { - pDest += _var22 + _var1E; + pDest += _xInc + _yInc; } void GfxSurface::NIH() { - _var22 = -_var22; + _xInc = -_xInc; } void GfxSurface::NIV() { - _var1E = -_var1E; + _yInc = -_yInc; } bool GfxSurface::TFP(int v) { @@ -773,7 +781,7 @@ bool GfxSurface::TFP(int v) { void GfxSurface::TF1(byte *&pDest, int &v) { v += _thickness + 1; - pDest += (_thickness + 1) * _var1E; + pDest += (_thickness + 1) * _yInc; } void GfxSurface::TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v) { @@ -781,7 +789,7 @@ void GfxSurface::TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int for (int idx = 0; idx <= _thickness; ++idx) { *pDest = csuiv(pSrc, pLookup); - pDest += _var1E; + pDest += _yInc; } } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index c733cbc501..8f21cde86f 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -41,7 +41,7 @@ private: int _xSize, _ySize, _var12; int _var14, _var18, _lookupValue; bool _nibbleFlag; - int _thickness, _var1E, _var20, _var22; + int _thickness, _yInc, _var20, _xInc; int _var24; int _width, _height; int _xOffset, _yOffset; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index cdeb412625..c302bfed78 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/debug-channels.h" #include "engines/util.h" #include "engines/engine.h" #include "graphics/palette.h" @@ -49,6 +50,10 @@ Common::ErrorCode MortevielleEngine::initialise() { // Initialise graphics mode initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); + // Set debug channels + DebugMan.addDebugChannel(kMortevielleCore, "core", "Core debugging"); + DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging"); + // Set up an intermediate screen surface _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); -- cgit v1.2.3 From 33f70da53cc9e5d060610c030a0a4dd76292525d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2012 09:12:27 +1100 Subject: MORTEVIELLE: Added an optimised drawBox routine --- engines/mortevielle/boite.cpp | 32 ++++---------------------------- engines/mortevielle/graphics.cpp | 39 +++++++++++++++++++++++++++++++++------ engines/mortevielle/graphics.h | 2 +- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 6e2976964d..e2b8200adc 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -25,41 +25,17 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/textconsole.h" #include "mortevielle/boite.h" -#include "mortevielle/mouse.h" -#include "mortevielle/var_mor.h" +#include "mortevielle/mortevielle.h" namespace Mortevielle { //Translation: box() void boite(int x, int y, int dx, int dy, int coul) { - int i; - int xi, yi, xo, yo; + warning("TODO: boite is deprecated in favour of ScreenSurface::drawBox"); - /* debug('boite'); */ - hide_mouse(); - if (res == 1) { - x = (uint)x >> 1; - dx = (uint)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(int, xi), yi, coul); - yi = succ(int, yi); - } else xi = succ(int, xi); - putpix(gd, xo, yo, coul); - if (yo == y + dy) xo = succ(int, xo); - else { - if (gd != cga) putpix(gd, succ(int, xo), yo, coul); - yo = succ(int, yo); - } - } - show_mouse(); + g_vm->_screenSurface.drawBox(x, y, dx, dy, coul); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 4be270ffa6..851e5df391 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -24,6 +24,8 @@ #include "common/system.h" #include "mortevielle/graphics.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/mouse.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { @@ -819,6 +821,7 @@ Graphics::Surface ScreenSurface::lockArea(const Common::Rect &bounds) { _dirtyRects.push_back(bounds); Graphics::Surface s; + s.format = format; s.pixels = getBasePtr(bounds.left, bounds.top); s.pitch = pitch; s.w = bounds.width(); @@ -845,8 +848,8 @@ void ScreenSurface::updateScreen() { /** * Draws a decoded picture on the screen - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled. + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled. * Also, image resources are stored at 320x200, so when drawn onto the screen every * other column is interpolated. */ @@ -888,8 +891,8 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { /** * Draws a character at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex) { Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, @@ -913,10 +916,34 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in } } +/** + * Draws a box at the specified position and size + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled + */ +void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { + if (res == 1) { + x = (uint)x >> 1; + dx = (uint)dx >> 1; + } + + Graphics::Surface destSurface = lockArea(Common::Rect(x, y * 2, x + dx, (y + dy) * 2)); + + destSurface.hLine(0, 0, dx, col); + destSurface.hLine(0, 1, dx, col); + destSurface.hLine(0, destSurface.h - 1, dx, col); + destSurface.hLine(0, destSurface.h - 2, dx, col); + destSurface.vLine(0, 2, destSurface.h - 3, col); + destSurface.vLine(1, 2, destSurface.h - 3, col); + destSurface.vLine(dx - 1, 2, destSurface.h - 3, col); + destSurface.vLine(dx - 2, 2, destSurface.h - 3, col); +} + + /** * Sets a single pixel at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 8f21cde86f..78c1637e58 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -76,7 +76,7 @@ public: void updateScreen(); void drawPicture(GfxSurface &surface, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); - + void drawBox(int x, int y, int dx, int dy, int col); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); }; -- cgit v1.2.3 From 6ac925fb1f05636c4d10aee5fdb17e1aef3f5020 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2012 09:16:01 +1100 Subject: MORTEVIELLE: Correct horizontal display of images --- engines/mortevielle/graphics.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 851e5df391..d7ed056ef7 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -848,15 +848,17 @@ void ScreenSurface::updateScreen() { /** * Draws a decoded picture on the screen - * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * @remarks - Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled. - * Also, image resources are stored at 320x200, so when drawn onto the screen every + * - Image resources are stored at 320x200, so when drawn onto the screen every * other column is interpolated. + * - Because the original game supported 320 width resolutions, the X coordinate + * also needs to be doubled for EGA mode */ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { // Lock the affected area of the surface to write to - Graphics::Surface destSurface = lockArea(Common::Rect(x, y, - x + surface.w * 2, y + surface.h * 2)); + Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y, + (x + surface.w) * 2, y + surface.h * 2)); // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { -- cgit v1.2.3 From 8c423fd790cfb200852d5de4a707817f07489195 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2012 22:30:00 +1100 Subject: MORTEVIELLE: Create a basic palette manager class --- engines/mortevielle/graphics.cpp | 50 +++++++++++++++++++++++++++++++++++++ engines/mortevielle/graphics.h | 6 +++++ engines/mortevielle/mortevielle.cpp | 7 ++---- engines/mortevielle/mortevielle.h | 1 + 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index d7ed056ef7..8e4ad338df 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -22,6 +22,7 @@ #include "common/endian.h" #include "common/system.h" +#include "graphics/palette.h" #include "mortevielle/graphics.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" @@ -29,6 +30,52 @@ namespace Mortevielle { +/*-------------------------------------------------------------------------* + * Palette Manager + * + *-------------------------------------------------------------------------*/ + +/** + * Set palette entries from the 64 colour available EGA palette + */ +void PaletteManager::setPalette(const int *palette, uint idx, uint size) { + assert((idx + size) <= 16); + + // Build up the EGA palette + byte egaPalette[64 * 3]; + + byte *p = &egaPalette[0]; + for (int i = 0; i < 64; i++) { + *p++ = (i >> 2 & 1) * 42 + (i >> 5 & 1) * 21; + *p++ = (i >> 1 & 1) * 42 + (i >> 4 & 1) * 21; + *p++ = (i & 1) * 42 + (i >> 3 & 1) * 21; + } + + // Loop through setting palette colours based on the passed indexes + for (; size > 0; --size, ++idx) { + int palIndex = palette[idx]; + assert(palIndex < 64); + + const byte *pRgb = (const byte *)&egaPalette[palIndex]; + g_system->getPaletteManager()->setPalette(pRgb, idx, 1); + } +} + +/** + * Set the default EGA palette + */ +void PaletteManager::setDefaultPalette() { +/* + int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 7, 20, 56, 57, 58, 59, 60, 61, 62, 63 }; + setPalette(defaultPalette, 0, 16); +*/ + // TODO: Replace with proper palette + for (int idx = 0; idx < 16; ++idx) { + uint32 c = 0x111111 * idx; + g_system->getPaletteManager()->setPalette((const byte *)&c, idx, 1); + } +} + /*-------------------------------------------------------------------------* * Image decoding * @@ -939,6 +986,9 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { destSurface.vLine(1, 2, destSurface.h - 3, col); destSurface.vLine(dx - 1, 2, destSurface.h - 3, col); destSurface.vLine(dx - 2, 2, destSurface.h - 3, col); + + // TODO: Remove this once we have a proper game loop + updateScreen(); } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 78c1637e58..f5c2207a12 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -30,6 +30,12 @@ namespace Mortevielle { +class PaletteManager { +public: + void setPalette(const int *palette, uint idx, uint size); + void setDefaultPalette(); +}; + #define FONT_WIDTH 8 #define FONT_HEIGHT 6 #define FONT_NUM_CHARS 121 diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c302bfed78..8346c3f9e7 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -121,11 +121,8 @@ Common::Error MortevielleEngine::run() { if (err != Common::kNoError) return err; - // TODO: Remove once palette loading is correctly done - for (int idx = 0; idx < 16; ++idx) { - uint32 c = 0x111111 * idx; - g_system->getPaletteManager()->setPalette((const byte *)&c, idx, 1); - } + // Set default palette + _paletteManager.setDefaultPalette(); // Dispatch to the game's main routine const char *argv[] = { "" }; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index bcd6f666d0..816a4360cc 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -52,6 +52,7 @@ private: void loadFont(Common::File &f); public: ScreenSurface _screenSurface; + PaletteManager _paletteManager; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); -- cgit v1.2.3 From d0129ad88bda4d1aa39f8e778c42343b4c0030f6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2012 23:52:36 +1100 Subject: MORTEVIELLE: Implemented a basic event handler. --- engines/mortevielle/graphics.cpp | 8 +--- engines/mortevielle/keyboard.cpp | 2 + engines/mortevielle/mor2.cpp | 3 ++ engines/mortevielle/mort.cpp | 12 +++--- engines/mortevielle/mort.h | 2 +- engines/mortevielle/mortevielle.cpp | 77 ++++++++++++++++++++++++++++++++++++- engines/mortevielle/mortevielle.h | 12 ++++++ engines/mortevielle/ovd1.cpp | 3 +- engines/mortevielle/var_mor.cpp | 4 +- 9 files changed, 105 insertions(+), 18 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 8e4ad338df..e6035bb114 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -66,7 +66,7 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { */ void PaletteManager::setDefaultPalette() { /* - int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 7, 20, 56, 57, 58, 59, 60, 61, 62, 63 }; + int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63 }; setPalette(defaultPalette, 0, 16); */ // TODO: Replace with proper palette @@ -933,9 +933,6 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { ++pDest; } } - - // TODO: Remove this once we have a proper game loop - updateScreen(); } /** @@ -986,9 +983,6 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { destSurface.vLine(1, 2, destSurface.h - 3, col); destSurface.vLine(dx - 1, 2, destSurface.h - 3, col); destSurface.vLine(dx - 2, 2, destSurface.h - 3, col); - - // TODO: Remove this once we have a proper game loop - updateScreen(); } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index dae117e110..4eba4c4a0d 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -49,6 +49,7 @@ int testou() { case '\23' : sonoff = ! sonoff; break; + /* Prevent changing graphics mode case '\1': case '\3': case '\5' : { @@ -69,6 +70,7 @@ int testou() { return testou_result; } break; + */ case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 1c2936d188..2f0793643c 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -31,6 +31,7 @@ #include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/parole2.h" @@ -275,6 +276,7 @@ void mfouen() void atf3f8(int &key) { do { key = testou(); + CHECK_QUIT; } while (!((key == 61) || (key == 66))); } @@ -394,6 +396,7 @@ void sparl(float adr, float rep) { do { parole(repint, haut[caff - 69], 0); atf3f8(key); + CHECK_QUIT; } while (!(key == 66)); hirs(); show_mouse(); diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index e24e9b58f9..fc592f98fe 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -26,6 +26,7 @@ */ #include "mortevielle/mort.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/var_mor.h" /* les variables */ //Translation: Variables #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" /* la gestion du clavier */ //Translation: Keyboard manager @@ -57,6 +58,8 @@ void divers(int np, bool b) { do { parole(np, 0, 0); atf3f8(key); + CHECK_QUIT; + if (newgd != gd) { gd = newgd; hirs(); @@ -67,7 +70,7 @@ void divers(int np, bool b) { /* NIVEAU 0 */ -int mortevielle_main(int argc, const char *argv[]) { +void mortevielle_main() { /*init_debug;*/ /* ecri_seg;*/ //pio_initialize(argc, argv); @@ -116,9 +119,12 @@ int mortevielle_main(int argc, const char *argv[]) { aff50(false); mlec = 0; divers(142, false); + CHECK_QUIT; ani50(); divers(143, true); + CHECK_QUIT; + suite(); music(); adzon(); @@ -137,10 +143,6 @@ int mortevielle_main(int argc, const char *argv[]) { do { tjouer(); } while (!arret); - hide_mouse(); - clrscr; - /*out_debug;*/ - return EXIT_SUCCESS; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mort.h b/engines/mortevielle/mort.h index 8523774da6..d313e32b78 100644 --- a/engines/mortevielle/mort.h +++ b/engines/mortevielle/mort.h @@ -32,7 +32,7 @@ namespace Mortevielle { extern void divers(int np, bool b); /* NIVEAU 0 */ -extern int mortevielle_main(int argc, const char *argv[]); +extern void mortevielle_main(); } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8346c3f9e7..6797a7e649 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -28,6 +28,7 @@ #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mort.h" +#include "mortevielle/mouse.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -37,6 +38,7 @@ MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): Engine(system), _gameDescription(gameDesc) { g_vm = this; + _lastGameFrame = 0; } MortevielleEngine::~MortevielleEngine() { @@ -113,6 +115,78 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { return Common::kNoError; } +bool MortevielleEngine::keyPressed() { + // Check for any pending key presses + handleEvents(); + + // Check if it's time to draw the next frame + if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { + _lastGameFrame = g_system->getMillis(); + + g_vm->_screenSurface.updateScreen(); + } + + // Delay briefly to keep CPU usage down + g_system->delayMillis(5); + + // Return if there are any pending key presses + return !_keypresses.empty(); +} + +int MortevielleEngine::getChar() { + // If there isn't any pending keypress, wait until there is + while (!shouldQuit() && _keypresses.empty()) { + keypressed(); + } + + // Return the top keypress + return shouldQuit() ? 0 : _keypresses.pop(); +} + +bool MortevielleEngine::handleEvents() { + Common::Event event; + if (!g_system->getEventManager()->pollEvent(event)) + return false; + + switch (event.type) { + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONUP: + case Common::EVENT_MBUTTONDOWN: + case Common::EVENT_MBUTTONUP: + case Common::EVENT_MOUSEMOVE: + x_s = event.mouse.x; + y_s = event.mouse.y; + break; + + case Common::EVENT_KEYDOWN: + addKeypress(event); + break; + default: + break; + } + + return true; +} + +/** + * Add the specified key to the event queue + */ +void MortevielleEngine::addKeypress(Common::Event &evt) { + // Check for control keypresses + if (evt.kbd.hasFlags(Common::KBD_CTRL) && (evt.kbd.keycode >= Common::KEYCODE_a) && + (evt.kbd.keycode <= Common::KEYCODE_z)) { + _keypresses.push(evt.kbd.keycode - Common::KEYCODE_a + 1); + return; + } + + // Handle function keys + if ((evt.kbd.keycode >= Common::KEYCODE_F1) && (evt.kbd.keycode <= Common::KEYCODE_F12)) { + _keypresses.push(59 + evt.kbd.keycode - Common::KEYCODE_F1); + } +} + /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { @@ -125,8 +199,7 @@ Common::Error MortevielleEngine::run() { _paletteManager.setDefaultPalette(); // Dispatch to the game's main routine - const char *argv[] = { "" }; - mortevielle_main(1, argv); + mortevielle_main(); return Common::kNoError; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 816a4360cc..c00561d54d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -23,8 +23,10 @@ #ifndef MORTEVIELLE_H #define MORTEVIELLE_H +#include "common/events.h" #include "common/file.h" #include "common/rect.h" +#include "common/stack.h" #include "engines/advancedDetector.h" #include "engines/engine.h" #include "common/error.h" @@ -42,14 +44,19 @@ enum { #define SCREEN_HEIGHT 400 #define MORT_DAT_REQUIRED_VERSION 1 #define MORT_DAT "mort.dat" +#define GAME_FRAME_DELAY (1000 / 50) class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; + Common::Stack _keypresses; + uint32 _lastGameFrame; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); void loadFont(Common::File &f); + bool handleEvents(); + void addKeypress(Common::Event &evt); public: ScreenSurface _screenSurface; PaletteManager _paletteManager; @@ -59,10 +66,15 @@ public: virtual bool hasFeature(EngineFeature f) const; virtual Common::Error run(); uint32 getGameFlags() const; + + bool keyPressed(); + int getChar(); }; extern MortevielleEngine *g_vm; +#define CHECK_QUIT if (g_vm->shouldQuit()) { return; } + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 89dde415df..50d7e0fe54 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -246,9 +246,10 @@ void ani50() { output(delig); } while (!(cy == 20)); ix = 0; - do { +/* do { ix = ix + 1; } while (!(keypressed() | (ix == 5e5))); +*/ crep = 998; textcolor(1); gotoxy(1, 21); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 5cca06f011..1b742a75e2 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -372,10 +372,10 @@ int get_random_number(int minval, int maxval) { } bool keypressed() { - return false; // Hardcoded currently for no keypress pending + return g_vm->keyPressed(); } char get_ch() { - return '\0'; // hardcoded currently for no keypress + return g_vm->getChar(); } void palette(int v1) { -- cgit v1.2.3 From 1d8ec4c3724a257c6f69210e0c02c77e8517be49 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Jan 2012 21:16:07 +1100 Subject: MORTEVIELLE: Properly handle image offsets when drawing images --- engines/mortevielle/graphics.cpp | 47 +++++++++++++++++++--------------------- engines/mortevielle/graphics.h | 4 +++- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e6035bb114..64e1256f8a 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -46,9 +46,9 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { byte *p = &egaPalette[0]; for (int i = 0; i < 64; i++) { - *p++ = (i >> 2 & 1) * 42 + (i >> 5 & 1) * 21; - *p++ = (i >> 1 & 1) * 42 + (i >> 4 & 1) * 21; - *p++ = (i & 1) * 42 + (i >> 3 & 1) * 21; + *p++ = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; + *p++ = (i >> 1 & 1) * 0xaa + (i >> 4 & 1) * 0x55; + *p++ = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; } // Loop through setting palette colours based on the passed indexes @@ -56,7 +56,7 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { int palIndex = palette[idx]; assert(palIndex < 64); - const byte *pRgb = (const byte *)&egaPalette[palIndex]; + const byte *pRgb = (const byte *)&egaPalette[palIndex * 3]; g_system->getPaletteManager()->setPalette(pRgb, idx, 1); } } @@ -65,15 +65,8 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { * Set the default EGA palette */ void PaletteManager::setDefaultPalette() { -/* int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63 }; setPalette(defaultPalette, 0, 16); -*/ - // TODO: Replace with proper palette - for (int idx = 0; idx < 16; ++idx) { - uint32 c = 0x111111 * idx; - g_system->getPaletteManager()->setPalette((const byte *)&c, idx, 1); - } } /*-------------------------------------------------------------------------* @@ -86,7 +79,7 @@ void PaletteManager::setDefaultPalette() { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } #define DEFAULT_WIDTH (SCREEN_WIDTH / 2) -#define BUFFER_SIZE 8192 +#define BUFFER_SIZE 65536 void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; @@ -99,17 +92,17 @@ void GfxSurface::decode(const byte *pSrc) { // First run through the data to calculate starting offsets const byte *p = pSrc; - _xOffset = _yOffset = 0xffff; + _offset.x = _offset.y = 999; assert(entryCount > 0); for (int idx = 0; idx < entryCount; ++idx) { _xp = READ_BE_UINT16(p + 4); - if (_xp < _xOffset) - _xOffset = _xp; + if (_xp < _offset.x) + _offset.x = _xp; _yp = READ_BE_UINT16(p + 6); - if (_yp < _yOffset) - _yOffset = _yp; + if (_yp < _offset.y) + _offset.y = _yp; // Move to next entry int size = READ_BE_UINT16(p) + READ_BE_UINT16(p + 2); @@ -134,8 +127,8 @@ void GfxSurface::decode(const byte *pSrc) { for (int entryIndex = 0; entryIndex < entryCount; ++entryIndex) { int lookupBytes = READ_BE_UINT16(pSrc); int srcSize = READ_BE_UINT16(pSrc + 2); - _xp = READ_BE_UINT16(pSrc + 4) - _xOffset; - _yp = READ_BE_UINT16(pSrc + 6) - _yOffset; + _xp = READ_BE_UINT16(pSrc + 4) - _offset.x; + _yp = READ_BE_UINT16(pSrc + 6) - _offset.y; pSrc += 8; int decomCode = READ_BE_UINT16(pSrc); @@ -169,7 +162,6 @@ void GfxSurface::decode(const byte *pSrc) { _nibbleFlag = savedNibbleFlag; _var18 = savedVar18; - assert(_var14 < 256); for (int idx = 0; idx < _var14; ++idx, ++tableOffset) { assert(tableOffset < BUFFER_SIZE); lookupTable[tableOffset] = suiv(pSrc); @@ -416,12 +408,12 @@ void GfxSurface::decode(const byte *pSrc) { } // At this point, the outputBuffer has the data for the image. Initialise the surface - // with the calculated size for the full image, and copy the lines to the surface - create(_xOffset + _width, _yOffset + _height, Graphics::PixelFormat::createFormatCLUT8()); + // with the calculated size, and copy the lines to the surface + create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); for (int yCtr = 0; yCtr < _height; ++yCtr) { const byte *copySrc = &outputBuffer[yCtr * DEFAULT_WIDTH]; - byte *copyDest = (byte *)getBasePtr(_xOffset, yCtr + _yOffset); + byte *copyDest = (byte *)getBasePtr(0, yCtr); Common::copy(copySrc, copySrc + _width, copyDest); } @@ -903,9 +895,13 @@ void ScreenSurface::updateScreen() { * also needs to be doubled for EGA mode */ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { + // Adjust the draw position by the draw offset + x += surface._offset.x; + y += surface._offset.y; + // Lock the affected area of the surface to write to - Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y, - (x + surface.w) * 2, y + surface.h * 2)); + Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2, + (x + surface.w) * 2, (y + surface.h) * 2)); // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { @@ -933,6 +929,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { ++pDest; } } + g_vm->_screenSurface.updateScreen(); } /** diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index f5c2207a12..ec6a19e949 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -50,7 +50,6 @@ private: int _thickness, _yInc, _var20, _xInc; int _var24; int _width, _height; - int _xOffset, _yOffset; void majTtxTty(); byte suiv(const byte *&pSrc); @@ -66,6 +65,9 @@ private: bool TFP(int v); void TF1(byte *&pDest, int &v); void TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v); +public: + // Specifies offset when drawing the image + Common::Point _offset; public: ~GfxSurface(); -- cgit v1.2.3 From 3d667ba670486359165ec95f61f3fc9d17e39bf0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Jan 2012 21:45:11 +1100 Subject: MORTEVIELLE: Fix decoding glitch in the first image --- engines/mortevielle/graphics.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 64e1256f8a..95988d32c1 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -499,8 +499,10 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku ++pDest; } else { // Write out vertical slice bottom to top - for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH) + for (int yIndex = 0; yIndex < _thickness; ++yIndex) { + pDest -= DEFAULT_WIDTH; *pDest = csuiv(pSrc, pLookup); + } } } @@ -529,8 +531,10 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku *pDest = csuiv(pSrc, pLookup); } else { // Write out vertical slice top to bottom - for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest -= DEFAULT_WIDTH) + for (int yIndex = 0; yIndex < _thickness; ++yIndex) { + pDest -= DEFAULT_WIDTH; *pDest = csuiv(pSrc, pLookup); + } } } -- cgit v1.2.3 From 55f5adeff3550695d6da84adce8db698ef2f1514 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Jan 2012 22:15:55 +1100 Subject: MORTEVIELLE: Give generic variables in image decoder proper names --- engines/mortevielle/graphics.cpp | 155 +++++++++++++++++++-------------------- engines/mortevielle/graphics.h | 7 +- 2 files changed, 80 insertions(+), 82 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 95988d32c1..dda2974228 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -83,11 +83,11 @@ void PaletteManager::setDefaultPalette() { void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; - _var1 = *pSrc++; + bool offsetFlag = *pSrc++ == 0; int entryCount = *pSrc++; pSrc += 2; - if (!_var1) + if (offsetFlag) pSrc += 30; // First run through the data to calculate starting offsets @@ -139,7 +139,7 @@ void GfxSurface::decode(const byte *pSrc) { pSrc += 6; pDest = &outputBuffer[0]; - _var18 = 0; + _lookupIndex = 0; _nibbleFlag = false; int decomIndex = 0; @@ -150,24 +150,24 @@ void GfxSurface::decode(const byte *pSrc) { if (decomCode & 1) { // Handle decompression of the pattern lookup table do { - _var12 = desanalyse(pSrc); - _var14 = desanalyse(pSrc); + int outerCount = desanalyse(pSrc); + int innerCount = desanalyse(pSrc); const byte *pSrcSaved = pSrc; bool savedNibbleFlag = _nibbleFlag; - int savedVar18 = _var18; + int savedLookupIndex = _lookupIndex; do { pSrc = pSrcSaved; _nibbleFlag = savedNibbleFlag; - _var18 = savedVar18; + _lookupIndex = savedLookupIndex; - for (int idx = 0; idx < _var14; ++idx, ++tableOffset) { + for (int idx = 0; idx < innerCount; ++idx, ++tableOffset) { assert(tableOffset < BUFFER_SIZE); lookupTable[tableOffset] = suiv(pSrc); } - } while (--_var12 > 0); - } while (_var18 < (lookupBytes - 1)); + } while (--outerCount > 0); + } while (_lookupIndex < (lookupBytes - 1)); } else { assert(lookupBytes < BUFFER_SIZE); @@ -183,30 +183,30 @@ void GfxSurface::decode(const byte *pSrc) { ++pSrc; tableOffset = 0; - _var18 = 0; + _lookupIndex = 0; if (decomCode & 2) { // Handle decompression of the temporary source buffer do { - _var12 = desanalyse(pSrc); - _var14 = desanalyse(pSrc); - _var18 += _var14; + int outerCount = desanalyse(pSrc); + int innerCount = desanalyse(pSrc); + _lookupIndex += innerCount; if (_nibbleFlag) { ++pSrc; - ++_var18; + ++_lookupIndex; _nibbleFlag = false; } const byte *pStart = pSrc; do { pSrc = pStart; - for (int idx = 0; idx < _var14; ++idx) { + for (int idx = 0; idx < innerCount; ++idx) { assert(tableOffset < BUFFER_SIZE); srcBuffer[tableOffset++] = *pSrc++; } - } while (--_var12 > 0); - } while (_var18 < (srcSize - 1)); + } while (--outerCount > 0); + } while (_lookupIndex < (srcSize - 1)); } else { assert(srcSize < BUFFER_SIZE); for (int idx = 0; idx < srcSize; ++idx) @@ -222,7 +222,7 @@ void GfxSurface::decode(const byte *pSrc) { pSrc = &srcBuffer[0]; pLookup = &lookupTable[0] - 1; - _lookupValue = _var18 = 0; + _lookupValue = _lookupIndex = 0; _nibbleFlag = false; decomIndex = decomCode >> 8; } @@ -339,8 +339,8 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; _thickness = _xInc = 1; _yInc = DEFAULT_WIDTH; - _var20 = _ySize; - _var24 = _xSize; + _yEnd = _ySize; + _xEnd = _xSize; diag(pSrc, pDest, pLookup); break; @@ -348,17 +348,17 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; _thickness = _xSize; _yInc = 1; - _var20 = _xSize; + _yEnd = _xSize; _xInc = DEFAULT_WIDTH; - _var24 = _ySize; + _xEnd = _ySize; diag(pSrc, pDest, pLookup); break; case 14: _thickness = _yInc = 1; - _var20 = _xSize; + _yEnd = _xSize; _xInc = DEFAULT_WIDTH; - _var24 = _ySize; + _xEnd = _ySize; diag(pSrc, pDest, pLookup); break; @@ -366,18 +366,18 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; _thickness = 2; _yInc = DEFAULT_WIDTH; - _var20 = _ySize; + _yEnd = _ySize; _xInc = 1; - _var24 = _xSize; + _xEnd = _xSize; diag(pSrc, pDest, pLookup); break; case 16: _thickness = 3; _yInc = 1; - _var20 = _xSize; + _yEnd = _xSize; _xInc = DEFAULT_WIDTH; - _var24 = _ySize; + _xEnd = _ySize; diag(pSrc, pDest, pLookup); break; @@ -385,9 +385,9 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; _thickness = 3; _yInc = DEFAULT_WIDTH; - _var20 = _ySize; + _yEnd = _ySize; _xInc = 1; - _var24 = _xSize; + _xEnd = _xSize; diag(pSrc, pDest, pLookup); break; @@ -395,9 +395,9 @@ void GfxSurface::decode(const byte *pSrc) { INCR_TAIX; _thickness = 5; _yInc = DEFAULT_WIDTH; - _var20 = _ySize; + _yEnd = _ySize; _xInc = 1; - _var24 = _xSize; + _xEnd = _xSize; diag(pSrc, pDest, pLookup); break; } @@ -431,7 +431,7 @@ byte GfxSurface::suiv(const byte *&pSrc) { int v = *pSrc; if (_nibbleFlag) { ++pSrc; - ++_var18; + ++_lookupIndex; _nibbleFlag = false; return v & 0xf; } else { @@ -564,12 +564,11 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku } void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { -// byte *pDestEnd = pDest + (_ySize - 1) * DEFAULT_WIDTH + _xSize; - int var28 = 0; + int drawIndex = 0; for (;;) { // Reduce thickness as necessary - while ((var28 + _thickness) > _xSize) { + while ((drawIndex + _thickness) > _xSize) { if (--_thickness == 0) return; } @@ -580,22 +579,22 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) if (yCtr > 0) pDest += DEFAULT_WIDTH; - var28 += _thickness; + drawIndex += _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) *pDest++ = csuiv(pSrc, pLookup); } else { pDest += DEFAULT_WIDTH; - var28 -= _thickness; + drawIndex -= _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) *--pDest = csuiv(pSrc, pLookup); } } if ((_ySize % 2) == 0) { pDest += _thickness; - var28 += _thickness; + drawIndex += _thickness; } - while (_xSize < (var28 + _thickness)) { + while (_xSize < (drawIndex + _thickness)) { if (--_thickness == 0) return; } @@ -606,13 +605,13 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) if (yCtr > 0) pDest -= DEFAULT_WIDTH; - var28 += _thickness; + drawIndex += _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) *pDest++ = csuiv(pSrc, pLookup); } else { pDest -= DEFAULT_WIDTH; - var28 -= _thickness; + drawIndex -= _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) *--pDest = csuiv(pSrc, pLookup); @@ -620,13 +619,13 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) } if ((_ySize % 2) == 0) { pDest += _thickness; - var28 += _thickness; + drawIndex += _thickness; } } } void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { - int var26 = 0, var28 = 0; + int yPos = 0, drawIndex = 0; _yInc = DEFAULT_WIDTH; _xInc = -1; --_xSize; @@ -643,32 +642,32 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) case 1: increments(pDest); - if (!var28) { + if (!drawIndex) { NIH(); NIV(); - if (var26 == _ySize) { + if (yPos == _ySize) { increments(pDest); - ++var28; + ++drawIndex; } else { - ++var26; + ++yPos; } *++pDest = csuiv(pSrc, pLookup); areaNum = 2; - } else if (var26 != _ySize) { - ++var26; - --var28; + } else if (yPos != _ySize) { + ++yPos; + --drawIndex; areaNum = 0; } else { NIH(); NIV(); increments(pDest); - ++var28; + ++drawIndex; *++pDest = csuiv(pSrc, pLookup); - if (var28 == _xSize) { + if (drawIndex == _xSize) { areaNum = -1; } else { areaNum = 2; @@ -679,35 +678,35 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) case 2: increments(pDest); - if (!var26) { + if (!yPos) { NIH(); NIV(); - if (var28 == _xSize) { + if (drawIndex == _xSize) { increments(pDest); - ++var26; + ++yPos; } else { - ++var28; + ++drawIndex; } pDest += DEFAULT_WIDTH; areaNum = 0; - } else if (var28 != _xSize) { - ++var28; - --var26; + } else if (drawIndex != _xSize) { + ++drawIndex; + --yPos; *pDest = csuiv(pSrc, pLookup); areaNum = 2; } else { pDest += DEFAULT_WIDTH; - ++var26; + ++yPos; NIH(); NIV(); increments(pDest); *pDest = csuiv(pSrc, pLookup); - if (var26 == _ySize) + if (yPos == _ySize) areaNum = -1; else areaNum = 1; @@ -718,10 +717,10 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) } void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { - int var26 = 0, var28 = 0; - --_var24; + int diagIndex = 0, drawIndex = 0; + --_xEnd; - while (!TFP(var26)) { + while (!TFP(diagIndex)) { for (;;) { NIH(); for (int idx = 0; idx <= _thickness; ++idx) { @@ -743,21 +742,21 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { NIV(); increments(pDest); - ++var28; - if (_var24 < (var28 + 1)) { - TF1(pDest, var26); + ++drawIndex; + if (_xEnd < (drawIndex + 1)) { + TF1(pDest, diagIndex); break; } pDest += _xInc; - ++var28; - if (_var24 < (var28 + 1)) { - TF2(pSrc, pDest, pLookup, var26); + ++drawIndex; + if (_xEnd < (drawIndex + 1)) { + TF2(pSrc, pDest, pLookup, diagIndex); break; } } - if (TFP(var26)) + if (TFP(diagIndex)) break; for (;;) { @@ -780,15 +779,15 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { NIV(); increments(pDest); - if (--var28 == 0) { - TF1(pDest, var26); + if (--drawIndex == 0) { + TF1(pDest, diagIndex); NIH(); break; } else { pDest += _xInc; - if (--var28 == 0) { - TF2(pSrc, pDest, pLookup, var26); + if (--drawIndex == 0) { + TF2(pSrc, pDest, pLookup, diagIndex); NIH(); break; } @@ -813,7 +812,7 @@ void GfxSurface::NIV() { } bool GfxSurface::TFP(int v) { - int diff = _var20 - v; + int diff = _yEnd - v; if (!diff) // Time to finish loop in outer method return true; diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index ec6a19e949..f3d09858bd 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -42,13 +42,12 @@ public: class GfxSurface: public Graphics::Surface { private: - int _var1; int _xp, _yp; int _xSize, _ySize, _var12; - int _var14, _var18, _lookupValue; + int _var14, _lookupIndex, _lookupValue; bool _nibbleFlag; - int _thickness, _yInc, _var20, _xInc; - int _var24; + int _thickness; + int _yInc, _yEnd, _xInc, _xEnd; int _width, _height; void majTtxTty(); -- cgit v1.2.3 From 45083e7c94508d09e8e96e8e90c452218e2a07bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 Jan 2012 23:09:31 +1100 Subject: MORTEVIELLE: Added needed palette remapping to drawPicture() The remapping allows the first image to now display using the correct colours. --- engines/mortevielle/graphics.cpp | 25 +++++++++++-------------- engines/mortevielle/level15.cpp | 1 - engines/mortevielle/var_mor.cpp | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index dda2974228..44bd58dfb5 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -892,8 +892,8 @@ void ScreenSurface::updateScreen() { * Draws a decoded picture on the screen * @remarks - Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled. - * - Image resources are stored at 320x200, so when drawn onto the screen every - * other column is interpolated. + * - Image resources are stored at 320x200, so when drawn onto the screen a single pixel + * from the source image is drawn using the two pixels at the given index in the palette map * - Because the original game supported 320 width resolutions, the X coordinate * also needs to be doubled for EGA mode */ @@ -906,6 +906,9 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2, (x + surface.w) * 2, (y + surface.h) * 2)); + // Get a lookup for the palette mapping + const byte *paletteMap = &mem[0x7000 * 16 + 2]; + // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { if (((y + yp) < 0) || ((y + yp) >= 200)) @@ -915,20 +918,14 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2); for (int xp = 0; xp < surface.w; ++xp, ++pSrc) { - // Draw pixel from source image - *pDest = *pSrc; - *(pDest + SCREEN_WIDTH) = *pSrc; + // Draw the pixel using the specified index in the palette map + *pDest = paletteMap[*pSrc * 2]; + *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2]; ++pDest; - // TODO: I'm not sure what algorithm the original uses to calculate - // which pixel to use on the alternate columns, so for now I'm doing - // a simple output of null values. This should be revisited once we've - // got the palette loading so we can compare palettes. In fact, the - // original had the alternate columns very noticablely striped. With - // the larger 256 colour palette, it may be worthwhile to offer a - // better blended graphics mode as an option. - *pDest = 0; - *(pDest + SCREEN_WIDTH) = 0; + // Use the secondary mapping value to draw the secondary column pixel + *pDest = paletteMap[*pSrc * 2 + 1]; + *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1]; ++pDest; } } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 8b8dbcf02f..42e4393527 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -103,7 +103,6 @@ void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&mem[seg * 16 + dep]); - decomp(seg, dep); if (gd == her) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 1b742a75e2..0b004a163a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -399,7 +399,7 @@ void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { // (* external 'c:\mc\decomp.com'; *) void decomp(int seg, int dep) { - warning("TODO: decomp"); + warning("TODO: decomp deprecated in faovur of GfxSurface::decode"); } // (* external 'c:\mc\affich.com'; *) -- cgit v1.2.3 From 78a653b24583506c1229b080000643e70685b065 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Jan 2012 08:51:18 +1100 Subject: MORTEVIELLE: Implement ScreenSurface::fillBox method --- engines/mortevielle/graphics.cpp | 16 ++++++++++++++++ engines/mortevielle/graphics.h | 2 ++ engines/mortevielle/var_mor.cpp | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 44bd58dfb5..0c2872f226 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -982,6 +982,22 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { destSurface.vLine(dx - 2, 2, destSurface.h - 3, col); } +/** + * Fills an area with the specified colour + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled + */ +void ScreenSurface::fillBox(int colour, const Common::Rect &bounds, int patt) { + Graphics::Surface destSurface = lockArea(Common::Rect(bounds.left, bounds.top * 2, + bounds.right, bounds.bottom * 2)); + + // Fill the area + destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), 0); + + // TODO: Figure out what effect patterns of other than '0xff' have + if (patt != 0xff) + warning("TODO: Figure out operation of ScreenSurface::box when pattern is %xh", patt); +} /** * Sets a single pixel at the specified co-ordinates diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index f3d09858bd..4f3956bdcf 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -84,6 +84,8 @@ public: void drawPicture(GfxSurface &surface, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); + void fillBox(int colour, const Common::Rect &bounds, int patt); + // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); }; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0b004a163a..2b20173174 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -394,7 +394,8 @@ void s_sauv(int Gd, int y, int dy) { // (* external 'c:\mc\boite.com'; *) void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { - warning("TODO: box method not yet implemented"); + warning("TODO: box deprecated in favour of GfxSurface::fillBox"); + g_vm->_screenSurface.fillBox(c, Common::Rect(xo, yo, xi, yi), patt); } // (* external 'c:\mc\decomp.com'; *) -- cgit v1.2.3 From c2ce0cff4446435a013627e42d7ef16b16d6e81b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Jan 2012 22:07:56 +1100 Subject: MORTEVIELLE: Fix the calculation in the animof method --- engines/mortevielle/level15.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 42e4393527..9243426c33 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -190,6 +190,9 @@ void adzon() { f.close(); } +/** + * Returns the offset within the compressed image data resource of the desired image + */ int animof(int ouf, int num) { int nani, aux; @@ -197,11 +200,8 @@ int animof(int ouf, int num) { nani = mem[adani * 16 + 1]; aux = num; if (ouf != 1) aux = aux + nani; - animof_result = (nani << 2) + 2 + swap(READ_LE_UINT16(&mem[adani * 16 + (aux << 1)])); - /*aux:= nani shl 2 + 2; - if ouf=1 then aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: num shl 1]) - else aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: (nani+num) shl 1]); - animof:=aux;*/ + animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); + return animof_result; } -- cgit v1.2.3 From 32a16af052580cdb64c751f7330eb77f26ef35d7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Jan 2012 22:10:06 +1100 Subject: MORTEVIELLE: Started some notes of the original memory map --- engines/mortevielle/var_mor.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 16ab044569..a96329f477 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -42,6 +42,21 @@ namespace Mortevielle { musique & paroles Oct 88 ) */ +/*---------------------------------------------------------------------------*/ +/*------------------- MEMORY MAP ------------------------*/ +/*---------------------------------------------------------------------------*/ +/* The following is a list of physical addresses in memory currently used + * by the game. + * + * Address + * ------- + * 6000:0 - Decompressed current image + * 7000:0+ - Compressed images + * 7000:2 - 16 words representing palette map + * 7000:4138 - width, height, x/y offset of decoded image + */ + + /*---------------------------------------------------------------------------*/ /*------------------------- DEFINES ----------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -411,7 +426,7 @@ extern byte mem[65536 * 16]; #define mortevielle_exit(ret) error("Exit the game") // Text screen functions not relevant for ScummVM -#define clrscr {} +#define clrscr { warning("ClrScr"); } #define clreol {} #define graphcolormode {} extern void gotoxy(int x, int y); -- cgit v1.2.3 From 1bc0028ab970ee837d4adfe72d47f8e2d13bf37a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Jan 2012 22:40:35 +1100 Subject: MORTEVIELLE: Fix another graphic glitch in the image decoder --- engines/mortevielle/graphics.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 0c2872f226..44b5921560 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -264,7 +264,6 @@ void GfxSurface::decode(const byte *pSrc) { case 2: // Draw rect alternating top to bottom, bottom to top - INCR_TAIX; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { if ((xCtr % 2) == 0) { for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { @@ -929,7 +928,6 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { ++pDest; } } - g_vm->_screenSurface.updateScreen(); } /** -- cgit v1.2.3 From 18e1193d700e13f262b8d05090140e557bb3ad21 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 09:47:40 +1100 Subject: MORTEVIELLE: Fix seeking in chardes and charani --- engines/mortevielle/taffich.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 78eccbbaf1..77733b8829 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -51,7 +51,7 @@ void chardes(Common::String nom, float passe, int long_) { passe = passe - 128; } if (p != 0) - f.seek(p); + f.seek(p * 0x80); p = abs((int)passe); l = long_ + p; i = 0; @@ -84,7 +84,7 @@ void charani(Common::String nom, float passe, int long_) { p = p + 1; } if (p != 0) - f.seek(p); + f.seek(p * 0x80); p = abs((int)passe); l = long_ + p; -- cgit v1.2.3 From 1244e3c7ad1eccdbf8ac5e3bfb46f4fa98d0be4b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 09:50:08 +1100 Subject: MORTEVIELLE: Reduce the decoding lookup buffer sizes --- engines/mortevielle/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 44b5921560..89fd123617 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -79,7 +79,7 @@ void PaletteManager::setDefaultPalette() { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } #define DEFAULT_WIDTH (SCREEN_WIDTH / 2) -#define BUFFER_SIZE 65536 +#define BUFFER_SIZE 8192 void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; -- cgit v1.2.3 From 64c0600c3c78c2c4b6d7855386bf4e000478cd5d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 10:06:50 +1100 Subject: MORTEVIELLE: Add ScreenSurface::clearScreen method --- engines/mortevielle/graphics.cpp | 8 +++++ engines/mortevielle/graphics.h | 1 + engines/mortevielle/var_mor.cpp | 71 ++++------------------------------------ 3 files changed, 15 insertions(+), 65 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 89fd123617..0bc3b77804 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -997,6 +997,14 @@ void ScreenSurface::fillBox(int colour, const Common::Rect &bounds, int patt) { warning("TODO: Figure out operation of ScreenSurface::box when pattern is %xh", patt); } +/** + * Clears the screen + */ +void ScreenSurface::clearScreen() { + Graphics::Surface destSurface = lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + destSurface.fillRect(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); +} + /** * Sets a single pixel at the specified co-ordinates * @remarks Because the ScummVM surface is using a double height 640x400 surface to diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 4f3956bdcf..376b9e5e85 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -85,6 +85,7 @@ public: void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); void fillBox(int colour, const Common::Rect &bounds, int patt); + void clearScreen(); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 2b20173174..301d0893a7 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -240,71 +240,12 @@ byte adcfiec[(4088 * 16) + (311 * 0x80)]; /*---------------------------------------------------------------------------*/ void hirs() { - /* Deprecated set graphics - - const byte tandy[14] = {113, 80, 90, 14, 63, 6, 50, 56, 2, 3, 6, 7, 0, 0}; - const byte herc[13] = {50, 40, 41, 9, 103, 3, 100, 100, 2, 3, 0, 0, 0}; - int i; - - switch (gd) { - case cga : { - graphcolormode; - graphbackground(0); - palette(1); - res = 1; - } - break; - case ams : { - hires; - //inline_((float)(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_((float)(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_((float)(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; - } - */ + // Note: The original used this to set the graphics mode and clear the screen, both at + // the start of the game, and whenever the screen need to be cleared. As such, this + // method is deprecated in favour of clearing the screen + warning("TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); + + g_vm->_screenSurface.clearScreen(); } /** -- cgit v1.2.3 From 0790b3f24a334c7a3b0fdbf631b786fe973f2d60 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 10:53:54 +1100 Subject: MORTEVIELLE: Fix savegame loading to allow to read from the data folder This is needed so that the initial game state can be correctly read from slot 0. --- engines/mortevielle/disk.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 8a889f2130..41868d42fa 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -87,19 +87,28 @@ void takesav(int n) { dem1(); // -- Load the file 'sauve#n.mor' Common::String saveName = Common::String::format("sav%d.mor", n); - Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(saveName); - Common::Serializer sz(f, NULL); - sync_save(sz); + // Try loading first from the save area + Common::SeekableReadStream *stream = g_system->getSavefileManager()->openForLoading(saveName); + + // If not present, try loading from the program folder + Common::File f; + if (stream == NULL) { + if (!f.open(saveName)) + error("Unable to open save file '%s'", saveName); - if (f->err()) { - i = do_alert(err_mess, 1); - mortevielle_exit(0); + stream = f.readStream(f.size()); + f.close(); } + + Common::Serializer sz(stream, NULL); + sync_save(sz); + s = s1; for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; - delete f; + // Close the stream + delete stream; } void ld_game(int n) { -- cgit v1.2.3 From 8f32aa48aae89e6ebd0d14a8beea380fb32d5f78 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 11:04:22 +1100 Subject: MORTEVIELLE: Fix loading of data in charge_bruit5() --- engines/mortevielle/ovd1.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 50d7e0fe54..d6713908dc 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -354,9 +354,7 @@ void ani50() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&mem[adbruit5 * 16 + 0], 149); - /*blockread(f,mem[$5CB0:0],100); - blockread(f,mem[$3D1F:0],49);*/ + f.read(&mem[adbruit5 * 16 + 0], 149 * 128); f.close(); } -- cgit v1.2.3 From 1c1f58ec5d3fc75eb420bbfbbd405b1e56092137 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 12:04:13 +1100 Subject: MORTEVIELLE: Fixed data reading in adzon() --- engines/mortevielle/level15.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 9243426c33..b0ed953aa4 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -158,35 +158,20 @@ end; void adzon() { Common::File f; -// Common::File g; -// byte a; -// int i; if (!f.open("don.mor")) error("Missing file - don.mor"); - f.read(tabdon, 7); + f.read(tabdon, 7 * 256); f.close(); if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); - f.read(&tabdon[fleche], 1); - /*i:=fleche; - repeat - read(g,a); - tabdon[i]:=a; - i:=succ(i); - until i=fleche + 1916;*/ + f.read(&tabdon[fleche], 1 * 1916); f.close(); if (!f.open("dec.mor")) - error("Missing files - dec.moir"); - f.read(&mem[0x73a2 * 16 + 0], 1); - /*i:=0; - repeat - read(g,a); - mem[$73A2:i]:=a; - i:=succ(i); - until eof(g);*/ + error("Missing file - dec.mor"); + f.read(&mem[0x73a2 * 16 + 0], 1 * 1664); f.close(); } -- cgit v1.2.3 From e3308ce3b54732197049461183194f2532c4c5bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 12:21:41 +1100 Subject: MORTEVIELLE: Correct ScreenSurface::fillBox to use the passed colour --- engines/mortevielle/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 0bc3b77804..f751bc2422 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -990,7 +990,7 @@ void ScreenSurface::fillBox(int colour, const Common::Rect &bounds, int patt) { bounds.right, bounds.bottom * 2)); // Fill the area - destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), 0); + destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), colour); // TODO: Figure out what effect patterns of other than '0xff' have if (patt != 0xff) -- cgit v1.2.3 From 5ecb0d4eea46fa89b89152d33c9c95ee87be60c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 15:10:40 +1100 Subject: MORTEVIELLE: Changed deprecated warnings to use debugC instead --- engines/mortevielle/boite.cpp | 2 +- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/var_mor.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index e2b8200adc..7072085c23 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -33,7 +33,7 @@ namespace Mortevielle { //Translation: box() void boite(int x, int y, int dx, int dy, int coul) { - warning("TODO: boite is deprecated in favour of ScreenSurface::drawBox"); + debugC(1, kMortevielleCore, "TODO: boite is deprecated in favour of ScreenSurface::drawBox"); g_vm->_screenSurface.drawBox(x, y, dx, dy, coul); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index f751bc2422..27595992c7 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -402,7 +402,7 @@ void GfxSurface::decode(const byte *pSrc) { } pSrc = pSrcStart; - debugC(1, kMortevielleGraphics, "Decoding image block %d position %d,%d size %d,%d method %d", + debugC(2, kMortevielleGraphics, "Decoding image block %d position %d,%d size %d,%d method %d", entryIndex + 1, _xp, _yp, _width, _height, decomIndex); } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 301d0893a7..9de3d94137 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -243,7 +243,7 @@ void hirs() { // Note: The original used this to set the graphics mode and clear the screen, both at // the start of the game, and whenever the screen need to be cleared. As such, this // method is deprecated in favour of clearing the screen - warning("TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); + debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); g_vm->_screenSurface.clearScreen(); } @@ -335,13 +335,13 @@ void s_sauv(int Gd, int y, int dy) { // (* external 'c:\mc\boite.com'; *) void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { - warning("TODO: box deprecated in favour of GfxSurface::fillBox"); + debugC(1, kMortevielleCore, "TODO: box deprecated in favour of GfxSurface::fillBox"); g_vm->_screenSurface.fillBox(c, Common::Rect(xo, yo, xi, yi), patt); } // (* external 'c:\mc\decomp.com'; *) void decomp(int seg, int dep) { - warning("TODO: decomp deprecated in faovur of GfxSurface::decode"); + debugC(1, kMortevielleCore, "TODO: decomp deprecated in faovur of GfxSurface::decode"); } // (* external 'c:\mc\affich.com'; *) -- cgit v1.2.3 From 3caa20a61879e683b834521be0110941ae9dce47 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 16:31:15 +1100 Subject: MORTEVIELLE: Set up default mouse cursor --- engines/mortevielle/mortevielle.cpp | 43 +++++++++++++++++++++++++++++++++---- engines/mortevielle/mortevielle.h | 1 + 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6797a7e649..97d36e9a34 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -24,6 +24,7 @@ #include "common/debug-channels.h" #include "engines/util.h" #include "engines/engine.h" +#include "graphics/cursorman.h" #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" @@ -64,7 +65,17 @@ Common::ErrorCode MortevielleEngine::initialise() { res = 2; // Load the mort.dat resource - return loadMortDat(); + Common::ErrorCode result = loadMortDat(); + if (result != Common::kNoError) + return result; + + // Set default EGA palette + _paletteManager.setDefaultPalette(); + + // Setup the mouse cursor + initMouse(); + + return Common::kNoError; } /** @@ -187,6 +198,33 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { } } +static byte CURSOR_ARROW_DATA[16 * 16] = { + 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +/** + * Initialise the mouse + */ +void MortevielleEngine::initMouse() { + CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); + CursorMan.showMouse(true); +} + /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { @@ -195,9 +233,6 @@ Common::Error MortevielleEngine::run() { if (err != Common::kNoError) return err; - // Set default palette - _paletteManager.setDefaultPalette(); - // Dispatch to the game's main routine mortevielle_main(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c00561d54d..2ea48c63b8 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -57,6 +57,7 @@ private: void loadFont(Common::File &f); bool handleEvents(); void addKeypress(Common::Event &evt); + void initMouse(); public: ScreenSurface _screenSurface; PaletteManager _paletteManager; -- cgit v1.2.3 From 5c628fedd2a21d4aee5f984dd1a1a4bcfc63024e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 17:12:14 +1100 Subject: MORTEVIELLE: Expand on the mouse/keyboard handling code --- engines/mortevielle/mortevielle.cpp | 74 +++++++++++++++++++++++++++++++------ engines/mortevielle/mortevielle.h | 5 +++ engines/mortevielle/mouse.cpp | 62 ++++++------------------------- 3 files changed, 79 insertions(+), 62 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 97d36e9a34..0e6db5447f 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -40,6 +40,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g Engine(system), _gameDescription(gameDesc) { g_vm = this; _lastGameFrame = 0; + _mouseButtons = 0; } MortevielleEngine::~MortevielleEngine() { @@ -164,11 +165,19 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONDOWN: case Common::EVENT_RBUTTONUP: - case Common::EVENT_MBUTTONDOWN: - case Common::EVENT_MBUTTONUP: case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; x_s = event.mouse.x; y_s = event.mouse.y; + + if (event.type == Common::EVENT_LBUTTONDOWN) + _mouseButtons |= 1; + else if (event.type == Common::EVENT_LBUTTONUP) + _mouseButtons &= ~1; + else if (event.type == Common::EVENT_RBUTTONDOWN) + _mouseButtons |= 2; + else if (event.type == Common::EVENT_RBUTTONUP) + _mouseButtons &= ~2; break; case Common::EVENT_KEYDOWN: @@ -182,20 +191,57 @@ bool MortevielleEngine::handleEvents() { } /** - * Add the specified key to the event queue + * Add the specified key to the pending keypress stack */ void MortevielleEngine::addKeypress(Common::Event &evt) { - // Check for control keypresses - if (evt.kbd.hasFlags(Common::KBD_CTRL) && (evt.kbd.keycode >= Common::KEYCODE_a) && - (evt.kbd.keycode <= Common::KEYCODE_z)) { - _keypresses.push(evt.kbd.keycode - Common::KEYCODE_a + 1); - return; + // Character to add + char ch = evt.kbd.ascii; + + // Handle alphabetic keys + if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { + if (evt.kbd.hasFlags(Common::KBD_CTRL)) + ch = evt.kbd.keycode - Common::KEYCODE_a + 1; + else + ch = evt.kbd.keycode - Common::KEYCODE_a + 'A'; + } else if ((evt.kbd.keycode >= Common::KEYCODE_F1) && (evt.kbd.keycode <= Common::KEYCODE_F12)) { + // Handle function keys + ch = 59 + evt.kbd.keycode - Common::KEYCODE_F1; + } else { + // Series of special cases + switch (evt.kbd.keycode) { + case Common::KEYCODE_KP4: + case Common::KEYCODE_LEFT: + ch = '4'; + case Common::KEYCODE_KP2: + case Common::KEYCODE_DOWN: + ch = '2'; + case Common::KEYCODE_KP6: + case Common::KEYCODE_RIGHT: + ch = '6'; + case Common::KEYCODE_KP8: + case Common::KEYCODE_UP: + ch = '8'; + case Common::KEYCODE_KP7: + ch = '7'; + case Common::KEYCODE_KP1: + ch = '1'; + case Common::KEYCODE_KP9: + ch = '9'; + case Common::KEYCODE_KP3: + ch = '3'; + case Common::KEYCODE_KP5: + ch = '5'; + case Common::KEYCODE_RETURN: + ch = '\13'; + case Common::KEYCODE_ESCAPE: + ch = '\33'; + default: + break; + } } - // Handle function keys - if ((evt.kbd.keycode >= Common::KEYCODE_F1) && (evt.kbd.keycode <= Common::KEYCODE_F12)) { - _keypresses.push(59 + evt.kbd.keycode - Common::KEYCODE_F1); - } + if (ch != 0) + _keypresses.push(ch); } static byte CURSOR_ARROW_DATA[16 * 16] = { @@ -225,6 +271,10 @@ void MortevielleEngine::initMouse() { CursorMan.showMouse(true); } +void MortevielleEngine::setMousePos(const Common::Point &pt) { + _mousePos = pt; +} + /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 2ea48c63b8..3010ae8664 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -51,6 +51,8 @@ private: const ADGameDescription *_gameDescription; Common::Stack _keypresses; uint32 _lastGameFrame; + int _mouseButtons; + Common::Point _mousePos; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); @@ -70,6 +72,9 @@ public: bool keyPressed(); int getChar(); + Common::Point getMousePos() const { return _mousePos; } + void setMousePos(const Common::Point &pt); + int getMouseButtons() const { return _mouseButtons; } }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 2fc6e1033b..2ea8434a1c 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -28,6 +28,7 @@ #include "common/endian.h" #include "common/rect.h" #include "mortevielle/mouse.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -271,67 +272,28 @@ void pos_mouse(int x, int y) { 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 = ((uint)y_s >> 1) * 80 + ((uint)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 + ((uint)x_s >> 3); - } - break; - } /* case Gd */ - show_mouse(); + + // Set the new position + g_vm->setMousePos(Common::Point(x, y)); } void read_pos_mouse(int &x, int &y, int &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; - } + x = g_vm->getMousePos().x; + y = g_vm->getMousePos().y; + c = g_vm->getMouseButtons(); } void mov_mouse(bool &funct, char &key) { bool p_key; char in1, in2; int 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; - } + // If mouse button clicked, return it + if (g_vm->getMouseButtons() != 0) { + clic = true; + return; } + funct = false; key = '\377'; p_key = keypressed(); -- cgit v1.2.3 From 412124baa66628c1d2b6804db0ce748b45e5a4cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 17:18:38 +1100 Subject: MORTEVIELLE: Fix compiler warnings and added assert --- engines/mortevielle/graphics.cpp | 1 + engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/mouse.cpp | 4 +--- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 27595992c7..ee9c63228b 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1011,6 +1011,7 @@ void ScreenSurface::clearScreen() { * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { + assert((pt.x >= 0) && (pt.y >= 0) && (pt.x <= SCREEN_WIDTH) && (pt.y <= SCREEN_ORIG_HEIGHT)); Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); byte *destP = (byte *)destSurface.pixels; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 3010ae8664..0555f302ab 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -42,6 +42,7 @@ enum { #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 +#define SCREEN_ORIG_HEIGHT 200 #define MORT_DAT_REQUIRED_VERSION 1 #define MORT_DAT "mort.dat" #define GAME_FRAME_DELAY (1000 / 50) diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 2ea8434a1c..04b6c116e0 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -265,8 +265,6 @@ void show_mouse() { } void pos_mouse(int x, int y) { - registres reg; - if (x > 314 * res) x = 314 * res; else if (x < 0) x = 0; if (y > 199) y = 199; @@ -286,7 +284,7 @@ void read_pos_mouse(int &x, int &y, int &c) { void mov_mouse(bool &funct, char &key) { bool p_key; char in1, in2; - int x, y, cx, cy, cd; + int cx, cy, cd; // If mouse button clicked, return it if (g_vm->getMouseButtons() != 0) { -- cgit v1.2.3 From 7d6b859df58f5ac9cf126e50ff5b0c25cd57850a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 17:22:54 +1100 Subject: MORTEVIELLE: Added explicit quit checks to the main game loops --- engines/mortevielle/mort.cpp | 1 + engines/mortevielle/mouse.cpp | 3 +++ engines/mortevielle/prog.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp index fc592f98fe..766ae3c429 100644 --- a/engines/mortevielle/mort.cpp +++ b/engines/mortevielle/mort.cpp @@ -142,6 +142,7 @@ void mortevielle_main() { show_mouse(); do { tjouer(); + CHECK_QUIT; } while (!arret); } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 04b6c116e0..e79086ed2c 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -295,7 +295,10 @@ void mov_mouse(bool &funct, char &key) { funct = false; key = '\377'; p_key = keypressed(); + while (p_key) { + CHECK_QUIT; + in1 = get_ch(); // input >> kbd >> in1; read_pos_mouse(cx, cy, cd); switch (toupper(in1)) { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 236e785199..41615219d4 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -30,6 +30,7 @@ #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/prog.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -265,6 +266,7 @@ void tecran() { mdn(); tinke(); mov_mouse(funct, inkey); + CHECK_QUIT; temps = temps + 1; } while (!((choisi) || (temps > lim) || (funct) || (anyone))); @@ -348,6 +350,7 @@ void tjouer() { antegame(); do { tecran(); + CHECK_QUIT; } while (!((arret) || (solu) || (perdu))); if (solu) tmaj1(); else if (perdu) tencore(); -- cgit v1.2.3 From 6c97ac2e4326a1dfb4564a4daa5ba8aa6c7b14fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 17:41:50 +1100 Subject: MORTEVIELLE: Correctly handle keyboard keys for moving mouse --- engines/mortevielle/mortevielle.cpp | 35 ++++++++++++++++++++++++++++++++--- engines/mortevielle/mouse.cpp | 14 ++++++++------ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 0e6db5447f..f3ad46894d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -155,6 +155,11 @@ int MortevielleEngine::getChar() { return shouldQuit() ? 0 : _keypresses.pop(); } +/** + * Handle pending events + * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, + * the mouse Y position is divided by 2 to keep the game thinking the Y goes from 0 - 199 + */ bool MortevielleEngine::handleEvents() { Common::Event event; if (!g_system->getEventManager()->pollEvent(event)) @@ -166,9 +171,9 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_RBUTTONDOWN: case Common::EVENT_RBUTTONUP: case Common::EVENT_MOUSEMOVE: - _mousePos = event.mouse; + _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); x_s = event.mouse.x; - y_s = event.mouse.y; + y_s = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseButtons |= 1; @@ -212,29 +217,40 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { case Common::KEYCODE_KP4: case Common::KEYCODE_LEFT: ch = '4'; + break; case Common::KEYCODE_KP2: case Common::KEYCODE_DOWN: ch = '2'; + break; case Common::KEYCODE_KP6: case Common::KEYCODE_RIGHT: ch = '6'; + break; case Common::KEYCODE_KP8: case Common::KEYCODE_UP: ch = '8'; + break; case Common::KEYCODE_KP7: ch = '7'; + break; case Common::KEYCODE_KP1: ch = '1'; + break; case Common::KEYCODE_KP9: ch = '9'; + break; case Common::KEYCODE_KP3: ch = '3'; + break; case Common::KEYCODE_KP5: ch = '5'; + break; case Common::KEYCODE_RETURN: ch = '\13'; + break; case Common::KEYCODE_ESCAPE: ch = '\33'; + break; default: break; } @@ -271,8 +287,21 @@ void MortevielleEngine::initMouse() { CursorMan.showMouse(true); } +/** + * Sets the mouse position + * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, + * the mouse Y position is doubled to convert from 0-199 to 0-399 + */ void MortevielleEngine::setMousePos(const Common::Point &pt) { - _mousePos = pt; + // Adjust the passed position from simulated 640x200 to 640x400 co-ordinates + Common::Point newPoint(pt.x, (pt.y == 199) ? 399 : pt.y * 2); + + if (newPoint != _mousePos) + // Warp the mouse to the new position + g_system->warpMouse(newPoint.x, newPoint.y); + + // Save the new position + _mousePos = newPoint; } /*-------------------------------------------------------------------------*/ diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e79086ed2c..2e945287ba 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -286,20 +286,22 @@ void mov_mouse(bool &funct, char &key) { char in1, in2; int cx, cy, cd; + // Set defaults and check pending events + funct = false; + key = '\377'; + p_key = keypressed(); + // If mouse button clicked, return it if (g_vm->getMouseButtons() != 0) { clic = true; return; } - funct = false; - key = '\377'; - p_key = keypressed(); - + // Handle any pending keypresses while (p_key) { CHECK_QUIT; - in1 = get_ch(); // input >> kbd >> in1; + in1 = get_ch(); read_pos_mouse(cx, cy, cd); switch (toupper(in1)) { case '4' : @@ -349,7 +351,7 @@ void mov_mouse(bool &funct, char &key) { p_key = keypressed(); if (p_key) { - in2 = get_ch(); // input >> kbd >> in2; + in2 = get_ch(); if ((in2 >= ';') && (in2 <= 'D')) { funct = true; -- cgit v1.2.3 From e9b10db262f76b1b8486bd96d7a3010cb08e3b45 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 19:11:07 +1100 Subject: MORTEVIELLE: Fix display of action tabs --- engines/mortevielle/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 2a055767f2..8c6561e097 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -160,7 +160,7 @@ void menu_aff() { do { /* ligne par ligne */ msk = 0x80; for (pt = 0; pt <= 7; pt ++) { - if ((lettres[num_letr][ind_tabl] & msk) != 0) { + if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { putpix(gd, x + 1, y + 1, 0); putpix(gd, x, y + 1, 0); putpix(gd, x, y, color); -- cgit v1.2.3 From 9a79a5e059812c50d35b27139950bac38b8eb3fd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 20:24:57 +1100 Subject: MORTEVIELLE: Formatting fixes for game menu display --- engines/mortevielle/menu.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 8c6561e097..a43372063e 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -51,7 +51,7 @@ namespace Mortevielle { clrscr; mortevielle_exit(0); } - while (s.size() < 30) s = s + ' '; + while (s.size() < 20) s = s + ' '; switch (h) { case invent : if (l != 7) { @@ -83,22 +83,22 @@ namespace Mortevielle { switch (h) { case invent : { if (l > 6) { - inv[l].setChar('<', 1); - inv[l].setChar('>', 22); + inv[l].setChar('<', 0); + inv[l].setChar('>', 21); } else inv[l].setChar('*', 1); } break; case depla : - dep[l].setChar('*', 1); + dep[l].setChar('*', 0); break; case action : - act[l].setChar('*', 1); + act[l].setChar('*', 0); break; case saction : - self_[l].setChar('*', 1); + self_[l].setChar('*', 0); break; case discut : - dis[l].setChar('*', 1); + dis[l].setChar('*', 0); break; } } @@ -111,23 +111,23 @@ namespace Mortevielle { l = lo(no); switch (h) { case invent : { - inv[l].setChar(' ', 1); - inv[l].setChar(' ', 22); + inv[l].setChar(' ', 0); + inv[l].setChar(' ', 21); } break; case depla : - dep[l].setChar(' ', 1); + dep[l].setChar(' ', 0); break; case action : - act[l].setChar(' ', 1); + act[l].setChar(' ', 0); break; case saction : { - self_[l].setChar(' ', 1); - self_[l].setChar(' ', 1); + self_[l].setChar(' ', 0); + self_[l].setChar(' ', 0); } break; case discut : - dis[l].setChar(' ', 1); + dis[l].setChar(' ', 0); break; } } -- cgit v1.2.3 From 1017159802176ad449dbf6d1eaa4ab3ad61ddbb8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 20:51:59 +1100 Subject: MORTEVIELLE: More game menu formatting fixes --- engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/ovd1.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 2f0793643c..4b8a9ae25a 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -218,7 +218,7 @@ void tmlieu(int mli) { cx = v_lieu[i][mli]; deline(cx + c_tmlieu, st, tail); nomp = delig; - while (nomp.size() < 30) nomp = nomp + ' '; + while (nomp.size() < 20) nomp = nomp + ' '; menut(depl[i], nomp); i = i + 1; } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index d6713908dc..f01937667a 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -116,11 +116,16 @@ void ani50() { i = 1; do { deline(i + c_action, st, tai); - act[i] = delig + " "; + act[i] = delig; + while (act[i].size() < 10) + act[i] += ' '; + if (i < 9) { if (i < 6) { deline(i + c_saction, st, tai); - self_[i] = delig + " "; + self_[i] = delig; + while (self_[i].size() < 10) + self_[i] += ' '; } deline(i + c_dis, st, tai); dis[i] = delig + ' '; -- cgit v1.2.3 From f5af2b407c12c39d7e0855413fb1fb2ce7dff354 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 22:13:36 +1100 Subject: MORTEVIELLE: Restore background area when a menu is removed --- engines/mortevielle/menu.cpp | 18 ++++++++++++++++++ engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/var_mor.cpp | 15 +++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a43372063e..11c7c34b00 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -30,6 +30,7 @@ #include "common/textconsole.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" @@ -255,6 +256,11 @@ void menu_down(int ii) { int xco, nb_lig; /* debug('menu_down'); */ + + // Make a copy of the current screen surface for later restore + g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); + + // Draw the menu xco = don[ii][1]; nb_lig = don[ii][4]; hide_mouse(); @@ -307,6 +313,18 @@ void menu_up(int xx) { /* debug('menu_up'); */ if (test0) { charecr(10, succ(byte, don[xx][2]) << 1); + + /* Restore the background area */ + assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); + + // Get a pointer to the source and destination of the area to restore + const byte *pSrc = (const byte *)g_vm->_backgroundSurface.getBasePtr(0, 10); + Graphics::Surface destArea = g_vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); + byte *pDest = (byte *)destArea.getBasePtr(0, 0); + + // Copy the data + Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest); + test0 = false; } } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0555f302ab..9974d1c40e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -64,6 +64,7 @@ private: public: ScreenSurface _screenSurface; PaletteManager _paletteManager; + GfxSurface _backgroundSurface; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 9de3d94137..444d9c6d5d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -319,8 +319,16 @@ char get_ch() { return g_vm->getChar(); } +/** + * Restore a screen sectio + */ +void s_sauv(int Gd, int y, int dy) { + // Note: May no longer be necessary, since the backgorund restore code + // is being handled slightly differently now in the menu_up() method +} + void palette(int v1) { - warning("TODO: s_sauv"); + warning("TODO: palette"); } // (* external 'c:\mc\charecr.com'; *) @@ -328,11 +336,6 @@ void s_char(int Gd, int y, int dy) { warning("TODO: s_char"); } -// (* external 'c:\mc\sauvecr.com'; *) -void s_sauv(int Gd, int y, int dy) { - warning("TODO: s_sauv"); -} - // (* external 'c:\mc\boite.com'; *) void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { debugC(1, kMortevielleCore, "TODO: box deprecated in favour of GfxSurface::fillBox"); -- cgit v1.2.3 From 84ef8f5a7f8b5f35e105ed908d96c56d9d17f2d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 22:28:13 +1100 Subject: MORTEVIELLE: Formatting fix for savegame list --- engines/mortevielle/menu.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 11c7c34b00..b14aacf4fa 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -295,12 +295,22 @@ void menu_down(int ii) { case 6 : writeg(fic[cx], 4); break; - case 7 : - writeg(fic[1] + ' ' + chr(48 + cx), 4); + case 7 : { + Common::String s = fic[1]; + s += ' '; + s += (char)(48 + cx); + writeg(s, 4); break; + } case 8 : - if (cx == 1) writeg(recom, 4); - else writeg(fic[2] + ' ' + chr(47 + cx), 4); + if (cx == 1) + writeg(recom, 4); + else { + Common::String s = fic[2]; + s += ' '; + s += (char)(47 + cx); + writeg(s, 4); + } break; } putxy(xco, ywhere + 8); -- cgit v1.2.3 From 6ee67ca7b7ba1e747df7c5a4be6a1051ef1a12a6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 22:44:38 +1100 Subject: MORTEVIELLE: Remove old drive boot sector read code in game startup. I presume that this may have been part of original game copy protection. --- engines/mortevielle/prog.cpp | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 41615219d4..41d72b5ee0 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -58,9 +58,7 @@ namespace Mortevielle { } /* overlay */ void antegame() { - registres regs; - char buffer[512]; - int i, j, k; + int k; bool test[3]; char g[8]; @@ -107,33 +105,14 @@ namespace Mortevielle { affrep(); stpou = ind_mess; while ((test[k] == false) && (k < 2)) { - regs.ax = 0; - k = succ(int, 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; - } + ++k; + + // Original read in the boot sector here of each drive and did some calculations - + // presumably for copy protection. This has been replaced with hardcoded success + test[k] = true; + + okdes = false; + solu = true; perdu = false; fouil = false; } -- cgit v1.2.3 From 962069f9371317b61a12e87b2618d75f98e43f91 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 22:56:56 +1100 Subject: MORTEVIELLE: Fix conversion of string to integer in room changes --- engines/mortevielle/alert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 804e0f41f0..36170361c3 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -50,7 +50,7 @@ static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String bool v; //val(s[2], nbc, i); - sscanf(s.c_str() + 1, "%d", nbc); + nbc = atoi(s.c_str() + 1); i = 0; c = ""; -- cgit v1.2.3 From 37386cdf7ce39f7241dc21fd3bf3db7d3c60e14d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 Jan 2012 23:08:35 +1100 Subject: MORTEVIELLE: Properly implement get_random_number method --- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 2 ++ engines/mortevielle/var_mor.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index f3ad46894d..bdb5b710c8 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -37,7 +37,7 @@ namespace Mortevielle { MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): - Engine(system), _gameDescription(gameDesc) { + Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { g_vm = this; _lastGameFrame = 0; _mouseButtons = 0; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 9974d1c40e..b0e7343d0e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -25,6 +25,7 @@ #include "common/events.h" #include "common/file.h" +#include "common/random.h" #include "common/rect.h" #include "common/stack.h" #include "engines/advancedDetector.h" @@ -65,6 +66,7 @@ public: ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; + Common::RandomSource _randomSource; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 444d9c6d5d..92f20a4442 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -307,9 +307,11 @@ void graphbackground(int c) { void intr(int intNum, registres ®s) { } +/** + * Get a random number between two values + */ int get_random_number(int minval, int maxval) { - // TODO: Replace with a proper random source in the engine - return minval; + return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval; } bool keypressed() { -- cgit v1.2.3 From 35b502612bebeec8007385f6eb1496b5755b4f31 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 09:24:24 +1100 Subject: MORTEVIELLE: Added missing variable to savegame synchronization --- engines/mortevielle/disk.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index 41868d42fa..a22c8f4bb0 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -62,6 +62,9 @@ void dem1() { */ } +/** + * Handle saving or loading savegame data + */ static void sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(s1.conf); sz.syncBytes((byte *)&s1.pourc[0], 11); @@ -78,6 +81,8 @@ static void sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(s1.icryp); sz.syncAsSint16LE(s1.ipre); sz.syncAsSint16LE(s1.heure); + + sz.syncBytes(bufcha, 390); } void takesav(int n) { -- cgit v1.2.3 From 90e076a36a25e79262848d0820f04d4fe1e5cc8f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 20:06:08 +1100 Subject: MORTEVIELLE: Merge the _mouseButtons and clic variables The original separate implementation was causing problems with the mouse click variable remaining set too long. --- engines/mortevielle/actions.cpp | 5 +++-- engines/mortevielle/alert.cpp | 7 ++++--- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/menu.cpp | 19 ++++++++++++------- engines/mortevielle/mor2.cpp | 5 +++-- engines/mortevielle/mortevielle.cpp | 12 +++--------- engines/mortevielle/mortevielle.h | 5 +++-- engines/mortevielle/mouse.cpp | 10 ++++------ engines/mortevielle/mouse.h | 2 +- engines/mortevielle/ovd1.cpp | 3 ++- engines/mortevielle/ques.cpp | 5 +++-- 11 files changed, 39 insertions(+), 36 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 81042c4ce2..9c1a6b738c 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -32,6 +32,7 @@ #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" @@ -1094,8 +1095,8 @@ L2: } else choi = 0; } } - } while (!((tou == '\15') || (((c != 0) || clic) && (choi != 0)))); - clic = false; + } while (!((tou == '\15') || (((c != 0) || g_vm->getMouseClick()) && (choi != 0)))); + g_vm->setMouseClick(false); if (choi != 46) { ix = choi - 1; if (col) { diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 36170361c3..6a380b2155 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -28,6 +28,7 @@ #include "common/str.h" #include "mortevielle/alert.h" #include "mortevielle/level15.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/sprint.h" @@ -150,7 +151,7 @@ int do_alert(Common::String str_, int n) { while (keypressed()) dumi = get_ch(); // input >> kbd >> dumi; - clic = false; + g_vm->setMouseClick(false); decod(str_, nbcase, nblig, nbcol, chaine, cas); sauvecr(50, succ(int, nligne) << 4); @@ -242,8 +243,8 @@ int do_alert(Common::String str_, int n) { } 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; + } while (!g_vm->getMouseClick()); + g_vm->setMouseClick(false); hide_mouse(); if (! test3) { quoi = n; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index ee9c63228b..034a60c505 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -79,7 +79,7 @@ void PaletteManager::setDefaultPalette() { #define INCR_TAIX { if (_xSize & 1) ++_xSize; } #define DEFAULT_WIDTH (SCREEN_WIDTH / 2) -#define BUFFER_SIZE 8192 +#define BUFFER_SIZE 40000 void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index b14aacf4fa..f24062a000 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -187,7 +187,7 @@ void draw_menu() { msg4 = no_choice; msg3 = no_choice; choisi = false; - clic = false; + g_vm->setMouseClick(false); test0 = false; } @@ -342,7 +342,7 @@ void menu_up(int xx) { void erase_menu() { /* debug('erase_menu'); */ active_menu = false; - clic = false; + g_vm->setMouseClick(false); menu_up(msg3); } @@ -355,7 +355,7 @@ void mdn() { if (! active_menu) return; x = x_s; y = y_s; - if (! clic) { + if (!g_vm->getMouseClick()) { if ((x == xprec) && (y == yprec)) return; else { @@ -385,21 +385,26 @@ void mdn() { } else { /* Not in the MenuTitle line */ if ((y > 11) && (test0)) util(x, y); } - } else /* il y a eu 'clic' */ + } else /* There was a click */ if ((msg3 == fichier) && (msg4 != no_choice)) { - clic = false; + // Another menu to be displayed + g_vm->setMouseClick(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 */ + + g_vm->setMouseClick(false); + } else { + // A menu was clicked on choisi = (test0) && (msg4 != no_choice); menu_up(msg3); msg[4] = msg4; msg[3] = msg3; msg3 = no_choice; msg4 = no_choice; - clic = false; + + g_vm->setMouseClick(false); } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 4b8a9ae25a..1c27ef3f04 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -202,7 +202,7 @@ void tkey1(bool d) { read_pos_mouse(x, y, c); } while (!(quest || (c != 0) || (d && anyone))); if (quest) key = testou(); - clic = false; + g_vm->setMouseClick(false); show_mouse(); } @@ -628,7 +628,8 @@ void tfleche() { do { mov_mouse(qust, touch); - if (clic) rect = (x_s < 256 * res) && (y_s < 176) && (y_s > 12); + if (g_vm->getMouseClick()) + rect = (x_s < 256 * res) && (y_s < 176) && (y_s > 12); tinke(); } while (!(qust || rect || anyone)); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index bdb5b710c8..88a3ecd9e5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -40,7 +40,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { g_vm = this; _lastGameFrame = 0; - _mouseButtons = 0; + _mouseClick = false; } MortevielleEngine::~MortevielleEngine() { @@ -168,21 +168,15 @@ bool MortevielleEngine::handleEvents() { switch (event.type) { case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONUP: - case Common::EVENT_RBUTTONDOWN: - case Common::EVENT_RBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); x_s = event.mouse.x; y_s = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) - _mouseButtons |= 1; + _mouseClick = true; else if (event.type == Common::EVENT_LBUTTONUP) - _mouseButtons &= ~1; - else if (event.type == Common::EVENT_RBUTTONDOWN) - _mouseButtons |= 2; - else if (event.type == Common::EVENT_RBUTTONUP) - _mouseButtons &= ~2; + _mouseClick = false; break; case Common::EVENT_KEYDOWN: diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b0e7343d0e..4c755a1f5e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -53,7 +53,7 @@ private: const ADGameDescription *_gameDescription; Common::Stack _keypresses; uint32 _lastGameFrame; - int _mouseButtons; + bool _mouseClick; Common::Point _mousePos; Common::ErrorCode initialise(); @@ -78,7 +78,8 @@ public: int getChar(); Common::Point getMousePos() const { return _mousePos; } void setMousePos(const Common::Point &pt); - int getMouseButtons() const { return _mouseButtons; } + bool getMouseClick() const { return _mouseClick; } + void setMouseClick(bool v) { _mouseClick = v; } }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 2e945287ba..98429cc04e 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -57,7 +57,7 @@ void init_mouse() { y_s = 0; p_o_s = 0; /*int_m:= False;*/ - clic = false; + g_vm->setMouseClick(false); m_show = m_arrow; if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) int_m = false; if (int_m) { @@ -278,7 +278,7 @@ void pos_mouse(int x, int y) { void read_pos_mouse(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; - c = g_vm->getMouseButtons(); + c = g_vm->getMouseClick() ? 1 : 0; } void mov_mouse(bool &funct, char &key) { @@ -292,10 +292,8 @@ void mov_mouse(bool &funct, char &key) { p_key = keypressed(); // If mouse button clicked, return it - if (g_vm->getMouseButtons() != 0) { - clic = true; + if (g_vm->getMouseClick()) return; - } // Handle any pending keypresses while (p_key) { @@ -343,7 +341,7 @@ void mov_mouse(bool &funct, char &key) { break; case ' ': case '\15' : { - clic = true; + g_vm->setMouseClick(true); return; } break; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index a981d521ac..32fba0420f 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -30,7 +30,7 @@ namespace Mortevielle { -extern bool clic, int_m; +extern bool int_m; extern int m_show, x_s, diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index f01937667a..283756948c 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -31,6 +31,7 @@ #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" @@ -142,7 +143,7 @@ void ani50() { msg4 = no_choice; msg[3] = no_choice; msg[4] = no_choice; - clic = false; + g_vm->setMouseClick(false); } diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index c9154acc59..e7ae1b30ec 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -28,6 +28,7 @@ #include "common/str.h" #include "mortevielle/boite.h" #include "mortevielle/level15.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" @@ -105,7 +106,7 @@ namespace Mortevielle { j = 0; memk = 0; do { - clic = false; + g_vm->setMouseClick(false); tesok = false; mov_mouse(func, key); k = 1; @@ -130,7 +131,7 @@ namespace Mortevielle { afftex(st, 100, 27 + memk * 8, 100, 1, 0); memk = 0; } - } while (!((memk != 0) && clic)); + } while (!((memk != 0) && g_vm->getMouseClick())); if (memk == ok[i]) compte = compte + 1; else { if (i == 5) i = i + 1; -- cgit v1.2.3 From 3fa59e95199002ec4ed6e4285be4f7234c257da0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 20:47:08 +1100 Subject: MORTEVIELLE: Bugfix for image block decoding method #0 --- engines/mortevielle/graphics.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 034a60c505..3683afc57b 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -129,6 +129,7 @@ void GfxSurface::decode(const byte *pSrc) { int srcSize = READ_BE_UINT16(pSrc + 2); _xp = READ_BE_UINT16(pSrc + 4) - _offset.x; _yp = READ_BE_UINT16(pSrc + 6) - _offset.y; + assert((_xp >= 0) && (_yp >= 0) && (_xp < SCREEN_WIDTH) && (_yp < SCREEN_ORIG_HEIGHT)); pSrc += 8; int decomCode = READ_BE_UINT16(pSrc); @@ -242,7 +243,7 @@ void GfxSurface::decode(const byte *pSrc) { } } - pSrc = pSrcStart + lookupBytes + ((lookupBytes & 1) ? 1 : 0); + pSrcStart += lookupBytes + ((lookupBytes & 1) ? 1 : 0); break; case 1: @@ -399,6 +400,9 @@ void GfxSurface::decode(const byte *pSrc) { _xEnd = _xSize; diag(pSrc, pDest, pLookup); break; + + default: + error("Unknown decompression block type %d", decomIndex); } pSrc = pSrcStart; -- cgit v1.2.3 From e578c4d6480d310de77aea0a4415faa9fc67be0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 21:22:33 +1100 Subject: MORTEVIELLE: Fix for displaying savegame menus correctly --- engines/mortevielle/menu.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f24062a000..819a2e7c55 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -217,15 +217,24 @@ void invers(int ix) { s = fic[lo(msg4)]; break; case 7 : - s = fic[1] + ' ' + chr(48 + lo(msg4)); + s = fic[1]; + s += ' '; + s += (char)(48 + lo(msg4)); break; case 8 : - if (lo(msg4) == 1) s = recom; - else s = fic[2] + ' ' + chr(47 + lo(msg4)); + if (lo(msg4) == 1) { + s = recom; + } else { + s = fic[2]; + s += ' '; + s += (char)(47 + lo(msg4)); + } break; } - if ((s[1] != '*') && (s[1] != '<')) writeg(s, ix); - else msg4 = no_choice; + if ((s[1] != '*') && (s[1] != '<')) + writeg(s, ix); + else + msg4 = no_choice; } void util(int x, int y) { -- cgit v1.2.3 From 6205e89e501e2ddd67e6eabe864637faef7023c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 21:27:50 +1100 Subject: MORTEVIELLE: Fix some string indexing --- engines/mortevielle/menu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 819a2e7c55..dc9e7e0e15 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -231,7 +231,7 @@ void invers(int ix) { } break; } - if ((s[1] != '*') && (s[1] != '<')) + if ((s[0] != '*') && (s[0] != '<')) writeg(s, ix); else msg4 = no_choice; @@ -287,19 +287,19 @@ void menu_down(int ii) { cx = succ(int, cx); switch (ii) { case 1 : - if (inv[cx][1] != '*') writeg(inv[cx], 4); + if (inv[cx][0] != '*') writeg(inv[cx], 4); break; case 2 : - if (dep[cx][1] != '*') writeg(dep[cx], 4); + if (dep[cx][0] != '*') writeg(dep[cx], 4); break; case 3 : - if (act[cx][1] != '*') writeg(act[cx], 4); + if (act[cx][0] != '*') writeg(act[cx], 4); break; case 4 : - if (self_[cx][1] != '*') writeg(self_[cx], 4); + if (self_[cx][0] != '*') writeg(self_[cx], 4); break; case 5 : - if (dis[cx][1] != '*') writeg(dis[cx], 4); + if (dis[cx][0] != '*') writeg(dis[cx], 4); break; case 6 : writeg(fic[cx], 4); -- cgit v1.2.3 From 73834c756354501dc6ccb982e6d228929ee8a6ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 21:49:58 +1100 Subject: MORTEVIELLE: Changed readclock() method to use ScummVM functionality --- engines/mortevielle/mor.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 373a80029a..17dd83a7ee 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -27,6 +27,7 @@ #include "common/endian.h" #include "common/str.h" +#include "common/system.h" #include "common/textconsole.h" #include "mortevielle/alert.h" #include "mortevielle/boite.h" @@ -55,24 +56,19 @@ void testfi() { } } - +/** + * Read the current system time + */ int readclock() { - registres r; - int s, m, h; + int m, h; /* debug('readclock');*/ - int readclock_result; - r.ax = 0x2c00; - intr(0x21, r); - { - h = (uint)r.cx >> 8; - m = r.cx % 256; - s = (uint)r.dx >> 8; - } - m = m * 60; - h = h * 3600; - readclock_result = h + m + s; - return readclock_result; + TimeDate dateTime; + g_system->getTimeAndDate(dateTime); + + m = dateTime.tm_min * 60; + h = dateTime.tm_hour * 3600; + return h + m + dateTime.tm_sec; } void modif(int &nu) { -- cgit v1.2.3 From e9f59153dbd47a83fdd3b305b6dfb6b1378823be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 22:34:42 +1100 Subject: MORTEVIELLE: Correct synchronisation of savegame data --- engines/mortevielle/disk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index a22c8f4bb0..e7c9801f4b 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -79,8 +79,8 @@ static void sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(s1.derobj); sz.syncAsSint16LE(s1.iloic); sz.syncAsSint16LE(s1.icryp); - sz.syncAsSint16LE(s1.ipre); - sz.syncAsSint16LE(s1.heure); + sz.syncAsByte(s1.ipre); + sz.syncAsByte(s1.heure); sz.syncBytes(bufcha, 390); } -- cgit v1.2.3 From e4a9586d74bb9c4ec8add26b63adf2a6ebe27d14 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 22:38:23 +1100 Subject: MORTEVIELLE: Change float parameters in chardes/charani to int32 The original used this to handle 32-bit values. So it's cleaner to use int32 explicitly. --- engines/mortevielle/taffich.cpp | 10 +++++----- engines/mortevielle/taffich.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 77733b8829..55fdbb7442 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -35,7 +35,7 @@ namespace Mortevielle { -void chardes(Common::String nom, float passe, int long_) { +void chardes(Common::String nom, int32 passe, int long_) { int i, p, l; // byte b; Common::File f; @@ -52,7 +52,7 @@ void chardes(Common::String nom, float passe, int long_) { } if (p != 0) f.seek(p * 0x80); - p = abs((int)passe); + p = abs(passe); l = long_ + p; i = 0; while (l > 0) { @@ -68,7 +68,7 @@ void chardes(Common::String nom, float passe, int long_) { /*$i+*/ } -void charani(Common::String nom, float passe, int long_) { +void charani(Common::String nom, int32 passe, int long_) { int i, p, l; // byte b; Common::File f; @@ -86,7 +86,7 @@ void charani(Common::String nom, float passe, int long_) { if (p != 0) f.seek(p * 0x80); - p = abs((int)passe); + p = abs(passe); l = long_ + p; i = 0; while (l > 0) { @@ -106,7 +106,7 @@ void taffich() { int i, m, a, b, cx, handle, npal; - float lgt; + int32 lgt; Common::String nom; int palh, k, j; int alllum[16]; diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h index bea3c09f2a..a6acce21eb 100644 --- a/engines/mortevielle/taffich.h +++ b/engines/mortevielle/taffich.h @@ -32,8 +32,8 @@ namespace Mortevielle { -extern void chardes(Common::String nom, float passe, int long_); -extern void charani(Common::String nom, float passe, int long_); +extern void chardes(Common::String nom, int32 passe, int long_); +extern void charani(Common::String nom, int32 passe, int long_); extern void taffich(); } // End of namespace Mortevielle -- cgit v1.2.3 From 5fb491070e8ac80e2bb8601c664ad5d22be97c1a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Jan 2012 23:40:01 +1100 Subject: MORTEVIELLE: Bugfixes for saving/loading savegames --- engines/mortevielle/disk.cpp | 2 +- engines/mortevielle/prog.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp index e7c9801f4b..25bf7faca3 100644 --- a/engines/mortevielle/disk.cpp +++ b/engines/mortevielle/disk.cpp @@ -82,7 +82,7 @@ static void sync_save(Common::Serializer &sz) { sz.syncAsByte(s1.ipre); sz.syncAsByte(s1.heure); - sz.syncBytes(bufcha, 390); + sz.syncBytes(bufcha, 391); } void takesav(int n) { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 41d72b5ee0..5f2fd3cb65 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -255,8 +255,10 @@ void tecran() { change_gd((uint)pred(int, ord(inkey)) >> 1); return; } - if (choisi && (msg[3] == sauve)) sv_game(msg[4] & 7); - if (choisi && (msg[3] == charge)) ld_game(pred(int, msg[4] & 7)); + if (choisi && (msg[3] == sauve)) + sv_game(msg[4] & 7); + if (choisi && (msg[3] == charge)) + ld_game((msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = do_alert(stpou, 1); return; -- cgit v1.2.3 From 9ae61553d4c5fab40b025824072b250770cb5b2b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Jan 2012 08:13:45 +1100 Subject: MORTEVIELLE: Visual fix for the inventory menu --- engines/mortevielle/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index dc9e7e0e15..9c50777cec 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -86,7 +86,7 @@ namespace Mortevielle { if (l > 6) { inv[l].setChar('<', 0); inv[l].setChar('>', 21); - } else inv[l].setChar('*', 1); + } else inv[l].setChar('*', 0); } break; case depla : -- cgit v1.2.3 From 85b7c1cef73a5a64e99c8e6405c8ccbd7630cf41 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Jan 2012 08:25:00 +1100 Subject: MORTEVIELLE: Add extra parenthesis to defines for operation safety --- engines/mortevielle/var_mor.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a96329f477..89f05f121e 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -61,14 +61,14 @@ namespace Mortevielle { /*------------------------- DEFINES ----------------------------------*/ /*---------------------------------------------------------------------------*/ -#define pred(type, v) (v - 1) -#define succ(type, v) (v + 1) +#define pred(type, v) ((v) - 1) +#define succ(type, v) ((v) + 1) #define ord(v) ((int) v) #define chr(v) ((char) v) -#define lo(v) (v & 0xff) -#define hi(v) ((v >> 8) & 0xff) +#define lo(v) ((v) & 0xff) +#define hi(v) (((v) >> 8) & 0xff) #define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) -#define odd(v) ((v % 2) == 1) +#define odd(v) (((v) % 2) == 1) /*---------------------------------------------------------------------------*/ /*------------------------- CONSTANTS ----------------------------------*/ -- cgit v1.2.3 From f875622ef63ab86ba248ada0c917bd6b97c80736 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Jan 2012 08:50:44 +1100 Subject: MORTEVIELLE: Fix sizes of several arrays --- engines/mortevielle/var_mor.cpp | 14 +++++++------- engines/mortevielle/var_mor.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 92f20a4442..34dc742144 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -199,18 +199,18 @@ Common::String al_mess, ind_mess, al_mess2; -int invt[8]; -int nbrep[8]; -int nbrepm[8]; -int disc[8]; +int invt[9]; +int nbrep[9]; +int nbrepm[9]; +int disc[9]; int msg[5]; -int depl[7]; +int depl[8]; Common::String inv[9]; Common::String dep[8]; Common::String act[22]; -Common::String self_[6]; +Common::String self_[7]; Common::String dis[9]; -char touv[7]; +char touv[8]; sav_chaine s, s1; byte bufcha[391]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 89f05f121e..642ecefb2b 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -367,18 +367,18 @@ extern Common::String al_mess, ind_mess, al_mess2; -extern int invt[8]; -extern int nbrep[8]; -extern int nbrepm[8]; -extern int disc[8]; +extern int invt[9]; +extern int nbrep[9]; +extern int nbrepm[9]; +extern int disc[9]; extern int msg[5]; -extern int depl[7]; +extern int depl[8]; extern Common::String inv[9]; extern Common::String dep[8]; extern Common::String act[22]; -extern Common::String self_[6]; +extern Common::String self_[7]; extern Common::String dis[9]; -extern char touv[7]; +extern char touv[8]; extern sav_chaine s, s1; extern byte bufcha[391]; -- cgit v1.2.3 From 02f2088d43adc2514895fd845bc9dce17fd1a36b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Jan 2012 09:16:41 +1100 Subject: MORTEVIELLE: Added extra quit checks to event loops --- engines/mortevielle/actions.cpp | 2 ++ engines/mortevielle/alert.cpp | 2 ++ engines/mortevielle/mor2.cpp | 2 ++ engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/ques.cpp | 2 ++ 5 files changed, 9 insertions(+) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9c1a6b738c..7e5143328d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1053,6 +1053,8 @@ L2: tou = '\0'; do { mov_mouse(f, tou); + CHECK_QUIT; + /* if keypressed then read(kbd,tou);*/ read_pos_mouse(x, y, c); x = x * (3 - res); diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 6a380b2155..3895bad7fd 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -195,6 +195,8 @@ int do_alert(Common::String str_, int n) { do { dumi = '\377'; mov_mouse(dum, dumi); + CHECK_QUIT0; + cx = x_s; cy = y_s; test = (cy > 95) && (cy < 105); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 1c27ef3f04..10fe6e9937 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -628,6 +628,8 @@ void tfleche() { do { mov_mouse(qust, touch); + CHECK_QUIT; + if (g_vm->getMouseClick()) rect = (x_s < 256 * res) && (y_s < 176) && (y_s > 12); tinke(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 4c755a1f5e..75aaeda580 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -85,6 +85,7 @@ public: extern MortevielleEngine *g_vm; #define CHECK_QUIT if (g_vm->shouldQuit()) { return; } +#define CHECK_QUIT0 if (g_vm->shouldQuit()) { return 0; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index e7ae1b30ec..a223e4956f 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -109,6 +109,8 @@ namespace Mortevielle { g_vm->setMouseClick(false); tesok = false; mov_mouse(func, key); + CHECK_QUIT0; + k = 1; while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; if (coor[k].etat) { -- cgit v1.2.3 From 08b3b91f0f47c5a51e2cec4d3f7ede5a0152563a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 Jan 2012 00:15:19 +1100 Subject: MORTEVIELLE: Converted the demus assembly code to C++ --- engines/mortevielle/module.mk | 1 + engines/mortevielle/ovd1.cpp | 3 ++- engines/mortevielle/parole.cpp | 3 ++- engines/mortevielle/sound.cpp | 56 +++++++++++++++++++++++++++++++++++++++++ engines/mortevielle/sound.h | 37 +++++++++++++++++++++++++++ engines/mortevielle/var_mor.cpp | 5 ---- engines/mortevielle/var_mor.h | 3 +-- 7 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 engines/mortevielle/sound.cpp create mode 100644 engines/mortevielle/sound.h diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 327c4ba3c9..b977c25273 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -23,6 +23,7 @@ MODULE_OBJS := \ parole2.o \ prog.o \ ques.o \ + sound.o \ sprint.o \ taffich.o \ var_mor.o diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 283756948c..3c23a62b28 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -36,6 +36,7 @@ #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole.h" +#include "mortevielle/sound.h" #include "mortevielle/sprint.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -338,7 +339,7 @@ void ani50() { fic.read(&mem[0x47a0 * 16 + 0], 123); fic.close(); - demus(0x3800, 0x5000, 623); + demus(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); addfix = (float)((tempo_mus - addv[1])) / 256; cctable(tbi); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 76d6c9a177..768b021454 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -27,6 +27,7 @@ #include "common/file.h" #include "mortevielle/parole.h" +#include "mortevielle/sound.h" namespace Mortevielle { @@ -128,7 +129,7 @@ void veracf(byte b) { f.read(&mem[0x7414 * 16 + 0], 273); /*blockread(f,mem[adson * 16+0],300); blockread(f,mem[adson * 16+2400+0],245);*/ - demus(0x7414, adson, 273); + demus(&mem[0x7414 * 16], &mem[adson * 16], 273); f.close(); } diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp new file mode 100644 index 0000000000..f2b70cf8ee --- /dev/null +++ b/engines/mortevielle/sound.cpp @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/scummsys.h" +#include "mortevielle/sound.h" + +namespace Mortevielle { + +const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; + +/** + * Decode music data + */ +void demus(const byte *PSrc, byte *PDest, int NbreSeg) { + int seed = 128; + int v; + + for (int idx1 = 0; idx1 < (NbreSeg * 2); ++idx1) { + for (int idx2 = 0; idx2 < 64; ++idx2) { + byte srcByte = *PSrc++; + v = tab[srcByte >> 4]; + seed += v; + *PDest++ = seed & 0xff; + + v = tab[srcByte & 0xf]; + seed += v; + *PDest++ = seed & 0xff; + } + } +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h new file mode 100644 index 0000000000..6e4f7b2a4d --- /dev/null +++ b/engines/mortevielle/sound.h @@ -0,0 +1,37 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_SOUND_H +#define MORTEVIELLE_SOUND_H + +namespace Mortevielle { + +extern void demus(const byte *PSrc, byte *PDest, int NbreSeg); + +} // End of namespace Mortevielle + +#endif diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 34dc742144..38a374e82b 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -359,11 +359,6 @@ void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } -// (* external 'c:\mc\demus.com'; *) -void demus(int Src, int Dst, int Tay) { - warning("TODO: demus"); -} - // (* external 'c:\mc\phint.com'; *) void litph(tablint &t, int typ, int tempo) { warning("TODO: litph"); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 642ecefb2b..b8a18a1253 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -50,6 +50,7 @@ namespace Mortevielle { * * Address * ------- + * 5000:0 - Music data * 6000:0 - Decompressed current image * 7000:0+ - Compressed images * 7000:2 - 16 words representing palette map @@ -455,8 +456,6 @@ extern void decomp(int seg, int dep); extern void afff(int Gd, int seg, int dep, int x, int y); // (* external 'c:\mc\reusint.com'; *) extern void musyc(tablint &tb, int nbseg, int att); -// (* external 'c:\mc\demus.com'; *) -extern void demus(int Src, int Dst, int Tay); // (* external 'c:\mc\phint.com'; *) extern void litph(tablint &t, int typ, int tempo); -- cgit v1.2.3 From 82381d6a19038800f85e4a10d6ab232c48555baa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 Jan 2012 22:31:36 +1100 Subject: MORTEVIELLE: Fix for erasing alert dialogs when done --- engines/mortevielle/alert.cpp | 6 ++++++ engines/mortevielle/graphics.cpp | 17 +++++++++++++++++ engines/mortevielle/graphics.h | 1 + 3 files changed, 24 insertions(+) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 3895bad7fd..36a51b07ed 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -143,6 +143,8 @@ int do_alert(Common::String str_, int n) { bool newaff, test, test1, test2, test3, dum; Common::String cas; + // Make a copy of the current screen surface for later restore + g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); /*debug('** do_alert **');*/ memset(&limit[0][0], 0, sizeof(int) * 3 * 3); @@ -258,6 +260,10 @@ int do_alert(Common::String str_, int n) { } charecr(50, succ(int, nligne) << 4); show_mouse(); + + /* Restore the background area */ + g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); + do_alert_result = quoi; return do_alert_result; } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3683afc57b..3450d41cf5 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -934,6 +934,23 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { } } +/** + * Copys a given surface to the given position + */ +void ScreenSurface::copyFrom(Graphics::Surface &src, int x, int y) { + Graphics::Surface destSurface = lockArea(Common::Rect(x, y, x + src.w, y + src.h)); + + // Loop through writing + for (int yp = 0; yp < src.h; ++yp) { + if (((y + yp) < 0) || ((y + yp) >= SCREEN_HEIGHT)) + continue; + + const byte *pSrc = (const byte *)src.getBasePtr(0, yp); + byte *pDest = (byte *)getBasePtr(0, yp); + Common::copy(pSrc, pSrc + src.w, pDest); + } +} + /** * Draws a character at the specified co-ordinates * @remarks Because the ScummVM surface is using a double height 640x400 surface to diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 376b9e5e85..0b265469df 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -82,6 +82,7 @@ public: Graphics::Surface lockArea(const Common::Rect &bounds); void updateScreen(); void drawPicture(GfxSurface &surface, int x, int y); + void copyFrom(Graphics::Surface &src, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); void fillBox(int colour, const Common::Rect &bounds, int patt); -- cgit v1.2.3 From 74d6a7bd01133d89ffde196dfcd339679ac8ee14 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 Jan 2012 21:17:12 +1100 Subject: MORTEVIELLE: Creation of a tool to extract game strings --- devtools/extract_mort/extract_mort.cpp | 373 +++++++++++++++++++++++++++++++++ devtools/extract_mort/module.mk | 11 + 2 files changed, 384 insertions(+) create mode 100644 devtools/extract_mort/extract_mort.cpp create mode 100644 devtools/extract_mort/module.mk diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp new file mode 100644 index 0000000000..9e5641759b --- /dev/null +++ b/devtools/extract_mort/extract_mort.cpp @@ -0,0 +1,373 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Lure of the Temptress lure.exe executable files into a new file + * lure.dat - this file is required for the ScummVM Lure of the Temptress module + * to work properly + */ + +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include +#include +#include + +#include "common/endian.h" + +enum AccessMode { + kFileReadMode = 1, + kFileWriteMode = 2 +}; + +class File { +private: + FILE *f; +public: + bool open(const char *filename, AccessMode mode = kFileReadMode) { + f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); + return (f != NULL); + } + void close() { + fclose(f); + f = NULL; + } + int seek(int32 offset, int whence = SEEK_SET) { + return fseek(f, offset, whence); + } + long read(void *buffer, int len) { + return fread(buffer, 1, len, f); + } + void write(const void *buffer, int len) { + fwrite(buffer, 1, len, f); + } + byte readByte() { + byte v; + read(&v, sizeof(byte)); + return v; + } + uint16 readWord() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); + } + uint32 readLong() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_LE_32(v); + } + void readString(char *sLine) { + while ((*sLine = readByte()) != '\n') + ++sLine; + + *sLine = '\0'; + } + void writeByte(byte v) { + write(&v, sizeof(byte)); + } + void writeWord(uint16 v) { + uint16 vTemp = TO_LE_16(v); + write(&vTemp, sizeof(uint16)); + } + void writeLong(uint32 v) { + uint32 vTemp = TO_LE_32(v); + write(&vTemp, sizeof(uint32)); + } + void writeString(const char *s) { + fprintf(f, "%s", s); + } + uint32 pos() { + return ftell(f); + } + uint32 size() { + int pos = ftell(f); + fseek (f, 0, SEEK_END); + int end = ftell (f); + fseek (f, pos, SEEK_SET); + + return end; + } +}; + +File textFile, txxInp, txxNtp; + +/*-------------------------------------------------------------------------*/ + +#define BUFFER_SIZE 32768 + +const byte tabdr[32] = { + 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 byte tab30[32] = { + 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 byte tab31[32]= { + 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 +}; + +/** + * Extracts a single character from the game data + */ +static void extractCharacter(unsigned char &c, int &idx, int &pt, bool &the_end, const uint16 *strData) { + uint16 oct, ocd; + + /* 5-8 */ + oct = FROM_LE_16(strData[idx]); + + oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); + if (pt < 6) { + idx = idx + 1; + oct = oct << (5 - pt); + pt = pt + 11; + oct = oct | (FROM_LE_16(strData[idx]) >> pt); + } else { + pt = pt - 5; + oct = (uint)oct >> pt; + } + + switch (oct) { + case 11 : { + c = '$'; + the_end = true; + } + break; + case 30: + case 31 : { + ocd = FROM_LE_16(strData[idx]); + ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); + if (pt < 6) { + idx = idx + 1; + ocd = ocd << (5 - pt); + pt = pt + 11; + ocd = ocd | (FROM_LE_16(strData[idx]) >> pt); + } else { + pt = pt - 5; + ocd = (uint)ocd >> pt; + } + if (oct == 30) + c = (char)tab30[ocd]; + else + c = (char)tab31[ocd]; + + if (c == '\0') { + the_end = true; + } + } + break; + default: + c = (char)tabdr[oct]; + } +} + +/** + * Puts a compressed 5-bit value into the string data buffer + */ +static void addCompressedValue(int oct, int &indis, int &point, uint16 *strData) { + // Write out the part of the value that fits into the current word + if (point < 5) + strData[indis] |= oct >> (5 - point); + else + strData[indis] |= oct << (point - 5); + + // Handling of there's any overlap into the next word + if (point < 5) { + // Overlapping into next word + ++indis; + + // Get the bits that fall into the next word and set it + int remainder = oct & ((1 << (5 - point)) - 1); + strData[indis] |= remainder << (16 - (5 - point)); + + point += -5 + 16; + } else { + point -= 5; + if (point == 0) { + point = 16; + ++indis; + } + } +} + +/** + * Compresses a single passed character and stores it in the compressed strings buffer + */ +static void compressCharacter(unsigned char ch, int &indis, int &point, uint16 *strData) { + if (ch == '$') { + // End of string + addCompressedValue(11, indis, point, strData); + return; + } + + // Scan through the tabdr array for a match + for (int idx = 0; idx < 30; ++idx) { + if ((idx != 11) && (tabdr[idx] == ch)) { + addCompressedValue(idx, indis, point, strData); + return; + } + } + + // Scan through the tab30 array + for (int idx = 0; idx < 32; ++idx) { + if (tab30[idx] == ch) { + addCompressedValue(30, indis, point, strData); + addCompressedValue(idx, indis, point, strData); + return; + } + } + + // Scan through the tab31 array + for (int idx = 0; idx < 32; ++idx) { + if (tab31[idx] == ch) { + addCompressedValue(31, indis, point, strData); + addCompressedValue(idx, indis, point, strData); + return; + } + } + + printf("Encountered invalid character '%c' when compressing strings\n", ch); + exit(1); +} + +/** + * string extractor + */ +static void export_strings(const char *textFilename) { + char buffer[BUFFER_SIZE]; + uint16 *strData; + + // Open input and output files + txxInp.open("TXX.INP", kFileReadMode); + txxNtp.open("TXX.NTP", kFileReadMode); + textFile.open(textFilename, kFileWriteMode); + + // Read all the compressed string data into a buffer + strData = (uint16 *)malloc(txxInp.size()); + txxInp.read(strData, txxInp.size()); + + // Loop through getting each string + for (unsigned int strIndex = 0; strIndex < (txxNtp.size() / 3); ++strIndex) { + int indis = txxNtp.readWord(); + int point = txxNtp.readByte(); + + // Extract the string + int charIndex = 0; + unsigned char ch; + bool endFlag = false; + do { + extractCharacter(ch, indis, point, endFlag, strData); + buffer[charIndex++] = ch; + if (ch == BUFFER_SIZE) { + printf("Extracted string exceeded allowed buffer size.\n"); + exit(1); + } + } while (!endFlag); + + // Write out the string + buffer[charIndex++] = '\n'; + buffer[charIndex] = '\0'; + textFile.writeString(buffer); + } + + // Close the files and free the buffer + free(strData); + txxInp.close(); + txxNtp.close(); + textFile.close(); +} + +/** + * string importer + */ +static void import_strings(const char *textFilename) { + // Open input and output files + txxInp.open("TXX.INP", kFileWriteMode); + txxNtp.open("TXX.NTP", kFileWriteMode); + textFile.open(textFilename, kFileReadMode); + + // Set up a buffer for the output compressed strings + uint16 strData[BUFFER_SIZE]; + memset(strData, 0, BUFFER_SIZE); + char sLine[BUFFER_SIZE]; + + int indis = 0; + int point = 16; + + while (textFile.pos() < textFile.size()) { + // Read in the next source line + textFile.readString(sLine); + + // Write out the index entry for the string + txxNtp.writeWord(indis); + txxNtp.writeByte(point); + + // Loop through writing out the characters to the compressed data buffer + char *s = sLine; + while (*s) { + compressCharacter(*s, indis, point, strData); + ++s; + } + } + + // Write out the compressed data + if (point != 16) + ++indis; + txxInp.write(strData, indis); + + // Close the files + txxInp.close(); + txxNtp.close(); + textFile.close(); +} + + +int main(int argc, char *argv[]) { + if (argc != 3) { + printf("Format: %s export|import output_file\n", argv[0]); + printf("The program must be run from the directory with the Mortville Manor game files.\n"); + exit(0); + } + + // Do the processing + if (!strcmp(argv[1], "export")) + export_strings(argv[2]); + else if (!strcmp(argv[1], "import")) + import_strings(argv[2]); + else + printf("Unknown operation specified\n"); +} diff --git a/devtools/extract_mort/module.mk b/devtools/extract_mort/module.mk new file mode 100644 index 0000000000..cbdcd251d9 --- /dev/null +++ b/devtools/extract_mort/module.mk @@ -0,0 +1,11 @@ + +MODULE := devtools/extract_mort + +MODULE_OBJS := \ + extract_mort.o \ + +# Set the name of the executable +TOOL_EXECUTABLE := extract_mort + +# Include common rules +include $(srcdir)/rules.mk -- cgit v1.2.3 From 42ff1a89db077ede823425c75339ad235f047916 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 Jan 2012 22:16:15 +1100 Subject: MORTEVIELLE: Minor bugfixes to string extraction tool --- devtools/extract_mort/extract_mort.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index 9e5641759b..192ea50723 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -296,6 +296,9 @@ static void export_strings(const char *textFilename) { printf("Extracted string exceeded allowed buffer size.\n"); exit(1); } + + if (indis >= (txxInp.size() / 2)) + endFlag = true; } while (!endFlag); // Write out the string @@ -347,7 +350,7 @@ static void import_strings(const char *textFilename) { // Write out the compressed data if (point != 16) ++indis; - txxInp.write(strData, indis); + txxInp.write(strData, indis * 2); // Close the files txxInp.close(); -- cgit v1.2.3 From 3a2cd5a223bb7097acddc7acda95298db20bf1f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Feb 2012 11:02:29 +1100 Subject: MORTEVIELLE: In progress implementation of PC Speaker music player --- engines/mortevielle/mortevielle.cpp | 19 ++++- engines/mortevielle/mortevielle.h | 3 + engines/mortevielle/ovd1.cpp | 4 +- engines/mortevielle/parole.cpp | 3 +- engines/mortevielle/parole2.cpp | 4 +- engines/mortevielle/sound.cpp | 144 +++++++++++++++++++++++++++++++++++- engines/mortevielle/sound.h | 76 ++++++++++++++++++- engines/mortevielle/var_mor.cpp | 5 -- engines/mortevielle/var_mor.h | 4 - 9 files changed, 246 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 88a3ecd9e5..fde3d424c5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -37,7 +37,8 @@ namespace Mortevielle { MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): - Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { + Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"), + _soundManager(_mixer) { g_vm = this; _lastGameFrame = 0; _mouseClick = false; @@ -298,6 +299,22 @@ void MortevielleEngine::setMousePos(const Common::Point &pt) { _mousePos = newPoint; } +/** + * Delay by a given amount + */ +void MortevielleEngine::delay(int amount) { + uint32 endTime = g_system->getMillis() + amount; + + while (g_system->getMillis() < endTime) { + if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { + _lastGameFrame = g_system->getMillis(); + g_vm->_screenSurface.updateScreen(); + } + + g_system->delayMillis(10); + } +} + /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 75aaeda580..86ec947200 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -33,6 +33,7 @@ #include "common/error.h" #include "graphics/surface.h" #include "mortevielle/graphics.h" +#include "mortevielle/sound.h" namespace Mortevielle { @@ -67,6 +68,7 @@ public: PaletteManager _paletteManager; GfxSurface _backgroundSurface; Common::RandomSource _randomSource; + SoundManager _soundManager; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -80,6 +82,7 @@ public: void setMousePos(const Common::Point &pt); bool getMouseClick() const { return _mouseClick; } void setMouseClick(bool v) { _mouseClick = v; } + void delay(int amount); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 3c23a62b28..bfa6f47790 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -339,7 +339,7 @@ void ani50() { fic.read(&mem[0x47a0 * 16 + 0], 123); fic.close(); - demus(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); + g_vm->_soundManager.demus(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); addfix = (float)((tempo_mus - addv[1])) / 256; cctable(tbi); @@ -347,7 +347,7 @@ void ani50() { k = 0; do { fin = keypressed(); - musyc(tbi, 9958 , tempo_mus); + g_vm->_soundManager.musyc(tbi, 9958 , tempo_mus); k = k + 1; fin = fin | keypressed() | (k >= 5); } while (!fin); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 768b021454..ba43b5955d 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -28,6 +28,7 @@ #include "common/file.h" #include "mortevielle/parole.h" #include "mortevielle/sound.h" +#include "mortevielle/mortevielle.h" namespace Mortevielle { @@ -129,7 +130,7 @@ void veracf(byte b) { f.read(&mem[0x7414 * 16 + 0], 273); /*blockread(f,mem[adson * 16+0],300); blockread(f,mem[adson * 16+2400+0],245);*/ - demus(&mem[0x7414 * 16], &mem[adson * 16], 273); + g_vm->_soundManager.demus(&mem[0x7414 * 16], &mem[adson * 16], 273); f.close(); } diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index cba5588ffc..e0aaf83af0 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -29,6 +29,8 @@ #include "mortevielle/level15.h" #include "mortevielle/parole2.h" #include "mortevielle/parole.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/sound.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -116,7 +118,7 @@ void parole(int rep, int ht, int typ) { break; } trait_ph(); - litph(tbi, typ, tempo); + g_vm->_soundManager.litph(tbi, typ, tempo); if (typlec != 0) for (i = 0; i <= 500; i ++) { t_cph[i] = savph[i]; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index f2b70cf8ee..08dbe0ba02 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -27,15 +27,125 @@ #include "common/scummsys.h" #include "mortevielle/sound.h" +#include "mortevielle/mortevielle.h" namespace Mortevielle { +/** + * Constructor + */ +PCSpeaker::PCSpeaker(int rate) { + _rate = rate; + _oscLength = 0; + _oscSamples = 0; + _remainingSamples = 0; + _volume = 255; +} + +/** + * Destructor + */ +PCSpeaker::~PCSpeaker() { +} + +/** + * Adds a new note to the queue of notes to be played. + */ +void PCSpeaker::play(int freq, uint32 length) { + assert((freq > 0) && (length > 0)); + Common::StackLock lock(_mutex); + + _pendingNotes.push(SpeakerNote(freq, length)); +} + +/** + * Stops the currently playing song + */ +void PCSpeaker::stop() { + Common::StackLock lock(_mutex); + + _remainingSamples = 0; + _pendingNotes.clear(); +} + +void PCSpeaker::setVolume(byte volume) { + _volume = volume; +} + +/** + * Return true if a song is currently playing + */ +bool PCSpeaker::isPlaying() const { + return !_pendingNotes.empty() || (_remainingSamples != 0); +} + +/** + * Method used by the mixer to pull off pending samples to play + */ +int PCSpeaker::readBuffer(int16 *buffer, const int numSamples) { + Common::StackLock lock(_mutex); + + int i; + + for (i = 0; (_remainingSamples || !_pendingNotes.empty()) && (i < numSamples); i++) { + if (!_remainingSamples) + // Used up the current note, so queue the next one + dequeueNote(); + + buffer[i] = generateSquare(_oscSamples, _oscLength) * _volume; + if (_oscSamples++ >= _oscLength) + _oscSamples = 0; + + _remainingSamples--; + } + + // Clear the rest of the buffer + if (i < numSamples) + memset(buffer + i, 0, (numSamples - i) * sizeof(int16)); + + return numSamples; +} + +/** + * Dequeues a note from the pending note list + */ +void PCSpeaker::dequeueNote() { + SpeakerNote note = _pendingNotes.pop(); + + _oscLength = _rate / note.freq; + _oscSamples = 0; + _remainingSamples = (_rate * note.length) / 1000000; + assert((_oscLength > 0) && (_remainingSamples > 0)); +} + +/** + * Support method for generating a square wave + */ +int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { + return (x < (oscLength / 2)) ? 127 : -128; +} + +/*-------------------------------------------------------------------------*/ + const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; +SoundManager::SoundManager(Audio::Mixer *mixer) { + _mixer = mixer; + _speakerStream = new PCSpeaker(mixer->getOutputRate()); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, + _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); +} + +SoundManager::~SoundManager() { + _mixer->stopHandle(_speakerHandle); + delete _speakerStream; + +} + /** * Decode music data */ -void demus(const byte *PSrc, byte *PDest, int NbreSeg) { +void SoundManager::demus(const byte *PSrc, byte *PDest, int NbreSeg) { int seed = 128; int v; @@ -53,4 +163,36 @@ void demus(const byte *PSrc, byte *PDest, int NbreSeg) { } } +void SoundManager::litph(tablint &t, int typ, int tempo) { + return; +} + +void SoundManager::playNote(int frequency, int32 length) { + _speakerStream->play(frequency, length); +} + + +void SoundManager::musyc(tablint &tb, int nbseg, int att) { +#ifdef DEBUG + const byte *pSrc = &mem[0x5000 * 16]; + + // Convert the countdown amount to a tempo rate, and then to note length in microseconds + int tempo = 1193180 / att; + int length = 1000000 / tempo; + + for (int noteIndex = 0; noteIndex < (nbseg * 16); ++noteIndex) { + int lookupValue = *pSrc++; + int noteCountdown = tb[lookupValue]; + int noteFrequency = 1193180 / noteCountdown; + + playNote(noteFrequency, length); + } + + // Keep waiting until the song has been finished + while (_speakerStream->isPlaying() && !g_vm->shouldQuit()) { + g_vm->delay(10); + } +#endif +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 6e4f7b2a4d..f089974c6b 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -28,9 +28,83 @@ #ifndef MORTEVIELLE_SOUND_H #define MORTEVIELLE_SOUND_H +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "common/mutex.h" +#include "common/queue.h" +#include "mortevielle/var_mor.h" + namespace Mortevielle { -extern void demus(const byte *PSrc, byte *PDest, int NbreSeg); +/** + * Structure used to store pending notes to play + */ +struct SpeakerNote { + int freq; + uint32 length; + + SpeakerNote(int noteFreq, uint32 noteLength) { + freq = noteFreq; + length = noteLength; + } +}; + +/** + * This is a modified PC Speaker class that allows the queueing of an entire song + * sequence one note at a time. + */ +class PCSpeaker : public Audio::AudioStream { +private: + Common::Queue _pendingNotes; + Common::Mutex _mutex; + + int _rate; + uint32 _oscLength; + uint32 _oscSamples; + uint32 _remainingSamples; + uint32 _mixedSamples; + byte _volume; + + void dequeueNote(); +protected: + static int8 generateSquare(uint32 x, uint32 oscLength); +public: + PCSpeaker(int rate = 44100); + ~PCSpeaker(); + + /** Play a note for length microseconds. + */ + void play(int freq, uint32 length); + /** Stop the currently playing sequence */ + void stop(); + /** Adjust the volume. */ + void setVolume(byte volume); + + bool isPlaying() const; + + int readBuffer(int16 *buffer, const int numSamples); + + bool isStereo() const { return false; } + bool endOfData() const { return false; } + bool endOfStream() const { return false; } + int getRate() const { return _rate; } +}; + +class SoundManager { +private: + Audio::Mixer *_mixer; + PCSpeaker *_speakerStream; + Audio::SoundHandle _speakerHandle; +public: + SoundManager(Audio::Mixer *mixer); + ~SoundManager(); + + void playNote(int frequency, int32 length); + + void demus(const byte *PSrc, byte *PDest, int NbreSeg); + void litph(tablint &t, int typ, int tempo); + void musyc(tablint &tb, int nbseg, int att); +}; } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 38a374e82b..bd432124db 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -359,9 +359,4 @@ void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } -// (* external 'c:\mc\phint.com'; *) -void litph(tablint &t, int typ, int tempo) { - warning("TODO: litph"); -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index b8a18a1253..5d62e77a1c 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -454,10 +454,6 @@ extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); extern void decomp(int seg, int dep); // (* external 'c:\mc\affich.com'; *) extern void afff(int Gd, int seg, int dep, int x, int y); -// (* external 'c:\mc\reusint.com'; *) -extern void musyc(tablint &tb, int nbseg, int att); -// (* external 'c:\mc\phint.com'; *) -extern void litph(tablint &t, int typ, int tempo); } // End of namespace Mortevielle -- cgit v1.2.3 From 4a34f4036544c9cb137237dbf5f23d8a5d2eafa1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Feb 2012 21:17:12 +1100 Subject: MORTEVIELLE: Replace timer chip frequency values with a constant --- engines/mortevielle/sound.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 08dbe0ba02..0a6e7e8d8d 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -129,6 +129,9 @@ int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; +// The PC timer chip works at a frequency of 1.19318Mhz +#define TIMER_FREQUENCY 1193180 + SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; _speakerStream = new PCSpeaker(mixer->getOutputRate()); @@ -177,13 +180,13 @@ void SoundManager::musyc(tablint &tb, int nbseg, int att) { const byte *pSrc = &mem[0x5000 * 16]; // Convert the countdown amount to a tempo rate, and then to note length in microseconds - int tempo = 1193180 / att; + int tempo = TIMER_FREQUENCY / att; int length = 1000000 / tempo; for (int noteIndex = 0; noteIndex < (nbseg * 16); ++noteIndex) { int lookupValue = *pSrc++; int noteCountdown = tb[lookupValue]; - int noteFrequency = 1193180 / noteCountdown; + int noteFrequency = TIMER_FREQUENCY / noteCountdown; playNote(noteFrequency, length); } -- cgit v1.2.3 From 3d9da88539bdd776d77b6accce6e77daffb72067 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Feb 2012 22:40:06 +1100 Subject: MORTEVIELLE: Merged mort.cpp into mortevielle.cpp, and split up intro from main game --- engines/mortevielle/module.mk | 1 - engines/mortevielle/mort.cpp | 149 ------------------------------------ engines/mortevielle/mort.h | 39 ---------- engines/mortevielle/mortevielle.cpp | 102 +++++++++++++++++++++++- engines/mortevielle/mortevielle.h | 3 + 5 files changed, 102 insertions(+), 192 deletions(-) delete mode 100644 engines/mortevielle/mort.cpp delete mode 100644 engines/mortevielle/mort.h diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index b977c25273..2d16106e0c 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -14,7 +14,6 @@ MODULE_OBJS := \ menu.o \ mor.o \ mor2.o \ - mort.o \ mortevielle.o \ mouse.o \ outtext.o \ diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp deleted file mode 100644 index 766ae3c429..0000000000 --- a/engines/mortevielle/mort.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/mort.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" /* les variables */ //Translation: Variables -#include "mortevielle/asm.h" -#include "mortevielle/keyboard.h" /* la gestion du clavier */ //Translation: Keyboard manager -#include "mortevielle/mouse.h" /* la souris */ //Translation: Mouse -#include "mortevielle/level15.h" /* les fonctions de base */ //Translation: Lowlevel functions -#include "mortevielle/droite.h" /* pour faire une droite */ //Translation: Display a lign -#include "mortevielle/boite.h" //Translation: Box -#include "mortevielle/sprint.h" /* l'affichage des textes */ //Translation: Display texts -#include "mortevielle/outtext.h" /* fonctions sup‚rieures d'affichage */ //Translation: Highlevel display functions -#include "mortevielle/parole.h" /* les fonctions de la parole */ //Translation: Speech functions -#include "mortevielle/alert.h" -#include "mortevielle/parole2.h" /* les fonctions de la parole */ //Translation: Speech functions -/* debug le debugging */ //Translation: Debugger -#include "mortevielle/ques.h" /* les questions */ //Translation: Questions -#include "mortevielle/menu.h" /* les fonctions du menu */ //Translation: Menu functions -#include "mortevielle/mor.h" /* divers */ //Translation: Misc -#include "mortevielle/taffich.h" /* chargement des dessins */ //Translation: pictures loader -#include "mortevielle/ovd1.h" /* les fonctions sur disque 1 */ //Translation: Disk functions -#include "mortevielle/mor2.h" /* divers */ //Translation: Misc -#include "mortevielle/actions.h" /* les actions */ //Translation: Actions -#include "mortevielle/prog.h" /* fonctions toplevel */ //Translation: toplevel functions -#include "mortevielle/disk.h" /* chargements et sauvegardes */ //Translation: Load/Save -/* ecrihexa utilitaire */ //Translation: Toolbox - -namespace Mortevielle { - -void divers(int np, bool b) { - teskbd(); - do { - parole(np, 0, 0); - atf3f8(key); - CHECK_QUIT; - - if (newgd != gd) { - gd = newgd; - hirs(); - aff50(b); - } - } while (!(key == 66)); -} - -/* NIVEAU 0 */ - -void mortevielle_main() { - /*init_debug;*/ - /* ecri_seg;*/ - //pio_initialize(argc, argv); - gd = ega; - newgd = gd; - zuul = false; - tesok = false; - chartex(); - charpal(); - charge_cfiph(); - charge_cfiec(); - zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - c_zzz = 1; - init_nbrepm(); - init_mouse(); - /* crep:=WRITE_LE_UINT16(&mem[$7f00:0]; - WRITE_LE_UINT16(&mem[$7f00:0]:= crep+1; - if (WRITE_LE_UINT16(&mem[$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); - CHECK_QUIT; - - ani50(); - divers(143, true); - CHECK_QUIT; - - suite(); - music(); - adzon(); - takesav(0); - if (rech_cfiec) charge_cfiec(); - for (crep = 1; crep <= c_zzz; crep ++) - zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - charge_bruit5(); - init_menu(); - - theure(); - dprog(); - hirs(); - dessine_rouleau(); - show_mouse(); - do { - tjouer(); - CHECK_QUIT; - } while (!arret); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/mort.h b/engines/mortevielle/mort.h deleted file mode 100644 index d313e32b78..0000000000 --- a/engines/mortevielle/mort.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_MORT_H -#define MORTEVIELLE_MORT_H - -namespace Mortevielle { - -extern void divers(int np, bool b); -/* NIVEAU 0 */ -extern void mortevielle_main(); - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index fde3d424c5..35d71c92aa 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -28,8 +28,16 @@ #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/mort.h" +#include "mortevielle/asm.h" +#include "mortevielle/disk.h" +#include "mortevielle/keyboard.h" +#include "mortevielle/level15.h" +#include "mortevielle/mor.h" +#include "mortevielle/mor2.h" #include "mortevielle/mouse.h" +#include "mortevielle/ovd1.h" +#include "mortevielle/parole2.h" +#include "mortevielle/prog.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -77,6 +85,36 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); + /*init_debug;*/ + /* ecri_seg;*/ + //pio_initialize(argc, argv); + gd = ega; + newgd = gd; + zuul = false; + tesok = false; + chartex(); + charpal(); + charge_cfiph(); + charge_cfiec(); + zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + c_zzz = 1; + init_nbrepm(); + init_mouse(); + + init_lieu(); + arret = false; + sonoff = false; + f2_all = false; + textcolor(9); + teskbd(); + dialpre(); + newgd = gd; + teskbd(); + if (newgd != gd) + gd = newgd; + hirs(); + ades = 0x7000; + return Common::kNoError; } @@ -323,10 +361,68 @@ Common::Error MortevielleEngine::run() { if (err != Common::kNoError) return err; - // Dispatch to the game's main routine - mortevielle_main(); + // Show the game introduction + showIntroduction(); + + adzon(); + takesav(0); + + mainGame(); return Common::kNoError; } +/** + * Show the game introduction + */ +void MortevielleEngine::showIntroduction() { + aff50(false); + mlec = 0; + divers(142, false); + CHECK_QUIT; + + ani50(); + divers(143, true); + CHECK_QUIT; + + suite(); + music(); +} + +void MortevielleEngine::divers(int np, bool b) { + teskbd(); + do { + parole(np, 0, 0); + atf3f8(key); + CHECK_QUIT; + + if (newgd != gd) { + gd = newgd; + hirs(); + aff50(b); + } + } while (!(key == 66)); +} + +/** + * Main game loop + */ +void MortevielleEngine::mainGame() { + if (rech_cfiec) charge_cfiec(); + for (crep = 1; crep <= c_zzz; crep ++) + zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + charge_bruit5(); + init_menu(); + + theure(); + dprog(); + hirs(); + dessine_rouleau(); + show_mouse(); + do { + tjouer(); + CHECK_QUIT; + } while (!arret); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 86ec947200..863cbdb95e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -63,6 +63,9 @@ private: bool handleEvents(); void addKeypress(Common::Event &evt); void initMouse(); + void showIntroduction(); + void mainGame(); + void divers(int np, bool b); public: ScreenSurface _screenSurface; PaletteManager _paletteManager; -- cgit v1.2.3 From 80302552e830c043f16b1860573ee8cc47232385 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Feb 2012 22:48:16 +1100 Subject: MORTEVIELLE: Moved the game detection entries to detection_tables.h --- engines/mortevielle/detection.cpp | 32 +------------------------------- engines/mortevielle/detection_tables.h | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 53d4292392..ec0b01622a 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -35,39 +35,9 @@ static const PlainGameDescriptor MortevielleGame[] = { {0, 0} }; -static const ADGameDescription MortevielleGameDescriptions[] = { - { - "mortevielle", - "", - { - {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::FR_FRA, - Common::kPlatformPC, - ADGF_NO_FLAGS, - GUIO0() - }, - { - "mortevielle", - "", - { - {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::DE_DEU, - Common::kPlatformPC, - ADGF_NO_FLAGS, - GUIO0() - }, - AD_TABLE_END_MARKER -}; - class MortevielleMetaEngine : public AdvancedMetaEngine { public: - MortevielleMetaEngine() : AdvancedMetaEngine(MortevielleGameDescriptions, sizeof(ADGameDescription), + MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::MortevielleGameDescriptions, sizeof(ADGameDescription), MortevielleGame) { _md5Bytes = 512; _singleid = "mortevielle"; diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 4ea062b2b2..7ceb40d524 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -22,15 +22,32 @@ namespace Mortevielle { -static const ADGameDescription gameDescriptions[] = { +static const ADGameDescription MortevielleGameDescriptions[] = { { "mortevielle", "", - AD_ENTRY1s("mortvielle.txt", "d41d8cd98f00b204e9800998ecf8427e", 0), + { + {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, Common::FR_FRA, Common::kPlatformPC, - ADGF_UNSTABLE, - GUIO1(GUIO_NOASPECT) + ADGF_NO_FLAGS, + GUIO0() + }, + { + "mortevielle", + "", + { + {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO0() }, AD_TABLE_END_MARKER }; -- cgit v1.2.3 From bae25fc2aab4fe0438b59dba4ac507ce6462a0e1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 12:34:51 +1100 Subject: MORTEVIELLE: Implemented ScummVM savegame functionality with metadata --- engines/mortevielle/detection.cpp | 27 ++- engines/mortevielle/disk.cpp | 157 ------------------ engines/mortevielle/disk.h | 39 ----- engines/mortevielle/module.mk | 2 +- engines/mortevielle/mortevielle.cpp | 181 +++++++++++++++++++- engines/mortevielle/mortevielle.h | 9 + engines/mortevielle/prog.cpp | 105 ------------ engines/mortevielle/prog.h | 2 - engines/mortevielle/saveload.cpp | 318 ++++++++++++++++++++++++++++++++++++ engines/mortevielle/saveload.h | 66 ++++++++ 10 files changed, 596 insertions(+), 310 deletions(-) delete mode 100644 engines/mortevielle/disk.cpp delete mode 100644 engines/mortevielle/disk.h create mode 100644 engines/mortevielle/saveload.cpp create mode 100644 engines/mortevielle/saveload.h diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index ec0b01622a..35e5cada81 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -25,6 +25,7 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/detection_tables.h" +#include "mortevielle/saveload.h" namespace Mortevielle { uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->flags; } @@ -52,6 +53,9 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; + virtual int getMaximumSaveSlot() const; + virtual SaveStateList listSaves(const char *target) const; + virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; bool MortevielleMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -62,9 +66,30 @@ bool MortevielleMetaEngine::createInstance(OSystem *syst, Engine **engine, const } bool MortevielleMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + switch (f) { + case kSupportsListSaves: + case kSupportsDeleteSave: + case kSupportsLoadingDuringStartup: + case kSavesSupportMetaInfo: + case kSavesSupportThumbnail: + case kSavesSupportCreationDate: + return true; + default: + return false; + } +} + +int MortevielleMetaEngine::getMaximumSaveSlot() const { return 99; } + +SaveStateList MortevielleMetaEngine::listSaves(const char *target) const { + return Mortevielle::SavegameManager::listSaves(target); } +SaveStateDescriptor MortevielleMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + return Mortevielle::SavegameManager::querySaveMetaInfos(slot); +} + + #if PLUGIN_ENABLED_DYNAMIC(MORTEVIELLE) REGISTER_PLUGIN_DYNAMIC(MORTEVIELLE, PLUGIN_TYPE_ENGINE, MortevielleMetaEngine); #else diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp deleted file mode 100644 index 25bf7faca3..0000000000 --- a/engines/mortevielle/disk.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "common/system.h" -#include "common/savefile.h" -#include "common/serializer.h" -#include "mortevielle/alert.h" -#include "mortevielle/disk.h" -#include "mortevielle/mor.h" -#include "mortevielle/mor2.h" -#include "mortevielle/mouse.h" -#include "mortevielle/ovd1.h" -#include "mortevielle/prog.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/** - * Ensure disk 1 data is available - */ -void dem1() { -/* Deprecated in ScummVM - int k; - - // -- demande de disk 1 -- //Translation: Ask for 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); - */ -} - -/** - * Handle saving or loading savegame data - */ -static void sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(s1.conf); - sz.syncBytes((byte *)&s1.pourc[0], 11); - sz.syncBytes((byte *)&s1.teauto[0], 43); - sz.syncBytes((byte *)&s1.sjer[0], 31); - sz.syncAsSint16LE(s1.mlieu); - sz.syncAsSint16LE(s1.iboul); - sz.syncAsSint16LE(s1.ibag); - sz.syncAsSint16LE(s1.icave); - sz.syncAsSint16LE(s1.ivier); - sz.syncAsSint16LE(s1.ipuit); - sz.syncAsSint16LE(s1.derobj); - sz.syncAsSint16LE(s1.iloic); - sz.syncAsSint16LE(s1.icryp); - sz.syncAsByte(s1.ipre); - sz.syncAsByte(s1.heure); - - sz.syncBytes(bufcha, 391); -} - -void takesav(int n) { - int i; - Common::String st; - - dem1(); - // -- Load the file 'sauve#n.mor' - Common::String saveName = Common::String::format("sav%d.mor", n); - - // Try loading first from the save area - Common::SeekableReadStream *stream = g_system->getSavefileManager()->openForLoading(saveName); - - // If not present, try loading from the program folder - Common::File f; - if (stream == NULL) { - if (!f.open(saveName)) - error("Unable to open save file '%s'", saveName); - - stream = f.readStream(f.size()); - f.close(); - } - - Common::Serializer sz(stream, NULL); - sync_save(sz); - - s = s1; - for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; - - // Close the stream - delete stream; -} - -void ld_game(int n) { - hide_mouse(); - maivid(); - takesav(n); - /* -- disquette 2 -- */ //Translation: Floppy #2 - dem2(); - /* -- mises en place -- */ //Translation: Initialization - theure(); - dprog(); - antegame(); - show_mouse(); -} - -void sv_game(int n) { - Common::OutSaveFile *f; - int i; - - hide_mouse(); - tmaj3(); - dem1(); - /* -- sauvegarde du fichier 'sauve#n.mor' -- */ //Translation: save file 'sauve%d.mor' - for (i = 0; i <= 389; i ++) bufcha[i] = tabdon[i + acha]; - s1 = s; - if (s1.mlieu == 26) s1.mlieu = 15; - - Common::String saveName = Common::String::format("sav%d.mor", n); - f = g_system->getSavefileManager()->openForSaving(saveName); - - Common::Serializer sz(NULL, f); - sync_save(sz); - - f->finalize(); - delete f; - - dem2(); - show_mouse(); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/disk.h b/engines/mortevielle/disk.h deleted file mode 100644 index 06df8e029a..0000000000 --- a/engines/mortevielle/disk.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_DISK_H -#define MORTEVIELLE_DISK_H - -namespace Mortevielle { - -extern void dem1(); -extern void takesav(int n); -extern void ld_game(int n); -extern void sv_game(int n); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 2d16106e0c..28c6c7fc6d 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -6,7 +6,6 @@ MODULE_OBJS := \ asm.o \ boite.o \ detection.o \ - disk.o \ droite.o \ graphics.o \ keyboard.o \ @@ -22,6 +21,7 @@ MODULE_OBJS := \ parole2.o \ prog.o \ ques.o \ + saveload.o \ sound.o \ sprint.o \ taffich.o \ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 35d71c92aa..cbe2613716 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/config-manager.h" #include "common/debug-channels.h" #include "engines/util.h" #include "engines/engine.h" @@ -28,16 +29,20 @@ #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/actions.h" +#include "mortevielle/alert.h" #include "mortevielle/asm.h" -#include "mortevielle/disk.h" #include "mortevielle/keyboard.h" #include "mortevielle/level15.h" +#include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole2.h" #include "mortevielle/prog.h" +#include "mortevielle/saveload.h" +#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -50,15 +55,58 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g g_vm = this; _lastGameFrame = 0; _mouseClick = false; + _inMainGameLoop = false; } MortevielleEngine::~MortevielleEngine() { } +/** + * Specifies whether the engine supports given features + */ bool MortevielleEngine::hasFeature(EngineFeature f) const { - return false; + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + +/** + * Return true if a game can currently be loaded + */ +bool MortevielleEngine::canLoadGameStateCurrently() { + // Saving is only allowed in the main game event loop + return _inMainGameLoop; } +/** + * Return true if a game can currently be saved + */ +bool MortevielleEngine::canSaveGameStateCurrently() { + // Loading is only allowed in the main game event loop + return _inMainGameLoop; +} + +/** + * Load in a savegame at the specified slot number + */ +Common::Error MortevielleEngine::loadGameState(int slot) { + return _savegameManager.loadGame(slot); +} + +/** + * Save the current game + */ +Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &desc) { + if (slot == 0) + return Common::kWritingFailed; + + return _savegameManager.saveGame(slot, desc); +} + +/** + * Initialise the game state + */ Common::ErrorCode MortevielleEngine::initialise() { // Initialise graphics mode initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); @@ -361,12 +409,23 @@ Common::Error MortevielleEngine::run() { if (err != Common::kNoError) return err; - // Show the game introduction - showIntroduction(); + // Check for a savegame + int loadSlot = 0; + if (ConfMan.hasKey("save_slot")) { + int gameToLoad = ConfMan.getInt("save_slot"); + if (gameToLoad >= 1 && gameToLoad <= 999) + loadSlot = gameToLoad; + } + + if (loadSlot == 0) + // Show the game introduction + showIntroduction(); + // Either load the initial game state savegame, or the specified savegame number adzon(); - takesav(0); + _savegameManager.takesav(loadSlot); + // Run the main game loop mainGame(); return Common::kNoError; @@ -425,4 +484,116 @@ void MortevielleEngine::mainGame() { } while (!arret); } +/** + * This method handles repeatedly calling a sub-method to wait for a user action and then handling it + */ +void MortevielleEngine::tjouer() { + antegame(); + do { + tecran(); + CHECK_QUIT; + } while (!((arret) || (solu) || (perdu))); + if (solu) + tmaj1(); + else if (perdu) + tencore(); +} + +/** + * Waits for the user to select an action, and then handles it + */ +void MortevielleEngine::tecran() { + const char idem[] = "Idem"; + const int lim = 20000; + int temps = 0; + char inkey = '\0'; + bool oo, funct = 0; + + clsf3(); + oo = false; + ctrm = 0; + if (! iesc) { + draw_menu(); + imen = true; + temps = 0; + key = 0; + funct = false; + inkey = '.'; + + _inMainGameLoop = true; + do { + mdn(); + tinke(); + mov_mouse(funct, inkey); + CHECK_QUIT; + temps = temps + 1; + } while (!((choisi) || (temps > lim) || (funct) || (anyone))); + _inMainGameLoop = false; + + erase_menu(); + imen = false; + if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { + change_gd((uint)pred(int, ord(inkey)) >> 1); + return; + } + if (choisi && (msg[3] == sauve)) { + Common::String saveName = Common::String::format("Savegame #%d", msg[4] & 7); + g_vm->_savegameManager.saveGame(msg[4] & 7, saveName); + } + if (choisi && (msg[3] == charge)) + g_vm->_savegameManager.loadGame((msg[4] & 7) - 1); + 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(); + } + } +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 863cbdb95e..6dad5a0a79 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -33,6 +33,7 @@ #include "common/error.h" #include "graphics/surface.h" #include "mortevielle/graphics.h" +#include "mortevielle/saveload.h" #include "mortevielle/sound.h" namespace Mortevielle { @@ -56,6 +57,7 @@ private: uint32 _lastGameFrame; bool _mouseClick; Common::Point _mousePos; + bool _inMainGameLoop; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); @@ -65,6 +67,8 @@ private: void initMouse(); void showIntroduction(); void mainGame(); + void tjouer(); + void tecran(); void divers(int np, bool b); public: ScreenSurface _screenSurface; @@ -72,10 +76,15 @@ public: GfxSurface _backgroundSurface; Common::RandomSource _randomSource; SoundManager _soundManager; + SavegameManager _savegameManager; public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; + virtual bool canLoadGameStateCurrently(); + virtual bool canSaveGameStateCurrently(); + virtual Common::Error loadGameState(int slot); + virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); uint32 getGameFlags() const; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 5f2fd3cb65..ba2c4ded91 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -219,100 +219,6 @@ L2: mennor(); } -void sv_game(int n); - -void ld_game(int n); - -void tecran() { - const char idem[] = "Idem"; - const int lim = 20000; - int temps = 0; - char inkey = '\0'; - bool oo, funct = 0; - - 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); - CHECK_QUIT; - temps = temps + 1; - } while (!((choisi) || (temps > lim) || (funct) || (anyone))); - - erase_menu(); - imen = false; - if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - change_gd((uint)pred(int, ord(inkey)) >> 1); - return; - } - if (choisi && (msg[3] == sauve)) - sv_game(msg[4] & 7); - if (choisi && (msg[3] == charge)) - ld_game((msg[4] & 7) - 1); - 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() { @@ -326,15 +232,4 @@ void theure() { else min = 0; } - -void tjouer() { - antegame(); - do { - tecran(); - CHECK_QUIT; - } while (!((arret) || (solu) || (perdu))); - if (solu) tmaj1(); - else if (perdu) tencore(); -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h index fbcd92f469..f51b2214b7 100644 --- a/engines/mortevielle/prog.h +++ b/engines/mortevielle/prog.h @@ -37,11 +37,9 @@ extern void antegame(); /* procedure PROGRAMME */ extern void tmaj3(); extern void tsitu(); -extern void tecran(); /* NIVEAU 1 */ extern void theure(); -extern void tjouer(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp new file mode 100644 index 0000000000..d0cd603845 --- /dev/null +++ b/engines/mortevielle/saveload.cpp @@ -0,0 +1,318 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/file.h" +#include "common/system.h" +#include "mortevielle/alert.h" +#include "mortevielle/mor.h" +#include "mortevielle/mor2.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/mouse.h" +#include "mortevielle/ovd1.h" +#include "mortevielle/prog.h" +#include "mortevielle/saveload.h" +#include "mortevielle/var_mor.h" + +namespace Mortevielle { + +static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; + +Common::String SavegameManager::generateSaveName(int slotNumber) { + return Common::String::format("sav%d.mor", slotNumber); +} + +/** + * Handle saving or loading savegame data + */ +void SavegameManager::sync_save(Common::Serializer &sz) { + sz.syncAsSint16LE(s1.conf); + sz.syncBytes((byte *)&s1.pourc[0], 11); + sz.syncBytes((byte *)&s1.teauto[0], 43); + sz.syncBytes((byte *)&s1.sjer[0], 31); + sz.syncAsSint16LE(s1.mlieu); + sz.syncAsSint16LE(s1.iboul); + sz.syncAsSint16LE(s1.ibag); + sz.syncAsSint16LE(s1.icave); + sz.syncAsSint16LE(s1.ivier); + sz.syncAsSint16LE(s1.ipuit); + sz.syncAsSint16LE(s1.derobj); + sz.syncAsSint16LE(s1.iloic); + sz.syncAsSint16LE(s1.icryp); + sz.syncAsByte(s1.ipre); + sz.syncAsByte(s1.heure); + + sz.syncBytes(bufcha, 391); +} + +/** + * Inner code for loading a saved game + */ +void SavegameManager::takesav(int n) { + int i; + Common::String st; + + // -- Load the file + Common::String filename = generateSaveName(n); + + // Try loading first from the save area + Common::SeekableReadStream *stream = g_system->getSavefileManager()->openForLoading(filename); + + // If not present, try loading from the program folder + Common::File f; + if (stream == NULL) { + if (!f.open(filename)) + error("Unable to open save file '%s'", filename); + + stream = f.readStream(f.size()); + f.close(); + } + + // Check whether it's a ScummVM saved game + char buffer[4]; + stream->read(buffer, 4); + if (!strncmp(&buffer[0], &SAVEGAME_ID[0], 4)) { + // Yes, it is, so skip over the savegame header + SavegameHeader header; + readSavegameHeader(stream, header); + delete header.thumbnail; + } else { + stream->seek(0); + } + + // Read the game contents + Common::Serializer sz(stream, NULL); + sync_save(sz); + + s = s1; + for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; + + // Close the stream + delete stream; +} + +/** + * Load a saved game + */ +Common::Error SavegameManager::loadGame(int n) { + hide_mouse(); + maivid(); + takesav(n); + + /* Initialization */ + theure(); + dprog(); + antegame(); + show_mouse(); + return Common::kNoError; +} + +/** + * Save the game + */ +Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { + Common::OutSaveFile *f; + int i; + + hide_mouse(); + tmaj3(); + + for (i = 0; i <= 389; i ++) + bufcha[i] = tabdon[i + acha]; + s1 = s; + if (s1.mlieu == 26) + s1.mlieu = 15; + + Common::String filename = generateSaveName(n); + f = g_system->getSavefileManager()->openForSaving(filename); + + // Write out the savegame header + f->write(&SAVEGAME_ID[0], 4); + + // Write out the header + SavegameHeader header; + writeSavegameHeader(f, saveName); + + // Write out the savegame contents + Common::Serializer sz(NULL, f); + sync_save(sz); + + // Close the save file + f->finalize(); + delete f; + + dem2(); + show_mouse(); + return Common::kNoError; +} + +void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName) { + // Write out a savegame header + out->writeByte(SAVEGAME_VERSION); + + // Write savegame name + out->writeString(saveName); + out->writeByte(0); + + // Get the active palette + uint8 thumbPalette[256 * 3]; + g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256); + + // Create a thumbnail and save it + Graphics::Surface *thumb = new Graphics::Surface(); + Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + + ::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); + Graphics::saveThumbnail(*out, *thumb); + thumb->free(); + delete thumb; + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + out->writeSint16LE(td.tm_year + 1900); + out->writeSint16LE(td.tm_mon + 1); + out->writeSint16LE(td.tm_mday); + out->writeSint16LE(td.tm_hour); + out->writeSint16LE(td.tm_min); +} + +bool SavegameManager::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header) { + header.thumbnail = NULL; + + // Get the savegame version + header.version = in->readByte(); + + // Read in the save name + header.saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') + header.saveName += ch; + + // Get the thumbnail + header.thumbnail = Graphics::loadThumbnail(*in); + if (!header.thumbnail) + return false; + + // Read in save date/time + header.saveYear = in->readSint16LE(); + header.saveMonth = in->readSint16LE(); + header.saveDay = in->readSint16LE(); + header.saveHour = in->readSint16LE(); + header.saveMinutes = in->readSint16LE(); + + return true; +} + +SaveStateList SavegameManager::listSaves(const char *target) { + Common::String pattern = "sav*.mor"; + Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern); + sort(files.begin(), files.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + for (Common::StringArray::const_iterator file = files.begin(); file != files.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + const Common::String &fname = *file; + int slotNumber = atoi(fname.c_str() + 3); + + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname); + if (in) { + // There can be two types of savegames: original interpreter savegames, and ScummVM savegames. + // Original interpreter savegames are 497 bytes, and still need to be supported because the + // initial game state is stored as a savegame + bool validFlag = false; + Common::String saveDescription; + + char buffer[4]; + in->read(buffer, 4); + if (!strncmp(&buffer[0], &SAVEGAME_ID[0], 4)) { + // ScummVm savegame. Read in the header to get the savegame name + SavegameHeader header; + validFlag = readSavegameHeader(in, header); + + if (validFlag) { + delete header.thumbnail; + saveDescription = header.saveName; + } + } else if (file->size() == 497) { + // Form an appropriate savegame name + saveDescription = (slotNumber == 0) ? "Initial game state" : + Common::String::format("Savegame #%d", slotNumber); + validFlag = true; + } + + if (validFlag) + // Got a valid savegame + saveList.push_back(SaveStateDescriptor(slotNumber, saveDescription)); + + delete in; + } + } + + return saveList; +} + +SaveStateDescriptor SavegameManager::querySaveMetaInfos(int slot) { + Common::String fileName = Mortevielle::SavegameManager::generateSaveName(slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); + + if (f) { + // Check to see if it's a ScummVM savegame or not + char buffer[4]; + f->read(buffer, 4); + + bool hasHeader = !strncmp(&buffer[0], &SAVEGAME_ID[0], 4); + + if (!hasHeader) { + // Original savegame perhaps? + delete f; + + SaveStateDescriptor desc(slot, Common::String::format("Savegame #%d", slot)); + desc.setDeletableFlag(slot != 0); + desc.setWriteProtectedFlag(slot == 0); + return desc; + } else { + // Get the savegame header information + SavegameHeader header; + readSavegameHeader(f, header); + delete f; + + // Create the return descriptor + SaveStateDescriptor desc(slot, header.saveName); + desc.setDeletableFlag(true); + desc.setWriteProtectedFlag(false); + desc.setThumbnail(header.thumbnail); + desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay); + desc.setSaveTime(header.saveHour, header.saveMinutes); + + return desc; + } + } + + return SaveStateDescriptor(); +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h new file mode 100644 index 0000000000..7f2edd8b53 --- /dev/null +++ b/engines/mortevielle/saveload.h @@ -0,0 +1,66 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_SAVELOAD_H +#define MORTEVIELLE_SAVELOAD_H + +#include "common/savefile.h" +#include "common/serializer.h" +#include "graphics/palette.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" + +#define SAVEGAME_VERSION 1 + +namespace Mortevielle { + +struct SavegameHeader { + uint8 version; + Common::String saveName; + Graphics::Surface *thumbnail; + int saveYear, saveMonth, saveDay; + int saveHour, saveMinutes; + int totalFrames; +}; + +class SavegameManager { +private: + void sync_save(Common::Serializer &sz); +public: + void takesav(int n); + Common::Error loadGame(int n); + Common::Error saveGame(int n, const Common::String &saveName); + + static void writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName); + static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header); + static Common::String generateSaveName(int slotNumber); + static SaveStateList listSaves(const char *target); + static SaveStateDescriptor querySaveMetaInfos(int slot); +}; + +} // End of namespace Mortevielle +#endif -- cgit v1.2.3 From 231315420b0ac7b199237a9221cae1445edf80a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 14:22:56 +1100 Subject: MORTEVIELLE: Renamed main loop methods, along with quit/end/lose variables --- engines/mortevielle/actions.cpp | 20 +++++++++++++------ engines/mortevielle/actions.h | 4 ++-- engines/mortevielle/mor2.cpp | 5 +++-- engines/mortevielle/mortevielle.cpp | 39 ++++++++++++++++++++++--------------- engines/mortevielle/mortevielle.h | 14 ++++++++++--- engines/mortevielle/prog.cpp | 18 ++++++++++------- engines/mortevielle/prog.h | 1 - engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.cpp | 2 -- engines/mortevielle/var_mor.h | 3 --- 10 files changed, 65 insertions(+), 43 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 7e5143328d..fe0e8f4d89 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -602,7 +602,8 @@ L2: repon(2, 167); parole(7, 9, 1); quel = do_alert(stouinon, 1); - if (quel == 1) solu = true; + if (quel == 1) + g_vm->_endGame = true; else crep = 168; } if ((s.mlieu == 17) && (s.ivier == 143)) { @@ -1186,9 +1187,12 @@ L2: num = 0; } -/* NIVEAU 2 */ -/* overlay */ void tmaj1() { /* Le jeu est termin‚ !!! */ //Translation: The game is over!!! - arret = true; +/** + * The game is over + * @remarks Originally called 'tmaj1' + */ +void MortevielleEngine::endGame() { + _quitGame = true; tlu(13, 152); maivid(); clsf1(); @@ -1218,7 +1222,11 @@ L2: inzon(); } -/* overlay */ void tencore() { /* Perdu !!! */ //Translation: You lost! +/** + * You lost! + * @remarks Originally called 'tencore' + */ +void MortevielleEngine::loseGame() { int quel; clsf2(); @@ -1235,7 +1243,7 @@ L2: jou = 0; repon(2, 180); quel = do_alert(stouinon, 1); - arret = (quel != 1); + _quitGame = (quel != 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index 904a58d87c..196e5a5de6 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -61,8 +61,8 @@ extern void tparler(); extern void tsentir(); extern void tgratter(); /* NIVEAU 2 */ -extern void tmaj1(); -extern void tencore(); +extern void endGame(); +extern void loseGame(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 10fe6e9937..c71c850286 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -290,8 +290,9 @@ void tperd() { iouv = 0; mchai = 0; mfouen(); - if (! blo) t11(21, cx); - perdu = true; + if (!blo) + t11(21, cx); + g_vm->_loseGame = true; clsf1(); boite(60, 35, 400, 50, 15); repon(9, crep); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index cbe2613716..eed4b5156b 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -56,6 +56,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _lastGameFrame = 0; _mouseClick = false; _inMainGameLoop = false; + _quitGame = false; } MortevielleEngine::~MortevielleEngine() { @@ -150,7 +151,6 @@ Common::ErrorCode MortevielleEngine::initialise() { init_mouse(); init_lieu(); - arret = false; sonoff = false; f2_all = false; textcolor(9); @@ -464,7 +464,8 @@ void MortevielleEngine::divers(int np, bool b) { } /** - * Main game loop + * Main game loop. Handles potentially playing the game multiple times, such as if the player + * loses, and chooses to start playing the game again. */ void MortevielleEngine::mainGame() { if (rech_cfiec) charge_cfiec(); @@ -478,31 +479,37 @@ void MortevielleEngine::mainGame() { hirs(); dessine_rouleau(); show_mouse(); + + // Loop to play the game do { - tjouer(); + playGame(); CHECK_QUIT; - } while (!arret); + } while (!_quitGame); } /** - * This method handles repeatedly calling a sub-method to wait for a user action and then handling it + * This method handles playing a loaded game + * @remarks Originally called tojouer */ -void MortevielleEngine::tjouer() { - antegame(); +void MortevielleEngine::playGame() { + gameLoaded(); + + // Loop handling actions until the game has to be quit, or show the lose or end sequence do { - tecran(); + handleAction(); CHECK_QUIT; - } while (!((arret) || (solu) || (perdu))); - if (solu) - tmaj1(); - else if (perdu) - tencore(); + } while (!((_quitGame) || (_endGame) || (_loseGame))); + if (_endGame) + endGame(); + else if (_loseGame) + loseGame(); } /** * Waits for the user to select an action, and then handles it + * @remarks Originally called tecran */ -void MortevielleEngine::tecran() { +void MortevielleEngine::handleAction() { const char idem[] = "Idem"; const int lim = 20000; int temps = 0; @@ -556,7 +563,7 @@ void MortevielleEngine::tecran() { } } if (inkey == '\73') { - arret = true; + _quitGame = true; tmaj3(); } else { if ((funct) && (inkey != '\77')) return; @@ -582,7 +589,7 @@ void MortevielleEngine::tecran() { } do { if (! oo) tsitu(); - if ((ctrm == 0) && (! perdu) && (! solu)) { + if ((ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); if (okdes) { okdes = false; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6dad5a0a79..9ca8258b8d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -57,7 +57,7 @@ private: uint32 _lastGameFrame; bool _mouseClick; Common::Point _mousePos; - bool _inMainGameLoop; + bool _inMainGameLoop; // Flag when the main game loop is active Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); @@ -67,8 +67,8 @@ private: void initMouse(); void showIntroduction(); void mainGame(); - void tjouer(); - void tecran(); + void playGame(); + void handleAction(); void divers(int np, bool b); public: ScreenSurface _screenSurface; @@ -77,6 +77,10 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; + + bool _quitGame; // Quit game flag. Originally called 'arret' + bool _endGame; // End game flag. Originally called 'solu' + bool _loseGame; // Lose game flag. Originally called 'perdu' public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -95,6 +99,10 @@ public: bool getMouseClick() const { return _mouseClick; } void setMouseClick(bool v) { _mouseClick = v; } void delay(int amount); + + void endGame(); + void loseGame(); + void gameLoaded(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index ba2c4ded91..9d8b8f91a1 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -57,7 +57,11 @@ namespace Mortevielle { menu_aff(); } -/* overlay */ void antegame() { +/** + * Called when a savegame has been loaded. + * @remarks Originally called 'antegame' + */ +void MortevielleEngine::gameLoaded() { int k; bool test[3]; char g[8]; @@ -66,7 +70,7 @@ namespace Mortevielle { hide_mouse(); imen = false; g[1] = 'M'; - perdu = true; + _loseGame = true; anyone = false; okdes = true; test[0] = false; @@ -112,8 +116,8 @@ namespace Mortevielle { test[k] = true; okdes = false; - solu = true; - perdu = false; + _endGame = true; + _loseGame = false; fouil = false; } person(); @@ -122,7 +126,7 @@ namespace Mortevielle { afdes(0); repon(2, crep); clsf3(); - solu = false; + _endGame = false; tmlieu(s.mlieu); modinv(); if (s.derobj != 0) modobj2(s.derobj + 400, test[1], test[2]); @@ -201,7 +205,7 @@ L1: 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)) { + && (s.mlieu != 0) && (s.derobj != 152) && (!g_vm->_loseGame)) { if ((s.conf > 99) && (h > 8) && (h < 16)) { crep = 1501; tperd(); @@ -210,7 +214,7 @@ L1: crep = 1508; tperd(); } - if ((j > 1) && (h > 8) && (! perdu)) { + if ((j > 1) && (h > 8) && (!g_vm->_loseGame)) { crep = 1502; tperd(); } diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h index f51b2214b7..e88b943307 100644 --- a/engines/mortevielle/prog.h +++ b/engines/mortevielle/prog.h @@ -31,7 +31,6 @@ namespace Mortevielle { extern void change_gd(int ngd); -extern void antegame(); /* NIVEAU 3 */ /* procedure PROGRAMME */ diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index d0cd603845..4f37c2839b 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -125,7 +125,7 @@ Common::Error SavegameManager::loadGame(int n) { /* Initialization */ theure(); dprog(); - antegame(); + g_vm->gameLoaded(); show_mouse(); return Common::kNoError; } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index bd432124db..5ace0614bb 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -112,7 +112,6 @@ bool blo, imen, cache, iesc, - perdu, col, syn, fouil, @@ -120,7 +119,6 @@ bool blo, tesok, obpart, okdes, - solu, arret, anyone, brt, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5d62e77a1c..eea89947b4 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -281,7 +281,6 @@ extern bool blo, imen, cache, iesc, - perdu, col, syn, fouil, @@ -289,8 +288,6 @@ extern bool blo, tesok, obpart, okdes, - solu, - arret, anyone, brt, rect, -- cgit v1.2.3 From e57a6a8c07bac4d9b69d89baca638beda34485d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 19:36:13 +1100 Subject: MORTEVIELLE: Added list of static executable strings to create_mortdat tool --- devtools/create_mortdat/create_mortdat.cpp | 164 ++++++++++++++++++++++++++++- dists/engine-data/mort.dat | Bin 738 -> 1797 bytes 2 files changed, 163 insertions(+), 1 deletion(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index aa7da0169a..773ddaeeed 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -91,6 +91,9 @@ public: uint32 vTemp = TO_LE_32(v); write(&vTemp, sizeof(uint32)); } + void writeString(const char *s) { + write(s, strlen(s) + 1); + } uint32 pos() { return ftell(f); } @@ -112,7 +115,10 @@ void openOutputFile(const char *outFilename) { outputFile.writeByte(VERSION_MINOR); } -void process() { +/** + * Write out the data for the font + */ +void writeFontBlock() { byte checkBuffer[7]; byte fontBuffer[121 * 6]; @@ -138,6 +144,162 @@ void process() { outputFile.write(fontBuffer, 121 * 6); } +void writeStaticStrings(const char **strings, int languageId) { + // Write out a section header + char sStaticStrings[4] = { 'S', 'S', 'T', 'R' }; + outputFile.write(sStaticStrings, 4); + + // Figure out the block size + int blockSize = 1; + const char **s = &strings[0]; + while (*s) { + blockSize += strlen(*s) + 1; + ++s; + } + + outputFile.writeWord(blockSize); + + // Write out a byte indicating the language for this block + outputFile.writeByte(languageId); + + // Write out each of the strings + s = &strings[0]; + while (*s) { + outputFile.writeString(*s); + ++s; + } +} + +/** + * Write out the French strings previously hard-coded into the application + */ +void writeEnglishStaticStrings() { + const char *string_list[] = { + "[2][ ][YES][NO]", + "Go to", + "Someone enters, looks surised, but says nothing", + "Cool", + " Lourde ", + "Malsaine", + "Idem", + "You", + "are", + "Alone", + + "Gosh! You hear some noise...", + " | You should have noticed, | ", + "% of hints...", + "Do you want to wake up?", + "OK", + "", + " Save", + + " Load", + " Restart ", + "F3: More", + "F8: Restart", + "Hide self", + "take", + " probe ", + " raise ", + " -SUITE- ", + " -STOP- ", + "[1] [So, use the DEP menu] [Ok]", + "lift", + "read", + + "look", + "search", + "open", + "put", + "turn", + "tie", + "close", + "hit", + "pose", + "smash", + + "smell", + "scratch", + "probe", + "[1] [ | Before, use the DEP menu...] [Ok]", + "& day", + NULL + }; + + writeStaticStrings(string_list, 1); +} + +/** + * Write out the French strings previously hard-coded into the application + */ +void writeFrenchStaticStrings() { + const char *string_list[] = { + "[2][ ][OUI][NON]", + "aller", + "quelqu'un entre, parait ‚tonn‚ mais ne dit rien", + "Cool", + " Lourde ", + "Malsaine", + "Idem", + "Vous", + "tes", + "SEUL", + + "Mince! Vous entendez du bruit...", + " | Vous devriez avoir remarqu‚| ", + "% des indices...", + "D‚sirez-vous vous r‚veiller?", + "OK", + "", + " Sauvegarde", + + " Chargement", + " Recommence ", + "F3: Encore", + "F8: Suite", + "se cacher", + + "prendre", + " sonder ", + "soulever", + " -SUITE- ", + " -STOP- ", + "[1][Alors, utilisez le menu DEP...][ok]", + "soulever", + "lire", + + "regarder", + "fouiller", + "ouvrir", + "mettre", + "tourner", + "attacher", + "fermer", + "frapper", + "poser", + "d‚foncer", + + "sentir", + "gratter", + "sonder", + "[1][ | Avant, utilisez le menu DEP...][ok]", + "& jour", + NULL + }; + + writeStaticStrings(string_list, 0); +} + +void process() { + writeFontBlock(); + writeEnglishStaticStrings(); + writeFrenchStaticStrings(); +} + +/** + * Main method + */ int main(int argc, char *argv[]) { if (argc != 3) { printf("Format: input_filename output_filename\n", argv[0]); diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index ebfb8a8e0e..8e0171fe5a 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From c81b81692b62c5fefe54e8d4399cd0a106c53921 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 19:40:03 +1100 Subject: MORTEVIELLE: Added support for using the static string list added to mort.dat --- engines/mortevielle/actions.cpp | 77 ++++++++++++++++++++-------------- engines/mortevielle/detection.cpp | 3 ++ engines/mortevielle/detection_tables.h | 20 +++++++++ engines/mortevielle/menu.cpp | 16 +++---- engines/mortevielle/mor.cpp | 43 +++++++++---------- engines/mortevielle/mor2.cpp | 32 +++++++++----- engines/mortevielle/mortevielle.cpp | 38 ++++++++++++++++- engines/mortevielle/mortevielle.h | 25 +++++++++++ engines/mortevielle/var_mor.cpp | 11 ----- engines/mortevielle/var_mor.h | 7 ---- 10 files changed, 181 insertions(+), 91 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index fe0e8f4d89..cd3a7b0df8 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,9 +42,6 @@ namespace Mortevielle { -/* NIVEAU 4 */ -const char stouinon[] = "[2][ ][OUI][NON]"; //Translation: [2] [ ] [YES] [NO] - /* overlay */ void taller() { //int mx, cx, cy; @@ -57,7 +54,8 @@ void taller() { repon(2, s.mlieu); } if ((s.mlieu == 15) && (msg[4] == depl[6])) { - if (! syn) ecr3("aller"); //Translation: Go to + if (!syn) + ecr3(g_vm->getString(S_GO_TO)); tfleche(); if (iesc) okdes = false; if ((anyone) || (iesc)) return; @@ -170,7 +168,8 @@ L2: } return; } - if (! syn) ecr3("prendre"); //Translation: Take + if (!syn) + ecr3(g_vm->getString(S_TAKE)); tfleche(); if ((anyone) || (iesc)) return; if (caff == 3) { @@ -257,7 +256,8 @@ L2: { int cx; - if (! syn) ecr3("soulever"); //Translation: Lift + if (!syn) + ecr3(g_vm->getString(S_LIFT)); tfleche(); if ((anyone) || (iesc)) return; tcoord(3); @@ -283,11 +283,13 @@ L2: if (caff > 99) st4(caff); else { - if (! syn) ecr3("lire"); //Translation: Read + if (!syn) + ecr3(g_vm->getString(S_READ)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(4); - if (num != 0) crep = 107; + if (num != 0) + crep = 107; } } } @@ -304,7 +306,8 @@ L2: crep = 103; return; } - if (! syn) ecr3("regarder"); //Translation: Look + if (!syn) + ecr3(g_vm->getString(S_LOOK)); tfleche(); if ((anyone) || (iesc)) return; tcoord(5); @@ -365,7 +368,8 @@ L2: st7(caff); return; } - if (! syn) ecr3("fouiller"); //Translation: Search + if (!syn) + ecr3(g_vm->getString(S_SEARCH)); tfleche(); if (anyone || iesc) return; if (s.mlieu == 23) { @@ -432,7 +436,8 @@ L2: /* overlay */ void touvrir() { int cx, haz; - if (! syn) ecr3("ouvrir"); //Translation: Open + if (!syn) + ecr3(g_vm->getString(S_OPEN)); if (caff == 26) { if (ment != 0) { msg[4] = entrer; @@ -493,7 +498,8 @@ L2: crep = 186; return; } - if (! syn) ecr3("mettre"); //Translation: Put + if (!syn) + ecr3(g_vm->getString(S_PUT)); tfleche(); if (iesc) crep = 998; if ((anyone) || (iesc)) return; @@ -523,7 +529,7 @@ L2: repon(2, 165); maivid(); parole(6, -9, 1); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); if (quel == 1) { deline(582, st, tay); i = do_alert(delig, 1); @@ -592,7 +598,8 @@ L2: crep = 149; return; } - if (! syn) ecr3("tourner"); //Translation: Turn + if (!syn) + ecr3(g_vm->getString(S_TURN)); tfleche(); if ((anyone) || (iesc)) return; tcoord(9); @@ -601,7 +608,7 @@ L2: if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); if (quel == 1) g_vm->_endGame = true; else crep = 168; @@ -610,7 +617,7 @@ L2: repon(2, 175); clsf3(); parole(6, -9, 1); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); if (quel == 1) { s.mlieu = 16; affrep(); @@ -620,7 +627,8 @@ L2: } /* overlay */ void tcacher() { - if (! syn) ecr3("se cacher"); //Translation: Hide self + if (!syn) + ecr3(g_vm->getString(S_HIDE_SELF)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(10); @@ -635,7 +643,8 @@ L2: /* overlay */ void tattacher() { if (s.derobj == 0) crep = 186; else { - if (! syn) ecr3("attacher"); //Translation: Tie + if (!syn) + ecr3(g_vm->getString(S_TIE)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(8); @@ -655,7 +664,8 @@ L2: /* overlay */ void tfermer() { int cx, chai; - if (! syn) ecr3("fermer"); //Translation: Close + if (!syn) + ecr3(g_vm->getString(S_CLOSE)); if (caff < 26) { tfleche(); if (iesc) crep = 998; @@ -684,9 +694,10 @@ L2: /* overlay */ void tfrapper() { int l, p, haz; - if (! syn) ecr3("frapper"); //Translation: Hit + if (!syn) + ecr3(g_vm->getString(S_HIT)); if (s.mlieu == 15) { - l = do_alert("[1][ | Avant, utilisez le menu DEP...][ok]", 1); //Translation: [1] [ | Before, use the DEP menu...] [Ok] + l = do_alert(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1); return; } if (s.mlieu < 25) { @@ -716,7 +727,8 @@ L2: /* overlay */ void tposer() { int cx, chai; - if (! syn) ecr3("poser"); + if (!syn) + ecr3(g_vm->getString(S_POSE)); if (s.derobj == 0) crep = 186; else { if (caff > 99) { @@ -884,7 +896,6 @@ L2: } /* overlay */ void tdormir() { - const char m1[] = "D‚sirez-vous vous r‚veiller?"; //Translation: Do you want to wake up? int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { @@ -902,7 +913,7 @@ L2: clsf3(); clsf2(); ecrf2(); - ecr2(m1); + ecr2(g_vm->getString(S_WANT_TO_WAKE_UP)); calch(j, h, m); do { if (h < 8) { @@ -916,7 +927,7 @@ L2: h = h + 1; if (h > 23) h = 0; tinke(); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); anyone = false; } while (!(quel == 1)); crep = 998; @@ -924,7 +935,8 @@ L2: } /* overlay */ void tdefoncer() { - if (! syn) ecr3("d‚foncer"); //Translation: Smash + if (!syn) + ecr3(g_vm->getString(S_SMASH)); if (caff < 25) tfleche(); if ((! anyone) && (! iesc)) if (s.mlieu != 26) crep = 997; @@ -977,14 +989,15 @@ L2: return; } repon(2, 102); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); } while (!(quel == 2)); crep = 998; if (! anyone) tinke(); } /* overlay */ void tsonder() { - if (! syn) ecr3("sonder"); //Translation: Probe + if (!syn) + ecr3(g_vm->getString(S_PROBE2)); if (caff < 27) { tfleche(); if (!(anyone) && (! iesc)) crep = 145; @@ -1170,7 +1183,8 @@ L2: /* overlay */ void tsentir() { crep = 119; if (caff < 26) { - if (! syn) ecr3("sentir"); //Translation: Smell + if (!syn) + ecr3(g_vm->getString(S_SMELL)); tfleche(); if (!(anyone) && !(iesc)) if (caff == 16) crep = 153; @@ -1181,7 +1195,8 @@ L2: /* overlay */ void tgratter() { crep = 155; if (caff < 27) { - if (! syn) ecr3("gratter"); //Translation: Scratch + if (!syn) + ecr3(g_vm->getString(S_SCRATCH)); tfleche(); } num = 0; @@ -1242,7 +1257,7 @@ void MortevielleEngine::loseGame() { heu = 10; jou = 0; repon(2, 180); - quel = do_alert(stouinon, 1); + quel = do_alert(g_vm->getString(S_YES_NO), 1); _quitGame = (quel != 1); } diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 35e5cada81..5997b4c349 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -29,6 +29,9 @@ namespace Mortevielle { uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->flags; } + +Common::Language MortevielleEngine::getLanguage() const { return _gameDescription->language; } + } static const PlainGameDescriptor MortevielleGame[] = { diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 7ceb40d524..307d125156 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -23,6 +23,7 @@ namespace Mortevielle { static const ADGameDescription MortevielleGameDescriptions[] = { + // French { "mortevielle", "", @@ -36,6 +37,8 @@ static const ADGameDescription MortevielleGameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, + + // German { "mortevielle", "", @@ -49,6 +52,23 @@ static const ADGameDescription MortevielleGameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, + + // English. Note that this is technically the French version, but English strings in mort.dat + // will automatically replace all the French strings + { + "mortevielle", + "", + { + {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO0() + }, + AD_TABLE_END_MARKER }; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9c50777cec..bc74a379e5 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -214,18 +214,18 @@ void invers(int ix) { s = dis[lo(msg4)]; break; case 6 : - s = fic[lo(msg4)]; + s = g_vm->getString(S_SAVE_LOAD + lo(msg4)); break; case 7 : - s = fic[1]; + s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + lo(msg4)); break; case 8 : if (lo(msg4) == 1) { - s = recom; + s = g_vm->getString(S_RESTART); } else { - s = fic[2]; + s = g_vm->getString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + lo(msg4)); } @@ -302,10 +302,10 @@ void menu_down(int ii) { if (dis[cx][0] != '*') writeg(dis[cx], 4); break; case 6 : - writeg(fic[cx], 4); + writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); break; case 7 : { - Common::String s = fic[1]; + Common::String s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); writeg(s, 4); @@ -313,9 +313,9 @@ void menu_down(int ii) { } case 8 : if (cx == 1) - writeg(recom, 4); + writeg(g_vm->getString(S_RESTART), 4); else { - Common::String s = fic[2]; + Common::String s = g_vm->getString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + cx); writeg(s, 4); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 17dd83a7ee..ae303e99fd 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -35,6 +35,7 @@ #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/parole2.h" @@ -43,9 +44,6 @@ namespace Mortevielle { -/* Niveau 14 suite */ -const char m1[] = "quelqu'un entre, parait ‚tonn‚ mais ne dit rien"; //Translation: Someone enters, looks surised, but says nothing - // For ScummVM, we need to do check for file errors where we do the file access const int ioresult = 0; @@ -287,10 +285,14 @@ void clsf10() { 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; + if (s.conf < 33) + st = g_vm->getString(S_COOL); + else if (s.conf < 66) + st = g_vm->getString(S_LOURDE); + else if (s.conf > 65) + st = g_vm->getString(S_MALSAINE); + if (res == 1) + co = 10; else co = 6; co = 574 - ((uint)co * st.size() >> 1); putxy(co, 92); @@ -453,9 +455,9 @@ void f3f8() { if (res == 1) co = 107; else co = 64; putxy(3, 44); - writeg(f3, 5); + writeg(g_vm->getString(S_F3), 5); ywhere = 51; - writeg(f8, 5); + writeg(g_vm->getString(S_F8), 5); boite(0, 42, co, 16, 7); } @@ -610,22 +612,21 @@ void affper(int per) { if ((h >= 0) && (h < 8)) p = 60; } +/** + * Shows the you are alone message in the status area on the right hand side of the screen + */ void person() { - const char m1[] = "Vous"; //Translation: You - const char m2[] = "tes"; //Translation: are - const char m3[] = "SEUL"; //Translation: ALONE - int cf; - Common::String str_; - /* debug('person'); */ - for (cf = 1; cf <= 8; cf ++) menu_disable(disc[cf]); + for (int cf = 1; cf <= 8; cf ++) + menu_disable(disc[cf]); + clsf10(); putxy(560, 30); - writeg(m1, 4); + writeg(g_vm->getString(S_YOU), 4); putxy(560, 50); - writeg(m2, 4); + writeg(g_vm->getString(S_ARE), 4); putxy(560, 70); - writeg(m3, 4); + writeg(g_vm->getString(S_ALONE), 4); ipers = 0; } @@ -668,7 +669,7 @@ void pendule() { else writeg("AM ", 1); putxy(550, 160); if ((jou >= 0) && (jou <= 8)) { - Common::String tmp("& jour"); //Translation: Day + Common::String tmp = g_vm->getString(S_DAY); tmp.insertChar((char)(jou + 49), 0); writeg(tmp, 1); } @@ -1208,7 +1209,7 @@ void phaz(int &haz, int &p, int cf) { if (s.conf > 69) s.conf = s.conf + (s.conf / 10); clsf3(); ecrf2(); - ecr3(m1); + ecr3(g_vm->getString(S_SOMEONE_ENTERS)); haz = (hazard(0, 4)) - 2; parole(2, haz, 1); for (haz = 0; haz <= 3000; haz ++); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c71c850286..b8b76c1928 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -47,13 +47,12 @@ const int men[12] = { 0, }; void tinke() { - const char m1[] = "Mince! Vous entendez du bruit..."; //Translation: Gosh! You hear some noise... - const char d1[] = " | Vous devriez avoir remarqu‚| "; //Translation: You should have noticed - const char d2[] = "% des indices..."; //Translation: %s of hints + Common::String d1 = g_vm->getString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = g_vm->getString(S_NUMBER_OF_HINTS); const char d3 = '['; const char d4 = ']'; const char d5 = '1'; - const char d6[] = "OK"; + Common::String d6 = g_vm->getString(S_OK); int cx, haz, nh, cf, j, h, m; Common::String stpo; bool am; @@ -78,7 +77,18 @@ void tinke() { if (cf == 10) stpo = "10"; else stpo = chr(cf + 48); - stpou = Common::String(d3) + d5 + d4 + d3 + d1 + stpo + '0' + d2 + d4 + d3 + d6 + d4; + stpou = Common::String(d3); + stpou += d5; + stpou += d4; + stpou += d3; + stpou += d1; + stpou += stpo; + stpou += '0'; + stpou += d2; + stpou += d4; + stpou += d3; + stpou += d6; + stpou += d4; } if (m > min) { min = 30; @@ -149,7 +159,7 @@ void tinke() { if (haz < 5) { clsf3(); ecrf2(); - ecr3(m1); + ecr3(g_vm->getString(S_HEAR_NOISE)); haz = (hazard(0, 4)) - 2; parole(1, haz, 1); clsf3(); @@ -269,8 +279,8 @@ void mfouen() menu_enable(menup, mettre); menu_enable(menup, ouvrir); menu_enable(menup, sortir); */ - menut(sonder, " sonder "); - menut(soulever, " soulever "); + menut(sonder, g_vm->getString(S_PROBE)); + menut(soulever, g_vm->getString(S_RAISE)); } void atf3f8(int &key) { @@ -427,8 +437,8 @@ void mfoudi() { menu_disable(menup, mettre); menu_disable(menup, ouvrir); menu_disable(menup, sortir); */ - menut(sonder, " -SUITE- "); - menut(soulever, " -STOP- "); + menut(sonder, g_vm->getString(S_SUITE)); + menut(soulever, g_vm->getString(S_STOP)); } void mennor() { @@ -774,7 +784,7 @@ void st13(int ob) { void aldepl() { int dummy; - dummy = do_alert("[1][Alors, utilisez le menu DEP...][ok]", 1); //Translation: [1] [So, use the DEP menu] [Ok] + dummy = do_alert(g_vm->getString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index eed4b5156b..1fc20cfbae 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -204,16 +204,51 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (!strncmp(dataType, "FONT", 4)) { // Font resource _screenSurface.readFontData(f, dataSize); + } else if (!strncmp(dataType, "SSTR", 4)) { + readStaticStrings(f, dataSize); } else { // Unknown section f.skip(dataSize); } } + // Close the file f.close(); + + assert(_staticStrings.size() > 0); return Common::kNoError; } +/** + * Read in a static strings block, and if the language matches, load up the static strings + */ +void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { + // Figure out what language Id is needed + byte desiredLanguageId = (getLanguage() == Common::EN_ANY) ? LANG_ENGLISH : LANG_FRENCH; + + // Read in the language + byte languageId = f.readByte(); + --dataSize; + + // If the language isn't correct, then skip the entire block + if (languageId != desiredLanguageId) { + f.skip(dataSize); + return; + } + + // Load in each of the strings + while (dataSize > 0) { + Common::String s; + char ch; + while ((ch = (char)f.readByte()) != '\0') + s += ch; + + _staticStrings.push_back(s); + dataSize -= s.size() + 1; + } + assert(dataSize == 0); +} + bool MortevielleEngine::keyPressed() { // Check for any pending key presses handleEvents(); @@ -510,7 +545,6 @@ void MortevielleEngine::playGame() { * @remarks Originally called tecran */ void MortevielleEngine::handleAction() { - const char idem[] = "Idem"; const int lim = 20000; int temps = 0; char inkey = '\0'; @@ -555,7 +589,7 @@ void MortevielleEngine::handleAction() { } else if (inkey == '\77') { if ((mnumo != no_choice) && ((msg[3] == action) || (msg[3] == saction))) { msg[4] = mnumo; - ecr3(idem); + ecr3(g_vm->getString(S_IDEM)); } else return; } else if (inkey == '\104') { if ((x != 0) && (y != 0)) num = 9999; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 9ca8258b8d..94640ba8a9 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -38,11 +38,32 @@ namespace Mortevielle { +// Debug channels enum { kMortevielleCore = 1 << 0, kMortevielleGraphics = 1 << 1 }; +// Game languages +enum { + LANG_FRENCH = 0, + LANG_ENGLISH = 1 +}; + +// Static string list +enum { + S_YES_NO = 0, S_GO_TO = 1, S_SOMEONE_ENTERS = 2, S_COOL = 3, S_LOURDE = 4, + S_MALSAINE = 5, S_IDEM = 6, S_YOU = 7, S_ARE = 8, S_ALONE = 9, + S_HEAR_NOISE = 10, S_SHOULD_HAVE_NOTICED = 11, S_NUMBER_OF_HINTS = 12, + S_WANT_TO_WAKE_UP = 13, S_OK = 14, S_SAVE_LOAD = 15, S_RESTART = 18, S_F3 = 19, + S_F8 = 20, S_HIDE_SELF = 21, S_TAKE = 22, S_PROBE = 23, S_RAISE = 24, S_SUITE = 25, + S_STOP = 26, S_USE_DEP_MENU = 27, S_LIFT = 28, S_READ = 29, + S_LOOK = 30, S_SEARCH = 31, S_OPEN = 32, S_PUT = 33, S_TURN = 34, S_TIE = 35, S_CLOSE = 36, + S_HIT = 37, S_POSE = 38, S_SMASH = 39, + + S_SMELL = 40, S_SCRATCH = 41, S_PROBE2 = 42, S_BEFORE_USE_DEP_MENU = 43, S_DAY = 44 +}; + #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 #define SCREEN_ORIG_HEIGHT 200 @@ -58,9 +79,11 @@ private: bool _mouseClick; Common::Point _mousePos; bool _inMainGameLoop; // Flag when the main game loop is active + Common::StringArray _staticStrings; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); + void readStaticStrings(Common::File &f, int dataSize); void loadFont(Common::File &f); bool handleEvents(); void addKeypress(Common::Event &evt); @@ -91,6 +114,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); uint32 getGameFlags() const; + Common::Language getLanguage() const; bool keyPressed(); int getChar(); @@ -99,6 +123,7 @@ public: bool getMouseClick() const { return _mouseClick; } void setMouseClick(bool v) { _mouseClick = v; } void delay(int amount); + Common::String getString(int idx) const { return _staticStrings[idx]; } void endGame(); void loseGame(); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 5ace0614bb..cd84b934a1 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -72,19 +72,8 @@ const byte don[9][5] = { {0, 62, 25, 13, 5} }; -const char *fic[3] = { - "", - " Sauvegarde", // Translation: "Save" - " Chargement" // Translation: "Load" -}; - const byte addv[2] = {8, 8}; -const char recom[] = " Recommence "; // Translation: "Restart" - -const char f3[] = "F3: Encore"; // Translation: "F3: More" -const char f8[] = "F8: Suite"; // Translation: "F8: Next" - const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*---------------------------------------------------------------------------*/ diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index eea89947b4..2e2bf539f2 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -176,15 +176,8 @@ extern const byte tnocon[364]; extern const byte don[9][5]; -extern const char *fic[3]; - extern const byte addv[2]; -extern const char recom[]; - -extern const char f3[]; -extern const char f8[]; - extern const byte rang[16]; /*---------------------------------------------------------------------------*/ -- cgit v1.2.3 From 46427cb61893e2fdb262d1a11a90dcc4d34f411a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 20:04:16 +1100 Subject: MORTEVIELLE: Removed text screen output, and fixed copyright to display on title screen. Note: The original used Pascal text display functions to show the copyright on the title screen. To avoid a lot of code needing to be added for just that line, I'm using the existing graphic text display code. The resulting copyright text isn't identical to the original, but I consider it close enough. --- engines/mortevielle/mortevielle.cpp | 2 + engines/mortevielle/ovd1.cpp | 90 +++++-------------------------------- 2 files changed, 12 insertions(+), 80 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1fc20cfbae..4cbc2b4ee3 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -479,7 +479,9 @@ void MortevielleEngine::showIntroduction() { divers(143, true); CHECK_QUIT; + // TODO: Once music is implemented, only use the below delay if music is turned off suite(); + delay(3000); music(); } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index bfa6f47790..8fb45b5ca3 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -233,75 +233,13 @@ void ani50() { al_mess2 = delig; } -/* overlay */ void dialpre() - -{ - int cy, tay; - char st[1410]; - float ix; -// char ch; - - +/** + * The original engine used this method to display a starting text screen letting the palyer + * select the graphics mode to use + */ +void dialpre() { /* 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 { - ch = get_ch(); // input >> kbd >> ch; - } while ((ch != '\1') && (ch != '\3') && (ch != '\5') && (ch != '\24') && (ch != '\10')); - switch (ch) { - case '\1': - case '\3': - case '\5' : - gd = (uint)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); - // "Play using keyboard / ... mouse" - output("Jeu au Clavier / … la Souris"); - textcolor(4); - gotoxy(33, 23); - output("C"); - gotoxy(48, 23); - output("S"); - /* - do { - ch = get_ch(); // input >> kbd >> ch; - } while ((ch != 'C') && (ch != 'S')); - int_m = (toupper(ch) == 'S'); - */ int_m = true; } @@ -390,10 +328,7 @@ void ani50() { f.close(); } - -/* overlay */ void suite() { - Common::String cpr; - +void suite() { hirs(); repon(7, 2035); caff = 51; @@ -402,15 +337,10 @@ void ani50() { if (newgd != gd) gd = newgd; hirs(); dessine(ades, 0, 0); - gotoxy(20 * pred(int, res) + 8, 24); - textcolor(7); - cpr = "COPYRIGHT 1989 : LANKHOR"; - if ((gd == ega) || (gd == ams) || (gd == cga)) - output(cpr); - else { - putxy(104 + 72 * res, 190); - writeg(cpr, 0); - } + + Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; + putxy(104 + 72 * res, 185); + writeg(cpr, 0); } } // End of namespace Mortevielle -- cgit v1.2.3 From e9c5437c3ba66dff9ada2a9f05fb6635e0d1a55b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 20:33:54 +1100 Subject: MORTEVIELLE: Removed redundant gfx functions, and moved others into ScreenSurface class. --- engines/mortevielle/actions.cpp | 10 ++-- engines/mortevielle/alert.cpp | 22 ++++----- engines/mortevielle/droite.cpp | 6 ++- engines/mortevielle/graphics.cpp | 55 +++++++++++++++++++++ engines/mortevielle/graphics.h | 4 ++ engines/mortevielle/level15.cpp | 4 -- engines/mortevielle/level15.h | 1 - engines/mortevielle/menu.cpp | 37 ++++++++------ engines/mortevielle/mor.cpp | 103 ++++++++++++++++++++------------------- engines/mortevielle/mor2.cpp | 12 +++-- engines/mortevielle/mouse.cpp | 1 - engines/mortevielle/outtext.cpp | 18 ++++--- engines/mortevielle/ovd1.cpp | 4 +- engines/mortevielle/sprint.cpp | 49 ------------------- engines/mortevielle/sprint.h | 1 - engines/mortevielle/var_mor.cpp | 23 --------- engines/mortevielle/var_mor.h | 5 -- 17 files changed, 174 insertions(+), 181 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index cd3a7b0df8..f3bc31b637 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1053,7 +1053,7 @@ L2: lig = 0; do { icm = succ(int, icm); - putxy(co, lig); + g_vm->_screenSurface.putxy(co, lig); if (s.teauto[icm] == '*') if (te[icm]) writetp(lib[icm], 1); else writetp(lib[icm], 0); @@ -1062,7 +1062,7 @@ L2: co = 320; } else lig = lig + 8; } while (!(icm == 42)); - putxy(320, 176); + g_vm->_screenSurface.putxy(320, 176); writetp(lib[46], 0); tou = '\0'; do { @@ -1080,7 +1080,7 @@ L2: lig = ((choi - 1) % 23) << 3; if (choi > 23) co = 320; else co = 0; - putxy(co, lig); + g_vm->_screenSurface.putxy(co, lig); if (te[choi]) writetp(lib[choi], 0); else writetp(lib[choi], 1); te[choi] = ! te[choi]; @@ -1094,7 +1094,7 @@ L2: lig = ((choi - 1) % 23) << 3; if (choi > 23) co = 320; else co = 0; - putxy(co, lig); + g_vm->_screenSurface.putxy(co, lig); if (te[choi]) writetp(lib[choi], 0); else writetp(lib[choi], 1); te[choi] = ! te[choi]; @@ -1103,7 +1103,7 @@ L2: lig = ((ix - 1) % 23) << 3; if (ix > 23) co = 320; else co = 0; - putxy(co, lig); + g_vm->_screenSurface.putxy(co, lig); if (te[ix]) writetp(lib[ix], 0); else writetp(lib[ix], 1); te[ix] = ! te[ix]; diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 36a51b07ed..73befd9196 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -87,7 +87,7 @@ static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String static void posit(int ji, int &coldep, int &esp) { - putxy(coldep + (40 + esp) *pred(int, ji), 98); + g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98); } @@ -122,13 +122,13 @@ static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::Strin } while (!(c[i + 1] == ']')); i = i + 2; while (str[l].size() < 3) str[l] = str[l] + ' '; - putxy(x, 98); + g_vm->_screenSurface.putxy(x, 98); Common::String tmp(" "); tmp += str[l]; tmp += " "; - writeg(tmp, 0); + g_vm->_screenSurface.writeg(tmp, 0); x = x + esp + 40; } } @@ -163,7 +163,7 @@ int do_alert(Common::String str_, int n) { } else { fait_boite(8, 7, nbcol); i = 0; - ywhere = 70; + g_vm->_screenSurface._textPos.y = 70; do { cx = 320; st = ""; @@ -173,9 +173,9 @@ int do_alert(Common::String str_, int n) { if (res == 2) cx = cx - 3; else cx = cx - 5; } - putxy(cx, ywhere); - ywhere = ywhere + 6; - writeg(st, 4); + g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); + g_vm->_screenSurface._textPos.y += 6; + g_vm->_screenSurface.writeg(st, 4); i = i + 1; } while (!(chaine[i] == ']')); } @@ -219,14 +219,14 @@ int do_alert(Common::String str_, int n) { Common::String tmp(" "); tmp += s[quoi]; tmp += " "; - writeg(tmp, 0); + g_vm->_screenSurface.writeg(tmp, 0); } posit(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += s[ix]; tmp2 += " "; - writeg(tmp2, 1); + g_vm->_screenSurface.writeg(tmp2, 1); quoi = ix; show_mouse(); @@ -240,7 +240,7 @@ int do_alert(Common::String str_, int n) { Common::String tmp3(" "); tmp3 += s[quoi]; tmp3 += " "; - writeg(tmp3, 0); + g_vm->_screenSurface.writeg(tmp3, 0); quoi = 0; show_mouse(); @@ -256,7 +256,7 @@ int do_alert(Common::String str_, int n) { Common::String tmp4(" "); tmp4 += s[n]; tmp4 += " "; - writeg(tmp4, 1); + g_vm->_screenSurface.writeg(tmp4, 1); } charecr(50, succ(int, nligne) << 4); show_mouse(); diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index 54d788b6eb..c0a48a51aa 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -26,6 +26,8 @@ */ #include "mortevielle/droite.h" +#include "mortevielle/graphics.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -47,7 +49,7 @@ void droite(int x, int y, int xx, int yy, int coul) { if (y > yy) step = -1; else step = 1; do { - putpix(gd, abs((int)(a * i + b)), i, coul); + g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i = i + step; } while (!(i == yy)); /*writeln(le_file,'X == ',a:3:3,' * Y + ',b:3:3);*/ @@ -58,7 +60,7 @@ void droite(int x, int y, int xx, int yy, int coul) { if (x > xx) step = -1; else step = 1; do { - putpix(gd, i, abs((int)(a * i + b)), coul); + g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (!(i == xx)); /*writeln(le_file,'Y == ',a:3:3,' * X + ',b:3:3);*/ diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3450d41cf5..e9c8c1e7e9 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1040,4 +1040,59 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { *(destP + SCREEN_WIDTH) = palIndex; } +/** + * Write out a string + */ +void ScreenSurface::writeg(const Common::String &l, int c) { + int i, x; + Common::Point pt; + int cecr = 0; + + /* debug('writeg : '+l);*/ + + if (l == "") + return; + hide_mouse(); + pt = _textPos; + + if (res == 2) + i = 6; + else + i = 10; + x = pt.x + i * l.size(); + + switch (c) { + case 1: + case 3 : { + cecr = 0; + box(15, gd, pt.x, pt.y, x, pt.y + 7, 255); + } + break; + case 4 : { + cecr = 0; + } + break; + case 5 : { + cecr = 15; + } + break; + case 0: + case 2 : { + cecr = 15; + box(0, gd, pt.x, pt.y, x, pt.y + 7, 255); + } + break; + } + pt.x += 1; + pt.y += 1; + for (x = 1; x <= (int)l.size(); ++x) { + g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); + pt.x += i; + } + show_mouse(); + + // TODO: Move screen updates to main loop once constructed + g_vm->_screenSurface.updateScreen(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 0b265469df..258f4cfacc 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -77,6 +77,8 @@ class ScreenSurface: public Graphics::Surface { private: Common::List _dirtyRects; byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; +public: + Common::Point _textPos; // Original called xwhere/ywhere public: void readFontData(Common::File &f, int dataSize); Graphics::Surface lockArea(const Common::Rect &bounds); @@ -87,6 +89,8 @@ public: void drawBox(int x, int y, int dx, int dy, int col); void fillBox(int colour, const Common::Rect &bounds, int patt); void clearScreen(); + void putxy(int x, int y) { _textPos = Common::Point(x, y); } + void writeg(const Common::String &l, int c); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index b0ed953aa4..c017bf24d3 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -112,10 +112,6 @@ void pictout(int seg, int dep, int x, int y) { g_vm->_screenSurface.drawPicture(surface, x, y); } -void putxy(int x, int y) { - xwhere = x; - ywhere = y; -} /* function calad(x,y:int):int; begin diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h index aee94c9c09..c3df5e5d6c 100644 --- a/engines/mortevielle/level15.h +++ b/engines/mortevielle/level15.h @@ -38,7 +38,6 @@ extern bool dans_rect(rectangle r); extern void outbloc(int n, pattern p, t_nhom pal); extern void writepal(int n); extern void pictout(int seg, int dep, int x, int y); -extern void putxy(int x, int y); // extern int calad(int x, int y); extern void sauvecr(int y, int dy); extern void charecr(int y, int dy); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index bc74a379e5..07626b3894 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -162,9 +162,9 @@ void menu_aff() { msk = 0x80; for (pt = 0; pt <= 7; pt ++) { if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { - putpix(gd, x + 1, y + 1, 0); - putpix(gd, x, y + 1, 0); - putpix(gd, x, y, color); + g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); + g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); + g_vm->_screenSurface.setPixel(Common::Point(x, y), color); } msk = (uint)msk >> 1; x = x + 1; @@ -196,7 +196,7 @@ void invers(int ix) { /* debug('invers'); */ if (msg4 == no_choice) return; - putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); + g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : s = inv[lo(msg4)]; @@ -232,7 +232,7 @@ void invers(int ix) { break; } if ((s[0] != '*') && (s[0] != '<')) - writeg(s, ix); + g_vm->_screenSurface.writeg(s, ix); else msg4 = no_choice; } @@ -281,48 +281,53 @@ void menu_down(int ii) { 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); + g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { cx = succ(int, cx); switch (ii) { case 1 : - if (inv[cx][0] != '*') writeg(inv[cx], 4); + if (inv[cx][0] != '*') + g_vm->_screenSurface.writeg(inv[cx], 4); break; case 2 : - if (dep[cx][0] != '*') writeg(dep[cx], 4); + if (dep[cx][0] != '*') + g_vm->_screenSurface.writeg(dep[cx], 4); break; case 3 : - if (act[cx][0] != '*') writeg(act[cx], 4); + if (act[cx][0] != '*') + g_vm->_screenSurface.writeg(act[cx], 4); break; case 4 : - if (self_[cx][0] != '*') writeg(self_[cx], 4); + if (self_[cx][0] != '*') + g_vm->_screenSurface.writeg(self_[cx], 4); break; case 5 : - if (dis[cx][0] != '*') writeg(dis[cx], 4); + if (dis[cx][0] != '*') + g_vm->_screenSurface.writeg(dis[cx], 4); break; case 6 : - writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); + g_vm->_screenSurface.writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); break; case 7 : { Common::String s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); - writeg(s, 4); + g_vm->_screenSurface.writeg(s, 4); break; } case 8 : if (cx == 1) - writeg(g_vm->getString(S_RESTART), 4); + g_vm->_screenSurface.writeg(g_vm->getString(S_RESTART), 4); else { Common::String s = g_vm->getString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + cx); - writeg(s, 4); + g_vm->_screenSurface.writeg(s, 4); } break; } - putxy(xco, ywhere + 8); + g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (!(cx == nb_lig)); test0 = true; show_mouse(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ae303e99fd..89787312d0 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -221,23 +221,24 @@ void ecr2(Common::String str_) { /* debug('ecr2 : '+str_);*/ if (res == 1) tab = 10; else tab = 6; - putxy(8, 177); + g_vm->_screenSurface.putxy(8, 177); tlig = 59 + pred(int, res) * 36; - if ((int)str_.size() < tlig) writeg(str_, 5); + if ((int)str_.size() < tlig) + g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { - putxy(8, 176); - writeg(copy(str_, 1, pred(int, tlig)), 5); - putxy(8, 182); - writeg(copy(str_, tlig, tlig << 1), 5); + g_vm->_screenSurface.putxy(8, 176); + g_vm->_screenSurface.writeg(copy(str_, 1, pred(int, tlig)), 5); + g_vm->_screenSurface.putxy(8, 182); + g_vm->_screenSurface.writeg(copy(str_, tlig, tlig << 1), 5); } else { f2_all = true; clsf2(); - putxy(8, 176); - writeg(copy(str_, 1, pred(int, tlig)), 5); - putxy(8, 182); - writeg(copy(str_, tlig, pred(int, (tlig << 1))), 5); - putxy(8, 190); - writeg(copy(str_, tlig << 1, tlig * 3), 5); + g_vm->_screenSurface.putxy(8, 176); + g_vm->_screenSurface.writeg(copy(str_, 1, pred(int, tlig)), 5); + g_vm->_screenSurface.putxy(8, 182); + g_vm->_screenSurface.writeg(copy(str_, tlig, pred(int, (tlig << 1))), 5); + g_vm->_screenSurface.putxy(8, 190); + g_vm->_screenSurface.writeg(copy(str_, tlig << 1, tlig * 3), 5); } } @@ -254,8 +255,8 @@ void clsf3() { void ecr3(Common::String text) { /* debug('ecr3 : '+text);*/ clsf3(); - putxy(8, 192); - writeg(text, 5); + g_vm->_screenSurface.putxy(8, 192); + g_vm->_screenSurface.writeg(text, 5); } void ecrf6() { @@ -295,8 +296,8 @@ void clsf10() { co = 10; else co = 6; co = 574 - ((uint)co * st.size() >> 1); - putxy(co, 92); - writeg(st, 4); + g_vm->_screenSurface.putxy(co, 92); + g_vm->_screenSurface.writeg(st, 4); if (res == 1) co = 620; else co = 584; box(15, gd, 560, 24, co, 86, 255); @@ -454,10 +455,10 @@ void f3f8() { if (res == 1) co = 107; else co = 64; - putxy(3, 44); - writeg(g_vm->getString(S_F3), 5); - ywhere = 51; - writeg(g_vm->getString(S_F8), 5); + g_vm->_screenSurface.putxy(3, 44); + g_vm->_screenSurface.writeg(g_vm->getString(S_F3), 5); + g_vm->_screenSurface._textPos.y = 51; + g_vm->_screenSurface.writeg(g_vm->getString(S_F8), 5); boite(0, 42, co, 16, 7); } @@ -488,43 +489,43 @@ void affper(int per) { for (cx = 1; cx <= 8; cx ++) menu_disable(disc[cx]); clsf10(); if ((per & 128) == 128) { - putxy(560, 24); - writeg("LEO", 4); + g_vm->_screenSurface.putxy(560, 24); + g_vm->_screenSurface.writeg("LEO", 4); menu_enable(disc[1]); } if ((per & 64) == 64) { - putxy(560, 32); - writeg("PAT", 4); + g_vm->_screenSurface.putxy(560, 32); + g_vm->_screenSurface.writeg("PAT", 4); menu_enable(disc[2]); } if ((per & 32) == 32) { - putxy(560, 40); - writeg("GUY", 4); + g_vm->_screenSurface.putxy(560, 40); + g_vm->_screenSurface.writeg("GUY", 4); menu_enable(disc[3]); } if ((per & 16) == 16) { - putxy(560, 48); - writeg("EVA", 4); + g_vm->_screenSurface.putxy(560, 48); + g_vm->_screenSurface.writeg("EVA", 4); menu_enable(disc[4]); } if ((per & 8) == 8) { - putxy(560, 56); - writeg("BOB", 4); + g_vm->_screenSurface.putxy(560, 56); + g_vm->_screenSurface.writeg("BOB", 4); menu_enable(disc[5]); } if ((per & 4) == 4) { - putxy(560, 64); - writeg("LUC", 4); + g_vm->_screenSurface.putxy(560, 64); + g_vm->_screenSurface.writeg("LUC", 4); menu_enable(disc[6]); } if ((per & 2) == 2) { - putxy(560, 72); - writeg("IDA", 4); + g_vm->_screenSurface.putxy(560, 72); + g_vm->_screenSurface.writeg("IDA", 4); menu_enable(disc[7]); } if ((per & 1) == 1) { - putxy(560, 80); - writeg("MAX", 4); + g_vm->_screenSurface.putxy(560, 80); + g_vm->_screenSurface.writeg("MAX", 4); menu_enable(disc[8]); } ipers = per; @@ -621,12 +622,12 @@ void person() { menu_disable(disc[cf]); clsf10(); - putxy(560, 30); - writeg(g_vm->getString(S_YOU), 4); - putxy(560, 50); - writeg(g_vm->getString(S_ARE), 4); - putxy(560, 70); - writeg(g_vm->getString(S_ALONE), 4); + g_vm->_screenSurface.putxy(560, 30); + g_vm->_screenSurface.writeg(g_vm->getString(S_YOU), 4); + g_vm->_screenSurface.putxy(560, 50); + g_vm->_screenSurface.writeg(g_vm->getString(S_ARE), 4); + g_vm->_screenSurface.putxy(560, 70); + g_vm->_screenSurface.writeg(g_vm->getString(S_ALONE), 4); ipers = 0; } @@ -664,14 +665,16 @@ void pendule() { if (h == 0) h = 12; droite(((uint)x >> 1)*res, y, ((uint)(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); + g_vm->_screenSurface.putxy(568, 154); + if (heu > 11) + g_vm->_screenSurface.writeg("PM ", 1); + else + g_vm->_screenSurface.writeg("AM ", 1); + g_vm->_screenSurface.putxy(550, 160); if ((jou >= 0) && (jou <= 8)) { Common::String tmp = g_vm->getString(S_DAY); tmp.insertChar((char)(jou + 49), 0); - writeg(tmp, 1); + g_vm->_screenSurface.writeg(tmp, 1); } } @@ -1218,8 +1221,10 @@ void phaz(int &haz, int &p, int cf) { } void writetp(Common::String s, int t) { - if (res == 2) writeg(s, t); - else writeg(copy(s, 1, 25), t); + if (res == 2) + g_vm->_screenSurface.writeg(s, t); + else + g_vm->_screenSurface.writeg(copy(s, 1, 25), t); } void messint(int nu) { diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index b8b76c1928..515fd836f6 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -182,10 +182,14 @@ void fenat(char ans) { int coul; hide_mouse(); - if (gd == cga) coul = 2; - else if (gd == her) coul = 1; - else coul = 12; - affcar(gd, 306, 193, coul, ord(ans)); + if (gd == cga) + coul = 2; + else if (gd == her) + coul = 1; + else + coul = 12; + + g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); boite(300, 191, 16, 8, 15); show_mouse(); } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 98429cc04e..631be60cf8 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -261,7 +261,6 @@ void show_mouse() { } break; } /* case Gd */ - affput(Common::Point(x_s, y_s), 0, 0); } void pos_mouse(int x, int y) { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index b42aa481ba..e7d75517be 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -26,7 +26,9 @@ */ #include "mortevielle/outtext.h" +#include "mortevielle/graphics.h" #include "mortevielle/level15.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" #include "common/str.h" @@ -174,7 +176,7 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { /* debug(' .. Afftex');*/ - putxy(x, y); + g_vm->_screenSurface.putxy(x, y); if (res == 1) tab = 10; else tab = 6; dx = dx * 6; @@ -189,12 +191,12 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { while (! the_end) { switch (ch[p]) { case '@' : { - writeg(s, typ); + g_vm->_screenSurface.writeg(s, typ); s = ""; p = p + 1; xc = x; yc = yc + 6; - putxy(xc, yc); + g_vm->_screenSurface.putxy(xc, yc); } break; case ' ' : { @@ -202,7 +204,7 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { xc = xc + tab; p = p + 1; if (l_motsuiv(p, ch, tab) + xc > xf) { - writeg(s, typ); + g_vm->_screenSurface.writeg(s, typ); s = ""; xc = x; yc = yc + 6; @@ -214,21 +216,21 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { do { j = x; do { - putxy(j, i); - writeg(" ", 0); + g_vm->_screenSurface.putxy(j, i); + g_vm->_screenSurface.writeg(" ", 0); j = j + 6; } while (!(j > xf)); i = i + 6; } while (!(i > yf)); yc = y; } - putxy(xc, yc); + g_vm->_screenSurface.putxy(xc, yc); } } break; case '$' : { the_end = true; - writeg(s, typ); + g_vm->_screenSurface.writeg(s, typ); } break; default: { diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 8fb45b5ca3..7deda53d7b 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -339,8 +339,8 @@ void suite() { dessine(ades, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - putxy(104 + 72 * res, 185); - writeg(cpr, 0); + g_vm->_screenSurface.putxy(104 + 72 * res, 185); + g_vm->_screenSurface.writeg(cpr, 0); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 027d74791a..6a52b2cdb2 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -42,53 +42,4 @@ void clear_box(int x, int y, int dx) { box(0, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); } -void writeg(Common::String l, int c) - -{ - int i, x, xo, yo; - int cecr = 0; - - /* debug('writeg : '+l);*/ - - if (l == "") return; - hide_mouse(); - xo = xwhere; - yo = ywhere; - if (res == 2) i = 6; - else i = 10; - x = xo + i * l.size(); - 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 <= (int)l.size(); x ++) { - affcar(gd, xo, yo, cecr, ord(l[x - 1])); - xo = xo + i; - } - show_mouse(); - - // TODO: Move screen updates to main loop once constructed - g_vm->_screenSurface.updateScreen(); -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h index 8484214fa3..09d5758f63 100644 --- a/engines/mortevielle/sprint.h +++ b/engines/mortevielle/sprint.h @@ -34,7 +34,6 @@ namespace Mortevielle { extern void fill_box(int x, int y, int dx); extern void clear_box(int x, int y, int dx); -extern void writeg(Common::String l, int c); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index cd84b934a1..77da4a50a0 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -164,8 +164,6 @@ int x, prebru, typlec, num_ph, - xwhere, - ywhere, numpal, lderobj, nb_word, @@ -235,27 +233,6 @@ void hirs() { g_vm->_screenSurface.clearScreen(); } -/** - * Draws either a single pixel or a character to the screen - */ -void affput(const Common::Point &pt, int palIndex, int ch) { - if (ch == 0) - g_vm->_screenSurface.setPixel(pt, palIndex); - else - g_vm->_screenSurface.writeCharacter(pt, ch, palIndex); -} - -void affcar(int gd, int x, int y, int coul, int chr) { - if (res == 1) - affput(Common::Point(((uint)x >> 1), y), coul, chr); - else - affput(Common::Point(x, y), coul, chr); -} - -void putpix(int gd, int x, int y, int coul) { - affput(Common::Point(x, y), coul, 0); -} - /** * Returns a substring of the given string * @param s Source string diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 2e2bf539f2..739934277c 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -336,8 +336,6 @@ extern int x, prebru, typlec, num_ph, - xwhere, - ywhere, numpal, lderobj, nb_word, @@ -399,11 +397,8 @@ extern byte adcfiec[822 * 128]; /*---------------------------------------------------------------------------*/ void hirs(); -void affcar(int gd, int x, int y, int coul, int chr); -void putpix(int gd, int x, int y, int coul); Common::String copy(const Common::String &s, int idx, size_t size); void Val(const Common::String &s, int &V, int Code); -void affput(const Common::Point &pt, int palIndex, int ch); /*---------------------------------------------------------------------------*/ /*------------------------------ STUBS ------------------------------*/ -- cgit v1.2.3 From 85df261941c562ae9bdcaba82f8a8b8b8ae4215a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 20:49:04 +1100 Subject: MORTEVIELLE: Removed boite() stab and remap calls to ScreenSurface::drawBox --- engines/mortevielle/boite.cpp | 41 ----------------------------------------- engines/mortevielle/boite.h | 37 ------------------------------------- engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 20 ++++++++++---------- engines/mortevielle/mor2.cpp | 11 +++++------ engines/mortevielle/ques.cpp | 3 +-- 6 files changed, 16 insertions(+), 97 deletions(-) delete mode 100644 engines/mortevielle/boite.cpp delete mode 100644 engines/mortevielle/boite.h diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp deleted file mode 100644 index 7072085c23..0000000000 --- a/engines/mortevielle/boite.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/textconsole.h" -#include "mortevielle/boite.h" -#include "mortevielle/mortevielle.h" - -namespace Mortevielle { - -//Translation: box() -void boite(int x, int y, int dx, int dy, int coul) { - debugC(1, kMortevielleCore, "TODO: boite is deprecated in favour of ScreenSurface::drawBox"); - - g_vm->_screenSurface.drawBox(x, y, dx, dy, coul); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/boite.h b/engines/mortevielle/boite.h deleted file mode 100644 index bff3e82d55..0000000000 --- a/engines/mortevielle/boite.h +++ /dev/null @@ -1,37 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_BOITE_H -#define MORTEVIELLE_BOITE_H - -namespace Mortevielle { - -extern void boite(int x, int y, int dx, int dy, int coul); - - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 28c6c7fc6d..4d2072a913 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -4,7 +4,6 @@ MODULE_OBJS := \ actions.o \ alert.o \ asm.o \ - boite.o \ detection.o \ droite.o \ graphics.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 89787312d0..6e2d1057cb 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -30,7 +30,6 @@ #include "common/system.h" #include "common/textconsole.h" #include "mortevielle/alert.h" -#include "mortevielle/boite.h" #include "mortevielle/droite.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" @@ -141,7 +140,8 @@ void initouv() { } void ecrf1() { - boite(0, 11, 512, 163, 15); /* grand dessin */ //Translation: Large drawing + // Large drawing + g_vm->_screenSurface.drawBox(0, 11, 512, 163, 15); } void clsf1() { @@ -199,11 +199,11 @@ void clsf2() { hide_mouse(); if (f2_all) { box(0, gd, 1, 176, 633, 199, 255); - boite(0, 175, 634, 24, 15); + g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); f2_all = false; } else { box(0, gd, 1, 176, 633, 190, 255); - boite(0, 175, 634, 15, 15); + g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); } show_mouse(); } @@ -211,7 +211,7 @@ void clsf2() { void ecrf2() { /* debug('ecrf2'); */ text_color(5); - /*boite(0,175,630,15,15);*/ + /*g_vm->_screenSurface.drawBox(0,175,630,15,15);*/ } void ecr2(Common::String str_) { @@ -248,7 +248,7 @@ void clsf3() { /* debug('clsf3'); */ hide_mouse(); box(0, gd, 1, 192, 633, 199, 255); - boite(0, 191, 634, 8, 15); + g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); show_mouse(); } @@ -262,7 +262,7 @@ void ecr3(Common::String text) { void ecrf6() { /* debug('ecrf6'); */ text_color(5); - boite(62, 33, 363, 80, 15); + g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15); } void ecrf7() { @@ -459,7 +459,7 @@ void f3f8() { g_vm->_screenSurface.writeg(g_vm->getString(S_F3), 5); g_vm->_screenSurface._textPos.y = 51; g_vm->_screenSurface.writeg(g_vm->getString(S_F8), 5); - boite(0, 42, co, 16, 7); + g_vm->_screenSurface.drawBox(0, 42, co, 16, 7); } void t5(int cx) { @@ -1321,10 +1321,10 @@ void dessin(int ad) { clsf1(); if (caff > 99) { dessine(ades, 60, 33); - boite(118, 32, 291, 121, 15); /* cadre moyen */ //Translation: Medium box + g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); /* cadre moyen */ //Translation: Medium box } else if (caff > 69) { dessine(ades, 112, 48); /* ttes */ //Translation: Heads - boite(222, 47, 155, 91, 15); + g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { dessine(ades, 0, 12); ecrf1(); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 515fd836f6..496ce64f92 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -27,7 +27,6 @@ #include "mortevielle/mor2.h" #include "mortevielle/alert.h" -#include "mortevielle/boite.h" #include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -190,7 +189,7 @@ void fenat(char ans) { coul = 12; g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - boite(300, 191, 16, 8, 15); + g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); show_mouse(); } @@ -308,7 +307,7 @@ void tperd() { t11(21, cx); g_vm->_loseGame = true; clsf1(); - boite(60, 35, 400, 50, 15); + g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); repon(9, crep); clsf2(); clsf3(); @@ -402,7 +401,7 @@ void sparl(float adr, float rep) { deline(repint + c_paroles, st, tay); afftex(st, 230, 4, 65, 24, 5); f3f8(); - /*boite(43,30,90,19,15); + /*g_vm->_screenSurface.drawBox(43,30,90,19,15); gotoxy(7,5); write('F3: Encore'); gotoxy(7,6); @@ -451,7 +450,7 @@ void mennor() { void premtet() { dessine(ades, 10, 80); - boite(18, 79, 155, 91, 15); + g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); } /* NIVEAU 5 */ @@ -499,7 +498,7 @@ void t1sama() { /* On entre dans le manoir */ //Translation: affper(ipers); caff = 77; afdes(0); - boite(223, 47, 155, 91, 15); + g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); tkey1(false); mennor(); diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index a223e4956f..924b378e14 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -26,7 +26,6 @@ */ #include "common/str.h" -#include "mortevielle/boite.h" #include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" @@ -101,7 +100,7 @@ namespace Mortevielle { coor[j + 1].etat = false; if (res == 1) rep = 10; else rep = 6; - boite(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); + g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); rep = 0; j = 0; memk = 0; -- cgit v1.2.3 From 855fed35d0c7548c43ceb9a77f811c15c60ea325 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 21:06:41 +1100 Subject: MORTEVIELLE: Fixed English strings for F3 and F8 --- devtools/create_mortdat/create_mortdat.cpp | 4 ++-- dists/engine-data/mort.dat | Bin 1797 -> 1799 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 773ddaeeed..aff67dc949 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -196,8 +196,8 @@ void writeEnglishStaticStrings() { " Load", " Restart ", - "F3: More", - "F8: Restart", + "F3: Repeat", + "F8: Proceed", "Hide self", "take", " probe ", diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 8e0171fe5a..b2caafee96 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 5448664f8bcae2d8aca4bdfb85f0d51563a76428 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 21:08:12 +1100 Subject: MORTEVIELLE: Fixed the F3/F8 box width to adjust to the text size --- engines/mortevielle/graphics.cpp | 10 ++++++++-- engines/mortevielle/graphics.h | 1 + engines/mortevielle/mor.cpp | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e9c8c1e7e9..ad421988d4 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1090,9 +1090,15 @@ void ScreenSurface::writeg(const Common::String &l, int c) { pt.x += i; } show_mouse(); +} + +/** + * Gets the width in pixels of the specified string + */ +int ScreenSurface::getStringWidth(const Common::String &s) { + int charWidth = (res == 2) ? 6 : 10; - // TODO: Move screen updates to main loop once constructed - g_vm->_screenSurface.updateScreen(); + return s.size() * charWidth; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 258f4cfacc..b196fce7f9 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -91,6 +91,7 @@ public: void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); + int getStringWidth(const Common::String &s); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6e2d1057cb..ba480ce125 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -451,15 +451,21 @@ void repon(int f, int m) { } void f3f8() { - int co; + Common::String f3 = g_vm->getString(S_F3); + Common::String f8 = g_vm->getString(S_F8); - if (res == 1) co = 107; - else co = 64; + // Write the F3 and F8 text strings g_vm->_screenSurface.putxy(3, 44); - g_vm->_screenSurface.writeg(g_vm->getString(S_F3), 5); + g_vm->_screenSurface.writeg(f3, 5); g_vm->_screenSurface._textPos.y = 51; - g_vm->_screenSurface.writeg(g_vm->getString(S_F8), 5); - g_vm->_screenSurface.drawBox(0, 42, co, 16, 7); + g_vm->_screenSurface.writeg(f8, 5); + + // Get the width of the written text strings + int f3Width = g_vm->_screenSurface.getStringWidth(f3); + int f8Width = g_vm->_screenSurface.getStringWidth(f8); + + // Write out the bounding box + g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); } void t5(int cx) { -- cgit v1.2.3 From bbc8ba9ad61430a8449bcfc04bd483cbc219f194 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 21:38:27 +1100 Subject: MORTEVIELLE: Replace old calls to afff to use new decode/drawPicture methods --- engines/mortevielle/mor.cpp | 28 ++++++++++++++++++++-------- engines/mortevielle/var_mor.cpp | 5 ----- engines/mortevielle/var_mor.h | 2 -- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ba480ce125..dbecbc9e7d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1233,18 +1233,29 @@ void writetp(Common::String s, int t) { g_vm->_screenSurface.writeg(copy(s, 1, 25), t); } +/** + * Shows the waiting message when changing scenes. + * @remarks Because modern computesr are so much quicker. There's no point in showing + * a waiting message between scenes. + */ void messint(int nu) { - /* debug('messint'); */ + /* Method is deprecated clsf1(); clsf2(); clsf3(); - decomp(0x73a2, 1008); + + GfxSurface surface; + surface.decode(&mem[0x73a2 * 16 + 1008]); + WRITE_LE_UINT16(&mem[0x7413 * 16 + 12], 80); WRITE_LE_UINT16(&mem[0x7413 * 16 + 14], 40); writepal(90); - afff(gd, 0x73a2, 1008, 0, 0); - afff(gd, 0x73a2, 1008, 0, 70); + + g_vm->_screenSurface.drawPicture(surface, 0, 0); + g_vm->_screenSurface.drawPicture(surface, 0, 70); + repon(7, nu); + */ } void aniof(int ouf, int num) { @@ -1257,11 +1268,12 @@ void aniof(int ouf, int num) { else if (num == 4) num = 3; ad = adani; offset = animof(ouf, num); - decomp(ad, offset); - hide_mouse(); - afff(gd, ad, offset, 0, 12); + + GfxSurface surface; + surface.decode(&mem[ad * 16 + offset]); + g_vm->_screenSurface.drawPicture(surface, 0, 12); + ecrf1(); - show_mouse(); } void musique(int so) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 77da4a50a0..487231673a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -313,11 +313,6 @@ void decomp(int seg, int dep) { debugC(1, kMortevielleCore, "TODO: decomp deprecated in faovur of GfxSurface::decode"); } -// (* external 'c:\mc\affich.com'; *) -void afff(int Gd, int seg, int dep, int x, int y) { - warning("TODO: afff"); -} - // (* external 'c:\mc\reusint.com'; *) void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 739934277c..e0b0480d53 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -437,8 +437,6 @@ extern void s_sauv(int Gd, int y, int dy); extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); // (* external 'c:\mc\decomp.com'; *) extern void decomp(int seg, int dep); -// (* external 'c:\mc\affich.com'; *) -extern void afff(int Gd, int seg, int dep, int x, int y); } // End of namespace Mortevielle -- cgit v1.2.3 From ec2d9d6d77a5f59d8a2332973d407c3fb02379d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 21:42:23 +1100 Subject: MORTEVIELLE: Added CHECK_QUIT to afdes() event loop --- engines/mortevielle/mor2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 496ce64f92..71546e943b 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -213,6 +213,7 @@ void tkey1(bool d) { if (d) tinke(); quest = keypressed(); read_pos_mouse(x, y, c); + CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); if (quest) key = testou(); g_vm->setMouseClick(false); -- cgit v1.2.3 From 459ef933395e9f7108c6047c7d07b2a22351a315 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 21:52:59 +1100 Subject: MORTEVIELLE: Add comments to the deprecated s_char method --- engines/mortevielle/var_mor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 487231673a..9b735bdeda 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -297,9 +297,13 @@ void palette(int v1) { warning("TODO: palette"); } -// (* external 'c:\mc\charecr.com'; *) +/** + * Restore a screen area + * @remarks Currently implemented differently in ScummVM, so this method is redundant. + * Original assembly was present in 'charecr.asm' + */ void s_char(int Gd, int y, int dy) { - warning("TODO: s_char"); + debugC(1, kMortevielleCore, "s_char called"); } // (* external 'c:\mc\boite.com'; *) -- cgit v1.2.3 From a29bd180f730ba79e380d9c04a140ab8303c5d77 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:03:50 +1100 Subject: MORTEVIELLE: Replaced all box() calls with ScreenSurface::fillBox --- engines/mortevielle/alert.cpp | 6 +++--- engines/mortevielle/graphics.cpp | 10 +++------- engines/mortevielle/graphics.h | 2 +- engines/mortevielle/menu.cpp | 8 ++++---- engines/mortevielle/mor.cpp | 14 +++++++------- engines/mortevielle/ques.cpp | 2 +- engines/mortevielle/sprint.cpp | 6 ++++-- engines/mortevielle/var_mor.cpp | 11 ----------- engines/mortevielle/var_mor.h | 4 ---- 9 files changed, 23 insertions(+), 40 deletions(-) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 73befd9196..8f2ff4ffd3 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -100,9 +100,9 @@ static void fait_boite(int lidep, int nli, int tx) { y = pred(int, 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); + g_vm->_screenSurface.fillBox(15, Common::Rect(x, y, xx, yy)); + g_vm->_screenSurface.fillBox(0, Common::Rect(x, y + 2, xx, y + 4)); + g_vm->_screenSurface.fillBox(0, Common::Rect(x, yy - 4, xx, yy - 2)); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index ad421988d4..3ac08cfea1 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1006,16 +1006,12 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ -void ScreenSurface::fillBox(int colour, const Common::Rect &bounds, int patt) { +void ScreenSurface::fillBox(int colour, const Common::Rect &bounds) { Graphics::Surface destSurface = lockArea(Common::Rect(bounds.left, bounds.top * 2, bounds.right, bounds.bottom * 2)); // Fill the area destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), colour); - - // TODO: Figure out what effect patterns of other than '0xff' have - if (patt != 0xff) - warning("TODO: Figure out operation of ScreenSurface::box when pattern is %xh", patt); } /** @@ -1065,7 +1061,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { case 1: case 3 : { cecr = 0; - box(15, gd, pt.x, pt.y, x, pt.y + 7, 255); + g_vm->_screenSurface.fillBox(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; case 4 : { @@ -1079,7 +1075,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { case 0: case 2 : { cecr = 15; - box(0, gd, pt.x, pt.y, x, pt.y + 7, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index b196fce7f9..38f2ac3068 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -87,7 +87,7 @@ public: void copyFrom(Graphics::Surface &src, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); - void fillBox(int colour, const Common::Rect &bounds, int patt); + void fillBox(int colour, const Common::Rect &bounds); void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 07626b3894..71b0ccf407 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -146,7 +146,7 @@ void menu_aff() { clrscr; halt; end;*/ - box(7, gd, 0, 0, 639, 10, 255); + g_vm->_screenSurface.fillBox(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; if (gd == cga) color = 1; else color = 9; @@ -278,9 +278,9 @@ void menu_down(int ii) { 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); + g_vm->_screenSurface.fillBox(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); + g_vm->_screenSurface.fillBox(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); + g_vm->_screenSurface.fillBox(0, Common::Rect(xco, 8 + (don[ii][2] << 1), xcc + 4, 12 + (don[ii][2] << 1))); g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index dbecbc9e7d..ea9012e49e 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -149,7 +149,7 @@ void clsf1() { /* debug('clsf1'); */ hide_mouse(); - box(0, gd, 0, 11, 514, 175, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(0, 11, 514, 175)); /* if Gd=ams then port[$3DD]:=15; case Gd of ams, @@ -198,11 +198,11 @@ void clsf2() { /* debug('clsf2'); */ hide_mouse(); if (f2_all) { - box(0, gd, 1, 176, 633, 199, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); f2_all = false; } else { - box(0, gd, 1, 176, 633, 190, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); } show_mouse(); @@ -247,7 +247,7 @@ void clsf3() { /* debug('clsf3'); */ hide_mouse(); - box(0, gd, 1, 192, 633, 199, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(1, 192, 633, 199)); g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); show_mouse(); } @@ -285,7 +285,7 @@ void clsf10() { co = 600; cod = 544; } - box(15, gd, cod, 93, co, 98, 255); + g_vm->_screenSurface.fillBox(15, Common::Rect(cod, 93, co, 98)); if (s.conf < 33) st = g_vm->getString(S_COOL); else if (s.conf < 66) @@ -300,7 +300,7 @@ void clsf10() { g_vm->_screenSurface.writeg(st, 4); if (res == 1) co = 620; else co = 584; - box(15, gd, 560, 24, co, 86, 255); + g_vm->_screenSurface.fillBox(15, Common::Rect(560, 24, co, 86)); /* rempli(69,12,32,5,255);*/ show_mouse(); } @@ -319,7 +319,7 @@ void paint_rect(int x, int y, int dx, int dy) { /* debug('paint_rect'); */ if (gd == cga) co = 3; else co = 11; - box(co, gd, x, y, x + dx, y + dy, 255); + g_vm->_screenSurface.fillBox(co, Common::Rect(x, y, x + dx, y + dy)); } int hazard(int min, int max) { diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 924b378e14..5453500fcd 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -63,7 +63,7 @@ namespace Mortevielle { deline(ta[i], st, tay); if (res == 1) y = 29; else y = 23; - box(15, gd, 0, 14, 630, y, 255); + g_vm->_screenSurface.fillBox(15, Common::Rect(0, 14, 630, y)); afftex(st, 20, 15, 100, 2, 0); if (i != 10) { prem = ta[i] + 1; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp index 6a52b2cdb2..e6d00358d5 100644 --- a/engines/mortevielle/sprint.cpp +++ b/engines/mortevielle/sprint.cpp @@ -35,11 +35,13 @@ namespace Mortevielle { void fill_box(int x, int y, int dx) { - box(15, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); + g_vm->_screenSurface.fillBox(15, Common::Rect(pred(int, x) << 3, pred(int, y) << 3, + pred(int, x + dx) << 3, y << 3)); } void clear_box(int x, int y, int dx) { - box(0, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255); + g_vm->_screenSurface.fillBox(0, Common::Rect(pred(int, x) << 3, pred(int, y) << 3, + pred(int, x + dx) << 3, y << 3)); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 9b735bdeda..1fc18e70d0 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -306,17 +306,6 @@ void s_char(int Gd, int y, int dy) { debugC(1, kMortevielleCore, "s_char called"); } -// (* external 'c:\mc\boite.com'; *) -void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) { - debugC(1, kMortevielleCore, "TODO: box deprecated in favour of GfxSurface::fillBox"); - g_vm->_screenSurface.fillBox(c, Common::Rect(xo, yo, xi, yi), patt); -} - -// (* external 'c:\mc\decomp.com'; *) -void decomp(int seg, int dep) { - debugC(1, kMortevielleCore, "TODO: decomp deprecated in faovur of GfxSurface::decode"); -} - // (* external 'c:\mc\reusint.com'; *) void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index e0b0480d53..5f13a254dd 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -433,10 +433,6 @@ extern int get_random_number(int minval, int maxval); extern void s_char(int Gd, int y, int dy); // (* external 'c:\mc\sauvecr.com'; *) extern void s_sauv(int Gd, int y, int dy); -// (* external 'c:\mc\boite.com'; *) -extern void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt); -// (* external 'c:\mc\decomp.com'; *) -extern void decomp(int seg, int dep); } // End of namespace Mortevielle -- cgit v1.2.3 From 4cd9be9f2f23631255ac4c748f5e01f8fc4e5518 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:21:14 +1100 Subject: MORTEVIELLE: Removed unused clear_box() and fill_box(), and renamed fillBox to fillRect --- engines/mortevielle/alert.cpp | 7 +++--- engines/mortevielle/graphics.cpp | 6 ++--- engines/mortevielle/graphics.h | 2 +- engines/mortevielle/menu.cpp | 9 ++++---- engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 15 ++++++------- engines/mortevielle/outtext.cpp | 1 - engines/mortevielle/ovd1.cpp | 1 - engines/mortevielle/ques.cpp | 3 +-- engines/mortevielle/sprint.cpp | 47 ---------------------------------------- engines/mortevielle/sprint.h | 39 --------------------------------- engines/mortevielle/var_mor.cpp | 1 - 12 files changed, 19 insertions(+), 113 deletions(-) delete mode 100644 engines/mortevielle/sprint.cpp delete mode 100644 engines/mortevielle/sprint.h diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 8f2ff4ffd3..6eb7d5e912 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -30,7 +30,6 @@ #include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" -#include "mortevielle/sprint.h" namespace Mortevielle { @@ -100,9 +99,9 @@ static void fait_boite(int lidep, int nli, int tx) { y = pred(int, lidep) << 3; xx = x + tx; yy = y + (nli << 3); - g_vm->_screenSurface.fillBox(15, Common::Rect(x, y, xx, yy)); - g_vm->_screenSurface.fillBox(0, Common::Rect(x, y + 2, xx, y + 4)); - g_vm->_screenSurface.fillBox(0, Common::Rect(x, yy - 4, xx, yy - 2)); + g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); + g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3ac08cfea1..bdf6c86daa 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1006,7 +1006,7 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ -void ScreenSurface::fillBox(int colour, const Common::Rect &bounds) { +void ScreenSurface::fillRect(int colour, const Common::Rect &bounds) { Graphics::Surface destSurface = lockArea(Common::Rect(bounds.left, bounds.top * 2, bounds.right, bounds.bottom * 2)); @@ -1061,7 +1061,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { case 1: case 3 : { cecr = 0; - g_vm->_screenSurface.fillBox(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + g_vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; case 4 : { @@ -1075,7 +1075,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { case 0: case 2 : { cecr = 15; - g_vm->_screenSurface.fillBox(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + g_vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 38f2ac3068..1daad5720b 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -87,7 +87,7 @@ public: void copyFrom(Graphics::Surface &src, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); - void fillBox(int colour, const Common::Rect &bounds); + void fillRect(int colour, const Common::Rect &bounds); void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 71b0ccf407..12ccbe3ff5 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -32,7 +32,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" -#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -146,7 +145,7 @@ void menu_aff() { clrscr; halt; end;*/ - g_vm->_screenSurface.fillBox(7, Common::Rect(0, 0, 639, 10)); + g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; if (gd == cga) color = 1; else color = 9; @@ -278,9 +277,9 @@ void menu_down(int ii) { if (res == 1) cx = 10; else cx = 6; xcc = xco + (don[ii][3] * cx) + 6; - g_vm->_screenSurface.fillBox(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); - g_vm->_screenSurface.fillBox(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); - g_vm->_screenSurface.fillBox(0, Common::Rect(xco, 8 + (don[ii][2] << 1), xcc + 4, 12 + (don[ii][2] << 1))); + g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (don[ii][2] << 1), xcc + 4, 12 + (don[ii][2] << 1))); g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 4d2072a913..0688fd5ac0 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -22,7 +22,6 @@ MODULE_OBJS := \ ques.o \ saveload.o \ sound.o \ - sprint.o \ taffich.o \ var_mor.o diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ea9012e49e..2f48999638 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -38,7 +38,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/parole2.h" -#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -149,7 +148,7 @@ void clsf1() { /* debug('clsf1'); */ hide_mouse(); - g_vm->_screenSurface.fillBox(0, Common::Rect(0, 11, 514, 175)); + g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); /* if Gd=ams then port[$3DD]:=15; case Gd of ams, @@ -198,11 +197,11 @@ void clsf2() { /* debug('clsf2'); */ hide_mouse(); if (f2_all) { - g_vm->_screenSurface.fillBox(0, Common::Rect(1, 176, 633, 199)); + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); f2_all = false; } else { - g_vm->_screenSurface.fillBox(0, Common::Rect(1, 176, 633, 190)); + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); } show_mouse(); @@ -247,7 +246,7 @@ void clsf3() { /* debug('clsf3'); */ hide_mouse(); - g_vm->_screenSurface.fillBox(0, Common::Rect(1, 192, 633, 199)); + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); show_mouse(); } @@ -285,7 +284,7 @@ void clsf10() { co = 600; cod = 544; } - g_vm->_screenSurface.fillBox(15, Common::Rect(cod, 93, co, 98)); + g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); if (s.conf < 33) st = g_vm->getString(S_COOL); else if (s.conf < 66) @@ -300,7 +299,7 @@ void clsf10() { g_vm->_screenSurface.writeg(st, 4); if (res == 1) co = 620; else co = 584; - g_vm->_screenSurface.fillBox(15, Common::Rect(560, 24, co, 86)); + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, co, 86)); /* rempli(69,12,32,5,255);*/ show_mouse(); } @@ -319,7 +318,7 @@ void paint_rect(int x, int y, int dx, int dy) { /* debug('paint_rect'); */ if (gd == cga) co = 3; else co = 11; - g_vm->_screenSurface.fillBox(co, Common::Rect(x, y, x + dx, y + dy)); + g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } int hazard(int min, int max) { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e7d75517be..4f2cadef74 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -29,7 +29,6 @@ #include "mortevielle/graphics.h" #include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" #include "common/str.h" diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 7deda53d7b..df79b72a6b 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -37,7 +37,6 @@ #include "mortevielle/ovd1.h" #include "mortevielle/parole.h" #include "mortevielle/sound.h" -#include "mortevielle/sprint.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 5453500fcd..17921951cf 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -31,7 +31,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ques.h" -#include "mortevielle/sprint.h" namespace Mortevielle { @@ -63,7 +62,7 @@ namespace Mortevielle { deline(ta[i], st, tay); if (res == 1) y = 29; else y = 23; - g_vm->_screenSurface.fillBox(15, Common::Rect(0, 14, 630, y)); + g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); afftex(st, 20, 15, 100, 2, 0); if (i != 10) { prem = ta[i] + 1; diff --git a/engines/mortevielle/sprint.cpp b/engines/mortevielle/sprint.cpp deleted file mode 100644 index e6d00358d5..0000000000 --- a/engines/mortevielle/sprint.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/str.h" -#include "common/textconsole.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/sprint.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void fill_box(int x, int y, int dx) { - g_vm->_screenSurface.fillBox(15, Common::Rect(pred(int, x) << 3, pred(int, y) << 3, - pred(int, x + dx) << 3, y << 3)); -} - -void clear_box(int x, int y, int dx) { - g_vm->_screenSurface.fillBox(0, Common::Rect(pred(int, x) << 3, pred(int, y) << 3, - pred(int, x + dx) << 3, y << 3)); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/sprint.h b/engines/mortevielle/sprint.h deleted file mode 100644 index 09d5758f63..0000000000 --- a/engines/mortevielle/sprint.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_SPRINT_H -#define MORTEVIELLE_SPRINT_H - -#include "common/str.h" - -namespace Mortevielle { - -extern void fill_box(int x, int y, int dx); -extern void clear_box(int x, int y, int dx); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 1fc18e70d0..7b6156263c 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -29,7 +29,6 @@ #include "common/str.h" #include "common/textconsole.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/sprint.h" #include "mortevielle/var_mor.h" namespace Mortevielle { -- cgit v1.2.3 From b1b7bd8501c7e474317c5ad8d8e8e9244e960a12 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:35:50 +1100 Subject: MORTEVIELLE: Removed all the code that was commented out in the original source --- engines/mortevielle/keyboard.cpp | 22 --------------------- engines/mortevielle/level15.cpp | 39 ------------------------------------- engines/mortevielle/mor.cpp | 29 ++------------------------- engines/mortevielle/mor2.cpp | 4 +--- engines/mortevielle/mortevielle.cpp | 3 --- engines/mortevielle/mouse.cpp | 18 +---------------- engines/mortevielle/ovd1.cpp | 31 ++++------------------------- engines/mortevielle/parole.cpp | 3 +-- engines/mortevielle/ques.cpp | 2 -- engines/mortevielle/var_mor.cpp | 2 +- 10 files changed, 10 insertions(+), 143 deletions(-) diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 4eba4c4a0d..a330a382d9 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -49,28 +49,6 @@ int testou() { case '\23' : sonoff = ! sonoff; break; - /* Prevent changing graphics mode - case '\1': - case '\3': - case '\5' : { - newgd = (uint)pred(int, 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 ((c_zzz == 1) && (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index c017bf24d3..8d89767e91 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -112,12 +112,6 @@ void pictout(int seg, int dep, int x, int y) { g_vm->_screenSurface.drawPicture(surface, x, y); } -/* -function calad(x,y:int):int; - begin - calad:=pred(x)+320*pred(y) - end; - */ void sauvecr(int y, int dy) { hide_mouse(); s_sauv(gd, y, dy); @@ -129,28 +123,6 @@ void charecr(int y, int dy) { s_char(gd, y, dy); show_mouse(); } -/* -function peek(ad:int):int; -begin - peek:=tabdon[ad]; -end; - -function peekw(ad:int):int; -begin - peekw:=tabdon[ad] shl 8+tabdon[succ(ad)]; -end; - -function peekl(ad:int):real; -begin - peekl:=tabdon[ad+3]+tabdon[ad+2] shl 8; -end; - - -procedure poke (ad,n:int); -begin - tabdon[ad]:=lo(n); -end; - */ void adzon() { Common::File f; @@ -186,15 +158,4 @@ int animof(int ouf, int num) { return animof_result; } -/*procedure affgd(offs,dep,x,y:int); -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;*/ - } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 2f48999638..36e23bf653 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -656,8 +656,7 @@ void pendule() { /* 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 ((gd == cga) || (gd == her)) @@ -1238,23 +1237,7 @@ void writetp(Common::String s, int t) { * a waiting message between scenes. */ void messint(int nu) { - /* Method is deprecated - clsf1(); - clsf2(); - clsf3(); - - GfxSurface surface; - surface.decode(&mem[0x73a2 * 16 + 1008]); - - WRITE_LE_UINT16(&mem[0x7413 * 16 + 12], 80); - WRITE_LE_UINT16(&mem[0x7413 * 16 + 14], 40); - writepal(90); - - g_vm->_screenSurface.drawPicture(surface, 0, 0); - g_vm->_screenSurface.drawPicture(surface, 0, 70); - - repon(7, nu); - */ + // Method is deprecated } void aniof(int ouf, int num) { @@ -1278,7 +1261,6 @@ void aniof(int ouf, int num) { void musique(int so) { bool i; int haz; - /* dep: array[1..5] of float;*/ /* debug('musique'); */ if (so == 0) { /*musik(0)*/ @@ -1315,13 +1297,6 @@ void musique(int so) { 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); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 71546e943b..5d9d9b24e2 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -677,9 +677,7 @@ void tcoord(int sx) atdon = atdon + 4; cy = succ(int, 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; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4cbc2b4ee3..026f17d718 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -134,9 +134,6 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - /*init_debug;*/ - /* ecri_seg;*/ - //pio_initialize(argc, argv); gd = ega; newgd = gd; zuul = false; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 631be60cf8..51af36b5f0 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -49,14 +49,13 @@ int s_s[12][6]; void init_mouse() { -// int i, j; registres reg; mouse_shwn = 0; x_s = 0; y_s = 0; p_o_s = 0; - /*int_m:= False;*/ + g_vm->setMouseClick(false); m_show = m_arrow; if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) int_m = false; @@ -75,21 +74,6 @@ void init_mouse() { } } -/*procedure change_mouse( t : int ); -begin - m_show:= t; -end;*/ - -/*procedure dessine_souris(xf,yf:int); - var x, xx, y :int; -begin - case m_show of - m_arrow : begin - affput(2,Gd,xf,yf,0,0); - end; - end; -end; */ - void hide_mouse() { int i, j, k, ps;; bool imp; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index df79b72a6b..6650dd04b2 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -45,25 +45,11 @@ namespace Mortevielle { // For ScummVM, we need to do check for file errors where we do the file access const int ioresult = 0; +/** + * Check for disk 2 being in the drive + */ void dem2() { - /* Deprecated check for disk 2 - - untyped_file f; - int 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); - */ + // Deprecated under ScummVM } void ani50() { @@ -75,15 +61,6 @@ void ani50() { 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(bool c) { caff = 50; maff = 0; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index ba43b5955d..2a8984195a 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -128,8 +128,7 @@ void veracf(byte b) { error("Missing file - sonmus.mor"); f.read(&mem[0x7414 * 16 + 0], 273); - /*blockread(f,mem[adson * 16+0],300); - blockread(f,mem[adson * 16+2400+0],245);*/ + g_vm->_soundManager.demus(&mem[0x7414 * 16], &mem[adson * 16], 273); f.close(); } diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index 17921951cf..aadedbd9cc 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -113,13 +113,11 @@ namespace Mortevielle { 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); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 7b6156263c..5c72961630 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -174,7 +174,7 @@ int x, int t_cph[6401]; byte tabdon[4001]; -/* t_dxx : array[0..121] of int;*/ + Common::String stpou; /* donne le % d'indices */ //Translation: "Provides the % of hints" byte is; char mode; -- cgit v1.2.3 From 0fa68f3406d3f6a5f31546ca2f91547fac04cd7a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:47:45 +1100 Subject: MORTEVIELLE: Remove more code that had been commented out in the original source --- engines/mortevielle/actions.cpp | 5 ++--- engines/mortevielle/droite.cpp | 4 +--- engines/mortevielle/mor.cpp | 47 +---------------------------------------- engines/mortevielle/mor2.cpp | 24 ++++++--------------- engines/mortevielle/taffich.cpp | 15 ------------- engines/mortevielle/var_mor.h | 2 +- 6 files changed, 11 insertions(+), 86 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index f3bc31b637..adcb17b5ed 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -862,7 +862,7 @@ L2: 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; @@ -882,7 +882,7 @@ L2: x = (hazard(0, 10)) - 5; parole(7, x, 1); aniof(1, 1); - /* tkey(1,32000);*/ + s.mlieu = ment; affrep(); debloc(s.mlieu); @@ -1069,7 +1069,6 @@ L2: mov_mouse(f, tou); CHECK_QUIT; - /* if keypressed then read(kbd,tou);*/ read_pos_mouse(x, y, c); x = x * (3 - res); if (x > 319) cx = 41; diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp index c0a48a51aa..fc52ff7bd3 100644 --- a/engines/mortevielle/droite.cpp +++ b/engines/mortevielle/droite.cpp @@ -41,7 +41,7 @@ void droite(int x, int y, int xx, int yy, int coul) { 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 = (float)((x - xx)) / (y - yy); b = (yr * xro - yro * xr) / (y - yy); @@ -52,7 +52,6 @@ void droite(int x, int y, int xx, int yy, int coul) { g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i = i + step; } while (!(i == yy)); - /*writeln(le_file,'X == ',a:3:3,' * Y + ',b:3:3);*/ } else { a = (float)((y - yy)) / (x - xx); b = ((yro * xr) - (yr * xro)) / (x - xx); @@ -63,7 +62,6 @@ void droite(int x, int y, int xx, int yy, int coul) { g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (!(i == xx)); - /*writeln(le_file,'Y == ',a:3:3,' * X + ',b:3:3);*/ } } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 36e23bf653..2d4df26e46 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -144,50 +144,10 @@ void ecrf1() { } void clsf1() { -// int i, j; - /* debug('clsf1'); */ hide_mouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - /* 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(); } @@ -208,9 +168,7 @@ void clsf2() { } void ecrf2() { - /* debug('ecrf2'); */ text_color(5); - /*g_vm->_screenSurface.drawBox(0,175,630,15,15);*/ } void ecr2(Common::String str_) { @@ -266,9 +224,6 @@ void ecrf6() { void ecrf7() { text_color(4); - /* draw_mode(2); - text_height(4*res); - text_style(normal);*/ } void clsf10() { diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 5d9d9b24e2..5d33175a60 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -402,11 +402,7 @@ void sparl(float adr, float rep) { deline(repint + c_paroles, st, tay); afftex(st, 230, 4, 65, 24, 5); f3f8(); - /*g_vm->_screenSurface.drawBox(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); @@ -428,19 +424,11 @@ void finfouil() { void mfoudi() { int 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); */ + for (cx = 1; cx <= 7; cx ++) + menu_disable(depl[cx]); + for (cx = 1; cx <= 11; cx ++) + menu_disable(men[cx]); + menut(sonder, g_vm->getString(S_SUITE)); menut(soulever, g_vm->getString(S_STOP)); } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 55fdbb7442..a9f727a41b 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -219,19 +219,4 @@ void taffich() { } } -/* begin - for i:=0 to 15 do - begin - PalH:=WRITE_LE_UINT16(&mem[$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;*/ - } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5f13a254dd..a872af199b 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -347,7 +347,7 @@ extern int x, extern int t_cph[6401]; extern byte tabdon[4001]; -/* t_dxx : array[0..121] of int;*/ + extern Common::String stpou; /* donne le % d'indices */ extern byte is; extern char mode; -- cgit v1.2.3 From 9f99fabaa8c15c561907ed6ae9498634b4adc4d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:50:13 +1100 Subject: MORTEVIELLE: Remove all the overlay comments --- engines/mortevielle/actions.cpp | 58 ++++++++++++++--------------- engines/mortevielle/alert.cpp | 2 +- engines/mortevielle/menu.cpp | 6 +-- engines/mortevielle/mor.cpp | 82 ++++++++++++++++++++--------------------- engines/mortevielle/ovd1.cpp | 18 ++++----- engines/mortevielle/parole.cpp | 12 +++--- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/ques.cpp | 2 +- 8 files changed, 91 insertions(+), 91 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index adcb17b5ed..5b2f43786a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,7 +42,7 @@ namespace Mortevielle { -/* overlay */ + void taller() { //int mx, cx, cy; int cx; @@ -134,7 +134,7 @@ L2: tmlieu(s.mlieu); } -/* overlay */ void tprendre() { +void tprendre() { //int cx, cy, cz; int cx; @@ -230,7 +230,7 @@ L2: } } -/* overlay */ void tsprendre() { +void tsprendre() { int cx, cy, cz; cx = 0; @@ -251,7 +251,7 @@ L2: clsf2(); } -/* overlay */ void tsoulever() +void tsoulever() { int cx; @@ -278,7 +278,7 @@ L2: if (crep == 255) crep = 997; } -/* overlay */ void tlire() { +void tlire() { // int iaff; if (caff > 99) st4(caff); @@ -294,12 +294,12 @@ L2: } } -/* overlay */ void tslire() { +void tslire() { if (s.derobj == 0) crep = 186; else st4(s.derobj); } -/* overlay */ void tregarder() { +void tregarder() { int cx; if (caff > 99) { @@ -355,12 +355,12 @@ L2: if ((s.mlieu == 10) && (num == 3)) treg(31); } -/* overlay */ void tsregarder() { +void tsregarder() { if (s.derobj != 0) treg(s.derobj); else crep = 186; } -/* overlay */ void tfouiller() { +void tfouiller() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; int cx; @@ -428,12 +428,12 @@ L2: } } -/* overlay */ void tsfouiller() { +void tsfouiller() { if (s.derobj != 0) st7(s.derobj); else crep = 186; } -/* overlay */ void touvrir() { +void touvrir() { int cx, haz; if (!syn) @@ -487,7 +487,7 @@ L2: } } -/* overlay */ void tmettre() { +void tmettre() { int quel; bool entre; char st[1410]; @@ -591,7 +591,7 @@ L2: } } -/* overlay */ void ttourner() { +void ttourner() { int quel; if (caff > 99) { @@ -626,7 +626,7 @@ L2: } } -/* overlay */ void tcacher() { +void tcacher() { if (!syn) ecr3(g_vm->getString(S_HIDE_SELF)); tfleche(); @@ -640,7 +640,7 @@ L2: } } -/* overlay */ void tattacher() { +void tattacher() { if (s.derobj == 0) crep = 186; else { if (!syn) @@ -661,7 +661,7 @@ L2: } } -/* overlay */ void tfermer() { +void tfermer() { int cx, chai; if (!syn) @@ -691,7 +691,7 @@ L2: if (caff == 26) crep = 999; } -/* overlay */ void tfrapper() { +void tfrapper() { int l, p, haz; if (!syn) @@ -724,7 +724,7 @@ L2: } } -/* overlay */ void tposer() { +void tposer() { int cx, chai; if (!syn) @@ -790,7 +790,7 @@ L2: } } -/* overlay */ void tecouter() { +void tecouter() { int l, p, haz, j, h, m; if (s.mlieu != 26) crep = 101; @@ -815,7 +815,7 @@ L2: } } -/* overlay */ void tmanger() { +void tmanger() { int j, h, m; if ((s.mlieu > 15) && (s.mlieu < 26)) @@ -842,7 +842,7 @@ L2: } } -/* overlay */ void tentrer() { +void tentrer() { int x, z = 0; if ((s.mlieu == 21) || (s.mlieu == 22)) { @@ -895,7 +895,7 @@ L2: } } -/* overlay */ void tdormir() { +void tdormir() { int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { @@ -934,7 +934,7 @@ L2: num = 0; } -/* overlay */ void tdefoncer() { +void tdefoncer() { if (!syn) ecr3(g_vm->getString(S_SMASH)); if (caff < 25) tfleche(); @@ -946,7 +946,7 @@ L2: } } -/* overlay */ void tsortir() { +void tsortir() { int lx = 0; tsort(); @@ -971,7 +971,7 @@ L2: } } -/* overlay */ void tattendre() { +void tattendre() { int quel; mpers = 0; @@ -995,7 +995,7 @@ L2: if (! anyone) tinke(); } -/* overlay */ void tsonder() { +void tsonder() { if (!syn) ecr3(g_vm->getString(S_PROBE2)); if (caff < 27) { @@ -1005,7 +1005,7 @@ L2: } } -/* overlay */ void tparler() +void tparler() { bool te[47]; @@ -1179,7 +1179,7 @@ L2: clsf3(); } -/* overlay */ void tsentir() { +void tsentir() { crep = 119; if (caff < 26) { if (!syn) @@ -1191,7 +1191,7 @@ L2: num = 0; } -/* overlay */ void tgratter() { +void tgratter() { crep = 155; if (caff < 27) { if (!syn) diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 6eb7d5e912..a3787a09b3 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -33,7 +33,7 @@ namespace Mortevielle { -/* overlay */ int do_alert(Common::String str_, int n); +int do_alert(Common::String str_, int n); const int nligne = 7; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 12ccbe3ff5..fbe3ff2ac0 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -38,7 +38,7 @@ namespace Mortevielle { /* NIVEAU 14*/ -/* overlay */ void menut(int no, Common::String nom) { +void menut(int no, Common::String nom) { byte h, l; Common::String s; @@ -74,7 +74,7 @@ namespace Mortevielle { } } -/* overlay */ void menu_disable(int no) { +void menu_disable(int no) { byte h, l; /* debug('menu_disable'); */ @@ -103,7 +103,7 @@ namespace Mortevielle { } } -/* overlay */ void menu_enable(int no) { +void menu_enable(int no) { byte h, l; /* debug('menu_disable'); */ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 2d4df26e46..4699575849 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -491,7 +491,7 @@ void affper(int per) { ipers = per; } -/* overlay */ void choix(int min, int max, int &per) { +void choix(int min, int max, int &per) { bool i; int haz, cx, cy, cz; @@ -515,7 +515,7 @@ void affper(int per) { i = false; } -/* overlay */ void cpl1(int &p) { +void cpl1(int &p) { int j, h, m; /* debug('o0 cpl1'); */ @@ -530,7 +530,7 @@ void affper(int per) { mdn(); } -/* overlay */ void cpl2(int &p) { +void cpl2(int &p) { int j, h, m; /* debug('o0 cpl2'); */ @@ -542,7 +542,7 @@ void affper(int per) { if ((h >= 0) && (h < 8)) p = 50; } -/* overlay */ void cpl3(int &p) { +void cpl3(int &p) { int j, h, m; /* debug('o0 cpl3'); */ @@ -551,7 +551,7 @@ void affper(int per) { if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) p = 0; } -/* overlay */ void cpl5(int &p) { +void cpl5(int &p) { int j, h, m; /* debug('o0 cpl5'); */ @@ -562,7 +562,7 @@ void affper(int per) { if ((h >= 0) && (h < 7)) p = 50; } -/* overlay */ void cpl6(int &p) { +void cpl6(int &p) { int j, h, m; /* debug('o0 cpl6'); */ @@ -650,7 +650,7 @@ void debloc(int l) { mpers = ipers; } -/* overlay */ void cpl10(int &p, int &h) { +void cpl10(int &p, int &h) { int j, m; /* debug('o1 cpl10'); */ @@ -663,7 +663,7 @@ void debloc(int l) { if ((h >= 0) && (h < 8)) p = 5; } -/* overlay */ void cpl11(int &p, int &h) { +void cpl11(int &p, int &h) { int j, m; /* debug('o1 cpl11'); */ @@ -675,7 +675,7 @@ void debloc(int l) { if ((h >= 0) && (h < 9)) p = 0; } -/* overlay */ void cpl12(int &p) { +void cpl12(int &p) { int j, h, m; /* debug('o1 cpl12'); */ @@ -686,12 +686,12 @@ void debloc(int l) { if ((h > 4) && (h < 9)) p = 15; } -/* overlay */ void cpl13(int &p) { +void cpl13(int &p) { /* debug('o1 cpl13'); */ p = 0; } -/* overlay */ void cpl15(int &p) { +void cpl15(int &p) { int j, h, m; /* debug('o1 cpl15'); */ @@ -705,7 +705,7 @@ void debloc(int l) { if ((h >= 0) && (h < 8)) p = -15; } -/* overlay */ void cpl20(int &p, int &h) { +void cpl20(int &p, int &h) { int j, m; /* debug('o1 cpl20'); */ @@ -717,7 +717,7 @@ void debloc(int l) { if ((h > 4) && (h < 10)) p = -5; } -/* overlay */ void quelq1(int l) { +void quelq1(int l) { int per; /* debug('o1 quelq1'); */ @@ -731,27 +731,27 @@ void debloc(int l) { ipers = 10; } -/* overlay */ void quelq2() { +void quelq2() { /* debug('o1 quelq2'); */ if (li == 2) bh2 = true; else bh9 = true; ipers = 10; } -/* overlay */ void quelq5() { +void quelq5() { /* debug('o1 quelq5'); */ bh5 = true; ipers = 10; } -/* overlay */ void quelq6(int l) { +void quelq6(int l) { /* debug('o1 quelq6'); */ if (l == 6) bh6 = true; if (l == 8) bh8 = true; ipers = 10; } -/* overlay */ void quelq10(int h, int &per) { +void quelq10(int h, int &per) { int min = 0, max = 0; /* debug('o1 quelq10'); */ @@ -778,7 +778,7 @@ void debloc(int l) { affper(per); } -/* overlay */ void quelq11(int h, int &per) { +void quelq11(int h, int &per) { int min = 0, max = 0; /* debug('o1 quelq11'); */ @@ -801,13 +801,13 @@ void debloc(int l) { affper(per); } -/* overlay */ void quelq12(int &per) { +void quelq12(int &per) { /* debug('o1 quelq12'); */ chlm(per); affper(per); } -/* overlay */ void quelq15(int &per) { +void quelq15(int &per) { int cx; bool test; @@ -831,7 +831,7 @@ void debloc(int l) { } } -/* overlay */ void quelq20(int h, int &per) { +void quelq20(int h, int &per) { int min = 0, max = 0; /* debug('o1 quelq20'); */ @@ -855,7 +855,7 @@ void debloc(int l) { } -/* overlay */void frap() { +void frap() { int j, h, m, haz; /* debug('o1 frap'); */ @@ -868,7 +868,7 @@ void debloc(int l) { } } -/* overlay */ void nouvp(int l, int &p) { +void nouvp(int l, int &p) { /* debug('o1 nouvp'); */ p = 0; if (l == 1) { @@ -889,7 +889,7 @@ void debloc(int l) { -/* overlay */ void tip(int ip, int &cx) { +void tip(int ip, int &cx) { /* debug('o1 tip'); */ if (ip == 128) cx = 1; else if (ip == 64) cx = 2; @@ -902,7 +902,7 @@ void debloc(int l) { } -/* overlay */ void ecfren(int &p, int &haz, int cf, int l) { +void ecfren(int &p, int &haz, int cf, int l) { /* debug('o1 ecfren'); */ if (l == 0) person(); p = -500; @@ -921,7 +921,7 @@ void debloc(int l) { } } -/* overlay */ void becfren(int l) { +void becfren(int l) { int haz; /* debug('o1 becfren'); */ @@ -958,7 +958,7 @@ void phaz(int &haz, int &p, int cf) { haz = hazard(1, 100); } -/* overlay */ void inzon() { +void inzon() { int cx; /* debug('o2 inzon'); */ @@ -989,7 +989,7 @@ void phaz(int &haz, int &p, int cf) { init_nbrepm(); } -/* overlay */ void dprog() { +void dprog() { /* debug('o2 dprog'); */ li = 21; /* jh:= t_settime(0);*/ @@ -999,7 +999,7 @@ void phaz(int &haz, int &p, int cf) { mh = readclock(); } -/* overlay */ void pl1(int cf) { +void pl1(int cf) { int p, haz; /* debug('o2 pl1'); */ @@ -1012,7 +1012,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlay */ void pl2(int cf) { +void pl2(int cf) { int p, haz; /* debug('o2 pl2'); */ @@ -1024,7 +1024,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlay */ void pl5(int cf) { +void pl5(int cf) { int p, haz; /* debug('o2 pl5'); */ @@ -1036,7 +1036,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlay */ void pl6(int cf) { +void pl6(int cf) { int p, haz; /* debug('o2 pl6'); */ @@ -1048,7 +1048,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlayi */ void pl9(int cf) { +void pl9(int cf) { int p, haz; /* debug('o2 pl9'); */ @@ -1060,7 +1060,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlayi */ void pl10(int cf) { +void pl10(int cf) { int p, h, haz; /* debug('o2 pl10'); */ @@ -1070,7 +1070,7 @@ void phaz(int &haz, int &p, int cf) { else quelq10(h, p); } -/* overlay */ void pl11(int cf) { +void pl11(int cf) { int p, h, haz; /* debug('o2 pl11'); */ @@ -1080,7 +1080,7 @@ void phaz(int &haz, int &p, int cf) { else quelq11(h, p); } -/* overlay */ void pl12(int cf) { +void pl12(int cf) { int p, haz; /* debug('o2 pl12'); */ @@ -1090,7 +1090,7 @@ void phaz(int &haz, int &p, int cf) { else quelq12(p); } -/* overlay */ void pl13(int cf) { +void pl13(int cf) { int p, haz; /* debug('o2 pl13'); */ @@ -1100,7 +1100,7 @@ void phaz(int &haz, int &p, int cf) { else quelq12(p); } -/* overlay */ void pl15(int cf) { +void pl15(int cf) { int p, haz; /* debug('o2 pl15'); */ @@ -1110,7 +1110,7 @@ void phaz(int &haz, int &p, int cf) { else quelq15(p); } -/* overlay */ void pl20(int cf) { +void pl20(int cf) { int p, h, haz; /* debug('o2 pl20'); */ @@ -1120,7 +1120,7 @@ void phaz(int &haz, int &p, int cf) { else quelq20(h, p); } -/* overlay */ void t11(int l11, int &a) { +void t11(int l11, int &a) { int p, haz, h = 0; /* debug('o2 t11'); */ @@ -1161,7 +1161,7 @@ void phaz(int &haz, int &p, int cf) { } } -/* overlay */ void cavegre() +void cavegre() { int haz; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 6650dd04b2..94f89c3401 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -61,7 +61,7 @@ void ani50() { repon(2, c_paroles + 143); } -/* overlay */ void aff50(bool c) { +void aff50(bool c) { caff = 50; maff = 0; taffich(); @@ -71,7 +71,7 @@ void ani50() { f3f8(); } -/* overlay */ void init_menu() { +void init_menu() { int i, tai; char st[1410]; Common::File f; @@ -124,7 +124,7 @@ void ani50() { } -/* overlay */ void charpal() { +void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx int i, j, k; @@ -172,7 +172,7 @@ void ani50() { fb.close(); } -/* overlay */ void chartex() { +void chartex() { int i; Common::File f; char s[1410]; @@ -219,7 +219,7 @@ void dialpre() { int_m = true; } -/* overlay */ void init_lieu() { +void init_lieu() { Common::File f_lieu; // tab_mlieu /* debug('o3 init_lieu'); */ @@ -234,7 +234,7 @@ void dialpre() { } -/* overlay */ void music() { +void music() { Common::File fic; int k; bool fin; @@ -269,7 +269,7 @@ void dialpre() { } -/* overlay */ void charge_bruit5() { +void charge_bruit5() { Common::File f; if (!f.open("bruit5")) @@ -279,7 +279,7 @@ void dialpre() { f.close(); } -/* overlay */ void charge_cfiec() { +void charge_cfiec() { Common::File f; if (!f.open("cfiec.mor")) @@ -292,7 +292,7 @@ void dialpre() { } -/* overlay */ void charge_cfiph() { +void charge_cfiph() { Common::File f; if (!f.open("cfiph.mor")) diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 2a8984195a..70bbd72e06 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -97,7 +97,7 @@ void veracf(byte b) { ; } -/* overlay */ void cctable(tablint &t) { +void cctable(tablint &t) { int k; float tb[257]; @@ -109,7 +109,7 @@ void veracf(byte b) { } } -/* overlay */ void regenbruit() { +void regenbruit() { int i, j; i = offsetb3 + 8590; @@ -121,7 +121,7 @@ void veracf(byte b) { } while (!(i >= offsetb3 + 8790)); } -/* overlay */ void charge_son() { + void charge_son() { Common::File f; if (!f.open("sonmus.mor")) @@ -133,7 +133,7 @@ void veracf(byte b) { f.close(); } -/* overlay */ void charge_phbruit() { + void charge_phbruit() { Common::File f; if (!f.open("phbrui.mor")) @@ -145,7 +145,7 @@ void veracf(byte b) { f.close(); } -/* overlay */ void charge_bruit() { + void charge_bruit() { Common::File f; int i; @@ -159,7 +159,7 @@ void veracf(byte b) { f.close(); } -/* overlay */ void trait_car() { + void trait_car() { byte d3; int d2, i; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 9d8b8f91a1..db8b2e9cbd 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -38,7 +38,7 @@ namespace Mortevielle { -/* overlay */ void change_gd(int ngd) { +void change_gd(int ngd) { hide_mouse(); gd = ngd; hirs(); diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp index aadedbd9cc..e8c568d398 100644 --- a/engines/mortevielle/ques.cpp +++ b/engines/mortevielle/ques.cpp @@ -34,7 +34,7 @@ namespace Mortevielle { -/* overlay */ bool ques() { +bool ques() { const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; -- cgit v1.2.3 From ce42caf57c28bebb263510f2266c9f401b3cda84 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:54:41 +1100 Subject: MORTEVIELLE: Removed all the remaining text mode function stubs --- engines/mortevielle/menu.cpp | 1 - engines/mortevielle/mor.cpp | 1 - engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/var_mor.cpp | 11 ----------- engines/mortevielle/var_mor.h | 10 ---------- 5 files changed, 1 insertion(+), 24 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index fbe3ff2ac0..35caac31ac 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,7 +48,6 @@ void menut(int no, Common::String nom) { l = lo(no); s = nom; if (! tesok) { - clrscr; mortevielle_exit(0); } while (s.size() < 20) s = s + ' '; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4699575849..22816dc738 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -260,7 +260,6 @@ void clsf10() { } void stop() { - clrscr; hirs(); gd = ams; hirs(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 026f17d718..130449a2b7 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -150,7 +150,7 @@ Common::ErrorCode MortevielleEngine::initialise() { init_lieu(); sonoff = false; f2_all = false; - textcolor(9); + teskbd(); dialpre(); newgd = gd; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 5c72961630..1b19d5ca11 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -255,17 +255,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) { int port[0xfff]; byte mem[65536 * 16]; -int wherey; - -void gotoxy(int x, int y) { -} -void textcolor(int c) { -} -void output(const Common::String &s) { - debug(s.c_str()); -} -void graphbackground(int c) { -} void intr(int intNum, registres ®s) { } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a872af199b..9bc10b30f2 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -411,16 +411,6 @@ extern byte mem[65536 * 16]; #define hires {} #define mortevielle_exit(ret) error("Exit the game") -// Text screen functions not relevant for ScummVM -#define clrscr { warning("ClrScr"); } -#define clreol {} -#define graphcolormode {} -extern void gotoxy(int x, int y); -extern void textcolor(int c); -extern void output(const Common::String &s); -extern void graphbackground(int c); -extern int wherey; - // Stubs for input functions extern bool keypressed(); extern char get_ch(); -- cgit v1.2.3 From b4bed3cba36ac90bc78a8550390481aa394e9e68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 22:57:15 +1100 Subject: MORTEVIELLE: Replaced stub calls to mortevielle_exit with Engine::quitGame --- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 4 ++-- engines/mortevielle/var_mor.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 35caac31ac..d8c1b6050b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,7 +48,7 @@ void menut(int no, Common::String nom) { l = lo(no); s = nom; if (! tesok) { - mortevielle_exit(0); + g_vm->quitGame(); } while (s.size() < 20) s = s + ' '; switch (h) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 22816dc738..05fe6c2a8c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -48,7 +48,7 @@ const int ioresult = 0; void testfi() { if (ioresult != 0) { caff = do_alert(err_mess, 1); - mortevielle_exit(0); + g_vm->quitGame(); } } @@ -263,7 +263,7 @@ void stop() { hirs(); gd = ams; hirs(); - mortevielle_exit(0); + g_vm->quitGame(); } void paint_rect(int x, int y, int dx, int dy) { diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 9bc10b30f2..3e496df9ff 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -409,7 +409,6 @@ extern int port[0xfff]; extern byte mem[65536 * 16]; #define hires {} -#define mortevielle_exit(ret) error("Exit the game") // Stubs for input functions extern bool keypressed(); -- cgit v1.2.3 From 2fb94dfa01e7673358aef3ef67022f29e74c1b3b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Feb 2012 23:05:08 +1100 Subject: MORTEVIELLE: Moved DROITE() into the ScreenSurface class --- engines/mortevielle/droite.cpp | 68 ---------------------------------------- engines/mortevielle/droite.h | 36 --------------------- engines/mortevielle/graphics.cpp | 33 +++++++++++++++++++ engines/mortevielle/graphics.h | 1 + engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 10 +++--- 6 files changed, 40 insertions(+), 109 deletions(-) delete mode 100644 engines/mortevielle/droite.cpp delete mode 100644 engines/mortevielle/droite.h diff --git a/engines/mortevielle/droite.cpp b/engines/mortevielle/droite.cpp deleted file mode 100644 index fc52ff7bd3..0000000000 --- a/engines/mortevielle/droite.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/droite.h" -#include "mortevielle/graphics.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void droite(int x, int y, int xx, int yy, int coul) { - int step, i; - float a, b; - float xr, yr, xro, yro; - - xr = x; - yr = y; - xro = xx; - yro = yy; - - if (abs(y - yy) > abs(x - xx)) { - a = (float)((x - xx)) / (y - yy); - b = (yr * xro - yro * xr) / (y - yy); - i = y; - if (y > yy) step = -1; - else step = 1; - do { - g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); - i = i + step; - } while (!(i == yy)); - } else { - a = (float)((y - yy)) / (x - xx); - b = ((yro * xr) - (yr * xro)) / (x - xx); - i = x; - if (x > xx) step = -1; - else step = 1; - do { - g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); - i = i + step; - } while (!(i == xx)); - } -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/droite.h b/engines/mortevielle/droite.h deleted file mode 100644 index 6017f481cd..0000000000 --- a/engines/mortevielle/droite.h +++ /dev/null @@ -1,36 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_DROITE_H -#define MORTEVIELLE_DROITE_H - -namespace Mortevielle { - -extern void droite(int x, int y, int xx, int yy, int coul); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index bdf6c86daa..0fab9de965 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1097,4 +1097,37 @@ int ScreenSurface::getStringWidth(const Common::String &s) { return s.size() * charWidth; } +void ScreenSurface::droite(int x, int y, int xx, int yy, int coul) { + int step, i; + float a, b; + float xr, yr, xro, yro; + + xr = x; + yr = y; + xro = xx; + yro = yy; + + if (abs(y - yy) > abs(x - xx)) { + a = (float)((x - xx)) / (y - yy); + b = (yr * xro - yro * xr) / (y - yy); + i = y; + if (y > yy) step = -1; + else step = 1; + do { + g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); + i = i + step; + } while (!(i == yy)); + } else { + a = (float)((y - yy)) / (x - xx); + b = ((yro * xr) - (yr * xro)) / (x - xx); + i = x; + if (x > xx) step = -1; + else step = 1; + do { + g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); + i = i + step; + } while (!(i == xx)); + } +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 1daad5720b..1aab4cf34b 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -92,6 +92,7 @@ public: void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); int getStringWidth(const Common::String &s); + void droite(int x, int y, int xx, int yy, int coul); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 0688fd5ac0..67ca57dbb4 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -5,7 +5,6 @@ MODULE_OBJS := \ alert.o \ asm.o \ detection.o \ - droite.o \ graphics.o \ keyboard.o \ level15.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 05fe6c2a8c..895e18362d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -30,7 +30,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "mortevielle/alert.h" -#include "mortevielle/droite.h" +#include "mortevielle/graphics.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -616,12 +616,14 @@ void pendule() { if ((gd == cga) || (gd == her)) co = 0; else co = 1; - if (min == 0) droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); - else droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); + if (min == 0) + g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); + else + g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); h = heu; if (h > 12) h = h - 12; if (h == 0) h = 12; - droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); + g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); show_mouse(); g_vm->_screenSurface.putxy(568, 154); if (heu > 11) -- cgit v1.2.3 From c3a63e04ee9a3cc5f70906638b41bf2fae7d13bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Feb 2012 00:02:03 +1100 Subject: MORTEVIELLE: Convert menu code to a class --- engines/mortevielle/actions.cpp | 9 ++-- engines/mortevielle/menu.cpp | 95 ++++++++++++++++++++++--------------- engines/mortevielle/menu.h | 27 ++++++----- engines/mortevielle/mor.cpp | 31 ++++++------ engines/mortevielle/mor2.cpp | 53 ++++++++++----------- engines/mortevielle/mortevielle.cpp | 6 +-- engines/mortevielle/mortevielle.h | 2 + engines/mortevielle/ovd1.cpp | 3 +- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/var_mor.cpp | 2 +- 10 files changed, 126 insertions(+), 104 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5b2f43786a..b84857162c 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -543,9 +543,12 @@ void tmettre() { show_mouse(); tinke(); pendule(); - if (ipers != 0) affper(ipers); - else person(); - menu_aff(); + if (ipers != 0) + affper(ipers); + else + person(); + + g_vm->_menu.menu_aff(); if (entre) { s.mlieu = 17; tmlieu(17); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d8c1b6050b..d6475c99d0 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -38,19 +38,22 @@ namespace Mortevielle { /* NIVEAU 14*/ -void menut(int no, Common::String nom) { +/** + * Setup a menu's contents + */ +void Menu::menut(int no, Common::String nom) { byte h, l; Common::String s; - - /* debug('menut'); */ h = hi(no); l = lo(no); s = nom; if (! tesok) { g_vm->quitGame(); } - while (s.size() < 20) s = s + ' '; + while (s.size() < 20) + s = s + ' '; + switch (h) { case invent : if (l != 7) { @@ -73,10 +76,13 @@ void menut(int no, Common::String nom) { } } -void menu_disable(int no) { +/** + * Disable a menu item + * @param no Hi byte represents menu number, lo byte reprsents item index + */ +void Menu::disableMenuItem(int no) { byte h, l; - /* debug('menu_disable'); */ h = hi(no); l = lo(no); switch (h) { @@ -84,7 +90,8 @@ void menu_disable(int no) { if (l > 6) { inv[l].setChar('<', 0); inv[l].setChar('>', 21); - } else inv[l].setChar('*', 0); + } else + inv[l].setChar('*', 0); } break; case depla : @@ -102,10 +109,13 @@ void menu_disable(int no) { } } -void menu_enable(int no) { +/** + * Enable a menu item + * @param no Hi byte represents menu number, lo byte reprsents item index + */ +void Menu::enableMenuItem(int no) { byte h, l; - /* debug('menu_disable'); */ h = hi(no); l = lo(no); switch (h) { @@ -131,19 +141,13 @@ void menu_enable(int no) { } } -void menu_aff() { +void Menu::menu_aff() { int ind_tabl, k, col; -// char c; - int pt, x, y, color, msk, - num_letr; - /* debug('menu_aff'); */ + int pt, x, y, color, msk, num_letr; + hide_mouse(); - /*if not tesok then - begin - clrscr; - halt; - end;*/ + g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; if (gd == cga) color = 1; @@ -177,9 +181,10 @@ void menu_aff() { show_mouse(); } - -void draw_menu() { - /* debug('draw_menu'); */ +/** + * Show the menu + */ +void Menu::drawMenu() { menu_aff(); active_menu = true; msg4 = no_choice; @@ -189,10 +194,9 @@ void draw_menu() { test0 = false; } -void invers(int ix) { +void Menu::invers(int ix) { Common::String s; - /* debug('invers'); */ if (msg4 == no_choice) return; g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { @@ -235,7 +239,7 @@ void invers(int ix) { msg4 = no_choice; } -void util(int x, int y) { +void Menu::util(int x, int y) { int ymx, dxcar, xmn, xmx, ix; /* debug('util'); */ @@ -258,11 +262,14 @@ void util(int x, int y) { } } -void menu_down(int ii) { +/** + * Draw a menu + */ +void Menu::menuDown(int ii) { int cx, xcc; int xco, nb_lig; - /* debug('menu_down'); */ + /* debug('menuDown'); */ // Make a copy of the current screen surface for later restore g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); @@ -331,8 +338,11 @@ void menu_down(int ii) { show_mouse(); } -void menu_up(int xx) { - /* debug('menu_up'); */ +/** + * Menu is being removed, so restore the previous background area. + */ +void Menu::menuUp(int xx) { + /* debug('menuUp'); */ if (test0) { charecr(10, succ(byte, don[xx][2]) << 1); @@ -351,14 +361,20 @@ void menu_up(int xx) { } } -void erase_menu() { - /* debug('erase_menu'); */ +/** + * Erase the menu + */ +void Menu::eraseMenu() { + /* debug('eraseMenu'); */ active_menu = false; g_vm->setMouseClick(false); - menu_up(msg3); + menuUp(msg3); } -void mdn() { +/** + * Handle updates to the menu + */ +void Menu::mdn() { //int x, y, c, a, ix; int x, y, ix; bool tes; @@ -389,28 +405,28 @@ void mdn() { else ix = fichier; if ((ix != msg3) || (! test0)) if (!((ix == fichier) && ((msg3 == sauve) || (msg3 == charge)))) { - menu_up(msg3); - menu_down(ix); + menuUp(msg3); + menuDown(ix); msg3 = ix; msg4 = no_choice; } } else { /* Not in the MenuTitle line */ if ((y > 11) && (test0)) util(x, y); } - } else /* There was a click */ + } else { /* There was a click */ if ((msg3 == fichier) && (msg4 != no_choice)) { // Another menu to be displayed g_vm->setMouseClick(false); - menu_up(msg3); + menuUp(msg3); if (lo(msg4) == 1) msg3 = 7; else msg3 = 8; - menu_down(msg3); + menuDown(msg3); g_vm->setMouseClick(false); } else { // A menu was clicked on choisi = (test0) && (msg4 != no_choice); - menu_up(msg3); + menuUp(msg3); msg[4] = msg4; msg[3] = msg3; msg3 = no_choice; @@ -418,6 +434,7 @@ void mdn() { g_vm->setMouseClick(false); } + } } } // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 1ea6931c0e..6ab020dbd9 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -32,18 +32,21 @@ namespace Mortevielle { -/* NIVEAU 14*/ -extern void menut(int no, Common::String nom); -extern void menu_disable(int no); -extern void menu_enable(int no); -extern void menu_aff(); -extern void draw_menu(); -extern void invers(int ix); -extern void util(int x, int y); -extern void menu_down(int ii); -extern void menu_up(int xx); -extern void erase_menu(); -extern void mdn(); +class Menu { +private: + void util(int x, int y); + void invers(int ix); + void menuDown(int ii); +public: + void menut(int no, Common::String nom); + void disableMenuItem(int no); + void enableMenuItem(int no); + void menu_aff(); + void drawMenu(); + void menuUp(int xx); + void eraseMenu(); + void mdn(); +}; } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 895e18362d..d4461be3cd 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -324,8 +324,8 @@ void modobj(int m) { deline(m - 501 + c_st41, str_, tay); strp = delig; } - menut(invt[8], strp); - menu_disable(invt[8]); + g_vm->_menu.menut(invt[8], strp); + g_vm->_menu.disableMenuItem(invt[8]); } void modobj2(int m, bool t1, bool t2) { @@ -341,8 +341,8 @@ void modobj2(int m, bool t1, bool t2) { deline(m - 501 + c_st41, str_, tay); strp = delig; } - menut(invt[8], strp); - menu_disable(invt[8]); + g_vm->_menu.menut(invt[8], strp); + g_vm->_menu.disableMenuItem(invt[8]); } @@ -445,47 +445,48 @@ void affper(int per) { int cx; /* debug('affper'); */ - for (cx = 1; cx <= 8; cx ++) menu_disable(disc[cx]); + for (cx = 1; cx <= 8; cx ++) + g_vm->_menu.disableMenuItem(disc[cx]); clsf10(); if ((per & 128) == 128) { g_vm->_screenSurface.putxy(560, 24); g_vm->_screenSurface.writeg("LEO", 4); - menu_enable(disc[1]); + g_vm->_menu.enableMenuItem(disc[1]); } if ((per & 64) == 64) { g_vm->_screenSurface.putxy(560, 32); g_vm->_screenSurface.writeg("PAT", 4); - menu_enable(disc[2]); + g_vm->_menu.enableMenuItem(disc[2]); } if ((per & 32) == 32) { g_vm->_screenSurface.putxy(560, 40); g_vm->_screenSurface.writeg("GUY", 4); - menu_enable(disc[3]); + g_vm->_menu.enableMenuItem(disc[3]); } if ((per & 16) == 16) { g_vm->_screenSurface.putxy(560, 48); g_vm->_screenSurface.writeg("EVA", 4); - menu_enable(disc[4]); + g_vm->_menu.enableMenuItem(disc[4]); } if ((per & 8) == 8) { g_vm->_screenSurface.putxy(560, 56); g_vm->_screenSurface.writeg("BOB", 4); - menu_enable(disc[5]); + g_vm->_menu.enableMenuItem(disc[5]); } if ((per & 4) == 4) { g_vm->_screenSurface.putxy(560, 64); g_vm->_screenSurface.writeg("LUC", 4); - menu_enable(disc[6]); + g_vm->_menu.enableMenuItem(disc[6]); } if ((per & 2) == 2) { g_vm->_screenSurface.putxy(560, 72); g_vm->_screenSurface.writeg("IDA", 4); - menu_enable(disc[7]); + g_vm->_menu.enableMenuItem(disc[7]); } if ((per & 1) == 1) { g_vm->_screenSurface.putxy(560, 80); g_vm->_screenSurface.writeg("MAX", 4); - menu_enable(disc[8]); + g_vm->_menu.enableMenuItem(disc[8]); } ipers = per; } @@ -526,7 +527,7 @@ void cpl1(int &p) { if ((h > 17) && (h < 22)) p = 35; if ((h > 21) && (h < 24)) p = 50; if ((h >= 0) && (h < 8)) p = 70; - mdn(); + g_vm->_menu.mdn(); } void cpl2(int &p) { @@ -578,7 +579,7 @@ void cpl6(int &p) { void person() { /* debug('person'); */ for (int cf = 1; cf <= 8; cf ++) - menu_disable(disc[cf]); + g_vm->_menu.disableMenuItem(disc[cf]); clsf10(); g_vm->_screenSurface.putxy(560, 30); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 5d33175a60..557ca0679b 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -104,7 +104,7 @@ void tinke() { nh = readclock(); if ((nh - mh) > t) { am = active_menu; - erase_menu(); + g_vm->_menu.eraseMenu(); jh = jh + ((nh - mh) / t); mh = nh; switch (li) { @@ -165,7 +165,8 @@ void tinke() { } } } - if (am) draw_menu(); + if (am) + g_vm->_menu.drawMenu(); } } hfb = readclock(); @@ -233,11 +234,12 @@ void tmlieu(int mli) { deline(cx + c_tmlieu, st, tail); nomp = delig; while (nomp.size() < 20) nomp = nomp + ' '; - menut(depl[i], nomp); + g_vm->_menu.menut(depl[i], nomp); i = i + 1; } nomp = "* "; - for (cx = 7; cx >= i; cx --) menut(depl[cx], nomp); + for (cx = 7; cx >= i; cx --) + g_vm->_menu.menut(depl[cx], nomp); } @@ -271,20 +273,11 @@ void mfouen() int 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, g_vm->getString(S_PROBE)); - menut(soulever, g_vm->getString(S_RAISE)); + for (cx = 1; cx <= 11; cx ++) + g_vm->_menu.enableMenuItem(men[cx]); + + g_vm->_menu.menut(sonder, g_vm->getString(S_PROBE)); + g_vm->_menu.menut(soulever, g_vm->getString(S_RAISE)); } void atf3f8(int &key) { @@ -382,13 +375,13 @@ void modinv() { r = (ord(s.sjer[cx]) + 400); deline(r - 501 + c_st41, nom, tay); nomp = delig; - menut(invt[cy], nomp); - menu_enable(invt[cx]); + g_vm->_menu.menut(invt[cy], nomp); + g_vm->_menu.enableMenuItem(invt[cx]); } if (cy < 6) for (cx = cy + 1; cx <= 6; cx ++) { - menut(invt[cx], " "); - menu_disable(invt[cx]); + g_vm->_menu.menut(invt[cx], " "); + g_vm->_menu.disableMenuItem(invt[cx]); } } @@ -425,16 +418,16 @@ void mfoudi() { int cx; for (cx = 1; cx <= 7; cx ++) - menu_disable(depl[cx]); + g_vm->_menu.disableMenuItem(depl[cx]); for (cx = 1; cx <= 11; cx ++) - menu_disable(men[cx]); + g_vm->_menu.disableMenuItem(men[cx]); - menut(sonder, g_vm->getString(S_SUITE)); - menut(soulever, g_vm->getString(S_STOP)); + g_vm->_menu.menut(sonder, g_vm->getString(S_SUITE)); + g_vm->_menu.menut(soulever, g_vm->getString(S_STOP)); } void mennor() { - menu_up(msg[3]); + g_vm->_menu.menuUp(msg[3]); } void premtet() { @@ -553,7 +546,8 @@ void quelquun() { int haz, cx; - if (imen) erase_menu(); + if (imen) + g_vm->_menu.eraseMenu(); finfouil(); crep = 997; L1: @@ -591,7 +585,8 @@ L1: affrep(); } } - if (imen) draw_menu(); + if (imen) + g_vm->_menu.drawMenu(); } void tsuiv() { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 130449a2b7..29a9d5bb46 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -553,7 +553,7 @@ void MortevielleEngine::handleAction() { oo = false; ctrm = 0; if (! iesc) { - draw_menu(); + g_vm->_menu.drawMenu(); imen = true; temps = 0; key = 0; @@ -562,7 +562,7 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { - mdn(); + g_vm->_menu.mdn(); tinke(); mov_mouse(funct, inkey); CHECK_QUIT; @@ -570,7 +570,7 @@ void MortevielleEngine::handleAction() { } while (!((choisi) || (temps > lim) || (funct) || (anyone))); _inMainGameLoop = false; - erase_menu(); + g_vm->_menu.eraseMenu(); imen = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { change_gd((uint)pred(int, ord(inkey)) >> 1); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 94640ba8a9..371dd40b38 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -33,6 +33,7 @@ #include "common/error.h" #include "graphics/surface.h" #include "mortevielle/graphics.h" +#include "mortevielle/menu.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" @@ -100,6 +101,7 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; + Menu _menu; bool _quitGame; // Quit game flag. Originally called 'arret' bool _endGame; // End game flag. Originally called 'solu' diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 94f89c3401..5bdb54f262 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -114,7 +114,8 @@ void init_menu() { disc[i] = 0x500 + i; if (i < 8) depl[i] = 0x200 + i; invt[i] = 0x100 + i; - if (i > 6) menu_disable(invt[i]); + if (i > 6) + g_vm->_menu.disableMenuItem(invt[i]); } msg3 = no_choice; msg4 = no_choice; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index db8b2e9cbd..7f61b79185 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -54,7 +54,7 @@ void change_gd(int ngd) { maff = 68; afdes(0); repon(2, crep); - menu_aff(); + g_vm->_menu.menu_aff(); } /** diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 1b19d5ca11..62b14575de 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -278,7 +278,7 @@ char get_ch() { */ void s_sauv(int Gd, int y, int dy) { // Note: May no longer be necessary, since the backgorund restore code - // is being handled slightly differently now in the menu_up() method + // is being handled slightly differently now in the menuUp() method } void palette(int v1) { -- cgit v1.2.3 From a764471c4cc32bf034d9491af26a6d01743efb84 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Feb 2012 09:07:48 +1100 Subject: MORTEVIELLE: Converted menu functions into it's own class --- engines/mortevielle/actions.cpp | 12 +-- engines/mortevielle/menu.cpp | 166 ++++++++++++++++++++++++------------ engines/mortevielle/menu.h | 16 ++++ engines/mortevielle/mor.cpp | 28 +++--- engines/mortevielle/mor2.cpp | 22 +++-- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/ovd1.cpp | 54 ------------ engines/mortevielle/ovd1.h | 1 - engines/mortevielle/var_mor.cpp | 11 +-- engines/mortevielle/var_mor.h | 19 +---- 10 files changed, 160 insertions(+), 171 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b84857162c..dfd0811086 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -47,13 +47,13 @@ void taller() { //int mx, cx, cy; int cx; - if ((s.mlieu == 26) && (msg[4] == depl[6])) { + if ((s.mlieu == 26) && (msg[4] == g_vm->_menu._depl[6])) { s.mlieu = 15; caff = s.mlieu; afdes(0); repon(2, s.mlieu); } - if ((s.mlieu == 15) && (msg[4] == depl[6])) { + if ((s.mlieu == 15) && (msg[4] == g_vm->_menu._depl[6])) { if (!syn) ecr3(g_vm->getString(S_GO_TO)); tfleche(); @@ -78,7 +78,7 @@ void taller() { cx = 0; do { cx = cx + 1; - } while (!(depl[cx] == msg[4])); + } while (!(g_vm->_menu._depl[cx] == msg[4])); if (s.mlieu == 19) { if (cx == 1) t1deva(); if (cx == 2) t1neig(); @@ -236,7 +236,7 @@ void tsprendre() { cx = 0; do { cx = cx + 1; - } while (!(invt[cx] == msg[4])); + } while (!(g_vm->_menu._invt[cx] == msg[4])); cz = 0; cy = 0; do { @@ -870,7 +870,7 @@ void tentrer() { s.conf = s.conf + 1; s.mlieu = 15; msg[3] = discut; - msg[4] = disc[x]; + msg[4] = g_vm->_menu._disc[x]; syn = true; if (ment == 9) { col = true; @@ -1027,7 +1027,7 @@ void tparler() cx = 0; do { cx = cx + 1; - } while (!(disc[cx] == msg[4])); + } while (!(g_vm->_menu._disc[cx] == msg[4])); caff = 69 + cx; afdes(0); repon(2, caff); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d6475c99d0..2fc558a7fb 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -2,14 +2,14 @@ * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. + * file _distributed with this source _distribution. * - * This program is free software; you can redistribute it and/or + * This program is free software; you can re_distribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, + * This program is _distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -32,6 +32,8 @@ #include "mortevielle/menu.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" +#include "mortevielle/ovd1.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -57,27 +59,27 @@ void Menu::menut(int no, Common::String nom) { switch (h) { case invent : if (l != 7) { - inv[l] = s; - inv[l].insertChar(' ', 0); + _inv[l] = s; + _inv[l].insertChar(' ', 0); } break; - case depla : - dep[l] = s; + case depla: + _dep[l] = s; break; - case action : - act[l] = s; + case action: + _act[l] = s; break; - case saction : - self_[l] = s; + case saction: + _self[l] = s; break; - case discut : - dis[l] = s; + case discut: + _dis[l] = s; break; } } /** - * Disable a menu item + * _disable a menu item * @param no Hi byte represents menu number, lo byte reprsents item index */ void Menu::disableMenuItem(int no) { @@ -88,23 +90,23 @@ void Menu::disableMenuItem(int no) { switch (h) { case invent : { if (l > 6) { - inv[l].setChar('<', 0); - inv[l].setChar('>', 21); + _inv[l].setChar('<', 0); + _inv[l].setChar('>', 21); } else - inv[l].setChar('*', 0); + _inv[l].setChar('*', 0); } break; - case depla : - dep[l].setChar('*', 0); + case depla: + _dep[l].setChar('*', 0); break; - case action : - act[l].setChar('*', 0); + case action: + _act[l].setChar('*', 0); break; - case saction : - self_[l].setChar('*', 0); + case saction: + _self[l].setChar('*', 0); break; - case discut : - dis[l].setChar('*', 0); + case discut: + _dis[l].setChar('*', 0); break; } } @@ -120,23 +122,23 @@ void Menu::enableMenuItem(int no) { l = lo(no); switch (h) { case invent : { - inv[l].setChar(' ', 0); - inv[l].setChar(' ', 21); + _inv[l].setChar(' ', 0); + _inv[l].setChar(' ', 21); } break; - case depla : - dep[l].setChar(' ', 0); + case depla: + _dep[l].setChar(' ', 0); break; - case action : - act[l].setChar(' ', 0); + case action: + _act[l].setChar(' ', 0); break; - case saction : { - self_[l].setChar(' ', 0); - self_[l].setChar(' ', 0); + case saction: { + _self[l].setChar(' ', 0); + _self[l].setChar(' ', 0); } break; - case discut : - dis[l].setChar(' ', 0); + case discut: + _dis[l].setChar(' ', 0); break; } } @@ -186,7 +188,7 @@ void Menu::menu_aff() { */ void Menu::drawMenu() { menu_aff(); - active_menu = true; + _menuActive = true; msg4 = no_choice; msg3 = no_choice; choisi = false; @@ -201,19 +203,19 @@ void Menu::invers(int ix) { g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : - s = inv[lo(msg4)]; + s = _inv[lo(msg4)]; break; case 2 : - s = dep[lo(msg4)]; + s = _dep[lo(msg4)]; break; case 3 : - s = act[lo(msg4)]; + s = _act[lo(msg4)]; break; case 4 : - s = self_[lo(msg4)]; + s = _self[lo(msg4)]; break; case 5 : - s = dis[lo(msg4)]; + s = _dis[lo(msg4)]; break; case 6 : s = g_vm->getString(S_SAVE_LOAD + lo(msg4)); @@ -292,24 +294,24 @@ void Menu::menuDown(int ii) { cx = succ(int, cx); switch (ii) { case 1 : - if (inv[cx][0] != '*') - g_vm->_screenSurface.writeg(inv[cx], 4); + if (_inv[cx][0] != '*') + g_vm->_screenSurface.writeg(_inv[cx], 4); break; case 2 : - if (dep[cx][0] != '*') - g_vm->_screenSurface.writeg(dep[cx], 4); + if (_dep[cx][0] != '*') + g_vm->_screenSurface.writeg(_dep[cx], 4); break; case 3 : - if (act[cx][0] != '*') - g_vm->_screenSurface.writeg(act[cx], 4); + if (_act[cx][0] != '*') + g_vm->_screenSurface.writeg(_act[cx], 4); break; case 4 : - if (self_[cx][0] != '*') - g_vm->_screenSurface.writeg(self_[cx], 4); + if (_self[cx][0] != '*') + g_vm->_screenSurface.writeg(_self[cx], 4); break; case 5 : - if (dis[cx][0] != '*') - g_vm->_screenSurface.writeg(dis[cx], 4); + if (_dis[cx][0] != '*') + g_vm->_screenSurface.writeg(_dis[cx], 4); break; case 6 : g_vm->_screenSurface.writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); @@ -366,7 +368,7 @@ void Menu::menuUp(int xx) { */ void Menu::eraseMenu() { /* debug('eraseMenu'); */ - active_menu = false; + _menuActive = false; g_vm->setMouseClick(false); menuUp(msg3); } @@ -380,7 +382,8 @@ void Menu::mdn() { bool tes; /* debug('mdn'); */ - if (! active_menu) return; + if (!_menuActive) + return; x = x_s; y = y_s; if (!g_vm->getMouseClick()) { @@ -415,7 +418,7 @@ void Menu::mdn() { } } else { /* There was a click */ if ((msg3 == fichier) && (msg4 != no_choice)) { - // Another menu to be displayed + // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); if (lo(msg4) == 1) msg3 = 7; @@ -437,4 +440,57 @@ void Menu::mdn() { } } +void Menu::initMenu() { + int i, tai; + char st[1410]; + Common::File f; + + if (!f.open("menufr.mor")) + error("Missing file - menufr.mor"); + + f.read(lettres, 7 * 24); + f.close(); + + // Ask to swap floppy + 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; + while (_act[i].size() < 10) + _act[i] += ' '; + + if (i < 9) { + if (i < 6) { + deline(i + c_saction, st, tai); + _self[i] = delig; + while (_self[i].size() < 10) + _self[i] += ' '; + } + deline(i + c_dis, st, tai); + _dis[i] = delig + ' '; + } + i = succ(int, 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) + g_vm->_menu.disableMenuItem(_invt[i]); + } + msg3 = no_choice; + msg4 = no_choice; + msg[3] = no_choice; + msg[4] = no_choice; + g_vm->setMouseClick(false); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 6ab020dbd9..8779d51298 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -37,6 +37,16 @@ private: void util(int x, int y); void invers(int ix); void menuDown(int ii); +public: + bool _menuActive; + Common::String _inv[9]; + Common::String _dep[8]; + Common::String _act[22]; + Common::String _self[7]; + Common::String _dis[9]; + int _disc[9]; + int _invt[9]; + int _depl[8]; public: void menut(int no, Common::String nom); void disableMenuItem(int no); @@ -46,6 +56,12 @@ public: void menuUp(int xx); void eraseMenu(); void mdn(); + void initMenu(); +}; + +enum { + invent = 1, depla = 2, action = 3, saction = 4, + discut = 5, fichier = 6, sauve = 7, charge = 8 }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index d4461be3cd..013f69437d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -324,8 +324,8 @@ void modobj(int m) { deline(m - 501 + c_st41, str_, tay); strp = delig; } - g_vm->_menu.menut(invt[8], strp); - g_vm->_menu.disableMenuItem(invt[8]); + g_vm->_menu.menut(g_vm->_menu._invt[8], strp); + g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); } void modobj2(int m, bool t1, bool t2) { @@ -341,8 +341,8 @@ void modobj2(int m, bool t1, bool t2) { deline(m - 501 + c_st41, str_, tay); strp = delig; } - g_vm->_menu.menut(invt[8], strp); - g_vm->_menu.disableMenuItem(invt[8]); + g_vm->_menu.menut(g_vm->_menu._invt[8], strp); + g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); } @@ -446,47 +446,47 @@ void affper(int per) { /* debug('affper'); */ for (cx = 1; cx <= 8; cx ++) - g_vm->_menu.disableMenuItem(disc[cx]); + g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cx]); clsf10(); if ((per & 128) == 128) { g_vm->_screenSurface.putxy(560, 24); g_vm->_screenSurface.writeg("LEO", 4); - g_vm->_menu.enableMenuItem(disc[1]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[1]); } if ((per & 64) == 64) { g_vm->_screenSurface.putxy(560, 32); g_vm->_screenSurface.writeg("PAT", 4); - g_vm->_menu.enableMenuItem(disc[2]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[2]); } if ((per & 32) == 32) { g_vm->_screenSurface.putxy(560, 40); g_vm->_screenSurface.writeg("GUY", 4); - g_vm->_menu.enableMenuItem(disc[3]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[3]); } if ((per & 16) == 16) { g_vm->_screenSurface.putxy(560, 48); g_vm->_screenSurface.writeg("EVA", 4); - g_vm->_menu.enableMenuItem(disc[4]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[4]); } if ((per & 8) == 8) { g_vm->_screenSurface.putxy(560, 56); g_vm->_screenSurface.writeg("BOB", 4); - g_vm->_menu.enableMenuItem(disc[5]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[5]); } if ((per & 4) == 4) { g_vm->_screenSurface.putxy(560, 64); g_vm->_screenSurface.writeg("LUC", 4); - g_vm->_menu.enableMenuItem(disc[6]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[6]); } if ((per & 2) == 2) { g_vm->_screenSurface.putxy(560, 72); g_vm->_screenSurface.writeg("IDA", 4); - g_vm->_menu.enableMenuItem(disc[7]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[7]); } if ((per & 1) == 1) { g_vm->_screenSurface.putxy(560, 80); g_vm->_screenSurface.writeg("MAX", 4); - g_vm->_menu.enableMenuItem(disc[8]); + g_vm->_menu.enableMenuItem(g_vm->_menu._disc[8]); } ipers = per; } @@ -579,7 +579,7 @@ void cpl6(int &p) { void person() { /* debug('person'); */ for (int cf = 1; cf <= 8; cf ++) - g_vm->_menu.disableMenuItem(disc[cf]); + g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); clsf10(); g_vm->_screenSurface.putxy(560, 30); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 557ca0679b..9a1d2712db 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -103,7 +103,7 @@ void tinke() { if (cf > 65) t = t - ((t / 3) * 2); nh = readclock(); if ((nh - mh) > t) { - am = active_menu; + am = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); jh = jh + ((nh - mh) / t); mh = nh; @@ -234,12 +234,12 @@ void tmlieu(int mli) { deline(cx + c_tmlieu, st, tail); nomp = delig; while (nomp.size() < 20) nomp = nomp + ' '; - g_vm->_menu.menut(depl[i], nomp); + g_vm->_menu.menut(g_vm->_menu._depl[i], nomp); i = i + 1; } nomp = "* "; for (cx = 7; cx >= i; cx --) - g_vm->_menu.menut(depl[cx], nomp); + g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); } @@ -375,13 +375,13 @@ void modinv() { r = (ord(s.sjer[cx]) + 400); deline(r - 501 + c_st41, nom, tay); nomp = delig; - g_vm->_menu.menut(invt[cy], nomp); - g_vm->_menu.enableMenuItem(invt[cx]); + g_vm->_menu.menut(g_vm->_menu._invt[cy], nomp); + g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); } if (cy < 6) for (cx = cy + 1; cx <= 6; cx ++) { - g_vm->_menu.menut(invt[cx], " "); - g_vm->_menu.disableMenuItem(invt[cx]); + g_vm->_menu.menut(g_vm->_menu._invt[cx], " "); + g_vm->_menu.disableMenuItem(g_vm->_menu._invt[cx]); } } @@ -418,7 +418,7 @@ void mfoudi() { int cx; for (cx = 1; cx <= 7; cx ++) - g_vm->_menu.disableMenuItem(depl[cx]); + g_vm->_menu.disableMenuItem(g_vm->_menu._depl[cx]); for (cx = 1; cx <= 11; cx ++) g_vm->_menu.disableMenuItem(men[cx]); @@ -541,9 +541,7 @@ void tctrm() { } -void quelquun() - -{ +void quelquun() { int haz, cx; if (imen) @@ -566,7 +564,7 @@ L1: caff = 69 + cx; crep = caff; msg[3] = discut; - msg[4] = disc[cx]; + msg[4] = g_vm->_menu._disc[cx]; syn = true; col = true; } else { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 29a9d5bb46..6a7f84c18c 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -506,7 +506,7 @@ void MortevielleEngine::mainGame() { for (crep = 1; crep <= c_zzz; crep ++) zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); charge_bruit5(); - init_menu(); + _menu.initMenu(); theure(); dprog(); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 5bdb54f262..53237f7100 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -71,60 +71,6 @@ void aff50(bool c) { f3f8(); } -void init_menu() { - int i, tai; - char st[1410]; - Common::File f; - - if (!f.open("menufr.mor")) - error("Missing file - menufr.mor"); - - f.read(lettres, 7 * 24); - f.close(); - - // Ask to swap floppy - 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; - while (act[i].size() < 10) - act[i] += ' '; - - if (i < 9) { - if (i < 6) { - deline(i + c_saction, st, tai); - self_[i] = delig; - while (self_[i].size() < 10) - self_[i] += ' '; - } - deline(i + c_dis, st, tai); - dis[i] = delig + ' '; - } - i = succ(int, 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) - g_vm->_menu.disableMenuItem(invt[i]); - } - msg3 = no_choice; - msg4 = no_choice; - msg[3] = no_choice; - msg[4] = no_choice; - g_vm->setMouseClick(false); -} - - void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 96239ed3d5..6bb553a041 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -34,7 +34,6 @@ extern void dem2(); extern void ani50(); //extern void apzuul(); extern void aff50(bool c); -extern void init_menu(); extern void charpal(); extern void chartex(); extern void dialpre(); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 62b14575de..27eb5bb0b6 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -111,8 +111,7 @@ bool blo, anyone, brt, rect, - rech_cfiec, - active_menu; + rech_cfiec; int x, @@ -183,17 +182,9 @@ Common::String al_mess, ind_mess, al_mess2; -int invt[9]; int nbrep[9]; int nbrepm[9]; -int disc[9]; int msg[5]; -int depl[8]; -Common::String inv[9]; -Common::String dep[8]; -Common::String act[22]; -Common::String self_[7]; -Common::String dis[9]; char touv[8]; sav_chaine s, s1; byte bufcha[391]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 3e496df9ff..b810033f0a 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -129,14 +129,6 @@ const int amzon = 1650; const int fleche = 1758; const int no_choice = 0; -const int invent = 1; -const int depla = 2; -const int action = 3; -const int saction = 4; -const int discut = 5; -const int fichier = 6; -const int sauve = 7; -const int charge = 8; const int attacher = 0x301; const int attendre = 0x302; @@ -284,8 +276,7 @@ extern bool blo, anyone, brt, rect, - rech_cfiec, - active_menu; + rech_cfiec; extern int x, @@ -356,17 +347,9 @@ extern Common::String al_mess, ind_mess, al_mess2; -extern int invt[9]; extern int nbrep[9]; extern int nbrepm[9]; -extern int disc[9]; extern int msg[5]; -extern int depl[8]; -extern Common::String inv[9]; -extern Common::String dep[8]; -extern Common::String act[22]; -extern Common::String self_[7]; -extern Common::String dis[9]; extern char touv[8]; extern sav_chaine s, s1; extern byte bufcha[391]; -- cgit v1.2.3 From d738576f1c966d4e515c3a3ee64bd0972b3efdca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Feb 2012 20:51:36 +1100 Subject: MORTEVIELLE: Convert f3/f8 dialog, alert dialog, and ques dialogs into classes --- engines/mortevielle/actions.cpp | 23 +- engines/mortevielle/alert.cpp | 270 ---------------------- engines/mortevielle/alert.h | 39 ---- engines/mortevielle/dialogs.cpp | 447 ++++++++++++++++++++++++++++++++++++ engines/mortevielle/dialogs.h | 60 +++++ engines/mortevielle/module.mk | 3 +- engines/mortevielle/mor.cpp | 22 +- engines/mortevielle/mor.h | 1 - engines/mortevielle/mor2.cpp | 17 +- engines/mortevielle/mor2.h | 1 - engines/mortevielle/mortevielle.cpp | 27 +-- engines/mortevielle/mortevielle.h | 1 - engines/mortevielle/ovd1.cpp | 21 +- engines/mortevielle/ovd1.h | 2 - engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/ques.cpp | 144 ------------ engines/mortevielle/ques.h | 38 --- engines/mortevielle/saveload.cpp | 2 +- 18 files changed, 535 insertions(+), 585 deletions(-) delete mode 100644 engines/mortevielle/alert.cpp delete mode 100644 engines/mortevielle/alert.h create mode 100644 engines/mortevielle/dialogs.cpp create mode 100644 engines/mortevielle/dialogs.h delete mode 100644 engines/mortevielle/ques.cpp delete mode 100644 engines/mortevielle/ques.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index dfd0811086..02c7b6a90f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -27,7 +27,7 @@ #include "common/scummsys.h" #include "mortevielle/actions.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -35,7 +35,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/ques.h" #include "mortevielle/parole2.h" #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" @@ -529,12 +528,12 @@ void tmettre() { repon(2, 165); maivid(); parole(6, -9, 1); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); if (quel == 1) { deline(582, st, tay); - i = do_alert(delig, 1); + i = Alert::show(delig, 1); tesok = false; - entre = ques(); + entre = Ques::show(); hide_mouse(); hirs(); dessine_rouleau(); @@ -559,7 +558,7 @@ void tmettre() { aniof(1, 2); aniof(1, 1); deline(577, st, tay); - i = do_alert(delig, 1); + i = Alert::show(delig, 1); aniof(2, 1); crep = 166; } @@ -611,7 +610,7 @@ void ttourner() { if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); if (quel == 1) g_vm->_endGame = true; else crep = 168; @@ -620,7 +619,7 @@ void ttourner() { repon(2, 175); clsf3(); parole(6, -9, 1); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); if (quel == 1) { s.mlieu = 16; affrep(); @@ -700,7 +699,7 @@ void tfrapper() { if (!syn) ecr3(g_vm->getString(S_HIT)); if (s.mlieu == 15) { - l = do_alert(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1); + l = Alert::show(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1); return; } if (s.mlieu < 25) { @@ -930,7 +929,7 @@ void tdormir() { h = h + 1; if (h > 23) h = 0; tinke(); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); anyone = false; } while (!(quel == 1)); crep = 998; @@ -992,7 +991,7 @@ void tattendre() { return; } repon(2, 102); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); } while (!(quel == 2)); crep = 998; if (! anyone) tinke(); @@ -1259,7 +1258,7 @@ void MortevielleEngine::loseGame() { heu = 10; jou = 0; repon(2, 180); - quel = do_alert(g_vm->getString(S_YES_NO), 1); + quel = Alert::show(g_vm->getString(S_YES_NO), 1); _quitGame = (quel != 1); } diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp deleted file mode 100644 index a3787a09b3..0000000000 --- a/engines/mortevielle/alert.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/str.h" -#include "mortevielle/alert.h" -#include "mortevielle/level15.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" - -namespace Mortevielle { - -int do_alert(Common::String str_, int n); - - -const int nligne = 7; - -const int coord[3][4] = { - {0, 0, 0, 0}, - {0, 150, 72, 103}, - {0, 143, 107, 183} -}; - - -static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { - int i, k; - bool v; - - //val(s[2], nbc, i); - nbc = atoi(s.c_str() + 1); - i = 0; - - 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(int ji, int &coldep, int &esp) { - g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98); -} - - - -static void fait_boite(int lidep, int nli, int tx) { - int x, y, xx, yy; - - if (tx > 640) tx = 640; - x = 320 - ((uint)tx >> 1); - y = pred(int, lidep) << 3; - xx = x + tx; - yy = y + (nli << 3); - g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); - g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); - g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); -} - - - -static void fait_choix(Common::String c, int &coldep, int &nbcase, Common::String *str, int &esp) { - int i, l, x; - char ch; - - i = 1; - x = coldep; - for (l = 1; l <= nbcase; l ++) { - str[l] = ""; - do { - i = i + 1; - ch = c[i]; - str[l] = str[l] + ch; - } while (!(c[i + 1] == ']')); - i = i + 2; - while (str[l].size() < 3) str[l] = str[l] + ' '; - g_vm->_screenSurface.putxy(x, 98); - - Common::String tmp(" "); - tmp += str[l]; - tmp += " "; - - g_vm->_screenSurface.writeg(tmp, 0); - x = x + esp + 40; - } -} - -int do_alert(Common::String str_, int n) { - int coldep, esp, i, nbcase, quoi, ix; - Common::String st, chaine; - int limit[3][3]; - char dumi; - Common::String s[3]; - int cx, cy, nbcol, nblig; - bool newaff, test, test1, test2, test3, dum; - Common::String cas; - - // Make a copy of the current screen surface for later restore - g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); - - /*debug('** do_alert **');*/ - memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - int do_alert_result; - hide_mouse(); - while (keypressed()) - dumi = get_ch(); // input >> kbd >> dumi; - - g_vm->setMouseClick(false); - decod(str_, nbcase, nblig, nbcol, chaine, cas); - sauvecr(50, succ(int, nligne) << 4); - - i = 0; - if (chaine == "") { - fait_boite(10, 5, nbcol); - } else { - fait_boite(8, 7, nbcol); - i = 0; - g_vm->_screenSurface._textPos.y = 70; - do { - cx = 320; - st = ""; - while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { - i = i + 1; - st = st + chaine[i]; - if (res == 2) cx = cx - 3; - else cx = cx - 5; - } - g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); - g_vm->_screenSurface._textPos.y += 6; - g_vm->_screenSurface.writeg(st, 4); - i = i + 1; - } while (!(chaine[i] == ']')); - } - if (nbcase == 1) esp = nbcol - 40; - else esp = (uint)(nbcol - nbcase * 40) >> 1; - coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); - fait_choix(cas, coldep, nbcase, &s[0], esp); - limit[1][1] = ((uint)(coldep) >> 1) * res; - limit[1][2] = limit[1][1] + 40; - if (nbcase == 1) { - limit[2][1] = limit[2][2]; - } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; - limit[2][2] = (limit[2][1]) + 40; - } - show_mouse(); - quoi = 0; - dum = false; - do { - dumi = '\377'; - mov_mouse(dum, dumi); - CHECK_QUIT0; - - 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); - - Common::String tmp(" "); - tmp += s[quoi]; - tmp += " "; - g_vm->_screenSurface.writeg(tmp, 0); - } - posit(ix, coldep, esp); - - Common::String tmp2 = " "; - tmp2 += s[ix]; - tmp2 += " "; - g_vm->_screenSurface.writeg(tmp2, 1); - - quoi = ix; - show_mouse(); - } - } - } - if ((quoi != 0) && ! newaff) { - hide_mouse(); - posit(quoi, coldep, esp); - - Common::String tmp3(" "); - tmp3 += s[quoi]; - tmp3 += " "; - g_vm->_screenSurface.writeg(tmp3, 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 (!g_vm->getMouseClick()); - g_vm->setMouseClick(false); - hide_mouse(); - if (! test3) { - quoi = n; - posit(n, coldep, esp); - Common::String tmp4(" "); - tmp4 += s[n]; - tmp4 += " "; - g_vm->_screenSurface.writeg(tmp4, 1); - } - charecr(50, succ(int, nligne) << 4); - show_mouse(); - - /* Restore the background area */ - g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); - - do_alert_result = quoi; - return do_alert_result; -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/alert.h b/engines/mortevielle/alert.h deleted file mode 100644 index f7a9e7d1c1..0000000000 --- a/engines/mortevielle/alert.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_ALERT_H -#define MORTEVIELLE_ALERT_H - -#include "common/str.h" - -namespace Mortevielle { - -extern int do_alert(Common::String str_, int n); -extern int do_alert(Common::String str_, int n); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp new file mode 100644 index 0000000000..3efa80efdd --- /dev/null +++ b/engines/mortevielle/dialogs.cpp @@ -0,0 +1,447 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/str.h" +#include "mortevielle/dialogs.h" +#include "mortevielle/keyboard.h" +#include "mortevielle/level15.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/mor.h" +#include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" +#include "mortevielle/parole2.h" +#include "mortevielle/taffich.h" + +namespace Mortevielle { + +static const int nligne = 7; + +/* +static const int coord[3][4] = { + {0, 0, 0, 0}, + {0, 150, 72, 103}, + {0, 143, 107, 183} +}; +*/ + +int Alert::show(const Common::String &msg, int n) { + int coldep, esp, i, nbcase, quoi, ix; + Common::String st, chaine; + int limit[3][3]; + char dumi; + Common::String s[3]; + int cx, cy, nbcol, nblig; + bool newaff, test, test1, test2, test3, dum; + Common::String cas; + + // Make a copy of the current screen surface for later restore + g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); + + /*debug('** do_alert **');*/ + memset(&limit[0][0], 0, sizeof(int) * 3 * 3); + int do_alert_result; + hide_mouse(); + while (keypressed()) + dumi = get_ch(); // input >> kbd >> dumi; + + g_vm->setMouseClick(false); + decod(msg, nbcase, nblig, nbcol, chaine, cas); + sauvecr(50, succ(int, nligne) << 4); + + i = 0; + if (chaine == "") { + fait_boite(10, 5, nbcol); + } else { + fait_boite(8, 7, nbcol); + i = 0; + g_vm->_screenSurface._textPos.y = 70; + do { + cx = 320; + st = ""; + while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { + i = i + 1; + st = st + chaine[i]; + if (res == 2) cx = cx - 3; + else cx = cx - 5; + } + g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); + g_vm->_screenSurface._textPos.y += 6; + g_vm->_screenSurface.writeg(st, 4); + i = i + 1; + } while (!(chaine[i] == ']')); + } + if (nbcase == 1) esp = nbcol - 40; + else esp = (uint)(nbcol - nbcase * 40) >> 1; + coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); + fait_choix(cas, coldep, nbcase, &s[0], esp); + limit[1][1] = ((uint)(coldep) >> 1) * res; + limit[1][2] = limit[1][1] + 40; + if (nbcase == 1) { + limit[2][1] = limit[2][2]; + } else { + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; + limit[2][2] = (limit[2][1]) + 40; + } + show_mouse(); + quoi = 0; + dum = false; + do { + dumi = '\377'; + mov_mouse(dum, dumi); + CHECK_QUIT0; + + 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) { + setPosition(quoi, coldep, esp); + + Common::String tmp(" "); + tmp += s[quoi]; + tmp += " "; + g_vm->_screenSurface.writeg(tmp, 0); + } + setPosition(ix, coldep, esp); + + Common::String tmp2 = " "; + tmp2 += s[ix]; + tmp2 += " "; + g_vm->_screenSurface.writeg(tmp2, 1); + + quoi = ix; + show_mouse(); + } + } + } + if ((quoi != 0) && ! newaff) { + hide_mouse(); + setPosition(quoi, coldep, esp); + + Common::String tmp3(" "); + tmp3 += s[quoi]; + tmp3 += " "; + g_vm->_screenSurface.writeg(tmp3, 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 (!g_vm->getMouseClick()); + g_vm->setMouseClick(false); + hide_mouse(); + if (! test3) { + quoi = n; + setPosition(n, coldep, esp); + Common::String tmp4(" "); + tmp4 += s[n]; + tmp4 += " "; + g_vm->_screenSurface.writeg(tmp4, 1); + } + charecr(50, succ(int, nligne) << 4); + show_mouse(); + + /* Restore the background area */ + g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); + + do_alert_result = quoi; + return do_alert_result; +} + +void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { + int i, k; + bool v; + + //val(s[2], nbc, i); + nbc = atoi(s.c_str() + 1); + i = 0; + + 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; +} + +void Alert::setPosition(int ji, int coldep, int esp) { + g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98); +} + +void Alert::fait_boite(int lidep, int nli, int tx) { + int x, y, xx, yy; + + if (tx > 640) tx = 640; + x = 320 - ((uint)tx >> 1); + y = pred(int, lidep) << 3; + xx = x + tx; + yy = y + (nli << 3); + g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); + g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); +} + + + +void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { + int i, l, x; + char ch; + + i = 1; + x = coldep; + for (l = 1; l <= nbcase; l ++) { + str[l] = ""; + do { + i = i + 1; + ch = c[i]; + str[l] = str[l] + ch; + } while (!(c[i + 1] == ']')); + i = i + 2; + while (str[l].size() < 3) str[l] = str[l] + ' '; + g_vm->_screenSurface.putxy(x, 98); + + Common::String tmp(" "); + tmp += str[l]; + tmp += " "; + + g_vm->_screenSurface.writeg(tmp, 0); + x = x + esp + 40; + } +} + +/*------------------------------------------------------------------------*/ + +bool Ques::show() { + const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; + const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; + + bool q, func, test; + int i, j, k, y, memk; + int tay , tmax; + int rep, prem, der; + char st[1410]; + char key; + rectangle coor[max_rect]; + Common::String chaines[15]; + int compte; + + + bool 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; + g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); + 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(int, der - prem); j ++) { + { + rectangle &with = coor[j]; + + with.x1 = 45 * res; + with.x2 = (tmax * 3 + 55) * res; + with.y1 = 27 + j * 8; + with.y2 = 34 + j * 8; + with.etat = true; + } + while ((int)chaines[j].size() < tmax) { + chaines[j] = chaines[j] + ' '; + } + } + coor[j + 1].etat = false; + if (res == 1) rep = 10; + else rep = 6; + g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); + rep = 0; + j = 0; + memk = 0; + do { + g_vm->setMouseClick(false); + tesok = false; + mov_mouse(func, key); + CHECK_QUIT0; + + k = 1; + while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; + if (coor[k].etat) { + if ((memk != 0) && (memk != k)) { + for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; + st[1 + tmax] = '$'; + afftex(st, 100, 27 + memk * 8, 100, 1, 0); + } + if (memk != k) { + for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j]; + 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) && g_vm->getMouseClick())); + 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; +} + +/*------------------------------------------------------------------------*/ + +/** + * Draw the F3/F8 dialog + */ +void f3f8::draw() { + Common::String f3 = g_vm->getString(S_F3); + Common::String f8 = g_vm->getString(S_F8); + + // Write the F3 and F8 text strings + g_vm->_screenSurface.putxy(3, 44); + g_vm->_screenSurface.writeg(f3, 5); + g_vm->_screenSurface._textPos.y = 51; + g_vm->_screenSurface.writeg(f8, 5); + + // Get the width of the written text strings + int f3Width = g_vm->_screenSurface.getStringWidth(f3); + int f8Width = g_vm->_screenSurface.getStringWidth(f8); + + // Write out the bounding box + g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); +} + +void f3f8::divers(int np, bool b) { + teskbd(); + do { + parole(np, 0, 0); + atf3f8(key); + CHECK_QUIT; + + if (newgd != gd) { + gd = newgd; + hirs(); + aff50(b); + } + } while (!(key == 66)); +} + +void f3f8::atf3f8(int &key) { + do { + key = testou(); + CHECK_QUIT; + } while (!((key == 61) || (key == 66))); +} + +void f3f8::aff50(bool c) { + caff = 50; + maff = 0; + taffich(); + dessine(ades, 63, 12); + if (c) + ani50(); + else + repon(2, c_paroles + 142); + + // Draw the f3/f8 dialog + draw(); +} + +void f3f8::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); +} + + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h new file mode 100644 index 0000000000..260f355e8f --- /dev/null +++ b/engines/mortevielle/dialogs.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_ALERT_H +#define MORTEVIELLE_ALERT_H + +#include "common/str.h" + +namespace Mortevielle { + +class Alert { +private: + static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); + static void setPosition(int ji, int coldep, int esp); + static void fait_boite(int lidep, int nli, int tx); + static void fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp); +public: + static int show(const Common::String &s, int n); +}; + +class Ques { +public: + static bool show(); +}; + +class f3f8 { +public: + static void draw(); + static void divers(int np, bool b); + static void atf3f8(int &key); + static void aff50(bool c); + static void ani50(); +}; + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 67ca57dbb4..16f56bc5b0 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -2,9 +2,9 @@ MODULE := engines/mortevielle MODULE_OBJS := \ actions.o \ - alert.o \ asm.o \ detection.o \ + dialogs.o \ graphics.o \ keyboard.o \ level15.o \ @@ -18,7 +18,6 @@ MODULE_OBJS := \ parole.o \ parole2.o \ prog.o \ - ques.o \ saveload.o \ sound.o \ taffich.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 013f69437d..eb900d1515 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -29,7 +29,7 @@ #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" @@ -47,7 +47,7 @@ const int ioresult = 0; void testfi() { if (ioresult != 0) { - caff = do_alert(err_mess, 1); + caff = Alert::show(err_mess, 1); g_vm->quitGame(); } } @@ -403,24 +403,6 @@ void repon(int f, int m) { } } -void f3f8() { - Common::String f3 = g_vm->getString(S_F3); - Common::String f8 = g_vm->getString(S_F8); - - // Write the F3 and F8 text strings - g_vm->_screenSurface.putxy(3, 44); - g_vm->_screenSurface.writeg(f3, 5); - g_vm->_screenSurface._textPos.y = 51; - g_vm->_screenSurface.writeg(f8, 5); - - // Get the width of the written text strings - int f3Width = g_vm->_screenSurface.getStringWidth(f3); - int f8Width = g_vm->_screenSurface.getStringWidth(f8); - - // Write out the bounding box - g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); -} - void t5(int cx) { /* debug('t5'); */ if (cx == 10) blo = false; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index cabc3c4e92..22879246f6 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -62,7 +62,6 @@ extern void okpas(); extern void modobj(int m); extern void modobj2(int m, bool t1, bool t2); extern void repon(int f, int m); -extern void f3f8(); extern void t5(int cx); extern void affper(int per); extern void choix(int min, int max, int &per); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 9a1d2712db..c388c4a937 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -26,7 +26,7 @@ */ #include "mortevielle/mor2.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -280,13 +280,6 @@ void mfouen() g_vm->_menu.menut(soulever, g_vm->getString(S_RAISE)); } -void atf3f8(int &key) { - do { - key = testou(); - CHECK_QUIT; - } while (!((key == 61) || (key == 66))); -} - /* NIVEAU 6 */ void tperd() { @@ -394,12 +387,12 @@ void sparl(float adr, float rep) { hide_mouse(); deline(repint + c_paroles, st, tay); afftex(st, 230, 4, 65, 24, 5); - f3f8(); + f3f8::draw(); key = 0; do { parole(repint, haut[caff - 69], 0); - atf3f8(key); + f3f8::atf3f8(key); CHECK_QUIT; } while (!(key == 66)); hirs(); @@ -631,7 +624,7 @@ void tfleche() { tinke(); } while (!(qust || rect || anyone)); - if (qust && (touch == '\103')) dummy = do_alert(stpou, 1); + if (qust && (touch == '\103')) dummy = Alert::show(stpou, 1); } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); if (touch == '\73') iesc = true; @@ -767,7 +760,7 @@ void st13(int ob) { void aldepl() { int dummy; - dummy = do_alert(g_vm->getString(S_USE_DEP_MENU), 1); + dummy = Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 6668d54113..1d66548ffa 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -41,7 +41,6 @@ extern void tlu(int af, int ob); extern void delin(int n); extern void affrep(); extern void mfouen(); -extern void atf3f8(int &key); /* NIVEAU 6 */ extern void tperd(); extern void tsort(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6a7f84c18c..b35e98611c 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -30,7 +30,7 @@ #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" #include "mortevielle/actions.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" #include "mortevielle/level15.h" @@ -467,13 +467,13 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - aff50(false); + f3f8::aff50(false); mlec = 0; - divers(142, false); + f3f8::divers(142, false); CHECK_QUIT; - ani50(); - divers(143, true); + f3f8::ani50(); + f3f8::divers(143, true); CHECK_QUIT; // TODO: Once music is implemented, only use the below delay if music is turned off @@ -482,21 +482,6 @@ void MortevielleEngine::showIntroduction() { music(); } -void MortevielleEngine::divers(int np, bool b) { - teskbd(); - do { - parole(np, 0, 0); - atf3f8(key); - CHECK_QUIT; - - if (newgd != gd) { - gd = newgd; - hirs(); - aff50(b); - } - } while (!(key == 66)); -} - /** * Main game loop. Handles potentially playing the game multiple times, such as if the player * loses, and chooses to start playing the game again. @@ -583,7 +568,7 @@ void MortevielleEngine::handleAction() { if (choisi && (msg[3] == charge)) g_vm->_savegameManager.loadGame((msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ - temps = do_alert(stpou, 1); + temps = Alert::show(stpou, 1); return; } else if (inkey == '\77') { if ((mnumo != no_choice) && ((msg[3] == action) || (msg[3] == saction))) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 371dd40b38..b0f1c4cffe 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -93,7 +93,6 @@ private: void mainGame(); void playGame(); void handleAction(); - void divers(int np, bool b); public: ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 53237f7100..33f879d61b 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -26,7 +26,7 @@ */ #include "common/file.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" #include "mortevielle/level15.h" #include "mortevielle/menu.h" @@ -52,25 +52,6 @@ void dem2() { // Deprecated under ScummVM } -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); -} - -void aff50(bool c) { - caff = 50; - maff = 0; - taffich(); - dessine(ades, 63, 12); - if (c) ani50(); - else repon(2, c_paroles + 142); - f3f8(); -} - void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 6bb553a041..13a8f5db2e 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -31,9 +31,7 @@ namespace Mortevielle { extern void dem2(); -extern void ani50(); //extern void apzuul(); -extern void aff50(bool c); extern void charpal(); extern void chartex(); extern void dialpre(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 7f61b79185..8d905af326 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -26,7 +26,7 @@ */ #include "mortevielle/actions.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" diff --git a/engines/mortevielle/ques.cpp b/engines/mortevielle/ques.cpp deleted file mode 100644 index e8c568d398..0000000000 --- a/engines/mortevielle/ques.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/str.h" -#include "mortevielle/level15.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" -#include "mortevielle/ques.h" - -namespace Mortevielle { - -bool ques() { - const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; - const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; - - bool q, func, test; - int i, j, k, y, memk; - int tay , tmax; - int rep, prem, der; - char st[1410]; - char key; - rectangle coor[max_rect]; - Common::String chaines[15]; - int compte; - - - bool 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; - g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); - 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(int, der - prem); j ++) { - { - rectangle &with = coor[j]; - - with.x1 = 45 * res; - with.x2 = (tmax * 3 + 55) * res; - with.y1 = 27 + j * 8; - with.y2 = 34 + j * 8; - with.etat = true; - } - while ((int)chaines[j].size() < tmax) { - chaines[j] = chaines[j] + ' '; - } - } - coor[j + 1].etat = false; - if (res == 1) rep = 10; - else rep = 6; - g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); - rep = 0; - j = 0; - memk = 0; - do { - g_vm->setMouseClick(false); - tesok = false; - mov_mouse(func, key); - CHECK_QUIT0; - - k = 1; - while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; - if (coor[k].etat) { - if ((memk != 0) && (memk != k)) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; - st[1 + tmax] = '$'; - afftex(st, 100, 27 + memk * 8, 100, 1, 0); - } - if (memk != k) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j]; - 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) && g_vm->getMouseClick())); - 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; -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/ques.h b/engines/mortevielle/ques.h deleted file mode 100644 index 7260bfa6a2..0000000000 --- a/engines/mortevielle/ques.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_QUES_H -#define MORTEVIELLE_QUES_H - -#include "common/str.h" - -namespace Mortevielle { - -extern bool ques(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 4f37c2839b..0b3946af0b 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -27,7 +27,7 @@ #include "common/file.h" #include "common/system.h" -#include "mortevielle/alert.h" +#include "mortevielle/dialogs.h" #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" -- cgit v1.2.3 From 94d881b141bc239f67490f542a1414654f54461c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 15 Feb 2012 22:28:07 +1100 Subject: MORTEVIELLE: Fix the 'You Are Alone' to be properly justified with English text --- engines/mortevielle/mor.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index eb900d1515..de784471f8 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -246,10 +246,8 @@ void clsf10() { st = g_vm->getString(S_LOURDE); else if (s.conf > 65) st = g_vm->getString(S_MALSAINE); - if (res == 1) - co = 10; - else co = 6; - co = 574 - ((uint)co * st.size() >> 1); + + co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); g_vm->_screenSurface.putxy(co, 92); g_vm->_screenSurface.writeg(st, 4); if (res == 1) co = 620; @@ -563,13 +561,18 @@ void person() { for (int cf = 1; cf <= 8; cf ++) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); + Common::String sYou = g_vm->getString(S_YOU); + Common::String sAre = g_vm->getString(S_ARE); + Common::String sAlone = g_vm->getString(S_ALONE); + clsf10(); - g_vm->_screenSurface.putxy(560, 30); - g_vm->_screenSurface.writeg(g_vm->getString(S_YOU), 4); - g_vm->_screenSurface.putxy(560, 50); - g_vm->_screenSurface.writeg(g_vm->getString(S_ARE), 4); - g_vm->_screenSurface.putxy(560, 70); - g_vm->_screenSurface.writeg(g_vm->getString(S_ALONE), 4); + g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sYou) / 2), 30); + g_vm->_screenSurface.writeg(sYou, 4); + g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAre) / 2), 50); + g_vm->_screenSurface.writeg(sAre, 4); + g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAlone) / 2), 70); + g_vm->_screenSurface.writeg(sAlone, 4); + ipers = 0; } -- cgit v1.2.3 From 3529fec5a9ceda657faffa1c9e403aff841388ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 18 Feb 2012 13:55:07 +0100 Subject: TOOLS: Add header files to create_mortdat, remove second parameter --- devtools/create_mortdat/create_mortdat.cpp | 197 ++--------------------------- devtools/create_mortdat/create_mortdat.h | 90 +++++++++++++ devtools/create_mortdat/enginetext.h | 136 ++++++++++++++++++++ 3 files changed, 236 insertions(+), 187 deletions(-) create mode 100644 devtools/create_mortdat/create_mortdat.h create mode 100644 devtools/create_mortdat/enginetext.h diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index aff67dc949..2f1539822d 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -38,74 +38,11 @@ #include #include "common/endian.h" - -enum AccessMode { - kFileReadMode = 1, - kFileWriteMode = 2 -}; - -class File { -private: - FILE *f; -public: - bool open(const char *filename, AccessMode mode = kFileReadMode) { - f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); - return (f != NULL); - } - void close() { - fclose(f); - f = NULL; - } - int seek(int32 offset, int whence = SEEK_SET) { - return fseek(f, offset, whence); - } - long read(void *buffer, int len) { - return fread(buffer, 1, len, f); - } - void write(const void *buffer, int len) { - fwrite(buffer, 1, len, f); - } - byte readByte() { - byte v; - read(&v, sizeof(byte)); - return v; - } - uint16 readWord() { - uint16 v; - read(&v, sizeof(uint16)); - return FROM_LE_16(v); - } - uint32 readLong() { - uint32 v; - read(&v, sizeof(uint32)); - return FROM_LE_32(v); - } - void writeByte(byte v) { - write(&v, sizeof(byte)); - } - void writeWord(uint16 v) { - uint16 vTemp = TO_LE_16(v); - write(&vTemp, sizeof(uint16)); - } - void writeLong(uint32 v) { - uint32 vTemp = TO_LE_32(v); - write(&vTemp, sizeof(uint32)); - } - void writeString(const char *s) { - write(s, strlen(s) + 1); - } - uint32 pos() { - return ftell(f); - } -}; - -File outputFile, mortCom; +#include "create_mortdat.h" +#include "enginetext.h" /*-------------------------------------------------------------------------*/ -#define VERSION_MAJOR 1 -#define VERSION_MINOR 0 - void openOutputFile(const char *outFilename) { outputFile.open(outFilename, kFileWriteMode); @@ -171,143 +108,29 @@ void writeStaticStrings(const char **strings, int languageId) { } /** - * Write out the French strings previously hard-coded into the application - */ -void writeEnglishStaticStrings() { - const char *string_list[] = { - "[2][ ][YES][NO]", - "Go to", - "Someone enters, looks surised, but says nothing", - "Cool", - " Lourde ", - "Malsaine", - "Idem", - "You", - "are", - "Alone", - - "Gosh! You hear some noise...", - " | You should have noticed, | ", - "% of hints...", - "Do you want to wake up?", - "OK", - "", - " Save", - - " Load", - " Restart ", - "F3: Repeat", - "F8: Proceed", - "Hide self", - "take", - " probe ", - " raise ", - " -SUITE- ", - " -STOP- ", - "[1] [So, use the DEP menu] [Ok]", - "lift", - "read", - - "look", - "search", - "open", - "put", - "turn", - "tie", - "close", - "hit", - "pose", - "smash", - - "smell", - "scratch", - "probe", - "[1] [ | Before, use the DEP menu...] [Ok]", - "& day", - NULL - }; - - writeStaticStrings(string_list, 1); -} - -/** - * Write out the French strings previously hard-coded into the application + * Write out the strings previously hard-coded into the engine */ -void writeFrenchStaticStrings() { - const char *string_list[] = { - "[2][ ][OUI][NON]", - "aller", - "quelqu'un entre, parait ‚tonn‚ mais ne dit rien", - "Cool", - " Lourde ", - "Malsaine", - "Idem", - "Vous", - "tes", - "SEUL", - - "Mince! Vous entendez du bruit...", - " | Vous devriez avoir remarqu‚| ", - "% des indices...", - "D‚sirez-vous vous r‚veiller?", - "OK", - "", - " Sauvegarde", - - " Chargement", - " Recommence ", - "F3: Encore", - "F8: Suite", - "se cacher", - - "prendre", - " sonder ", - "soulever", - " -SUITE- ", - " -STOP- ", - "[1][Alors, utilisez le menu DEP...][ok]", - "soulever", - "lire", - - "regarder", - "fouiller", - "ouvrir", - "mettre", - "tourner", - "attacher", - "fermer", - "frapper", - "poser", - "d‚foncer", - - "sentir", - "gratter", - "sonder", - "[1][ | Avant, utilisez le menu DEP...][ok]", - "& jour", - NULL - }; - - writeStaticStrings(string_list, 0); +void writeEngineStrings() { + writeStaticStrings(engineDataEn, 1); + writeStaticStrings(engineDataFr, 0); } void process() { writeFontBlock(); - writeEnglishStaticStrings(); - writeFrenchStaticStrings(); + writeEngineStrings(); } /** * Main method */ int main(int argc, char *argv[]) { - if (argc != 3) { - printf("Format: input_filename output_filename\n", argv[0]); + if (argc != 2) { + printf("Usage:\n%s input_filename\nWhere input_filename is the name of the Mortevielle DOS executable", argv[0]); exit(0); } mortCom.open(argv[1], kFileReadMode); - openOutputFile(argv[2]); + openOutputFile("mort.dat"); process(); diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h new file mode 100644 index 0000000000..c46ad8aa26 --- /dev/null +++ b/devtools/create_mortdat/create_mortdat.h @@ -0,0 +1,90 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Mortevielle executable files into a new file mort.dat - this + * is required for the ScummVM Mortevielle module to work properly + */ + +#define VERSION_MAJOR 1 +#define VERSION_MINOR 0 + +enum AccessMode { + kFileReadMode = 1, + kFileWriteMode = 2 +}; + +class File { +private: + FILE *f; +public: + bool open(const char *filename, AccessMode mode = kFileReadMode) { + f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); + return (f != NULL); + } + void close() { + fclose(f); + f = NULL; + } + int seek(int32 offset, int whence = SEEK_SET) { + return fseek(f, offset, whence); + } + long read(void *buffer, int len) { + return fread(buffer, 1, len, f); + } + void write(const void *buffer, int len) { + fwrite(buffer, 1, len, f); + } + byte readByte() { + byte v; + read(&v, sizeof(byte)); + return v; + } + uint16 readWord() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); + } + uint32 readLong() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_LE_32(v); + } + void writeByte(byte v) { + write(&v, sizeof(byte)); + } + void writeWord(uint16 v) { + uint16 vTemp = TO_LE_16(v); + write(&vTemp, sizeof(uint16)); + } + void writeLong(uint32 v) { + uint32 vTemp = TO_LE_32(v); + write(&vTemp, sizeof(uint32)); + } + void writeString(const char *s) { + write(s, strlen(s) + 1); + } + uint32 pos() { + return ftell(f); + } +}; + +File outputFile, mortCom; + diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h new file mode 100644 index 0000000000..fb4d12d966 --- /dev/null +++ b/devtools/create_mortdat/enginetext.h @@ -0,0 +1,136 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Mortevielle executable files into a new file mort.dat - this + * is required for the ScummVM Mortevielle module to work properly + */ + +#ifndef ENGINEDATA_H +#define ENGINEDATA_H + +const char *engineDataEn[] = { + "[2][ ][YES][NO]", + "Go to", + "Someone enters, looks surised, but says nothing", + "Cool", + " Lourde ", + "Malsaine", + "Idem", + "You", + "are", + "Alone", + + "Gosh! You hear some noise...", + " | You should have noticed, | ", + "% of hints...", + "Do you want to wake up?", + "OK", + "", + " Save", + + " Load", + " Restart ", + "F3: Repeat", + "F8: Proceed", + "Hide self", + "take", + " probe ", + " raise ", + " -SUITE- ", + " -STOP- ", + "[1] [So, use the DEP menu] [Ok]", + "lift", + "read", + + "look", + "search", + "open", + "put", + "turn", + "tie", + "close", + "hit", + "pose", + "smash", + + "smell", + "scratch", + "probe", + "[1] [ | Before, use the DEP menu...] [Ok]", + "& day", + NULL +}; + +const char *engineDataFr[] = { + "[2][ ][OUI][NON]", + "aller", + "quelqu'un entre, parait ‚tonn‚ mais ne dit rien", + "Cool", + " Lourde ", + "Malsaine", + "Idem", + "Vous", + "tes", + "SEUL", + + "Mince! Vous entendez du bruit...", + " | Vous devriez avoir remarqu‚| ", + "% des indices...", + "D‚sirez-vous vous r‚veiller?", + "OK", + "", + " Sauvegarde", + + " Chargement", + " Recommence ", + "F3: Encore", + "F8: Suite", + "se cacher", + + "prendre", + " sonder ", + "soulever", + " -SUITE- ", + " -STOP- ", + "[1][Alors, utilisez le menu DEP...][ok]", + "soulever", + "lire", + + "regarder", + "fouiller", + "ouvrir", + "mettre", + "tourner", + "attacher", + "fermer", + "frapper", + "poser", + "d‚foncer", + + "sentir", + "gratter", + "sonder", + "[1][ | Avant, utilisez le menu DEP...][ok]", + "& jour", + NULL +}; + +#endif -- cgit v1.2.3 From 13692fc18fa85fd05c47b58d55e1a38f05c000ce Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 18 Feb 2012 18:02:25 +0100 Subject: TOOL: Use a define for output name --- devtools/create_mortdat/create_mortdat.cpp | 2 +- devtools/create_mortdat/create_mortdat.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 2f1539822d..eb476c187a 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) { } mortCom.open(argv[1], kFileReadMode); - openOutputFile("mort.dat"); + openOutputFile(MORT_DAT); process(); diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h index c46ad8aa26..d9c7561d93 100644 --- a/devtools/create_mortdat/create_mortdat.h +++ b/devtools/create_mortdat/create_mortdat.h @@ -31,6 +31,8 @@ enum AccessMode { kFileWriteMode = 2 }; +#define MORT_DAT "mort.dat" + class File { private: FILE *f; -- cgit v1.2.3 From 45fb3b9153af98216a2fa9add347a3446d7bf1b3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 18 Feb 2012 19:32:59 +0100 Subject: TOOLS: Add ingame text. This will allow us to get an English version, and will help when we'll try to support Atari/Amiga version using hardcoded ingame texts --- devtools/create_mortdat/create_mortdat.cpp | 10 + devtools/create_mortdat/gametext.h | 1206 ++++++++++++++++++++++++++++ 2 files changed, 1216 insertions(+) create mode 100644 devtools/create_mortdat/gametext.h diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index eb476c187a..de4bb415d4 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -40,6 +40,7 @@ #include "common/endian.h" #include "create_mortdat.h" #include "enginetext.h" +#include "gametext.h" /*-------------------------------------------------------------------------*/ @@ -115,9 +116,18 @@ void writeEngineStrings() { writeStaticStrings(engineDataFr, 0); } +/** + * Write out the strings used in the game + */ +void writeGameStrings() { + writeStaticStrings(gameDataEn, 1); + writeStaticStrings(gameDataFr, 0); +} + void process() { writeFontBlock(); writeEngineStrings(); + writeGameStrings(); } /** diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h new file mode 100644 index 0000000000..6905fdf7c6 --- /dev/null +++ b/devtools/create_mortdat/gametext.h @@ -0,0 +1,1206 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Mortevielle executable files into a new file mort.dat - this + * is required for the ScummVM Mortevielle module to work properly + */ + +#ifndef GAMEDATA_H +#define GAMEDATA_H + +const char *gameDataEn[] = { + "Calm within the storm$", + "Discussed in colours$", + "Your mauve!$", + "Be kind enough to leave the room...$", + "If you're NOT overdrawn...$", + "If you're feeling blue...$", + "Read what's on the walls?$", + "Water sports$", + "Room for envy?$", + "A glance at the forbidden$", + "Smell of a woodfire and tobacco$", + "Tobacco and old books$", + "Onions, cinnamon and spirits$", + "A place seldom visited$", + "Humidity and decay$", + "Sorry, no ""door to door""$", + "Rotting corpse: deady cryptomania$", + "And what's more, there are disused traps$", + "It's already open$", + "Danger: avalanches$", + "Proper Charlie's place?$", + "An imposing building$", + "The other side of the mystery$", + "Strange horoscope$", + "Look out... but she wishes well?$", + "An oak door$", + "A photograph$", + "The coat of arms$", + "$", + "Max, the servant, welcomes you and shows you to your room$", + "Mortville 6/2/51@ My dear Jerome@Regarding my telegram, I must tell you the reason for my wor-@ries. A year ago, Murielle, my lady companion, disappeared. The de@part may have had something to do@with the financial success of themanor, or... A silence hard to un@derstand for my son Guy. Not ha@ving been able to see the light of day over this affair, I count @on you to sort things out. If my state of health doesn't improve, @take the decisions that you feel @are apropriate.@ Kind regards, Julia DEFRANCK$", + "Later, Guy will inform you of Leo's suicide after a@heavy bet at the races$", + "F3: AGAIN F8: STOP$", + "The master of the premises$", + "The future heir$", + "JULIA's son$", + "A pretty picture$", + "Superman!$", + "Ida's husband$", + "Interesting remarks?$", + "Service included!$", + "Nothing underneath$", + "You could hear a pin drop$", + "Half an hour passes: nothing! Wait any longer?$", + "Admire! Contemplate!$", + "No! Nothing!$", + "Impossible$", + "That stains!$", + "A treatise on the history of the area$", + "A few coins...$", + "First commandment...$", + "Pleasing to the nostrils!$", + "Spades, Hearts...$", + "Just a spoonful of sugar...$", + "A romantic novel$", + "Worth more than a penny, (whistle)$", + "Just needs a little patience$", + "Watch the sharp bends$", + "Deep and dark$", + "Normal sensations$", + "Sniff!$", + "Not discreet! Be content to watch!$", + "Bless you! Dusty!$", + "The canvas is signed, the wallpaper is not!$", + "Nothing, Unlucky!$", + "Be more discreet!$", + "The shutters are closed$", + "Snow! And more snow!$", + "Brilliant! The work of a master!$", + "No doubt at all! A genuine fake!$", + "Hmm! A cheap reproduction!$", + "A rare and valuable piece$", + "Nothing special$", + "Linen, personal belongings...$", + "Not just anywhere!$", + "It's not time!$", + "One doesn't speak with ones mouth full!$", + "Someone comes in, messes about then goes out again$", + "Someone's approaching your hiding-place$", + "Someone surprises you!$", + "Impossible! You're too loaded!$", + "Try again!$", + "Still puzzled!?$", + "You leave Mortville.In Paris a message awaits you...$", + "You hurt yourself$", + "Nothing more here$", + "The sound seems normal$", + "It doesn't move$", + "You are answered$", + "Not the right moment!$", + "The same matter, from another angle!$", + "The reflection is tarnished, but the frame is gold!$", + "Bric-a-brac$", + "Face to face with failure!$", + "Smells like something you'd rather not see!$", + "Cleaning products$", + "Got an itch?$", + "It's stuck, frozen. Brrr!$", + "All the locks are jammed!$", + "Papers$", + "No! Father christmas hasn't got himself stuck!$", + "It leads onto a corridor$", + "China, silverware...$", + "No! It's not Julia's remains!$", + "An old engraving$", + "You find a deep diamond-shaped opening$", + "The wall slides open! A passage! Do you follow it?$", + "The passageway closes$", + "A secret drawer: a notebook! Do you read it?$", + "The drawer shuts$", + "Nothing! Flesh and blood stuck to the stone$", + "Certain details lead you to believe death was not immediate!$", + "A rotten affair!$", + "Did she cling to dear life with just one finger?$", + "Has the treasure packed its trunk?$", + "A slot the size of a coin$", + "Part of the stone wall pivots.A crypt! Do you enter?$", + "The ring turns, the wall closes$", + "A stone column behind the altar$", + "There is a noise!$", + "Occupied!$", + "Take another chance?$", + "Too deep!$", + "The cellar wall pivots$", + "Nothing$", + "The one and only!$", + "The object slides to the bottom$", + "You have nothing in hand$", + "It is not open$", + "There is already something$", + "The door is locked$", + "No reply$", + "A solid wooden ball$", + "There's no more space$", + "A wooden ball pierced through the side$", + "? ?$", + "Your move$", + "OK !$", + "Suddenly Max arrives with your suitcase: \"Thank you for your @visit!\".Mister discreet \"private eye\" (in need of a private optici@an!). Thoroughly demoralised, you@leave the manor. You are useless!$", + "Leo interrupts: \"The storm has died down,I am going into town in@1 hour. Get ready\". You have lost@time...but not your life$", + "Congestion, the deadly flu... You@are stuck here! Your whole case@sinks slowly beneath the water$", + "The water is rising fast,freezing your last illusions. Before you@have time to react...you are dead$", + "As soon as you reach the bottom of the well, a hand cuts the rope@Farewell sweet life!$", + "The storm covers your footprints.A wall of silence falls heavily@on your shoulders. Slowly you succumb to frosbite...$", + "You're not completely alone! A cold blade plunges into your backup@In future, be more care!$", + "You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case,the family problems thatyou have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", + "$", + "You don't have the keys to the manor. Your cries rest unheard@You're going to catch... your death!$", + "With a circular movement, the sword slices across you. Guts and@intestines spill out all over. A sorry state of affairs!$", + "Home, Sweet home !$", + "The mystery behind a closed door$", + "Bewitching charm of these old rooms$", + "An empty stomach$", + "Closer to heaven? Not so sure$", + "Afraid of the dark?$", + "Old rugs and a glint of gold$", + "Anguish!$", + "Safe? Perhaps not!$", + "A little ill at ease, eh!?$", + "Always further$", + "Your way of the cross!$", + "On the trail of...$", + "Watch what's hiding$", + "The road down to hell$", + "Feeling well? You look a little pale$", + "What lurks behind...?$", + "Close-up on:$", + "You notice, amongst other things$", + "And...$", + "That's all!$", + "A bit of reading$", + "The adventure awaits, you set off!$", + "Don't mess up YOUR next ADVENTURE!$", + "I don't understand$", + "There is an easier way$", + "No, not just now$", + "Too late$", + "$", + "Like a deep stony stare, a solitary eye that points towards the@stars; the artery that links hea-ven and hell. You must fathom@these depths keeping hold of that@which is, and will become. Monday, Tuesday, Wednesday, Sunday, from@Monday 1st to Sunday 1st,plunging from one day to the next your@\"IS\" or \"WILL BECOME\". Carrying your burden with love and light,@the smallest oversight will seal your fate.$", + "10/1/51: We think we've solved the mystery of the manuscript and@located the crypt. Is it the idea@of success in what seems like a dream that disturbs me so? I feel@I have committed myself rather too much, as far as Leo is concer@ned... No! I should go on. @I should have put Guy in the pic-ture but for a week now, I've had@no news of him$", + "Take your prayers as you would to the holy place. From the pillar@of wisdom, bring the sun to his@knees. Thus will it show you the place to offer alms of another@kind and like young Arthur, open the way of darkness.White is your@colour, golden your hearth. So@advance with caution Orpheus and light your way unto the sad@virgin. Offer her the circle of the man with three faces. That he@may regain the world and turn with it to its original@inglory!$", + "The mountains are the fangs in a monstrous mouth opening on the@finity of a celestial orgy, grin-ding the stars as we grind our@teeth into dust. You will drop your chord of stone at your feet.@The laugh of silence at the@highest pitch, and in your right hand, the measure of genius. Thus@will you pass between the two crescents beyond the abyss of the@wall of silence. The key to the melody is within your grasp. It@suffices to find the note that clashes.$", + " 9/12 INTER. 518 3/13 EXPENS. 23@ 9/12 SALES 1203 7/12 CHEQUE 1598@ TOTAL 1721 TOTAL 1721$", + " 5/1/51@@ Luc, my love@ Guy knows about us. After an argument I told him everything! I@think only of you. Max keeps pes-tering me, but it's finished with @him. He should stick to his pots and pans! When can you and I be alone together? For you I would@get a divorce.@I love you.@ Eva$", + " Mortville, 10/2/51@@ Pat@ I recall you owe me 50000 frs that I lent you for your business@I need that money, can you repay me quickly?@ Guy$", + " Mortville, 15/2/51@ Dear Sir@ I am writing to you on the sub-ject of our business deal. I have@decided to go all the way in the certainty that my partner, Pat@DEFRANCK, has been forging the accounts. @In spite of$", + "A pipe$", + "A pen$", + "A lighter$", + "A retort$", + "A shaving brush$", + "A tin of paint$", + "A flute$", + "An expensive ring$", + "A reel of thread$", + "An old book$", + "A wallet$", + "A dagger$", + "A pistol$", + "A bible$", + "A candle$", + "A jewellery box$", + "An iron$", + "A photo$", + "A pocket watch$", + "A rope$", + "Keys$", + "A pearl necklace$", + "A bottle of perfume$", + "Binoculars$", + "Glasses$", + "A leather purse$", + "A tennis ball$", + "Ammunition$", + "A cut-throat razor$", + "A hairbrush$", + "A clothes brush$", + "A pack of cards$", + "A shoe horn$", + "A screwdriver$", + "A hammer$", + "Keys$", + "Keys$", + "An ashtray$", + "A paintbrush$", + "A rope$", + "A wooden object$", + "Sleeping pills$", + "A gold ring$", + "A jewellery box$", + "An alarm clock$", + "A coat of armour$", + "A candlestick$", + "A pair of gloves$", + "A engraved goblet$", + "A parchment$", + "A dagger$", + "A dossier$", + "A parchment$", + "A parchment$", + "A dossier$", + "A dossier$", + "A letter$", + "A novel$", + "A wooden rod$", + "An envelope$", + "A letter$", + "An envelope$", + "Julia$", + "Julia's death$", + "Julia's relationships$", + "A message from Julia$", + "Julia's inheritance$", + "Julia's final actions$", + "Julia's gifts$", + "Julia's bedroom$", + "The photo at Julia's home$", + "Julia and yourself...$", + "L‚o's occupations$", + "Pat's occupations$", + "Guy's occupations$", + "Bob's occupations$", + "Eva's occupations$", + "Luc's occupations$", + "Ida's occupations$", + "Max's occupations$", + "Your occupations$", + "L‚o's relationships$", + "Pat's relationships$", + "Guy's relationships$", + "Bob's relationships$", + "Eva's relationships$", + "Luc's relationships$", + "Ida's relationships$", + "Max's relationships$", + "Your relationships$", + "Murielle$", + "Murielle's relationships$", + "Murielle and yourself...$", + "Murielle's disappearance$", + "The wall of silence$", + "The manuscripts$", + "The coat of arms$", + "Engravings in the cellar$", + "The well$", + "The secret passages$", + "The chapel$", + "The paintings$", + "The photo of the attic$", + "The body in the crypt$", + "$", + "$", + "END OF THE CONVERSATION$", + "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", + "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "TBT - Je n'en sais rien !$", + "TBT - Elle est morte d'une embolie pulmonaire$", + "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "TBT - Madame DEFRANCK est morte d'un coup de froid$", + "TBT - Elle est morte d'une embolie pulmonaire$", + "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "TBT - Ce sont toujours les meilleurs qui partent les premiers$", + "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", + "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", + "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", + "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", + "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", + "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "TBT - Ce sont ses affaires ...$", + "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", + "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", + "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", + "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", + "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", + "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", + "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", + "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", + "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "TBT - Les bijoux ...$", + "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", + "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", + "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", + "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", + "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", + "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", + "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", + "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", + "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", + "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", + "TBT - Moi je n'ai rien … lui reprocher$", + "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", + "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", + "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", + "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", + "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", + "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", + "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", + "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", + "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "TBT - C'est pour un rendez-vous ?$", + "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", + "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", + "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", + "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", + "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", + "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", + "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", + "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", + "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", + "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", + "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", + "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", + "TBT - Elle aussi, faisait des recherches ...$", + "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", + "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "TBT - Je crois que tout le monde l'aimait bien$", + "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", + "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", + "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "TBT - A part sa famille, pas grand monde$", + "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "TBT - Non rien !$", + "TBT - Non ... Pas que le sache$", + "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", + "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", + "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", + "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", + "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", + "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", + "TBT - Son dernier pr‚sent m'a surpris$", + "TBT - Quel cadeau ?$", + "TBT - Un chandellier ...$", + "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "TBT - Et bien oui ! Comme tout le monde, je crois$", + "TBT - Un poignard$", + "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "TBT - Vous avez un don de double-vue ou un passe-partout$", + "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", + "TBT - Vous savez, je la connaissais assez peu$", + "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", + "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", + "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", + "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", + "TBT - Si la chambre est ferm‚e, demandez … L‚o$", + "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "TBT - Vous savez ce que c'est : Des relations familiales$", + "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", + "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", + "TBT - Je ne me rappelle pas$", + "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", + "TBT - Vous tes bien curieux !... C'est sans valeur$", + "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "TBT - Dommage que la devise soit manquante ...$", + "TBT - C'est trŠs beau ... Et trŠs vieux ...$", + "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", + "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", + "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", + "TBT - Ca reste pour moi le plus grand des mystŠres$", + "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", + "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", + "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "TBT - Quoi ?! Quel corps ? Quel crypte ?$", + "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", + "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", + "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", + "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "TBT - Julia aimait beaucoup la peinture$", + "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", + "TBT - Que faites-vous l… ?$", + "TBT - Je suis s–r que vous cherchez quelque chose ici$", + "TBT - Je vous ‚coute$", + "TBT - Que d‚sirez-vous ?$", + "TBT - Oui ?$", + "TBT - Je suis … vous ...$", + "TBT - C'est pourquoi ?$", + "TBT - Allez-y$", + "TBT - C'est … quel sujet ?$", + "TBT - Max : … votre service, monsieur$", + "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", + "TBT - Vous tes trop curieux !$", + "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", + "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", + "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", + "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "to the bureau$", + "to the kitchen$", + "to the cellar$", + "to the landing$", + "outside$", + "to the dining room$", + "inside the manor$", + "front of the manor$", + "to the chapel$", + "to the weel$", + "north$", + "behind the manor$", + "south$", + "east$", + "west$", + "towards the manor$", + "further$", + "in the water$", + "out of the weel$", + "in the weel$", + "choice on screen$", + "In the MYSTERY series...$", + "MORTVILLE MANOR$", + "$", + "From an original idea of...$", + "Bernard GRELAUD and Bruno GOURIER$", + "$", + "Directed by: KYILKHOR CREATION and LANGLOIS$", + "$", + "With the cooperation of...$", + "B‚atrice et Jean_Luc LANGLOIS$", + "for the music and the voices,$", + "Bernard GRELAUD for the graphic conception,$", + "MARIA-DOLORES for the graphic direction,$", + "Bruno GOURIER for the technical direction,$", + "Mick ANDON for the translation. $", + "$", + "Publisher: KYILKHOR and B&JL LANGLOIS $", + "COPYRIGHT 1987: KYILKHOR and B&JL LANGLOIS$", + "$", + "YOUR MOVE$", + "attach$", + "wait$", + "force$", + "sleep$", + "listen$", + "enter$", + "close$", + "search$", + "knock$", + "scratch$", + "read$", + "eat$", + "place$", + "open$", + "take$", + "look$", + "smell$", + "sound$", + "leave$", + "lift$", + "turn$", + "hide yourself$", + "search$", + "read$", + "put$", + "look$", + "Leo$", + "Pat$", + "Guy$", + "Eva$", + "Bob$", + "Luc$", + "Ida$", + "Max$", + "JULIA...$", + "- Did she commit suicide?$", + "- Was she murdered?$", + "- Did she die by accident?$", + "- Did she die of natural causes?$", + "Where did the money come from@for the restoration of the manor?$", + "- Blackmail$", + "- Honest work$", + "- Inheritance$", + "- Races$", + "- Rents$", + "- Hold-up$", + "- Other$", + "What is Leo's hobby?$", + "- Historical research$", + "- Politics$", + "- Painting$", + "- Drugs$", + "- Occult sciences$", + "- Management of a sect$", + "Julia left several clues that are@represented in one place. Which?$", + "- Chapel$", + "- Outside$", + "- Cellar$", + "- Attic$", + "- Kitchen$", + "- Dining room$", + "- Julia's room$", + "- Leo's room$", + "- Pat's room$", + "- Bob's room$", + "- Max's room$", + "- Luc/Ida's room$", + "- Guy/Eva's room$", + "The main clue that leads you@to the underground door is:$", + "- A dagger$", + "- A ring$", + "- A book$", + "- A parchment$", + "- A letter$", + "- A pendulum$", + "How many parchments were there in the manor?$", + "- 0$", + "- 1$", + "- 2$", + "- 3$", + "- 4$", + "- 5$", + "How many persons are involved in@this story?@(Julia included, but not yourself)$", + "- 9$", + "- 10$", + "- 11$", + "What was the first name@of the unknown character?$", + "- Mireille$", + "- Françoise$", + "- Maguy$", + "- Emilie$", + "- Murielle$", + "- Sophie$", + "Wo did Murielle have an affair with?$", + "- Bob$", + "- Luc$", + "- Guy$", + "- Leo$", + "- Max$", + "Murielle shared an occupation@with one other person. Who?$", + "[1][You realize that certain elements of|this investigation remain a mystery for you.|Therefore, you decide first to learn|more before undertaking new risks..][ok]$", + "[3][ | insert disk 1 | in drive A ][ok]$", + "[1][ | Disk error | All stop... ][ok]$", + "[1][ | You should have noticed |00% of the clues ][ok]$", + "[3][ | insert disk 2 | in drive A ][ok]$", + "TBT - [1][|Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "TBT - MASTER .$", + "TBT - rorL$", + NULL +}; + +const char *gameDataFr[] = { + "Le calme dans la tourmente$", + "Des go—ts et des couleurs!$", + "Mauve qui peut!$", + "PriŠre de laisser en sortant...$", + "Trou noir troublant$", + "Bleu... comme \"peur bleue\"!$", + "Chambre de \"Saigneur\"!$", + "Histoire d'eaux$", + "Vert nid$", + "Coup d'oeil sur l'interdit$", + "Odeur de feux de bois et de tabac$", + "Tabac et vieux bouquins$", + "Oignons, cannelle et spiritueux$", + "Un endroit bien peu visit‚$", + "Humidit‚ et moisissure$", + "Avis aux colporteurs...$", + "Corps putr‚fi‚ : cryptomanie mortelle!$", + "Et en plus... des piŠges d‚samorc‚s!$", + "C'est d‚j… ouvert$", + "Danger : avalanches$", + "Une odeur de saintet‚!$", + "Une btisse imposante$", + "L'envers du mystŠre!$", + "Dr“le d'horoscope!$", + "Tant va la cruche...$", + "Une porte en chŠne$", + "Une photo$", + "Les armoiries$", + "$", + "Max, le domestique, vous accueille puis vous conduit … votre chambre$", + "Mortevielle, le 16/2/51@ Mon cher J‚r“me,@ Suite … mon t‚l‚gramme, je vous fais part des raisons de mon inqui‚tude :il y a un an, Murielle, ma dame de compagnie, disparaissait . D‚part ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile … comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'… pr‚sent, faire le jour sur cette affaire, je compte sur vous pour la mener … bien . Si mon ‚tat de sant‚ ne s'am‚liorait pas, prenez les d‚cisions qui vous sembleront le plus appropri‚es...@ Amiti‚s. JULIA DEFRANCK$", + "Plus tard, Guy vous apprendra le suicide de L‚o... aprŠs un pari insens‚ aux courses!$", + "F3: encore@F8: suite$", + "Le maŚtre des lieux$", + "Le futur h‚ritier$", + "Le fils de JULIA$", + "Joli brin!!!$", + "Superman!$", + "Le mari d'Ida$", + "Propos int‚ressants?$", + "Service compris...$", + "Rien dessous!$", + "Un ange passe...$", + "Une 1/2 h passe: rien! Attendez-vous encore?$", + "Admirez! Contemplez!$", + "Non ! Rien !$", + "Impossible$", + "‡a tache !$", + "Un trait‚ sur l'histoire de la r‚gion$", + "Quelques piŠces$", + "Premier commandement...$", + "Des p‚tales plein les narines !$", + "Pique, Coeur...$", + "‡a ne manque pas de cachets !$", + "Un roman d'amour$", + "Souffler n'est pas jouer$", + "Pas une r‚ussite!$", + "Gare aux rebondissements !$", + "Sombre et profond...$", + "Sensations normales$", + "Sniff!$", + "Pas discret ! Contentez-vous de regarder !$", + "Atchoum! De la p... poussiŠre$", + "La toile est sign‚e... pas le papier peint !$", + "Pas de chance, rien !$", + "Soyez plus discret !$", + "Les volets sont clos$", + "De la neige, encore de la neige !$", + "G‚nial : une toile de maŚtre !$", + "Aucun doute : une v‚ritable imitation$", + "Hum ! Vous tiquez : de l'antique en toc !$", + "Une piŠce rare de valeur !$", + "Rien de remarquable$", + "Linge, objets personnels...$", + "Pas n'importe o— !$", + "Ce n'est pas l'heure !$", + "On ne parle pas la bouche pleine ! Donc, une fois le repas termin‚...$", + "Quelqu'un entre, s'affaire, ressort...$", + "On s'approche de votre cachette !$", + "On vous surprend !$", + "Non : vous tes trop charg‚ !$", + "Essayez de nouveau$", + "Vous restez perplexe !?$", + "Vous quittez le Manoir. A Paris, un message vous attend...$", + "A‹e, a‹e, a‹e !$", + "Rien de plus$", + "Le son paraŚt normal$", + "Ca ne bouge pas$", + "On vous r‚pond$", + "Pas le moment !$", + "Mme matiŠre, autre face !$", + "Le reflet est piqu‚, mais le cadre est d'or$", + "Bibelots, babioles...$", + "Vous essuyez un ‚chec !$", + "Il est des odeurs... qu'il vaut mieux ne pas voir !$", + "Des produits m‚nagers$", + "‡a vous d‚mange ?$", + "C'est coinc‚, gel‚ ! Brrrr...$", + "Les huisseries sont bloqu‚es !$", + "Des papiers...$", + "Non ! Le pŠre Nol n'est pas coinc‚ !$", + "‡a donne sur un couloir$", + "Vaisselle, argenterie...$", + "Non ! Ce ne sont pas les restes de Julia !$", + "Une gravure ancienne$", + "Il y a une profonde ouverture en losange$", + "Le mur coulisse... Un passage ! L'empruntez-vous ?$", + "Le passage se ferme$", + "Un tiroir secret... Un livret ! Le lisez-vous ?$", + "Le tiroir se referme$", + "Rien ! Sang et chairs collent … la pierre !$", + "Des d‚tails vous font supposer que... la mort ne fut pas imm‚diate !$", + "Des projets v‚reux ?$", + "Sa vie n'aurait-elle tenu qu'… un doigt ?$", + "Un tr‚sor se serait-il fait la malle ?$", + "Une fente de la taille d'une piŠce !$", + "Quelques pierres pivotent... Une crypte ! Y p‚n‚trez-vous ?$", + "La bague tourne, le mur se referme...$", + "Une colonne de pierres derriŠre l'autel$", + "Il y a du bruit...$", + "Occup‚ !$", + "Retentez-vous votre chance ?$", + "Trop profond !$", + "Le mur de la cave pivote$", + "Nothing !$", + "L'unique !$", + "L'objet glisse au fond...$", + "Vous n'avez rien en main$", + "Ce n'est pas ouvert$", + "Il y a d‚j… quelque chose$", + "La porte est ferm‚e$", + "Pas de r‚ponse$", + "Une boule de bois pleine$", + "Il n'y a plus de place$", + "Une boule de bois perc‚e par le travers$", + "? ?$", + "A vous de jouer$", + "OK !$", + "Soudain Max survient avec votre valise : \"Merci de votre visite ! D‚tective \"priv‚\"... de bon sens et de discr‚tion sans doute\" . D‚‡u d‚moralis‚, vous quittez le manoir@Vous Štes NUL !$", + "L‚o vous interrompt : \"la tempŠte est calm‚e. Je pars en ville dans 1 heure. Tenez-vous prt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", + "Congestion, grippe fatale : vous y restez ! Votre enquŠte tombe … l'eau$", + "L'eau monte trŠs vite et refroidit vos derniŠres illusions... Avant que vous n'ayez eu le temps de r‚agir, vous Štes mort!$", + "A peine Štes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", + "La tempŠte recouvre vos traces . Un mur de silence s'abat sur vos ‚paules . Lentement vous succombez … la morsure du froid !$", + "Pas si seul que ‡a ! Une lame glac‚e s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", + "Vous ignorez la responsabilit‚ exacte de L‚o dans la mort de Murielle... Est-elle morte sur le coup ? De toutes fa‡ons les problŠmes familiaux d‚couverts lors de votre enquŠte justifient l'attitude de L‚o... Vous n'Štes pas s—r que Julia vous ait appel‚ pour ‡a mais c'est suffisant pour vous ! Par respect pour elle, et aprŠs certaines pr‚cautions, vous avez une entrevue r‚v‚latrice avec L‚o$", + "$", + "Vous n'avez pas les clefs du Manoir . Vos appels restent sans r‚ponse . Vous allez attraper... la mort !$", + "D'un mouvement circulaire, l'‚p‚e vous fend par le travers : tripes et boyaux … l'air, bonjour les vers!$", + "Home, Sweet home !$", + "MystŠre d'une porte close$", + "Charme envo—tant de vieilles piŠces$", + "La faim au ventre$", + "Plus prŠs du ciel? Pas s—r !$", + "Peur du noir?$", + "Vieux tapis et reflets d'or$", + "Angoisse !$", + "Sauv‚ ? Pas certain !$", + "Mal … l'aise, hein !$", + "Toujours plus loin !$", + "Votre chemin de croix !$", + "A la d‚couverte de...$", + "Attention … ce que cache...$", + "Une descente aux Enfers !$", + "Si ce n'est pas dans vos cordes :@ ne soyez pas sot!$", + "Avant la mise en piŠce !$", + "Gros plan sur :$", + "Vous remarquez particuliŠrement...$", + "Et encore...$", + "C'est fini !$", + "Un peu de lecture$", + "L'aventure vous attend, vous partez...$", + "Ne ratez pas VOTRE prochaine AVENTURE...$", + "Je ne comprends pas$", + "Il y a plus simple$", + "Non ! Pas ce coup-ci$", + "Trop tard$", + "$", + "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumiŠre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artŠre comme un rat au coeur mme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", + "10/1/50: Nous avons r‚solu le mystŠre du manuscrit et localis‚ la crypte . Est-ce l'id‚e d'aboutir dans ce qui n'‚tait qu'un \"rŠve\" qui me rend si anxieuse ?@Je regrette de m'tre engag‚e vis … vis de L‚o . Non! je dois continuer ! J'aurais d— mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", + "Porte ta priŠre au lieu saint qui se doit, changes-en l'air, tu auras la matiŠre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton …me s'ouvrira un chemin et gagnera son Šre . Avance comme un Orph‚e peu soucieux des t‚nŠbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'… la myst‚rieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premiŠre.$", + "Les montagnes sont les crocs d'une gueule dantesque ouverte … l'infini de quelqu' orgie c‚leste, mastiquant des ‚toiles comme nous broyons du noir .@Tu d‚poseras l'accord de pierre … tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mŠtre . Tu passeras ainsi entre les deux croissants, par del… les abŚmes du Mur du Silence . La Cl‚ des champs est … ta port‚e, tu n'as qu'… retrouver la note qui d‚note.$", + " DECEMBRE@ 9 REMISE 518 13 AGIOS 23@ 19 VIREMENT 1203 17 TRESOR 1598@ TOTAL 1721 TOTAL 1721$", + " Le 5/01/51@@ Luc, mon amour@ Guy connaŚt notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'… toi ! Max me relance mais j'ai d‚finitivement rompu avec lui . Qu'il reste … ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", + " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr‚t‚s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", + " Mortevielle, le 15/2/51@ MaŚtre,@ Je vous ‚cris au sujet de notre affaire. Je suis d‚cid‚ … aller jusqu'au bout, certain que mon associ‚, Pat DEFRANCK, a falsifi‚ un livre de comptes . Malgr‚$", + "Une pipe$", + "Un stylo … plume$", + "Un briquet … essence$", + "Une cornue$", + "Un blaireau$", + "Un pot de peinture$", + "Une flute$", + "Une bague de valeur$", + "Une bobine de fil$", + "Un vieux bouquin$", + "Un porte-monnaie$", + "Un poignard$", + "Un r‚volver$", + "Une bible$", + "Une bougie$", + "Un coffret … bijoux$", + "Un fer … repasser$", + "Une photo$", + "Une montre … gousset$", + "Une corde$", + "Des clefs$", + "Un collier de perles$", + "Un flacon de parfum$", + "Des jumelles$", + "Des lunettes$", + "Une bourse en cuir$", + "Une balle de tennis$", + "Des munitions$", + "Un rasoir … main$", + "Une brosse … cheveux$", + "Une brosse … linge$", + "Un jeu de cartes$", + "Un chausse pied$", + "Un tournevis$", + "Un marteau$", + "Des clefs$", + "Des clefs$", + "Un cendrier$", + "Un pinceau$", + "Une corde$", + "Un objet en bois$", + "Des somnifŠres$", + "Une bague en or$", + "Un coffret … bijoux$", + "Un r‚veil matin$", + "Une cotte de mailles$", + "Un chandellier$", + "Une paire de gants$", + "Une coupe cisel‚e$", + "Un parchemin$", + "Un poignard$", + "Un dossier$", + "Un parchemin$", + "Un parchemin$", + "Un dossier$", + "Un dossier$", + "Une lettre$", + "Un roman$", + "Une baguette en bois$", + "Une enveloppe$", + "Une lettre$", + "Une enveloppe$", + "Julia$", + "La mort de Julia$", + "Les relations de Julia$", + "Un message de Julia$", + "L'h‚ritage de Julia$", + "Derniers actes de Julia$", + "Les cadeaux de Julia$", + "La chambre de Julia$", + "La photo chez Julia$", + "Julia et vous...$", + "Les occupations de L‚o$", + "Les occupations de Pat$", + "Les occupations de Guy$", + "Les occupations de Bob$", + "Les occupations d'Eva$", + "Les occupations de Luc$", + "Les occupations d'Ida$", + "Les occupations de Max$", + "Vos occupations$", + "Les relations de L‚o$", + "Les relations de Pat$", + "Les relations de Guy$", + "Les relations de Bob$", + "Les relations d'Eva$", + "Les relations de Luc$", + "Les relations d'Ida$", + "Les relations de Max$", + "Vos relations$", + "Murielle$", + "Les relations de Murielle$", + "Murielle et vous...$", + "Disparition de Murielle$", + "Le mur du silence$", + "Les manuscrits$", + "Le blason$", + "Les gravures dans la cave$", + "Le puits$", + "Les passages secrets$", + "La chapelle$", + "Les tableaux$", + "La photo du grenier$", + "Le corps dans la crypte$", + "$", + "$", + "FIN DE LA CONVERSATION$", + "Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", + "C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "Je n'en sais rien !$", + "Elle est morte d'une embolie pulmonaire$", + "Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "Madame DEFRANCK est morte d'un coup de froid$", + "Elle est morte d'une embolie pulmonaire$", + "Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "Ce sont toujours les meilleurs qui partent les premiers$", + "J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", + "Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", + "C'est un homme dynamique qui a r‚ussi dans le parfum$", + "Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", + "J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", + "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "Ce sont ses affaires ...$", + "Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", + "Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", + "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", + "Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", + "Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", + "Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", + "Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", + "Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", + "Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "Les bijoux ...$", + "Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", + "Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", + "Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "Une femme comme il n'y en a plus : Elle s'interesse a tout !$", + "Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", + "Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", + "Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", + "C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", + "C'est un homme de caractŠre . Il faut savoir le prendre ..$", + "Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", + "Relations ? Relations amicales ? Relations financiŠres sans doute$", + "Moi je n'ai rien … lui reprocher$", + "C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", + "Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", + "A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", + "Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", + "Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "J'aime bien tout le monde, tant qu'on ne m'escroque pas$", + "Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", + "Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", + "Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", + "Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "C'est pour un rendez-vous ?$", + "Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", + "Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", + "La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", + "C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", + "Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", + "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", + "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", + "Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", + "Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", + "C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", + "C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", + "Murielle a ‚t‚ la dame de compagnie de Julia$", + "Elle aussi, faisait des recherches ...$", + "C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", + "Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "Je crois que tout le monde l'aimait bien$", + "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", + "A part L‚o, elle avait de trŠs bon rapport avec Max ...$", + "Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "A part sa famille, pas grand monde$", + "Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "Non rien !$", + "Non ... Pas que le sache$", + "J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", + "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", + "Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", + "A part la lettre pour vous que j'ai post‚, rien de bien important !$", + "J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", + "Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", + "Son dernier pr‚sent m'a surpris$", + "Quel cadeau ?$", + "Un chandellier ...$", + "Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "Et bien oui ! Comme tout le monde, je crois$", + "Un poignard$", + "Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "Vous avez un don de double-vue ou un passe-partout$", + "Le portrait d'une jeune fille : C'est Murielle ...$", + "Vous savez, je la connaissais assez peu$", + "Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", + "C'est la seule femme vraiment interessante que j'ai rencontr‚$", + "Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", + "Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", + "Si la chambre est ferm‚e, demandez … L‚o$", + "J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "Vous savez ce que c'est : Des relations familiales$", + "Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "Je l'aimais autant qu'elle m'aimais, je crois$", + "De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "C'est sans doute la photo de Murielle avec le filleul de Julia$", + "Je ne me rappelle pas$", + "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", + "Vous tes bien curieux !... C'est sans valeur$", + "Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "Dommage que la devise soit manquante ...$", + "C'est trŠs beau ... Et trŠs vieux ...$", + "Tiens ! C'est un endroit que je n'ai jamais visit‚$", + "D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", + "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "Profond et inqui‚tant : Le progrŠs a du bon$", + "Ca reste pour moi le plus grand des mystŠres$", + "Les derniers temps elle parlait d'un voyage . Et puis ...$", + "Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", + "De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "Quoi ?! Quel corps ? Quel crypte ?$", + "Si il y en a, je ne les ai jamais trouv‚ ...$", + "Bien s–r ! ... Et des fant“mes aussi ...$", + "C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", + "Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "Julia aimait beaucoup la peinture$", + "Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", + "Que faites-vous l… ?$", + "Je suis s–r que vous cherchez quelque chose ici$", + "Je vous ‚coute$", + "Que d‚sirez-vous ?$", + "Oui ?$", + "Je suis … vous ...$", + "C'est pourquoi ?$", + "Allez-y$", + "C'est … quel sujet ?$", + "Max : … votre service, monsieur$", + "De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", + "Vous tes trop curieux !$", + "J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", + "En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", + "F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", + "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + " au bureau$", + " … la cuisine$", + " … la cave$", + " dans le couloir$", + " dehors$", + " la salle … manger$", + " dans le manoir$", + " devant le manoir$", + " … la chapelle$", + " devant le puits$", + " au nord$", + " derriŠre le manoir$", + " au sud$", + " … l'est$", + " … l'ouest$", + " vers le manoir$", + " plus loin$", + " dans l'eau$", + " hors du puits$", + " dans le puits$", + " choix sur ‚cran$", + " Dans la serie MYSTERE...$", + " LE MANOIR DE MORTEVIELLE$", + "$", + " Sur une idee de...$", + " Bernard GRELAUD et Bruno GOURIER$", + "$", + " Realisation: LANKHOR$", + "$", + " Avec la participation de...$", + " Beatrice et Jean-Luc LANGLOIS$", + " pour la musique et les voix,$", + " Bernard GRELAUD pour la conception graphique,$", + " MARIA-DOLORES pour la realisation graphique,$", + " Bruno GOURIER pour la realisation technique,$", + " Clement ROQUES pour l'adaptation sur IBM PC et compatibles .$", + "$", + " Edition: LANKHOR$", + " COPYRIGHT 1988: LANKHOR$", + "$", + " A VOUS DE JOUER$", + " attacher$", + " attendre$", + " d‚foncer$", + " dormir$", + " ‚couter$", + " entrer$", + " fermer$", + " fouiller$", + " frapper$", + " gratter$", + " lire$", + " manger$", + " mettre$", + " ouvrir$", + " prendre$", + " regarder$", + " sentir$", + " sonder$", + " sortir$", + " soulever$", + " tourner$", + " se cacher$", + " fouiller$", + " lire$", + " poser$", + " regarder$", + " L‚o$", + " Pat$", + " Guy$", + " Eva$", + " Bob$", + " Luc$", + " Ida$", + " Max$", + "Comment Julia est-elle morte ?$", + "Elle s'est suicid‚e$", + "Elle est morte assassin‚e$", + "Elle est morte accidentellement$", + "Elle est morte naturellement$", + "D'o— provenait l'argent qui a permis la restauration du manoir ?$", + "chantage$", + "travail$", + "h‚ritage$", + "courses$", + "rentes$", + "hold-up$", + "d‚couverte$", + "Quel est le hobby de L‚o ?$", + "recherches historiques$", + "politique$", + "peinture$", + "drogue$", + "sciences occultes$", + "direction d'une secte$", + "Julia a laiss‚ une s‚rie d'indices . Ceux-ci sont repr‚sent‚s en un seul lieu . Lequel ?$", + "Chapelle$", + "Ext‚rieur$", + "Cave$", + "Grenier$", + "Cuisine$", + "Salle … manger$", + "Chambre Julia$", + "Chambre L‚o$", + "Chambre Pat$", + "Chambre Bob$", + "Chambre Max$", + "Chambre Luc/Ida$", + "Chambre Guy/Eva$", + "L'indice principal qui vous a permis d'arriver … la porte du souterrain est :$", + "Un poignard$", + "Une bague$", + "Un livre$", + "Un parchemin$", + "Une lettre$", + "Un pendule$", + "Combien y avait-il de parchemin dans le manoir ?$", + "Aucun$", + "Un seul$", + "Deux$", + "Trois$", + "Quatre$", + "Cinq$", + "Combien de personnes sont m‚l‚es … cette histoire - Julia y comprise, vous except‚ - ?$", + "Neuf$", + "Dix$", + "Onze$", + "Quel ‚tait le pr‚nom de la personne inconnue ?$", + "Mireille$", + "Fran‡oise$", + "Maguy$", + "Emilie$", + "Murielle$", + "Sophie$", + "De qui Murielle ‚tait-elle la maŚtresse ?$", + "Bob$", + "Luc$", + "Guy$", + "L‚o$", + "Max$", + "Murielle partageait une occupation avec une autre personne . Qui ?$", + "[1][|Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", + "[1][|Ins‚rez la disquette 1 dans le lecteur A][ok]$", + "[1][|! ERREUR DISQUETTE !|On arrete tout][ok]$", + "[1][|Vous devriez avoir remarqu‚|00% des indices][ok]$", + "[1][|Ins‚rez la disquette 2 dans le lecteur A][ok]$", + "[1][|Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + " MASTER .$", + " rorL$", +}; + +#endif -- cgit v1.2.3 From ecda7b6b8f1b3105686bd99e262ca26cce4e22fe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 19 Feb 2012 11:12:17 +0100 Subject: TOOLS: Mortevielle - Remove extra spaces in one of the words --- devtools/create_mortdat/enginetext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index fb4d12d966..d9b3b05e2b 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -106,7 +106,7 @@ const char *engineDataFr[] = { "se cacher", "prendre", - " sonder ", + "sonder", "soulever", " -SUITE- ", " -STOP- ", -- cgit v1.2.3 From b12f8bf5ad72290bddf9d5b9c50bc1c4aa516005 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 19 Feb 2012 11:28:19 +0100 Subject: MORTEVIELLE: Start cleaning taffich.cpp --- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/prog.cpp | 4 +- engines/mortevielle/taffich.cpp | 181 +++++++++++++++++++++++----------------- engines/mortevielle/taffich.h | 4 +- engines/mortevielle/var_mor.cpp | 2 +- engines/mortevielle/var_mor.h | 2 +- 6 files changed, 110 insertions(+), 85 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 3efa80efdd..3cb8192283 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -422,7 +422,7 @@ void f3f8::atf3f8(int &key) { void f3f8::aff50(bool c) { caff = 50; - maff = 0; + _maff = 0; taffich(); dessine(ades, 63, 12); if (c) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 8d905af326..f0a95ff108 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -51,7 +51,7 @@ void change_gd(int ngd) { else person(); clsf2(); clsf3(); - maff = 68; + _maff = 68; afdes(0); repon(2, crep); g_vm->_menu.menu_aff(); @@ -83,7 +83,7 @@ void MortevielleEngine::gameLoaded() { g[2] = 'A'; cache = false; brt = false; - maff = 68; + _maff = 68; g[5] = 'E'; mnumo = 0; prebru = 0; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index a9f727a41b..e654d1adf0 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -35,69 +35,63 @@ namespace Mortevielle { -void chardes(Common::String nom, int32 passe, int long_) { - int i, p, l; -// byte b; +void chardes(Common::String filename, int32 skipSize, int length) { Common::File f; - - /* debug('chardes'); */ - if (!f.open(nom)) - error("Missing file %s", nom.c_str()); + if (!f.open(filename)) + error("Missing file %s", filename.c_str()); testfi(); - p = 0; - while (passe > 127) { - p = p + 1; - passe = passe - 128; + int skipBlock = 0; + while (skipSize > 127) { + ++skipBlock; + skipSize -= 128; } - if (p != 0) - f.seek(p * 0x80); - p = abs(passe); - l = long_ + p; - i = 0; - while (l > 0) { - f.read(&mem[0x6000 * 16 + i], 128); + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int totalLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (totalLength > 0) { + f.read(&mem[memIndx], 128); testfi(); - l = l - 128; - i = i + 128; + totalLength -= 128; + memIndx += 128; } f.close(); - for (i = p; i <= long_ + p; i ++) - mem[0x7000 * 16 + i - p] = mem[0x6000 * 16 + i]; - /*$i+*/ + for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + mem[0x7000 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } -void charani(Common::String nom, int32 passe, int long_) { - int i, p, l; -// byte b; +void charani(Common::String filename, int32 skipSize, int length) { Common::File f; - /* debug('charani'); */ - if (!f.open(nom)) - error("Missing file - %s", nom.c_str()); + if (!f.open(filename)) + error("Missing file - %s", filename.c_str()); testfi(); - p = 0; - while (passe > 127) { - passe = passe - 128; - p = p + 1; + int skipBlock = 0; + while (skipSize > 127) { + skipSize = skipSize - 128; + ++skipBlock; } - if (p != 0) - f.seek(p * 0x80); - - p = abs(passe); - l = long_ + p; - i = 0; - while (l > 0) { - f.read(&mem[0x6000 * 16 + i], 128); + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int fullLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (fullLength > 0) { + f.read(&mem[memIndx], 128); testfi(); - l = l - 128; - i = i + 128; + fullLength -= 128; + memIndx += 128; } f.close(); - for (i = p; i <= long_ + p; i ++) mem[0x7314 * 16 + i - p] = mem[0x6000 * 16 + i]; + for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + mem[0x7314 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } void taffich() { @@ -107,7 +101,6 @@ void taffich() { int i, m, a, b, cx, handle, npal; int32 lgt; - Common::String nom; int palh, k, j; int alllum[16]; @@ -118,69 +111,101 @@ void taffich() { else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; b = a; - if (maff == a) return; - if (a == 16) { + if (_maff == a) + return; + + switch (a) { + case 16: s.pourc[9] = '*'; s.teauto[42] = '*'; - } - if (a == 20) { + break; + case 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) { + break; + case 24: + s.teauto[37] = '*'; + break; + case 30: + s.teauto[9] = '*'; + break; + case 31: s.pourc[4] = '*'; s.teauto[35] = '*'; + break; + case 118: + s.teauto[41] = '*'; + break; + case 143: + s.pourc[1] = '*'; + break; + case 150: + s.teauto[34] = '*'; + break; + case 151: + s.pourc[2] = '*'; + break; + default: + break; } - 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; + Common::String filename; + 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 == 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; + 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; + _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]; + + for (cx = 0; cx <= (a - 1); cx ++) + lgt = lgt + l[cx]; handle = l[a]; - nom = "DXX.mor"; + + filename = "DXX.mor"; } else { - nom = "DZZ.mor"; + filename = "DZZ.mor"; handle = l[87]; if (a == 51) { lgt = handle; handle = l[88]; } - maff = a; + _maff = a; npal = a + 37; } - chardes(nom, lgt, handle); + chardes(filename, lgt, handle); if (gd == her) { for (i = 0; i <= 15; i ++) { palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); @@ -204,15 +229,15 @@ void taffich() { 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"; + filename = "AXX.mor"; } else if (b == 50) { - nom = "AZZ.mor"; + filename = "AZZ.mor"; handle = 1260; } - charani(nom, lgt, handle); + charani(filename, lgt, handle); } show_mouse(); - if ((a < 27) && ((maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) { + 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; diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h index a6acce21eb..4bb5e77de1 100644 --- a/engines/mortevielle/taffich.h +++ b/engines/mortevielle/taffich.h @@ -32,8 +32,8 @@ namespace Mortevielle { -extern void chardes(Common::String nom, int32 passe, int long_); -extern void charani(Common::String nom, int32 passe, int long_); +extern void chardes(Common::String filename, int32 passe, int long_); +extern void charani(Common::String filename, int32 skipSize, int length); extern void taffich(); } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 27eb5bb0b6..0caadadbff 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -137,7 +137,7 @@ int x, ment, haut, caff, - maff, + _maff, crep, ades, iouv, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index b810033f0a..bfccd66e34 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -302,7 +302,7 @@ extern int x, ment, haut, caff, - maff, + _maff, crep, ades, iouv, -- cgit v1.2.3 From d8686819760db1e8fec28a99ef989c98f116c77a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 19 Feb 2012 21:15:57 +0100 Subject: MORTEVIELLE: Rename mouse functions, various formatting fixes --- engines/mortevielle/actions.cpp | 32 ++--- engines/mortevielle/dialogs.cpp | 24 ++-- engines/mortevielle/graphics.cpp | 4 +- engines/mortevielle/level15.cpp | 10 +- engines/mortevielle/menu.cpp | 8 +- engines/mortevielle/mor.cpp | 28 ++-- engines/mortevielle/mor2.cpp | 20 +-- engines/mortevielle/mortevielle.cpp | 6 +- engines/mortevielle/mouse.cpp | 247 +++++++++++++++++++----------------- engines/mortevielle/mouse.h | 12 +- engines/mortevielle/prog.cpp | 10 +- engines/mortevielle/saveload.cpp | 8 +- engines/mortevielle/taffich.cpp | 51 +++++--- 13 files changed, 240 insertions(+), 220 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 02c7b6a90f..fe9d3a4dda 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -534,12 +534,12 @@ void tmettre() { i = Alert::show(delig, 1); tesok = false; entre = Ques::show(); - hide_mouse(); + hideMouse(); hirs(); dessine_rouleau(); clsf2(); clsf3(); - show_mouse(); + showMouse(); tinke(); pendule(); if (ipers != 0) @@ -1034,7 +1034,7 @@ void tparler() } tkey1(false); mennor(); - hide_mouse(); + hideMouse(); hirs(); premtet(); sparl(0, suj); @@ -1047,7 +1047,7 @@ void tparler() } lib[46] = lib[45]; lib[45] = ' '; - show_mouse(); + showMouse(); do { choi = 0; icm = 0; @@ -1068,10 +1068,10 @@ void tparler() writetp(lib[46], 0); tou = '\0'; do { - mov_mouse(f, tou); + moveMouse(f, tou); CHECK_QUIT; - read_pos_mouse(x, y, c); + getMousePos(x, y, c); x = x * (3 - res); if (x > 319) cx = 41; else cx = 1; @@ -1135,11 +1135,11 @@ void tparler() s.conf = s.conf + 3; suj = 139; } - hide_mouse(); + hideMouse(); hirs(); premtet(); sparl(0, suj); - show_mouse(); + showMouse(); if ((suj == 84) || (suj == 86)) { s.pourc[5] = '*'; s.teauto[7] = '*'; @@ -1152,26 +1152,26 @@ void tparler() s.pourc[8] = '*'; s.teauto[32] = '*'; } - hide_mouse(); + hideMouse(); hirs(); - show_mouse(); + showMouse(); } } while (!((choi == 46) || (suj == 138))); if (col) { s.conf = s.conf + (3 * (s.conf / 10)); - hide_mouse(); + hideMouse(); hirs(); premtet(); sparl(0, 138); - show_mouse(); + showMouse(); col = false; s.mlieu = 15; } ctrm = 0; - hide_mouse(); + hideMouse(); hirs(); dessine_rouleau(); - show_mouse(); + showMouse(); affper(ipers); tinke(); pendule(); @@ -1216,13 +1216,13 @@ void MortevielleEngine::endGame() { clsf3(); repon(9, 1509); tkey1(false); - hide_mouse(); + hideMouse(); caff = 70; taffich(); hirs(); premtet(); sparl(0, 141); - show_mouse(); + showMouse(); clsf1(); repon(9, 1509); repon(2, 142); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 3cb8192283..bccbb10f56 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -64,7 +64,7 @@ int Alert::show(const Common::String &msg, int n) { /*debug('** do_alert **');*/ memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; - hide_mouse(); + hideMouse(); while (keypressed()) dumi = get_ch(); // input >> kbd >> dumi; @@ -106,12 +106,12 @@ int Alert::show(const Common::String &msg, int n) { limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; limit[2][2] = (limit[2][1]) + 40; } - show_mouse(); + showMouse(); quoi = 0; dum = false; do { dumi = '\377'; - mov_mouse(dum, dumi); + moveMouse(dum, dumi); CHECK_QUIT0; cx = x_s; @@ -127,7 +127,7 @@ int Alert::show(const Common::String &msg, int n) { if (test1) ix = 1; else ix = 2; if (ix != quoi) { - hide_mouse(); + hideMouse(); if (quoi != 0) { setPosition(quoi, coldep, esp); @@ -144,12 +144,12 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.writeg(tmp2, 1); quoi = ix; - show_mouse(); + showMouse(); } } } if ((quoi != 0) && ! newaff) { - hide_mouse(); + hideMouse(); setPosition(quoi, coldep, esp); Common::String tmp3(" "); @@ -158,13 +158,13 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.writeg(tmp3, 0); quoi = 0; - show_mouse(); + showMouse(); } test3 = (cy > 95) && (cy < 105) && (((cx > limit[1][1]) && (cx < limit[1][2])) || ((cx > limit[2][1]) && (cx < limit[2][2]))); } while (!g_vm->getMouseClick()); g_vm->setMouseClick(false); - hide_mouse(); + hideMouse(); if (! test3) { quoi = n; setPosition(n, coldep, esp); @@ -174,7 +174,7 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.writeg(tmp4, 1); } charecr(50, succ(int, nligne) << 4); - show_mouse(); + showMouse(); /* Restore the background area */ g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); @@ -289,9 +289,9 @@ bool Ques::show() { compte = 0; do { - hide_mouse(); + hideMouse(); hirs(); - show_mouse(); + showMouse(); i = i + 1; deline(ta[i], st, tay); if (res == 1) y = 29; @@ -340,7 +340,7 @@ bool Ques::show() { do { g_vm->setMouseClick(false); tesok = false; - mov_mouse(func, key); + moveMouse(func, key); CHECK_QUIT0; k = 1; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 0fab9de965..62f13dac5e 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1048,7 +1048,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { if (l == "") return; - hide_mouse(); + hideMouse(); pt = _textPos; if (res == 2) @@ -1085,7 +1085,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); pt.x += i; } - show_mouse(); + showMouse(); } /** diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 8d89767e91..374851f7f0 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -50,7 +50,7 @@ bool dans_rect(rectangle r) { int x, y, c; bool dans_rect_result; - read_pos_mouse(x, y, c); + getMousePos(x, y, c); if ((x > r.x1) && (x < r.x2) && (y > r.y1) && @@ -113,15 +113,15 @@ void pictout(int seg, int dep, int x, int y) { } void sauvecr(int y, int dy) { - hide_mouse(); + hideMouse(); s_sauv(gd, y, dy); - show_mouse(); + showMouse(); } void charecr(int y, int dy) { - hide_mouse(); + hideMouse(); s_char(gd, y, dy); - show_mouse(); + showMouse(); } void adzon() { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 2fc558a7fb..7da2eefb0f 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -148,7 +148,7 @@ void Menu::menu_aff() { int pt, x, y, color, msk, num_letr; - hide_mouse(); + hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; @@ -180,7 +180,7 @@ void Menu::menu_aff() { } while (!(y == 9)); col = col + 48 * res; } while (!(num_letr == 6)); - show_mouse(); + showMouse(); } /** @@ -279,7 +279,7 @@ void Menu::menuDown(int ii) { // Draw the menu xco = don[ii][1]; nb_lig = don[ii][4]; - hide_mouse(); + hideMouse(); sauvecr(10, succ(byte, don[ii][2]) << 1); xco = xco << 3; if (res == 1) cx = 10; @@ -337,7 +337,7 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (!(cx == nb_lig)); test0 = true; - show_mouse(); + showMouse(); } /** diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index de784471f8..78e577a3f5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -92,10 +92,10 @@ void modif(int &nu) { void dessine(int ad, int x, int y) { /* debug('dessine'); */ - hide_mouse(); + hideMouse(); writepal(numpal); pictout(ad, 0, x, y); - show_mouse(); + showMouse(); } void dessine_rouleau() { @@ -104,9 +104,9 @@ void dessine_rouleau() { if (gd == her) { mem[0x7000 * 16 + 14] = 15; } - hide_mouse(); + hideMouse(); pictout(0x73a2, 0, 0, 0); - show_mouse(); + showMouse(); } @@ -145,17 +145,17 @@ void ecrf1() { void clsf1() { /* debug('clsf1'); */ - hide_mouse(); + hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - show_mouse(); + showMouse(); } void clsf2() { // int i, j; /* debug('clsf2'); */ - hide_mouse(); + hideMouse(); if (f2_all) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); @@ -164,7 +164,7 @@ void clsf2() { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); } - show_mouse(); + showMouse(); } void ecrf2() { @@ -203,10 +203,10 @@ void clsf3() { // int i, j; /* debug('clsf3'); */ - hide_mouse(); + hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); - show_mouse(); + showMouse(); } void ecr3(Common::String text) { @@ -231,7 +231,7 @@ void clsf10() { Common::String st; /* debug('clsf10'); */ - hide_mouse(); + hideMouse(); if (res == 1) { co = 634; cod = 534; @@ -254,7 +254,7 @@ void clsf10() { else co = 584; g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, co, 86)); /* rempli(69,12,32,5,255);*/ - show_mouse(); + showMouse(); } void stop() { @@ -595,7 +595,7 @@ void pendule() { /* debug('pendule'); */ - hide_mouse(); + hideMouse(); paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); @@ -610,7 +610,7 @@ void pendule() { if (h > 12) h = h - 12; if (h == 0) h = 12; g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); - show_mouse(); + showMouse(); g_vm->_screenSurface.putxy(568, 154); if (heu > 11) g_vm->_screenSurface.writeg("PM ", 1); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c388c4a937..7a49456197 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -181,7 +181,7 @@ void tinke() { void fenat(char ans) { int coul; - hide_mouse(); + hideMouse(); if (gd == cga) coul = 2; else if (gd == her) @@ -191,7 +191,7 @@ void fenat(char ans) { g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - show_mouse(); + showMouse(); } @@ -207,18 +207,18 @@ void tkey1(bool d) { int x, y, c; int key; - hide_mouse(); + hideMouse(); fenat('K'); while (keypressed()) key = testou(); do { if (d) tinke(); quest = keypressed(); - read_pos_mouse(x, y, c); + getMousePos(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); if (quest) key = testou(); g_vm->setMouseClick(false); - show_mouse(); + showMouse(); } void tmlieu(int mli) { @@ -384,7 +384,7 @@ void sparl(float adr, float rep) { char st[1410]; repint = abs((int)rep); - hide_mouse(); + hideMouse(); deline(repint + c_paroles, st, tay); afftex(st, 230, 4, 65, 24, 5); f3f8::draw(); @@ -396,7 +396,7 @@ void sparl(float adr, float rep) { CHECK_QUIT; } while (!(key == 66)); hirs(); - show_mouse(); + showMouse(); } void finfouil() { @@ -477,13 +477,13 @@ void t1sama() { /* On entre dans le manoir */ //Translation: repon(2, 33); tkey1(false); mennor(); - hide_mouse(); + hideMouse(); hirs(); premtet(); sparl(0, 140); dessine_rouleau(); pendule(); - show_mouse(); + showMouse(); s.mlieu = 0; affrep(); t5(10); @@ -616,7 +616,7 @@ void tfleche() { touch = '\0'; do { - mov_mouse(qust, touch); + moveMouse(qust, touch); CHECK_QUIT; if (g_vm->getMouseClick()) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b35e98611c..256b8551ed 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -145,7 +145,7 @@ Common::ErrorCode MortevielleEngine::initialise() { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); c_zzz = 1; init_nbrepm(); - init_mouse(); + initMouse(); init_lieu(); sonoff = false; @@ -497,7 +497,7 @@ void MortevielleEngine::mainGame() { dprog(); hirs(); dessine_rouleau(); - show_mouse(); + showMouse(); // Loop to play the game do { @@ -549,7 +549,7 @@ void MortevielleEngine::handleAction() { do { g_vm->_menu.mdn(); tinke(); - mov_mouse(funct, inkey); + moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; } while (!((choisi) || (temps > lim) || (funct) || (anyone))); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 51af36b5f0..d99163cc6f 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -47,8 +47,11 @@ int m_show, int s_s[12][6]; - -void init_mouse() { +/** + * Initialize the mouse + * @remarks Originally called 'init_mouse' + */ +void initMouse() { registres reg; mouse_shwn = 0; @@ -58,23 +61,28 @@ void init_mouse() { g_vm->setMouseClick(false); m_show = m_arrow; - if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) int_m = false; + if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[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; - } + reg.ax = 4; + reg.cx = 0; + reg.dx = 0; + intr(0x33, reg); } } } -void hide_mouse() { +/** + * Hide the mouse + * @remarks Originally called 'hide_mouse' + */ +void hideMouse() { int i, j, k, ps;; bool imp; @@ -83,7 +91,7 @@ void hide_mouse() { imp = odd(y_s); j = p_o_s; switch (gd) { - case cga : { + case cga: { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -91,12 +99,12 @@ void hide_mouse() { WRITE_LE_UINT16(&mem[0xb800 * 16 + j + 2], s_s[1][k]); WRITE_LE_UINT16(&mem[0xba00 * 16 + j], s_s[2][k]); WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]); - j = j + 80; + j += 80; k = succ(int, k); } while (!(k >= 5)); } break; - case ams : { + case ams: { for (i = 0; i <= 3; i ++) { port[0x3dd] = 1 << i; k = 0; @@ -104,10 +112,10 @@ void hide_mouse() { do { if (imp) { WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); - j = j + 80 - 0x2000; + j += 80 - 0x2000; } else { WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); - j = j + 0x2000; + j += 0x2000; } imp = ! imp; k = succ(int, k); @@ -115,7 +123,7 @@ void hide_mouse() { } } break; - case ega : { + case ega: { port[0x3c4] = 2; port[0x3ce] = 8; port[0x3cf] = 255; @@ -129,23 +137,23 @@ void hide_mouse() { mem[0xa000 * 16 + j] = lo(s_s[i][k]); ps = mem[0xa000 * 16 + j + 1]; mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); - j = j + 80; + j += 80; k = succ(int, k); } while (!(k >= 8)); - i = i + 1; + ++i; } while (!(i == 4)); } break; - case her : { + case her: { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); - j = j + 80; + j += 80; } } break; - case tan : { + case tan: { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { @@ -153,7 +161,7 @@ void hide_mouse() { WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } - j = j + 160; + j += 160; k = succ(int, k); } while (!(k == 3)); } @@ -163,7 +171,11 @@ void hide_mouse() { } } -void show_mouse() { +/** + * Show mouse + * @remarks Originally called 'show_mouse' + */ +void showMouse() { int i, j, k, l; bool imp; @@ -173,7 +185,7 @@ void show_mouse() { imp = odd(y_s); i = x_s & 7; switch (gd) { - case cga : { + case cga: { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -181,12 +193,12 @@ void show_mouse() { s_s[1][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j + 2]); s_s[2][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j]); s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]); - j = j + 80; + j += 80; k = succ(int, k); } while (!(k >= 5)); } break; - case ams : { + case ams: { for (i = 0; i <= 3; i ++) { j = p_o_s; imp = odd(y_s); @@ -195,10 +207,10 @@ void show_mouse() { do { if (imp) { s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); - j = j + 80 - 0x2000; + j += 80 - 0x2000; } else { s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); - j = j + 0x2000; + j += 0x2000; } imp = ! imp; k = succ(int, k); @@ -206,7 +218,7 @@ void show_mouse() { } } break; - case ega : { + case ega: { port[0x3ce] = 4; l = 0; do { @@ -215,14 +227,14 @@ void show_mouse() { j = p_o_s; do { s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 * 16 + succ(int, j)] << 8); - j = j + 80; + j += 80; k = succ(int, k); } while (!(k >= 8)); - l = l + 1; + ++l; } while (!(l == 4)); } break; - case her : { + case her: { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) @@ -231,7 +243,7 @@ void show_mouse() { } } break; - case tan : { + case tan: { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { @@ -239,7 +251,7 @@ void show_mouse() { s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]); s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); } - j = j + 160; + j += 160; k = succ(int, k); } while (!(k == 3)); } @@ -247,24 +259,41 @@ void show_mouse() { } /* case Gd */ } -void pos_mouse(int x, int y) { - 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; +/** + * Set mouse position + * @remarks Originally called 'pos_mouse' + */ +void setMousePos(int x, int y) { + 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; // Set the new position g_vm->setMousePos(Common::Point(x, y)); } -void read_pos_mouse(int &x, int &y, int &c) { +/** + * Get mouse poisition + * @remarks Originally called 'read_pos_mouse' + */ +void getMousePos(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; c = g_vm->getMouseClick() ? 1 : 0; } -void mov_mouse(bool &funct, char &key) { +/** + * Move mouse + * @remarks Originally called 'mov_mouse' + */ +void moveMouse(bool &funct, char &key) { bool p_key; char in1, in2; int cx, cy, cd; @@ -283,52 +312,46 @@ void mov_mouse(bool &funct, char &key) { CHECK_QUIT; in1 = get_ch(); - read_pos_mouse(cx, cy, cd); + getMousePos(cx, cy, cd); switch (toupper(in1)) { - case '4' : + case '4': cx = cx - 8; break; - case '2' : + case '2': cy = cy + 8; break; - case '6' : + case '6': cx = cx + 8; break; - case '8' : + case '8': cy = cy - 8; break; - case '7' : { + case '7': cy = 1; cx = 1; - } - break; - case '1' : { + break; + case '1': cx = 1; cy = 190; - } - break; - case '9' : { + break; + case '9': cx = 315 * res; cy = 1; - } - break; - case '3' : { + break; + case '3': cy = 190; cx = 315 * res; - } - break; - case '5' : { + break; + case '5': cy = 100; cx = 155 * res; - } - break; + break; case ' ': - case '\15' : { + case '\15': g_vm->setMouseClick(true); return; - } - break; - case '\33' : { + break; + case '\33': p_key = keypressed(); if (p_key) { @@ -340,102 +363,90 @@ void mov_mouse(bool &funct, char &key) { return; } else { switch (in2) { - case 'K' : + case 'K': cx = pred(int, cx); break; - case 'P' : + case 'P': cy = succ(int, cy); break; - case 'M' : + case 'M': cx = cx + 2; break; - case 'H' : + case 'H': cy = pred(int, cy); break; - case 'G' : { + case 'G': cx = cx - 1; cy = cy - 1; - } - break; - case 'I' : { + break; + case 'I': cx = cx + 1; cy = cy - 1; - } - break; - case 'O' : { + break; + case 'O': cx = cx - 1; cy = cy + 1; - } - break; - case 'Q' : { + break; + case 'Q': cx = cx + 1; cy = cy + 1; - } - break; - } /* case */ + break; + default: + break; + } // case } } - } - break; - case 'I' : { + break; + case 'I': cx = res * 32; cy = 8; - } - break; - case 'D' : { + break; + case 'D': cx = 80 * res; cy = 8; - } - break; - case 'A' : { + break; + case 'A': cx = 126 * res; cy = 8; - } - break; - case 'S' : { + break; + case 'S': cx = 174 * res; cy = 8; - } - break; - case 'P' : { + break; + case 'P': cx = 222 * res; cy = 8; - } - break; - case 'F' : { + break; + case 'F': cx = res * 270; cy = 8; - } - break; - case '\23' : { + break; + case '\23': sonoff = ! sonoff; return; - } - break; - case '\26' : { + break; + case '\26': zuul = true; return; - } - break; - case '\24' : { /* ^T => mode tandy */ + break; + case '\24': // ^T => mode tandy funct = true; key = '\11'; - } - break; - case '\10' : { /* ^H => mode Hercule */ + break; + case '\10': // ^H => mode Hercule funct = true; key = '\7'; - } - break; + break; case '\1': case '\3': - case '\5' : { + case '\5': funct = true; key = in1; + break; + default: + break; } - break; - } - pos_mouse(cx, cy); + setMousePos(cx, cy); p_key = keypressed(); } } diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 32fba0420f..d17654c19e 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -38,14 +38,14 @@ extern int m_show, p_o_s, mouse_shwn; -void init_mouse(); +void initMouse(); //extern void change_mouse(int t); //extern void dessine_souris(int xf, int yf); -extern void hide_mouse(); -extern void show_mouse(); -extern void pos_mouse(int x, int y); -extern void read_pos_mouse(int &x, int &y, int &c); -extern void mov_mouse(bool &funct, char &key); +extern void hideMouse(); +extern void showMouse(); +extern void setMousePos(int x, int y); +extern void getMousePos(int &x, int &y, int &c); +extern void moveMouse(bool &funct, char &key); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index f0a95ff108..737ec6602e 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -39,11 +39,11 @@ namespace Mortevielle { void change_gd(int ngd) { - hide_mouse(); + hideMouse(); gd = ngd; hirs(); - init_mouse(); - show_mouse(); + initMouse(); + showMouse(); dessine_rouleau(); tinke(); pendule(); @@ -67,7 +67,7 @@ void MortevielleEngine::gameLoaded() { char g[8]; - hide_mouse(); + hideMouse(); imen = false; g[1] = 'M'; _loseGame = true; @@ -131,7 +131,7 @@ void MortevielleEngine::gameLoaded() { modinv(); if (s.derobj != 0) modobj2(s.derobj + 400, test[1], test[2]); else tesok = test[1] || test[2]; - show_mouse(); + showMouse(); } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 0b3946af0b..c2c43953d0 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -118,7 +118,7 @@ void SavegameManager::takesav(int n) { * Load a saved game */ Common::Error SavegameManager::loadGame(int n) { - hide_mouse(); + hideMouse(); maivid(); takesav(n); @@ -126,7 +126,7 @@ Common::Error SavegameManager::loadGame(int n) { theure(); dprog(); g_vm->gameLoaded(); - show_mouse(); + showMouse(); return Common::kNoError; } @@ -137,7 +137,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { Common::OutSaveFile *f; int i; - hide_mouse(); + hideMouse(); tmaj3(); for (i = 0; i <= 389; i ++) @@ -165,7 +165,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { delete f; dem2(); - show_mouse(); + showMouse(); return Common::kNoError; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index e654d1adf0..9402f3fec5 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -40,7 +40,6 @@ void chardes(Common::String filename, int32 skipSize, int length) { if (!f.open(filename)) error("Missing file %s", filename.c_str()); - testfi(); int skipBlock = 0; while (skipSize > 127) { ++skipBlock; @@ -66,11 +65,9 @@ void chardes(Common::String filename, int32 skipSize, int length) { void charani(Common::String filename, int32 skipSize, int length) { Common::File f; - if (!f.open(filename)) error("Missing file - %s", filename.c_str()); - testfi(); int skipBlock = 0; while (skipSize > 127) { skipSize = skipSize - 128; @@ -153,23 +150,29 @@ void taffich() { } okdes = true; - hide_mouse(); + hideMouse(); lgt = 0; Common::String filename; 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 ((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; + 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) @@ -224,10 +227,14 @@ void taffich() { 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]; + 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]; filename = "AXX.mor"; } else if (b == 50) { @@ -236,10 +243,12 @@ void taffich() { } charani(filename, lgt, handle); } - show_mouse(); + showMouse(); if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) { - if ((a == 13) || (a == 14)) person(); - else if (! blo) t11(s.mlieu, cx); + if ((a == 13) || (a == 14)) + person(); + else if (! blo) + t11(s.mlieu, cx); mpers = 0; } } -- cgit v1.2.3 From b5cbc1b8a56fa6841680d34e4a439eae7af0e3e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 19 Feb 2012 21:56:29 +0100 Subject: MORTEVIELLE: Some more code formatting in mouse --- engines/mortevielle/mouse.cpp | 92 ++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 49 deletions(-) diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d99163cc6f..d724fe652b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -36,8 +36,7 @@ namespace Mortevielle { const int m_arrow = 0; const int m_point_hand = 1; -bool int_m, - clic; +bool int_m, clic; int m_show, x_s, @@ -91,7 +90,7 @@ void hideMouse() { imp = odd(y_s); j = p_o_s; switch (gd) { - case cga: { + case cga: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -102,9 +101,8 @@ void hideMouse() { j += 80; k = succ(int, k); } while (!(k >= 5)); - } - break; - case ams: { + break; + case ams: for (i = 0; i <= 3; i ++) { port[0x3dd] = 1 << i; k = 0; @@ -117,13 +115,12 @@ void hideMouse() { WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); j += 0x2000; } - imp = ! imp; + imp = !imp; k = succ(int, k); } while (!(k >= 8)); } - } - break; - case ega: { + break; + case ega: port[0x3c4] = 2; port[0x3ce] = 8; port[0x3cf] = 255; @@ -142,18 +139,16 @@ void hideMouse() { } while (!(k >= 8)); ++i; } while (!(i == 4)); - } - break; - case her: { + break; + case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } - } - break; - case tan: { + break; + case tan: j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { @@ -164,10 +159,10 @@ void hideMouse() { j += 160; k = succ(int, k); } while (!(k == 3)); - } - break; - - } /* case Gd */ + break; + default: + break; + } // case Gd } } @@ -180,12 +175,13 @@ void showMouse() { bool imp; mouse_shwn = mouse_shwn + 1; - if (mouse_shwn != 1) return; + if (mouse_shwn != 1) + return; j = p_o_s; imp = odd(y_s); i = x_s & 7; switch (gd) { - case cga: { + case cga: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -196,9 +192,8 @@ void showMouse() { j += 80; k = succ(int, k); } while (!(k >= 5)); - } - break; - case ams: { + break; + case ams: for (i = 0; i <= 3; i ++) { j = p_o_s; imp = odd(y_s); @@ -212,13 +207,12 @@ void showMouse() { s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); j += 0x2000; } - imp = ! imp; + imp = !imp; k = succ(int, k); } while (!(k >= 8)); } - } - break; - case ega: { + break; + case ega: port[0x3ce] = 4; l = 0; do { @@ -232,18 +226,16 @@ void showMouse() { } while (!(k >= 8)); ++l; } while (!(l == 4)); - } - break; - case her: { + break; + case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; i ++) { for (k = 0; k <= 3; k ++) s_s[i][k] = READ_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j]); - j = j + 80; + j += 80; } - } - break; - case tan: { + break; + case tan: j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { @@ -254,9 +246,10 @@ void showMouse() { j += 160; k = succ(int, k); } while (!(k == 3)); - } - break; - } /* case Gd */ + break; + default: + break; + } // case Gd } /** @@ -370,26 +363,26 @@ void moveMouse(bool &funct, char &key) { cy = succ(int, cy); break; case 'M': - cx = cx + 2; + cx += 2; break; case 'H': cy = pred(int, cy); break; case 'G': - cx = cx - 1; - cy = cy - 1; + --cx; + --cy; break; case 'I': - cx = cx + 1; - cy = cy - 1; + ++cx; + --cy; break; case 'O': - cx = cx - 1; - cy = cy + 1; + --cx; + ++cy; break; case 'Q': - cx = cx + 1; - cy = cy + 1; + ++cx; + ++cy; break; default: break; @@ -422,7 +415,7 @@ void moveMouse(bool &funct, char &key) { cy = 8; break; case '\23': - sonoff = ! sonoff; + sonoff = !sonoff; return; break; case '\26': @@ -446,6 +439,7 @@ void moveMouse(bool &funct, char &key) { default: break; } + setMousePos(cx, cy); p_key = keypressed(); } -- cgit v1.2.3 From 6150e9583853b333dfa362c4eb24c3848f20580d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 19 Feb 2012 23:17:22 +0100 Subject: MORTEVIELLE: Apply coding conventions to actions.cpp --- engines/mortevielle/actions.cpp | 822 +++++++++++++++++++++++++--------------- 1 file changed, 515 insertions(+), 307 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index fe9d3a4dda..5aa91f80df 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -56,69 +56,106 @@ void taller() { if (!syn) ecr3(g_vm->getString(S_GO_TO)); tfleche(); - if (iesc) okdes = false; - if ((anyone) || (iesc)) return; + if (iesc) + okdes = false; + if ((anyone) || (iesc)) + return; tcoord(1); - if (num == 0) return; + 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(); + } 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; + ++cx; } while (!(g_vm->_menu._depl[cx] == msg[4])); if (s.mlieu == 19) { - if (cx == 1) t1deva(); - if (cx == 2) t1neig(); + if (cx == 1) + t1deva(); + if (cx == 2) + t1neig(); goto L2; } if (s.mlieu == 23) { - if (cx == 1) t1deau(); - if (cx == 2) t1derr(); + if (cx == 1) + t1deau(); + if (cx == 2) + t1derr(); goto L2; } - if ((s.mlieu == 11) && (cx == 1)) cx = 6; + if ((s.mlieu == 11) && (cx == 1)) + cx = 6; if (s.mlieu == 12) { - if (cx == 2) cx = 6; - if (cx == 5) cx = 16; + 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 == 14) && (cx == 3)) + cx = 6; + if (((s.mlieu == 15) || (s.mlieu == 26)) && (cx == 4)) + cx = 6; + if ((s.mlieu > 19) && (s.mlieu != 26)) + 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 (cx == 12) + cx = 16; + else if (cx > 13) + cx = 15; } - if ((s.mlieu == 22) && (cx > 14)) 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(); + 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; + if ((s.ipuit != 120) && (s.ipuit != 140)) + crep = 997; + else if (s.ipuit == 120) + crep = 181; else if (s.conf > 80) { crep = 1505; tperd(); @@ -127,7 +164,8 @@ void taller() { affrep(); } } - if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); + if ((cx < 5) || (cx == 13) || (cx == 14)) + affrep(); debloc(s.mlieu); L2: tmlieu(s.mlieu); @@ -141,26 +179,34 @@ void tprendre() { cx = caff; avpoing(cx); if (crep != 139) { - if (ipers > 0) s.conf = s.conf + 3; + if (ipers > 0) + s.conf += 3; if (obpart) { - if (s.mlieu == 2) s.iloic = 0; + 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.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; + 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(int, mchai) * 10) + pred(int, cs)] = 0; tsuiv(); - dobj = dobj + 1; + ++dobj; if (dobj > 6) { - s.conf = s.conf + 2; + s.conf += 2; dobj = 0; } } @@ -170,7 +216,8 @@ void tprendre() { if (!syn) ecr3(g_vm->getString(S_TAKE)); tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; if (caff == 3) { tcoord(2); if (num == 1) { @@ -182,22 +229,28 @@ void tprendre() { if ((num == 0) || ((num == 1) && (s.mlieu == 16))) { tcoord(8); if (num != 0) { - if (ipers > 0) s.conf = s.conf + 3; + if (ipers > 0) + s.conf += 3; crep = 997; - if ((s.mlieu == 2) && (s.iloic != 0)) avpoing(s.iloic); + 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 ((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 ((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 ((crep != 997) && (crep != 139)) + aniof(2, 2); } - if ((s.mlieu == 16) && (s.icryp != 0)) avpoing(s.icryp); + 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)) { @@ -207,25 +260,26 @@ void tprendre() { } if ((s.mlieu == 24) && (s.ipuit != 0)) { avpoing(s.ipuit); - if ((crep != 997) && (crep != 139)) aniof(2, 1); + if ((crep != 997) && (crep != 139)) + aniof(2, 1); } - if ((crep != 997) && (crep != 182) && (crep != 139)) crep = 999; + 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; - } + 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; } } @@ -234,13 +288,14 @@ void tsprendre() { cx = 0; do { - cx = cx + 1; + ++cx; } while (!(g_vm->_menu._invt[cx] == msg[4])); cz = 0; cy = 0; do { - cy = cy + 1; - if (ord(s.sjer[cy]) != 0) cz = cz + 1; + ++cy; + if (ord(s.sjer[cy]) != 0) + ++cz; } while (!(cz == cx)); cz = ord(s.sjer[cy]); s.sjer[cy] = chr(0); @@ -250,37 +305,43 @@ void tsprendre() { clsf2(); } -void tsoulever() - -{ +void tsoulever() { int cx; if (!syn) ecr3(g_vm->getString(S_LIFT)); tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; tcoord(3); if (num == 0) { tcoord(8); if (num != 0) { - if (ipers > 0) s.conf = s.conf + 1; + if (ipers > 0) + ++s.conf; crep = 997; - if ((s.mlieu == 2) && (s.iloic != 0)) treg(s.iloic); + if ((s.mlieu == 2) && (s.iloic != 0)) + treg(s.iloic); } return; } - if (ipers > 0) s.conf = s.conf + 1; + if (ipers > 0) + ++s.conf; cx = s.mlieu; - if (s.mlieu == 16) cx = 14; - if (s.mlieu == 19) cx = 15; + if (s.mlieu == 16) + cx = 14; + else if (s.mlieu == 19) + cx = 15; crep = tabdon[asoul + (cx << 3) + pred(int, num)]; - if (crep == 255) crep = 997; + if (crep == 255) + crep = 997; } void tlire() { // int iaff; - if (caff > 99) st4(caff); + if (caff > 99) + st4(caff); else { if (!syn) ecr3(g_vm->getString(S_READ)); @@ -294,8 +355,10 @@ void tlire() { } void tslire() { - if (s.derobj == 0) crep = 186; - else st4(s.derobj); + if (s.derobj == 0) + crep = 186; + else + st4(s.derobj); } void tregarder() { @@ -308,7 +371,8 @@ void tregarder() { if (!syn) ecr3(g_vm->getString(S_LOOK)); tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; tcoord(5); if (num == 0) { tcoord(8); @@ -317,46 +381,65 @@ void tregarder() { if (s.mlieu == 13) { if (num == 1) { crep = 164; - if (s.ibag != 0) treg(s.ibag); - else if (s.iboul != 0) treg(s.iboul); + 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.ibag != 0) + treg(s.ibag); } } if (s.mlieu == 14) { crep = 164; - if (s.icave != 0) treg(s.icave); + if (s.icave != 0) + treg(s.icave); } if (s.mlieu == 17) { crep = 174; - if (s.ivier != 0) treg(s.ivier); + if (s.ivier != 0) + treg(s.ivier); } if (s.mlieu == 24) { crep = 131; - if (s.ipuit != 0) treg(s.ipuit); + 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; + if (s.mlieu == 20) + cx = 17; + if ((s.mlieu > 21) && (s.mlieu < 25)) + cx -= 4; + if (s.mlieu == 26) + cx = 21; crep = tabdon[arega + (cx * 7) + pred(int, 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); + 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); } void tsregarder() { - if (s.derobj != 0) treg(s.derobj); - else crep = 186; + if (s.derobj != 0) + treg(s.derobj); + else + crep = 186; } void tfouiller() { @@ -370,7 +453,8 @@ void tfouiller() { if (!syn) ecr3(g_vm->getString(S_SEARCH)); tfleche(); - if (anyone || iesc) return; + if (anyone || iesc) + return; if (s.mlieu == 23) { crep = 1504; tperd(); @@ -382,11 +466,13 @@ void tfouiller() { if (num != 0) { cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 6) || (num == ord(touv[cx])))); - if (num != ord(touv[cx])) crep = 187; + if (num != ord(touv[cx])) + crep = 187; else { - if (ipers > 0) s.conf = s.conf + 3; + if (ipers > 0) + s.conf += 3; rechai(mchai); if (mchai != 0) { cs = 0; @@ -394,42 +480,55 @@ void tfouiller() { fouil = true; mfoudi(); tsuiv(); - } else crep = 997; + } else + crep = 997; } } else { tcoord(8); crep = 997; if (num != 0) { - if (ipers > 0) s.conf = s.conf + 3; + if (ipers > 0) + 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.iloic != 0) + treg(s.iloic); } if (s.mlieu == 16) { crep = 123; - if (s.icryp != 0) treg(s.icryp); + if (s.icryp != 0) + treg(s.icryp); } } } } } else { - if (ipers > 0) s.conf = s.conf + 3; + if (ipers > 0) + s.conf += 3; crep = 997; - if (s.mlieu < 14) crep = r[s.mlieu]; - if ((s.mlieu == 3) && (num == 2)) crep = 162; + 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 ((num == 3) || (num == 4)) + crep = 162; + else if (num == 5) + crep = 159; } - if (s.mlieu == 19) crep = 104; - if (s.mlieu == 16) crep = 155; + if (s.mlieu == 19) + crep = 104; + else if (s.mlieu == 16) + crep = 155; } } void tsfouiller() { - if (s.derobj != 0) st7(s.derobj); - else crep = 186; + if (s.derobj != 0) + st7(s.derobj); + else + crep = 186; } void touvrir() { @@ -441,7 +540,8 @@ void touvrir() { if (ment != 0) { msg[4] = entrer; syn = true; - } else crep = 997; + } else + crep = 997; return; } if (caff == 15) { @@ -449,40 +549,42 @@ void touvrir() { return; } tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; tcoord(7); if (num != 0) { - if (ipers > 0) s.conf = s.conf + 2; - iouv = iouv + 1; + if (ipers > 0) + s.conf += 2; + ++iouv; cx = 0; do { - cx = cx + 1; + ++cx; } 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)) { + 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); + if (haz == 3) + parole(7, 9, 1); } touv[cx] = chr(num); aniof(1, num); } cx = s.mlieu; - if (s.mlieu == 16) cx = 14; + if (s.mlieu == 16) + cx = 14; crep = tabdon[aouvr + (cx * 7) + pred(int, num)]; - if (crep == 254) crep = 999; - } else crep = 18; + if (crep == 254) + crep = 999; + } else + crep = 18; } } @@ -500,26 +602,33 @@ void tmettre() { if (!syn) ecr3(g_vm->getString(S_PUT)); tfleche(); - if (iesc) crep = 998; - if ((anyone) || (iesc)) return; + 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; + if (s.iboul != 0) + crep = 188; else { s.iboul = s.derobj; - if (s.derobj == 141) aniof(1, 7); + if (s.derobj == 141) + aniof(1, 7); } - } else if (s.ibag != 0) crep = 188; + } else if (s.ibag != 0) + crep = 188; else { s.ibag = s.derobj; - if (s.derobj == 159) aniof(1, 6); + if (s.derobj == 159) + aniof(1, 6); } } if (caff == 14) - if (s.icave != 0) crep = 188; + if (s.icave != 0) + crep = 188; else { s.icave = s.derobj; if (s.derobj == 151) { @@ -572,10 +681,13 @@ void tmettre() { } } if (caff == 16) - if (s.icryp == 0) s.icryp = s.derobj; - else crep = 188; + if (s.icryp == 0) + s.icryp = s.derobj; + else + crep = 188; if (caff == 17) - if (s.ivier != 0) crep = 188; + if (s.ivier != 0) + crep = 188; else if (s.derobj == 143) { s.ivier = 143; aniof(1, 1); @@ -584,12 +696,15 @@ void tmettre() { tperd(); } if (caff == 24) - if (s.ipuit != 0) crep = 188; + 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(); + } else + crep = 185; + if (crep != 188) + maivid(); } } @@ -603,7 +718,8 @@ void ttourner() { if (!syn) ecr3(g_vm->getString(S_TURN)); tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; tcoord(9); if (num != 0) { crep = 997; @@ -613,7 +729,8 @@ void ttourner() { quel = Alert::show(g_vm->getString(S_YES_NO), 1); if (quel == 1) g_vm->_endGame = true; - else crep = 168; + else + crep = 168; } if ((s.mlieu == 17) && (s.ivier == 143)) { repon(2, 175); @@ -623,7 +740,8 @@ void ttourner() { if (quel == 1) { s.mlieu = 16; affrep(); - } else crep = 176; + } else + crep = 176; } } } @@ -634,7 +752,8 @@ void tcacher() { tfleche(); if (!(anyone) && !(iesc)) { tcoord(10); - if (num == 0) cache = false; + if (num == 0) + cache = false; else { cache = true; crep = 999; @@ -643,7 +762,8 @@ void tcacher() { } void tattacher() { - if (s.derobj == 0) crep = 186; + if (s.derobj == 0) + crep = 186; else { if (!syn) ecr3(g_vm->getString(S_TIE)); @@ -656,7 +776,8 @@ void tattacher() { if ((s.derobj == 120) || (s.derobj == 140)) { s.ipuit = s.derobj; aniof(1, 1); - } else crep = 185; + } else + crep = 185; maivid(); } } @@ -670,27 +791,32 @@ void tfermer() { ecr3(g_vm->getString(S_CLOSE)); if (caff < 26) { tfleche(); - if (iesc) crep = 998; - if ((anyone) || (iesc)) return; + if (iesc) + crep = 998; + if ((anyone) || (iesc)) + return; tcoord(7); if (num != 0) { cx = 0; do { - cx = cx + 1; + ++cx; } 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; + if (iouv < 0) + iouv = 0; chai = 9999; rechai(chai); - if (mchai == chai) mchai = 0; + if (mchai == chai) + mchai = 0; } else crep = 187; } } - if (caff == 26) crep = 999; + if (caff == 26) + crep = 999; } void tfrapper() { @@ -705,8 +831,10 @@ void tfrapper() { if (s.mlieu < 25) { tfleche(); if (!(anyone) && !(iesc)) - if ((s.mlieu < 19) && (s.mlieu != 15)) crep = 133; - else crep = 997; + if ((s.mlieu < 19) && (s.mlieu != 15)) + crep = 133; + else + crep = 997; return; } if (s.mlieu == 26) { @@ -716,13 +844,16 @@ void tfrapper() { l = ment; if (l != 0) if (p != -500) { - if (haz > p) crep = 190; + if (haz > p) + crep = 190; else { becfren(l); frap(); } - } else frap(); - if (ment == 8) crep = 190; + } else + frap(); + if (ment == 8) + crep = 190; } } @@ -731,27 +862,32 @@ void tposer() { if (!syn) ecr3(g_vm->getString(S_POSE)); - if (s.derobj == 0) crep = 186; + if (s.derobj == 0) + crep = 186; else { if (caff > 99) { crep = 999; ajchai(); - if (crep != 192) maivid(); + if (crep != 192) + maivid(); return; } tfleche(); - if ((anyone) || (iesc)) return; + if ((anyone) || (iesc)) + return; tcoord(7); crep = 124; if (num != 0) { rechai(chai); - if (chai == 0) crep = 997; + if (chai == 0) + crep = 997; else { cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 6) || (num == ord(touv[cx])))); - if (num != ord(touv[cx])) crep = 187; + if (num != ord(touv[cx])) + crep = 187; else { mchai = chai; crep = 999; @@ -762,32 +898,46 @@ void tposer() { if (num != 0) { crep = 998; if (caff == 2) - if (s.iloic != 0) crep = 188; - else s.iloic = s.derobj; + 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 (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; + 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 (num != 0) + crep = 185; } } } - if (caff == 23) crep = 185; + if (caff == 23) + crep = 185; if ((crep == 999) || (crep == 185) || (crep == 998)) { - if (crep == 999) ajchai(); - if (crep != 192) maivid(); + if (crep == 999) + ajchai(); + if (crep != 192) + maivid(); } } } @@ -795,25 +945,34 @@ void tposer() { void tecouter() { int l, p, haz, j, h, m; - if (s.mlieu != 26) crep = 101; + if (s.mlieu != 26) + crep = 101; else { - if (ipers != 0) s.conf = s.conf + 1; + if (ipers != 0) + ++s.conf; ecfren(p, haz, s.conf, ment); l = ment; - if (l != 0) + if (l != 0) { if (p != -500) { - if (haz > p) crep = 101; + 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; + if (haz > 30) + crep = 101; + else + crep = 178; + } else if (haz > 70) + crep = 101; + else + crep = 178; } - } else crep = 178; + } else + crep = 178; + } } } @@ -832,15 +991,20 @@ void tmanger() { 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 (m == 0) + h = 4; + else + h = 3; if ((h == 13) || (h == 19)) - if (m == 0) h = 2; - else h = 1; - jh = jh + h; + if (m == 0) + h = 2; + else + h = 1; + jh += h; crep = 135; tinke(); - } else crep = 134; + } else + crep = 134; } } @@ -850,49 +1014,52 @@ void tentrer() { 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)) { + } 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); - - tip(z, x); - s.conf = s.conf + 1; - s.mlieu = 15; - msg[3] = discut; - msg[4] = g_vm->_menu._disc[x]; - syn = true; - if (ment == 9) { - col = true; - caff = 70; - afdes(0); - repon(2, caff); - } else col = false; - debloc(ment); - ment = 0; - } - } else { + } 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); - s.mlieu = ment; - affrep(); - debloc(s.mlieu); - tmlieu(s.mlieu); + tip(z, x); + ++s.conf; + s.mlieu = 15; + msg[3] = discut; + msg[4] = g_vm->_menu._disc[x]; + syn = true; + if (ment == 9) { + col = true; + caff = 70; + afdes(0); + repon(2, caff); + } else + col = false; + debloc(ment); ment = 0; - mpers = 0; - ipers = 0; } + } else { + x = (hazard(0, 10)) - 5; + parole(7, x, 1); + aniof(1, 1); + + s.mlieu = ment; + affrep(); + debloc(s.mlieu); + tmlieu(s.mlieu); + ment = 0; + mpers = 0; + ipers = 0; } } } @@ -921,13 +1088,15 @@ void tdormir() { if (h < 8) { s.conf = s.conf - (s.conf / 20); z = (7 - h) * 2; - if (m == 30) z = z - 1; - jh = jh + z; + if (m == 30) + --z; + jh += z; h = 7; } - jh = jh + 2; - h = h + 1; - if (h > 23) h = 0; + jh += 2; + ++h; + if (h > 23) + h = 0; tinke(); quel = Alert::show(g_vm->getString(S_YES_NO), 1); anyone = false; @@ -939,12 +1108,14 @@ void tdormir() { void tdefoncer() { if (!syn) ecr3(g_vm->getString(S_SMASH)); - if (caff < 25) tfleche(); + if (caff < 25) + tfleche(); if ((! anyone) && (! iesc)) - if (s.mlieu != 26) crep = 997; + if (s.mlieu != 26) + crep = 997; else { crep = 143; - s.conf = s.conf + 2; + s.conf += 2; } } @@ -953,21 +1124,28 @@ void tsortir() { tsort(); crep = 0; - if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22) - || (s.mlieu == 24)) crep = 997; + 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) || (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; + 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; + if (crep == 0) + crep = lx; debloc(lx); tmlieu(lx); } @@ -979,22 +1157,27 @@ void tattendre() { mpers = 0; clsf3(); do { - jh = jh + 1; + ++jh; tinke(); - if (! blo) t11(s.mlieu, quel); + 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; + if ((s.mlieu == 13) || (s.mlieu == 14)) + cavegre(); + if ((s.mlieu > 0) && (s.mlieu < 10)) + anyone = true; mpers = ipers; - if (! anyone) tinke(); + if (!anyone) + tinke(); return; } repon(2, 102); quel = Alert::show(g_vm->getString(S_YES_NO), 1); } while (!(quel == 2)); crep = 998; - if (! anyone) tinke(); + if (!anyone) + tinke(); } void tsonder() { @@ -1002,14 +1185,13 @@ void tsonder() { ecr3(g_vm->getString(S_PROBE2)); if (caff < 27) { tfleche(); - if (!(anyone) && (! iesc)) crep = 145; + if (!(anyone) && (!iesc)) + crep = 145; num = 0; } } -void tparler() - -{ +void tparler() { bool te[47]; int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; @@ -1018,14 +1200,13 @@ void tparler() char st[1410]; bool f; - - finfouil(); - if (col) suj = 128; + if (col) + suj = 128; else { cx = 0; do { - cx = cx + 1; + ++cx; } while (!(g_vm->_menu._disc[cx] == msg[4])); caff = 69 + cx; afdes(0); @@ -1039,11 +1220,13 @@ void tparler() premtet(); sparl(0, suj); hirs(); - for (ix = 1; ix <= 46; ix ++) te[ix] = false; - for (ix = 1; ix <= 45; ix ++) { + 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] + ' '; + for (i = tay; i <= 40; ++i) + lib[ix] = lib[ix] + ' '; } lib[46] = lib[45]; lib[45] = ' '; @@ -1057,12 +1240,15 @@ void tparler() icm = succ(int, icm); g_vm->_screenSurface.putxy(co, lig); if (s.teauto[icm] == '*') - if (te[icm]) writetp(lib[icm], 1); - else writetp(lib[icm], 0); + if (te[icm]) + writetp(lib[icm], 1); + else + writetp(lib[icm], 0); if (icm == 23) { lig = 0; co = 320; - } else lig = lig + 8; + } else + lig = lig + 8; } while (!(icm == 42)); g_vm->_screenSurface.putxy(320, 176); writetp(lib[46], 0); @@ -1073,43 +1259,59 @@ void tparler() getMousePos(x, y, c); x = x * (3 - res); - if (x > 319) cx = 41; - else cx = 1; + if (x > 319) + cx = 41; + else + cx = 1; cy = succ(int, ((uint)y >> 3)); /* 0-199 => 1-25 */ if ((cy > 23) || ((cx == 41) && ((cy >= 20) && (cy <= 22)))) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; - if (choi > 23) co = 320; - else co = 0; + if (choi > 23) + co = 320; + else + co = 0; g_vm->_screenSurface.putxy(co, lig); - if (te[choi]) writetp(lib[choi], 0); - else writetp(lib[choi], 1); - te[choi] = ! te[choi]; + 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 (cx == 41) + ix = ix + 23; if (ix != choi) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; - if (choi > 23) co = 320; - else co = 0; + if (choi > 23) + co = 320; + else + co = 0; g_vm->_screenSurface.putxy(co, lig); - if (te[choi]) writetp(lib[choi], 0); - else writetp(lib[choi], 1); + 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; + if (ix > 23) + co = 320; + else + co = 0; g_vm->_screenSurface.putxy(co, lig); - if (te[ix]) writetp(lib[ix], 0); - else writetp(lib[ix], 1); + if (te[ix]) + writetp(lib[ix], 0); + else + writetp(lib[ix], 1); te[ix] = ! te[ix]; choi = ix; - } else choi = 0; + } else + choi = 0; } } } while (!((tou == '\15') || (((c != 0) || g_vm->getMouseClick()) && (choi != 0)))); @@ -1119,10 +1321,13 @@ void tparler() if (col) { col = false; s.mlieu = 15; - if (iouv > 0) max = 8; - else max = 4; + if (iouv > 0) + max = 8; + else + max = 4; haz = hazard(1, max); - if (haz == 2) suj = 129; + if (haz == 2) + suj = 129; else { suj = 138; s.conf = s.conf + (3 * (s.conf / 10)); @@ -1145,7 +1350,8 @@ void tparler() s.teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { - for (ix = 29; ix <= 31; ix ++) s.teauto[ix] = '*'; + for (ix = 29; ix <= 31; ++ix) + s.teauto[ix] = '*'; s.pourc[7] = '*'; } if (suj == 70) { @@ -1188,8 +1394,10 @@ void tsentir() { ecr3(g_vm->getString(S_SMELL)); tfleche(); if (!(anyone) && !(iesc)) - if (caff == 16) crep = 153; - } else if (caff == 123) crep = 110; + if (caff == 16) + crep = 153; + } else if (caff == 123) + crep = 110; num = 0; } -- cgit v1.2.3 From d0ec6e9b32249a81606594c4d77c5baf29061550 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 20 Feb 2012 08:28:06 +0100 Subject: MORTEVIELLE: rename verbs and associated opcodes, use enum for opcodes --- engines/mortevielle/actions.cpp | 140 +++++++++++++++++++++++++++++------- engines/mortevielle/actions.h | 46 ++++++------ engines/mortevielle/menu.cpp | 38 +++++----- engines/mortevielle/menu.h | 2 +- engines/mortevielle/mor2.cpp | 18 ++--- engines/mortevielle/mortevielle.cpp | 6 +- engines/mortevielle/prog.cpp | 73 ++++++++++++------- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.h | 35 +++------ 9 files changed, 229 insertions(+), 131 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5aa91f80df..caaeb07638 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,7 +42,11 @@ namespace Mortevielle { -void taller() { +/** + * Engine function - Move + * @remarks Originally called 'taller' + */ +void fctMove() { //int mx, cx, cy; int cx; @@ -171,7 +175,11 @@ L2: tmlieu(s.mlieu); } -void tprendre() { +/** + * Engine function - Take + * @remarks Originally called 'tprendre' + */ +void fctTake() { //int cx, cy, cz; int cx; @@ -305,7 +313,11 @@ void tsprendre() { clsf2(); } -void tsoulever() { +/** + * Engine function - Lift + * @remarks Originally called 'tsoulever' + */ +void fctLift() { int cx; if (!syn) @@ -337,7 +349,11 @@ void tsoulever() { crep = 997; } -void tlire() { +/** + * Engine function - Read + * @remarks Originally called 'tlire' + */ +void fctRead() { // int iaff; if (caff > 99) @@ -361,7 +377,11 @@ void tslire() { st4(s.derobj); } -void tregarder() { +/** + * Engine function - Look + * @remarks Originally called 'tregarder' + */ +void fctLook() { int cx; if (caff > 99) { @@ -442,7 +462,11 @@ void tsregarder() { crep = 186; } -void tfouiller() { +/** + * Engine function - Search + * @remarks Originally called 'tfouiller' + */ +void fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; int cx; @@ -531,14 +555,18 @@ void tsfouiller() { crep = 186; } -void touvrir() { +/** + * Engine function - Open + * @remarks Originally called 'touvrir' + */ +void fctOpen() { int cx, haz; if (!syn) ecr3(g_vm->getString(S_OPEN)); if (caff == 26) { if (ment != 0) { - msg[4] = entrer; + msg[4] = OPCODE_ENTER; syn = true; } else crep = 997; @@ -588,7 +616,11 @@ void touvrir() { } } -void tmettre() { +/** + * Engine function - Place + * @remarks Originally called 'tmettre' + */ +void fctPlace() { int quel; bool entre; char st[1410]; @@ -708,7 +740,11 @@ void tmettre() { } } -void ttourner() { +/** + * Engine function - Turn + * @remarks Originally called 'ttourner' + */ +void fctTurn() { int quel; if (caff > 99) { @@ -746,7 +782,11 @@ void ttourner() { } } -void tcacher() { +/** + * Engine function - Hide Self + * @remarks Originally called 'tcacher' + */ +void fctHideSelf() { if (!syn) ecr3(g_vm->getString(S_HIDE_SELF)); tfleche(); @@ -761,7 +801,11 @@ void tcacher() { } } -void tattacher() { +/** + * Engine function - Attach + * @remarks Originally called 'tattacher' + */ +void fctAttach() { if (s.derobj == 0) crep = 186; else { @@ -784,7 +828,11 @@ void tattacher() { } } -void tfermer() { +/** + * Engine function - Close + * @remarks Originally called 'tfermer' + */ +void fctClose() { int cx, chai; if (!syn) @@ -819,7 +867,11 @@ void tfermer() { crep = 999; } -void tfrapper() { +/** + * Engine function - Knock + * @remarks Originally called 'tfrapper' + */ +void fctKnock() { int l, p, haz; if (!syn) @@ -942,7 +994,11 @@ void tposer() { } } -void tecouter() { +/** + * Engine function - Listen + * @remarks Originally called 'tecouter' + */ +void fctListen() { int l, p, haz, j, h, m; if (s.mlieu != 26) @@ -976,7 +1032,11 @@ void tecouter() { } } -void tmanger() { +/** + * Engine function - Eat + * @remarks Originally called 'tmanger' + */ +void fctEat() { int j, h, m; if ((s.mlieu > 15) && (s.mlieu < 26)) @@ -1008,7 +1068,11 @@ void tmanger() { } } -void tentrer() { +/** + * Engine function - Enter + * @remarks Originally called 'tentrer' + */ +void fctEnter() { int x, z = 0; if ((s.mlieu == 21) || (s.mlieu == 22)) { @@ -1064,7 +1128,11 @@ void tentrer() { } } -void tdormir() { +/** + * Engine function - Sleep + * @remarks Originally called 'tdormir' + */ +void fctSleep() { int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { @@ -1105,7 +1173,11 @@ void tdormir() { num = 0; } -void tdefoncer() { +/** + * Engine function - Force + * @remarks Originally called 'tdefoncer' + */ +void fctForce() { if (!syn) ecr3(g_vm->getString(S_SMASH)); if (caff < 25) @@ -1119,7 +1191,11 @@ void tdefoncer() { } } -void tsortir() { +/** + * Engine function - Leave + * @remarks Originally called 'tsortir' + */ +void fctLeave() { int lx = 0; tsort(); @@ -1151,7 +1227,11 @@ void tsortir() { } } -void tattendre() { +/** + * Engine function - Wait + * @remarks Originally called 'tattendre' + */ +void fctWait() { int quel; mpers = 0; @@ -1180,7 +1260,11 @@ void tattendre() { tinke(); } -void tsonder() { +/** + * Engine function - Sound + * @remarks Originally called 'tsonder' + */ +void fctSound() { if (!syn) ecr3(g_vm->getString(S_PROBE2)); if (caff < 27) { @@ -1387,7 +1471,11 @@ void tparler() { clsf3(); } -void tsentir() { +/** + * Engine function - Smell + * @remarks Originally called 'tsentir' + */ +void fctSmell() { crep = 119; if (caff < 26) { if (!syn) @@ -1401,7 +1489,11 @@ void tsentir() { num = 0; } -void tgratter() { +/** + * Engine function - Scratch + * @remarks Originally called 'tgratter' + */ +void fctScratch() { crep = 155; if (caff < 27) { if (!syn) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index 196e5a5de6..d96b712835 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -31,35 +31,35 @@ namespace Mortevielle { /* NIVEAU 4 */ -extern void taller(); -extern void tprendre(); +extern void fctMove(); +extern void fctTake(); extern void tsprendre(); -extern void tsoulever(); -extern void tlire(); +extern void fctLift(); +extern void fctRead(); extern void tslire(); -extern void tregarder(); +extern void fctLook(); extern void tsregarder(); -extern void tfouiller(); +extern void fctSearch(); extern void tsfouiller(); -extern void touvrir(); -extern void tmettre(); -extern void ttourner(); -extern void tcacher(); -extern void tattacher(); -extern void tfermer(); -extern void tfrapper(); +extern void fctOpen(); +extern void fctPlace(); +extern void fctTurn(); +extern void fctHideSelf(); +extern void fctAttach(); +extern void fctClose(); +extern void fctKnock(); extern void tposer(); -extern void tecouter(); -extern void tmanger(); -extern void tentrer(); -extern void tdormir(); -extern void tdefoncer(); -extern void tsortir(); -extern void tattendre(); -extern void tsonder(); +extern void fctListen(); +extern void fctEat(); +extern void fctEnter(); +extern void fctSleep(); +extern void fctForce(); +extern void fctLeave(); +extern void fctWait(); +extern void fctSound(); extern void tparler(); -extern void tsentir(); -extern void tgratter(); +extern void fctSmell(); +extern void fctScratch(); /* NIVEAU 2 */ extern void endGame(); extern void loseGame(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 7da2eefb0f..51fad3f651 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -63,7 +63,7 @@ void Menu::menut(int no, Common::String nom) { _inv[l].insertChar(' ', 0); } break; - case depla: + case MENU_MOVE: _dep[l] = s; break; case action: @@ -96,7 +96,7 @@ void Menu::disableMenuItem(int no) { _inv[l].setChar('*', 0); } break; - case depla: + case MENU_MOVE: _dep[l].setChar('*', 0); break; case action: @@ -126,7 +126,7 @@ void Menu::enableMenuItem(int no) { _inv[l].setChar(' ', 21); } break; - case depla: + case MENU_MOVE: _dep[l].setChar(' ', 0); break; case action: @@ -189,8 +189,8 @@ void Menu::menu_aff() { void Menu::drawMenu() { menu_aff(); _menuActive = true; - msg4 = no_choice; - msg3 = no_choice; + msg4 = OPCODE_NONE; + msg3 = OPCODE_NONE; choisi = false; g_vm->setMouseClick(false); test0 = false; @@ -199,7 +199,7 @@ void Menu::drawMenu() { void Menu::invers(int ix) { Common::String s; - if (msg4 == no_choice) return; + if (msg4 == OPCODE_NONE) return; g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : @@ -238,7 +238,7 @@ void Menu::invers(int ix) { if ((s[0] != '*') && (s[0] != '<')) g_vm->_screenSurface.writeg(s, ix); else - msg4 = no_choice; + msg4 = OPCODE_NONE; } void Menu::util(int x, int y) { @@ -258,9 +258,9 @@ void Menu::util(int x, int y) { msg4 = ix; invers(0); } - } else if (msg4 != no_choice) { + } else if (msg4 != OPCODE_NONE) { invers(1); - msg4 = no_choice; + msg4 = OPCODE_NONE; } } @@ -401,7 +401,7 @@ void Menu::mdn() { || ((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 < 124 * res) ix = MENU_MOVE; else if (x < 172 * res) ix = action; else if (x < 220 * res) ix = saction; else if (x < 268 * res) ix = discut; @@ -411,13 +411,13 @@ void Menu::mdn() { menuUp(msg3); menuDown(ix); msg3 = ix; - msg4 = no_choice; + msg4 = OPCODE_NONE; } } else { /* Not in the MenuTitle line */ if ((y > 11) && (test0)) util(x, y); } } else { /* There was a click */ - if ((msg3 == fichier) && (msg4 != no_choice)) { + if ((msg3 == fichier) && (msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); @@ -428,12 +428,12 @@ void Menu::mdn() { g_vm->setMouseClick(false); } else { // A menu was clicked on - choisi = (test0) && (msg4 != no_choice); + choisi = (test0) && (msg4 != OPCODE_NONE); menuUp(msg3); msg[4] = msg4; msg[3] = msg3; - msg3 = no_choice; - msg4 = no_choice; + msg3 = OPCODE_NONE; + msg4 = OPCODE_NONE; g_vm->setMouseClick(false); } @@ -486,10 +486,10 @@ void Menu::initMenu() { if (i > 6) g_vm->_menu.disableMenuItem(_invt[i]); } - msg3 = no_choice; - msg4 = no_choice; - msg[3] = no_choice; - msg[4] = no_choice; + msg3 = OPCODE_NONE; + msg4 = OPCODE_NONE; + msg[3] = OPCODE_NONE; + msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 8779d51298..d4aecbcbd9 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,7 +60,7 @@ public: }; enum { - invent = 1, depla = 2, action = 3, saction = 4, + invent = 1, MENU_MOVE = 2, action = 3, saction = 4, discut = 5, fichier = 6, sauve = 7, charge = 8 }; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 7a49456197..15d413d119 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -39,10 +39,10 @@ namespace Mortevielle { -const int men[12] = { 0, - scacher, attacher, defoncer, dormir, - entrer, fermer, frapper, manger, - mettre, ouvrir, sortir +const int men[12] = { OPCODE_NONE, + OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; void tinke() { @@ -251,7 +251,7 @@ void tlu(int af, int ob) { repon(2, 999); tkey1(true); caff = af; - msg[3] = no_choice; + msg[3] = OPCODE_NONE; crep = 998; } @@ -276,8 +276,8 @@ void mfouen() for (cx = 1; cx <= 11; cx ++) g_vm->_menu.enableMenuItem(men[cx]); - g_vm->_menu.menut(sonder, g_vm->getString(S_PROBE)); - g_vm->_menu.menut(soulever, g_vm->getString(S_RAISE)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_PROBE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_RAISE)); } /* NIVEAU 6 */ @@ -415,8 +415,8 @@ void mfoudi() { for (cx = 1; cx <= 11; cx ++) g_vm->_menu.disableMenuItem(men[cx]); - g_vm->_menu.menut(sonder, g_vm->getString(S_SUITE)); - g_vm->_menu.menut(soulever, g_vm->getString(S_STOP)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_STOP)); } void mennor() { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 256b8551ed..82eb1179f1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -571,7 +571,7 @@ void MortevielleEngine::handleAction() { temps = Alert::show(stpou, 1); return; } else if (inkey == '\77') { - if ((mnumo != no_choice) && ((msg[3] == action) || (msg[3] == saction))) { + if ((mnumo != OPCODE_NONE) && ((msg[3] == action) || (msg[3] == saction))) { msg[4] = mnumo; ecr3(g_vm->getString(S_IDEM)); } else return; @@ -594,9 +594,9 @@ void MortevielleEngine::handleAction() { if (! anyone) { if ((fouil) || (obpart)) { if (y_s < 12) return; - if ((msg[4] == sonder) || (msg[4] == soulever)) { + if ((msg[4] == OPCODE_SOUND) || (msg[4] == OPCODE_LIFT)) { oo = true; - if ((msg[4] == soulever) || (obpart)) { + if ((msg[4] == OPCODE_LIFT) || (obpart)) { finfouil(); caff = s.mlieu; crep = 998; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 737ec6602e..2ee26a9392 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -157,37 +157,58 @@ void tsitu() iesc = false; if (anyone) goto L1; if (brt) - if ((msg[3] == depla) || (msg[4] == sortir) || (msg[4] == dormir) || - (msg[4] == manger)) { + if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { ctrm = 4; goto L2; } - if (msg[3] == depla) taller(); //Translation: go to + if (msg[3] == MENU_MOVE) + fctMove(); if (msg[3] == discut) tparler(); //Translation: talk if (msg[3] == invent) tsprendre(); //Translation: inventory/take - if (msg[4] == attacher) tattacher(); //Translation: tie - if (msg[4] == attendre) tattendre(); //Translation: wait - if (msg[4] == defoncer) tdefoncer(); //Translation: smash - if (msg[4] == dormir) tdormir(); //Translation: sleep - if (msg[4] == ecouter) tecouter(); //Translation: listen - if (msg[4] == entrer) tentrer(); //Translation: enter - if (msg[4] == fermer) tfermer(); //Translation: close - if (msg[4] == fouiller) tfouiller(); //Translation: search - if (msg[4] == frapper) tfrapper(); //Translation: hit - if (msg[4] == gratter) tgratter(); //Translation: scratch - if (msg[4] == lire) tlire(); //Translation: read - if (msg[4] == manger) tmanger(); //Translation: eat - if (msg[4] == mettre) tmettre(); //Translation: put - if (msg[4] == ouvrir) touvrir(); //Translation: open - if (msg[4] == prendre) tprendre(); //Translation: take - if (msg[4] == regarder) tregarder(); //Translation: look - if (msg[4] == sentir) tsentir(); //Translation: smell - if (msg[4] == sonder) tsonder(); //Translation: probe - if (msg[4] == sortir) tsortir(); //Translation: exit - if (msg[4] == soulever) tsoulever(); //Translation: lift - if (msg[4] == tourner) ttourner(); //Translation: turn - if (msg[4] == scacher) { //Translation: hide - tcacher(); + if (msg[4] == OPCODE_ATTACH) + fctAttach(); + if (msg[4] == OPCODE_WAIT) + fctWait(); + if (msg[4] == OPCODE_FORCE) + fctForce(); + if (msg[4] == OPCODE_SLEEP) + fctSleep(); + if (msg[4] == OPCODE_LISTEN) + fctListen(); + if (msg[4] == OPCODE_ENTER) + fctEnter(); + if (msg[4] == OPCODE_CLOSE) + fctClose(); + if (msg[4] == OPCODE_SEARCH) + fctSearch(); + if (msg[4] == OPCODE_KNOCK) + fctKnock(); + if (msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (msg[4] == OPCODE_READ) + fctRead(); + if (msg[4] == OPCODE_EAT) + fctEat(); + if (msg[4] == OPCODE_PLACE) + fctPlace(); + if (msg[4] == OPCODE_OPEN) + fctOpen(); + if (msg[4] == OPCODE_TAKE) + fctTake(); + if (msg[4] == OPCODE_LOOK) + fctLook(); + if (msg[4] == OPCODE_SMELL) + fctSmell(); + if (msg[4] == OPCODE_SOUND) + fctSound(); + if (msg[4] == OPCODE_LEAVE) + fctLeave(); + if (msg[4] == OPCODE_LIFT) + fctLift(); + if (msg[4] == OPCODE_TURN) + fctTurn(); + if (msg[4] == OPCODE_HIDE_SELF) { //Translation: hide + fctHideSelf(); goto L1; } if (msg[4] == sfouiller) tsfouiller();//Translation: search diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 9402f3fec5..08aaa2a1f1 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -244,7 +244,7 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) { + if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (! blo) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index bfccd66e34..7a3249dee0 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -128,31 +128,16 @@ const int arep = 1314; const int amzon = 1650; const int fleche = 1758; -const int no_choice = 0; - -const int attacher = 0x301; -const int attendre = 0x302; -const int defoncer = 0x303; -const int dormir = 0x304; -const int ecouter = 0x305; -const int entrer = 0x306; -const int fermer = 0x307; -const int fouiller = 0x308; -const int frapper = 0x309; -const int gratter = 0x30a; -const int lire = 0x30b; -const int manger = 0x30c; -const int mettre = 0x30d; -const int ouvrir = 0x30e; -const int prendre = 0x30f; -const int regarder = 0x310; -const int sentir = 0x311; -const int sonder = 0x312; -const int sortir = 0x313; -const int soulever = 0x314; -const int tourner = 0x315; - -const int scacher = 0x401; +const int OPCODE_NONE = 0; + +enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, + OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, + OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, + OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, + OPCODE_TURN = 0x315}; + +enum verbs2 {OPCODE_HIDE_SELF = 0x401}; + const int sfouiller = 0x402; const int slire = 0x403; const int sposer = 0x404; -- cgit v1.2.3 From acd636dc2ca6d7828c350fe3af9af657ad890e76 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 20 Feb 2012 23:56:32 +0100 Subject: MORTEVIELLE: Some more cleanup, renaming, plus a couple of crash fixes in deline and writeg --- engines/mortevielle/actions.cpp | 14 +- engines/mortevielle/actions.h | 4 +- engines/mortevielle/dialogs.cpp | 130 +++--- engines/mortevielle/graphics.cpp | 5 +- engines/mortevielle/keyboard.cpp | 29 +- engines/mortevielle/level15.cpp | 39 +- engines/mortevielle/menu.cpp | 114 ++--- engines/mortevielle/menu.h | 2 +- engines/mortevielle/mor.cpp | 886 +++++++++++++++++++++++---------------- engines/mortevielle/mor2.cpp | 289 ++++++++----- engines/mortevielle/outtext.cpp | 5 + engines/mortevielle/prog.cpp | 6 +- engines/mortevielle/var_mor.h | 3 +- 13 files changed, 905 insertions(+), 621 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index caaeb07638..66215170ce 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -909,7 +909,11 @@ void fctKnock() { } } -void tposer() { +/** + * Engine function - Put + * @remarks Originally called 'tposer' + */ +void fctPut() { int cx, chai; if (!syn) @@ -1099,7 +1103,7 @@ void fctEnter() { tip(z, x); ++s.conf; s.mlieu = 15; - msg[3] = discut; + msg[3] = MENU_DISCUSS; msg[4] = g_vm->_menu._disc[x]; syn = true; if (ment == 9) { @@ -1275,7 +1279,11 @@ void fctSound() { } } -void tparler() { +/** + * Engine function - Discuss + * @remarks Originally called 'tparler' + */ +void fctDiscuss() { bool te[47]; int ix, cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index d96b712835..e73dc080f5 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -48,7 +48,7 @@ extern void fctHideSelf(); extern void fctAttach(); extern void fctClose(); extern void fctKnock(); -extern void tposer(); +extern void fctPut(); extern void fctListen(); extern void fctEat(); extern void fctEnter(); @@ -57,7 +57,7 @@ extern void fctForce(); extern void fctLeave(); extern void fctWait(); extern void fctSound(); -extern void tparler(); +extern void fctDiscuss(); extern void fctSmell(); extern void fctScratch(); /* NIVEAU 2 */ diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index bccbb10f56..89658452e8 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -83,19 +83,23 @@ int Alert::show(const Common::String &msg, int n) { cx = 320; st = ""; while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { - i = i + 1; + ++i; st = st + chaine[i]; - if (res == 2) cx = cx - 3; - else cx = cx - 5; + if (res == 2) + cx -= 3; + else + cx -= 5; } g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); g_vm->_screenSurface._textPos.y += 6; g_vm->_screenSurface.writeg(st, 4); - i = i + 1; + ++i; } while (!(chaine[i] == ']')); } - if (nbcase == 1) esp = nbcol - 40; - else esp = (uint)(nbcol - nbcase * 40) >> 1; + if (nbcase == 1) + esp = nbcol - 40; + else + esp = (uint)(nbcol - nbcase * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); fait_choix(cas, coldep, nbcase, &s[0], esp); limit[1][1] = ((uint)(coldep) >> 1) * res; @@ -121,11 +125,14 @@ int Alert::show(const Common::String &msg, int n) { if (test) { test1 = (cx > limit[1][1]) && (cx < limit[1][2]); test2 = test1; - if (nbcase > 1) test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); + if (nbcase > 1) + test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); if (test2) { newaff = true; - if (test1) ix = 1; - else ix = 2; + if (test1) + ix = 1; + else + ix = 2; if (ix != quoi) { hideMouse(); if (quoi != 0) { @@ -165,7 +172,7 @@ int Alert::show(const Common::String &msg, int n) { } while (!g_vm->getMouseClick()); g_vm->setMouseClick(false); hideMouse(); - if (! test3) { + if (!test3) { quoi = n; setPosition(n, coldep, esp); Common::String tmp4(" "); @@ -199,26 +206,30 @@ void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String col = 0; while (s[i] != ']') { - c = c + s[i]; + c += s[i]; if ((s[i] == '|') || (s[i + 1] == ']')) { - if (k > col) col = k; + if (k > col) + col = k; k = 0; nbl = nbl + 1; - } else if (s[i] != ' ') v = false; - i = i + 1; - k = k + 1; + } else if (s[i] != ' ') + v = false; + ++i; + ++k; } if (v) { c = ""; col = 20; } else { - c = c + ']'; - col = col + 6; + c += ']'; + col += 6; } - i = i + 1; + ++i; cs = copy(s, i, 30); - if (res == 2) col = col * 6; - else col = col * 10; + if (res == 2) + col *= 6; + else + col *= 10; } void Alert::setPosition(int ji, int coldep, int esp) { @@ -228,7 +239,8 @@ void Alert::setPosition(int ji, int coldep, int esp) { void Alert::fait_boite(int lidep, int nli, int tx) { int x, y, xx, yy; - if (tx > 640) tx = 640; + if (tx > 640) + tx = 640; x = 320 - ((uint)tx >> 1); y = pred(int, lidep) << 3; xx = x + tx; @@ -249,12 +261,13 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String for (l = 1; l <= nbcase; l ++) { str[l] = ""; do { - i = i + 1; + ++i; ch = c[i]; - str[l] = str[l] + ch; + str[l] += ch; } while (!(c[i + 1] == ']')); i = i + 2; - while (str[l].size() < 3) str[l] = str[l] + ' '; + while (str[l].size() < 3) + str[l] += ' '; g_vm->_screenSurface.putxy(x, 98); Common::String tmp(" "); @@ -262,7 +275,7 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String tmp += " "; g_vm->_screenSurface.writeg(tmp, 0); - x = x + esp + 40; + x += esp + 40; } } @@ -292,10 +305,12 @@ bool Ques::show() { hideMouse(); hirs(); showMouse(); - i = i + 1; + ++i; deline(ta[i], st, tay); - if (res == 1) y = 29; - else y = 23; + if (res == 1) + y = 29; + else + y = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); afftex(st, 20, 15, 100, 2, 0); if (i != 10) { @@ -310,29 +325,31 @@ bool Ques::show() { memk = 1; for (j = prem; j <= der; j ++) { deline(j, st, tay); - if (tay > tmax) tmax = tay; + if (tay > tmax) + tmax = tay; afftex(st, 100, y, 100, 1, 0); chaines[memk] = delig; - memk = memk + 1; - y = y + 8; + ++memk; + y += 8; } - for (j = 1; j <= succ(int, der - prem); j ++) { - { - rectangle &with = coor[j]; - - with.x1 = 45 * res; - with.x2 = (tmax * 3 + 55) * res; - with.y1 = 27 + j * 8; - with.y2 = 34 + j * 8; - with.etat = true; - } + for (j = 1; j <= succ(int, der - prem); j++) { + rectangle &with = coor[j]; + + with.x1 = 45 * res; + with.x2 = (tmax * 3 + 55) * res; + with.y1 = 27 + j * 8; + with.y2 = 34 + j * 8; + with.etat = true; + while ((int)chaines[j].size() < tmax) { - chaines[j] = chaines[j] + ' '; + chaines[j] += ' '; } } coor[j + 1].etat = false; - if (res == 1) rep = 10; - else rep = 6; + if (res == 1) + rep = 10; + else + rep = 6; g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); rep = 0; j = 0; @@ -347,29 +364,40 @@ bool Ques::show() { while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; if (coor[k].etat) { if ((memk != 0) && (memk != k)) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[memk][j]; + strncpy(st, chaines[memk].c_str(), tmax); +// st[1 + tmax] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); } if (memk != k) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[k][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[k][j]; + strncpy(st, chaines[k].c_str(), tmax); st[1 + tmax] = '$'; afftex(st, 100, 27 + k * 8, 100, 1, 1); memk = k; } } else if (memk != 0) { - for (j = 1; j <= tmax; j ++) st[j] = chaines[memk][j]; +// for (j = 1; j <= tmax; j ++) +// st[j] = chaines[memk][j]; + strncpy(st, chaines[memk].c_str(), tmax); st[1 + tmax] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); memk = 0; } } while (!((memk != 0) && g_vm->getMouseClick())); - if (memk == ok[i]) compte = compte + 1; + if (memk == ok[i]) + ++compte; else { - if (i == 5) i = i + 1; - if ((i == 7) || (i == 8)) i = 10; + if (i == 5) + ++i; + if ((i == 7) || (i == 8)) + i = 10; } - if (i == 10) q = /*testprot*/ true; + if (i == 10) + q = /*testprot*/ true; } while (!(i == 10)); ques_result = (compte == 10) && q; return ques_result; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 62f13dac5e..1c0a4fa0a3 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -484,7 +484,8 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku for (;;) { // If position is past end point, then skip this line if (((_thickness - 1) * DEFAULT_WIDTH) + pDest >= pDestEnd) { - if (--_thickness == 0) break; + if (--_thickness == 0) + break; continue; } @@ -1081,7 +1082,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { } pt.x += 1; pt.y += 1; - for (x = 1; x <= (int)l.size(); ++x) { + for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); pt.x += i; } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index a330a382d9..abf8c26346 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -32,43 +32,38 @@ namespace Mortevielle { char readkey1() { - char c; + char c = get_ch(); - char readkey1_result; - c = get_ch(); // input >> kbd >> c; - readkey1_result = c; - return readkey1_result; + return c; } int testou() { - char ch; + char ch = get_ch(); - int testou_result; - ch = get_ch(); // input >> kbd >> ch; switch (ch) { case '\23' : - sonoff = ! sonoff; + sonoff = !sonoff; break; case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); c_zzz = succ(int, c_zzz); - testou_result = 61; - return testou_result; + + return 61; } break; case '\33' : - if (keypressed()) ch = get_ch(); // input >> kbd >> ch; + if (keypressed()) + ch = get_ch(); break; } - testou_result = ord(ch); - return testou_result; + + return ord(ch); } void teskbd() { - int dum; - - if (keypressed()) dum = testou(); + if (keypressed()) + testou(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 374851f7f0..571abfa18d 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -37,9 +37,7 @@ namespace Mortevielle { /* NIVEAU 15 */ void copcha() { - int i; - - i = acha; + int i = acha; do { tabdon[i] = tabdon[i + 390]; i = succ(int, i); @@ -54,8 +52,11 @@ bool dans_rect(rectangle r) { if ((x > r.x1) && (x < r.x2) && (y > r.y1) && - (y < r.y2)) dans_rect_result = true; - else dans_rect_result = false; + (y < r.y2)) + dans_rect_result = true; + else + dans_rect_result = false; + return dans_rect_result; } @@ -63,27 +64,24 @@ void outbloc(int n, pattern p, t_nhom pal) { int i, j, ad; ad = n * 404 + 0xd700; - { - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); - ad = ad + 4; - for (i = 1; i <= p.tax; i ++) - for (j = 1; j <= p.tay; j ++) - mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; - } -} + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); + ad = ad + 4; + for (i = 1; i <= p.tax; i ++) + for (j = 1; j <= p.tay; j ++) + mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; +} void writepal(int n) { int i; t_nhom pal; - switch (gd) { case tan: case ega: case ams : - for (i = 1; i <= 16; i ++) { + for (i = 1; i <= 16; i++) { mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; } @@ -91,8 +89,10 @@ void writepal(int n) { case cga : { warning("TODO: If this code is needed, resolve the incompatible types"); // pal = palcga[n].a; - if (n < 89) palette(palcga[n].p); - for (i = 0; i <= 15; i ++) outbloc(i, tpt[pal[i].n], pal); + if (n < 89) + palette(palcga[n].p); + for (i = 0; i <= 15; i++) + outbloc(i, tpt[pal[i].n], pal); } break; } @@ -152,7 +152,8 @@ int animof(int ouf, int num) { int animof_result; nani = mem[adani * 16 + 1]; aux = num; - if (ouf != 1) aux = aux + nani; + if (ouf != 1) + aux += nani; animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); return animof_result; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 51fad3f651..97ba083d77 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -44,20 +44,19 @@ namespace Mortevielle { * Setup a menu's contents */ void Menu::menut(int no, Common::String nom) { - byte h, l; - Common::String s; + byte h = hi(no); + byte l = lo(no); + Common::String s = nom; - h = hi(no); - l = lo(no); - s = nom; if (! tesok) { g_vm->quitGame(); } + while (s.size() < 20) - s = s + ' '; + s += ' '; switch (h) { - case invent : + case invent: if (l != 7) { _inv[l] = s; _inv[l].insertChar(' ', 0); @@ -72,7 +71,7 @@ void Menu::menut(int no, Common::String nom) { case saction: _self[l] = s; break; - case discut: + case MENU_DISCUSS: _dis[l] = s; break; } @@ -83,13 +82,12 @@ void Menu::menut(int no, Common::String nom) { * @param no Hi byte represents menu number, lo byte reprsents item index */ void Menu::disableMenuItem(int no) { - byte h, l; + byte h = hi(no); + byte l = lo(no); - h = hi(no); - l = lo(no); switch (h) { case invent : { - if (l > 6) { + if (l > 6) { _inv[l].setChar('<', 0); _inv[l].setChar('>', 21); } else @@ -105,7 +103,7 @@ void Menu::disableMenuItem(int no) { case saction: _self[l].setChar('*', 0); break; - case discut: + case MENU_DISCUSS: _dis[l].setChar('*', 0); break; } @@ -116,28 +114,25 @@ void Menu::disableMenuItem(int no) { * @param no Hi byte represents menu number, lo byte reprsents item index */ void Menu::enableMenuItem(int no) { - byte h, l; + byte h = hi(no); + byte l = lo(no); - h = hi(no); - l = lo(no); switch (h) { - case invent : { + case invent : _inv[l].setChar(' ', 0); _inv[l].setChar(' ', 21); - } - break; + break; case MENU_MOVE: _dep[l].setChar(' ', 0); break; case action: _act[l].setChar(' ', 0); break; - case saction: { + case saction: _self[l].setChar(' ', 0); _self[l].setChar(' ', 0); - } - break; - case discut: + break; + case MENU_DISCUSS: _dis[l].setChar(' ', 0); break; } @@ -152,17 +147,19 @@ void Menu::menu_aff() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; - if (gd == cga) color = 1; - else color = 9; + if (gd == cga) + color = 1; + else + color = 9; num_letr = 0; - do { /* lettre par lettre */ - num_letr = num_letr + 1; + do { // One character after the other + ++num_letr; ind_tabl = 0; y = 1; - do { /* colonne par colonne */ + do { // One column after the other k = 0; x = col; - do { /* ligne par ligne */ + do { // One line after the other msk = 0x80; for (pt = 0; pt <= 7; pt ++) { if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { @@ -171,14 +168,14 @@ void Menu::menu_aff() { g_vm->_screenSurface.setPixel(Common::Point(x, y), color); } msk = (uint)msk >> 1; - x = x + 1; + ++x; } ind_tabl = succ(int, ind_tabl); k = succ(int, k); } while (!(k == 3)); - y = y + 1; + ++y; } while (!(y == 9)); - col = col + 48 * res; + col += 48 * res; } while (!(num_letr == 6)); showMouse(); } @@ -199,7 +196,9 @@ void Menu::drawMenu() { void Menu::invers(int ix) { Common::String s; - if (msg4 == OPCODE_NONE) return; + if (msg4 == OPCODE_NONE) + return; + g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : @@ -248,8 +247,10 @@ void Menu::util(int x, int y) { ymx = (don[msg3][4] << 3) + 16; dxcar = don[msg3][3]; xmn = (don[msg3][1] << 2) * res; - if (res == 1) ix = 5; - else ix = 3; + if (res == 1) + ix = 5; + else + ix = 3; xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); @@ -282,8 +283,10 @@ void Menu::menuDown(int ii) { hideMouse(); sauvecr(10, succ(byte, don[ii][2]) << 1); xco = xco << 3; - if (res == 1) cx = 10; - else cx = 6; + if (res == 1) + cx = 10; + else + cx = 6; xcc = xco + (don[ii][3] * cx) + 6; g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); @@ -384,11 +387,12 @@ void Menu::mdn() { /* debug('mdn'); */ if (!_menuActive) return; + x = x_s; y = y_s; if (!g_vm->getMouseClick()) { - if ((x == xprec) && - (y == yprec)) return; + if ((x == xprec) && (y == yprec)) + return; else { xprec = x; yprec = y; @@ -400,12 +404,19 @@ void Menu::mdn() { || ((x > 220 * res) && (x < 220 * res + 24)) || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { - if (x < 76 * res) ix = invent; - else if (x < 124 * res) ix = MENU_MOVE; - else if (x < 172 * res) ix = action; - else if (x < 220 * res) ix = saction; - else if (x < 268 * res) ix = discut; - else ix = fichier; + if (x < 76 * res) + ix = invent; + else if (x < 124 * res) + ix = MENU_MOVE; + else if (x < 172 * res) + ix = action; + else if (x < 220 * res) + ix = saction; + else if (x < 268 * res) + ix = MENU_DISCUSS; + else + ix = fichier; + if ((ix != msg3) || (! test0)) if (!((ix == fichier) && ((msg3 == sauve) || (msg3 == charge)))) { menuUp(msg3); @@ -413,16 +424,19 @@ void Menu::mdn() { msg3 = ix; msg4 = OPCODE_NONE; } - } else { /* Not in the MenuTitle line */ - if ((y > 11) && (test0)) util(x, y); + } else { // Not in the MenuTitle line + if ((y > 11) && (test0)) + util(x, y); } - } else { /* There was a click */ + } else { // There was a click if ((msg3 == fichier) && (msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); - if (lo(msg4) == 1) msg3 = 7; - else msg3 = 8; + if (lo(msg4) == 1) + msg3 = 7; + else + msg3 = 8; menuDown(msg3); g_vm->setMouseClick(false); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index d4aecbcbd9..1fb8ad45c6 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -61,7 +61,7 @@ public: enum { invent = 1, MENU_MOVE = 2, action = 3, saction = 4, - discut = 5, fichier = 6, sauve = 7, charge = 8 + MENU_DISCUSS = 5, fichier = 6, sauve = 7, charge = 8 }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 78e577a3f5..bf9a480af7 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -56,42 +56,55 @@ void testfi() { * Read the current system time */ int readclock() { - int m, h; - - /* debug('readclock');*/ TimeDate dateTime; g_system->getTimeAndDate(dateTime); - m = dateTime.tm_min * 60; - h = dateTime.tm_hour * 3600; + int m = dateTime.tm_min * 60; + int h = dateTime.tm_hour * 3600; return h + m + dateTime.tm_sec; } void modif(int &nu) { - /* debug('modif'); */ - if (nu == 26) nu = 25; - if ((nu > 29) && (nu < 36)) nu = nu - 4; - if ((nu > 69) && (nu < 78)) nu = nu - 37; - if ((nu > 99) && (nu < 194)) nu = nu - 59; - if ((nu > 996) && (nu < 1000)) nu = nu - 862; - if ((nu > 1500) && (nu < 1507)) nu = nu - 1363; - if ((nu > 1507) && (nu < 1513)) nu = nu - 1364; - if ((nu > 1999) && (nu < 2002)) nu = nu - 1851; - if (nu == 2010) nu = 151; - if ((nu > 2011) && (nu < 2025)) nu = nu - 1860; - if (nu == 2026) nu = 165; - if ((nu > 2029) && (nu < 2037)) nu = nu - 1864; - if ((nu > 3000) && (nu < 3005)) nu = nu - 2828; - if (nu == 4100) nu = 177; - if (nu == 4150) nu = 178; - if ((nu > 4151) && (nu < 4156)) nu = nu - 3973; - if (nu == 4157) nu = 183; - if ((nu == 4160) || (nu == 4161)) nu = nu - 3976; + if (nu == 26) + nu = 25; + else if ((nu > 29) && (nu < 36)) + nu -= 4; + else if ((nu > 69) && (nu < 78)) + nu -= 37; + else if ((nu > 99) && (nu < 194)) + nu -= 59; + else if ((nu > 996) && (nu < 1000)) + nu -= 862; + else if ((nu > 1500) && (nu < 1507)) + nu -= 1363; + else if ((nu > 1507) && (nu < 1513)) + nu -= 1364; + else if ((nu > 1999) && (nu < 2002)) + nu -= 1851; + else if (nu == 2010) + nu = 151; + else if ((nu > 2011) && (nu < 2025)) + nu -= 1860; + else if (nu == 2026) + nu = 165; + else if ((nu > 2029) && (nu < 2037)) + nu -= 1864; + else if ((nu > 3000) && (nu < 3005)) + nu -= 2828; + else if (nu == 4100) + nu = 177; + else if (nu == 4150) + nu = 178; + else if ((nu > 4151) && (nu < 4156)) + nu -= 3973; + else if (nu == 4157) + nu = 183; + else if ((nu == 4160) || (nu == 4161)) + nu -= 3976; } void dessine(int ad, int x, int y) { - /* debug('dessine'); */ hideMouse(); writepal(numpal); pictout(ad, 0, x, y); @@ -99,7 +112,6 @@ void dessine(int ad, int x, int y) { } void dessine_rouleau() { - /* debug('dessine_rouleau'); */ writepal(89); if (gd == her) { mem[0x7000 * 16 + 14] = 15; @@ -124,18 +136,19 @@ void text1(int x, int y, int nb, int m) { /* debug('text'); */ - if (res == 1) co = 10; - else co = 6; + if (res == 1) + co = 10; + else + co = 6; deline(m, st, tay); - if ((y == 182) && (tay * co > nb * 6)) y = 176; + if ((y == 182) && (tay * co > nb * 6)) + y = 176; afftex(st, x, y, nb, 20, color_txt); } void initouv() { - int cx; - - /* debug('initouv'); */ - for (cx = 1; cx <= 7; cx ++) touv[cx] = chr(0); + for (int cx = 1; cx <= 7; cx++) + touv[cx] = chr(0); } void ecrf1() { @@ -144,7 +157,6 @@ void ecrf1() { } void clsf1() { - /* debug('clsf1'); */ hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); @@ -152,9 +164,6 @@ void clsf1() { } void clsf2() { -// int i, j; - - /* debug('clsf2'); */ hideMouse(); if (f2_all) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); @@ -173,13 +182,13 @@ void ecrf2() { void ecr2(Common::String str_) { int tab; - int tlig; - /* debug('ecr2 : '+str_);*/ - if (res == 1) tab = 10; - else tab = 6; + if (res == 1) + tab = 10; + else + tab = 6; g_vm->_screenSurface.putxy(8, 177); - tlig = 59 + pred(int, res) * 36; + int tlig = 59 + pred(int, res) * 36; if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { @@ -200,9 +209,6 @@ void ecr2(Common::String str_) { } void clsf3() { -// int i, j; - - /* debug('clsf3'); */ hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); @@ -210,14 +216,12 @@ void clsf3() { } void ecr3(Common::String text) { - /* debug('ecr3 : '+text);*/ clsf3(); g_vm->_screenSurface.putxy(8, 192); g_vm->_screenSurface.writeg(text, 5); } void ecrf6() { - /* debug('ecrf6'); */ text_color(5); g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15); } @@ -230,7 +234,6 @@ void clsf10() { int co, cod; Common::String st; - /* debug('clsf10'); */ hideMouse(); if (res == 1) { co = 634; @@ -250,8 +253,12 @@ void clsf10() { co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); g_vm->_screenSurface.putxy(co, 92); g_vm->_screenSurface.writeg(st, 4); - if (res == 1) co = 620; - else co = 584; + + if (res == 1) + co = 620; + else + co = 584; + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, co, 86)); /* rempli(69,12,32,5,255);*/ showMouse(); @@ -267,23 +274,20 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - /* debug('paint_rect'); */ - if (gd == cga) co = 3; - else co = 11; + if (gd == cga) + co = 3; + else + co = 11; g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } int hazard(int min, int max) { - /* debug('hazard'); */ return get_random_number(min, max); } void calch(int &j, int &h, int &m) { - int th, nh; - - /* debug('calch');*/ - nh = readclock(); - th = jh + ((nh - mh) / t); + int nh = readclock(); + int th = jh + ((nh - mh) / t); m = ((th % 2) + vm) * 30; h = ((uint)th >> 1) + vh; if (m == 60) { @@ -295,10 +299,7 @@ void calch(int &j, int &h, int &m) { } void conv(int x, int &y) { - int cx; - - /* debug('conv'); */ - cx = 1; + int cx = 1; y = 128; while (cx < x) { y = (uint)y >> 1; @@ -313,11 +314,9 @@ void okpas() { void modobj(int m) { char str_[1410]; - Common::String strp; int tay; - /* debug('modobj'); */ - strp = ' '; + Common::String strp = Common::String(' '); if (m != 500) { deline(m - 501 + c_st41, str_, tay); strp = delig; @@ -328,13 +327,13 @@ void modobj(int m) { void modobj2(int m, bool t1, bool t2) { char str_[1410]; - Common::String strp; int tay; - /* debug('modobj'); */ - strp = ' '; - if (t1 || t2) okpas(); - else tesok = false;; + Common::String strp = Common::String(' '); + if (t1 || t2) + okpas(); + else + tesok = false;; if (m != 500) { deline(m - 501 + c_st41, str_, tay); strp = delig; @@ -348,25 +347,28 @@ void repon(int f, int m) { Common::String str_; Common::String str1; char st[1410]; -// text1 fic; int i, xco, dx, caspe, tay; - /* debug('repon fenetre nř'+chr(f+48));*/ if ((m > 499) && (m < 563)) { deline(m - 501 + c_st41, st, tay); - if (tay > ((58 + pred(int, res) * 37) << 1)) f2_all = true; - else f2_all = false; + if (tay > ((58 + pred(int, res) * 37) << 1)) + f2_all = true; + else + f2_all = false; clsf2(); afftex(st, 8, 176, 85, 3, 5); } else { modif(m); - if (f == 8) f = 2; - if (f == 1) f = 6; + if (f == 8) + f = 2; + if (f == 1) + f = 6; if (f == 2) { clsf2(); ecrf2(); text1(8, 182, 103, m); - if ((m == 68) || (m == 69)) s.teauto[40] = '*'; + if ((m == 68) || (m == 69)) + s.teauto[40] = '*'; if ((m == 104) && (caff == 14)) { s.teauto[36] = '*'; if (s.teauto[39] == '*') { @@ -377,11 +379,15 @@ void repon(int f, int m) { } if ((f >= 6) && (f <= 9)) { deline(m, st, tay); - if (f == 6) i = 4; - else i = 5; + if (f == 6) + i = 4; + else + i = 5; afftex(st, 80, 40, 60, 25, i); - if (m == 180) s.pourc[6] = '*'; - if (m == 179) s.pourc[10] = '*'; + if (m == 180) + s.pourc[6] = '*'; + if (m == 179) + s.pourc[10] = '*'; } if (f == 7) { /* messint */ ecrf7(); @@ -395,30 +401,43 @@ void repon(int f, int m) { caspe = 144; dx = 50; } - if (tay < 40) afftex(st, xco, 86, dx, 3, 5); - else afftex(st, caspe, 86, dx, 3, 5); + if (tay < 40) + afftex(st, xco, 86, dx, 3, 5); + else + afftex(st, caspe, 86, dx, 3, 5); } } } void t5(int cx) { - /* debug('t5'); */ - if (cx == 10) blo = false; + if (cx == 10) + blo = false; + if (cx != 1) { bh1 = false; bf1 = false; } - if (cx != 2) bh2 = false; + + if (cx != 2) + bh2 = false; + if (cx != 4) { bh4 = false; bf4 = false; } - if (cx != 5) bh5 = false; - if (cx != 6) bh6 = false; - if (cx != 8) bh8 = false; - if (cx != 3) bt3 = false; - if (cx != 7) bt7 = false; - if (cx != 9) bh9 = false; + + if (cx != 5) + bh5 = false; + if (cx != 6) + bh6 = false; + if (cx != 8) + bh8 = false; + if (cx != 3) + bt3 = false; + if (cx != 7) + bt7 = false; + if (cx != 9) + bh9 = false; } void affper(int per) { @@ -473,91 +492,109 @@ void affper(int per) { void choix(int min, int max, int &per) { bool i; - int haz, cx, cy, cz; + int cz; - /* debug('o0 choix'); */ - haz = hazard(min, max); + int haz = hazard(min, max); if (haz > 4) { haz = 8 - haz; i = true; - } else i = false; - cx = 0; + } else + i = false; + + int cx = 0; per = 0; while (cx < haz) { - cy = hazard(1, 8); + int cy = hazard(1, 8); conv(cy, cz); if ((per & cz) != cz) { - cx = cx + 1; - per = (per | cz); + ++cx; + per |= cz; } } - if (i) per = 255 - per; - i = false; + if (i) + per = 255 - per; } void cpl1(int &p) { int j, h, m; - /* debug('o0 cpl1'); */ calch(j, h, m); - if ((h > 7) || (h < 11)) p = 25; - if ((h > 10) && (h < 14)) p = 35; - if ((h > 13) && (h < 16)) p = 50; - if ((h > 15) && (h < 18)) p = 5; - if ((h > 17) && (h < 22)) p = 35; - if ((h > 21) && (h < 24)) p = 50; - if ((h >= 0) && (h < 8)) p = 70; + if ((h > 7) || (h < 11)) + p = 25; + else if ((h > 10) && (h < 14)) + p = 35; + else if ((h > 13) && (h < 16)) + p = 50; + else if ((h > 15) && (h < 18)) + p = 5; + else if ((h > 17) && (h < 22)) + p = 35; + else if ((h > 21) && (h < 24)) + p = 50; + else if ((h >= 0) && (h < 8)) + p = 70; + g_vm->_menu.mdn(); } void cpl2(int &p) { int j, h, m; - /* debug('o0 cpl2'); */ calch(j, h, m); - if ((h > 7) && (h < 11)) p = -2; - if (h == 11) p = 100; - if ((h > 11) && (h < 23)) p = 10; - if (h == 23) p = 20; - if ((h >= 0) && (h < 8)) p = 50; + if ((h > 7) && (h < 11)) + p = -2; + if (h == 11) + p = 100; + if ((h > 11) && (h < 23)) + p = 10; + if (h == 23) + p = 20; + if ((h >= 0) && (h < 8)) + p = 50; } void cpl3(int &p) { int j, h, m; - /* debug('o0 cpl3'); */ calch(j, h, m); - if (((h > 8) && (h < 10)) || ((h > 19) && (h < 24))) p = 34; - if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) p = 0; + if (((h > 8) && (h < 10)) || ((h > 19) && (h < 24))) + p = 34; + if (((h > 9) && (h < 20)) || ((h >= 0) && (h < 9))) + p = 0; } void cpl5(int &p) { int j, h, m; - /* debug('o0 cpl5'); */ calch(j, h, m); - if ((h > 6) && (h < 10)) p = 0; - if (h == 10) p = 100; - if ((h > 10) && (h < 24)) p = 15; - if ((h >= 0) && (h < 7)) p = 50; + if ((h > 6) && (h < 10)) + p = 0; + if (h == 10) + p = 100; + if ((h > 10) && (h < 24)) + p = 15; + if ((h >= 0) && (h < 7)) + p = 50; } void cpl6(int &p) { int j, h, m; - /* debug('o0 cpl6'); */ calch(j, h, m); - if (((h > 7) && (h < 13)) || ((h > 17) && (h < 20))) p = -2; - if (((h > 12) && (h < 17)) || ((h > 19) && (h < 24))) p = 35; - if (h == 17) p = 100; - if ((h >= 0) && (h < 8)) p = 60; + if (((h > 7) && (h < 13)) || ((h > 17) && (h < 20))) + p = -2; + if (((h > 12) && (h < 17)) || ((h > 19) && (h < 24))) + p = 35; + if (h == 17) + p = 100; + if ((h >= 0) && (h < 8)) + p = 60; } /** * Shows the you are alone message in the status area on the right hand side of the screen */ void person() { - /* debug('person'); */ for (int cf = 1; cf <= 8; cf ++) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); @@ -577,7 +614,6 @@ void person() { } void chlm(int &per) { - /* debug('chlm'); */ per = hazard(1, 2); if (per == 2) per = 128; } @@ -594,7 +630,6 @@ void pendule() { int h, co; - /* debug('pendule'); */ hideMouse(); paint_rect(570, 118, 20, 10); @@ -602,20 +637,27 @@ void pendule() { if ((gd == cga) || (gd == her)) co = 0; else co = 1; + if (min == 0) g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); else g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); + h = heu; - if (h > 12) h = h - 12; - if (h == 0) h = 12; + if (h > 12) + h -= 12; + if (h == 0) + h = 12; + g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); showMouse(); g_vm->_screenSurface.putxy(568, 154); + if (heu > 11) g_vm->_screenSurface.writeg("PM ", 1); else g_vm->_screenSurface.writeg("AM ", 1); + g_vm->_screenSurface.putxy(550, 160); if ((jou >= 0) && (jou <= 8)) { Common::String tmp = g_vm->getString(S_DAY); @@ -629,134 +671,158 @@ void pendule() { *************/ void debloc(int l) { - /* debug('debloc'); */ num = 0; x = 0; y = 0; - if ((l != 26) && (l != 15)) t5(l); + if ((l != 26) && (l != 15)) + t5(l); mpers = ipers; } void cpl10(int &p, int &h) { int j, m; - /* debug('o1 cpl10'); */ calch(j, h, m); - if (((h > 7) && (h < 11)) || ((h > 11) && (h < 14)) - || ((h > 18) && (h < 21))) p = 100; - if ((h == 11) || ((h > 20) && (h < 24))) p = 45; - if (((h > 13) && (h < 17)) || (h == 18)) p = 35; - if (h == 17) p = 60; - if ((h >= 0) && (h < 8)) p = 5; + if (((h > 7) && (h < 11)) || ((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + p = 100; + if ((h == 11) || ((h > 20) && (h < 24))) + p = 45; + if (((h > 13) && (h < 17)) || (h == 18)) + p = 35; + if (h == 17) + p = 60; + if ((h >= 0) && (h < 8)) + p = 5; } void cpl11(int &p, int &h) { int j, m; - /* debug('o1 cpl11'); */ calch(j, h, m); - if (((h > 8) && (h < 12)) || ((h > 20) && (h < 24))) p = 25; - if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) p = 5; - if ((h > 13) && (h < 17)) p = 55; - if ((h > 16) && (h < 19)) p = 45; - if ((h >= 0) && (h < 9)) p = 0; + if (((h > 8) && (h < 12)) || ((h > 20) && (h < 24))) + p = 25; + if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + p = 5; + if ((h > 13) && (h < 17)) + p = 55; + if ((h > 16) && (h < 19)) + p = 45; + if ((h >= 0) && (h < 9)) + p = 0; } void cpl12(int &p) { int j, h, m; - /* debug('o1 cpl12'); */ calch(j, h, m); - if (((h > 8) && (h < 15)) || ((h > 16) && (h < 22))) p = 55; - if (((h > 14) && (h < 17)) || ((h > 21) && (h < 24))) p = 25; - if ((h >= 0) && (h < 5)) p = 0; - if ((h > 4) && (h < 9)) p = 15; + if (((h > 8) && (h < 15)) || ((h > 16) && (h < 22))) + p = 55; + if (((h > 14) && (h < 17)) || ((h > 21) && (h < 24))) + p = 25; + if ((h >= 0) && (h < 5)) + p = 0; + if ((h > 4) && (h < 9)) + p = 15; } void cpl13(int &p) { - /* debug('o1 cpl13'); */ p = 0; } void cpl15(int &p) { int j, h, m; - /* debug('o1 cpl15'); */ calch(j, h, m); - if ((h > 7) && (h < 12)) p = 25; - if ((h > 11) && (h < 14)) p = 0; - if ((h > 13) && (h < 18)) p = 10; - if ((h > 17) && (h < 20)) p = 55; - if ((h > 19) && (h < 22)) p = 5; - if ((h > 21) && (h < 24)) p = 15; - if ((h >= 0) && (h < 8)) p = -15; + if ((h > 7) && (h < 12)) + p = 25; + else if ((h > 11) && (h < 14)) + p = 0; + else if ((h > 13) && (h < 18)) + p = 10; + else if ((h > 17) && (h < 20)) + p = 55; + else if ((h > 19) && (h < 22)) + p = 5; + else if ((h > 21) && (h < 24)) + p = 15; + else if ((h >= 0) && (h < 8)) + p = -15; } void cpl20(int &p, int &h) { int j, m; - /* debug('o1 cpl20'); */ calch(j, h, m); - if (h == 10) p = 65; - if ((h > 10) && (h < 21)) p = 5; - if ((h > 20) && (h < 24)) p = -15; - if ((h >= 0) && (h < 5)) p = -300; - if ((h > 4) && (h < 10)) p = -5; + if (h == 10) + p = 65; + else if ((h > 10) && (h < 21)) + p = 5; + else if ((h > 20) && (h < 24)) + p = -15; + else if ((h >= 0) && (h < 5)) + p = -300; + else if ((h > 4) && (h < 10)) + p = -5; } void quelq1(int l) { int per; - /* debug('o1 quelq1'); */ per = hazard(1, 2); - if (l == 1) - if (per == 1) bh1 = true; - else bf1 = true; - if (l == 4) - if (per == 1) bh4 = true; - else bf4 = true; + if (l == 1) { + if (per == 1) + bh1 = true; + else + bf1 = true; + } else if (l == 4) { + if (per == 1) + bh4 = true; + else + bf4 = true; + } + ipers = 10; } void quelq2() { - /* debug('o1 quelq2'); */ - if (li == 2) bh2 = true; - else bh9 = true; + if (li == 2) + bh2 = true; + else + bh9 = true; + ipers = 10; } void quelq5() { - /* debug('o1 quelq5'); */ bh5 = true; ipers = 10; } void quelq6(int l) { - /* debug('o1 quelq6'); */ - if (l == 6) bh6 = true; - if (l == 8) bh8 = true; + if (l == 6) + bh6 = true; + else if (l == 8) + bh8 = true; + ipers = 10; } void quelq10(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq10'); */ - if ((h >= 0) && (h < 8)) chlm(per); + if ((h >= 0) && (h < 8)) + chlm(per); else { if ((h > 7) && (h < 10)) { min = 5; max = 7; - } - if ((h > 9) && (h < 12)) { + } else if ((h > 9) && (h < 12)) { min = 1; max = 4; - } - if (((h > 11) && (h < 15)) || ((h > 18) && (h < 21))) { + } else if (((h > 11) && (h < 15)) || ((h > 18) && (h < 21))) { min = 6; max = 8; - } - if (((h > 14) && (h < 19)) || ((h > 20) && (h < 24))) { + } else if (((h > 14) && (h < 19)) || ((h > 20) && (h < 24))) { min = 1; max = 5; } @@ -768,18 +834,16 @@ void quelq10(int h, int &per) { void quelq11(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq11'); */ - if ((h >= 0) && (h < 8)) chlm(per); + if ((h >= 0) && (h < 8)) + chlm(per); else { if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { min = 1; max = 3; - } - if (((h > 9) && (h < 12)) || ((h > 13) && (h < 19))) { + } else if (((h > 9) && (h < 12)) || ((h > 13) && (h < 19))) { min = 1; max = 4; - } - if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) { + } else if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) { min = 1; max = 2; } @@ -789,7 +853,6 @@ void quelq11(int h, int &per) { } void quelq12(int &per) { - /* debug('o1 quelq12'); */ chlm(per); affper(per); } @@ -798,41 +861,37 @@ void quelq15(int &per) { int cx; bool test; - - /* debug('o1 quelq15'); */ per = 0; - if (per == 0) { - do { - cx = hazard(1, 8); - test = (((cx == 1) && (bh2 || bh9)) || - ((cx == 2) && bh8) || - ((cx == 3) && bh4) || - ((cx == 4) && bf4) || - ((cx == 5) && bh6) || - ((cx == 6) && bh1) || - ((cx == 7) && bf1) || - ((cx == 8) && bh5)); - } while (!(! test)); - conv(cx, per); - affper(per); - } + + do { + cx = hazard(1, 8); + test = (((cx == 1) && (bh2 || bh9)) || + ((cx == 2) && bh8) || + ((cx == 3) && bh4) || + ((cx == 4) && bf4) || + ((cx == 5) && bh6) || + ((cx == 6) && bh1) || + ((cx == 7) && bf1) || + ((cx == 8) && bh5)); + } while (!(! test)); + + conv(cx, per); + affper(per); } void quelq20(int h, int &per) { int min = 0, max = 0; - /* debug('o1 quelq20'); */ - if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); + if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) + chlm(per); else { if ((h > 9) && (h < 12)) { min = 3; max = 7; - } - if ((h > 11) && (h < 18)) { + } else if ((h > 11) && (h < 18)) { min = 1; max = 2; - } - if (h == 18) { + } else if (h == 18) { min = 2; max = 4; } @@ -847,61 +906,86 @@ void frap() { /* debug('o1 frap'); */ calch(j, h, m); - if ((h >= 0) && (h < 8)) crep = 190; + if ((h >= 0) && (h < 8)) + crep = 190; else { haz = hazard(1, 100); - if (haz > 70) crep = 190; - else crep = 147; + if (haz > 70) + crep = 190; + else + crep = 147; } } void nouvp(int l, int &p) { - /* debug('o1 nouvp'); */ p = 0; if (l == 1) { - if (bh1) p = 4; - if (bf1) p = 2; - } - if (((l == 2) && (bh2)) || ((l == 9) && (bh9))) p = 128; - if (l == 4) { - if (bh4) p = 32; - if (bf4) p = 16; - } - if ((l == 5) && (bh5)) p = 1; - if ((l == 6) && (bh6)) p = 8; - if ((l == 8) && (bh8)) p = 64; - if (((l == 3) && (bt3)) || ((l == 7) && (bt7))) p = 9; - if (p != 9) affper(p); + if (bh1) + p = 4; + if (bf1) + p = 2; + } else if (((l == 2) && (bh2)) || ((l == 9) && (bh9))) + p = 128; + else if (l == 4) { + if (bh4) + p = 32; + if (bf4) + p = 16; + } else if ((l == 5) && (bh5)) + p = 1; + else if ((l == 6) && (bh6)) + p = 8; + else if ((l == 8) && (bh8)) + p = 64; + else if (((l == 3) && (bt3)) || ((l == 7) && (bt7))) + p = 9; + + if (p != 9) + affper(p); } void tip(int ip, int &cx) { - /* debug('o1 tip'); */ - if (ip == 128) cx = 1; - else if (ip == 64) cx = 2; - else if (ip == 32) cx = 3; - else if (ip == 16) cx = 4; - else if (ip == 8) cx = 5; - else if (ip == 4) cx = 6; - else if (ip == 2) cx = 7; - else if (ip == 1) cx = 8; + if (ip == 128) + cx = 1; + else if (ip == 64) + cx = 2; + else if (ip == 32) + cx = 3; + else if (ip == 16) + cx = 4; + else if (ip == 8) + cx = 5; + else if (ip == 4) + cx = 6; + else if (ip == 2) + cx = 7; + else if (ip == 1) + cx = 8; } void ecfren(int &p, int &haz, int cf, int l) { /* debug('o1 ecfren'); */ - if (l == 0) person(); + if (l == 0) + person(); p = -500; haz = 0; - if (((l == 1) && (! bh1) && (! bf1)) - || ((l == 4) && (! bh4) && (! bf4))) cpl1(p); - if ((l == 2) && (! bh2) && (! bh9)) cpl2(p); - if (((l == 3) && (! bt3)) || ((l == 7) && (! bt7))) cpl3(p); - if ((l == 5) && (! bh5)) cpl5(p); - if (((l == 6) && (! bh6)) || ((l == 8) && (! bh8))) cpl6(p); - if ((l == 9) && (! bh9) && (! bh2)) p = 10; - if (((l == 2) && (bh9)) || ((l == 9) && (bh2))) p = -400; + if (((l == 1) && (! bh1) && (! bf1)) || ((l == 4) && (! bh4) && (! bf4))) + cpl1(p); + if ((l == 2) && (! bh2) && (! bh9)) + cpl2(p); + if (((l == 3) && (! bt3)) || ((l == 7) && (! bt7))) + cpl3(p); + if ((l == 5) && (! bh5)) + cpl5(p); + if (((l == 6) && (! bh6)) || ((l == 8) && (! bh8))) + cpl6(p); + if ((l == 9) && (! bh9) && (! bh2)) + p = 10; + if (((l == 2) && (bh9)) || ((l == 9) && (bh2))) + p = -400; if (p != -500) { p = p + cf; haz = hazard(1, 100); @@ -915,19 +999,29 @@ void becfren(int l) { if ((l == 1) || (l == 4)) { haz = hazard(1, 2); if (l == 1) - if (haz == 1) bh1 = true; - else bf1 = true; + if (haz == 1) + bh1 = true; + else + bf1 = true; if (l == 4) - if (haz == 1) bh4 = true; - else bf4 = true; - } - if (l == 2) bh2 = true; - else if (l == 3) bt3 = true; - else if (l == 5) bh5 = true; - else if (l == 6) bh6 = true; - else if (l == 7) bt7 = true; - else if (l == 8) bh8 = true; - else if (l == 9) bh9 = true; + if (haz == 1) + bh4 = true; + else + bf4 = true; + } else if (l == 2) + bh2 = true; + else if (l == 3) + bt3 = true; + else if (l == 5) + bh5 = true; + else if (l == 6) + bh6 = true; + else if (l == 7) + bt7 = true; + else if (l == 8) + bh8 = true; + else if (l == 9) + bh9 = true; } /* NIVEAU 10 */ @@ -941,7 +1035,7 @@ void init_nbrepm() { void phaz(int &haz, int &p, int cf) { /* debug('phaz'); */ - p = p + cf; + p += cf; haz = hazard(1, 100); } @@ -950,29 +1044,45 @@ void inzon() { /* debug('o2 inzon'); */ copcha(); - { - s.ipre = false; - s.derobj = 0; - s.icave = 0; - s.iboul = 0; - s.ibag = 0; - s.ipuit = 0; - s.ivier = 0; - s.iloic = 136; - s.icryp = 141; - s.conf = hazard(4, 10); - s.mlieu = 21; - for (cx = 2; cx <= 6; cx ++) s.sjer[cx] = chr(0); - s.sjer[1] = chr(113); - s.heure = chr(20); - for (cx = 1; cx <= 10; cx ++) s.pourc[cx] = ' '; - for (cx = 1; cx <= 6; cx ++) s.teauto[cx] = '*'; - for (cx = 7; cx <= 9; cx ++) s.teauto[cx] = ' '; - for (cx = 10; cx <= 28; cx ++) s.teauto[cx] = '*'; - for (cx = 29; cx <= 42; cx ++) s.teauto[cx] = ' '; - s.teauto[33] = '*'; - } - for (cx = 1; cx <= 8; cx ++) nbrep[cx] = 0; + + s.ipre = false; + s.derobj = 0; + s.icave = 0; + s.iboul = 0; + s.ibag = 0; + s.ipuit = 0; + s.ivier = 0; + s.iloic = 136; + s.icryp = 141; + s.conf = hazard(4, 10); + s.mlieu = 21; + + for (cx = 2; cx <= 6; cx ++) + s.sjer[cx] = chr(0); + + s.sjer[1] = chr(113); + s.heure = chr(20); + + for (cx = 1; cx <= 10; cx ++) + s.pourc[cx] = ' '; + + for (cx = 1; cx <= 6; cx ++) + s.teauto[cx] = '*'; + + for (cx = 7; cx <= 9; cx ++) + s.teauto[cx] = ' '; + + for (cx = 10; cx <= 28; cx ++) + s.teauto[cx] = '*'; + + for (cx = 29; cx <= 42; cx ++) + s.teauto[cx] = ' '; + + s.teauto[33] = '*'; + + for (cx = 1; cx <= 8; cx ++) + nbrep[cx] = 0; + init_nbrepm(); } @@ -981,7 +1091,8 @@ void dprog() { li = 21; /* jh:= t_settime(0);*/ jh = 0; - if (! s.ipre) blo = true; + if (! s.ipre) + blo = true; t = ti1; mh = readclock(); } @@ -990,12 +1101,13 @@ void pl1(int cf) { int p, haz; /* debug('o2 pl1'); */ - if (((li == 1) && (! bh1) && (! bf1)) - || ((li == 4) && (! bh4) && (! bf4))) { + if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { cpl1(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq1(li); + if (haz > p) + person(); + else + quelq1(li); } } @@ -1006,8 +1118,10 @@ void pl2(int cf) { if (! bh2) { cpl2(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq2(); + if (haz > p) + person(); + else + quelq2(); } } @@ -1018,8 +1132,10 @@ void pl5(int cf) { if (! bh5) { cpl5(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq5(); + if (haz > p) + person(); + else + quelq5(); } } @@ -1030,8 +1146,10 @@ void pl6(int cf) { if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { cpl6(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq6(li); + if (haz > p) + person(); + else + quelq6(li); } } @@ -1042,8 +1160,10 @@ void pl9(int cf) { if (! bh9) { cf = -10; phaz(haz, p, cf); - if (haz > p) person(); - else quelq2(); + if (haz > p) + person(); + else + quelq2(); } } @@ -1053,8 +1173,10 @@ void pl10(int cf) { /* debug('o2 pl10'); */ cpl10(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq10(h, p); + if (haz > p) + person(); + else + quelq10(h, p); } void pl11(int cf) { @@ -1063,8 +1185,10 @@ void pl11(int cf) { /* debug('o2 pl11'); */ cpl11(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq11(h, p); + if (haz > p) + person(); + else + quelq11(h, p); } void pl12(int cf) { @@ -1073,8 +1197,10 @@ void pl12(int cf) { /* debug('o2 pl12'); */ cpl12(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq12(p); + if (haz > p) + person(); + else + quelq12(p); } void pl13(int cf) { @@ -1083,8 +1209,10 @@ void pl13(int cf) { /* debug('o2 pl13'); */ cpl13(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq12(p); + if (haz > p) + person(); + else + quelq12(p); } void pl15(int cf) { @@ -1093,8 +1221,10 @@ void pl15(int cf) { /* debug('o2 pl15'); */ cpl15(p); phaz(haz, p, cf); - if (haz > p) person(); - else quelq15(p); + if (haz > p) + person(); + else + quelq15(p); } void pl20(int cf) { @@ -1103,8 +1233,10 @@ void pl20(int cf) { /* debug('o2 pl20'); */ cpl20(p, h); phaz(haz, p, cf); - if (haz > p) person(); - else quelq20(h, p); + if (haz > p) + person(); + else + quelq20(h, p); } void t11(int l11, int &a) { @@ -1113,7 +1245,7 @@ void t11(int l11, int &a) { /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); li = l11; - if ((l11 > 0) && (l11 < 10)) + if ((l11 > 0) && (l11 < 10)) { if (p != -500) { if (haz > p) { person(); @@ -1122,46 +1254,63 @@ void t11(int l11, int &a) { becfren(li); nouvp(li, a); } - } else nouvp(li, a); - if (l11 > 9) - if ((l11 > 15) && (l11 != 20) && (l11 != 26)) person(); + } else + nouvp(li, a); + } + + if (l11 > 9) { + if ((l11 > 15) && (l11 != 20) && (l11 != 26)) + person(); else { - if (l11 == 10) cpl10(p, h); - if (l11 == 11) cpl11(p, h); - if (l11 == 12) cpl12(p); - if ((l11 == 13) || (l11 == 14)) cpl13(p); - if ((l11 == 15) || (l11 == 26)) cpl15(p); - if (l11 == 20) cpl20(p, h); + if (l11 == 10) + cpl10(p, h); + if (l11 == 11) + cpl11(p, h); + if (l11 == 12) + cpl12(p); + if ((l11 == 13) || (l11 == 14)) + cpl13(p); + if ((l11 == 15) || (l11 == 26)) + cpl15(p); + if (l11 == 20) + cpl20(p, h); p = p + s.conf; haz = hazard(1, 100); if (haz > p) { person(); a = 0; } else { - if (l11 == 10) quelq10(h, p); - if (l11 == 11) quelq11(h, p); - if ((l11 == 12) || (l11 == 13) || (l11 == 14)) quelq12(p); - if ((l11 == 15) || (l11 == 26)) quelq15(p); - if (l11 == 20) quelq20(h, p); + if (l11 == 10) + quelq10(h, p); + if (l11 == 11) + quelq11(h, p); + if ((l11 == 12) || (l11 == 13) || (l11 == 14)) + quelq12(p); + if ((l11 == 15) || (l11 == 26)) + quelq15(p); + if (l11 == 20) + quelq20(h, p); a = p; } } + } } -void cavegre() - -{ +void cavegre() { int haz; /* debug('cavegre'); */ s.conf = s.conf + 2; - if (s.conf > 69) s.conf = s.conf + (s.conf / 10); + if (s.conf > 69) + s.conf += (s.conf / 10); clsf3(); ecrf2(); ecr3(g_vm->getString(S_SOMEONE_ENTERS)); haz = (hazard(0, 4)) - 2; parole(2, haz, 1); - for (haz = 0; haz <= 3000; haz ++); + + // Useless? + for (haz = 0; haz <= 3000; haz++); clsf3(); person(); } @@ -1183,15 +1332,21 @@ void messint(int nu) { } void aniof(int ouf, int num) { - int ad, offset; + if ((caff == 7) && ((num == 4) || (num == 5))) + return; + + if ((caff == 10) && (num == 7)) + num = 6; + + if (caff == 12) { + if (num == 3) + num = 4; + else if (num == 4) + num = 3; + } - /* debug('aniof'); */ - if ((caff == 7) && ((num == 4) || (num == 5))) return; - if ((caff == 10) && (num == 7)) num = 6; - if (caff == 12) if (num == 3) num = 4; - else if (num == 4) num = 3; - ad = adani; - offset = animof(ouf, num); + int ad = adani; + int offset = animof(ouf, num); GfxSurface surface; surface.decode(&mem[ad * 16 + offset]); @@ -1209,7 +1364,7 @@ void musique(int so) { ; } else if ((prebru == 0) && (! s.ipre)) { parole(10, 1, 1); - prebru = prebru + 1; + ++prebru; } else { i = false; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) { @@ -1247,15 +1402,13 @@ void musique(int so) { /* NIVEAU 9 */ void dessin(int ad) { - int cx; - - /* debug('dessin'); */ - if (ad != 0) dessine(ades, ((ad % 160) * 2), (ad / 160)); + if (ad != 0) + dessine(ades, ((ad % 160) * 2), (ad / 160)); else { clsf1(); if (caff > 99) { dessine(ades, 60, 33); - g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); /* cadre moyen */ //Translation: Medium box + g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (caff > 69) { dessine(ades, 112, 48); /* ttes */ //Translation: Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); @@ -1263,17 +1416,30 @@ void dessin(int ad) { dessine(ades, 0, 12); ecrf1(); if ((caff < 30) || (caff > 32)) { - for (cx = 1; cx <= 6; cx ++) - if (ord(touv[cx]) != 0) aniof(1, ord(touv[cx])); + for (int cx = 1; cx <= 6; cx ++) { + if (ord(touv[cx]) != 0) + aniof(1, ord(touv[cx])); + } + if (caff == 13) { - if (s.iboul == 141) aniof(1, 7); - if (s.ibag == 159) aniof(1, 6); + if (s.iboul == 141) + aniof(1, 7); + + if (s.ibag == 159) + aniof(1, 6); } - if ((caff == 14) && (s.icave == 151)) aniof(1, 2); - if ((caff == 17) && (s.ivier == 143)) aniof(1, 1); - if ((caff == 24) && (s.ipuit != 0)) aniof(1, 1); + if ((caff == 14) && (s.icave == 151)) + aniof(1, 2); + + if ((caff == 17) && (s.ivier == 143)) + aniof(1, 1); + + if ((caff == 24) && (s.ipuit != 0)) + aniof(1, 1); } - if (caff < 26) musique(1); + + if (caff < 26) + musique(1); } } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 15d413d119..73259aa7a0 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -62,8 +62,9 @@ void tinke() { jou = j; cx = 0; do { - cx = cx + 1; - if (nbrepm[cx] != 0) nbrepm[cx] = nbrepm[cx] - 1; + ++cx; + if (nbrepm[cx] != 0) + --nbrepm[cx]; nbrep[cx] = 0; } while (!(cx == 8)); } @@ -72,9 +73,15 @@ void tinke() { min = 0; pendule(); cf = 0; - for (cx = 1; cx <= 10; cx ++) if (s.pourc[cx] == '*') cf = cf + 1; - if (cf == 10) stpo = "10"; - else stpo = chr(cf + 48); + for (cx = 1; cx <= 10; cx ++) { + if (s.pourc[cx] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); stpou = Common::String(d3); stpou += d5; @@ -93,14 +100,21 @@ void tinke() { min = 30; pendule(); } - if (y_s < 12) return; + if (y_s < 12) + return; + if (! blo) { if ((h == 12) || ((h > 18) && (h < 21)) || ((h >= 0) && (h < 7))) t = ti2; - else t = ti1; + else + t = ti1; cf = s.conf; - if ((cf > 33) && (cf < 66)) t = t - (t / 3); - if (cf > 65) t = t - ((t / 3) * 2); + if ((cf > 33) && (cf < 66)) + t = t - (t / 3); + + if (cf > 65) + t = t - ((t / 3) * 2); + nh = readclock(); if ((nh - mh) > t) { am = g_vm->_menu._menuActive; @@ -146,9 +160,12 @@ void tinke() { pl20(cf); break; } - if ((mpers != 0) && (ipers != 10)) mpers = ipers; + if ((mpers != 0) && (ipers != 10)) + mpers = ipers; + if ((mpers == 0) && (ipers > 0)) - if ((s.mlieu == 13) || (s.mlieu == 14)) cavegre(); + if ((s.mlieu == 13) || (s.mlieu == 14)) + cavegre(); else if (ipers == 10) { ipers = 0; if (! brt) { @@ -174,7 +191,8 @@ void tinke() { nouvp(li, cx); brt = false; hdb = 0; - if ((s.mlieu > 0) && (s.mlieu < 10)) anyone = true; + if ((s.mlieu > 0) && (s.mlieu < 10)) + anyone = true; } } @@ -209,14 +227,18 @@ void tkey1(bool d) { hideMouse(); fenat('K'); - while (keypressed()) key = testou(); + while (keypressed()) + key = testou(); + do { - if (d) tinke(); + if (d) + tinke(); quest = keypressed(); getMousePos(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); - if (quest) key = testou(); + if (quest) + key = testou(); g_vm->setMouseClick(false); showMouse(); } @@ -227,18 +249,21 @@ void tmlieu(int mli) { char st[1410]; - if (mli == 26) mli = 15; + if (mli == 26) + mli = 15; + i = 1; while ((i < 8) && (v_lieu[i][mli] != 0)) { cx = v_lieu[i][mli]; deline(cx + c_tmlieu, st, tail); nomp = delig; - while (nomp.size() < 20) nomp = nomp + ' '; + while (nomp.size() < 20) + nomp += ' '; g_vm->_menu.menut(g_vm->_menu._depl[i], nomp); - i = i + 1; + ++i; } nomp = "* "; - for (cx = 7; cx >= i; cx --) + for (cx = 7; cx >= i; cx--) g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); } @@ -267,9 +292,7 @@ void affrep() { crep = s.mlieu; } -void mfouen() - -{ +void mfouen() { int cx; tmlieu(s.mlieu); @@ -304,12 +327,16 @@ void tperd() { } void tsort() { - int cx; - if ((iouv > 0) && (s.mlieu != 0)) - if (s.conf < 50) s.conf = s.conf + 2; - else s.conf = s.conf + (s.conf / 10); - for (cx = 1; cx <= 7; cx ++) touv[cx] = chr(0); + if ((iouv > 0) && (s.mlieu != 0)) { + if (s.conf < 50) + s.conf += 2; + else + s.conf += (s.conf / 10); + } + + for (int cx = 1; cx <= 7; cx ++) + touv[cx] = chr(0); ment = 0; iouv = 0; mchai = 0; @@ -318,6 +345,7 @@ void tsort() { void st4(int ob) { crep = 997; + switch (ob) { case 114 : crep = 109; @@ -340,6 +368,8 @@ void st4(int ob) { case 161 : tlu(caff, ob); break; + default: + break; } } @@ -347,8 +377,11 @@ void cherjer(int ob, bool &d) { int cx; d = false; - for (cx = 1; cx <= 6; cx ++) d = (d || (ord(s.sjer[cx]) == ob)); - if (s.derobj == ob) d = true; + for (cx = 1; cx <= 6; cx++) + d = (d || (ord(s.sjer[cx]) == ob)); + + if (s.derobj == ob) + d = true; } void st1sama() { @@ -357,12 +390,12 @@ void st1sama() { } void modinv() { - int cx, cy, tay, r; + int tay, r; char nom[1410]; Common::String nomp; - cy = 0; - for (cx = 1; cx <= 6; cx ++) + int cy = 0; + for (int cx = 1; cx <= 6; cx++) if (s.sjer[cx] != chr(0)) { cy = succ(int, cy); r = (ord(s.sjer[cx]) + 400); @@ -372,7 +405,7 @@ void modinv() { g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); } if (cy < 6) - for (cx = cy + 1; cx <= 6; cx ++) { + for (int cx = cy + 1; cx <= 6; cx++) { g_vm->_menu.menut(g_vm->_menu._invt[cx], " "); g_vm->_menu.disableMenuItem(g_vm->_menu._invt[cx]); } @@ -408,11 +441,10 @@ void finfouil() { } void mfoudi() { - int cx; - - for (cx = 1; cx <= 7; cx ++) + for (int cx = 1; cx <= 7; cx++) g_vm->_menu.disableMenuItem(g_vm->_menu._depl[cx]); - for (cx = 1; cx <= 11; cx ++) + + for (int cx = 1; cx <= 11; cx++) g_vm->_menu.disableMenuItem(men[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); @@ -430,45 +462,47 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - int cx, cy, lderobj; - cy = (acha + pred(int, pred(int, mchai) * 10)); - cx = 0; + int cy = (acha + pred(int, pred(int, mchai) * 10)); + int cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 9) || (tabdon[cy + cx] == 0))); + if (tabdon[cy + cx] == 0) { - lderobj = s.derobj; + int lderobj = s.derobj; tabdon[cy + cx] = lderobj; - } else crep = 192; + } else + crep = 192; } void ajjer(int ob) { - int cx; - - cx = 0; + int cx = 0; do { - cx = cx + 1; + ++cx; } while (!((cx > 5) || (ord(s.sjer[cx]) == 0))); + if (ord(s.sjer[cx]) == 0) { s.sjer[(cx)] = chr(ob); modinv(); - } else crep = 139; + } else + crep = 139; } -void t1sama() { /* On entre dans le manoir */ //Translation: Entering manor +void t1sama() { //Entering manor int j, h, m; bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { cherjer(137, d); - if (! d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late + if (!d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late crep = 1511; tperd(); - } else st1sama(); - } else if (! s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? + } else + st1sama(); + } else if (!s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? ipers = 255; affper(ipers); caff = 77; @@ -487,12 +521,14 @@ void t1sama() { /* On entre dans le manoir */ //Translation: s.mlieu = 0; affrep(); t5(10); - if (! blo) t11(0, m); + if (! blo) + t11(0, m); ipers = 0; mpers = 0; s.ipre = true; /*chech;*/ - } else st1sama(); + } else + st1sama(); } void t1vier() { @@ -501,7 +537,7 @@ void t1vier() { } void t1neig() { - inei = inei + 1; + ++inei; if (inei > 2) { crep = 1506; tperd(); @@ -543,20 +579,26 @@ void quelquun() { crep = 997; L1: if (! cache) { - if (crep == 997) crep = 138; + if (crep == 997) + crep = 138; repon(2, crep); - if (crep == 138) parole(5, 2, 1); - else parole(4, 4, 1); - if (iouv == 0) s.conf = s.conf + 2; - else if (s.conf < 50) s.conf = s.conf + 4; + if (crep == 138) + parole(5, 2, 1); else - s.conf = s.conf + (3 * (s.conf / 10)); + parole(4, 4, 1); + + if (iouv == 0) + s.conf += 2; + else if (s.conf < 50) + s.conf += 4; + else + s.conf += 3 * (s.conf / 10); tsort(); tmlieu(15); tip(ipers, cx); caff = 69 + cx; crep = caff; - msg[3] = discut; + msg[3] = MENU_DISCUSS; msg[4] = g_vm->_menu._disc[cx]; syn = true; col = true; @@ -581,35 +623,39 @@ L1: } void tsuiv() { - int cx, tbcl; - int cl, cy; + int tbcl; + int cl; - cy = acha + ((mchai - 1) * 10) - 1; - cx = 0; + int cy = acha + ((mchai - 1) * 10) - 1; + int cx = 0; do { cx = cx + 1; cs = cs + 1; cl = cy + cs; tbcl = tabdon[cl]; } while (!((tbcl != 0) || (cs > 9))); + if ((tbcl != 0) && (cs < 11)) { is = is + 1; caff = tbcl; crep = caff + 400; - if (ipers != 0) s.conf = s.conf + 2; + if (ipers != 0) + s.conf = s.conf + 2; } else { affrep(); finfouil(); - if (cx > 9) crep = 131; + if (cx > 9) + crep = 131; } } void tfleche() { bool qust; char touch; - int dummy; - if (num == 9999) return; + if (num == 9999) + return; + fenat(chr(152)); rect = false; do { @@ -624,19 +670,20 @@ void tfleche() { tinke(); } while (!(qust || rect || anyone)); - if (qust && (touch == '\103')) dummy = Alert::show(stpou, 1); - } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || - (anyone) || (rect))); - if (touch == '\73') iesc = true; + if (qust && (touch == '\103')) + Alert::show(stpou, 1); + } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); + + if (touch == '\73') + iesc = true; + if (rect) { x = x_s; y = y_s; } } -void tcoord(int sx) - -{ +void tcoord(int sx) { int sy, ix, iy, cb, cy, ib; int a, b, atdon; @@ -647,50 +694,65 @@ void tcoord(int sx) atdon = amzon + 3; cy = 0; while (cy < caff) { - a = a + tabdon[atdon]; - atdon = atdon + 4; + a += tabdon[atdon]; + atdon += 4; cy = succ(int, cy); } b = tabdon[atdon]; - if (b == 0) goto L1; - a = a + fleche; + if (b == 0) + goto L1; + a += fleche; cb = 0; - for (cy = 0; cy <= (sx - 2); cy ++) { + for (cy = 0; cy <= (sx - 2); cy++) { ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; - cb = cb + (ib * 4) + 2; + cb += (ib * 4) + 2; } ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; - if (ib == 0) goto L1; + if (ib == 0) + goto L1; + cy = 1; do { - cb = cb + 2; + cb += 2; sx = tabdon[a + cb] * res; sy = tabdon[succ(int, a + cb)]; - cb = cb + 2; + cb += 2; ix = tabdon[a + cb] * res; iy = tabdon[succ(int, a + cb)]; - cy = cy + 1; - } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) - || (cy > ib))); - if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) + ++cy; + } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); - { + if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) { num = cy - 1; return; } + L1: crep = 997; } void st7(int ob) { - crep = 183; - if ((ob == 116) || (ob == 144)) crep = 104; - if ((ob == 126) || (ob == 111)) crep = 108; - if (ob == 132) crep = 111; - if (ob == 142) crep = 112; - if (crep == 183) st4(ob); + switch (ob) { + case 116: + case 144: + crep = 104; + break; + case 126: + case 111: + crep = 108; + break; + case 132: + crep = 111; + break; + case 142: + crep = 112; + break; + default: + crep = 183; + st4(ob); + } } void treg(int ob) { @@ -698,11 +760,12 @@ void treg(int ob) { mdes = caff; caff = ob; - if (((caff > 29) && (caff < 33)) || (caff == 144) || - (caff == 147) || (caff == 149) || (msg[4] == sregarder)) { + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == sregarder)) { afdes(0); - if ((caff > 29) && (caff < 33)) repon(2, caff); - else repon(2, (caff + 400)); + if ((caff > 29) && (caff < 33)) + repon(2, caff); + else + repon(2, (caff + 400)); tkey1(true); caff = mdes; msg[3] = 0; @@ -716,7 +779,8 @@ void treg(int ob) { void avpoing(int &ob) { crep = 999; - if (s.derobj != 0) ajjer(s.derobj); + if (s.derobj != 0) + ajjer(s.derobj); if (crep != 139) { modobj(ob + 400); s.derobj = ob; @@ -728,7 +792,8 @@ void rechai(int &ch) { int cx; cx = s.mlieu; - if (s.mlieu == 16) cx = 14; + if (s.mlieu == 16) + cx = 14; ch = tabdon[achai + (cx * 7) + pred(int, num)]; } @@ -737,7 +802,7 @@ void t23coul(int &l) { cherjer(143, d); l = 14; - if (! d) { + if (!d) { crep = 1512; tperd(); } @@ -750,17 +815,17 @@ void maivid() { void st13(int ob) { if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || - (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || - (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || - (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || - (ob == 150) || (ob == 152)) crep = 999; - else crep = 105; + (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || + (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || + (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || + (ob == 150) || (ob == 152)) + crep = 999; + else + crep = 105; } void aldepl() { - int dummy; - - dummy = Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); + Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4f2cadef74..82b8ad37fd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -129,6 +129,11 @@ void deline(int num, char *l , int &tl) { byte ps, k; bool the_end; + if (num < 0) { + warning("deline: num < 0! Skipping"); + return; + } + /* DETEX */ /*debug(' => DeLine');*/ delig = ""; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 2ee26a9392..f478fc0d39 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -163,7 +163,8 @@ void tsitu() } if (msg[3] == MENU_MOVE) fctMove(); - if (msg[3] == discut) tparler(); //Translation: talk + if (msg[3] == MENU_DISCUSS) + fctDiscuss(); if (msg[3] == invent) tsprendre(); //Translation: inventory/take if (msg[4] == OPCODE_ATTACH) fctAttach(); @@ -213,7 +214,8 @@ void tsitu() } if (msg[4] == sfouiller) tsfouiller();//Translation: search if (msg[4] == slire) tslire(); //Translation: read - if (msg[4] == sposer) tposer(); //Translation: put + if (msg[4] == OPCODE_PUT) + fctPut(); if (msg[4] == sregarder) tsregarder();//Translation: look cache = false; L1: diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 7a3249dee0..e8f9282df3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -136,11 +136,10 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, OPCODE_TURN = 0x315}; -enum verbs2 {OPCODE_HIDE_SELF = 0x401}; +enum verbs2 {OPCODE_HIDE_SELF = 0x401, OPCODE_PUT = 0x404}; const int sfouiller = 0x402; const int slire = 0x403; -const int sposer = 0x404; const int sregarder = 0x405; const int max_patt = 20; -- cgit v1.2.3 From 3904af5306cdd88247165f77b4b98f5909b2f902 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 00:33:48 +0100 Subject: MORTEVIELLE: Rename some more variables and functions --- engines/mortevielle/actions.cpp | 45 ++++++++++++++++++++-------------------- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/graphics.h | 2 +- engines/mortevielle/mor.cpp | 18 ++++++++-------- engines/mortevielle/mor.h | 2 +- engines/mortevielle/mor2.cpp | 26 +++++++++++------------ engines/mortevielle/prog.cpp | 12 ++++++----- engines/mortevielle/var_mor.cpp | 6 +++--- engines/mortevielle/var_mor.h | 6 +++--- 9 files changed, 61 insertions(+), 58 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 66215170ce..975992ee2a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -621,7 +621,6 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - int quel; bool entre; char st[1410]; Common::String str_; @@ -669,8 +668,8 @@ void fctPlace() { repon(2, 165); maivid(); parole(6, -9, 1); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); - if (quel == 1) { + int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + if (answer== 1) { deline(582, st, tay); i = Alert::show(delig, 1); tesok = false; @@ -682,7 +681,7 @@ void fctPlace() { clsf3(); showMouse(); tinke(); - pendule(); + drawClock(); if (ipers != 0) affper(ipers); else @@ -745,8 +744,6 @@ void fctPlace() { * @remarks Originally called 'ttourner' */ void fctTurn() { - int quel; - if (caff > 99) { crep = 149; return; @@ -762,8 +759,8 @@ void fctTurn() { if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); - if (quel == 1) + int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + if (answer == 1) g_vm->_endGame = true; else crep = 168; @@ -772,8 +769,8 @@ void fctTurn() { repon(2, 175); clsf3(); parole(6, -9, 1); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); - if (quel == 1) { + int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + if (answer == 1) { s.mlieu = 16; affrep(); } else @@ -1137,7 +1134,7 @@ void fctEnter() { * @remarks Originally called 'tdormir' */ void fctSleep() { - int z, j, h, m, quel; + int z, j, h, m; if ((s.mlieu > 15) && (s.mlieu < 26)) { crep = 148; @@ -1156,6 +1153,8 @@ void fctSleep() { ecrf2(); ecr2(g_vm->getString(S_WANT_TO_WAKE_UP)); calch(j, h, m); + + int answer; do { if (h < 8) { s.conf = s.conf - (s.conf / 20); @@ -1170,9 +1169,9 @@ void fctSleep() { if (h > 23) h = 0; tinke(); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); + answer = Alert::show(g_vm->getString(S_YES_NO), 1); anyone = false; - } while (!(quel == 1)); + } while (!(answer == 1)); crep = 998; num = 0; } @@ -1240,6 +1239,8 @@ void fctWait() { mpers = 0; clsf3(); + + int answer; do { ++jh; tinke(); @@ -1257,8 +1258,8 @@ void fctWait() { return; } repon(2, 102); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); - } while (!(quel == 2)); + answer = Alert::show(g_vm->getString(S_YES_NO), 1); + } while (!(answer == 2)); crep = 998; if (!anyone) tinke(); @@ -1472,7 +1473,7 @@ void fctDiscuss() { showMouse(); affper(ipers); tinke(); - pendule(); + drawClock(); affrep(); /* chech;*/ tmlieu(s.mlieu); @@ -1551,7 +1552,7 @@ void MortevielleEngine::endGame() { * @remarks Originally called 'tencore' */ void MortevielleEngine::loseGame() { - int quel; + int answer; clsf2(); musique(0); @@ -1562,12 +1563,12 @@ void MortevielleEngine::loseGame() { vh = 10; vm = 0; vj = 0; - min = 0; - heu = 10; - jou = 0; + _minute = 0; + _hour = 10; + _day = 0; repon(2, 180); - quel = Alert::show(g_vm->getString(S_YES_NO), 1); - _quitGame = (quel != 1); + answer = Alert::show(g_vm->getString(S_YES_NO), 1); + _quitGame = (answer != 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 1c0a4fa0a3..e26901bc8e 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1098,7 +1098,7 @@ int ScreenSurface::getStringWidth(const Common::String &s) { return s.size() * charWidth; } -void ScreenSurface::droite(int x, int y, int xx, int yy, int coul) { +void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { int step, i; float a, b; float xr, yr, xro, yro; diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 1aab4cf34b..28a9d64b7c 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -92,7 +92,7 @@ public: void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); int getStringWidth(const Common::String &s); - void droite(int x, int y, int xx, int yy, int coul); + void drawLine(int x, int y, int xx, int yy, int coul); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index bf9a480af7..a4283407c5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -618,7 +618,7 @@ void chlm(int &per) { if (per == 2) per = 128; } -void pendule() { +void drawClock() { const int cv[3][13] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 }, @@ -638,30 +638,30 @@ void pendule() { co = 0; else co = 1; - if (min == 0) - g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); + if (_minute == 0) + g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); else - g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); + g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); - h = heu; + h = _hour; if (h > 12) h -= 12; if (h == 0) h = 12; - g_vm->_screenSurface.droite(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); + g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); showMouse(); g_vm->_screenSurface.putxy(568, 154); - if (heu > 11) + if (_hour > 11) g_vm->_screenSurface.writeg("PM ", 1); else g_vm->_screenSurface.writeg("AM ", 1); g_vm->_screenSurface.putxy(550, 160); - if ((jou >= 0) && (jou <= 8)) { + if ((_day >= 0) && (_day <= 8)) { Common::String tmp = g_vm->getString(S_DAY); - tmp.insertChar((char)(jou + 49), 0); + tmp.insertChar((char)(_day + 49), 0); g_vm->_screenSurface.writeg(tmp, 1); } } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 22879246f6..0351bd0b7c 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -72,7 +72,7 @@ extern void cpl5(int &p); extern void cpl6(int &p); extern void person(); extern void chlm(int &per); -extern void pendule(); +extern void drawClock(); /************* * NIVEAU 11 * *************/ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 73259aa7a0..9dcbb85b0e 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -58,8 +58,8 @@ void tinke() { anyone = false; calch(j, h, m); - if (j != jou) { - jou = j; + if (j != _day) { + _day = j; cx = 0; do { ++cx; @@ -68,10 +68,10 @@ void tinke() { nbrep[cx] = 0; } while (!(cx == 8)); } - if ((h > heu) || ((h == 0) && (heu == 23))) { - heu = h; - min = 0; - pendule(); + if ((h > _hour) || ((h == 0) && (_hour == 23))) { + _hour = h; + _minute = 0; + drawClock(); cf = 0; for (cx = 1; cx <= 10; cx ++) { if (s.pourc[cx] == '*') @@ -96,9 +96,9 @@ void tinke() { stpou += d6; stpou += d4; } - if (m > min) { - min = 30; - pendule(); + if (m > _minute) { + _minute = 30; + drawClock(); } if (y_s < 12) return; @@ -110,16 +110,16 @@ void tinke() { t = ti1; cf = s.conf; if ((cf > 33) && (cf < 66)) - t = t - (t / 3); + t -= (t / 3); if (cf > 65) - t = t - ((t / 3) * 2); + t -= ((t / 3) * 2); nh = readclock(); if ((nh - mh) > t) { am = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); - jh = jh + ((nh - mh) / t); + jh += ((nh - mh) / t); mh = nh; switch (li) { case 1: @@ -516,7 +516,7 @@ void t1sama() { //Entering manor premtet(); sparl(0, 140); dessine_rouleau(); - pendule(); + drawClock(); showMouse(); s.mlieu = 0; affrep(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index f478fc0d39..e6fd9b7f45 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -46,7 +46,7 @@ void change_gd(int ngd) { showMouse(); dessine_rouleau(); tinke(); - pendule(); + drawClock(); if (ipers != 0) affper(ipers); else person(); clsf2(); @@ -122,7 +122,7 @@ void MortevielleEngine::gameLoaded() { } person(); tinke(); - pendule(); + drawClock(); afdes(0); repon(2, crep); clsf3(); @@ -254,9 +254,11 @@ void theure() { vj = vj / 48; vm = vh % 2; vh = vh / 2; - heu = vh; - if (vm == 1) min = 30; - else min = 0; + _hour = vh; + if (vm == 1) + _minute = 30; + else + _minute = 0; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0caadadbff..6f88d8db9a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -127,10 +127,10 @@ int x, gd, /* Gd = graph device */ hdb, hfb, - heu, - jou, + _hour, + _day, key, - min, + _minute, num, max, res, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index e8f9282df3..f5cd3afdc3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -276,10 +276,10 @@ extern int x, gd, /* Gd = graph device */ hdb, hfb, - heu, - jou, + _hour, + _day, key, - min, + _minute, num, max, res, -- cgit v1.2.3 From a54dfa48457750a22d744beabe5d6f9e12542621 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 18:51:44 +0100 Subject: MORTEVIELLE: Some more code formatting, rename sonoff --- engines/mortevielle/dialogs.cpp | 12 +- engines/mortevielle/graphics.cpp | 4 +- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/level15.cpp | 54 ++++----- engines/mortevielle/menu.cpp | 87 ++++++++------ engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mouse.cpp | 18 +-- engines/mortevielle/outtext.cpp | 141 +++++++++++----------- engines/mortevielle/outtext.h | 2 - engines/mortevielle/ovd1.cpp | 32 ++--- engines/mortevielle/parole.cpp | 231 ++++++++++++++++++++---------------- engines/mortevielle/parole2.cpp | 41 ++++--- engines/mortevielle/prog.cpp | 51 ++++---- engines/mortevielle/saveload.cpp | 5 +- engines/mortevielle/taffich.cpp | 27 +++-- engines/mortevielle/var_mor.cpp | 2 +- engines/mortevielle/var_mor.h | 2 +- 17 files changed, 378 insertions(+), 335 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 89658452e8..9f90f4c48a 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -258,7 +258,7 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String i = 1; x = coldep; - for (l = 1; l <= nbcase; l ++) { + for (l = 1; l <= nbcase; ++l) { str[l] = ""; do { ++i; @@ -323,7 +323,7 @@ bool Ques::show() { y = 35; tmax = 0; memk = 1; - for (j = prem; j <= der; j ++) { + for (j = prem; j <= der; ++j) { deline(j, st, tay); if (tay > tmax) tmax = tay; @@ -332,7 +332,7 @@ bool Ques::show() { ++memk; y += 8; } - for (j = 1; j <= succ(int, der - prem); j++) { + for (j = 1; j <= succ(int, der - prem); ++j) { rectangle &with = coor[j]; with.x1 = 45 * res; @@ -364,7 +364,7 @@ bool Ques::show() { while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; if (coor[k].etat) { if ((memk != 0) && (memk != k)) { -// for (j = 1; j <= tmax; j ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[memk][j]; strncpy(st, chaines[memk].c_str(), tmax); // @@ -372,7 +372,7 @@ bool Ques::show() { afftex(st, 100, 27 + memk * 8, 100, 1, 0); } if (memk != k) { -// for (j = 1; j <= tmax; j ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[k][j]; strncpy(st, chaines[k].c_str(), tmax); st[1 + tmax] = '$'; @@ -380,7 +380,7 @@ bool Ques::show() { memk = k; } } else if (memk != 0) { -// for (j = 1; j <= tmax; j ++) +// for (j = 1; j <= tmax; ++j) // st[j] = chaines[memk][j]; strncpy(st, chaines[memk].c_str(), tmax); st[1 + tmax] = '$'; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e26901bc8e..acc2bb0d34 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -45,11 +45,11 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { byte egaPalette[64 * 3]; byte *p = &egaPalette[0]; - for (int i = 0; i < 64; i++) { + for (int i = 0; i < 64; ++i) { *p++ = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; *p++ = (i >> 1 & 1) * 0xaa + (i >> 4 & 1) * 0x55; *p++ = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; - } + } // Loop through setting palette colours based on the passed indexes for (; size > 0; --size, ++idx) { diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index abf8c26346..bd7ad2c8aa 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -42,7 +42,7 @@ int testou() { switch (ch) { case '\23' : - sonoff = !sonoff; + _soundOff = !_soundOff; break; case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 571abfa18d..d297529470 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -47,54 +47,47 @@ void copcha() { bool dans_rect(rectangle r) { int x, y, c; - bool dans_rect_result; getMousePos(x, y, c); - if ((x > r.x1) && - (x < r.x2) && - (y > r.y1) && - (y < r.y2)) - dans_rect_result = true; - else - dans_rect_result = false; - - return dans_rect_result; + if ((x > r.x1) && (x < r.x2) && (y > r.y1) && (y < r.y2)) + return true; + + return false; } void outbloc(int n, pattern p, t_nhom pal) { - int i, j, ad; - - ad = n * 404 + 0xd700; + int ad = n * 404 + 0xd700; WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); - ad = ad + 4; - for (i = 1; i <= p.tax; i ++) - for (j = 1; j <= p.tay; j ++) + ad += 4; + for (int i = 1; i <= p.tax; ++i) + for (int j = 1; j <= p.tay; ++j) mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; } void writepal(int n) { - int i; t_nhom pal; switch (gd) { case tan: case ega: - case ams : - for (i = 1; i <= 16; i++) { + case ams: + for (int i = 1; i <= 16; ++i) { mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; } break; - case cga : { + case cga: warning("TODO: If this code is needed, resolve the incompatible types"); // pal = palcga[n].a; if (n < 89) palette(palcga[n].p); - for (i = 0; i <= 15; i++) + + for (int i = 0; i <= 15; ++i) outbloc(i, tpt[pal[i].n], pal); - } - break; + break; + default: + break; } } @@ -107,8 +100,10 @@ void pictout(int seg, int dep, int x, int y) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } + if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); + g_vm->_screenSurface.drawPicture(surface, x, y); } @@ -129,16 +124,19 @@ void adzon() { if (!f.open("don.mor")) error("Missing file - don.mor"); + f.read(tabdon, 7 * 256); f.close(); if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); + f.read(&tabdon[fleche], 1 * 1916); f.close(); if (!f.open("dec.mor")) error("Missing file - dec.mor"); + f.read(&mem[0x73a2 * 16 + 0], 1 * 1664); f.close(); } @@ -147,14 +145,12 @@ void adzon() { * Returns the offset within the compressed image data resource of the desired image */ int animof(int ouf, int num) { - int nani, aux; - - int animof_result; - nani = mem[adani * 16 + 1]; - aux = num; + int nani = mem[adani * 16 + 1]; + int aux = num; if (ouf != 1) aux += nani; - animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); + + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); return animof_result; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 97ba083d77..b585177f19 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,9 +48,9 @@ void Menu::menut(int no, Common::String nom) { byte l = lo(no); Common::String s = nom; - if (! tesok) { + if (! tesok) g_vm->quitGame(); - } + while (s.size() < 20) s += ' '; @@ -74,6 +74,8 @@ void Menu::menut(int no, Common::String nom) { case MENU_DISCUSS: _dis[l] = s; break; + default: + break; } } @@ -86,14 +88,13 @@ void Menu::disableMenuItem(int no) { byte l = lo(no); switch (h) { - case invent : { + case invent: if (l > 6) { _inv[l].setChar('<', 0); _inv[l].setChar('>', 21); } else _inv[l].setChar('*', 0); - } - break; + break; case MENU_MOVE: _dep[l].setChar('*', 0); break; @@ -106,6 +107,8 @@ void Menu::disableMenuItem(int no) { case MENU_DISCUSS: _dis[l].setChar('*', 0); break; + default: + break; } } @@ -135,6 +138,8 @@ void Menu::enableMenuItem(int no) { case MENU_DISCUSS: _dis[l].setChar(' ', 0); break; + default: + break; } } @@ -161,7 +166,7 @@ void Menu::menu_aff() { x = col; do { // One line after the other msk = 0x80; - for (pt = 0; pt <= 7; pt ++) { + for (pt = 0; pt <= 7; ++pt) { if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); @@ -201,30 +206,30 @@ void Menu::invers(int ix) { g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { - case 1 : + case 1: s = _inv[lo(msg4)]; break; - case 2 : + case 2: s = _dep[lo(msg4)]; break; - case 3 : + case 3: s = _act[lo(msg4)]; break; - case 4 : + case 4: s = _self[lo(msg4)]; break; - case 5 : + case 5: s = _dis[lo(msg4)]; break; - case 6 : + case 6: s = g_vm->getString(S_SAVE_LOAD + lo(msg4)); break; - case 7 : + case 7: s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + lo(msg4)); break; - case 8 : + case 8: if (lo(msg4) == 1) { s = g_vm->getString(S_RESTART); } else { @@ -233,6 +238,8 @@ void Menu::invers(int ix) { s += (char)(47 + lo(msg4)); } break; + default: + break; } if ((s[0] != '*') && (s[0] != '<')) g_vm->_screenSurface.writeg(s, ix); @@ -241,17 +248,17 @@ void Menu::invers(int ix) { } void Menu::util(int x, int y) { - int ymx, dxcar, xmn, xmx, ix; - /* debug('util'); */ - ymx = (don[msg3][4] << 3) + 16; - dxcar = don[msg3][3]; - xmn = (don[msg3][1] << 2) * res; + int ymx = (don[msg3][4] << 3) + 16; + int dxcar = don[msg3][3]; + int xmn = (don[msg3][1] << 2) * res; + + int ix; if (res == 1) ix = 5; else ix = 3; - xmx = dxcar * ix * res + xmn + 2; + int xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); if (ix != msg4) { @@ -296,37 +303,37 @@ void Menu::menuDown(int ii) { do { cx = succ(int, cx); switch (ii) { - case 1 : + case 1: if (_inv[cx][0] != '*') g_vm->_screenSurface.writeg(_inv[cx], 4); break; - case 2 : + case 2: if (_dep[cx][0] != '*') g_vm->_screenSurface.writeg(_dep[cx], 4); break; - case 3 : + case 3: if (_act[cx][0] != '*') g_vm->_screenSurface.writeg(_act[cx], 4); break; - case 4 : + case 4: if (_self[cx][0] != '*') g_vm->_screenSurface.writeg(_self[cx], 4); break; - case 5 : + case 5: if (_dis[cx][0] != '*') g_vm->_screenSurface.writeg(_dis[cx], 4); break; - case 6 : + case 6: g_vm->_screenSurface.writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); break; - case 7 : { + case 7: { Common::String s = g_vm->getString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); g_vm->_screenSurface.writeg(s, 4); + } break; - } - case 8 : + case 8: if (cx == 1) g_vm->_screenSurface.writeg(g_vm->getString(S_RESTART), 4); else { @@ -336,6 +343,8 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.writeg(s, 4); } break; + default: + break; } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (!(cx == nb_lig)); @@ -397,12 +406,14 @@ void Menu::mdn() { xprec = x; yprec = y; } - tes = (y < 11) && ((x >= (28 * res) && x <= (28 * res + 24)) - || (x >= (76 * res) && x <= (76 * res + 24)) - || ((x > 124 * res) && (x < 124 * res + 24)) - || ((x > 172 * res) && (x < 172 * res + 24)) - || ((x > 220 * res) && (x < 220 * res + 24)) - || ((x > 268 * res) && (x < 268 * res + 24))); + + tes = (y < 11) + && ((x >= (28 * res) && x <= (28 * res + 24)) + || (x >= (76 * res) && x <= (76 * res + 24)) + || ((x > 124 * res) && (x < 124 * res + 24)) + || ((x > 172 * res) && (x < 172 * res + 24)) + || ((x > 220 * res) && (x < 220 * res + 24)) + || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { if (x < 76 * res) ix = invent; @@ -468,10 +479,10 @@ void Menu::initMenu() { // Ask to swap floppy dem2(); - for (i = 1; i <= 8; i ++) + for (i = 1; i <= 8; ++i) _inv[i] = "* "; _inv[7] = "< -*-*-*-*-*-*-*-*-*- "; - for (i = 1; i <= 7; i ++) + for (i = 1; i <= 7; ++i) _dep[i] = "* "; i = 1; do { @@ -492,7 +503,7 @@ void Menu::initMenu() { } i = succ(int, i); } while (!(i == 22)); - for (i = 1; i <= 8; i ++) { + for (i = 1; i <= 8; ++i) { _disc[i] = 0x500 + i; if (i < 8) _depl[i] = 0x200 + i; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 82eb1179f1..4112073cde 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -148,7 +148,7 @@ Common::ErrorCode MortevielleEngine::initialise() { initMouse(); init_lieu(); - sonoff = false; + _soundOff = false; f2_all = false; teskbd(); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d724fe652b..44b254fe41 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -103,7 +103,7 @@ void hideMouse() { } while (!(k >= 5)); break; case ams: - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { port[0x3dd] = 1 << i; k = 0; j = p_o_s; @@ -142,8 +142,8 @@ void hideMouse() { break; case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) + for (i = 0; i <= 5; ++i) { + for (k = 0; k <= 3; ++k) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } @@ -152,7 +152,7 @@ void hideMouse() { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } @@ -194,7 +194,7 @@ void showMouse() { } while (!(k >= 5)); break; case ams: - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { j = p_o_s; imp = odd(y_s); port[0x3de] = i; @@ -229,8 +229,8 @@ void showMouse() { break; case her: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; i ++) { - for (k = 0; k <= 3; k ++) + for (i = 0; i <= 5; ++i) { + for (k = 0; k <= 3; ++k) s_s[i][k] = READ_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j]); j += 80; } @@ -239,7 +239,7 @@ void showMouse() { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { - for (i = 0; i <= 3; i ++) { + for (i = 0; i <= 3; ++i) { s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]); s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); } @@ -415,7 +415,7 @@ void moveMouse(bool &funct, char &key) { cy = 8; break; case '\23': - sonoff = !sonoff; + _soundOff = !_soundOff; return; break; case '\26': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 82b8ad37fd..95ccc3baef 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -79,44 +79,47 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { oct = t_mot[idx]; oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { - idx = idx + 1; + ++idx; oct = oct << (5 - pt); - pt = pt + 11; + pt += 11; oct = oct | ((uint)t_mot[idx] >> pt); } else { - pt = pt - 5; + pt -= 5; oct = (uint)oct >> pt; } switch (oct) { - case 11 : { + case 11: c = '$'; the_end = true; - } - break; + break; case 30: - case 31 : { + case 31: ocd = t_mot[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { - idx = idx + 1; + ++idx; ocd = ocd << (5 - pt); - pt = pt + 11; + pt += 11; ocd = ocd | ((uint)t_mot[idx] >> pt); } else { - pt = pt - 5; + pt -= 5; ocd = (uint)ocd >> pt; } - if (oct == 30) c = chr(tab30[ocd]); - else c = chr(tab31[ocd]); + + if (oct == 30) + c = chr(tab30[ocd]); + else + c = chr(tab31[ocd]); + if (c == '\0') { the_end = true; c = '#'; } - } - break; + break; default: c = chr(tabdr[oct]); + break; } } /* 5-8 */ @@ -124,94 +127,88 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { * Decode and extract the line with the given Id */ void deline(int num, char *l , int &tl) { - int i, j, ts; - char let; - byte ps, k; - bool the_end; - if (num < 0) { warning("deline: num < 0! Skipping"); return; } - /* DETEX */ - /*debug(' => DeLine');*/ + // DETEX delig = ""; - ts = t_rec[num].indis; - ps = t_rec[num].point; - i = ts; + int ts = t_rec[num].indis; + byte ps = t_rec[num].point; + int i = ts; tl = 1; - j = 1; - k = ps; - the_end = false; + int j = 1; + byte k = ps; + bool endFl = false; + char let; do { - cinq_huit(let, i, k, the_end); + cinq_huit(let, i, k, endFl); l[j] = let; - if (j < 254) delig = delig + let; - j = j + 1; - } while (!the_end); + if (j < 254) + delig += let; + ++j; + } while (!endFl); tl = j - 1; if (tl < 255) - delig.deleteLastChar(); // Remove trailing '$' -} /* DETEX */ + // Remove trailing '$' + delig.deleteLastChar(); +} void afftex(char *ch, int x, int y, int dx, int dy, int typ); static int l_motsuiv(int p, char *ch, int &tab) { - int c; + int c = p; - int l_motsuiv_result; - c = p; while ((ch[p] != ' ') && (ch[p] != '$') && (ch[p] != '@')) ++p; - l_motsuiv_result = tab * (p - c); - return l_motsuiv_result; + + return tab * (p - c); } void afftex(char *ch, int x, int y, int dx, int dy, int typ) { bool the_end; - int xf, yf; - int xc, yc; - int tab, p; + int tab; Common::String s; int i, j; /* debug(' .. Afftex');*/ g_vm->_screenSurface.putxy(x, y); - if (res == 1) tab = 10; - else tab = 6; - dx = dx * 6; - dy = dy * 6; - xc = x; - yc = y; - xf = x + dx; - yf = y + dy; - p = 1; + if (res == 1) + tab = 10; + else + tab = 6; + dx *= 6; + dy *= 6; + int xc = x; + int yc = y; + int xf = x + dx; + int yf = y + dy; + int p = 1; the_end = (ch[p] == '$'); s = ""; - while (! the_end) { + while (!the_end) { switch (ch[p]) { - case '@' : { + case '@': g_vm->_screenSurface.writeg(s, typ); s = ""; - p = p + 1; + ++p; xc = x; - yc = yc + 6; + yc += 6; g_vm->_screenSurface.putxy(xc, yc); - } - break; - case ' ' : { - s = s + ' '; - xc = xc + tab; - p = p + 1; + break; + case ' ': + s += ' '; + xc += tab; + ++p; if (l_motsuiv(p, ch, tab) + xc > xf) { g_vm->_screenSurface.writeg(s, typ); s = ""; xc = x; - yc = yc + 6; + yc += 6; if (yc > yf) { do { ; @@ -222,26 +219,24 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { do { g_vm->_screenSurface.putxy(j, i); g_vm->_screenSurface.writeg(" ", 0); - j = j + 6; + j += 6; } while (!(j > xf)); - i = i + 6; + i += 6; } while (!(i > yf)); yc = y; } g_vm->_screenSurface.putxy(xc, yc); } - } - break; - case '$' : { + break; + case '$': the_end = true; g_vm->_screenSurface.writeg(s, typ); - } - break; - default: { - s = s + ch[p]; - p = p + 1; - xc = xc + tab; - } + break; + default: + s += ch[p]; + ++p; + xc += tab; + break; } /* case */ } } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index ad69ca9109..470479a81b 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -34,9 +34,7 @@ namespace Mortevielle { extern Common::String delig; -//static void cinq_huit(char &c, int &ind, byte &pt, bool &the_end); extern void deline(int num , char *l , int &tl); -//static int l_motsuiv(int p, char *ch, int &tab); extern void afftex(char *ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 33f879d61b..0177d3e5c1 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -55,7 +55,6 @@ void dem2() { void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx - int i, j, k; Common::File fb; // byte values byte b; @@ -67,8 +66,8 @@ void charpal() { if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); - for (i = 0; i <= 90; ++i) { - for (j = 1; j <= 16; ++j) { + for (int i = 0; i <= 90; ++i) { + for (int j = 1; j <= 16; ++j) { tabpal[i][j].x = f.readByte(); tabpal[i][j].y = f.readByte(); } @@ -78,9 +77,9 @@ void charpal() { if (!fb.open("cxx.mor")) error("Missing file - cxx.mor"); - for (j = 0; j <= 90; j ++) { + for (int j = 0; j <= 90; ++j) { palcga[j].p = fb.readByte(); - for (i = 0; i <= 15; i ++) { + for (int i = 0; i <= 15; ++i) { nhom &with = palcga[j].a[i]; b = fb.readByte(); @@ -90,28 +89,26 @@ void charpal() { } } palcga[10].a[9] = palcga[10].a[5]; - for (j = 0; j <= 14; j ++) { + for (int j = 0; j <= 14; ++j) { tpt[j].tax = fb.readByte(); tpt[j].tay = fb.readByte(); - for (i = 1; i <= 20; i ++) - for (k = 1; k <= 20; k ++) + for (int i = 1; i <= 20; ++i) + for (int k = 1; k <= 20; ++k) tpt[j].des[i][k] = fb.readByte(); } fb.close(); } void chartex() { - int i; Common::File f; char s[1410]; /* debug('o3 chartex'); */ - i = 0; if (!f.open("TXX.INP")) error("Missing file - TXX.INP"); assert(f.size() <= (maxti * 2)); - for (i = 0; i < f.size() / 2; ++i) + for (int i = 0; i < f.size() / 2; ++i) t_mot[i] = f.readUint16LE(); f.close(); @@ -120,6 +117,7 @@ void chartex() { error("Missing file - TXX.NTP"); assert(f.size() <= (maxtd * 3)); + int i; for (i = 0; i < (f.size() / 3); ++i) { t_rec[i].indis = f.readSint16LE(); t_rec[i].point = f.readByte(); @@ -171,7 +169,9 @@ void music() { /* debug('o3 music'); */ - if (sonoff) return; + if (_soundOff) + return; + rech_cfiec = true; if (!fic.open("mort.img")) @@ -190,10 +190,11 @@ void music() { do { fin = keypressed(); g_vm->_soundManager.musyc(tbi, 9958 , tempo_mus); - k = k + 1; + ++k; fin = fin | keypressed() | (k >= 5); } while (!fin); - while (keypressed()) ch = get_ch(); // input >> kbd >> ch; + while (keypressed()) + ch = get_ch(); // input >> kbd >> ch; } @@ -238,7 +239,8 @@ void suite() { caff = 51; taffich(); teskbd(); - if (newgd != gd) gd = newgd; + if (newgd != gd) + gd = newgd; hirs(); dessine(ades, 0, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 70bbd72e06..02f298e8f6 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -37,7 +37,7 @@ void spfrac(int wor) { if ((typlec == 0) && (c3.code != 9)) if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || ((c3.code < 5) && ((c3.rep != 19) && (c3.rep != 22) && (c3.rep != 4) && (c3.rep != 9))))) { - c3.rep = c3.rep + 1; + ++c3.rep; } c3.freq = ((uint)wor >> 6) & 7; @@ -65,21 +65,19 @@ void charg_car() { c3.code = 4; } else { switch (int_) { - case 60 : { + case 60: c3.val = 32; /* " " */ c3.code = 9; - } - break; - case 61 : { + break; + case 61: c3.val = 46; /* "." */ c3.code = 9; - } - break; - case 62 : { + break; + case 62: c3.val = 35; /* "#" */ c3.code = 9; - } - break; + default: + break; } } @@ -90,7 +88,7 @@ void charg_car() { void entroct(byte o) { mem[adtroct * 16 + ptr_oct] = o; - ptr_oct = ptr_oct + 1; + ++ptr_oct; } void veracf(byte b) { @@ -98,30 +96,26 @@ void veracf(byte b) { } void cctable(tablint &t) { - int k; float tb[257]; - tb[0] = 0; - for (k = 0; k <= 255; k ++) { + for (int k = 0; k <= 255; ++k) { tb[k + 1] = addfix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } void regenbruit() { - int i, j; - - i = offsetb3 + 8590; - j = 0; + int i = offsetb3 + 8590; + int j = 0; do { t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); - i = i + 2; - j = j + 1; + i += 2; + ++j; } while (!(i >= offsetb3 + 8790)); } - void charge_son() { +void charge_son() { Common::File f; if (!f.open("sonmus.mor")) @@ -133,7 +127,7 @@ void regenbruit() { f.close(); } - void charge_phbruit() { +void charge_phbruit() { Common::File f; if (!f.open("phbrui.mor")) @@ -145,7 +139,7 @@ void regenbruit() { f.close(); } - void charge_bruit() { +void charge_bruit() { Common::File f; int i; @@ -153,54 +147,67 @@ void regenbruit() { error("Missing file - bruits"); f.read(&mem[adbruit * 16 + 0], 250); - for (i = 0; i <= 19013; i ++) mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; + for (i = 0; i <= 19013; ++i) + mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; f.read(&mem[adbruit1 * 16 + offsetb1], 149); f.close(); } - void trait_car() { +void trait_car() { byte d3; int d2, i; switch (c2.code) { - case 9 : - if (c2.val != ord('#')) for (i = 0; i <= c2.rep; i ++) entroct(c2.val); + case 9: + if (c2.val != ord('#')) + for (i = 0; i <= c2.rep; ++i) + entroct(c2.val); break; - case 5: - case 6 : { - if (c2.code == 6) d3 = tabdph[(c2.val - 14) << 1]; - else d3 = null; + case 6: + if (c2.code == 6) + d3 = tabdph[(c2.val - 14) << 1]; + else + d3 = null; if (c1.code >= 5) { veracf(c2.acc); if (c1.code == 9) { entroct(4); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(22); } } + switch (c2.rep) { - case 0 : { + case 0: entroct(0); entroct(c2.val); - if (d3 == null) if (c3.code == 9) entroct(2); - else entroct(4); - else if (c3.code == 9) entroct(0); - else entroct(1); - } - break; + if (d3 == null) + if (c3.code == 9) + entroct(2); + else + entroct(4); + else if (c3.code == 9) + entroct(0); + else + entroct(1); + break; case 4: case 5: - case 6 : { + case 6: if (c2.rep != 4) { i = c2.rep - 5; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } @@ -213,18 +220,19 @@ void regenbruit() { entroct(c2.val); entroct(3); } - } - break; + break; case 7: case 8: - case 9 : { + case 9: if (c2.rep != 7) { i = c2.rep - 8; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } @@ -237,34 +245,37 @@ void regenbruit() { entroct(c2.val); entroct(0); } - } - break; + break; case 1: case 2: - case 3 : { + case 3: if (c2.rep != 1) { i = c2.rep - 2; do { - i = i - 1; + --i; entroct(0); - if (d3 == null) entroct(c2.val); - else entroct(d3); + if (d3 == null) + entroct(c2.val); + else + entroct(d3); entroct(3); } while (!(i < 0)); } entroct(0); entroct(c2.val); - if (c3.code == 9) entroct(0); - else entroct(1); - } + if (c3.code == 9) + entroct(0); + else + entroct(1); + break; + default: + break; + } // switch c2.rep break; - } /* case c2.rep */ - } - break; case 2: - case 3 : { - d3 = c2.code + 5; /* 7 ou 8 => voyelle correspondante */ //Translation: Corresponding vowel + case 3: + d3 = c2.code + 5; // 7 ou 8 => Corresponding vowel if (c1.code > 4) { veracf(c2.acc); if (c1.code == 9) { @@ -274,9 +285,10 @@ void regenbruit() { } } i = c2.rep; + assert(i >= 0); if (i != 0) { do { - i = i - 1; + --i; entroct(0); entroct(d3); entroct(3); @@ -289,43 +301,47 @@ void regenbruit() { entroct(c2.val); } else { entroct(4); - if (c3.val == 4) entroct(3); - else entroct(c3.val); + if (c3.val == 4) + entroct(3); + else + entroct(c3.val); entroct(c2.val); } - } - break; + break; case 0: - case 1 : { + case 1: veracf(c2.acc); switch (c3.code) { - case 2 : + case 2: d2 = 7; break; - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 10; - } /* case c3.code */ + break; + } // switch c3.code d2 = d2 * 26 + c2.val; - if (tnocon[d2] == 0) d3 = 2; - else d3 = 6; + if (tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; if (c2.rep >= 5) { c2.rep = c2.rep - 5; - d3 = 8 - d3; /* echange 2 et 6 */ //Translation: swap 2 and 6 + d3 = 8 - d3; // Swap 2 and 6 } if (c2.code == 0) { i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(d3); entroct(c2.val); entroct(3); @@ -341,7 +357,7 @@ void regenbruit() { i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(d3); entroct(c2.val); entroct(4); @@ -355,33 +371,40 @@ void regenbruit() { } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 7; - } /* case c3.code */ - if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) c2.val = c2.val + 1; - if ((c2.val == 17) || (c2.val == 18)) c2.val = 16; + break; + } // switch c3.code + if (d2 == 4) + d2 = 3; + + if (intcon[c2.val] != 0) + ++c2.val; + + if ((c2.val == 17) || (c2.val == 18)) + c2.val = 16; + entroct(4); entroct(d2); entroct(c2.val); } - } - break; - case 4 : { + + break; + case 4: veracf(c2.acc); i = c2.rep; if (i != 0) { do { - i = i - 1; + --i; entroct(2); entroct(c2.val); entroct(3); @@ -397,27 +420,35 @@ void regenbruit() { } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { veracf(c3.acc); switch (c3.code) { - case 3 : + case 3: d2 = 8; break; - case 6 : + case 6: d2 = tabdph[(c3.val - 14) << 1]; break; - case 5 : + case 5: d2 = c3.val; break; default: d2 = 7; - } /* case c3.code */ - if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) c2.val = c2.val + 1; + break; + } // switch c3.code + + if (d2 == 4) + d2 = 3; + + if (intcon[c2.val] != 0) + ++c2.val; + entroct(4); entroct(d2); entroct(tabdbc[((c2.val - 26) << 1) + 1]); } - } - break; - } /* case c2.code */ + + break; + default: + break; + } // switch c2.code } } // End of namespace Mortevielle diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index e0aaf83af0..785e49acaa 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -38,18 +38,14 @@ namespace Mortevielle { void rot_chariot() { c1 = c2; c2 = c3; - { - c3.val = 32; - c3.code = 9; - } + c3.val = 32; + c3.code = 9; } void init_chariot() { - { - c3.rep = 0; - c3.freq = 0; - c3.acc = 0; - } + c3.rep = 0; + c3.freq = 0; + c3.acc = 0; rot_chariot(); rot_chariot(); } @@ -89,38 +85,41 @@ void trait_ph() { void parole(int rep, int ht, int typ) { int savph[501]; - int i; int tempo; + if (_soundOff) + return; - if (sonoff) return; num_ph = rep; haut = ht; typlec = typ; if (typlec != 0) { - for (i = 0; i <= 500; i ++) savph[i] = t_cph[i]; + for (int i = 0; i <= 500; ++i) + savph[i] = t_cph[i]; tempo = tempo_bruit; - } else if (haut > 5) tempo = tempo_f; - else tempo = tempo_m; + } else if (haut > 5) + tempo = tempo_f; + else + tempo = tempo_m; addfix = (float)((tempo - addv[0])) / 256; cctable(tbi); switch (typ) { - case 1 : { + case 1: charge_bruit(); /*if zuul then zzuul(adbruit,0,1095);*/ regenbruit(); - } - break; - case 2 : { + break; + case 2: charge_son(); charge_phbruit(); - } - break; + break; + default: + break; } trait_ph(); g_vm->_soundManager.litph(tbi, typ, tempo); if (typlec != 0) - for (i = 0; i <= 500; i ++) { + for (int i = 0; i <= 500; ++i) { t_cph[i] = savph[i]; mlec = typlec; } diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index e6fd9b7f45..fa83b822d0 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -47,8 +47,10 @@ void change_gd(int ngd) { dessine_rouleau(); tinke(); drawClock(); - if (ipers != 0) affper(ipers); - else person(); + if (ipers != 0) + affper(ipers); + else + person(); clsf2(); clsf3(); _maff = 68; @@ -66,7 +68,6 @@ void MortevielleEngine::gameLoaded() { bool test[3]; char g[8]; - hideMouse(); imen = false; g[1] = 'M'; @@ -129,8 +130,10 @@ void MortevielleEngine::gameLoaded() { _endGame = false; tmlieu(s.mlieu); modinv(); - if (s.derobj != 0) modobj2(s.derobj + 400, test[1], test[2]); - else tesok = test[1] || test[2]; + if (s.derobj != 0) + modobj2(s.derobj + 400, test[1], test[2]); + else + tesok = test[1] || test[2]; showMouse(); } @@ -141,21 +144,22 @@ void tmaj3() { int j, h, m; calch(j, h, m); - if (m == 30) m = 1; - h = h + (j * 24); - m = m + (h * 2); + if (m == 30) + m = 1; + h += j * 24; + m += h * 2; s.heure = chr(m); } -void tsitu() - -{ +void tsitu() { int h, j, m; - if (! col) clsf2(); + if (! col) + clsf2(); syn = false; iesc = false; - if (anyone) goto L1; + if (anyone) + goto L1; if (brt) if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { ctrm = 4; @@ -165,7 +169,8 @@ void tsitu() fctMove(); if (msg[3] == MENU_DISCUSS) fctDiscuss(); - if (msg[3] == invent) tsprendre(); //Translation: inventory/take + if (msg[3] == invent) + tsprendre(); //Translation: inventory/take if (msg[4] == OPCODE_ATTACH) fctAttach(); if (msg[4] == OPCODE_WAIT) @@ -208,15 +213,18 @@ void tsitu() fctLift(); if (msg[4] == OPCODE_TURN) fctTurn(); - if (msg[4] == OPCODE_HIDE_SELF) { //Translation: hide + if (msg[4] == OPCODE_HIDE_SELF) { fctHideSelf(); goto L1; } - if (msg[4] == sfouiller) tsfouiller();//Translation: search - if (msg[4] == slire) tslire(); //Translation: read + if (msg[4] == sfouiller) + tsfouiller();//Translation: search + if (msg[4] == slire) + tslire(); //Translation: read if (msg[4] == OPCODE_PUT) fctPut(); - if (msg[4] == sregarder) tsregarder();//Translation: look + if (msg[4] == sregarder) + tsregarder();//Translation: look cache = false; L1: if (anyone) { @@ -226,7 +234,8 @@ L1: } calch(j, h, m); if ((((h == 12) || (h == 13) || (h == 19)) && (s.mlieu != 10)) || - ((h > 0) && (h < 6) && (s.mlieu != 0))) s.conf = s.conf + 1; + ((h > 0) && (h < 6) && (s.mlieu != 0))) + s.conf = s.conf + 1; if (((s.mlieu < 16) || (s.mlieu > 19)) && (s.mlieu != 23) && (s.mlieu != 0) && (s.derobj != 152) && (!g_vm->_loseGame)) { if ((s.conf > 99) && (h > 8) && (h < 16)) { @@ -251,9 +260,9 @@ L2: void theure() { vj = ord(s.heure); vh = vj % 48; - vj = vj / 48; + vj /= 48; vm = vh % 2; - vh = vh / 2; + vh /= 2; _hour = vh; if (vm == 1) _minute = 30; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c2c43953d0..929b0880f6 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -108,7 +108,8 @@ void SavegameManager::takesav(int n) { sync_save(sz); s = s1; - for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i]; + for (i = 0; i <= 389; ++i) + tabdon[i + acha] = bufcha[i]; // Close the stream delete stream; @@ -140,7 +141,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { hideMouse(); tmaj3(); - for (i = 0; i <= 389; i ++) + for (i = 0; i <= 389; ++i) bufcha[i] = tabdon[i + acha]; s1 = s; if (s1.mlieu == 26) diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 08aaa2a1f1..4da3ef0c32 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -59,7 +59,7 @@ void chardes(Common::String filename, int32 skipSize, int length) { } f.close(); - for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) mem[0x7000 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } @@ -87,7 +87,7 @@ void charani(Common::String filename, int32 skipSize, int length) { } f.close(); - for (int i = remainingSkipSize; i <= length + remainingSkipSize; i ++) + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) mem[0x7314 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; } @@ -95,19 +95,18 @@ void taffich() { byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> - int i, m, a, b, cx, handle, - npal; + int i, m, cx, handle, npal; int32 lgt; int palh, k, j; int alllum[16]; - a = caff; + int a = caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; - b = a; + int b = a; if (_maff == a) return; @@ -193,7 +192,7 @@ void taffich() { a = a - 1; npal = a; - for (cx = 0; cx <= (a - 1); cx ++) + for (cx = 0; cx <= (a - 1); ++cx) lgt = lgt + l[cx]; handle = l[a]; @@ -210,13 +209,15 @@ void taffich() { } chardes(filename, lgt, handle); if (gd == her) { - for (i = 0; i <= 15; i ++) { + for (i = 0; i <= 15; ++i) { palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } - for (i = 0; i <= 15; i ++) { + for (i = 0; i <= 15; ++i) { k = 0; - for (j = 0; j <= 15; j ++) if (alllum[j] > alllum[k]) k = j; + for (j = 0; j <= 15; ++j) + if (alllum[j] > alllum[k]) + k = j; mem[0x7000 * 16 + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } @@ -232,9 +233,9 @@ void taffich() { else if (b == 24) b = 17; else if (b > 15) - b = b - 1; - for (cx = 0; cx <= (b - 1); cx ++) - lgt = lgt + l[cx + 89]; + --b; + for (cx = 0; cx <= (b - 1); ++cx) + lgt += l[cx + 89]; handle = l[b + 89]; filename = "AXX.mor"; } else if (b == 50) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 6f88d8db9a..efd84cca76 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -92,7 +92,7 @@ bool blo, bt7, bh9, - sonoff, + _soundOff, main1, choisi, test0, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index f5cd3afdc3..a77586ca2b 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -242,7 +242,7 @@ extern bool blo, bt7, bh9, - sonoff, + _soundOff, main1, choisi, test0, -- cgit v1.2.3 From 20e61b40d05b35c55038311a1a617b70f0790837 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 21:15:36 +0100 Subject: MORTEVIELLE: Rename Alert functions --- engines/mortevielle/dialogs.cpp | 65 ++++++++++++++++++++--------------------- engines/mortevielle/dialogs.h | 6 ++-- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 9f90f4c48a..991bda4bd4 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -40,21 +40,13 @@ namespace Mortevielle { static const int nligne = 7; -/* -static const int coord[3][4] = { - {0, 0, 0, 0}, - {0, 150, 72, 103}, - {0, 143, 107, 183} -}; -*/ - int Alert::show(const Common::String &msg, int n) { - int coldep, esp, i, nbcase, quoi, ix; + int coldep, esp, i, caseNumb, quoi, ix; Common::String st, chaine; int limit[3][3]; char dumi; Common::String s[3]; - int cx, cy, nbcol, nblig; + int cx, cy, nbcol, lignNumb; bool newaff, test, test1, test2, test3, dum; Common::String cas; @@ -69,14 +61,14 @@ int Alert::show(const Common::String &msg, int n) { dumi = get_ch(); // input >> kbd >> dumi; g_vm->setMouseClick(false); - decod(msg, nbcase, nblig, nbcol, chaine, cas); - sauvecr(50, succ(int, nligne) << 4); + decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); + sauvecr(50, (nligne + 1) << 4); i = 0; if (chaine == "") { - fait_boite(10, 5, nbcol); + drawAlertBox(10, 5, nbcol); } else { - fait_boite(8, 7, nbcol); + drawAlertBox(8, 7, nbcol); i = 0; g_vm->_screenSurface._textPos.y = 70; do { @@ -96,15 +88,15 @@ int Alert::show(const Common::String &msg, int n) { ++i; } while (!(chaine[i] == ']')); } - if (nbcase == 1) + if (caseNumb == 1) esp = nbcol - 40; else - esp = (uint)(nbcol - nbcase * 40) >> 1; + esp = (uint)(nbcol - caseNumb * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); - fait_choix(cas, coldep, nbcase, &s[0], esp); + setButtonText(cas, coldep, caseNumb, &s[0], esp); limit[1][1] = ((uint)(coldep) >> 1) * res; limit[1][2] = limit[1][1] + 40; - if (nbcase == 1) { + if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; @@ -125,7 +117,7 @@ int Alert::show(const Common::String &msg, int n) { if (test) { test1 = (cx > limit[1][1]) && (cx < limit[1][2]); test2 = test1; - if (nbcase > 1) + if (caseNumb > 1) test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); if (test2) { newaff = true; @@ -190,7 +182,7 @@ int Alert::show(const Common::String &msg, int n) { return do_alert_result; } -void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs) { +void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &col, Common::String &c, Common::String &cs) { int i, k; bool v; @@ -199,7 +191,7 @@ void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String i = 0; c = ""; - nbl = 0; + lineNumb = 0; i = 5; k = 0; v = true; @@ -211,7 +203,7 @@ void Alert::decod(Common::String s, int &nbc, int &nbl, int &col, Common::String if (k > col) col = k; k = 0; - nbl = nbl + 1; + ++lineNumb; } else if (s[i] != ' ') v = false; ++i; @@ -236,23 +228,28 @@ void Alert::setPosition(int ji, int coldep, int esp) { g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98); } -void Alert::fait_boite(int lidep, int nli, int tx) { - int x, y, xx, yy; - +/** + * Alert function - Draw Alert Box + * @remarks Originally called 'fait_boite' + */ +void Alert::drawAlertBox(int lidep, int nli, int tx) { if (tx > 640) tx = 640; - x = 320 - ((uint)tx >> 1); - y = pred(int, lidep) << 3; - xx = x + tx; - yy = y + (nli << 3); + int x = 320 - ((uint)tx >> 1); + int y = pred(int, lidep) << 3; + int xx = x + tx; + int yy = y + (nli << 3); g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } - -void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { +/** + * Alert function - Set Button Text + * @remarks Originally called 'fait_choix' + */ +void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { int i, l, x; char ch; @@ -265,9 +262,11 @@ void Alert::fait_choix(Common::String c, int coldep, int nbcase, Common::String ch = c[i]; str[l] += ch; } while (!(c[i + 1] == ']')); - i = i + 2; + i += 2; + while (str[l].size() < 3) - str[l] += ' '; + str[l] += ' '; + g_vm->_screenSurface.putxy(x, 98); Common::String tmp(" "); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 260f355e8f..76b824eab0 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -34,10 +34,10 @@ namespace Mortevielle { class Alert { private: - static void decod(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); + static void decodeAlertDetails(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); static void setPosition(int ji, int coldep, int esp); - static void fait_boite(int lidep, int nli, int tx); - static void fait_choix(Common::String c, int coldep, int nbcase, Common::String *str, int esp); + static void drawAlertBox(int lidep, int nli, int tx); + static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: static int show(const Common::String &s, int n); }; -- cgit v1.2.3 From 77f9e706e50e11d711575a90e18522381d5bac73 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 22:14:22 +0100 Subject: MORTEVIELLE: Rename F3F8 functions, rename everything related to Graphical Device --- engines/mortevielle/dialogs.cpp | 38 ++++++++++++++++++++++++++----------- engines/mortevielle/dialogs.h | 6 +++--- engines/mortevielle/keyboard.cpp | 2 ++ engines/mortevielle/level15.cpp | 8 ++++---- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 11 ++++++----- engines/mortevielle/mor2.cpp | 6 +++--- engines/mortevielle/mortevielle.cpp | 18 +++++++++--------- engines/mortevielle/mouse.cpp | 4 ++-- engines/mortevielle/ovd1.cpp | 4 ++-- engines/mortevielle/prog.cpp | 8 ++++++-- engines/mortevielle/prog.h | 2 +- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 4 ++-- engines/mortevielle/var_mor.h | 4 ++-- 15 files changed, 71 insertions(+), 48 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 991bda4bd4..93b556ea68 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -40,6 +40,10 @@ namespace Mortevielle { static const int nligne = 7; +/** + * Alert function - Show + * @remarks Originally called 'do_alert' + */ int Alert::show(const Common::String &msg, int n) { int coldep, esp, i, caseNumb, quoi, ix; Common::String st, chaine; @@ -182,6 +186,10 @@ int Alert::show(const Common::String &msg, int n) { return do_alert_result; } +/** + * Alert function - Decode Alert Details + * @remarks Originally called 'decod' + */ void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &col, Common::String &c, Common::String &cs) { int i, k; bool v; @@ -244,7 +252,6 @@ void Alert::drawAlertBox(int lidep, int nli, int tx) { g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } - /** * Alert function - Set Button Text * @remarks Originally called 'fait_choix' @@ -425,34 +432,43 @@ void f3f8::draw() { g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); } -void f3f8::divers(int np, bool b) { +/** + * Alert function - Loop until F8 is pressed, update + * Graphical Device if modified + * @remarks Originally called 'diver' + */ +void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { - parole(np, 0, 0); - atf3f8(key); + parole(SpeechNum, 0, 0); + waitForF3F8(key); CHECK_QUIT; - if (newgd != gd) { - gd = newgd; + if (_newGraphicalDevice != _currGraphicalDevice) { + _currGraphicalDevice = _newGraphicalDevice; hirs(); - aff50(b); + aff50(drawAni50Fl); } - } while (!(key == 66)); + } while (!(key == 66)); // keycode for F8 } -void f3f8::atf3f8(int &key) { +/** + * Alert function - Loop until F3 or F8 is pressed + * @remarks Originally called 'atf3f8' + */ +void f3f8::waitForF3F8(int &key) { do { key = testou(); CHECK_QUIT; } while (!((key == 61) || (key == 66))); } -void f3f8::aff50(bool c) { +void f3f8::aff50(bool drawAni50Fl) { caff = 50; _maff = 0; taffich(); dessine(ades, 63, 12); - if (c) + if (drawAni50Fl) ani50(); else repon(2, c_paroles + 142); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 76b824eab0..a8c0cb7cf7 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -50,9 +50,9 @@ public: class f3f8 { public: static void draw(); - static void divers(int np, bool b); - static void atf3f8(int &key); - static void aff50(bool c); + static void checkForF8(int SpeechNum, bool drawAni50Fl); + static void waitForF3F8(int &key); + static void aff50(bool drawAni50Fl); static void ani50(); }; diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index bd7ad2c8aa..679264bff9 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -56,6 +56,8 @@ int testou() { if (keypressed()) ch = get_ch(); break; + default: + break; } return ord(ch); diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index d297529470..eff7172235 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -68,7 +68,7 @@ void outbloc(int n, pattern p, t_nhom pal) { void writepal(int n) { t_nhom pal; - switch (gd) { + switch (_currGraphicalDevice) { case tan: case ega: case ams: @@ -96,7 +96,7 @@ void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&mem[seg * 16 + dep]); - if (gd == her) { + if (_currGraphicalDevice == her) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } @@ -109,13 +109,13 @@ void pictout(int seg, int dep, int x, int y) { void sauvecr(int y, int dy) { hideMouse(); - s_sauv(gd, y, dy); + s_sauv(_currGraphicalDevice, y, dy); showMouse(); } void charecr(int y, int dy) { hideMouse(); - s_char(gd, y, dy); + s_char(_currGraphicalDevice, y, dy); showMouse(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index b585177f19..9f2e83f967 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -152,7 +152,7 @@ void Menu::menu_aff() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; - if (gd == cga) + if (_currGraphicalDevice == cga) color = 1; else color = 9; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index a4283407c5..76ba080c22 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -113,7 +113,7 @@ void dessine(int ad, int x, int y) { void dessine_rouleau() { writepal(89); - if (gd == her) { + if (_currGraphicalDevice == her) { mem[0x7000 * 16 + 14] = 15; } hideMouse(); @@ -266,7 +266,7 @@ void clsf10() { void stop() { hirs(); - gd = ams; + _currGraphicalDevice = ams; hirs(); g_vm->quitGame(); } @@ -274,7 +274,7 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - if (gd == cga) + if (_currGraphicalDevice == cga) co = 3; else co = 11; @@ -634,9 +634,10 @@ void drawClock() { paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); - if ((gd == cga) || (gd == her)) + if ((_currGraphicalDevice == cga) || (_currGraphicalDevice == her)) co = 0; - else co = 1; + else + co = 1; if (_minute == 0) g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 9dcbb85b0e..fff6917907 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -200,9 +200,9 @@ void fenat(char ans) { int coul; hideMouse(); - if (gd == cga) + if (_currGraphicalDevice == cga) coul = 2; - else if (gd == her) + else if (_currGraphicalDevice == her) coul = 1; else coul = 12; @@ -425,7 +425,7 @@ void sparl(float adr, float rep) { key = 0; do { parole(repint, haut[caff - 69], 0); - f3f8::atf3f8(key); + f3f8::waitForF3F8(key); CHECK_QUIT; } while (!(key == 66)); hirs(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4112073cde..e6ecbde4d3 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -120,7 +120,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - gd = ega; + _currGraphicalDevice = ega; res = 2; // Load the mort.dat resource @@ -134,8 +134,8 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - gd = ega; - newgd = gd; + _currGraphicalDevice = ega; + _newGraphicalDevice = _currGraphicalDevice; zuul = false; tesok = false; chartex(); @@ -153,10 +153,10 @@ Common::ErrorCode MortevielleEngine::initialise() { teskbd(); dialpre(); - newgd = gd; + _newGraphicalDevice = _currGraphicalDevice; teskbd(); - if (newgd != gd) - gd = newgd; + if (_newGraphicalDevice != _currGraphicalDevice) + _currGraphicalDevice = _newGraphicalDevice; hirs(); ades = 0x7000; @@ -469,11 +469,11 @@ Common::Error MortevielleEngine::run() { void MortevielleEngine::showIntroduction() { f3f8::aff50(false); mlec = 0; - f3f8::divers(142, false); + f3f8::checkForF8(142, false); CHECK_QUIT; f3f8::ani50(); - f3f8::divers(143, true); + f3f8::checkForF8(143, true); CHECK_QUIT; // TODO: Once music is implemented, only use the below delay if music is turned off @@ -558,7 +558,7 @@ void MortevielleEngine::handleAction() { g_vm->_menu.eraseMenu(); imen = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - change_gd((uint)pred(int, ord(inkey)) >> 1); + changeGraphicalDevice((uint)pred(int, ord(inkey)) >> 1); return; } if (choisi && (msg[3] == sauve)) { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 44b254fe41..2a4ab76efb 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -89,7 +89,7 @@ void hideMouse() { if (mouse_shwn == 0) { imp = odd(y_s); j = p_o_s; - switch (gd) { + switch (_currGraphicalDevice) { case cga: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); @@ -180,7 +180,7 @@ void showMouse() { j = p_o_s; imp = odd(y_s); i = x_s & 7; - switch (gd) { + switch (_currGraphicalDevice) { case cga: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 0177d3e5c1..fb893570ff 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -239,8 +239,8 @@ void suite() { caff = 51; taffich(); teskbd(); - if (newgd != gd) - gd = newgd; + if (_newGraphicalDevice != _currGraphicalDevice) + _currGraphicalDevice = _newGraphicalDevice; hirs(); dessine(ades, 0, 0); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index fa83b822d0..0c05e81cdb 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -38,9 +38,13 @@ namespace Mortevielle { -void change_gd(int ngd) { +/** + * Engine function - Change Graphical Device + * @remarks Originally called 'change_gd' + */ +void changeGraphicalDevice(int newDevice) { hideMouse(); - gd = ngd; + _currGraphicalDevice = newDevice; hirs(); initMouse(); showMouse(); diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h index e88b943307..c6ccca8920 100644 --- a/engines/mortevielle/prog.h +++ b/engines/mortevielle/prog.h @@ -30,7 +30,7 @@ namespace Mortevielle { -extern void change_gd(int ngd); +extern void changeGraphicalDevice(int newDevice); /* NIVEAU 3 */ /* procedure PROGRAMME */ diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 4da3ef0c32..1306f7f1b1 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -208,7 +208,7 @@ void taffich() { npal = a + 37; } chardes(filename, lgt, handle); - if (gd == her) { + if (_currGraphicalDevice == her) { for (i = 0; i <= 15; ++i) { palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index efd84cca76..759c29ab9b 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -124,7 +124,7 @@ int x, jh, mh, cs, - gd, /* Gd = graph device */ + _currGraphicalDevice, hdb, hfb, _hour, @@ -147,7 +147,7 @@ int x, msg3, msg4, mlec, - newgd, + _newGraphicalDevice, c_zzz, mchai, menup, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a77586ca2b..179c92d6bc 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -273,7 +273,7 @@ extern int x, jh, mh, cs, - gd, /* Gd = graph device */ + _currGraphicalDevice, hdb, hfb, _hour, @@ -296,7 +296,7 @@ extern int x, msg3, msg4, mlec, - newgd, + _newGraphicalDevice, c_zzz, mchai, menup, -- cgit v1.2.3 From a988c467a4ef50ee405657ded1fc1c49db061ade Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 22:36:45 +0100 Subject: MORTEVIELLE: Rename graphical mode constants --- engines/mortevielle/level15.cpp | 10 ++++---- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 8 +++---- engines/mortevielle/mor2.cpp | 4 ++-- engines/mortevielle/mortevielle.cpp | 46 +++++++++++++++++++++++++------------ engines/mortevielle/mouse.cpp | 20 ++++++++-------- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.h | 2 +- 8 files changed, 55 insertions(+), 39 deletions(-) diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index eff7172235..e1bba275e7 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -69,15 +69,15 @@ void writepal(int n) { t_nhom pal; switch (_currGraphicalDevice) { - case tan: - case ega: - case ams: + case MODE_TANDY: + case MODE_EGA: + case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; } break; - case cga: + case MODE_CGA: warning("TODO: If this code is needed, resolve the incompatible types"); // pal = palcga[n].a; if (n < 89) @@ -96,7 +96,7 @@ void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&mem[seg * 16 + dep]); - if (_currGraphicalDevice == her) { + if (_currGraphicalDevice == MODE_HERCULES) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9f2e83f967..78d9449b03 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -152,7 +152,7 @@ void Menu::menu_aff() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; - if (_currGraphicalDevice == cga) + if (_currGraphicalDevice == MODE_CGA) color = 1; else color = 9; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 76ba080c22..6707587184 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -113,7 +113,7 @@ void dessine(int ad, int x, int y) { void dessine_rouleau() { writepal(89); - if (_currGraphicalDevice == her) { + if (_currGraphicalDevice == MODE_HERCULES) { mem[0x7000 * 16 + 14] = 15; } hideMouse(); @@ -266,7 +266,7 @@ void clsf10() { void stop() { hirs(); - _currGraphicalDevice = ams; + _currGraphicalDevice = MODE_AMSTRAD1512; hirs(); g_vm->quitGame(); } @@ -274,7 +274,7 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - if (_currGraphicalDevice == cga) + if (_currGraphicalDevice == MODE_CGA) co = 3; else co = 11; @@ -634,7 +634,7 @@ void drawClock() { paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); - if ((_currGraphicalDevice == cga) || (_currGraphicalDevice == her)) + if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) co = 0; else co = 1; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index fff6917907..9ded5a16f9 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -200,9 +200,9 @@ void fenat(char ans) { int coul; hideMouse(); - if (_currGraphicalDevice == cga) + if (_currGraphicalDevice == MODE_CGA) coul = 2; - else if (_currGraphicalDevice == her) + else if (_currGraphicalDevice == MODE_HERCULES) coul = 1; else coul = 12; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index e6ecbde4d3..67621d036d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -120,7 +120,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - _currGraphicalDevice = ega; + _currGraphicalDevice = MODE_EGA; res = 2; // Load the mort.dat resource @@ -134,7 +134,7 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - _currGraphicalDevice = ega; + _currGraphicalDevice = MODE_EGA; _newGraphicalDevice = _currGraphicalDevice; zuul = false; tesok = false; @@ -296,8 +296,8 @@ bool MortevielleEngine::handleEvents() { _mouseClick = true; else if (event.type == Common::EVENT_LBUTTONUP) _mouseClick = false; - break; + break; case Common::EVENT_KEYDOWN: addKeypress(event); break; @@ -445,7 +445,7 @@ Common::Error MortevielleEngine::run() { int loadSlot = 0; if (ConfMan.hasKey("save_slot")) { int gameToLoad = ConfMan.getInt("save_slot"); - if (gameToLoad >= 1 && gameToLoad <= 999) + if ((gameToLoad >= 1) && (gameToLoad <= 999)) loadSlot = gameToLoad; } @@ -487,9 +487,12 @@ void MortevielleEngine::showIntroduction() { * loses, and chooses to start playing the game again. */ void MortevielleEngine::mainGame() { - if (rech_cfiec) charge_cfiec(); + if (rech_cfiec) + charge_cfiec(); + for (crep = 1; crep <= c_zzz; crep ++) zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + charge_bruit5(); _menu.initMenu(); @@ -518,6 +521,7 @@ void MortevielleEngine::playGame() { handleAction(); CHECK_QUIT; } while (!((_quitGame) || (_endGame) || (_loseGame))); + if (_endGame) endGame(); else if (_loseGame) @@ -574,9 +578,11 @@ void MortevielleEngine::handleAction() { if ((mnumo != OPCODE_NONE) && ((msg[3] == action) || (msg[3] == saction))) { msg[4] = mnumo; ecr3(g_vm->getString(S_IDEM)); - } else return; + } else + return; } else if (inkey == '\104') { - if ((x != 0) && (y != 0)) num = 9999; + if ((x != 0) && (y != 0)) + num = 9999; return; } } @@ -584,39 +590,49 @@ void MortevielleEngine::handleAction() { _quitGame = true; tmaj3(); } else { - if ((funct) && (inkey != '\77')) return; + if ((funct) && (inkey != '\77')) + return; if (temps > lim) { repon(2, 141); - if (num == 9999) num = 0; + if (num == 9999) + num = 0; } else { mnumo = msg[3]; - if ((msg[3] == action) || (msg[3] == saction)) mnumo = msg[4]; + if ((msg[3] == action) || (msg[3] == saction)) + mnumo = msg[4]; if (! anyone) { if ((fouil) || (obpart)) { - if (y_s < 12) return; + if (y_s < 12) + return; + if ((msg[4] == OPCODE_SOUND) || (msg[4] == OPCODE_LIFT)) { oo = true; if ((msg[4] == OPCODE_LIFT) || (obpart)) { finfouil(); caff = s.mlieu; crep = 998; - } else tsuiv(); + } else + tsuiv(); mennor(); } } } do { - if (! oo) tsitu(); + if (! oo) + tsitu(); + if ((ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); if (okdes) { okdes = false; dessin(0); } - if ((! syn) || (col)) repon(2, crep); + if ((! syn) || (col)) + repon(2, crep); } } while (!(! syn)); - if (ctrm != 0) tctrm(); + if (ctrm != 0) + tctrm(); } } } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 2a4ab76efb..c96e92f0a8 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -90,7 +90,7 @@ void hideMouse() { imp = odd(y_s); j = p_o_s; switch (_currGraphicalDevice) { - case cga: + case MODE_CGA: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -102,7 +102,7 @@ void hideMouse() { k = succ(int, k); } while (!(k >= 5)); break; - case ams: + case MODE_AMSTRAD1512: for (i = 0; i <= 3; ++i) { port[0x3dd] = 1 << i; k = 0; @@ -120,7 +120,7 @@ void hideMouse() { } while (!(k >= 8)); } break; - case ega: + case MODE_EGA: port[0x3c4] = 2; port[0x3ce] = 8; port[0x3cf] = 255; @@ -140,7 +140,7 @@ void hideMouse() { ++i; } while (!(i == 4)); break; - case her: + case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) @@ -148,7 +148,7 @@ void hideMouse() { j += 80; } break; - case tan: + case MODE_TANDY: j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { @@ -181,7 +181,7 @@ void showMouse() { imp = odd(y_s); i = x_s & 7; switch (_currGraphicalDevice) { - case cga: + case MODE_CGA: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { @@ -193,7 +193,7 @@ void showMouse() { k = succ(int, k); } while (!(k >= 5)); break; - case ams: + case MODE_AMSTRAD1512: for (i = 0; i <= 3; ++i) { j = p_o_s; imp = odd(y_s); @@ -212,7 +212,7 @@ void showMouse() { } while (!(k >= 8)); } break; - case ega: + case MODE_EGA: port[0x3ce] = 4; l = 0; do { @@ -227,7 +227,7 @@ void showMouse() { ++l; } while (!(l == 4)); break; - case her: + case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) @@ -235,7 +235,7 @@ void showMouse() { j += 80; } break; - case tan: + case MODE_TANDY: j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); k = 0; do { diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 1306f7f1b1..46df0b4e3b 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -208,7 +208,7 @@ void taffich() { npal = a + 37; } chardes(filename, lgt, handle); - if (_currGraphicalDevice == her) { + if (_currGraphicalDevice == MODE_HERCULES) { for (i = 0; i <= 15; ++i) { palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 179c92d6bc..a6d40e5b77 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -223,7 +223,7 @@ typedef int tfxx[108]; /*------------------------------ ENUMS ------------------------------*/ /*---------------------------------------------------------------------------*/ -enum GraphicModes { ams = 0, cga = 1, ega = 2, her = 3, tan = 4 }; +enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; /*---------------------------------------------------------------------------*/ /*------------------------------ VARIABLES ------------------------------*/ -- cgit v1.2.3 From 33106100f63afd7cff1f9ae38b4d682ac95150bd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 21 Feb 2012 23:09:29 +0100 Subject: MORTEVIELLE: remove pred and succ --- engines/mortevielle/actions.cpp | 12 ++++++------ engines/mortevielle/dialogs.cpp | 8 ++++---- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/level15.cpp | 8 ++++---- engines/mortevielle/menu.cpp | 16 ++++++++-------- engines/mortevielle/mor.cpp | 12 ++++++------ engines/mortevielle/mor2.cpp | 22 +++++++++++----------- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mouse.cpp | 26 +++++++++++++------------- engines/mortevielle/parole2.cpp | 2 +- engines/mortevielle/taffich.cpp | 4 ++-- engines/mortevielle/var_mor.h | 2 -- 12 files changed, 57 insertions(+), 59 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 975992ee2a..eb8bf87061 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -210,7 +210,7 @@ void fctTake() { obpart = false; affrep(); } else { - tabdon[acha + (pred(int, mchai) * 10) + pred(int, cs)] = 0; + tabdon[acha + ((mchai - 1) * 10) + cs - 1] = 0; tsuiv(); ++dobj; if (dobj > 6) { @@ -344,7 +344,7 @@ void fctLift() { cx = 14; else if (s.mlieu == 19) cx = 15; - crep = tabdon[asoul + (cx << 3) + pred(int, num)]; + crep = tabdon[asoul + (cx << 3) + (num - 1)]; if (crep == 255) crep = 997; } @@ -436,7 +436,7 @@ void fctLook() { cx -= 4; if (s.mlieu == 26) cx = 21; - crep = tabdon[arega + (cx * 7) + pred(int, num)]; + crep = tabdon[arega + (cx * 7) + num - 1]; if ((s.mlieu == 13) && (num == 8)) crep = 126; if (s.mlieu == 19) @@ -608,7 +608,7 @@ void fctOpen() { cx = s.mlieu; if (s.mlieu == 16) cx = 14; - crep = tabdon[aouvr + (cx * 7) + pred(int, num)]; + crep = tabdon[aouvr + (cx * 7) + num - 1]; if (crep == 254) crep = 999; } else @@ -1330,7 +1330,7 @@ void fctDiscuss() { co = 0; lig = 0; do { - icm = succ(int, icm); + ++icm; g_vm->_screenSurface.putxy(co, lig); if (s.teauto[icm] == '*') if (te[icm]) @@ -1356,7 +1356,7 @@ void fctDiscuss() { cx = 41; else cx = 1; - cy = succ(int, ((uint)y >> 3)); /* 0-199 => 1-25 */ + cy = ((uint)y >> 3) + 1; // 0-199 => 1-25 if ((cy > 23) || ((cx == 41) && ((cy >= 20) && (cy <= 22)))) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 93b556ea68..20e2898121 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -176,7 +176,7 @@ int Alert::show(const Common::String &msg, int n) { tmp4 += " "; g_vm->_screenSurface.writeg(tmp4, 1); } - charecr(50, succ(int, nligne) << 4); + charecr(50, (nligne + 1) << 4); showMouse(); /* Restore the background area */ @@ -233,7 +233,7 @@ void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &c } void Alert::setPosition(int ji, int coldep, int esp) { - g_vm->_screenSurface.putxy(coldep + (40 + esp) *pred(int, ji), 98); + g_vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); } /** @@ -244,7 +244,7 @@ void Alert::drawAlertBox(int lidep, int nli, int tx) { if (tx > 640) tx = 640; int x = 320 - ((uint)tx >> 1); - int y = pred(int, lidep) << 3; + int y = (lidep - 1) << 3; int xx = x + tx; int yy = y + (nli << 3); g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); @@ -338,7 +338,7 @@ bool Ques::show() { ++memk; y += 8; } - for (j = 1; j <= succ(int, der - prem); ++j) { + for (j = 1; j <= der - prem + 1; ++j) { rectangle &with = coor[j]; with.x1 = 45 * res; diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 679264bff9..0306e71962 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -47,7 +47,7 @@ int testou() { case '\26' : if ((c_zzz == 1) && (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - c_zzz = succ(int, c_zzz); + ++c_zzz; return 61; } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index e1bba275e7..57eaa4dccc 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -40,7 +40,7 @@ void copcha() { int i = acha; do { tabdon[i] = tabdon[i + 390]; - i = succ(int, i); + ++i; } while (!(i == acha + 390)); } @@ -62,7 +62,7 @@ void outbloc(int n, pattern p, t_nhom pal) { ad += 4; for (int i = 1; i <= p.tax; ++i) for (int j = 1; j <= p.tay; ++j) - mem[0x6000 * 16 + ad + pred(int, j)*p.tax + pred(int, i)] = pal[n].hom[p.des[i][j]]; + mem[(0x6000 * 16) + ad + (j - 1) * p.tax + i - 1] = pal[n].hom[p.des[i][j]]; } void writepal(int n) { @@ -73,8 +73,8 @@ void writepal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - mem[0x7000 * 16 + 2 * i] = tabpal[n][i].x; - mem[0x7000 * 16 + succ(int, 2 * i)] = tabpal[n][i].y; + mem[(0x7000 * 16) + (2 * i)] = tabpal[n][i].x; + mem[(0x7000 * 16) + (2 * i) + 1] = tabpal[n][i].y; } break; case MODE_CGA: diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 78d9449b03..1f8f3460e1 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -175,8 +175,8 @@ void Menu::menu_aff() { msk = (uint)msk >> 1; ++x; } - ind_tabl = succ(int, ind_tabl); - k = succ(int, k); + ++ind_tabl; + ++k; } while (!(k == 3)); ++y; } while (!(y == 9)); @@ -204,7 +204,7 @@ void Menu::invers(int ix) { if (msg4 == OPCODE_NONE) return; - g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); + g_vm->_screenSurface.putxy(don[msg3][1] << 3, (lo(msg4) + 1) << 3); switch (msg3) { case 1: s = _inv[lo(msg4)]; @@ -260,7 +260,7 @@ void Menu::util(int x, int y) { ix = 3; int xmx = dxcar * ix * res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { - ix = pred(int, ((uint)y >> 3)) + (msg3 << 8); + ix = (((uint)y >> 3) - 1) + (msg3 << 8); if (ix != msg4) { invers(1); msg4 = ix; @@ -288,7 +288,7 @@ void Menu::menuDown(int ii) { xco = don[ii][1]; nb_lig = don[ii][4]; hideMouse(); - sauvecr(10, succ(byte, don[ii][2]) << 1); + sauvecr(10, (don[ii][2] + 1) << 1); xco = xco << 3; if (res == 1) cx = 10; @@ -301,7 +301,7 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { - cx = succ(int, cx); + ++cx; switch (ii) { case 1: if (_inv[cx][0] != '*') @@ -358,7 +358,7 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int xx) { /* debug('menuUp'); */ if (test0) { - charecr(10, succ(byte, don[xx][2]) << 1); + charecr(10, (don[xx][2] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); @@ -501,7 +501,7 @@ void Menu::initMenu() { deline(i + c_dis, st, tai); _dis[i] = delig + ' '; } - i = succ(int, i); + ++i; } while (!(i == 22)); for (i = 1; i <= 8; ++i) { _disc[i] = 0x500 + i; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6707587184..6fe396f3cc 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -188,21 +188,21 @@ void ecr2(Common::String str_) { else tab = 6; g_vm->_screenSurface.putxy(8, 177); - int tlig = 59 + pred(int, res) * 36; + int tlig = 59 + (res - 1) * 36; if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.writeg(copy(str_, 1, pred(int, tlig)), 5); + g_vm->_screenSurface.writeg(copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); g_vm->_screenSurface.writeg(copy(str_, tlig, tlig << 1), 5); } else { f2_all = true; clsf2(); g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.writeg(copy(str_, 1, pred(int, tlig)), 5); + g_vm->_screenSurface.writeg(copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.writeg(copy(str_, tlig, pred(int, (tlig << 1))), 5); + g_vm->_screenSurface.writeg(copy(str_, tlig, ((tlig << 1) - 1)), 5); g_vm->_screenSurface.putxy(8, 190); g_vm->_screenSurface.writeg(copy(str_, tlig << 1, tlig * 3), 5); } @@ -303,7 +303,7 @@ void conv(int x, int &y) { y = 128; while (cx < x) { y = (uint)y >> 1; - cx = succ(int, cx); + ++cx; } } @@ -351,7 +351,7 @@ void repon(int f, int m) { if ((m > 499) && (m < 563)) { deline(m - 501 + c_st41, st, tay); - if (tay > ((58 + pred(int, res) * 37) << 1)) + if (tay > ((58 + (res - 1) * 37) << 1)) f2_all = true; else f2_all = false; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 9ded5a16f9..9a06668ec8 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -395,9 +395,9 @@ void modinv() { Common::String nomp; int cy = 0; - for (int cx = 1; cx <= 6; cx++) + for (int cx = 1; cx <= 6; ++cx) if (s.sjer[cx] != chr(0)) { - cy = succ(int, cy); + ++cy; r = (ord(s.sjer[cx]) + 400); deline(r - 501 + c_st41, nom, tay); nomp = delig; @@ -405,7 +405,7 @@ void modinv() { g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); } if (cy < 6) - for (int cx = cy + 1; cx <= 6; cx++) { + for (int cx = cy + 1; cx <= 6; ++cx) { g_vm->_menu.menut(g_vm->_menu._invt[cx], " "); g_vm->_menu.disableMenuItem(g_vm->_menu._invt[cx]); } @@ -464,7 +464,7 @@ void premtet() { void ajchai() { - int cy = (acha + pred(int, pred(int, mchai) * 10)); + int cy = acha + ((mchai - 1) * 10) - 1; int cx = 0; do { ++cx; @@ -696,7 +696,7 @@ void tcoord(int sx) { while (cy < caff) { a += tabdon[atdon]; atdon += 4; - cy = succ(int, cy); + ++cy; } b = tabdon[atdon]; @@ -704,11 +704,11 @@ void tcoord(int sx) { goto L1; a += fleche; cb = 0; - for (cy = 0; cy <= (sx - 2); cy++) { - ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; + for (cy = 0; cy <= (sx - 2); ++cy) { + ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } - ib = (tabdon[a + cb] << 8) + tabdon[succ(int, a + cb)]; + ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; if (ib == 0) goto L1; @@ -716,10 +716,10 @@ void tcoord(int sx) { do { cb += 2; sx = tabdon[a + cb] * res; - sy = tabdon[succ(int, a + cb)]; + sy = tabdon[(a + cb + 1)]; cb += 2; ix = tabdon[a + cb] * res; - iy = tabdon[succ(int, a + cb)]; + iy = tabdon[(a + cb + 1)]; ++cy; } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); @@ -794,7 +794,7 @@ void rechai(int &ch) { cx = s.mlieu; if (s.mlieu == 16) cx = 14; - ch = tabdon[achai + (cx * 7) + pred(int, num)]; + ch = tabdon[achai + (cx * 7) + num - 1]; } void t23coul(int &l) { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 67621d036d..7c7524235b 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -562,7 +562,7 @@ void MortevielleEngine::handleAction() { g_vm->_menu.eraseMenu(); imen = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - changeGraphicalDevice((uint)pred(int, ord(inkey)) >> 1); + changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } if (choisi && (msg[3] == sauve)) { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index c96e92f0a8..a3676664d3 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -85,7 +85,7 @@ void hideMouse() { int i, j, k, ps;; bool imp; - mouse_shwn = pred(int, mouse_shwn); + --mouse_shwn; if (mouse_shwn == 0) { imp = odd(y_s); j = p_o_s; @@ -99,7 +99,7 @@ void hideMouse() { WRITE_LE_UINT16(&mem[0xba00 * 16 + j], s_s[2][k]); WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]); j += 80; - k = succ(int, k); + ++k; } while (!(k >= 5)); break; case MODE_AMSTRAD1512: @@ -116,7 +116,7 @@ void hideMouse() { j += 0x2000; } imp = !imp; - k = succ(int, k); + ++k; } while (!(k >= 8)); } break; @@ -135,7 +135,7 @@ void hideMouse() { ps = mem[0xa000 * 16 + j + 1]; mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; - k = succ(int, k); + ++k; } while (!(k >= 8)); ++i; } while (!(i == 4)); @@ -157,7 +157,7 @@ void hideMouse() { WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; - k = succ(int, k); + ++k; } while (!(k == 3)); break; default: @@ -190,7 +190,7 @@ void showMouse() { s_s[2][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j]); s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]); j += 80; - k = succ(int, k); + ++k; } while (!(k >= 5)); break; case MODE_AMSTRAD1512: @@ -208,7 +208,7 @@ void showMouse() { j += 0x2000; } imp = !imp; - k = succ(int, k); + ++k; } while (!(k >= 8)); } break; @@ -220,9 +220,9 @@ void showMouse() { k = 0; j = p_o_s; do { - s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 * 16 + succ(int, j)] << 8); + s_s[l][k] = mem[0xa000 * 16 + j] + (mem[(0xa000 * 16) + j + 1] << 8); j += 80; - k = succ(int, k); + ++k; } while (!(k >= 8)); ++l; } while (!(l == 4)); @@ -244,7 +244,7 @@ void showMouse() { s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); } j += 160; - k = succ(int, k); + ++k; } while (!(k == 3)); break; default: @@ -357,16 +357,16 @@ void moveMouse(bool &funct, char &key) { } else { switch (in2) { case 'K': - cx = pred(int, cx); + --cx; break; case 'P': - cy = succ(int, cy); + ++cy; break; case 'M': cx += 2; break; case 'H': - cy = pred(int, cy); + --cy; break; case 'G': --cx; diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 785e49acaa..c493e19a79 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -54,7 +54,7 @@ void init_chariot() { void trait_ph() { const int deca[3] = {300, 30, 40}; - ptr_tcph = pred(int, num_ph); + ptr_tcph = num_ph - 1; ledeb = swap(t_cph[ptr_tcph]) + deca[typlec]; lefin = swap(t_cph[ptr_tcph + 1]) + deca[typlec]; nb_word = lefin - ledeb; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 46df0b4e3b..29cdc0a288 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -210,7 +210,7 @@ void taffich() { chardes(filename, lgt, handle); if (_currGraphicalDevice == MODE_HERCULES) { for (i = 0; i <= 15; ++i) { - palh = READ_LE_UINT16(&mem[0x7000 * 16 + (succ(int, i) << 1)]); + palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (i = 0; i <= 15; ++i) { @@ -218,7 +218,7 @@ void taffich() { for (j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - mem[0x7000 * 16 + 2 + (k << 1)] = rang[i]; + mem[(0x7000 * 16) + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a6d40e5b77..069a603dd2 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -62,8 +62,6 @@ namespace Mortevielle { /*------------------------- DEFINES ----------------------------------*/ /*---------------------------------------------------------------------------*/ -#define pred(type, v) ((v) - 1) -#define succ(type, v) ((v) + 1) #define ord(v) ((int) v) #define chr(v) ((char) v) #define lo(v) ((v) & 0xff) -- cgit v1.2.3 From ac71654b4999663fc911572aaa2e6174767706d3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 22 Feb 2012 07:37:41 +0100 Subject: MORTEVIELLE: various cleanup and renaming --- engines/mortevielle/dialogs.cpp | 8 ++++---- engines/mortevielle/var_mor.cpp | 3 ++- engines/mortevielle/var_mor.h | 37 ++++++++++++++++++++----------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 20e2898121..c58f6b3309 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -345,13 +345,13 @@ bool Ques::show() { with.x2 = (tmax * 3 + 55) * res; with.y1 = 27 + j * 8; with.y2 = 34 + j * 8; - with.etat = true; + with.enabled = true; while ((int)chaines[j].size() < tmax) { chaines[j] += ' '; } } - coor[j + 1].etat = false; + coor[j + 1].enabled = false; if (res == 1) rep = 10; else @@ -367,8 +367,8 @@ bool Ques::show() { CHECK_QUIT0; k = 1; - while (coor[k].etat && ! dans_rect(coor[k])) k = k + 1; - if (coor[k].etat) { + while (coor[k].enabled && ! dans_rect(coor[k])) k = k + 1; + if (coor[k].enabled) { if ((memk != 0) && (memk != k)) { // for (j = 1; j <= tmax; ++j) // st[j] = chaines[memk][j]; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 759c29ab9b..a304592515 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -204,7 +204,7 @@ int tbi[256]; chariot c1, c2, c3; float addfix; t_pcga palsav[91]; -doublet tabpal[91][17]; +Common::Point tabpal[91][17]; t_pcga palcga[91]; pattern tpt[15]; @@ -248,6 +248,7 @@ int port[0xfff]; byte mem[65536 * 16]; void intr(int intNum, registres ®s) { + warning("STUBBED: Call to DOS interrupt #%d", intNum); } /** diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 069a603dd2..bc63aa98d3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -75,23 +75,24 @@ namespace Mortevielle { const float freq0 = 1.19318e6; -const int seg_syst = 0x6fed; -const int segmou = 0x6f00; -const int segdon = 0x6c00; const int adani = 0x7314; -const int adword = 0x4000; -const int adtroct = 0x406b; const int adbruit = 0x5cb0;/*2C00;*/ -const int adbruit1 = 0x6924;/*3874;*/ -const int adbruit2 = 0x6b30;/*3A80;*/ +const int adbruit1 = 0x6924; const int adbruit3 = 0x6ba6;/*3AF6;*/ const int adbruit5 = 0x3b50; const int adson = 0x5cb0;/*2C00;*/ -const int adson2 = 0x60b0;/*3000;*/ +const int adtroct = 0x406b; +const int adword = 0x4000; const int offsetb1 = 6; -const int offsetb2 = 4; const int offsetb3 = 6; +// Useless constants +//const int segdon = 0x6c00; +//const int adbruit2 = 0x6b30;/*3A80;*/ +//const int adson2 = 0x60b0;/*3000;*/ +//const int seg_syst = 0x6fed; +//const int offsetb2 = 4; + const int null = 255; const int tempo_mus = 71; @@ -168,6 +169,7 @@ struct sav_chaine { bool ipre; char heure; }; + struct registres { int ax, bx, cx, dx, bp, si, di, ds, es, flags; }; @@ -177,22 +179,23 @@ struct ind { byte point; }; -typedef int word1; struct chariot { int val, - code, - acc, - freq, - rep; + code, + acc, + freq, + rep; }; +/* struct doublet { byte x, y; }; +*/ struct rectangle { int x1, x2, y1, y2; - bool etat; + bool enabled; }; struct pattern { @@ -214,7 +217,7 @@ struct t_pcga { }; typedef int tablint[256]; -typedef doublet tabdb[17]; +//typedef Common::Point tabdb[17]; typedef int tfxx[108]; /*---------------------------------------------------------------------------*/ @@ -351,7 +354,7 @@ extern int tbi[256]; extern chariot c1, c2, c3; extern float addfix; extern t_pcga palsav[91]; -extern doublet tabpal[91][17]; +extern Common::Point tabpal[91][17]; extern t_pcga palcga[91]; extern pattern tpt[15]; -- cgit v1.2.3 From c6f90f2d2732553de6e71ba86edc6c335aa8ee46 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 23 Feb 2012 07:39:58 +0100 Subject: MORTEVIELLE: Add detection for another French version --- engines/mortevielle/detection_tables.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 307d125156..2b9a4511da 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -37,7 +37,20 @@ static const ADGameDescription MortevielleGameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - + // French + { + "mortevielle", + "", + { + {"menu.mor", 0, "3fef0a3f8fca99fdcb6dbca8cbcef46f", 160}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO0() + }, // German { "mortevielle", -- cgit v1.2.3 From f4a8434d8f59b7df60c5f4c10f598940be4e266a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 23 Feb 2012 07:43:16 +0100 Subject: MORTEVIELLE: Fix a bug in decodeAlertDetails --- engines/mortevielle/dialogs.cpp | 8 +++++--- engines/mortevielle/dialogs.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index c58f6b3309..b332c7e94c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -190,17 +190,19 @@ int Alert::show(const Common::String &msg, int n) { * Alert function - Decode Alert Details * @remarks Originally called 'decod' */ -void Alert::decodeAlertDetails(Common::String s, int &nbc, int &lineNumb, int &col, Common::String &c, Common::String &cs) { +void Alert::decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs) { int i, k; bool v; //val(s[2], nbc, i); - nbc = atoi(s.c_str() + 1); + choiceNumb = atoi(s.c_str() + 1); i = 0; c = ""; lineNumb = 0; - i = 5; + + // Originally set to 5, decreased to 4 because strings are 0 based, and not 1 based as in Pascal + i = 4; k = 0; v = true; col = 0; diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index a8c0cb7cf7..c4d4ab266f 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -34,7 +34,7 @@ namespace Mortevielle { class Alert { private: - static void decodeAlertDetails(Common::String s, int &nbc, int &nbl, int &col, Common::String &c, Common::String &cs); + static void decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs); static void setPosition(int ji, int coldep, int esp); static void drawAlertBox(int lidep, int nli, int tx); static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); -- cgit v1.2.3 From 529b678885f4fb63bb8630bafca53183a0f6b4fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 23 Feb 2012 07:55:58 +0100 Subject: MORTEVIELLE: cleanup decodeAlertDetails, rename parameters and variables --- engines/mortevielle/dialogs.cpp | 40 ++++++++++++++++++---------------------- engines/mortevielle/dialogs.h | 2 +- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b332c7e94c..beac0a595e 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -190,44 +190,40 @@ int Alert::show(const Common::String &msg, int n) { * Alert function - Decode Alert Details * @remarks Originally called 'decod' */ -void Alert::decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs) { - int i, k; - bool v; +void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr) { + // The second character of the string contains the number of choices + choiceNumb = atoi(inputStr.c_str() + 1); - //val(s[2], nbc, i); - choiceNumb = atoi(s.c_str() + 1); - i = 0; - - c = ""; + choiceStr = ""; + col = 0; lineNumb = 0; // Originally set to 5, decreased to 4 because strings are 0 based, and not 1 based as in Pascal - i = 4; - k = 0; - v = true; - col = 0; + int i = 4; + int k = 0; + bool empty = true; - while (s[i] != ']') { - c += s[i]; - if ((s[i] == '|') || (s[i + 1] == ']')) { + for (; inputStr[i] != ']'; ++i) { + choiceStr += inputStr[i]; + if ((inputStr[i] == '|') || (inputStr[i + 1] == ']')) { if (k > col) col = k; k = 0; ++lineNumb; - } else if (s[i] != ' ') - v = false; - ++i; + } else if (inputStr[i] != ' ') + empty = false; ++k; } - if (v) { - c = ""; + + if (empty) { + choiceStr = ""; col = 20; } else { - c += ']'; + choiceStr += ']'; col += 6; } ++i; - cs = copy(s, i, 30); + choiceListStr = copy(inputStr, i, 30); if (res == 2) col *= 6; else diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index c4d4ab266f..a3f98f38d9 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -34,7 +34,7 @@ namespace Mortevielle { class Alert { private: - static void decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs); + static void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); static void setPosition(int ji, int coldep, int esp); static void drawAlertBox(int lidep, int nli, int tx); static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); -- cgit v1.2.3 From aeb901571356181d85f8d92515379a076d142e31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 09:15:41 +0100 Subject: MORTEVIELLE: Fix questions display when entering hidden passage --- engines/mortevielle/dialogs.cpp | 56 ++++++++++++++++++++++------------------- engines/mortevielle/mor2.cpp | 7 ------ engines/mortevielle/mor2.h | 1 - engines/mortevielle/outtext.cpp | 12 +++++---- engines/mortevielle/outtext.h | 2 +- 5 files changed, 38 insertions(+), 40 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index beac0a595e..50cfc7bc9c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -291,12 +291,13 @@ bool Ques::show() { bool q, func, test; int i, j, k, y, memk; - int tay , tmax; + int curLength, maxLength; int rep, prem, der; char st[1410]; char key; rectangle coor[max_rect]; - Common::String chaines[15]; + Common::String choiceArray[15]; + Common::String currChoice; int compte; @@ -310,7 +311,7 @@ bool Ques::show() { hirs(); showMouse(); ++i; - deline(ta[i], st, tay); + deline(ta[i], st, curLength); if (res == 1) y = 29; else @@ -325,14 +326,14 @@ bool Ques::show() { der = 510; } y = 35; - tmax = 0; + maxLength = 0; memk = 1; for (j = prem; j <= der; ++j) { - deline(j, st, tay); - if (tay > tmax) - tmax = tay; + deline(j, st, curLength); + if (curLength > maxLength) + maxLength = curLength; afftex(st, 100, y, 100, 1, 0); - chaines[memk] = delig; + choiceArray[memk] = delig; ++memk; y += 8; } @@ -340,13 +341,13 @@ bool Ques::show() { rectangle &with = coor[j]; with.x1 = 45 * res; - with.x2 = (tmax * 3 + 55) * res; + with.x2 = (maxLength * 3 + 55) * res; with.y1 = 27 + j * 8; with.y2 = 34 + j * 8; with.enabled = true; - while ((int)chaines[j].size() < tmax) { - chaines[j] += ' '; + while ((int)choiceArray[j].size() < maxLength) { + choiceArray[j] += ' '; } } coor[j + 1].enabled = false; @@ -354,7 +355,7 @@ bool Ques::show() { rep = 10; else rep = 6; - g_vm->_screenSurface.drawBox(80, 33, 40 + tmax * rep, (der - prem) * 8 + 16, 15); + g_vm->_screenSurface.drawBox(80, 33, 40 + maxLength * rep, (der - prem) * 8 + 16, 15); rep = 0; j = 0; memk = 0; @@ -365,29 +366,32 @@ bool Ques::show() { CHECK_QUIT0; k = 1; - while (coor[k].enabled && ! dans_rect(coor[k])) k = k + 1; + while (coor[k].enabled && ! dans_rect(coor[k])) + ++k; if (coor[k].enabled) { if ((memk != 0) && (memk != k)) { -// for (j = 1; j <= tmax; ++j) -// st[j] = chaines[memk][j]; - strncpy(st, chaines[memk].c_str(), tmax); -// - st[1 + tmax] = '$'; + st[0] = ' '; +// for (j = 0; j <= maxLength; ++j) +// st[j + 1] = choiceArray[memk][j]; + strncpy(st + 1, choiceArray[memk].c_str(), maxLength); + st[1 + maxLength] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); } if (memk != k) { -// for (j = 1; j <= tmax; ++j) -// st[j] = chaines[k][j]; - strncpy(st, chaines[k].c_str(), tmax); - st[1 + tmax] = '$'; + st[0] = ' '; +// for (j = 0; j <= maxLength; ++j) +// st[j + 1] = choiceArray[k][j]; + strncpy(st + 1, choiceArray[k].c_str(), maxLength); + st[1 + maxLength] = '$'; 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]; - strncpy(st, chaines[memk].c_str(), tmax); - st[1 + tmax] = '$'; + st[0] = ' '; +// for (j = 0; j <= maxLength; ++j) +// st[j + 1] = choiceArray[memk][j]; + strncpy(st + 1, choiceArray[memk].c_str(), maxLength); + st[1 + maxLength] = '$'; afftex(st, 100, 27 + memk * 8, 100, 1, 0); memk = 0; } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 9a06668ec8..6ef32945c7 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -280,13 +280,6 @@ void tlu(int af, int ob) { crep = 998; } -void delin(int n) { - char s[1410]; - int t; - - deline(n, s, t); -} - void affrep() { caff = s.mlieu; crep = s.mlieu; diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 1d66548ffa..2c95f1e29d 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -38,7 +38,6 @@ extern void tkey1(bool d); extern void tmlieu(int mli); /* NIVEAU 7 */ extern void tlu(int af, int ob); -extern void delin(int n); extern void affrep(); extern void mfouen(); /* NIVEAU 6 */ diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 95ccc3baef..ceac79aacd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -126,7 +126,7 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { /** * Decode and extract the line with the given Id */ -void deline(int num, char *l , int &tl) { +void deline(int num, char *line , int &length) { if (num < 0) { warning("deline: num < 0! Skipping"); return; @@ -137,20 +137,22 @@ void deline(int num, char *l , int &tl) { int ts = t_rec[num].indis; byte ps = t_rec[num].point; int i = ts; - tl = 1; + length = 1; int j = 1; + // Initialize properly first string character + line[0] = ' '; byte k = ps; bool endFl = false; char let; do { cinq_huit(let, i, k, endFl); - l[j] = let; + line[j] = let; if (j < 254) delig += let; ++j; } while (!endFl); - tl = j - 1; - if (tl < 255) + length = j - 1; + if (length < 255) // Remove trailing '$' delig.deleteLastChar(); } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 470479a81b..32d3c4c7ec 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -34,7 +34,7 @@ namespace Mortevielle { extern Common::String delig; -extern void deline(int num , char *l , int &tl); +extern void deline(int num , char *line , int &length); extern void afftex(char *ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle -- cgit v1.2.3 From 9efa50c6e418bf707648b056230f1a2d22b3eacb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 10:54:43 +0100 Subject: MORTEVIELLE: rename variables in Ques::show(), fix remaining glitches --- engines/mortevielle/actions.cpp | 9 ++- engines/mortevielle/dialogs.cpp | 140 +++++++++++++++++++++------------------- 2 files changed, 80 insertions(+), 69 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index eb8bf87061..1f83c5c6a7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -621,7 +621,7 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - bool entre; + bool enterPassageFl; char st[1410]; Common::String str_; int i, tay; @@ -663,17 +663,20 @@ void fctPlace() { else { s.icave = s.derobj; if (s.derobj == 151) { + // Open hidden passage aniof(1, 2); aniof(1, 1); repon(2, 165); maivid(); parole(6, -9, 1); + + // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getString(S_YES_NO), 1); if (answer== 1) { deline(582, st, tay); i = Alert::show(delig, 1); tesok = false; - entre = Ques::show(); + enterPassageFl = Ques::show(); hideMouse(); hirs(); dessine_rouleau(); @@ -688,7 +691,7 @@ void fctPlace() { person(); g_vm->_menu.menu_aff(); - if (entre) { + if (enterPassageFl) { s.mlieu = 17; tmlieu(17); } else { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 50cfc7bc9c..b6253b0024 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -285,59 +285,59 @@ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::Stri /*------------------------------------------------------------------------*/ +/** + * Questions asked before entering the hidden passage + */ bool Ques::show() { - const int ta[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; - const int ok[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; + const int textIndexArr[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; + const int correctAnswerArr[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; - bool q, func, test; - int i, j, k, y, memk; + int optionPosY; int curLength, maxLength; - int rep, prem, der; - char st[1410]; + int rep; + int firstOption, lastOption; char key; rectangle coor[max_rect]; Common::String choiceArray[15]; - Common::String currChoice; - int compte; - + char st[1410]; - bool ques_result; - test = false; - i = 0; - compte = 0; + int currChoice, prevChoice; + int indx = 0; + int correctCount = 0; + bool protectionCheck = false; do { hideMouse(); hirs(); showMouse(); - ++i; - deline(ta[i], st, curLength); + ++indx; + deline(textIndexArr[indx], st, curLength); + int dialogHeight; if (res == 1) - y = 29; + dialogHeight = 29; else - y = 23; - g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, y)); + dialogHeight = 23; + g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); afftex(st, 20, 15, 100, 2, 0); - if (i != 10) { - prem = ta[i] + 1; - der = ta[i + 1] - 1; + if (indx != 10) { + firstOption = textIndexArr[indx] + 1; + lastOption = textIndexArr[indx + 1] - 1; } else { - prem = 503; - der = 510; + firstOption = 503; + lastOption = 510; } - y = 35; + optionPosY = 35; maxLength = 0; - memk = 1; - for (j = prem; j <= der; ++j) { + + for (int j = firstOption, prevChoice = 1; j <= lastOption; ++j, ++prevChoice) { deline(j, st, curLength); if (curLength > maxLength) maxLength = curLength; - afftex(st, 100, y, 100, 1, 0); - choiceArray[memk] = delig; - ++memk; - y += 8; + afftex(st, 100, optionPosY, 100, 1, 0); + choiceArray[prevChoice] = delig; + optionPosY += 8; } - for (j = 1; j <= der - prem + 1; ++j) { + for (int j = 1; j <= lastOption - firstOption + 1; ++j) { rectangle &with = coor[j]; with.x1 = 45 * res; @@ -350,65 +350,73 @@ bool Ques::show() { choiceArray[j] += ' '; } } - coor[j + 1].enabled = false; + coor[lastOption - firstOption + 2].enabled = false; if (res == 1) rep = 10; else rep = 6; - g_vm->_screenSurface.drawBox(80, 33, 40 + maxLength * rep, (der - prem) * 8 + 16, 15); + g_vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; - j = 0; - memk = 0; + + prevChoice = 0; do { g_vm->setMouseClick(false); tesok = false; - moveMouse(func, key); + bool flag; + moveMouse(flag, key); CHECK_QUIT0; - k = 1; - while (coor[k].enabled && ! dans_rect(coor[k])) - ++k; - if (coor[k].enabled) { - if ((memk != 0) && (memk != k)) { + currChoice = 1; + while (coor[currChoice].enabled && !dans_rect(coor[currChoice])) + ++currChoice; + if (coor[currChoice].enabled) { + if ((prevChoice != 0) && (prevChoice != currChoice)) { st[0] = ' '; // for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[memk][j]; - strncpy(st + 1, choiceArray[memk].c_str(), maxLength); +// st[j + 1] = choiceArray[prevChoice][j]; + strncpy(st + 1, choiceArray[prevChoice].c_str(), maxLength); st[1 + maxLength] = '$'; - afftex(st, 100, 27 + memk * 8, 100, 1, 0); + afftex(st, 100, 27 + (prevChoice * 8), 100, 1, 0); } - if (memk != k) { + if (prevChoice != currChoice) { st[0] = ' '; // for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[k][j]; - strncpy(st + 1, choiceArray[k].c_str(), maxLength); +// st[j + 1] = choiceArray[currChoice][j]; + strncpy(st + 1, choiceArray[currChoice].c_str(), maxLength); st[1 + maxLength] = '$'; - afftex(st, 100, 27 + k * 8, 100, 1, 1); - memk = k; + afftex(st, 100, 27 + (currChoice * 8), 100, 1, 1); + prevChoice = currChoice; } - } else if (memk != 0) { + } else if (prevChoice != 0) { st[0] = ' '; // for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[memk][j]; - strncpy(st + 1, choiceArray[memk].c_str(), maxLength); +// st[j + 1] = choiceArray[prevChoice][j]; + strncpy(st + 1, choiceArray[prevChoice].c_str(), maxLength); st[1 + maxLength] = '$'; - afftex(st, 100, 27 + memk * 8, 100, 1, 0); - memk = 0; + afftex(st, 100, 27 + (prevChoice * 8), 100, 1, 0); + prevChoice = 0; } - } while (!((memk != 0) && g_vm->getMouseClick())); - if (memk == ok[i]) - ++compte; + } while (!((prevChoice != 0) && g_vm->getMouseClick())); + + warning("Expected answer: %d, answer: %d", prevChoice, correctAnswerArr[indx]); + if (prevChoice == correctAnswerArr[indx]) + // Answer is correct + ++correctCount; else { - if (i == 5) - ++i; - if ((i == 7) || (i == 8)) - i = 10; + // Skip questions that may give hints on previous wrong answer + if (indx == 5) + ++indx; + + if ((indx == 7) || (indx == 8)) + indx = 10; + } + if (indx == 10) { + warning("Skipping protection check: testprot()"); + protectionCheck = true; } - if (i == 10) - q = /*testprot*/ true; - } while (!(i == 10)); - ques_result = (compte == 10) && q; - return ques_result; + } while (!(indx == 10)); + + return (correctCount == 10) && protectionCheck; } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From 59eacf43c1f3b9e5fec35abed41125f78df2bf80 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Feb 2012 21:04:42 +1100 Subject: MORTEVIELLE: Changed some char fields in sav_chaine to byte This fixes a problem with inventory display, because the original Pascal type was unsigned, whereas char is cigned --- engines/mortevielle/var_mor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index bc63aa98d3..5bbc8bdb36 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -161,9 +161,9 @@ extern const byte rang[16]; struct sav_chaine { int conf; - char pourc[11]; - char teauto[43]; - char sjer[31]; + byte pourc[11]; + byte teauto[43]; + byte sjer[31]; int mlieu, iboul, ibag, icave, ivier, ipuit; int derobj, iloic, icryp; bool ipre; -- cgit v1.2.3 From 0dea84d47bd0e05f2e80d198bec4826b494a9f77 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Feb 2012 21:08:54 +1100 Subject: MORTEVIELLE: Convert some more char types to byte --- engines/mortevielle/var_mor.cpp | 4 ++-- engines/mortevielle/var_mor.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index a304592515..7aef569618 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -176,7 +176,7 @@ byte tabdon[4001]; Common::String stpou; /* donne le % d'indices */ //Translation: "Provides the % of hints" byte is; -char mode; +byte mode; Common::String al_mess, err_mess, ind_mess, @@ -185,7 +185,7 @@ Common::String al_mess, int nbrep[9]; int nbrepm[9]; int msg[5]; -char touv[8]; +byte touv[8]; sav_chaine s, s1; byte bufcha[391]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5bbc8bdb36..af8ef9d60f 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -63,7 +63,7 @@ namespace Mortevielle { /*---------------------------------------------------------------------------*/ #define ord(v) ((int) v) -#define chr(v) ((char) v) +#define chr(v) ((unsigned char) v) #define lo(v) ((v) & 0xff) #define hi(v) (((v) >> 8) & 0xff) #define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) @@ -167,7 +167,7 @@ struct sav_chaine { int mlieu, iboul, ibag, icave, ivier, ipuit; int derobj, iloic, icryp; bool ipre; - char heure; + byte heure; }; struct registres { @@ -326,7 +326,7 @@ extern byte tabdon[4001]; extern Common::String stpou; /* donne le % d'indices */ extern byte is; -extern char mode; +extern byte mode; extern Common::String al_mess, err_mess, ind_mess, @@ -335,7 +335,7 @@ extern Common::String al_mess, extern int nbrep[9]; extern int nbrepm[9]; extern int msg[5]; -extern char touv[8]; +extern byte touv[8]; extern sav_chaine s, s1; extern byte bufcha[391]; -- cgit v1.2.3 From 7a6eca74b414986ef9d38c524b7a0cfcee68ae4b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 12:03:54 +0100 Subject: MORTEVIELLE: remove a couple of GOTOs --- engines/mortevielle/prog.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 0c05e81cdb..96083f1fc8 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -167,7 +167,8 @@ void tsitu() { if (brt) if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { ctrm = 4; - goto L2; + mennor(); + return; } if (msg[3] == MENU_MOVE) fctMove(); @@ -234,7 +235,8 @@ L1: if (anyone) { quelquun(); anyone = false; - goto L2; + mennor(); + return; } calch(j, h, m); if ((((h == 12) || (h == 13) || (h == 19)) && (s.mlieu != 10)) || @@ -255,7 +257,6 @@ L1: tperd(); } } -L2: mennor(); } -- cgit v1.2.3 From 735c7c3c641e6d403e9bbb8b657a687a26fa715c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 12:04:24 +0100 Subject: MORTEVIELLE: Fix protection skip and avoid instant exit --- engines/mortevielle/dialogs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b6253b0024..8d53da7526 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -413,6 +413,7 @@ bool Ques::show() { if (indx == 10) { warning("Skipping protection check: testprot()"); protectionCheck = true; + tesok = true; } } while (!(indx == 10)); -- cgit v1.2.3 From 3a8a15e201f36a7f33e73cc88c68378013ddb0de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 22:55:00 +0100 Subject: MORTEVIELLE: Some more cleanup, add alternate file names used by german and alternate french versions --- engines/mortevielle/dialogs.cpp | 8 +++----- engines/mortevielle/dialogs.h | 2 ++ engines/mortevielle/menu.cpp | 4 +++- engines/mortevielle/mor.cpp | 26 +++++++++++++------------- engines/mortevielle/mor2.cpp | 20 +++++++------------- engines/mortevielle/mor2.h | 8 ++++++++ engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/ovd1.cpp | 6 ++++-- engines/mortevielle/sound.cpp | 4 ++-- engines/mortevielle/sound.h | 2 +- 10 files changed, 44 insertions(+), 38 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 8d53da7526..7cf12cb1bd 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -38,8 +38,6 @@ namespace Mortevielle { -static const int nligne = 7; - /** * Alert function - Show * @remarks Originally called 'do_alert' @@ -57,7 +55,6 @@ int Alert::show(const Common::String &msg, int n) { // Make a copy of the current screen surface for later restore g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); - /*debug('** do_alert **');*/ memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; hideMouse(); @@ -66,7 +63,7 @@ int Alert::show(const Common::String &msg, int n) { g_vm->setMouseClick(false); decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); - sauvecr(50, (nligne + 1) << 4); + sauvecr(50, (NUM_LINES + 1) << 4); i = 0; if (chaine == "") { @@ -176,7 +173,7 @@ int Alert::show(const Common::String &msg, int n) { tmp4 += " "; g_vm->_screenSurface.writeg(tmp4, 1); } - charecr(50, (nligne + 1) << 4); + charecr(50, (NUM_LINES + 1) << 4); showMouse(); /* Restore the background area */ @@ -413,6 +410,7 @@ bool Ques::show() { if (indx == 10) { warning("Skipping protection check: testprot()"); protectionCheck = true; + // tesok is set to true in testprot() tesok = true; } } while (!(indx == 10)); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index a3f98f38d9..661c544b13 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -32,6 +32,8 @@ namespace Mortevielle { +static const int NUM_LINES = 7; + class Alert { private: static void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 1f8f3460e1..7cf6a316dd 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -471,7 +471,9 @@ void Menu::initMenu() { Common::File f; if (!f.open("menufr.mor")) - error("Missing file - menufr.mor"); + if (!f.open("menual.mor")) + if (!f.open("menu.mor")) + error("Missing file - menufr.mor or menual.mor or menu.mor"); f.read(lettres, 7 * 24); f.close(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6fe396f3cc..b740ad24dc 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -147,7 +147,7 @@ void text1(int x, int y, int nb, int m) { } void initouv() { - for (int cx = 1; cx <= 7; cx++) + for (int cx = 1; cx <= 7; ++cx) touv[cx] = chr(0); } @@ -444,7 +444,7 @@ void affper(int per) { int cx; /* debug('affper'); */ - for (cx = 1; cx <= 8; cx ++) + for (cx = 1; cx <= 8; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cx]); clsf10(); if ((per & 128) == 128) { @@ -595,7 +595,7 @@ void cpl6(int &p) { * Shows the you are alone message in the status area on the right hand side of the screen */ void person() { - for (int cf = 1; cf <= 8; cf ++) + for (int cf = 1; cf <= 8; ++cf) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); Common::String sYou = g_vm->getString(S_YOU); @@ -1058,30 +1058,30 @@ void inzon() { s.conf = hazard(4, 10); s.mlieu = 21; - for (cx = 2; cx <= 6; cx ++) + 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 ++) + for (cx = 1; cx <= 10; ++cx) s.pourc[cx] = ' '; - for (cx = 1; cx <= 6; cx ++) + for (cx = 1; cx <= 6; ++cx) s.teauto[cx] = '*'; - for (cx = 7; cx <= 9; cx ++) + for (cx = 7; cx <= 9; ++cx) s.teauto[cx] = ' '; - for (cx = 10; cx <= 28; cx ++) + for (cx = 10; cx <= 28; ++cx) s.teauto[cx] = '*'; - for (cx = 29; cx <= 42; cx ++) + for (cx = 29; cx <= 42; ++cx) s.teauto[cx] = ' '; s.teauto[33] = '*'; - for (cx = 1; cx <= 8; cx ++) + for (cx = 1; cx <= 8; ++cx) nbrep[cx] = 0; init_nbrepm(); @@ -1311,7 +1311,7 @@ void cavegre() { parole(2, haz, 1); // Useless? - for (haz = 0; haz <= 3000; haz++); + for (haz = 0; haz <= 3000; ++haz); clsf3(); person(); } @@ -1411,13 +1411,13 @@ void dessin(int ad) { dessine(ades, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (caff > 69) { - dessine(ades, 112, 48); /* ttes */ //Translation: Heads + dessine(ades, 112, 48); // Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { dessine(ades, 0, 12); ecrf1(); if ((caff < 30) || (caff > 32)) { - for (int cx = 1; cx <= 6; cx ++) { + for (int cx = 1; cx <= 6; ++cx) { if (ord(touv[cx]) != 0) aniof(1, ord(touv[cx])); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 6ef32945c7..0a9637523d 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -39,12 +39,6 @@ namespace Mortevielle { -const int men[12] = { OPCODE_NONE, - OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - void tinke() { Common::String d1 = g_vm->getString(S_SHOULD_HAVE_NOTICED); Common::String d2 = g_vm->getString(S_NUMBER_OF_HINTS); @@ -73,7 +67,7 @@ void tinke() { _minute = 0; drawClock(); cf = 0; - for (cx = 1; cx <= 10; cx ++) { + for (cx = 1; cx <= 10; ++cx) { if (s.pourc[cx] == '*') ++cf; } @@ -263,7 +257,7 @@ void tmlieu(int mli) { ++i; } nomp = "* "; - for (cx = 7; cx >= i; cx--) + for (cx = 7; cx >= i; --cx) g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); } @@ -289,7 +283,7 @@ void mfouen() { int cx; tmlieu(s.mlieu); - for (cx = 1; cx <= 11; cx ++) + for (cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(men[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_PROBE)); @@ -328,7 +322,7 @@ void tsort() { s.conf += (s.conf / 10); } - for (int cx = 1; cx <= 7; cx ++) + for (int cx = 1; cx <= 7; ++cx) touv[cx] = chr(0); ment = 0; iouv = 0; @@ -370,7 +364,7 @@ void cherjer(int ob, bool &d) { int cx; d = false; - for (cx = 1; cx <= 6; cx++) + for (cx = 1; cx <= 6; ++cx) d = (d || (ord(s.sjer[cx]) == ob)); if (s.derobj == ob) @@ -434,10 +428,10 @@ void finfouil() { } void mfoudi() { - for (int cx = 1; cx <= 7; cx++) + for (int cx = 1; cx <= 7; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._depl[cx]); - for (int cx = 1; cx <= 11; cx++) + for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.disableMenuItem(men[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 2c95f1e29d..dc23d04b63 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -28,8 +28,16 @@ #ifndef MORTEVIELLE_MOR2_H #define MORTEVIELLE_MOR2_H +#include "mortevielle/var_mor.h" + namespace Mortevielle { +static const int men[12] = { OPCODE_NONE, + OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + extern void tinke(); extern void fenat(char ans); /* NIVEAU 8 */ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7c7524235b..3a744fa2e2 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -490,7 +490,7 @@ void MortevielleEngine::mainGame() { if (rech_cfiec) charge_cfiec(); - for (crep = 1; crep <= c_zzz; crep ++) + for (crep = 1; crep <= c_zzz; ++crep) zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); charge_bruit5(); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index fb893570ff..84f57402ea 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -105,7 +105,8 @@ void chartex() { /* debug('o3 chartex'); */ if (!f.open("TXX.INP")) - error("Missing file - TXX.INP"); + if (!f.open("TXX.MOR")) + error("Missing file - TXX.INP or .MOR"); assert(f.size() <= (maxti * 2)); for (int i = 0; i < f.size() / 2; ++i) @@ -114,7 +115,8 @@ void chartex() { f.close(); if (!f.open("TXX.NTP")) - error("Missing file - TXX.NTP"); + if (!f.open("TXX.IND")) + error("Missing file - TXX.NTP or .IND"); assert(f.size() <= (maxtd * 3)); int i; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 0a6e7e8d8d..5f634c595c 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -87,7 +87,7 @@ int PCSpeaker::readBuffer(int16 *buffer, const int numSamples) { int i; - for (i = 0; (_remainingSamples || !_pendingNotes.empty()) && (i < numSamples); i++) { + for (i = 0; (_remainingSamples || !_pendingNotes.empty()) && (i < numSamples); ++i) { if (!_remainingSamples) // Used up the current note, so queue the next one dequeueNote(); @@ -148,7 +148,7 @@ SoundManager::~SoundManager() { /** * Decode music data */ -void SoundManager::demus(const byte *PSrc, byte *PDest, int NbreSeg) { +void SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg) { int seed = 128; int v; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index f089974c6b..5c70bc8d0f 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -101,7 +101,7 @@ public: void playNote(int frequency, int32 length); - void demus(const byte *PSrc, byte *PDest, int NbreSeg); + void decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg); void litph(tablint &t, int typ, int tempo); void musyc(tablint &tb, int nbseg, int att); }; -- cgit v1.2.3 From b414beeff286c6138e6c50235b54de4925a97934 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 24 Feb 2012 23:55:17 +0100 Subject: MORTEVIELLE: clean up while statements using separate 'not' --- engines/mortevielle/actions.cpp | 22 +++++++++++----------- engines/mortevielle/dialogs.cpp | 10 +++++----- engines/mortevielle/graphics.cpp | 4 ++-- engines/mortevielle/level15.cpp | 2 +- engines/mortevielle/menu.cpp | 10 +++++----- engines/mortevielle/mor.cpp | 2 +- engines/mortevielle/mor2.cpp | 10 +++++----- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mouse.cpp | 20 ++++++++++---------- engines/mortevielle/outtext.cpp | 4 ++-- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/parole.cpp | 18 +++++++++--------- engines/mortevielle/parole2.cpp | 4 ++-- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1f83c5c6a7..6aea0e691d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -89,7 +89,7 @@ void fctMove() { cx = 0; do { ++cx; - } while (!(g_vm->_menu._depl[cx] == msg[4])); + } while (g_vm->_menu._depl[cx] != msg[4]); if (s.mlieu == 19) { if (cx == 1) t1deva(); @@ -297,14 +297,14 @@ void tsprendre() { cx = 0; do { ++cx; - } while (!(g_vm->_menu._invt[cx] == msg[4])); + } while (g_vm->_menu._invt[cx] != msg[4]); cz = 0; cy = 0; do { ++cy; if (ord(s.sjer[cy]) != 0) ++cz; - } while (!(cz == cx)); + } while (cz != cx); cz = ord(s.sjer[cy]); s.sjer[cy] = chr(0); modinv(); @@ -491,7 +491,7 @@ void fctSearch() { cx = 0; do { ++cx; - } while (!((cx > 6) || (num == ord(touv[cx])))); + } while ((cx <= 6) && (num != ord(touv[cx]))); if (num != ord(touv[cx])) crep = 187; else { @@ -848,7 +848,7 @@ void fctClose() { cx = 0; do { ++cx; - } while (!((cx > 6) || (num == ord(touv[cx])))); + } while ((cx <= 6) && (num != ord(touv[cx]))); if (num == ord(touv[cx])) { aniof(2, num); crep = 998; @@ -941,7 +941,7 @@ void fctPut() { cx = 0; do { ++cx; - } while (!((cx > 6) || (num == ord(touv[cx])))); + } while ((cx <= 6) && (num != ord(touv[cx]))); if (num != ord(touv[cx])) crep = 187; else { @@ -1174,7 +1174,7 @@ void fctSleep() { tinke(); answer = Alert::show(g_vm->getString(S_YES_NO), 1); anyone = false; - } while (!(answer == 1)); + } while (answer != 1); crep = 998; num = 0; } @@ -1262,7 +1262,7 @@ void fctWait() { } repon(2, 102); answer = Alert::show(g_vm->getString(S_YES_NO), 1); - } while (!(answer == 2)); + } while (answer != 2); crep = 998; if (!anyone) tinke(); @@ -1303,7 +1303,7 @@ void fctDiscuss() { cx = 0; do { ++cx; - } while (!(g_vm->_menu._disc[cx] == msg[4])); + } while (g_vm->_menu._disc[cx] != msg[4]); caff = 69 + cx; afdes(0); repon(2, caff); @@ -1345,7 +1345,7 @@ void fctDiscuss() { co = 320; } else lig = lig + 8; - } while (!(icm == 42)); + } while (icm != 42); g_vm->_screenSurface.putxy(320, 176); writetp(lib[46], 0); tou = '\0'; @@ -1458,7 +1458,7 @@ void fctDiscuss() { hirs(); showMouse(); } - } while (!((choi == 46) || (suj == 138))); + } while ((choi != 46) && (suj != 138)); if (col) { s.conf = s.conf + (3 * (s.conf / 10)); hideMouse(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 7cf12cb1bd..5c53616e25 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -87,7 +87,7 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface._textPos.y += 6; g_vm->_screenSurface.writeg(st, 4); ++i; - } while (!(chaine[i] == ']')); + } while (chaine[i] != ']'); } if (caseNumb == 1) esp = nbcol - 40; @@ -263,7 +263,7 @@ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::Stri ++i; ch = c[i]; str[l] += ch; - } while (!(c[i + 1] == ']')); + } while (c[i + 1] != ']'); i += 2; while (str[l].size() < 3) @@ -413,7 +413,7 @@ bool Ques::show() { // tesok is set to true in testprot() tesok = true; } - } while (!(indx == 10)); + } while (indx != 10); return (correctCount == 10) && protectionCheck; } @@ -458,7 +458,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { hirs(); aff50(drawAni50Fl); } - } while (!(key == 66)); // keycode for F8 + } while (key != 66); // keycode for F8 } /** @@ -469,7 +469,7 @@ void f3f8::waitForF3F8(int &key) { do { key = testou(); CHECK_QUIT; - } while (!((key == 61) || (key == 66))); + } while ((key != 61) && (key != 66)); } void f3f8::aff50(bool drawAni50Fl) { diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index acc2bb0d34..7511b21ce2 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1117,7 +1117,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { do { g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i = i + step; - } while (!(i == yy)); + } while (i != yy); } else { a = (float)((y - yy)) / (x - xx); b = ((yro * xr) - (yr * xro)) / (x - xx); @@ -1127,7 +1127,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { do { g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; - } while (!(i == xx)); + } while (i != xx); } } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 57eaa4dccc..f90e1aa714 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -41,7 +41,7 @@ void copcha() { do { tabdon[i] = tabdon[i + 390]; ++i; - } while (!(i == acha + 390)); + } while (i != acha + 390); } bool dans_rect(rectangle r) { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 7cf6a316dd..bb901a15d8 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -177,11 +177,11 @@ void Menu::menu_aff() { } ++ind_tabl; ++k; - } while (!(k == 3)); + } while (k != 3); ++y; - } while (!(y == 9)); + } while (y != 9); col += 48 * res; - } while (!(num_letr == 6)); + } while (num_letr != 6); showMouse(); } @@ -347,7 +347,7 @@ void Menu::menuDown(int ii) { break; } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); - } while (!(cx == nb_lig)); + } while (cx != nb_lig); test0 = true; showMouse(); } @@ -504,7 +504,7 @@ void Menu::initMenu() { _dis[i] = delig + ' '; } ++i; - } while (!(i == 22)); + } while (i != 22); for (i = 1; i <= 8; ++i) { _disc[i] = 0x500 + i; if (i < 8) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index b740ad24dc..f8873c66b0 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -874,7 +874,7 @@ void quelq15(int &per) { ((cx == 6) && bh1) || ((cx == 7) && bf1) || ((cx == 8) && bh5)); - } while (!(! test)); + } while (test); conv(cx, per); affper(per); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 0a9637523d..c235186c8a 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -60,7 +60,7 @@ void tinke() { if (nbrepm[cx] != 0) --nbrepm[cx]; nbrep[cx] = 0; - } while (!(cx == 8)); + } while (cx != 8); } if ((h > _hour) || ((h == 0) && (_hour == 23))) { _hour = h; @@ -414,7 +414,7 @@ void sparl(float adr, float rep) { parole(repint, haut[caff - 69], 0); f3f8::waitForF3F8(key); CHECK_QUIT; - } while (!(key == 66)); + } while (key != 66); hirs(); showMouse(); } @@ -455,7 +455,7 @@ void ajchai() { int cx = 0; do { ++cx; - } while (!((cx > 9) || (tabdon[cy + cx] == 0))); + } while ((cx <= 9) && (tabdon[cy + cx] != 0)); if (tabdon[cy + cx] == 0) { int lderobj = s.derobj; @@ -468,7 +468,7 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while (!((cx > 5) || (ord(s.sjer[cx]) == 0))); + } while ((cx <= 5) && (ord(s.sjer[cx]) != 0)); if (ord(s.sjer[cx]) == 0) { s.sjer[(cx)] = chr(ob); @@ -620,7 +620,7 @@ void tsuiv() { cs = cs + 1; cl = cy + cs; tbcl = tabdon[cl]; - } while (!((tbcl != 0) || (cs > 9))); + } while ((tbcl == 0) && (cs <= 9)); if ((tbcl != 0) && (cs < 11)) { is = is + 1; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3a744fa2e2..6be14bdfa9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -630,7 +630,7 @@ void MortevielleEngine::handleAction() { if ((! syn) || (col)) repon(2, crep); } - } while (!(! syn)); + } while (syn); if (ctrm != 0) tctrm(); } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index a3676664d3..e7da3c3074 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -100,7 +100,7 @@ void hideMouse() { WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]); j += 80; ++k; - } while (!(k >= 5)); + } while (k < 5); break; case MODE_AMSTRAD1512: for (i = 0; i <= 3; ++i) { @@ -117,7 +117,7 @@ void hideMouse() { } imp = !imp; ++k; - } while (!(k >= 8)); + } while (k < 8); } break; case MODE_EGA: @@ -136,9 +136,9 @@ void hideMouse() { mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; - } while (!(k >= 8)); + } while (k < 8); ++i; - } while (!(i == 4)); + } while (i != 4); break; case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); @@ -158,7 +158,7 @@ void hideMouse() { } j += 160; ++k; - } while (!(k == 3)); + } while (k != 3); break; default: break; @@ -191,7 +191,7 @@ void showMouse() { s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]); j += 80; ++k; - } while (!(k >= 5)); + } while (k < 5); break; case MODE_AMSTRAD1512: for (i = 0; i <= 3; ++i) { @@ -209,7 +209,7 @@ void showMouse() { } imp = !imp; ++k; - } while (!(k >= 8)); + } while (k < 8); } break; case MODE_EGA: @@ -223,9 +223,9 @@ void showMouse() { s_s[l][k] = mem[0xa000 * 16 + j] + (mem[(0xa000 * 16) + j + 1] << 8); j += 80; ++k; - } while (!(k >= 8)); + } while (k < 8); ++l; - } while (!(l == 4)); + } while (l != 4); break; case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); @@ -245,7 +245,7 @@ void showMouse() { } j += 160; ++k; - } while (!(k == 3)); + } while (k != 3); break; default: break; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index ceac79aacd..1c73f7ab4d 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -222,9 +222,9 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { g_vm->_screenSurface.putxy(j, i); g_vm->_screenSurface.writeg(" ", 0); j += 6; - } while (!(j > xf)); + } while (j <= xf); i += 6; - } while (!(i > yf)); + } while (i <= yf); yc = y; } g_vm->_screenSurface.putxy(xc, yc); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 84f57402ea..74639d32db 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -183,7 +183,7 @@ void music() { fic.read(&mem[0x47a0 * 16 + 0], 123); fic.close(); - g_vm->_soundManager.demus(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); + g_vm->_soundManager.decodeMusic(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); addfix = (float)((tempo_mus - addv[1])) / 256; cctable(tbi); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 02f298e8f6..e86b647f36 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -112,7 +112,7 @@ void regenbruit() { t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); i += 2; ++j; - } while (!(i >= offsetb3 + 8790)); + } while (i < offsetb3 + 8790); } void charge_son() { @@ -123,7 +123,7 @@ void charge_son() { f.read(&mem[0x7414 * 16 + 0], 273); - g_vm->_soundManager.demus(&mem[0x7414 * 16], &mem[adson * 16], 273); + g_vm->_soundManager.decodeMusic(&mem[0x7414 * 16], &mem[adson * 16], 273); f.close(); } @@ -209,7 +209,7 @@ void trait_car() { else entroct(d3); entroct(3); - } while (!(i < 0)); + } while (i >= 0); } if (d3 == null) { entroct(4); @@ -234,7 +234,7 @@ void trait_car() { else entroct(d3); entroct(3); - } while (!(i < 0)); + } while (i >= 0); } if (d3 == null) { entroct(0); @@ -259,7 +259,7 @@ void trait_car() { else entroct(d3); entroct(3); - } while (!(i < 0)); + } while (i >= 0); } entroct(0); entroct(c2.val); @@ -292,7 +292,7 @@ void trait_car() { entroct(0); entroct(d3); entroct(3); - } while (!(i <= 0)); + } while (i > 0); } veracf(c3.acc); if (c3.code == 6) { @@ -345,7 +345,7 @@ void trait_car() { entroct(d3); entroct(c2.val); entroct(3); - } while (!(i <= 0)); + } while (i > 0); } entroct(d3); entroct(c2.val); @@ -361,7 +361,7 @@ void trait_car() { entroct(d3); entroct(c2.val); entroct(4); - } while (!(i <= 0)); + } while (i > 0); } } if (c3.code == 9) { @@ -408,7 +408,7 @@ void trait_car() { entroct(2); entroct(c2.val); entroct(3); - } while (!(i <= 0)); + } while (i > 0); } entroct(2); entroct(c2.val); diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index c493e19a79..19b44191b0 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -64,7 +64,7 @@ void trait_ph() { WRITE_LE_UINT16(&mem[adword + ptr_word], t_cph[ptr_tcph]); ptr_word = ptr_word + 2; ptr_tcph = ptr_tcph + 1; - } while (!(ptr_tcph >= (int)((uint)lefin >> 1))); + } while (ptr_tcph < (int)((uint)lefin >> 1)); ptr_oct = 0; ptr_word = 0; @@ -74,7 +74,7 @@ void trait_ph() { rot_chariot(); charg_car(); trait_car(); - } while (!(ptr_word >= nb_word)); + } while (ptr_word < nb_word); rot_chariot(); trait_car(); -- cgit v1.2.3 From 8072e9e97a909e2d1f9d97c6af4d2ec6a08df14d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 25 Feb 2012 21:13:24 +0100 Subject: MORTEVIELLE: Rename remaining Menu enums, rename _staticStrings into _engineStrings as a preliminar work on an English DOS version --- engines/mortevielle/actions.cpp | 64 ++++++++++++++++++------------------- engines/mortevielle/dialogs.cpp | 4 +-- engines/mortevielle/menu.cpp | 46 +++++++++++++------------- engines/mortevielle/menu.h | 4 +-- engines/mortevielle/mor.cpp | 20 ++++++------ engines/mortevielle/mor2.cpp | 18 +++++------ engines/mortevielle/mortevielle.cpp | 14 ++++---- engines/mortevielle/mortevielle.h | 4 +-- engines/mortevielle/prog.cpp | 2 +- 9 files changed, 89 insertions(+), 87 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6aea0e691d..68d6e82c43 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -58,7 +58,7 @@ void fctMove() { } if ((s.mlieu == 15) && (msg[4] == g_vm->_menu._depl[6])) { if (!syn) - ecr3(g_vm->getString(S_GO_TO)); + ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); if (iesc) okdes = false; @@ -222,7 +222,7 @@ void fctTake() { return; } if (!syn) - ecr3(g_vm->getString(S_TAKE)); + ecr3(g_vm->getEngineString(S_TAKE)); tfleche(); if ((anyone) || (iesc)) return; @@ -321,7 +321,7 @@ void fctLift() { int cx; if (!syn) - ecr3(g_vm->getString(S_LIFT)); + ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); if ((anyone) || (iesc)) return; @@ -360,7 +360,7 @@ void fctRead() { st4(caff); else { if (!syn) - ecr3(g_vm->getString(S_READ)); + ecr3(g_vm->getEngineString(S_READ)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(4); @@ -389,7 +389,7 @@ void fctLook() { return; } if (!syn) - ecr3(g_vm->getString(S_LOOK)); + ecr3(g_vm->getEngineString(S_LOOK)); tfleche(); if ((anyone) || (iesc)) return; @@ -475,7 +475,7 @@ void fctSearch() { return; } if (!syn) - ecr3(g_vm->getString(S_SEARCH)); + ecr3(g_vm->getEngineString(S_SEARCH)); tfleche(); if (anyone || iesc) return; @@ -563,7 +563,7 @@ void fctOpen() { int cx, haz; if (!syn) - ecr3(g_vm->getString(S_OPEN)); + ecr3(g_vm->getEngineString(S_OPEN)); if (caff == 26) { if (ment != 0) { msg[4] = OPCODE_ENTER; @@ -631,7 +631,7 @@ void fctPlace() { return; } if (!syn) - ecr3(g_vm->getString(S_PUT)); + ecr3(g_vm->getEngineString(S_PUT)); tfleche(); if (iesc) crep = 998; @@ -671,7 +671,7 @@ void fctPlace() { parole(6, -9, 1); // Do you want to enter the hidden passage? - int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer== 1) { deline(582, st, tay); i = Alert::show(delig, 1); @@ -752,7 +752,7 @@ void fctTurn() { return; } if (!syn) - ecr3(g_vm->getString(S_TURN)); + ecr3(g_vm->getEngineString(S_TURN)); tfleche(); if ((anyone) || (iesc)) return; @@ -762,7 +762,7 @@ void fctTurn() { if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); - int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) g_vm->_endGame = true; else @@ -772,7 +772,7 @@ void fctTurn() { repon(2, 175); clsf3(); parole(6, -9, 1); - int answer = Alert::show(g_vm->getString(S_YES_NO), 1); + int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { s.mlieu = 16; affrep(); @@ -788,7 +788,7 @@ void fctTurn() { */ void fctHideSelf() { if (!syn) - ecr3(g_vm->getString(S_HIDE_SELF)); + ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(10); @@ -810,7 +810,7 @@ void fctAttach() { crep = 186; else { if (!syn) - ecr3(g_vm->getString(S_TIE)); + ecr3(g_vm->getEngineString(S_TIE)); tfleche(); if (!(anyone) && !(iesc)) { tcoord(8); @@ -836,7 +836,7 @@ void fctClose() { int cx, chai; if (!syn) - ecr3(g_vm->getString(S_CLOSE)); + ecr3(g_vm->getEngineString(S_CLOSE)); if (caff < 26) { tfleche(); if (iesc) @@ -875,9 +875,9 @@ void fctKnock() { int l, p, haz; if (!syn) - ecr3(g_vm->getString(S_HIT)); + ecr3(g_vm->getEngineString(S_HIT)); if (s.mlieu == 15) { - l = Alert::show(g_vm->getString(S_BEFORE_USE_DEP_MENU), 1); + l = Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } if (s.mlieu < 25) { @@ -917,7 +917,7 @@ void fctPut() { int cx, chai; if (!syn) - ecr3(g_vm->getString(S_POSE)); + ecr3(g_vm->getEngineString(S_POSE)); if (s.derobj == 0) crep = 186; else { @@ -1154,7 +1154,7 @@ void fctSleep() { clsf3(); clsf2(); ecrf2(); - ecr2(g_vm->getString(S_WANT_TO_WAKE_UP)); + ecr2(g_vm->getEngineString(S_WANT_TO_WAKE_UP)); calch(j, h, m); int answer; @@ -1172,7 +1172,7 @@ void fctSleep() { if (h > 23) h = 0; tinke(); - answer = Alert::show(g_vm->getString(S_YES_NO), 1); + answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); anyone = false; } while (answer != 1); crep = 998; @@ -1185,7 +1185,7 @@ void fctSleep() { */ void fctForce() { if (!syn) - ecr3(g_vm->getString(S_SMASH)); + ecr3(g_vm->getEngineString(S_SMASH)); if (caff < 25) tfleche(); if ((! anyone) && (! iesc)) @@ -1261,7 +1261,7 @@ void fctWait() { return; } repon(2, 102); - answer = Alert::show(g_vm->getString(S_YES_NO), 1); + answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); } while (answer != 2); crep = 998; if (!anyone) @@ -1274,7 +1274,7 @@ void fctWait() { */ void fctSound() { if (!syn) - ecr3(g_vm->getString(S_PROBE2)); + ecr3(g_vm->getEngineString(S_PROBE2)); if (caff < 27) { tfleche(); if (!(anyone) && (!iesc)) @@ -1289,7 +1289,7 @@ void fctSound() { */ void fctDiscuss() { bool te[47]; - int ix, cy, cx, max, haz, suj, co, lig, icm, + int cy, cx, max, haz, suj, co, lig, icm, i, tay, choi, x, y, c; char tou; Common::String lib[47]; @@ -1316,9 +1316,9 @@ void fctDiscuss() { premtet(); sparl(0, suj); hirs(); - for (ix = 1; ix <= 46; ++ix) + for (int ix = 1; ix <= 46; ++ix) te[ix] = false; - for (ix = 1; ix <= 45; ++ix) { + for (int ix = 1; ix <= 45; ++ix) { deline(ix + c_tparler, st, tay); lib[ix] = delig; for (i = tay; i <= 40; ++i) @@ -1376,7 +1376,7 @@ void fctDiscuss() { choi = 0; } } else { - ix = cy; + int ix = cy; if (cx == 41) ix = ix + 23; if (ix != choi) { @@ -1413,7 +1413,7 @@ void fctDiscuss() { } while (!((tou == '\15') || (((c != 0) || g_vm->getMouseClick()) && (choi != 0)))); g_vm->setMouseClick(false); if (choi != 46) { - ix = choi - 1; + int ix = choi - 1; if (col) { col = false; s.mlieu = 15; @@ -1446,7 +1446,7 @@ void fctDiscuss() { s.teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { - for (ix = 29; ix <= 31; ++ix) + for (int ix = 29; ix <= 31; ++ix) s.teauto[ix] = '*'; s.pourc[7] = '*'; } @@ -1491,7 +1491,7 @@ void fctSmell() { crep = 119; if (caff < 26) { if (!syn) - ecr3(g_vm->getString(S_SMELL)); + ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); if (!(anyone) && !(iesc)) if (caff == 16) @@ -1509,7 +1509,7 @@ void fctScratch() { crep = 155; if (caff < 27) { if (!syn) - ecr3(g_vm->getString(S_SCRATCH)); + ecr3(g_vm->getEngineString(S_SCRATCH)); tfleche(); } num = 0; @@ -1570,7 +1570,7 @@ void MortevielleEngine::loseGame() { _hour = 10; _day = 0; repon(2, 180); - answer = Alert::show(g_vm->getString(S_YES_NO), 1); + answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 5c53616e25..b91fd30ee3 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -424,8 +424,8 @@ bool Ques::show() { * Draw the F3/F8 dialog */ void f3f8::draw() { - Common::String f3 = g_vm->getString(S_F3); - Common::String f8 = g_vm->getString(S_F8); + Common::String f3 = g_vm->getEngineString(S_F3); + Common::String f8 = g_vm->getEngineString(S_F8); // Write the F3 and F8 text strings g_vm->_screenSurface.putxy(3, 44); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index bb901a15d8..f81a454ab9 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -56,7 +56,7 @@ void Menu::menut(int no, Common::String nom) { s += ' '; switch (h) { - case invent: + case MENU_INVENTORY: if (l != 7) { _inv[l] = s; _inv[l].insertChar(' ', 0); @@ -65,10 +65,10 @@ void Menu::menut(int no, Common::String nom) { case MENU_MOVE: _dep[l] = s; break; - case action: + case MENU_ACTION: _act[l] = s; break; - case saction: + case MENU_SUB_ACTION: _self[l] = s; break; case MENU_DISCUSS: @@ -88,7 +88,7 @@ void Menu::disableMenuItem(int no) { byte l = lo(no); switch (h) { - case invent: + case MENU_INVENTORY: if (l > 6) { _inv[l].setChar('<', 0); _inv[l].setChar('>', 21); @@ -98,10 +98,10 @@ void Menu::disableMenuItem(int no) { case MENU_MOVE: _dep[l].setChar('*', 0); break; - case action: + case MENU_ACTION: _act[l].setChar('*', 0); break; - case saction: + case MENU_SUB_ACTION: _self[l].setChar('*', 0); break; case MENU_DISCUSS: @@ -121,17 +121,17 @@ void Menu::enableMenuItem(int no) { byte l = lo(no); switch (h) { - case invent : + case MENU_INVENTORY: _inv[l].setChar(' ', 0); _inv[l].setChar(' ', 21); break; case MENU_MOVE: _dep[l].setChar(' ', 0); break; - case action: + case MENU_ACTION: _act[l].setChar(' ', 0); break; - case saction: + case MENU_SUB_ACTION: _self[l].setChar(' ', 0); _self[l].setChar(' ', 0); break; @@ -222,18 +222,18 @@ void Menu::invers(int ix) { s = _dis[lo(msg4)]; break; case 6: - s = g_vm->getString(S_SAVE_LOAD + lo(msg4)); + s = g_vm->getEngineString(S_SAVE_LOAD + lo(msg4)); break; case 7: - s = g_vm->getString(S_SAVE_LOAD + 1); + s = g_vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + lo(msg4)); break; case 8: if (lo(msg4) == 1) { - s = g_vm->getString(S_RESTART); + s = g_vm->getEngineString(S_RESTART); } else { - s = g_vm->getString(S_SAVE_LOAD + 2); + s = g_vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + lo(msg4)); } @@ -324,10 +324,10 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.writeg(_dis[cx], 4); break; case 6: - g_vm->_screenSurface.writeg(g_vm->getString(S_SAVE_LOAD + cx), 4); + g_vm->_screenSurface.writeg(g_vm->getEngineString(S_SAVE_LOAD + cx), 4); break; case 7: { - Common::String s = g_vm->getString(S_SAVE_LOAD + 1); + Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); g_vm->_screenSurface.writeg(s, 4); @@ -335,9 +335,9 @@ void Menu::menuDown(int ii) { break; case 8: if (cx == 1) - g_vm->_screenSurface.writeg(g_vm->getString(S_RESTART), 4); + g_vm->_screenSurface.writeg(g_vm->getEngineString(S_RESTART), 4); else { - Common::String s = g_vm->getString(S_SAVE_LOAD + 2); + Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + cx); g_vm->_screenSurface.writeg(s, 4); @@ -416,20 +416,20 @@ void Menu::mdn() { || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { if (x < 76 * res) - ix = invent; + ix = MENU_INVENTORY; else if (x < 124 * res) ix = MENU_MOVE; else if (x < 172 * res) - ix = action; + ix = MENU_ACTION; else if (x < 220 * res) - ix = saction; + ix = MENU_SUB_ACTION; else if (x < 268 * res) ix = MENU_DISCUSS; else - ix = fichier; + ix = MENU_FILE; if ((ix != msg3) || (! test0)) - if (!((ix == fichier) && ((msg3 == sauve) || (msg3 == charge)))) { + if (!((ix == MENU_FILE) && ((msg3 == MENU_SAVE) || (msg3 == MENU_LOAD)))) { menuUp(msg3); menuDown(ix); msg3 = ix; @@ -440,7 +440,7 @@ void Menu::mdn() { util(x, y); } } else { // There was a click - if ((msg3 == fichier) && (msg4 != OPCODE_NONE)) { + if ((msg3 == MENU_FILE) && (msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 1fb8ad45c6..84169241c3 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,8 +60,8 @@ public: }; enum { - invent = 1, MENU_MOVE = 2, action = 3, saction = 4, - MENU_DISCUSS = 5, fichier = 6, sauve = 7, charge = 8 + MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SUB_ACTION = 4, + MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8 }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index f8873c66b0..f36ae2dff5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -244,11 +244,11 @@ void clsf10() { } g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); if (s.conf < 33) - st = g_vm->getString(S_COOL); + st = g_vm->getEngineString(S_COOL); else if (s.conf < 66) - st = g_vm->getString(S_LOURDE); + st = g_vm->getEngineString(S_LOURDE); else if (s.conf > 65) - st = g_vm->getString(S_MALSAINE); + st = g_vm->getEngineString(S_MALSAINE); co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); g_vm->_screenSurface.putxy(co, 92); @@ -598,9 +598,9 @@ void person() { for (int cf = 1; cf <= 8; ++cf) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); - Common::String sYou = g_vm->getString(S_YOU); - Common::String sAre = g_vm->getString(S_ARE); - Common::String sAlone = g_vm->getString(S_ALONE); + Common::String sYou = g_vm->getEngineString(S_YOU); + Common::String sAre = g_vm->getEngineString(S_ARE); + Common::String sAlone = g_vm->getEngineString(S_ALONE); clsf10(); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sYou) / 2), 30); @@ -661,7 +661,7 @@ void drawClock() { g_vm->_screenSurface.putxy(550, 160); if ((_day >= 0) && (_day <= 8)) { - Common::String tmp = g_vm->getString(S_DAY); + Common::String tmp = g_vm->getEngineString(S_DAY); tmp.insertChar((char)(_day + 49), 0); g_vm->_screenSurface.writeg(tmp, 1); } @@ -1306,12 +1306,14 @@ void cavegre() { s.conf += (s.conf / 10); clsf3(); ecrf2(); - ecr3(g_vm->getString(S_SOMEONE_ENTERS)); + ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); haz = (hazard(0, 4)) - 2; parole(2, haz, 1); // Useless? - for (haz = 0; haz <= 3000; ++haz); + for (haz = 0; haz <= 3000; ++haz) + ; + clsf3(); person(); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c235186c8a..fb1ccafa31 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -40,12 +40,12 @@ namespace Mortevielle { void tinke() { - Common::String d1 = g_vm->getString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = g_vm->getString(S_NUMBER_OF_HINTS); + Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); const char d3 = '['; const char d4 = ']'; const char d5 = '1'; - Common::String d6 = g_vm->getString(S_OK); + Common::String d6 = g_vm->getEngineString(S_OK); int cx, haz, nh, cf, j, h, m; Common::String stpo; bool am; @@ -169,7 +169,7 @@ void tinke() { if (haz < 5) { clsf3(); ecrf2(); - ecr3(g_vm->getString(S_HEAR_NOISE)); + ecr3(g_vm->getEngineString(S_HEAR_NOISE)); haz = (hazard(0, 4)) - 2; parole(1, haz, 1); clsf3(); @@ -286,8 +286,8 @@ void mfouen() { for (cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(men[cx]); - g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_PROBE)); - g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_RAISE)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); } /* NIVEAU 6 */ @@ -434,8 +434,8 @@ void mfoudi() { for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.disableMenuItem(men[cx]); - g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); - g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_STOP)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); } void mennor() { @@ -812,7 +812,7 @@ void st13(int ob) { } void aldepl() { - Alert::show(g_vm->getString(S_USE_DEP_MENU), 1); + Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6be14bdfa9..4f367412fc 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -212,7 +212,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Close the file f.close(); - assert(_staticStrings.size() > 0); + assert(_engineStrings.size() > 0); return Common::kNoError; } @@ -240,7 +240,7 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { while ((ch = (char)f.readByte()) != '\0') s += ch; - _staticStrings.push_back(s); + _engineStrings.push_back(s); dataSize -= s.size() + 1; } assert(dataSize == 0); @@ -565,19 +565,19 @@ void MortevielleEngine::handleAction() { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (choisi && (msg[3] == sauve)) { + if (choisi && (msg[3] == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", msg[4] & 7); g_vm->_savegameManager.saveGame(msg[4] & 7, saveName); } - if (choisi && (msg[3] == charge)) + if (choisi && (msg[3] == MENU_LOAD)) g_vm->_savegameManager.loadGame((msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(stpou, 1); return; } else if (inkey == '\77') { - if ((mnumo != OPCODE_NONE) && ((msg[3] == action) || (msg[3] == saction))) { + if ((mnumo != OPCODE_NONE) && ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SUB_ACTION))) { msg[4] = mnumo; - ecr3(g_vm->getString(S_IDEM)); + ecr3(g_vm->getEngineString(S_IDEM)); } else return; } else if (inkey == '\104') { @@ -598,7 +598,7 @@ void MortevielleEngine::handleAction() { num = 0; } else { mnumo = msg[3]; - if ((msg[3] == action) || (msg[3] == saction)) + if ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SUB_ACTION)) mnumo = msg[4]; if (! anyone) { if ((fouil) || (obpart)) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b0f1c4cffe..07c5896086 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -80,7 +80,7 @@ private: bool _mouseClick; Common::Point _mousePos; bool _inMainGameLoop; // Flag when the main game loop is active - Common::StringArray _staticStrings; + Common::StringArray _engineStrings; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); @@ -124,7 +124,7 @@ public: bool getMouseClick() const { return _mouseClick; } void setMouseClick(bool v) { _mouseClick = v; } void delay(int amount); - Common::String getString(int idx) const { return _staticStrings[idx]; } + Common::String getEngineString(int idx) const { return _engineStrings[idx]; } void endGame(); void loseGame(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 96083f1fc8..e2a6cf454c 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -174,7 +174,7 @@ void tsitu() { fctMove(); if (msg[3] == MENU_DISCUSS) fctDiscuss(); - if (msg[3] == invent) + if (msg[3] == MENU_INVENTORY) tsprendre(); //Translation: inventory/take if (msg[4] == OPCODE_ATTACH) fctAttach(); -- cgit v1.2.3 From ce56512c99b522e3942a84993360203d5f9e8fbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 26 Feb 2012 02:04:25 +0100 Subject: MORTEVIELLE: First "English" version. DAT file needs to be rebuilt --- devtools/create_mortdat/create_mortdat.cpp | 19 +++++---- devtools/create_mortdat/create_mortdat.h | 5 +++ engines/mortevielle/mortevielle.cpp | 31 +++++++++++++-- engines/mortevielle/mortevielle.h | 14 +++++-- engines/mortevielle/outtext.cpp | 12 ++++++ engines/mortevielle/ovd1.cpp | 63 +++++++++++++++++------------- 6 files changed, 102 insertions(+), 42 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index de4bb415d4..4c1dd14fdb 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -82,10 +82,15 @@ void writeFontBlock() { outputFile.write(fontBuffer, 121 * 6); } -void writeStaticStrings(const char **strings, int languageId) { +void writeStaticStrings(const char **strings, DataType dataType, int languageId) { // Write out a section header char sStaticStrings[4] = { 'S', 'S', 'T', 'R' }; - outputFile.write(sStaticStrings, 4); + char sGameStrings[4] = { 'G', 'S', 'T', 'R' }; + + if (dataType == kStaticStrings) + outputFile.write(sStaticStrings, 4); + else if (dataType == kGameStrings) + outputFile.write(sGameStrings, 4); // Figure out the block size int blockSize = 1; @@ -112,22 +117,22 @@ void writeStaticStrings(const char **strings, int languageId) { * Write out the strings previously hard-coded into the engine */ void writeEngineStrings() { - writeStaticStrings(engineDataEn, 1); - writeStaticStrings(engineDataFr, 0); + writeStaticStrings(engineDataEn, kStaticStrings, 1); + writeStaticStrings(engineDataFr, kStaticStrings, 0); } /** * Write out the strings used in the game */ void writeGameStrings() { - writeStaticStrings(gameDataEn, 1); - writeStaticStrings(gameDataFr, 0); + writeStaticStrings(gameDataEn, kGameStrings, 1); + writeStaticStrings(gameDataFr, kGameStrings, 0); } void process() { writeFontBlock(); - writeEngineStrings(); writeGameStrings(); + writeEngineStrings(); } /** diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h index d9c7561d93..0aa6b529df 100644 --- a/devtools/create_mortdat/create_mortdat.h +++ b/devtools/create_mortdat/create_mortdat.h @@ -31,6 +31,11 @@ enum AccessMode { kFileWriteMode = 2 }; +enum DataType { + kStaticStrings = 0, + kGameStrings = 1 +}; + #define MORT_DAT "mort.dat" class File { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4f367412fc..9ca4839e76 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -38,6 +38,7 @@ #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole2.h" #include "mortevielle/prog.h" @@ -123,11 +124,28 @@ Common::ErrorCode MortevielleEngine::initialise() { _currGraphicalDevice = MODE_EGA; res = 2; + _txxFileFl = false; + // Load texts from TXX files + chartex(); + // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); if (result != Common::kNoError) return result; + // Load some error messages (was previously in chartex()) + int length = 0; + char str[1410]; + + deline(578, str, length); + al_mess = delig; + deline(579, str, length); + err_mess = delig; + deline(580, str, length); + ind_mess = delig; + deline(581, str, length); + al_mess2 = delig; + // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -138,7 +156,6 @@ Common::ErrorCode MortevielleEngine::initialise() { _newGraphicalDevice = _currGraphicalDevice; zuul = false; tesok = false; - chartex(); charpal(); charge_cfiph(); charge_cfiec(); @@ -202,7 +219,9 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Font resource _screenSurface.readFontData(f, dataSize); } else if (!strncmp(dataType, "SSTR", 4)) { - readStaticStrings(f, dataSize); + readStaticStrings(f, dataSize, kStaticStrings); + } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { + readStaticStrings(f, dataSize, kGameStrings); } else { // Unknown section f.skip(dataSize); @@ -219,7 +238,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { /** * Read in a static strings block, and if the language matches, load up the static strings */ -void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { +void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataType dataType) { // Figure out what language Id is needed byte desiredLanguageId = (getLanguage() == Common::EN_ANY) ? LANG_ENGLISH : LANG_FRENCH; @@ -240,7 +259,11 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { while ((ch = (char)f.readByte()) != '\0') s += ch; - _engineStrings.push_back(s); + if (dataType == kStaticStrings) + _engineStrings.push_back(s); + else if (dataType == kGameStrings) + _gameStrings.push_back(s); + dataSize -= s.size() + 1; } assert(dataSize == 0); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 07c5896086..c44daff1bd 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -48,7 +48,8 @@ enum { // Game languages enum { LANG_FRENCH = 0, - LANG_ENGLISH = 1 + LANG_ENGLISH = 1, + LANG_GERMAN = 2 }; // Static string list @@ -65,6 +66,11 @@ enum { S_SMELL = 40, S_SCRATCH = 41, S_PROBE2 = 42, S_BEFORE_USE_DEP_MENU = 43, S_DAY = 44 }; +enum DataType { + kStaticStrings = 0, + kGameStrings = 1 +}; + #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 #define SCREEN_ORIG_HEIGHT 200 @@ -81,10 +87,10 @@ private: Common::Point _mousePos; bool _inMainGameLoop; // Flag when the main game loop is active Common::StringArray _engineStrings; - + Common::StringArray _gameStrings; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); - void readStaticStrings(Common::File &f, int dataSize); + void readStaticStrings(Common::File &f, int dataSize, DataType dataType); void loadFont(Common::File &f); bool handleEvents(); void addKeypress(Common::Event &evt); @@ -105,6 +111,7 @@ public: bool _quitGame; // Quit game flag. Originally called 'arret' bool _endGame; // End game flag. Originally called 'solu' bool _loseGame; // Lose game flag. Originally called 'perdu' + bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -125,6 +132,7 @@ public: void setMouseClick(bool v) { _mouseClick = v; } void delay(int amount); Common::String getEngineString(int idx) const { return _engineStrings[idx]; } + Common::String getGameString(int idx) const { return _gameStrings[idx]; } void endGame(); void loseGame(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 1c73f7ab4d..99c2cac92c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -132,6 +132,16 @@ void deline(int num, char *line , int &length) { return; } + if (!g_vm->_txxFileFl) { + delig = g_vm->getGameString(num); + if (line) { + strcpy(line, delig.c_str()); + length = delig.size(); + } + + return; + } + // DETEX delig = ""; int ts = t_rec[num].indis; @@ -155,6 +165,8 @@ void deline(int num, char *line , int &length) { if (length < 255) // Remove trailing '$' delig.deleteLastChar(); + + warning("deline: delig %s - line %s", delig.c_str(), line); } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 74639d32db..17966b88c6 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -100,45 +100,52 @@ void charpal() { } void chartex() { - Common::File f; + Common::File inpFile; + Common::File ntpFile; char s[1410]; - /* debug('o3 chartex'); */ - if (!f.open("TXX.INP")) - if (!f.open("TXX.MOR")) - error("Missing file - TXX.INP or .MOR"); + g_vm->_txxFileFl = false; + if (g_vm->getLanguage() == Common::EN_ANY) { + warning("English version expected - Switching to DAT file"); + return; + } - assert(f.size() <= (maxti * 2)); - for (int i = 0; i < f.size() / 2; ++i) - t_mot[i] = f.readUint16LE(); + if (!inpFile.open("TXX.INP")) { + if (!inpFile.open("TXX.MOR")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + } - f.close(); + if (!ntpFile.open("TXX.NTP")) { + if (!ntpFile.open("TXX.IND")) { + warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); + return; + } + } - if (!f.open("TXX.NTP")) - if (!f.open("TXX.IND")) - error("Missing file - TXX.NTP or .IND"); - - assert(f.size() <= (maxtd * 3)); - int i; - for (i = 0; i < (f.size() / 3); ++i) { - t_rec[i].indis = f.readSint16LE(); - t_rec[i].point = f.readByte(); + if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { + warning("TXX file - Unexpected format - Switching to DAT file"); + return; } - f.close(); + for (int i = 0; i < inpFile.size() / 2; ++i) + t_mot[i] = inpFile.readUint16LE(); + + inpFile.close(); + + for (int i = 0; i < (ntpFile.size() / 3); ++i) { + t_rec[i].indis = ntpFile.readSint16LE(); + t_rec[i].point = ntpFile.readByte(); + } + + ntpFile.close(); - 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; + g_vm->_txxFileFl = true; } /** - * The original engine used this method to display a starting text screen letting the palyer + * The original engine used this method to display a starting text screen letting the player * select the graphics mode to use */ void dialpre() { -- cgit v1.2.3 From 510cae8af11ec66d849d6d6912eacef048de8012 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 26 Feb 2012 18:08:53 +0100 Subject: MORTEVIELLE: Start removing deline() and delig --- engines/mortevielle/actions.cpp | 25 ++++------ engines/mortevielle/dialogs.cpp | 44 +++++++----------- engines/mortevielle/graphics.cpp | 14 ++++-- engines/mortevielle/menu.cpp | 15 ++---- engines/mortevielle/mor.cpp | 91 ++++++++++++++----------------------- engines/mortevielle/mor2.cpp | 30 ++++-------- engines/mortevielle/mortevielle.cpp | 15 ++---- engines/mortevielle/outtext.cpp | 30 +++++++++--- engines/mortevielle/outtext.h | 3 +- engines/mortevielle/ovd1.cpp | 1 - engines/mortevielle/var_mor.cpp | 2 +- 11 files changed, 113 insertions(+), 157 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 68d6e82c43..a22dd3bbf2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -47,7 +47,6 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void fctMove() { - //int mx, cx, cy; int cx; if ((s.mlieu == 26) && (msg[4] == g_vm->_menu._depl[6])) { @@ -180,7 +179,6 @@ L2: * @remarks Originally called 'tprendre' */ void fctTake() { - //int cx, cy, cz; int cx; if (caff > 99) { @@ -354,8 +352,6 @@ void fctLift() { * @remarks Originally called 'tlire' */ void fctRead() { -// int iaff; - if (caff > 99) st4(caff); else { @@ -622,9 +618,8 @@ void fctOpen() { */ void fctPlace() { bool enterPassageFl; - char st[1410]; Common::String str_; - int i, tay; + int i; if (s.derobj == 0) { crep = 186; @@ -673,8 +668,9 @@ void fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer== 1) { - deline(582, st, tay); - i = Alert::show(delig, 1); + Common::String alertTxt = delin2(582); + i = Alert::show(alertTxt, 1); + tesok = false; enterPassageFl = Ques::show(); hideMouse(); @@ -700,8 +696,8 @@ void fctPlace() { dessin(0); aniof(1, 2); aniof(1, 1); - deline(577, st, tay); - i = Alert::show(delig, 1); + alertTxt = delin2(577); + i = Alert::show(alertTxt, 1); aniof(2, 1); crep = 166; } @@ -1289,11 +1285,9 @@ void fctSound() { */ void fctDiscuss() { bool te[47]; - int cy, cx, max, haz, suj, co, lig, icm, - i, tay, choi, x, y, c; + int cy, cx, max, haz, suj, co, lig, icm, i, choi, x, y, c; char tou; Common::String lib[47]; - char st[1410]; bool f; finfouil(); @@ -1319,9 +1313,8 @@ void fctDiscuss() { for (int ix = 1; ix <= 46; ++ix) te[ix] = false; for (int ix = 1; ix <= 45; ++ix) { - deline(ix + c_tparler, st, tay); - lib[ix] = delig; - for (i = tay; i <= 40; ++i) + lib[ix] = delin2(ix + c_tparler); + for (i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } lib[46] = lib[45]; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b91fd30ee3..f8c5ceb3f6 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -290,13 +290,12 @@ bool Ques::show() { const int correctAnswerArr[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; int optionPosY; - int curLength, maxLength; + int maxLength; int rep; int firstOption, lastOption; char key; rectangle coor[max_rect]; Common::String choiceArray[15]; - char st[1410]; int currChoice, prevChoice; int indx = 0; @@ -308,14 +307,15 @@ bool Ques::show() { hirs(); showMouse(); ++indx; - deline(textIndexArr[indx], st, curLength); int dialogHeight; if (res == 1) dialogHeight = 29; else dialogHeight = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); - afftex(st, 20, 15, 100, 2, 0); + Common::String tmpStr = delin2(textIndexArr[indx]); + afftex(tmpStr, 20, 15, 100, 2, 0); + if (indx != 10) { firstOption = textIndexArr[indx] + 1; lastOption = textIndexArr[indx + 1] - 1; @@ -327,11 +327,11 @@ bool Ques::show() { maxLength = 0; for (int j = firstOption, prevChoice = 1; j <= lastOption; ++j, ++prevChoice) { - deline(j, st, curLength); - if (curLength > maxLength) - maxLength = curLength; - afftex(st, 100, optionPosY, 100, 1, 0); - choiceArray[prevChoice] = delig; + tmpStr = delin2(j); + if ((int) tmpStr.size() > maxLength) + maxLength = tmpStr.size(); + afftex(tmpStr, 100, optionPosY, 100, 1, 0); + choiceArray[prevChoice] = tmpStr; optionPosY += 8; } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { @@ -356,6 +356,7 @@ bool Ques::show() { rep = 0; prevChoice = 0; + warning("Expected answer: %d", correctAnswerArr[indx]); do { g_vm->setMouseClick(false); tesok = false; @@ -368,34 +369,21 @@ bool Ques::show() { ++currChoice; if (coor[currChoice].enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { - st[0] = ' '; -// for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[prevChoice][j]; - strncpy(st + 1, choiceArray[prevChoice].c_str(), maxLength); - st[1 + maxLength] = '$'; - afftex(st, 100, 27 + (prevChoice * 8), 100, 1, 0); + Common::String tmpStr = choiceArray[prevChoice] + '$'; + afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { - st[0] = ' '; -// for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[currChoice][j]; - strncpy(st + 1, choiceArray[currChoice].c_str(), maxLength); - st[1 + maxLength] = '$'; - afftex(st, 100, 27 + (currChoice * 8), 100, 1, 1); + Common::String tmpStr = choiceArray[currChoice] + '$'; + afftex(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { - st[0] = ' '; -// for (j = 0; j <= maxLength; ++j) -// st[j + 1] = choiceArray[prevChoice][j]; - strncpy(st + 1, choiceArray[prevChoice].c_str(), maxLength); - st[1 + maxLength] = '$'; - afftex(st, 100, 27 + (prevChoice * 8), 100, 1, 0); + Common::String tmpStr = choiceArray[prevChoice] + '$'; + afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } } while (!((prevChoice != 0) && g_vm->getMouseClick())); - warning("Expected answer: %d, answer: %d", prevChoice, correctAnswerArr[indx]); if (prevChoice == correctAnswerArr[indx]) // Answer is correct ++correctCount; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 7511b21ce2..bec7ef4073 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1112,18 +1112,22 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { a = (float)((x - xx)) / (y - yy); b = (yr * xro - yro * xr) / (y - yy); i = y; - if (y > yy) step = -1; - else step = 1; + if (y > yy) + step = -1; + else + step = 1; do { g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); - i = i + step; + i += step; } while (i != yy); } else { a = (float)((y - yy)) / (x - xx); b = ((yro * xr) - (yr * xro)) / (x - xx); i = x; - if (x > xx) step = -1; - else step = 1; + if (x > xx) + step = -1; + else + step = 1; do { g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f81a454ab9..d176d7cd70 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -389,11 +389,9 @@ void Menu::eraseMenu() { * Handle updates to the menu */ void Menu::mdn() { - //int x, y, c, a, ix; int x, y, ix; bool tes; - /* debug('mdn'); */ if (!_menuActive) return; @@ -466,8 +464,7 @@ void Menu::mdn() { } void Menu::initMenu() { - int i, tai; - char st[1410]; + int i; Common::File f; if (!f.open("menufr.mor")) @@ -488,20 +485,18 @@ void Menu::initMenu() { _dep[i] = "* "; i = 1; do { - deline(i + c_action, st, tai); - _act[i] = delig; + _act[i] = delin2(i + c_action); + while (_act[i].size() < 10) _act[i] += ' '; if (i < 9) { if (i < 6) { - deline(i + c_saction, st, tai); - _self[i] = delig; + _self[i] = delin2(i + c_saction); while (_self[i].size() < 10) _self[i] += ' '; } - deline(i + c_dis, st, tai); - _dis[i] = delig + ' '; + _dis[i] = delin2(i + c_dis) + ' '; } ++i; } while (i != 22); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index f36ae2dff5..cac723a4f5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -130,20 +130,16 @@ void text_color(int c) { void text1(int x, int y, int nb, int m) { - char st[1410]; - int tay; int co; - - /* debug('text'); */ if (res == 1) co = 10; else co = 6; - deline(m, st, tay); - if ((y == 182) && (tay * co > nb * 6)) + Common::String tmpStr = delin2(m); + if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; - afftex(st, x, y, nb, 20, color_txt); + afftex(tmpStr, x, y, nb, 20, color_txt); } void initouv() { @@ -313,31 +309,26 @@ void okpas() { } void modobj(int m) { - char str_[1410]; - int tay; - Common::String strp = Common::String(' '); - if (m != 500) { - deline(m - 501 + c_st41, str_, tay); - strp = delig; - } + + if (m != 500) + strp = delin2(m - 501 + c_st41); + g_vm->_menu.menut(g_vm->_menu._invt[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); } void modobj2(int m, bool t1, bool t2) { - char str_[1410]; - int tay; - Common::String strp = Common::String(' '); + if (t1 || t2) okpas(); else tesok = false;; - if (m != 500) { - deline(m - 501 + c_st41, str_, tay); - strp = delig; - } + + if (m != 500) + strp = delin2(m - 501 + c_st41); + g_vm->_menu.menut(g_vm->_menu._invt[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); } @@ -346,17 +337,19 @@ void modobj2(int m, bool t1, bool t2) { void repon(int f, int m) { Common::String str_; Common::String str1; - char st[1410]; - int i, xco, dx, caspe, tay; + Common::String tmpStr; + int i, xco, dx, caspe; if ((m > 499) && (m < 563)) { - deline(m - 501 + c_st41, st, tay); - if (tay > ((58 + (res - 1) * 37) << 1)) + tmpStr = delin2(m - 501 + c_st41); + + if ((int) tmpStr.size() > ((58 + (res - 1) * 37) << 1)) f2_all = true; else f2_all = false; + clsf2(); - afftex(st, 8, 176, 85, 3, 5); + afftex(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); if (f == 8) @@ -378,33 +371,37 @@ void repon(int f, int m) { } } if ((f >= 6) && (f <= 9)) { - deline(m, st, tay); if (f == 6) i = 4; else i = 5; - afftex(st, 80, 40, 60, 25, i); + + tmpStr = delin2(m); + afftex(tmpStr, 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); + tmpStr = delin2(m); if (res == 1) { - xco = 252 - tay * 5; + xco = 252 - tmpStr.size() * 5; caspe = 100; dx = 80; } else { - xco = 252 - tay * 3; + xco = 252 - tmpStr.size() * 3; caspe = 144; dx = 50; } - if (tay < 40) - afftex(st, xco, 86, dx, 3, 5); + + if (tmpStr.size() < 40) + afftex(tmpStr, xco, 86, dx, 3, 5); else - afftex(st, caspe, 86, dx, 3, 5); + afftex(tmpStr, caspe, 86, dx, 3, 5); } } } @@ -443,7 +440,6 @@ void t5(int cx) { void affper(int per) { int cx; - /* debug('affper'); */ for (cx = 1; cx <= 8; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cx]); clsf10(); @@ -905,7 +901,6 @@ void quelq20(int h, int &per) { void frap() { int j, h, m, haz; - /* debug('o1 frap'); */ calch(j, h, m); if ((h >= 0) && (h < 8)) crep = 190; @@ -968,7 +963,6 @@ void tip(int ip, int &cx) { void ecfren(int &p, int &haz, int cf, int l) { - /* debug('o1 ecfren'); */ if (l == 0) person(); p = -500; @@ -996,7 +990,6 @@ void ecfren(int &p, int &haz, int cf, int l) { void becfren(int l) { int haz; - /* debug('o1 becfren'); */ if ((l == 1) || (l == 4)) { haz = hazard(1, 2); if (l == 1) @@ -1029,13 +1022,11 @@ void becfren(int l) { void init_nbrepm() { const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - /* debug('init_nbrepm'); */ for (int idx = 0; idx < 9; ++idx) nbrepm[idx] = ipm[idx]; } void phaz(int &haz, int &p, int cf) { - /* debug('phaz'); */ p += cf; haz = hazard(1, 100); } @@ -1043,7 +1034,6 @@ void phaz(int &haz, int &p, int cf) { void inzon() { int cx; - /* debug('o2 inzon'); */ copcha(); s.ipre = false; @@ -1088,9 +1078,7 @@ void inzon() { } void dprog() { - /* debug('o2 dprog'); */ li = 21; - /* jh:= t_settime(0);*/ jh = 0; if (! s.ipre) blo = true; @@ -1101,7 +1089,6 @@ void dprog() { void pl1(int cf) { int p, haz; - /* debug('o2 pl1'); */ if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { cpl1(p); phaz(haz, p, cf); @@ -1115,7 +1102,6 @@ void pl1(int cf) { void pl2(int cf) { int p, haz; - /* debug('o2 pl2'); */ if (! bh2) { cpl2(p); phaz(haz, p, cf); @@ -1129,7 +1115,6 @@ void pl2(int cf) { void pl5(int cf) { int p, haz; - /* debug('o2 pl5'); */ if (! bh5) { cpl5(p); phaz(haz, p, cf); @@ -1143,7 +1128,6 @@ void pl5(int cf) { void pl6(int cf) { int p, haz; - /* debug('o2 pl6'); */ if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { cpl6(p); phaz(haz, p, cf); @@ -1157,7 +1141,6 @@ void pl6(int cf) { void pl9(int cf) { int p, haz; - /* debug('o2 pl9'); */ if (! bh9) { cf = -10; phaz(haz, p, cf); @@ -1171,7 +1154,6 @@ void pl9(int cf) { void pl10(int cf) { int p, h, haz; - /* debug('o2 pl10'); */ cpl10(p, h); phaz(haz, p, cf); if (haz > p) @@ -1183,7 +1165,6 @@ void pl10(int cf) { void pl11(int cf) { int p, h, haz; - /* debug('o2 pl11'); */ cpl11(p, h); phaz(haz, p, cf); if (haz > p) @@ -1195,7 +1176,6 @@ void pl11(int cf) { void pl12(int cf) { int p, haz; - /* debug('o2 pl12'); */ cpl12(p); phaz(haz, p, cf); if (haz > p) @@ -1207,7 +1187,6 @@ void pl12(int cf) { void pl13(int cf) { int p, haz; - /* debug('o2 pl13'); */ cpl13(p); phaz(haz, p, cf); if (haz > p) @@ -1219,7 +1198,6 @@ void pl13(int cf) { void pl15(int cf) { int p, haz; - /* debug('o2 pl15'); */ cpl15(p); phaz(haz, p, cf); if (haz > p) @@ -1231,7 +1209,6 @@ void pl15(int cf) { void pl20(int cf) { int p, h, haz; - /* debug('o2 pl20'); */ cpl20(p, h); phaz(haz, p, cf); if (haz > p) @@ -1243,7 +1220,6 @@ void pl20(int cf) { void t11(int l11, int &a) { int p, haz, h = 0; - /* debug('o2 t11'); */ ecfren(p, haz, s.conf, l11); li = l11; if ((l11 > 0) && (l11 < 10)) { @@ -1300,7 +1276,6 @@ void t11(int l11, int &a) { void cavegre() { int haz; - /* debug('cavegre'); */ s.conf = s.conf + 2; if (s.conf > 69) s.conf += (s.conf / 10); @@ -1362,8 +1337,8 @@ void musique(int so) { bool i; int haz; - /* debug('musique'); */ - if (so == 0) { /*musik(0)*/ + if (so == 0) { + /* musik(0) */ ; } else if ((prebru == 0) && (! s.ipre)) { parole(10, 1, 1); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index fb1ccafa31..f51275784e 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -238,26 +238,21 @@ void tkey1(bool d) { } void tmlieu(int mli) { - int cx, i, tail; Common::String nomp; - char st[1410]; - if (mli == 26) mli = 15; - i = 1; + int i = 1; while ((i < 8) && (v_lieu[i][mli] != 0)) { - cx = v_lieu[i][mli]; - deline(cx + c_tmlieu, st, tail); - nomp = delig; + nomp = delin2(v_lieu[i][mli] + c_tmlieu); while (nomp.size() < 20) nomp += ' '; g_vm->_menu.menut(g_vm->_menu._depl[i], nomp); ++i; } nomp = "* "; - for (cx = 7; cx >= i; --cx) + for (int cx = 7; cx >= i; --cx) g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); } @@ -377,8 +372,7 @@ void st1sama() { } void modinv() { - int tay, r; - char nom[1410]; + int r; Common::String nomp; int cy = 0; @@ -386,8 +380,7 @@ void modinv() { if (s.sjer[cx] != chr(0)) { ++cy; r = (ord(s.sjer[cx]) + 400); - deline(r - 501 + c_st41, nom, tay); - nomp = delig; + nomp = delin2(r - 501 + c_st41); g_vm->_menu.menut(g_vm->_menu._invt[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); } @@ -400,13 +393,12 @@ void modinv() { void sparl(float adr, float rep) { const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, tay, repint; - char st[1410]; + int key, repint; repint = abs((int)rep); hideMouse(); - deline(repint + c_paroles, st, tay); - afftex(st, 230, 4, 65, 24, 5); + Common::String tmpStr = delin2(repint + c_paroles); + afftex(tmpStr, 230, 4, 65, 24, 5); f3f8::draw(); key = 0; @@ -449,8 +441,6 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - - int cy = acha + ((mchai - 1) * 10) - 1; int cx = 0; do { @@ -484,12 +474,12 @@ void t1sama() { //Entering manor calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { cherjer(137, d); - if (!d) { /* On n'a pas les cl‚s et il est tard */ //Translation: You don't have the keys, and it's late + if (!d) { //You don't have the keys, and it's late crep = 1511; tperd(); } else st1sama(); - } else if (!s.ipre) { /* c'est votre premiŠre fois ? */ //Translation: Is it your first time? + } else if (!s.ipre) { //Is it your first time? ipers = 255; affper(ipers); caff = 77; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 9ca4839e76..262cc3446e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -134,17 +134,10 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - int length = 0; - char str[1410]; - - deline(578, str, length); - al_mess = delig; - deline(579, str, length); - err_mess = delig; - deline(580, str, length); - ind_mess = delig; - deline(581, str, length); - al_mess2 = delig; + al_mess = delin2(578); // Insert floppy #1 + err_mess = delin2(579); // Floppy error + ind_mess = delin2(580); // You should have noticed %d hints + al_mess2 = delin2(581); // Insert floppy #2 // Set default EGA palette _paletteManager.setDefaultPalette(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 99c2cac92c..c2da1166b5 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -134,8 +134,13 @@ void deline(int num, char *line , int &length) { if (!g_vm->_txxFileFl) { delig = g_vm->getGameString(num); +/* if (delig.size() < 255) + // Remove trailing '$' + delig.deleteLastChar(); +*/ if (line) { - strcpy(line, delig.c_str()); + line[0] = ' '; + strcpy(line + 1, delig.c_str()); length = delig.size(); } @@ -169,11 +174,21 @@ void deline(int num, char *line , int &length) { warning("deline: delig %s - line %s", delig.c_str(), line); } +Common::String delin2(int num) { + char tmpStr[1410]; + int length; + + deline(num, tmpStr, length); + + Common::String resStr = delig; + delig = ""; + return resStr; +} -void afftex(char *ch, int x, int y, int dx, int dy, int typ); +void afftex(const char *ch, int x, int y, int dx, int dy, int typ); -static int l_motsuiv(int p, char *ch, int &tab) { +static int l_motsuiv(int p, const char *ch, int &tab) { int c = p; while ((ch[p] != ' ') && (ch[p] != '$') && (ch[p] != '@')) @@ -182,12 +197,14 @@ static int l_motsuiv(int p, char *ch, int &tab) { return tab * (p - c); } -void afftex(char *ch, int x, int y, int dx, int dy, int typ) { +void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { bool the_end; int tab; Common::String s; int i, j; + // Safeguard: add $ just in case + ch += '$'; /* debug(' .. Afftex');*/ g_vm->_screenSurface.putxy(x, y); @@ -201,7 +218,8 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { int yc = y; int xf = x + dx; int yf = y + dy; - int p = 1; +// int p = 1; + int p = 0; the_end = (ch[p] == '$'); s = ""; while (!the_end) { @@ -218,7 +236,7 @@ void afftex(char *ch, int x, int y, int dx, int dy, int typ) { s += ' '; xc += tab; ++p; - if (l_motsuiv(p, ch, tab) + xc > xf) { + if (l_motsuiv(p, ch.c_str(), tab) + xc > xf) { g_vm->_screenSurface.writeg(s, typ); s = ""; xc = x; diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 32d3c4c7ec..742b832612 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -35,7 +35,8 @@ namespace Mortevielle { extern Common::String delig; extern void deline(int num , char *line , int &length); -extern void afftex(char *ch, int x, int y, int dx, int dy, int typ); +extern Common::String delin2(int num); +extern void afftex(Common::String ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 17966b88c6..64bb6cb463 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -102,7 +102,6 @@ void charpal() { void chartex() { Common::File inpFile; Common::File ntpFile; - char s[1410]; g_vm->_txxFileFl = false; if (g_vm->getLanguage() == Common::EN_ANY) { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 7aef569618..daac97704d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -174,7 +174,7 @@ int x, int t_cph[6401]; byte tabdon[4001]; -Common::String stpou; /* donne le % d'indices */ //Translation: "Provides the % of hints" +Common::String stpou; // Provides the % of hints byte is; byte mode; Common::String al_mess, -- cgit v1.2.3 From d3bbf213e9396820b845ecd44c56ff5a695e8562 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 27 Feb 2012 21:31:58 +0100 Subject: MORTEVIELLE: Rename arrays used by menu --- engines/mortevielle/actions.cpp | 12 ++--- engines/mortevielle/menu.cpp | 104 ++++++++++++++++++++-------------------- engines/mortevielle/menu.h | 18 +++---- engines/mortevielle/mor.cpp | 28 +++++------ engines/mortevielle/mor2.cpp | 20 ++++---- engines/mortevielle/mor2.h | 2 +- 6 files changed, 93 insertions(+), 91 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index a22dd3bbf2..80aba8df0d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -49,13 +49,13 @@ namespace Mortevielle { void fctMove() { int cx; - if ((s.mlieu == 26) && (msg[4] == g_vm->_menu._depl[6])) { + if ((s.mlieu == 26) && (msg[4] == g_vm->_menu._moveMenu[6])) { s.mlieu = 15; caff = s.mlieu; afdes(0); repon(2, s.mlieu); } - if ((s.mlieu == 15) && (msg[4] == g_vm->_menu._depl[6])) { + if ((s.mlieu == 15) && (msg[4] == g_vm->_menu._moveMenu[6])) { if (!syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); @@ -88,7 +88,7 @@ void fctMove() { cx = 0; do { ++cx; - } while (g_vm->_menu._depl[cx] != msg[4]); + } while (g_vm->_menu._moveMenu[cx] != msg[4]); if (s.mlieu == 19) { if (cx == 1) t1deva(); @@ -295,7 +295,7 @@ void tsprendre() { cx = 0; do { ++cx; - } while (g_vm->_menu._invt[cx] != msg[4]); + } while (g_vm->_menu._inventoryMenu[cx] != msg[4]); cz = 0; cy = 0; do { @@ -1100,7 +1100,7 @@ void fctEnter() { ++s.conf; s.mlieu = 15; msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._disc[x]; + msg[4] = g_vm->_menu._discussMenu[x]; syn = true; if (ment == 9) { col = true; @@ -1297,7 +1297,7 @@ void fctDiscuss() { cx = 0; do { ++cx; - } while (g_vm->_menu._disc[cx] != msg[4]); + } while (g_vm->_menu._discussMenu[cx] != msg[4]); caff = 69 + cx; afdes(0); repon(2, caff); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d176d7cd70..250fd12d6e 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -43,10 +43,10 @@ namespace Mortevielle { /** * Setup a menu's contents */ -void Menu::menut(int no, Common::String nom) { +void Menu::menut(int no, Common::String name) { byte h = hi(no); byte l = lo(no); - Common::String s = nom; + Common::String s = name; if (! tesok) g_vm->quitGame(); @@ -58,21 +58,21 @@ void Menu::menut(int no, Common::String nom) { switch (h) { case MENU_INVENTORY: if (l != 7) { - _inv[l] = s; - _inv[l].insertChar(' ', 0); + _inventoryStringArray[l] = s; + _inventoryStringArray[l].insertChar(' ', 0); } break; case MENU_MOVE: - _dep[l] = s; + _moveStringArray[l] = s; break; case MENU_ACTION: - _act[l] = s; + _actionStringArray[l] = s; break; case MENU_SUB_ACTION: - _self[l] = s; + _selfStringArray[l] = s; break; case MENU_DISCUSS: - _dis[l] = s; + _discussStringArray[l] = s; break; default: break; @@ -90,22 +90,22 @@ void Menu::disableMenuItem(int no) { switch (h) { case MENU_INVENTORY: if (l > 6) { - _inv[l].setChar('<', 0); - _inv[l].setChar('>', 21); + _inventoryStringArray[l].setChar('<', 0); + _inventoryStringArray[l].setChar('>', 21); } else - _inv[l].setChar('*', 0); + _inventoryStringArray[l].setChar('*', 0); break; case MENU_MOVE: - _dep[l].setChar('*', 0); + _moveStringArray[l].setChar('*', 0); break; case MENU_ACTION: - _act[l].setChar('*', 0); + _actionStringArray[l].setChar('*', 0); break; case MENU_SUB_ACTION: - _self[l].setChar('*', 0); + _selfStringArray[l].setChar('*', 0); break; case MENU_DISCUSS: - _dis[l].setChar('*', 0); + _discussStringArray[l].setChar('*', 0); break; default: break; @@ -115,6 +115,7 @@ void Menu::disableMenuItem(int no) { /** * Enable a menu item * @param no Hi byte represents menu number, lo byte reprsents item index + * @remarks Originally called menu_enable */ void Menu::enableMenuItem(int no) { byte h = hi(no); @@ -122,21 +123,22 @@ void Menu::enableMenuItem(int no) { switch (h) { case MENU_INVENTORY: - _inv[l].setChar(' ', 0); - _inv[l].setChar(' ', 21); + _inventoryStringArray[l].setChar(' ', 0); + _inventoryStringArray[l].setChar(' ', 21); break; case MENU_MOVE: - _dep[l].setChar(' ', 0); + _moveStringArray[l].setChar(' ', 0); break; case MENU_ACTION: - _act[l].setChar(' ', 0); + _actionStringArray[l].setChar(' ', 0); break; case MENU_SUB_ACTION: - _self[l].setChar(' ', 0); - _self[l].setChar(' ', 0); + _selfStringArray[l].setChar(' ', 0); + // The original sets two times the same value. Skipped + // _selfStringArray[l].setChar(' ', 0); break; case MENU_DISCUSS: - _dis[l].setChar(' ', 0); + _discussStringArray[l].setChar(' ', 0); break; default: break; @@ -207,19 +209,19 @@ void Menu::invers(int ix) { g_vm->_screenSurface.putxy(don[msg3][1] << 3, (lo(msg4) + 1) << 3); switch (msg3) { case 1: - s = _inv[lo(msg4)]; + s = _inventoryStringArray[lo(msg4)]; break; case 2: - s = _dep[lo(msg4)]; + s = _moveStringArray[lo(msg4)]; break; case 3: - s = _act[lo(msg4)]; + s = _actionStringArray[lo(msg4)]; break; case 4: - s = _self[lo(msg4)]; + s = _selfStringArray[lo(msg4)]; break; case 5: - s = _dis[lo(msg4)]; + s = _discussStringArray[lo(msg4)]; break; case 6: s = g_vm->getEngineString(S_SAVE_LOAD + lo(msg4)); @@ -304,24 +306,24 @@ void Menu::menuDown(int ii) { ++cx; switch (ii) { case 1: - if (_inv[cx][0] != '*') - g_vm->_screenSurface.writeg(_inv[cx], 4); + if (_inventoryStringArray[cx][0] != '*') + g_vm->_screenSurface.writeg(_inventoryStringArray[cx], 4); break; case 2: - if (_dep[cx][0] != '*') - g_vm->_screenSurface.writeg(_dep[cx], 4); + if (_moveStringArray[cx][0] != '*') + g_vm->_screenSurface.writeg(_moveStringArray[cx], 4); break; case 3: - if (_act[cx][0] != '*') - g_vm->_screenSurface.writeg(_act[cx], 4); + if (_actionStringArray[cx][0] != '*') + g_vm->_screenSurface.writeg(_actionStringArray[cx], 4); break; case 4: - if (_self[cx][0] != '*') - g_vm->_screenSurface.writeg(_self[cx], 4); + if (_selfStringArray[cx][0] != '*') + g_vm->_screenSurface.writeg(_selfStringArray[cx], 4); break; case 5: - if (_dis[cx][0] != '*') - g_vm->_screenSurface.writeg(_dis[cx], 4); + if (_discussStringArray[cx][0] != '*') + g_vm->_screenSurface.writeg(_discussStringArray[cx], 4); break; case 6: g_vm->_screenSurface.writeg(g_vm->getEngineString(S_SAVE_LOAD + cx), 4); @@ -479,34 +481,34 @@ void Menu::initMenu() { dem2(); for (i = 1; i <= 8; ++i) - _inv[i] = "* "; - _inv[7] = "< -*-*-*-*-*-*-*-*-*- "; + _inventoryStringArray[i] = "* "; + _inventoryStringArray[7] = "< -*-*-*-*-*-*-*-*-*- "; for (i = 1; i <= 7; ++i) - _dep[i] = "* "; + _moveStringArray[i] = "* "; i = 1; do { - _act[i] = delin2(i + c_action); + _actionStringArray[i] = delin2(i + c_action); - while (_act[i].size() < 10) - _act[i] += ' '; + while (_actionStringArray[i].size() < 10) + _actionStringArray[i] += ' '; if (i < 9) { if (i < 6) { - _self[i] = delin2(i + c_saction); - while (_self[i].size() < 10) - _self[i] += ' '; + _selfStringArray[i] = delin2(i + c_saction); + while (_selfStringArray[i].size() < 10) + _selfStringArray[i] += ' '; } - _dis[i] = delin2(i + c_dis) + ' '; + _discussStringArray[i] = delin2(i + c_dis) + ' '; } ++i; } while (i != 22); for (i = 1; i <= 8; ++i) { - _disc[i] = 0x500 + i; + _discussMenu[i] = 0x500 + i; if (i < 8) - _depl[i] = 0x200 + i; - _invt[i] = 0x100 + i; + _moveMenu[i] = 0x200 + i; + _inventoryMenu[i] = 0x100 + i; if (i > 6) - g_vm->_menu.disableMenuItem(_invt[i]); + g_vm->_menu.disableMenuItem(_inventoryMenu[i]); } msg3 = OPCODE_NONE; msg4 = OPCODE_NONE; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 84169241c3..67fc8bbf64 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -39,16 +39,16 @@ private: void menuDown(int ii); public: bool _menuActive; - Common::String _inv[9]; - Common::String _dep[8]; - Common::String _act[22]; - Common::String _self[7]; - Common::String _dis[9]; - int _disc[9]; - int _invt[9]; - int _depl[8]; + Common::String _inventoryStringArray[9]; + Common::String _moveStringArray[8]; + Common::String _actionStringArray[22]; + Common::String _selfStringArray[7]; + Common::String _discussStringArray[9]; + int _discussMenu[9]; + int _inventoryMenu[9]; + int _moveMenu[8]; public: - void menut(int no, Common::String nom); + void menut(int no, Common::String name); void disableMenuItem(int no); void enableMenuItem(int no); void menu_aff(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index cac723a4f5..25a0cf7b1c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -314,8 +314,8 @@ void modobj(int m) { if (m != 500) strp = delin2(m - 501 + c_st41); - g_vm->_menu.menut(g_vm->_menu._invt[8], strp); - g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); + g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); } void modobj2(int m, bool t1, bool t2) { @@ -329,8 +329,8 @@ void modobj2(int m, bool t1, bool t2) { if (m != 500) strp = delin2(m - 501 + c_st41); - g_vm->_menu.menut(g_vm->_menu._invt[8], strp); - g_vm->_menu.disableMenuItem(g_vm->_menu._invt[8]); + g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); } @@ -441,47 +441,47 @@ void affper(int per) { int cx; for (cx = 1; cx <= 8; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cx]); + g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cx]); clsf10(); if ((per & 128) == 128) { g_vm->_screenSurface.putxy(560, 24); g_vm->_screenSurface.writeg("LEO", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[1]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[1]); } if ((per & 64) == 64) { g_vm->_screenSurface.putxy(560, 32); g_vm->_screenSurface.writeg("PAT", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[2]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[2]); } if ((per & 32) == 32) { g_vm->_screenSurface.putxy(560, 40); g_vm->_screenSurface.writeg("GUY", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[3]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[3]); } if ((per & 16) == 16) { g_vm->_screenSurface.putxy(560, 48); g_vm->_screenSurface.writeg("EVA", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[4]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[4]); } if ((per & 8) == 8) { g_vm->_screenSurface.putxy(560, 56); g_vm->_screenSurface.writeg("BOB", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[5]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[5]); } if ((per & 4) == 4) { g_vm->_screenSurface.putxy(560, 64); g_vm->_screenSurface.writeg("LUC", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[6]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[6]); } if ((per & 2) == 2) { g_vm->_screenSurface.putxy(560, 72); g_vm->_screenSurface.writeg("IDA", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[7]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[7]); } if ((per & 1) == 1) { g_vm->_screenSurface.putxy(560, 80); g_vm->_screenSurface.writeg("MAX", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._disc[8]); + g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[8]); } ipers = per; } @@ -592,7 +592,7 @@ void cpl6(int &p) { */ void person() { for (int cf = 1; cf <= 8; ++cf) - g_vm->_menu.disableMenuItem(g_vm->_menu._disc[cf]); + g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cf]); Common::String sYou = g_vm->getEngineString(S_YOU); Common::String sAre = g_vm->getEngineString(S_ARE); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index f51275784e..5495854c32 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -248,12 +248,12 @@ void tmlieu(int mli) { nomp = delin2(v_lieu[i][mli] + c_tmlieu); while (nomp.size() < 20) nomp += ' '; - g_vm->_menu.menut(g_vm->_menu._depl[i], nomp); + g_vm->_menu.menut(g_vm->_menu._moveMenu[i], nomp); ++i; } nomp = "* "; for (int cx = 7; cx >= i; --cx) - g_vm->_menu.menut(g_vm->_menu._depl[cx], nomp); + g_vm->_menu.menut(g_vm->_menu._moveMenu[cx], nomp); } @@ -279,7 +279,7 @@ void mfouen() { tmlieu(s.mlieu); for (cx = 1; cx <= 11; ++cx) - g_vm->_menu.enableMenuItem(men[cx]); + g_vm->_menu.enableMenuItem(_actionMenu[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); @@ -381,13 +381,13 @@ void modinv() { ++cy; r = (ord(s.sjer[cx]) + 400); nomp = delin2(r - 501 + c_st41); - g_vm->_menu.menut(g_vm->_menu._invt[cy], nomp); - g_vm->_menu.enableMenuItem(g_vm->_menu._invt[cx]); + g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cy], nomp); + g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); } if (cy < 6) for (int cx = cy + 1; cx <= 6; ++cx) { - g_vm->_menu.menut(g_vm->_menu._invt[cx], " "); - g_vm->_menu.disableMenuItem(g_vm->_menu._invt[cx]); + g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cx], " "); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); } } @@ -421,10 +421,10 @@ void finfouil() { void mfoudi() { for (int cx = 1; cx <= 7; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._depl[cx]); + g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.disableMenuItem(men[cx]); + g_vm->_menu.disableMenuItem(_actionMenu[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); @@ -576,7 +576,7 @@ L1: caff = 69 + cx; crep = caff; msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._disc[cx]; + msg[4] = g_vm->_menu._discussMenu[cx]; syn = true; col = true; } else { diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index dc23d04b63..2df20b7804 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -32,7 +32,7 @@ namespace Mortevielle { -static const int men[12] = { OPCODE_NONE, +static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -- cgit v1.2.3 From 13846779913e06d591d8fe6fb99caf0958c0f5b6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 27 Feb 2012 22:05:34 +0100 Subject: MORTEVIELLE: clean up deline() --- engines/mortevielle/actions.cpp | 6 +-- engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/menu.cpp | 6 +-- engines/mortevielle/mor.cpp | 12 +++--- engines/mortevielle/mor2.cpp | 6 +-- engines/mortevielle/mortevielle.cpp | 8 ++-- engines/mortevielle/outtext.cpp | 73 +++++++++++-------------------------- engines/mortevielle/outtext.h | 5 +-- 8 files changed, 43 insertions(+), 77 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 80aba8df0d..d9a1022548 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -668,7 +668,7 @@ void fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer== 1) { - Common::String alertTxt = delin2(582); + Common::String alertTxt = deline(582); i = Alert::show(alertTxt, 1); tesok = false; @@ -696,7 +696,7 @@ void fctPlace() { dessin(0); aniof(1, 2); aniof(1, 1); - alertTxt = delin2(577); + alertTxt = deline(577); i = Alert::show(alertTxt, 1); aniof(2, 1); crep = 166; @@ -1313,7 +1313,7 @@ void fctDiscuss() { for (int ix = 1; ix <= 46; ++ix) te[ix] = false; for (int ix = 1; ix <= 45; ++ix) { - lib[ix] = delin2(ix + c_tparler); + lib[ix] = deline(ix + c_tparler); for (i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f8c5ceb3f6..9d7ea2fa4c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -313,7 +313,7 @@ bool Ques::show() { else dialogHeight = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); - Common::String tmpStr = delin2(textIndexArr[indx]); + Common::String tmpStr = deline(textIndexArr[indx]); afftex(tmpStr, 20, 15, 100, 2, 0); if (indx != 10) { @@ -327,7 +327,7 @@ bool Ques::show() { maxLength = 0; for (int j = firstOption, prevChoice = 1; j <= lastOption; ++j, ++prevChoice) { - tmpStr = delin2(j); + tmpStr = deline(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); afftex(tmpStr, 100, optionPosY, 100, 1, 0); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 250fd12d6e..fe5581dc48 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -487,18 +487,18 @@ void Menu::initMenu() { _moveStringArray[i] = "* "; i = 1; do { - _actionStringArray[i] = delin2(i + c_action); + _actionStringArray[i] = deline(i + c_action); while (_actionStringArray[i].size() < 10) _actionStringArray[i] += ' '; if (i < 9) { if (i < 6) { - _selfStringArray[i] = delin2(i + c_saction); + _selfStringArray[i] = deline(i + c_saction); while (_selfStringArray[i].size() < 10) _selfStringArray[i] += ' '; } - _discussStringArray[i] = delin2(i + c_dis) + ' '; + _discussStringArray[i] = deline(i + c_dis) + ' '; } ++i; } while (i != 22); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 25a0cf7b1c..9c57ed5b8c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -136,7 +136,7 @@ void text1(int x, int y, int nb, int m) { co = 10; else co = 6; - Common::String tmpStr = delin2(m); + Common::String tmpStr = deline(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; afftex(tmpStr, x, y, nb, 20, color_txt); @@ -312,7 +312,7 @@ void modobj(int m) { Common::String strp = Common::String(' '); if (m != 500) - strp = delin2(m - 501 + c_st41); + strp = deline(m - 501 + c_st41); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); @@ -327,7 +327,7 @@ void modobj2(int m, bool t1, bool t2) { tesok = false;; if (m != 500) - strp = delin2(m - 501 + c_st41); + strp = deline(m - 501 + c_st41); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); @@ -341,7 +341,7 @@ void repon(int f, int m) { int i, xco, dx, caspe; if ((m > 499) && (m < 563)) { - tmpStr = delin2(m - 501 + c_st41); + tmpStr = deline(m - 501 + c_st41); if ((int) tmpStr.size() > ((58 + (res - 1) * 37) << 1)) f2_all = true; @@ -376,7 +376,7 @@ void repon(int f, int m) { else i = 5; - tmpStr = delin2(m); + tmpStr = deline(m); afftex(tmpStr, 80, 40, 60, 25, i); if (m == 180) @@ -387,7 +387,7 @@ void repon(int f, int m) { } if (f == 7) { /* messint */ ecrf7(); - tmpStr = delin2(m); + tmpStr = deline(m); if (res == 1) { xco = 252 - tmpStr.size() * 5; caspe = 100; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 5495854c32..01e913d51a 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -245,7 +245,7 @@ void tmlieu(int mli) { int i = 1; while ((i < 8) && (v_lieu[i][mli] != 0)) { - nomp = delin2(v_lieu[i][mli] + c_tmlieu); + nomp = deline(v_lieu[i][mli] + c_tmlieu); while (nomp.size() < 20) nomp += ' '; g_vm->_menu.menut(g_vm->_menu._moveMenu[i], nomp); @@ -380,7 +380,7 @@ void modinv() { if (s.sjer[cx] != chr(0)) { ++cy; r = (ord(s.sjer[cx]) + 400); - nomp = delin2(r - 501 + c_st41); + nomp = deline(r - 501 + c_st41); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); } @@ -397,7 +397,7 @@ void sparl(float adr, float rep) { repint = abs((int)rep); hideMouse(); - Common::String tmpStr = delin2(repint + c_paroles); + Common::String tmpStr = deline(repint + c_paroles); afftex(tmpStr, 230, 4, 65, 24, 5); f3f8::draw(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 262cc3446e..f2bb1ef46c 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -134,10 +134,10 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - al_mess = delin2(578); // Insert floppy #1 - err_mess = delin2(579); // Floppy error - ind_mess = delin2(580); // You should have noticed %d hints - al_mess2 = delin2(581); // Insert floppy #2 + al_mess = deline(578); // Insert floppy #1 + err_mess = deline(579); // Floppy error + ind_mess = deline(580); // You should have noticed %d hints + al_mess2 = deline(581); // Insert floppy #2 // Set default EGA palette _paletteManager.setDefaultPalette(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index c2da1166b5..2cdfbe4188 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -60,7 +60,7 @@ const byte tab31[32]= { 119, 0, 0, 0, 0, 0, 0, 0 }; -void deline(int num , char *l , int &tl); +Common::String deline(int num); typedef unsigned char uchar; static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { @@ -126,63 +126,32 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { /** * Decode and extract the line with the given Id */ -void deline(int num, char *line , int &length) { +Common::String deline(int num) { + Common::String wrkStr = ""; + if (num < 0) { warning("deline: num < 0! Skipping"); - return; - } - - if (!g_vm->_txxFileFl) { - delig = g_vm->getGameString(num); -/* if (delig.size() < 255) - // Remove trailing '$' - delig.deleteLastChar(); -*/ - if (line) { - line[0] = ' '; - strcpy(line + 1, delig.c_str()); - length = delig.size(); - } - - return; + } else if (!g_vm->_txxFileFl) { + wrkStr = g_vm->getGameString(num); + } else { + int i = t_rec[num].indis; + byte k = t_rec[num].point; + int length = 0; + bool endFl = false; + char let; + do { + cinq_huit(let, i, k, endFl); + if (length < 254) + wrkStr += let; + ++length; + } while (!endFl); } - // DETEX - delig = ""; - int ts = t_rec[num].indis; - byte ps = t_rec[num].point; - int i = ts; - length = 1; - int j = 1; - // Initialize properly first string character - line[0] = ' '; - byte k = ps; - bool endFl = false; - char let; - do { - cinq_huit(let, i, k, endFl); - line[j] = let; - if (j < 254) - delig += let; - ++j; - } while (!endFl); - length = j - 1; - if (length < 255) + if (wrkStr.lastChar() == '$') // Remove trailing '$' - delig.deleteLastChar(); - - warning("deline: delig %s - line %s", delig.c_str(), line); -} - -Common::String delin2(int num) { - char tmpStr[1410]; - int length; + wrkStr.deleteLastChar(); - deline(num, tmpStr, length); - - Common::String resStr = delig; - delig = ""; - return resStr; + return wrkStr; } void afftex(const char *ch, int x, int y, int dx, int dy, int typ); diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 742b832612..d2e5f6bd3b 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -32,10 +32,7 @@ namespace Mortevielle { -extern Common::String delig; - -extern void deline(int num , char *line , int &length); -extern Common::String delin2(int num); +extern Common::String deline(int num); extern void afftex(Common::String ch, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle -- cgit v1.2.3 From 05848e5d2d4eee3efd32e24e7e0c25579f862a51 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 27 Feb 2012 23:19:33 +0100 Subject: MORTEVIELLE: remove error messages uselessly loaded --- engines/mortevielle/mor.cpp | 3 ++- engines/mortevielle/mor2.cpp | 26 +++++++++++++------------- engines/mortevielle/mortevielle.cpp | 7 ++----- engines/mortevielle/prog.cpp | 3 ++- engines/mortevielle/var_mor.cpp | 6 +----- engines/mortevielle/var_mor.h | 6 +----- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 9c57ed5b8c..10f0194bf9 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -47,7 +47,8 @@ const int ioresult = 0; void testfi() { if (ioresult != 0) { - caff = Alert::show(err_mess, 1); + // Theoritical message + warning("IO Error"); g_vm->quitGame(); } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 01e913d51a..86360b018b 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -77,18 +77,18 @@ void tinke() { else stpo = chr(cf + 48); - stpou = Common::String(d3); - stpou += d5; - stpou += d4; - stpou += d3; - stpou += d1; - stpou += stpo; - stpou += '0'; - stpou += d2; - stpou += d4; - stpou += d3; - stpou += d6; - stpou += d4; + _hintPctMessage = Common::String(d3); + _hintPctMessage += d5; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d1; + _hintPctMessage += stpo; + _hintPctMessage += '0'; + _hintPctMessage += d2; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d6; + _hintPctMessage += d4; } if (m > _minute) { _minute = 30; @@ -648,7 +648,7 @@ void tfleche() { } while (!(qust || rect || anyone)); if (qust && (touch == '\103')) - Alert::show(stpou, 1); + Alert::show(_hintPctMessage, 1); } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); if (touch == '\73') diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index f2bb1ef46c..9c4df1cf9d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -134,10 +134,7 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - al_mess = deline(578); // Insert floppy #1 - err_mess = deline(579); // Floppy error - ind_mess = deline(580); // You should have noticed %d hints - al_mess2 = deline(581); // Insert floppy #2 + _hintPctMessage = deline(580); // You should have noticed %d hints // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -588,7 +585,7 @@ void MortevielleEngine::handleAction() { if (choisi && (msg[3] == MENU_LOAD)) g_vm->_savegameManager.loadGame((msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ - temps = Alert::show(stpou, 1); + temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { if ((mnumo != OPCODE_NONE) && ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SUB_ACTION))) { diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index e2a6cf454c..a41b652b06 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -35,6 +35,7 @@ #include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" namespace Mortevielle { @@ -112,7 +113,7 @@ void MortevielleEngine::gameLoaded() { iouv = 0; dobj = 0; affrep(); - stpou = ind_mess; + _hintPctMessage = deline(580); while ((test[k] == false) && (k < 2)) { ++k; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index daac97704d..d3a44c46e6 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -174,13 +174,9 @@ int x, int t_cph[6401]; byte tabdon[4001]; -Common::String stpou; // Provides the % of hints +Common::String _hintPctMessage; // Provides the % of hints byte is; byte mode; -Common::String al_mess, - err_mess, - ind_mess, - al_mess2; int nbrep[9]; int nbrepm[9]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index af8ef9d60f..0956b23e2f 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -324,13 +324,9 @@ extern int x, extern int t_cph[6401]; extern byte tabdon[4001]; -extern Common::String stpou; /* donne le % d'indices */ +extern Common::String _hintPctMessage; // gives the pct of hints found extern byte is; extern byte mode; -extern Common::String al_mess, - err_mess, - ind_mess, - al_mess2; extern int nbrep[9]; extern int nbrepm[9]; -- cgit v1.2.3 From 4361f843fdcd545305067daa43e48360eef05539 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 28 Feb 2012 07:55:43 +0100 Subject: TOOLS: Mortevielle - Add missing heading space for several sentences used in menus, in the English version --- devtools/create_mortdat/gametext.h | 360 ++++++++++++++++++------------------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index 6905fdf7c6..b9ef039c74 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -213,68 +213,68 @@ const char *gameDataEn[] = { " 5/1/51@@ Luc, my love@ Guy knows about us. After an argument I told him everything! I@think only of you. Max keeps pes-tering me, but it's finished with @him. He should stick to his pots and pans! When can you and I be alone together? For you I would@get a divorce.@I love you.@ Eva$", " Mortville, 10/2/51@@ Pat@ I recall you owe me 50000 frs that I lent you for your business@I need that money, can you repay me quickly?@ Guy$", " Mortville, 15/2/51@ Dear Sir@ I am writing to you on the sub-ject of our business deal. I have@decided to go all the way in the certainty that my partner, Pat@DEFRANCK, has been forging the accounts. @In spite of$", - "A pipe$", - "A pen$", - "A lighter$", - "A retort$", - "A shaving brush$", - "A tin of paint$", - "A flute$", - "An expensive ring$", - "A reel of thread$", - "An old book$", - "A wallet$", - "A dagger$", - "A pistol$", - "A bible$", - "A candle$", - "A jewellery box$", - "An iron$", - "A photo$", - "A pocket watch$", - "A rope$", - "Keys$", - "A pearl necklace$", - "A bottle of perfume$", - "Binoculars$", - "Glasses$", - "A leather purse$", - "A tennis ball$", - "Ammunition$", - "A cut-throat razor$", - "A hairbrush$", - "A clothes brush$", - "A pack of cards$", - "A shoe horn$", - "A screwdriver$", - "A hammer$", - "Keys$", - "Keys$", - "An ashtray$", - "A paintbrush$", - "A rope$", - "A wooden object$", - "Sleeping pills$", - "A gold ring$", - "A jewellery box$", - "An alarm clock$", - "A coat of armour$", - "A candlestick$", - "A pair of gloves$", - "A engraved goblet$", - "A parchment$", - "A dagger$", - "A dossier$", - "A parchment$", - "A parchment$", - "A dossier$", - "A dossier$", - "A letter$", - "A novel$", - "A wooden rod$", - "An envelope$", - "A letter$", - "An envelope$", + " A pipe$", + " A pen$", + " A lighter$", + " A retort$", + " A shaving brush$", + " A tin of paint$", + " A flute$", + " An expensive ring$", + " A reel of thread$", + " An old book$", + " A wallet$", + " A dagger$", + " A pistol$", + " A bible$", + " A candle$", + " A jewellery box$", + " An iron$", + " A photo$", + " A pocket watch$", + " A rope$", + " Keys$", + " A pearl necklace$", + " A bottle of perfume$", + " Binoculars$", + " Glasses$", + " A leather purse$", + " A tennis ball$", + " Ammunition$", + " A cut-throat razor$", + " A hairbrush$", + " A clothes brush$", + " A pack of cards$", + " A shoe horn$", + " A screwdriver$", + " A hammer$", + " Keys$", + " Keys$", + " An ashtray$", + " A paintbrush$", + " A rope$", + " A wooden object$", + " Sleeping pills$", + " A gold ring$", + " A jewellery box$", + " An alarm clock$", + " A coat of armour$", + " A candlestick$", + " A pair of gloves$", + " A engraved goblet$", + " A parchment$", + " A dagger$", + " A dossier$", + " A parchment$", + " A parchment$", + " A dossier$", + " A dossier$", + " A letter$", + " A novel$", + " A wooden rod$", + " An envelope$", + " A letter$", + " An envelope$", "Julia$", "Julia's death$", "Julia's relationships$", @@ -463,27 +463,27 @@ const char *gameDataEn[] = { "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", - "to the bureau$", - "to the kitchen$", - "to the cellar$", - "to the landing$", - "outside$", - "to the dining room$", - "inside the manor$", - "front of the manor$", - "to the chapel$", - "to the weel$", - "north$", - "behind the manor$", - "south$", - "east$", - "west$", - "towards the manor$", - "further$", - "in the water$", - "out of the weel$", - "in the weel$", - "choice on screen$", + " to the bureau$", + " to the kitchen$", + " to the cellar$", + " to the landing$", + " outside$", + " to the dining room$", + " inside the manor$", + " front of the manor$", + " to the chapel$", + " to the weel$", + " north$", + " behind the manor$", + " south$", + " east$", + " west$", + " towards the manor$", + " further$", + " in the water$", + " out of the weel$", + " in the weel$", + " choice on screen$", "In the MYSTERY series...$", "MORTVILLE MANOR$", "$", @@ -504,40 +504,40 @@ const char *gameDataEn[] = { "COPYRIGHT 1987: KYILKHOR and B&JL LANGLOIS$", "$", "YOUR MOVE$", - "attach$", - "wait$", - "force$", - "sleep$", - "listen$", - "enter$", - "close$", - "search$", - "knock$", - "scratch$", - "read$", - "eat$", - "place$", - "open$", - "take$", - "look$", - "smell$", - "sound$", - "leave$", - "lift$", - "turn$", - "hide yourself$", - "search$", - "read$", - "put$", - "look$", - "Leo$", - "Pat$", - "Guy$", - "Eva$", - "Bob$", - "Luc$", - "Ida$", - "Max$", + " attach$", + " wait$", + " force$", + " sleep$", + " listen$", + " enter$", + " close$", + " search$", + " knock$", + " scratch$", + " read$", + " eat$", + " place$", + " open$", + " take$", + " look$", + " smell$", + " sound$", + " leave$", + " lift$", + " turn$", + " hide yourself$", + " search$", + " read$", + " put$", + " look$", + " Leo$", + " Pat$", + " Guy$", + " Eva$", + " Bob$", + " Luc$", + " Ida$", + " Max$", "JULIA...$", "- Did she commit suicide?$", "- Was she murdered?$", @@ -592,7 +592,7 @@ const char *gameDataEn[] = { "- 11$", "What was the first name@of the unknown character?$", "- Mireille$", - "- Françoise$", + "- Fran‡oise$", "- Maguy$", "- Emilie$", "- Murielle$", @@ -802,68 +802,68 @@ const char *gameDataFr[] = { " Le 5/01/51@@ Luc, mon amour@ Guy connaŚt notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'… toi ! Max me relance mais j'ai d‚finitivement rompu avec lui . Qu'il reste … ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr‚t‚s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", " Mortevielle, le 15/2/51@ MaŚtre,@ Je vous ‚cris au sujet de notre affaire. Je suis d‚cid‚ … aller jusqu'au bout, certain que mon associ‚, Pat DEFRANCK, a falsifi‚ un livre de comptes . Malgr‚$", - "Une pipe$", - "Un stylo … plume$", - "Un briquet … essence$", - "Une cornue$", - "Un blaireau$", - "Un pot de peinture$", - "Une flute$", - "Une bague de valeur$", - "Une bobine de fil$", - "Un vieux bouquin$", - "Un porte-monnaie$", - "Un poignard$", - "Un r‚volver$", - "Une bible$", - "Une bougie$", - "Un coffret … bijoux$", - "Un fer … repasser$", - "Une photo$", - "Une montre … gousset$", - "Une corde$", - "Des clefs$", - "Un collier de perles$", - "Un flacon de parfum$", - "Des jumelles$", - "Des lunettes$", - "Une bourse en cuir$", - "Une balle de tennis$", - "Des munitions$", - "Un rasoir … main$", - "Une brosse … cheveux$", - "Une brosse … linge$", - "Un jeu de cartes$", - "Un chausse pied$", - "Un tournevis$", - "Un marteau$", - "Des clefs$", - "Des clefs$", - "Un cendrier$", - "Un pinceau$", - "Une corde$", - "Un objet en bois$", - "Des somnifŠres$", - "Une bague en or$", - "Un coffret … bijoux$", - "Un r‚veil matin$", - "Une cotte de mailles$", - "Un chandellier$", - "Une paire de gants$", - "Une coupe cisel‚e$", - "Un parchemin$", - "Un poignard$", - "Un dossier$", - "Un parchemin$", - "Un parchemin$", - "Un dossier$", - "Un dossier$", - "Une lettre$", - "Un roman$", - "Une baguette en bois$", - "Une enveloppe$", - "Une lettre$", - "Une enveloppe$", + " Une pipe$", + " Un stylo … plume$", + " Un briquet … essence$", + " Une cornue$", + " Un blaireau$", + " Un pot de peinture$", + " Une flute$", + " Une bague de valeur$", + " Une bobine de fil$", + " Un vieux bouquin$", + " Un porte-monnaie$", + " Un poignard$", + " Un r‚volver$", + " Une bible$", + " Une bougie$", + " Un coffret … bijoux$", + " Un fer … repasser$", + " Une photo$", + " Une montre … gousset$", + " Une corde$", + " Des clefs$", + " Un collier de perles$", + " Un flacon de parfum$", + " Des jumelles$", + " Des lunettes$", + " Une bourse en cuir$", + " Une balle de tennis$", + " Des munitions$", + " Un rasoir … main$", + " Une brosse … cheveux$", + " Une brosse … linge$", + " Un jeu de cartes$", + " Un chausse pied$", + " Un tournevis$", + " Un marteau$", + " Des clefs$", + " Des clefs$", + " Un cendrier$", + " Un pinceau$", + " Une corde$", + " Un objet en bois$", + " Des somnifŠres$", + " Une bague en or$", + " Un coffret … bijoux$", + " Un r‚veil matin$", + " Une cotte de mailles$", + " Un chandellier$", + " Une paire de gants$", + " Une coupe cisel‚e$", + " Un parchemin$", + " Un poignard$", + " Un dossier$", + " Un parchemin$", + " Un parchemin$", + " Un dossier$", + " Un dossier$", + " Une lettre$", + " Un roman$", + " Une baguette en bois$", + " Une enveloppe$", + " Une lettre$", + " Une enveloppe$", "Julia$", "La mort de Julia$", "Les relations de Julia$", -- cgit v1.2.3 From f98a818c363055fbe94e7c3f8d184eba25bff67a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 28 Feb 2012 07:59:51 +0100 Subject: MORTEVIELLE: Rename menu entry type erroneously named --- engines/mortevielle/menu.cpp | 8 ++++---- engines/mortevielle/menu.h | 2 +- engines/mortevielle/mortevielle.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index fe5581dc48..3edaaaaf21 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -68,7 +68,7 @@ void Menu::menut(int no, Common::String name) { case MENU_ACTION: _actionStringArray[l] = s; break; - case MENU_SUB_ACTION: + case MENU_SELF: _selfStringArray[l] = s; break; case MENU_DISCUSS: @@ -101,7 +101,7 @@ void Menu::disableMenuItem(int no) { case MENU_ACTION: _actionStringArray[l].setChar('*', 0); break; - case MENU_SUB_ACTION: + case MENU_SELF: _selfStringArray[l].setChar('*', 0); break; case MENU_DISCUSS: @@ -132,7 +132,7 @@ void Menu::enableMenuItem(int no) { case MENU_ACTION: _actionStringArray[l].setChar(' ', 0); break; - case MENU_SUB_ACTION: + case MENU_SELF: _selfStringArray[l].setChar(' ', 0); // The original sets two times the same value. Skipped // _selfStringArray[l].setChar(' ', 0); @@ -422,7 +422,7 @@ void Menu::mdn() { else if (x < 172 * res) ix = MENU_ACTION; else if (x < 220 * res) - ix = MENU_SUB_ACTION; + ix = MENU_SELF; else if (x < 268 * res) ix = MENU_DISCUSS; else diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 67fc8bbf64..f6e3ea5a9c 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,7 +60,7 @@ public: }; enum { - MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SUB_ACTION = 4, + MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4, MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8 }; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 9c4df1cf9d..c9ea556c80 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -588,7 +588,7 @@ void MortevielleEngine::handleAction() { temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { - if ((mnumo != OPCODE_NONE) && ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SUB_ACTION))) { + if ((mnumo != OPCODE_NONE) && ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SELF))) { msg[4] = mnumo; ecr3(g_vm->getEngineString(S_IDEM)); } else @@ -611,7 +611,7 @@ void MortevielleEngine::handleAction() { num = 0; } else { mnumo = msg[3]; - if ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SUB_ACTION)) + if ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SELF)) mnumo = msg[4]; if (! anyone) { if ((fouil) || (obpart)) { -- cgit v1.2.3 From 2bdc20dc9b3b2c2e3b8b7b2dde751ae7c7a11fb6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 28 Feb 2012 08:22:20 +0100 Subject: MORTEVIELLE: Use 0-based array instead of 1-based for menu constants, some renaming --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/menu.cpp | 48 +++++++++++++++++++++-------------------- engines/mortevielle/menu.h | 2 +- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/var_mor.cpp | 19 ++++++++-------- engines/mortevielle/var_mor.h | 2 +- 6 files changed, 38 insertions(+), 37 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index d9a1022548..80a460e0c2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -686,7 +686,7 @@ void fctPlace() { else person(); - g_vm->_menu.menu_aff(); + g_vm->_menu.displayMenu(); if (enterPassageFl) { s.mlieu = 17; tmlieu(17); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 3edaaaaf21..6bbfa62df5 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -145,7 +145,7 @@ void Menu::enableMenuItem(int no) { } } -void Menu::menu_aff() { +void Menu::displayMenu() { int ind_tabl, k, col; int pt, x, y, color, msk, num_letr; @@ -191,7 +191,7 @@ void Menu::menu_aff() { * Show the menu */ void Menu::drawMenu() { - menu_aff(); + displayMenu(); _menuActive = true; msg4 = OPCODE_NONE; msg3 = OPCODE_NONE; @@ -206,38 +206,40 @@ void Menu::invers(int ix) { if (msg4 == OPCODE_NONE) return; - g_vm->_screenSurface.putxy(don[msg3][1] << 3, (lo(msg4) + 1) << 3); + int menuIndex = lo(msg4); + + g_vm->_screenSurface.putxy(_menuConstants[msg3 - 1][0] << 3, (menuIndex + 1) << 3); switch (msg3) { case 1: - s = _inventoryStringArray[lo(msg4)]; + s = _inventoryStringArray[menuIndex]; break; case 2: - s = _moveStringArray[lo(msg4)]; + s = _moveStringArray[menuIndex]; break; case 3: - s = _actionStringArray[lo(msg4)]; + s = _actionStringArray[menuIndex]; break; case 4: - s = _selfStringArray[lo(msg4)]; + s = _selfStringArray[menuIndex]; break; case 5: - s = _discussStringArray[lo(msg4)]; + s = _discussStringArray[menuIndex]; break; case 6: - s = g_vm->getEngineString(S_SAVE_LOAD + lo(msg4)); + s = g_vm->getEngineString(S_SAVE_LOAD + menuIndex); break; case 7: s = g_vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; - s += (char)(48 + lo(msg4)); + s += (char)(48 + menuIndex); break; case 8: - if (lo(msg4) == 1) { + if (menuIndex == 1) { s = g_vm->getEngineString(S_RESTART); } else { s = g_vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; - s += (char)(47 + lo(msg4)); + s += (char)(47 + menuIndex); } break; default: @@ -251,9 +253,9 @@ void Menu::invers(int ix) { void Menu::util(int x, int y) { - int ymx = (don[msg3][4] << 3) + 16; - int dxcar = don[msg3][3]; - int xmn = (don[msg3][1] << 2) * res; + int ymx = (_menuConstants[msg3 - 1][3] << 3) + 16; + int dxcar = _menuConstants[msg3 - 1][2]; + int xmn = (_menuConstants[msg3 - 1][0] << 2) * res; int ix; if (res == 1) @@ -287,19 +289,19 @@ void Menu::menuDown(int ii) { g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); // Draw the menu - xco = don[ii][1]; - nb_lig = don[ii][4]; + xco = _menuConstants[ii - 1][0]; + nb_lig = _menuConstants[ii - 1][3]; hideMouse(); - sauvecr(10, (don[ii][2] + 1) << 1); + sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (res == 1) cx = 10; else cx = 6; - xcc = xco + (don[ii][3] * cx) + 6; - g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (don[ii][2] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (don[ii][2] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (don[ii][2] << 1), xcc + 4, 12 + (don[ii][2] << 1))); + xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6; + g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { @@ -360,7 +362,7 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int xx) { /* debug('menuUp'); */ if (test0) { - charecr(10, (don[xx][2] + 1) << 1); + charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index f6e3ea5a9c..923c5aa3b6 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -51,7 +51,7 @@ public: void menut(int no, Common::String name); void disableMenuItem(int no); void enableMenuItem(int no); - void menu_aff(); + void displayMenu(); void drawMenu(); void menuUp(int xx); void eraseMenu(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index a41b652b06..cd7bb2a050 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -61,7 +61,7 @@ void changeGraphicalDevice(int newDevice) { _maff = 68; afdes(0); repon(2, crep); - g_vm->_menu.menu_aff(); + g_vm->_menu.displayMenu(); } /** diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index d3a44c46e6..ef9dbcf23a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -59,16 +59,15 @@ const byte tnocon[364] = { }; -const byte don[9][5] = { - { 0, 0, 0, 0, 0}, - { 0, 7, 37, 22, 8}, - {0, 19, 33, 23, 7}, - {0, 31, 89, 10, 21}, - {0, 43, 25, 11, 5}, - {0, 55, 37, 5, 8}, - {0, 64, 13, 11, 2}, - {0, 62, 22, 13, 4}, - {0, 62, 25, 13, 5} +const byte _menuConstants[8][4] = { + { 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 byte addv[2] = {8, 8}; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 0956b23e2f..d6024ece24 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -149,7 +149,7 @@ extern const byte typcon[26]; extern const byte intcon[26]; extern const byte tnocon[364]; -extern const byte don[9][5]; +extern const byte _menuConstants[8][4]; extern const byte addv[2]; -- cgit v1.2.3 From f2d7e57505441dedede3e6394bdaa24998703018 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 29 Feb 2012 08:15:54 +0100 Subject: MORTEVIELLE: Rename remaining opcodes, remove a couple of GOTOs --- engines/mortevielle/actions.cpp | 31 ++++++--- engines/mortevielle/actions.h | 12 ++-- engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/mor2.h | 6 +- engines/mortevielle/prog.cpp | 143 ++++++++++++++++++++-------------------- engines/mortevielle/var_mor.h | 17 ++--- 6 files changed, 110 insertions(+), 101 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 80a460e0c2..63f432b81a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -288,8 +288,11 @@ void fctTake() { crep = 120; } } - -void tsprendre() { +/** + * Engine function - Inventory / Take + * @remarks Originally called 'tsprendre' + */ +void fctInventoryTake() { int cx, cy, cz; cx = 0; @@ -366,7 +369,11 @@ void fctRead() { } } -void tslire() { +/** + * Engine function - Self / Read + * @remarks Originally called 'tslire' + */ +void fctSelfRead() { if (s.derobj == 0) crep = 186; else @@ -451,7 +458,11 @@ void fctLook() { treg(31); } -void tsregarder() { +/** + * Engine function - Self / Look + * @remarks Originally called 'tsregarder' + */ +void fctSelftLook() { if (s.derobj != 0) treg(s.derobj); else @@ -544,7 +555,11 @@ void fctSearch() { } } -void tsfouiller() { +/** + * Engine function - Self / Search + * @remarks Originally called 'tsfouiller' + */ +void fctSelfSearch() { if (s.derobj != 0) st7(s.derobj); else @@ -782,7 +797,7 @@ void fctTurn() { * Engine function - Hide Self * @remarks Originally called 'tcacher' */ -void fctHideSelf() { +void fctSelfHide() { if (!syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); @@ -906,10 +921,10 @@ void fctKnock() { } /** - * Engine function - Put + * Engine function - Self / Put * @remarks Originally called 'tposer' */ -void fctPut() { +void fctSelfPut() { int cx, chai; if (!syn) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index e73dc080f5..74d4e5c046 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -33,22 +33,22 @@ namespace Mortevielle { /* NIVEAU 4 */ extern void fctMove(); extern void fctTake(); -extern void tsprendre(); +extern void fctInventoryTake(); extern void fctLift(); extern void fctRead(); -extern void tslire(); +extern void fctSelfRead(); extern void fctLook(); -extern void tsregarder(); +extern void fctSelftLook(); extern void fctSearch(); -extern void tsfouiller(); +extern void fctSelfSearch(); extern void fctOpen(); extern void fctPlace(); extern void fctTurn(); -extern void fctHideSelf(); +extern void fctSelfHide(); extern void fctAttach(); extern void fctClose(); extern void fctKnock(); -extern void fctPut(); +extern void fctSelfPut(); extern void fctListen(); extern void fctEat(); extern void fctEnter(); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 86360b018b..33016faba9 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -737,7 +737,7 @@ void treg(int ob) { mdes = caff; caff = ob; - if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == sregarder)) { + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == OPCODE_SLOOK)) { afdes(0); if ((caff > 29) && (caff < 33)) repon(2, caff); diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 2df20b7804..8dc0e1a974 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -33,9 +33,9 @@ namespace Mortevielle { static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; extern void tinke(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index cd7bb2a050..4953f86a00 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -163,81 +163,80 @@ void tsitu() { clsf2(); syn = false; iesc = false; - if (anyone) - goto L1; - if (brt) - if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { - ctrm = 4; + if (!anyone) { + if (brt) + if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { + ctrm = 4; + mennor(); + return; + } + if (msg[3] == MENU_MOVE) + fctMove(); + if (msg[3] == MENU_DISCUSS) + fctDiscuss(); + if (msg[3] == MENU_INVENTORY) + fctInventoryTake(); + if (msg[4] == OPCODE_ATTACH) + fctAttach(); + if (msg[4] == OPCODE_WAIT) + fctWait(); + if (msg[4] == OPCODE_FORCE) + fctForce(); + if (msg[4] == OPCODE_SLEEP) + fctSleep(); + if (msg[4] == OPCODE_LISTEN) + fctListen(); + if (msg[4] == OPCODE_ENTER) + fctEnter(); + if (msg[4] == OPCODE_CLOSE) + fctClose(); + if (msg[4] == OPCODE_SEARCH) + fctSearch(); + if (msg[4] == OPCODE_KNOCK) + fctKnock(); + if (msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (msg[4] == OPCODE_READ) + fctRead(); + if (msg[4] == OPCODE_EAT) + fctEat(); + if (msg[4] == OPCODE_PLACE) + fctPlace(); + if (msg[4] == OPCODE_OPEN) + fctOpen(); + if (msg[4] == OPCODE_TAKE) + fctTake(); + if (msg[4] == OPCODE_LOOK) + fctLook(); + if (msg[4] == OPCODE_SMELL) + fctSmell(); + if (msg[4] == OPCODE_SOUND) + fctSound(); + if (msg[4] == OPCODE_LEAVE) + fctLeave(); + if (msg[4] == OPCODE_LIFT) + fctLift(); + if (msg[4] == OPCODE_TURN) + fctTurn(); + if (msg[4] == OPCODE_SSEARCH) + fctSelfSearch(); + if (msg[4] == OPCODE_SREAD) + fctSelfRead(); + if (msg[4] == OPCODE_SPUT) + fctSelfPut(); + if (msg[4] == OPCODE_SLOOK) + fctSelftLook(); + cache = false; + + if (msg[4] == OPCODE_SHIDE) + fctSelfHide(); + } else { + if (anyone) { + quelquun(); + anyone = false; mennor(); return; } - if (msg[3] == MENU_MOVE) - fctMove(); - if (msg[3] == MENU_DISCUSS) - fctDiscuss(); - if (msg[3] == MENU_INVENTORY) - tsprendre(); //Translation: inventory/take - if (msg[4] == OPCODE_ATTACH) - fctAttach(); - if (msg[4] == OPCODE_WAIT) - fctWait(); - if (msg[4] == OPCODE_FORCE) - fctForce(); - if (msg[4] == OPCODE_SLEEP) - fctSleep(); - if (msg[4] == OPCODE_LISTEN) - fctListen(); - if (msg[4] == OPCODE_ENTER) - fctEnter(); - if (msg[4] == OPCODE_CLOSE) - fctClose(); - if (msg[4] == OPCODE_SEARCH) - fctSearch(); - if (msg[4] == OPCODE_KNOCK) - fctKnock(); - if (msg[4] == OPCODE_SCRATCH) - fctScratch(); - if (msg[4] == OPCODE_READ) - fctRead(); - if (msg[4] == OPCODE_EAT) - fctEat(); - if (msg[4] == OPCODE_PLACE) - fctPlace(); - if (msg[4] == OPCODE_OPEN) - fctOpen(); - if (msg[4] == OPCODE_TAKE) - fctTake(); - if (msg[4] == OPCODE_LOOK) - fctLook(); - if (msg[4] == OPCODE_SMELL) - fctSmell(); - if (msg[4] == OPCODE_SOUND) - fctSound(); - if (msg[4] == OPCODE_LEAVE) - fctLeave(); - if (msg[4] == OPCODE_LIFT) - fctLift(); - if (msg[4] == OPCODE_TURN) - fctTurn(); - if (msg[4] == OPCODE_HIDE_SELF) { - fctHideSelf(); - goto L1; - } - if (msg[4] == sfouiller) - tsfouiller();//Translation: search - if (msg[4] == slire) - tslire(); //Translation: read - if (msg[4] == OPCODE_PUT) - fctPut(); - if (msg[4] == sregarder) - tsregarder();//Translation: look - cache = false; -L1: - if (anyone) { - quelquun(); - anyone = false; - mennor(); - return; } calch(j, h, m); if ((((h == 12) || (h == 13) || (h == 19)) && (s.mlieu != 10)) || diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index d6024ece24..d9a11f5528 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -129,17 +129,12 @@ const int fleche = 1758; const int OPCODE_NONE = 0; -enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, - OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, - OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, - OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, - OPCODE_TURN = 0x315}; - -enum verbs2 {OPCODE_HIDE_SELF = 0x401, OPCODE_PUT = 0x404}; - -const int sfouiller = 0x402; -const int slire = 0x403; -const int sregarder = 0x405; +enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, + OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, + OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, + OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, + OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, + OPCODE_SLOOK = 0x405}; const int max_patt = 20; -- cgit v1.2.3 From e26a93efdf9b128ac8ed721460efe94966ae5f2c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 29 Feb 2012 08:17:29 +0100 Subject: MORTEVIELLE: Fix bug, this is a "in [1, 2]" in the original code --- engines/mortevielle/keyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 0306e71962..0cf22b35d8 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -45,7 +45,7 @@ int testou() { _soundOff = !_soundOff; break; case '\26' : - if ((c_zzz == 1) && (c_zzz == 2)) { + if ((c_zzz == 1) || (c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); ++c_zzz; -- cgit v1.2.3 From 10132f3632ecb86ba928db3d1510d5ac16eb5529 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 29 Feb 2012 19:28:56 +0100 Subject: MORTEVIELLE: Double check all "in []" statements, fix a couple of errors --- engines/mortevielle/mor.cpp | 6 +++++- engines/mortevielle/parole.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 10f0194bf9..97b116f869 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -371,7 +371,7 @@ void repon(int f, int m) { } } } - if ((f >= 6) && (f <= 9)) { + if ((f == 6) || (f == 9)) { if (f == 6) i = 4; else @@ -615,6 +615,10 @@ void chlm(int &per) { if (per == 2) per = 128; } +/** + * Engine function - Draw Clock + * @remarks Originally called 'pendule' + */ void drawClock() { const int cv[3][13] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index e86b647f36..791bfd7d61 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -36,7 +36,7 @@ void spfrac(int wor) { c3.rep = (uint)wor >> 12; if ((typlec == 0) && (c3.code != 9)) if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || - ((c3.code < 5) && ((c3.rep != 19) && (c3.rep != 22) && (c3.rep != 4) && (c3.rep != 9))))) { + ((c3.code < 5) && ((c3.val != 19) && (c3.val != 22) && (c3.rep != 4) && (c3.rep != 9))))) { ++c3.rep; } -- cgit v1.2.3 From 38c9aa8b5623df4536598aec4e841bcb936cd9a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 29 Feb 2012 23:50:49 +0100 Subject: MORTEVIELLE: silent several warning reported by cppCheck --- engines/mortevielle/actions.cpp | 93 +++++++++++++++++++------------------ engines/mortevielle/menu.cpp | 11 ++--- engines/mortevielle/mor.cpp | 2 +- engines/mortevielle/mor2.cpp | 44 +++++++++--------- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/outtext.cpp | 3 -- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/taffich.cpp | 12 ++--- engines/mortevielle/var_mor.cpp | 4 +- engines/mortevielle/var_mor.h | 10 +--- 11 files changed, 91 insertions(+), 94 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 63f432b81a..b2a23f5814 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -179,10 +179,8 @@ L2: * @remarks Originally called 'tprendre' */ void fctTake() { - int cx; - if (caff > 99) { - cx = caff; + int cx = caff; avpoing(cx); if (crep != 139) { if (ipers > 0) @@ -475,27 +473,30 @@ void fctSelftLook() { */ void fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; - int cx; if (caff > 99) { st7(caff); return; } + if (!syn) ecr3(g_vm->getEngineString(S_SEARCH)); + 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; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -504,6 +505,7 @@ void fctSearch() { else { if (ipers > 0) s.conf += 3; + rechai(mchai); if (mchai != 0) { cs = 0; @@ -540,14 +542,17 @@ void fctSearch() { 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; else if (num == 5) crep = 159; } + if (s.mlieu == 19) crep = 104; else if (s.mlieu == 16) @@ -571,10 +576,9 @@ void fctSelfSearch() { * @remarks Originally called 'touvrir' */ void fctOpen() { - int cx, haz; - if (!syn) ecr3(g_vm->getEngineString(S_OPEN)); + if (caff == 26) { if (ment != 0) { msg[4] = OPCODE_ENTER; @@ -583,19 +587,22 @@ void fctOpen() { crep = 997; return; } + if (caff == 15) { aldepl(); return; } + tfleche(); if ((anyone) || (iesc)) return; + tcoord(7); if (num != 0) { if (ipers > 0) s.conf += 2; ++iouv; - cx = 0; + int cx = 0; do { ++cx; } while (!((cx > 6) || (ord(touv[cx]) == 0) || (ord(touv[cx]) == num))); @@ -609,8 +616,7 @@ void fctOpen() { 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) + if (hazard(1, 4) == 3) parole(7, 9, 1); } touv[cx] = chr(num); @@ -632,10 +638,6 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - bool enterPassageFl; - Common::String str_; - int i; - if (s.derobj == 0) { crep = 186; return; @@ -684,10 +686,10 @@ void fctPlace() { int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer== 1) { Common::String alertTxt = deline(582); - i = Alert::show(alertTxt, 1); + Alert::show(alertTxt, 1); tesok = false; - enterPassageFl = Ques::show(); + bool enterPassageFl = Ques::show(); hideMouse(); hirs(); dessine_rouleau(); @@ -712,7 +714,7 @@ void fctPlace() { aniof(1, 2); aniof(1, 1); alertTxt = deline(577); - i = Alert::show(alertTxt, 1); + Alert::show(alertTxt, 1); aniof(2, 1); crep = 166; } @@ -844,10 +846,9 @@ void fctAttach() { * @remarks Originally called 'tfermer' */ void fctClose() { - int cx, chai; - if (!syn) ecr3(g_vm->getEngineString(S_CLOSE)); + if (caff < 26) { tfleche(); if (iesc) @@ -856,7 +857,7 @@ void fctClose() { return; tcoord(7); if (num != 0) { - cx = 0; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -867,7 +868,7 @@ void fctClose() { iouv = iouv - 1; if (iouv < 0) iouv = 0; - chai = 9999; + int chai = 9999; rechai(chai); if (mchai == chai) mchai = 0; @@ -883,14 +884,14 @@ void fctClose() { * @remarks Originally called 'tfrapper' */ void fctKnock() { - int l, p, haz; - if (!syn) ecr3(g_vm->getEngineString(S_HIT)); + if (s.mlieu == 15) { - l = Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); + Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } + if (s.mlieu < 25) { tfleche(); if (!(anyone) && !(iesc)) @@ -900,12 +901,14 @@ void fctKnock() { crep = 997; return; } + if (s.mlieu == 26) { - haz = (hazard(0, 8)) - 4; + int haz = (hazard(0, 8)) - 4; parole(11, haz, 1); + int p; ecfren(p, haz, s.conf, ment); - l = ment; - if (l != 0) + int l = ment; + if (l != 0) { if (p != -500) { if (haz > p) crep = 190; @@ -915,6 +918,8 @@ void fctKnock() { } } else frap(); + } + if (ment == 8) crep = 190; } @@ -925,8 +930,6 @@ void fctKnock() { * @remarks Originally called 'tposer' */ void fctSelfPut() { - int cx, chai; - if (!syn) ecr3(g_vm->getEngineString(S_POSE)); if (s.derobj == 0) @@ -945,11 +948,12 @@ void fctSelfPut() { tcoord(7); crep = 124; if (num != 0) { + int chai; rechai(chai); if (chai == 0) crep = 997; else { - cx = 0; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -1014,21 +1018,21 @@ void fctSelfPut() { * @remarks Originally called 'tecouter' */ void fctListen() { - int l, p, haz, j, h, m; - if (s.mlieu != 26) crep = 101; else { if (ipers != 0) ++s.conf; + int p, haz; ecfren(p, haz, s.conf, ment); - l = ment; + int l = ment; if (l != 0) { if (p != -500) { if (haz > p) crep = 101; else { becfren(l); + int j, h, m; calch(j, h, m); haz = hazard(1, 100); if ((h >= 0) && (h < 8)) { @@ -1052,8 +1056,6 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - int j, h, m; - if ((s.mlieu > 15) && (s.mlieu < 26)) crep = 148; else { @@ -1062,6 +1064,8 @@ void fctEat() { caff = 10; debloc(s.mlieu); tmlieu(s.mlieu); + + int j, h, m; calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { s.conf = s.conf - (s.conf / 7); @@ -1088,7 +1092,7 @@ void fctEat() { * @remarks Originally called 'tentrer' */ void fctEnter() { - int x, z = 0; +// int x; if ((s.mlieu == 21) || (s.mlieu == 22)) { t1sama(); @@ -1101,21 +1105,22 @@ void fctEnter() { crep = 189; s.teauto[8] = '*'; } else { + int z = 0; 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); + g_x = (hazard(0, 10)) - 5; + parole(7, g_x, 1); aniof(1, 1); - tip(z, x); + tip(z, g_x); ++s.conf; s.mlieu = 15; msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._discussMenu[x]; + msg[4] = g_vm->_menu._discussMenu[g_x]; syn = true; if (ment == 9) { col = true; @@ -1128,8 +1133,8 @@ void fctEnter() { ment = 0; } } else { - x = (hazard(0, 10)) - 5; - parole(7, x, 1); + g_x = (hazard(0, 10)) - 5; + parole(7, g_x, 1); aniof(1, 1); s.mlieu = ment; @@ -1213,13 +1218,13 @@ void fctForce() { * @remarks Originally called 'tsortir' */ void fctLeave() { - int lx = 0; - tsort(); crep = 0; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22) || (s.mlieu == 24)) crep = 997; else { + int lx = 0; + if ((s.mlieu < 16) || (s.mlieu == 26)) lx = 10; if ((s.mlieu == 10) || (s.mlieu == 20)) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6bbfa62df5..6ff97164f0 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -393,14 +393,11 @@ void Menu::eraseMenu() { * Handle updates to the menu */ void Menu::mdn() { - int x, y, ix; - bool tes; - if (!_menuActive) return; - x = x_s; - y = y_s; + int x = x_s; + int y = y_s; if (!g_vm->getMouseClick()) { if ((x == xprec) && (y == yprec)) return; @@ -409,7 +406,7 @@ void Menu::mdn() { yprec = y; } - tes = (y < 11) + bool tes = (y < 11) && ((x >= (28 * res) && x <= (28 * res + 24)) || (x >= (76 * res) && x <= (76 * res + 24)) || ((x > 124 * res) && (x < 124 * res + 24)) @@ -417,6 +414,8 @@ void Menu::mdn() { || ((x > 220 * res) && (x < 220 * res + 24)) || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { + int ix; + if (x < 76 * res) ix = MENU_INVENTORY; else if (x < 124 * res) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 97b116f869..12df21ea9c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -674,7 +674,7 @@ void drawClock() { void debloc(int l) { num = 0; - x = 0; + g_x = 0; y = 0; if ((l != 26) && (l != 15)) t5(l); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 33016faba9..2a80cecee1 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -649,45 +649,49 @@ void tfleche() { if (qust && (touch == '\103')) Alert::show(_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (y != 0)) || (anyone) || (rect))); if (touch == '\73') iesc = true; if (rect) { - x = x_s; + g_x = x_s; y = y_s; } } void tcoord(int sx) { - int sy, ix, iy, cb, cy, ib; - int a, b, atdon; + int sy, ix, iy; + int ib; num = 0; crep = 999; - a = 0; - atdon = amzon + 3; - cy = 0; + int a = 0; + int atdon = amzon + 3; + int cy = 0; while (cy < caff) { a += tabdon[atdon]; atdon += 4; ++cy; } - b = tabdon[atdon]; - if (b == 0) - goto L1; + if (tabdon[atdon] == 0) { + crep = 997; + return; + } + a += fleche; - cb = 0; + int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; - if (ib == 0) - goto L1; + if (ib == 0) { + crep = 997; + return; + } cy = 1; do { @@ -698,14 +702,13 @@ void tcoord(int sx) { ix = tabdon[a + cb] * res; iy = tabdon[(a + cb + 1)]; ++cy; - } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); + } while (!(((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); - if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) { + if ((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) { num = cy - 1; return; } -L1: crep = 997; } @@ -733,10 +736,9 @@ void st7(int ob) { } void treg(int ob) { - int mdes; - - mdes = caff; + int mdes = caff; caff = ob; + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == OPCODE_SLOOK)) { afdes(0); if ((caff > 29) && (caff < 33)) @@ -758,6 +760,7 @@ void avpoing(int &ob) { crep = 999; if (s.derobj != 0) ajjer(s.derobj); + if (crep != 139) { modobj(ob + 400); s.derobj = ob; @@ -766,9 +769,8 @@ void avpoing(int &ob) { } void rechai(int &ch) { - int cx; + int cx = s.mlieu; - cx = s.mlieu; if (s.mlieu == 16) cx = 14; ch = tabdon[achai + (cx * 7) + num - 1]; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c9ea556c80..50631663e1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -594,7 +594,7 @@ void MortevielleEngine::handleAction() { } else return; } else if (inkey == '\104') { - if ((x != 0) && (y != 0)) + if ((g_x != 0) && (y != 0)) num = 9999; return; } diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 2cdfbe4188..3cc9b342fd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -154,9 +154,6 @@ Common::String deline(int num) { return wrkStr; } -void afftex(const char *ch, int x, int y, int dx, int dy, int typ); - - static int l_motsuiv(int p, const char *ch, int &tab) { int c = p; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 64bb6cb463..1ea8d509ed 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -61,7 +61,7 @@ void charpal() { if (!ft.open("fxx.mor")) error("Missing file - fxx.mor"); for (int i = 0; i < 108; ++i) - l[i] = ft.readSint16LE(); + g_l[i] = ft.readSint16LE(); ft.close(); if (!f.open("plxx.mor")) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 4953f86a00..635140f048 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -94,7 +94,7 @@ void MortevielleEngine::gameLoaded() { mnumo = 0; prebru = 0; g[4] = 'T'; - x = 0; + g_x = 0; y = 0; num = 0; hdb = 0; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 29cdc0a288..52ed011604 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -193,16 +193,16 @@ void taffich() { npal = a; for (cx = 0; cx <= (a - 1); ++cx) - lgt = lgt + l[cx]; - handle = l[a]; + lgt = lgt + g_l[cx]; + handle = g_l[a]; filename = "DXX.mor"; } else { filename = "DZZ.mor"; - handle = l[87]; + handle = g_l[87]; if (a == 51) { lgt = handle; - handle = l[88]; + handle = g_l[88]; } _maff = a; npal = a + 37; @@ -235,8 +235,8 @@ void taffich() { else if (b > 15) --b; for (cx = 0; cx <= (b - 1); ++cx) - lgt += l[cx + 89]; - handle = l[b + 89]; + lgt += g_l[cx + 89]; + handle = g_l[b + 89]; filename = "AXX.mor"; } else if (b == 50) { filename = "AZZ.mor"; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index ef9dbcf23a..d63d9aa808 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -113,7 +113,7 @@ bool blo, rech_cfiec; -int x, +int g_x, y, t, vj, @@ -194,7 +194,7 @@ ind t_rec[maxtd + 1]; //file sauv_t; //untyped_file fibyte; byte v_lieu[8][25]; -int l[108]; +int g_l[108]; int tbi[256]; chariot c1, c2, c3; float addfix; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index d9a11f5528..5769b61064 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -182,12 +182,6 @@ struct chariot { rep; }; -/* -struct doublet { - byte x, y; -}; -*/ - struct rectangle { int x1, x2, y1, y2; bool enabled; @@ -259,7 +253,7 @@ extern bool blo, rech_cfiec; -extern int x, +extern int g_x, y, t, vj, @@ -340,7 +334,7 @@ extern ind t_rec[maxtd + 1]; //file sauv_t; //untyped_file fibyte; extern byte v_lieu[8][25]; -extern int l[108]; +extern int g_l[108]; extern int tbi[256]; extern chariot c1, c2, c3; extern float addfix; -- cgit v1.2.3 From 06e54aaa674dc6c37aa53e846b28d863b8803dec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 Mar 2012 07:53:57 +0100 Subject: MORTEVIELLE: Silent the remaining errors reported by CppCheck --- engines/mortevielle/mor.cpp | 74 +++++++++++++++++++---------------------- engines/mortevielle/mor2.cpp | 29 ++++++++-------- engines/mortevielle/mouse.cpp | 41 ++++++++++++----------- engines/mortevielle/ovd1.cpp | 5 +-- engines/mortevielle/taffich.cpp | 15 ++++----- engines/mortevielle/var_mor.cpp | 2 +- 6 files changed, 80 insertions(+), 86 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 12df21ea9c..d54312a97f 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -178,14 +178,10 @@ void ecrf2() { } void ecr2(Common::String str_) { - int tab; - - if (res == 1) - tab = 10; - else - tab = 6; + // Some dead code was present in the original: removed g_vm->_screenSurface.putxy(8, 177); int tlig = 59 + (res - 1) * 36; + if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); else if ((int)str_.size() < (tlig << 1)) { @@ -339,7 +335,6 @@ void repon(int f, int m) { Common::String str_; Common::String str1; Common::String tmpStr; - int i, xco, dx, caspe; if ((m > 499) && (m < 563)) { tmpStr = deline(m - 501 + c_st41); @@ -372,6 +367,7 @@ void repon(int f, int m) { } } if ((f == 6) || (f == 9)) { + int i; if (f == 6) i = 4; else @@ -389,6 +385,8 @@ void repon(int f, int m) { if (f == 7) { /* messint */ ecrf7(); tmpStr = deline(m); + + int xco, dx, caspe; if (res == 1) { xco = 252 - tmpStr.size() * 5; caspe = 100; @@ -516,7 +514,11 @@ void cpl1(int &p) { int j, h, m; calch(j, h, m); - if ((h > 7) || (h < 11)) + // The original uses an || instead of an &&, resulting + // in an always true condition. Based on the other tests, + // and on other scenes, we use an && instead. + // if ((h > 7) || (h < 11)) + if ((h > 7) && (h < 11)) p = 25; else if ((h > 10) && (h < 14)) p = 35; @@ -810,11 +812,10 @@ void quelq6(int l) { } void quelq10(int h, int &per) { - int min = 0, max = 0; - if ((h >= 0) && (h < 8)) chlm(per); else { + int min = 0, max = 0; if ((h > 7) && (h < 10)) { min = 5; max = 7; @@ -834,11 +835,10 @@ void quelq10(int h, int &per) { } void quelq11(int h, int &per) { - int min = 0, max = 0; - if ((h >= 0) && (h < 8)) chlm(per); else { + int min = 0, max = 0; if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { min = 1; max = 3; @@ -882,11 +882,10 @@ void quelq15(int &per) { } void quelq20(int h, int &per) { - int min = 0, max = 0; - if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) chlm(per); else { + int min = 0, max = 0; if ((h > 9) && (h < 12)) { min = 3; max = 7; @@ -904,13 +903,13 @@ void quelq20(int h, int &per) { void frap() { - int j, h, m, haz; + int j, h, m; calch(j, h, m); if ((h >= 0) && (h < 8)) crep = 190; else { - haz = hazard(1, 100); + int haz = hazard(1, 100); if (haz > 70) crep = 190; else @@ -993,10 +992,8 @@ void ecfren(int &p, int &haz, int cf, int l) { } void becfren(int l) { - int haz; - if ((l == 1) || (l == 4)) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (l == 1) if (haz == 1) bh1 = true; @@ -1092,11 +1089,11 @@ void dprog() { } void pl1(int cf) { - int p, haz; - if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { + int p, haz; cpl1(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1105,11 +1102,11 @@ void pl1(int cf) { } void pl2(int cf) { - int p, haz; - if (! bh2) { + int p, haz; cpl2(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1118,11 +1115,11 @@ void pl2(int cf) { } void pl5(int cf) { - int p, haz; - if (! bh5) { + int p, haz; cpl5(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1131,11 +1128,11 @@ void pl5(int cf) { } void pl6(int cf) { - int p, haz; - if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { + int p, haz; cpl6(p); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1144,11 +1141,11 @@ void pl6(int cf) { } void pl9(int cf) { - int p, haz; - if (! bh9) { cf = -10; + int p, haz; phaz(haz, p, cf); + if (haz > p) person(); else @@ -1158,9 +1155,9 @@ void pl9(int cf) { void pl10(int cf) { int p, h, haz; - cpl10(p, h); phaz(haz, p, cf); + if (haz > p) person(); else @@ -1223,7 +1220,7 @@ void pl20(int cf) { } void t11(int l11, int &a) { - int p, haz, h = 0; + int p, haz; ecfren(p, haz, s.conf, l11); li = l11; @@ -1244,6 +1241,7 @@ void t11(int l11, int &a) { if ((l11 > 15) && (l11 != 20) && (l11 != 26)) person(); else { + int h = 0; if (l11 == 10) cpl10(p, h); if (l11 == 11) @@ -1312,6 +1310,7 @@ void writetp(Common::String s, int t) { */ void messint(int nu) { // Method is deprecated + warning("DEPRECATED: messint"); } void aniof(int ouf, int num) { @@ -1339,9 +1338,6 @@ void aniof(int ouf, int num) { } void musique(int so) { - bool i; - int haz; - if (so == 0) { /* musik(0) */ ; @@ -1349,9 +1345,9 @@ void musique(int so) { parole(10, 1, 1); ++prebru; } else { - i = false; + bool i = false; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) { - haz = hazard(1, 3); + int haz = hazard(1, 3); if (haz == 2) { haz = hazard(2, 4); parole(9, haz, 1); @@ -1359,14 +1355,14 @@ void musique(int so) { } } if (s.mlieu == 20) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (haz == 1) { parole(8, 1, 1); i = true; } } if (s.mlieu == 24) { - haz = hazard(1, 2); + int haz = hazard(1, 2); if (haz == 2) { parole(12, 1, 1); i = true; @@ -1377,7 +1373,7 @@ void musique(int so) { i = true; } if (! i) { - haz = hazard(1, 17); + int haz = hazard(1, 17); parole(haz, 1, 2); } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 2a80cecee1..ed5ed494eb 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -46,9 +46,8 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; Common::String d6 = g_vm->getEngineString(S_OK); - int cx, haz, nh, cf, j, h, m; + int cx, cf, j, h, m; Common::String stpo; - bool am; anyone = false; calch(j, h, m); @@ -109,9 +108,9 @@ void tinke() { if (cf > 65) t -= ((t / 3) * 2); - nh = readclock(); + int nh = readclock(); if ((nh - mh) > t) { - am = g_vm->_menu._menuActive; + bool activeMenu = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); jh += ((nh - mh) / t); mh = nh; @@ -165,7 +164,7 @@ void tinke() { if (! brt) { brt = true; hdb = readclock(); - haz = hazard(1, 5); + int haz = hazard(1, 5); if (haz < 5) { clsf3(); ecrf2(); @@ -176,7 +175,7 @@ void tinke() { } } } - if (am) + if (activeMenu) g_vm->_menu.drawMenu(); } } @@ -217,7 +216,6 @@ void afdes(int ad) { void tkey1(bool d) { bool quest; int x, y, c; - int key; hideMouse(); fenat('K'); @@ -232,7 +230,7 @@ void tkey1(bool d) { CHECK_QUIT; } while (!(quest || (c != 0) || (d && anyone))); if (quest) - key = testou(); + testou(); g_vm->setMouseClick(false); showMouse(); } @@ -288,15 +286,16 @@ void mfouen() { /* NIVEAU 6 */ void tperd() { - int cx; - initouv(); ment = 0; iouv = 0; mchai = 0; mfouen(); - if (!blo) + if (!blo) { + int cx; t11(21, cx); + } + g_vm->_loseGame = true; clsf1(); g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); @@ -469,10 +468,10 @@ void ajjer(int ob) { void t1sama() { //Entering manor int j, h, m; - bool d; calch(j, h, m); if ((h < 5) && (s.mlieu > 18)) { + bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late crep = 1511; @@ -548,10 +547,9 @@ void tctrm() { void quelquun() { - int haz, cx; - if (imen) g_vm->_menu.eraseMenu(); + finfouil(); crep = 997; L1: @@ -572,6 +570,7 @@ L1: s.conf += 3 * (s.conf / 10); tsort(); tmlieu(15); + int cx; tip(ipers, cx); caff = 69 + cx; crep = caff; @@ -580,7 +579,7 @@ L1: syn = true; col = true; } else { - haz = hazard(1, 3); + int haz = hazard(1, 3); if (haz == 2) { cache = false; crep = 137; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e7da3c3074..d607b0597b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -82,16 +82,13 @@ void initMouse() { * @remarks Originally called 'hide_mouse' */ void hideMouse() { - int i, j, k, ps;; - bool imp; - --mouse_shwn; if (mouse_shwn == 0) { - imp = odd(y_s); - j = p_o_s; + bool imp = odd(y_s); + int j = p_o_s; switch (_currGraphicalDevice) { - case MODE_CGA: - k = 0; + case MODE_CGA: { + int k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { WRITE_LE_UINT16(&mem[0xb000 * 16 + j], s_s[0][k]); @@ -101,11 +98,12 @@ void hideMouse() { j += 80; ++k; } while (k < 5); + } break; case MODE_AMSTRAD1512: - for (i = 0; i <= 3; ++i) { + for (int i = 0; i <= 3; ++i) { port[0x3dd] = 1 << i; - k = 0; + int k = 0; j = p_o_s; do { if (imp) { @@ -120,45 +118,50 @@ void hideMouse() { } while (k < 8); } break; - case MODE_EGA: + case MODE_EGA: { port[0x3c4] = 2; port[0x3ce] = 8; port[0x3cf] = 255; - i = 0; + int i = 0; do { port[0x3c5] = 1 << i; - k = 0; + int k = 0; j = p_o_s; do { - ps = mem[0xa000 * 16 + j]; + // Useless ? + // ps = mem[0xa000 * 16 + j]; mem[0xa000 * 16 + j] = lo(s_s[i][k]); - ps = mem[0xa000 * 16 + j + 1]; + + // Useless ?? + // ps = mem[0xa000 * 16 + j + 1]; mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; } while (k < 8); ++i; } while (i != 4); + } break; case MODE_HERCULES: j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); - for (i = 0; i <= 5; ++i) { - for (k = 0; k <= 3; ++k) + for (int i = 0; i <= 5; ++i) { + for (int k = 0; k <= 3; ++k) WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } break; - case MODE_TANDY: + case MODE_TANDY: { j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); - k = 0; + int k = 0; do { - for (i = 0; i <= 3; ++i) { + for (int i = 0; i <= 3; ++i) { WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; ++k; } while (k != 3); + } break; default: break; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 1ea8d509ed..e1374d4f04 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -172,9 +172,6 @@ void music() { Common::File fic; int k; bool fin; - char ch; -// float x, y; - /* debug('o3 music'); */ if (_soundOff) @@ -202,7 +199,7 @@ void music() { fin = fin | keypressed() | (k >= 5); } while (!fin); while (keypressed()) - ch = get_ch(); // input >> kbd >> ch; + get_ch(); // input >> kbd >> ch; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 52ed011604..82abc27989 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -95,9 +95,8 @@ void taffich() { byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> - int i, m, cx, handle, npal; + int cx, handle, npal; int32 lgt; - int palh, k, j; int alllum[16]; @@ -154,7 +153,7 @@ void taffich() { Common::String filename; if ((a != 50) && (a != 51)) { - m = a + 2000; + int m = a + 2000; if ((m > 2001) && (m < 2010)) m = 2001; if (m == 2011) @@ -209,13 +208,13 @@ void taffich() { } chardes(filename, lgt, handle); if (_currGraphicalDevice == MODE_HERCULES) { - for (i = 0; i <= 15; ++i) { - palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); + for (int i = 0; i <= 15; ++i) { + int palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } - for (i = 0; i <= 15; ++i) { - k = 0; - for (j = 0; j <= 15; ++j) + for (int i = 0; i <= 15; ++i) { + int k = 0; + for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; mem[(0x7000 * 16) + 2 + (k << 1)] = rang[i]; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index d63d9aa808..42fab06f7c 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -231,7 +231,7 @@ Common::String copy(const Common::String &s, int idx, size_t size) { tmp[size] = '\0'; Common::String result(tmp); - delete tmp; + delete[] tmp; return result; } -- cgit v1.2.3 From 2eecba4db94794ac1899ca3c5cfceec0c01e2fe6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 Mar 2012 08:00:23 +0100 Subject: MORTEVIELLE: Replace an 1-based array by a 0-based one --- engines/mortevielle/mor.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index d54312a97f..ab2ac1f256 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -622,17 +622,15 @@ void chlm(int &per) { * @remarks Originally called 'pendule' */ void drawClock() { - const int cv[3][13] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 5, 8, 10, 8, 5, 0, -5, -8, -10, -8, -5, 0 }, - { 0, -5, -3, 0, 3, 5, 6, 5, 3, 0, -3, -5, -6 } + const int cv[2][12] = { + { 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 int x = 580; const int y = 123; const int rg = 9; int h, co; - hideMouse(); paint_rect(570, 118, 20, 10); @@ -653,7 +651,7 @@ void drawClock() { if (h == 0) h = 12; - g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)(x + cv[1][h]) >> 1)*res, y + cv[2][h], co); + g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)(x + cv[0][h - 1]) >> 1)*res, y + cv[1][h - 1], co); showMouse(); g_vm->_screenSurface.putxy(568, 154); -- cgit v1.2.3 From 8d8bd8ec8c52f8f432e1b132e8b462a64ce89132 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 Mar 2012 19:11:56 +0100 Subject: MORTEVIELLE: Add braces, silenting some GCC warnings --- engines/mortevielle/actions.cpp | 93 +++++++++++++++++++++++++++-------------- engines/mortevielle/mor.cpp | 5 ++- engines/mortevielle/mor2.cpp | 8 ++-- 3 files changed, 69 insertions(+), 37 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b2a23f5814..49d6a00c0a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -642,37 +642,42 @@ void fctPlace() { crep = 186; return; } + if (!syn) ecr3(g_vm->getEngineString(S_PUT)); + 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) + if (s.iboul != 0) { crep = 188; - else { + } else { s.iboul = s.derobj; if (s.derobj == 141) aniof(1, 7); } - } else if (s.ibag != 0) + } else if (s.ibag != 0) { crep = 188; - else { + } else { s.ibag = s.derobj; if (s.derobj == 159) aniof(1, 6); } } - if (caff == 14) - if (s.icave != 0) + + if (caff == 14) { + if (s.icave != 0) { crep = 188; - else { + } else { s.icave = s.derobj; if (s.derobj == 151) { // Open hidden passage @@ -684,7 +689,7 @@ void fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); - if (answer== 1) { + if (answer== 1) { Common::String alertTxt = deline(582); Alert::show(alertTxt, 1); @@ -727,29 +732,38 @@ void fctPlace() { return; } } - if (caff == 16) + } + + if (caff == 16) { if (s.icryp == 0) s.icryp = s.derobj; else crep = 188; - if (caff == 17) - if (s.ivier != 0) + } + + if (caff == 17) { + if (s.ivier != 0) { crep = 188; - else if (s.derobj == 143) { + } else if (s.derobj == 143) { s.ivier = 143; aniof(1, 1); } else { crep = 1512; tperd(); } - if (caff == 24) - if (s.ipuit != 0) + } + + if (caff == 24) { + if (s.ipuit != 0) { crep = 188; - else if ((s.derobj == 140) || (s.derobj == 120)) { + } else if ((s.derobj == 140) || (s.derobj == 120)) { s.ipuit = s.derobj; aniof(1, 1); - } else + } else { crep = 185; + } + } + if (crep != 188) maivid(); } @@ -894,11 +908,13 @@ void fctKnock() { if (s.mlieu < 25) { tfleche(); - if (!(anyone) && !(iesc)) + if (!(anyone) && !(iesc)) { if ((s.mlieu < 19) && (s.mlieu != 15)) crep = 133; else crep = 997; + } + return; } @@ -968,27 +984,33 @@ void fctSelfPut() { tcoord(8); if (num != 0) { crep = 998; - if (caff == 2) + 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) + } else if (s.ibag != 0) { crep = 188; - else + } else { s.ibag = s.derobj; + } } - if (caff == 16) + + if (caff == 16) { if (s.icryp != 0) crep = 188; else s.icryp = s.derobj; + } + if (caff == 24) crep = 185; if ((caff == 14) || (caff == 17)) @@ -1056,9 +1078,9 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - if ((s.mlieu > 15) && (s.mlieu < 26)) + if ((s.mlieu > 15) && (s.mlieu < 26)) { crep = 148; - else { + } else { tsort(); s.mlieu = 10; caff = 10; @@ -1069,21 +1091,26 @@ void fctEat() { calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { s.conf = s.conf - (s.conf / 7); - if (h == 12) + if (h == 12) { if (m == 0) h = 4; else h = 3; - if ((h == 13) || (h == 19)) + } + + if ((h == 13) || (h == 19)) { if (m == 0) h = 2; else h = 1; + } + jh += h; crep = 135; tinke(); - } else + } else { crep = 134; + } } } @@ -1204,13 +1231,15 @@ void fctForce() { ecr3(g_vm->getEngineString(S_SMASH)); if (caff < 25) tfleche(); - if ((! anyone) && (! iesc)) + + if ((! anyone) && (! iesc)) { if (s.mlieu != 26) crep = 997; else { crep = 143; s.conf += 2; } + } } /** @@ -1443,10 +1472,10 @@ void fctDiscuss() { } } 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; + s.conf += tabdon[arcf + ix]; + ++nbrep[caff - 69]; } else { - s.conf = s.conf + 3; + s.conf += 3; suj = 139; } hideMouse(); @@ -1459,8 +1488,8 @@ void fctDiscuss() { s.teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { - for (int ix = 29; ix <= 31; ++ix) - s.teauto[ix] = '*'; + for (int indx = 29; indx <= 31; ++indx) + s.teauto[indx] = '*'; s.pourc[7] = '*'; } if (suj == 70) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ab2ac1f256..8b99fcc4a1 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -992,16 +992,17 @@ void ecfren(int &p, int &haz, int cf, int l) { void becfren(int l) { if ((l == 1) || (l == 4)) { int haz = hazard(1, 2); - if (l == 1) + if (l == 1) { if (haz == 1) bh1 = true; else bf1 = true; - if (l == 4) + } else { // l == 4 if (haz == 1) bh4 = true; else bf4 = true; + } } else if (l == 2) bh2 = true; else if (l == 3) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index ed5ed494eb..8edafa8c2c 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -156,10 +156,10 @@ void tinke() { if ((mpers != 0) && (ipers != 10)) mpers = ipers; - if ((mpers == 0) && (ipers > 0)) - if ((s.mlieu == 13) || (s.mlieu == 14)) + if ((mpers == 0) && (ipers > 0)) { + if ((s.mlieu == 13) || (s.mlieu == 14)) { cavegre(); - else if (ipers == 10) { + } else if (ipers == 10) { ipers = 0; if (! brt) { brt = true; @@ -175,6 +175,8 @@ void tinke() { } } } + } + if (activeMenu) g_vm->_menu.drawMenu(); } -- cgit v1.2.3 From 1a70cee6a6e59290819f516736bb3123f232e342 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 2 Mar 2012 02:04:43 +0100 Subject: MORTEVIELLE: Silent a bunch of GCC warnings and errors --- engines/mortevielle/actions.cpp | 610 ++++++++++++++++++------------------ engines/mortevielle/dialogs.cpp | 19 +- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/level15.cpp | 8 +- engines/mortevielle/menu.cpp | 10 +- engines/mortevielle/mor.cpp | 145 +++++---- engines/mortevielle/mor2.cpp | 148 +++++---- engines/mortevielle/mortevielle.cpp | 52 +-- engines/mortevielle/mouse.cpp | 6 +- engines/mortevielle/ovd1.cpp | 6 +- engines/mortevielle/parole.cpp | 4 +- engines/mortevielle/parole2.cpp | 6 +- engines/mortevielle/prog.cpp | 104 +++--- engines/mortevielle/saveload.cpp | 6 +- engines/mortevielle/taffich.cpp | 44 +-- engines/mortevielle/var_mor.cpp | 32 +- engines/mortevielle/var_mor.h | 32 +- 17 files changed, 614 insertions(+), 620 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 49d6a00c0a..56c87efdf8 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -49,13 +49,13 @@ namespace Mortevielle { void fctMove() { int cx; - if ((s.mlieu == 26) && (msg[4] == g_vm->_menu._moveMenu[6])) { - s.mlieu = 15; - caff = s.mlieu; + if ((g_s.mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + g_s.mlieu = 15; + caff = g_s.mlieu; afdes(0); - repon(2, s.mlieu); + repon(2, g_s.mlieu); } - if ((s.mlieu == 15) && (msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s.mlieu == 15) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { if (!syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); @@ -64,21 +64,21 @@ void fctMove() { if ((anyone) || (iesc)) return; tcoord(1); - if (num == 0) + if (g_num == 0) return; - if (num == 1) { - s.mlieu = 0; + if (g_num == 1) { + g_s.mlieu = 0; tmlieu(0); - } else if (num == 7) { - s.mlieu = 13; + } else if (g_num == 7) { + g_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) + } else if (g_num != 6) + g_s.mlieu = 26; + if ((g_num > 1) && (g_num < 6)) + ment = g_num - 1; + if (g_num > 7) + ment = g_num - 3; + if (g_num != 6) affrep(); else aldepl(); @@ -88,56 +88,56 @@ void fctMove() { cx = 0; do { ++cx; - } while (g_vm->_menu._moveMenu[cx] != msg[4]); - if (s.mlieu == 19) { + } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); + if (g_s.mlieu == 19) { if (cx == 1) t1deva(); if (cx == 2) t1neig(); goto L2; } - if (s.mlieu == 23) { + if (g_s.mlieu == 23) { if (cx == 1) t1deau(); if (cx == 2) t1derr(); goto L2; } - if ((s.mlieu == 11) && (cx == 1)) + if ((g_s.mlieu == 11) && (cx == 1)) cx = 6; - if (s.mlieu == 12) { + if (g_s.mlieu == 12) { if (cx == 2) cx = 6; if (cx == 5) cx = 16; } - if ((s.mlieu == 14) && (cx == 3)) + if ((g_s.mlieu == 14) && (cx == 3)) cx = 6; - if (((s.mlieu == 15) || (s.mlieu == 26)) && (cx == 4)) + if (((g_s.mlieu == 15) || (g_s.mlieu == 26)) && (cx == 4)) cx = 6; - if ((s.mlieu > 19) && (s.mlieu != 26)) + if ((g_s.mlieu > 19) && (g_s.mlieu != 26)) cx += 10; - if ((s.mlieu == 20) && (cx == 13)) + if ((g_s.mlieu == 20) && (cx == 13)) cx = 16; - if (s.mlieu == 21) { + if (g_s.mlieu == 21) { if (cx == 12) cx = 16; else if (cx > 13) cx = 15; } - if ((s.mlieu == 22) && (cx > 14)) + if ((g_s.mlieu == 22) && (cx > 14)) cx = 15; - if ((s.mlieu == 24) && (cx != 17)) + if ((g_s.mlieu == 24) && (cx != 17)) if (cx > 13) cx = 15; if (cx == 1) - s.mlieu = 11; + g_s.mlieu = 11; else if (cx == 2) - s.mlieu = 12; + g_s.mlieu = 12; else if (cx == 3) - s.mlieu = 14; + g_s.mlieu = 14; else if (cx == 4) - s.mlieu = 15; + g_s.mlieu = 15; else if (cx == 5) cx = 12; if (cx == 6) @@ -147,31 +147,31 @@ void fctMove() { else if (cx == 12) t1deva(); else if (cx == 13) - s.mlieu = 20; + g_s.mlieu = 20; else if (cx == 14) - s.mlieu = 24; + g_s.mlieu = 24; else if (cx == 15) t1neig(); else if (cx == 16) t1derr(); else if (cx == 17) { - if ((s.ipuit != 120) && (s.ipuit != 140)) + if ((g_s.ipuit != 120) && (g_s.ipuit != 140)) crep = 997; - else if (s.ipuit == 120) + else if (g_s.ipuit == 120) crep = 181; - else if (s.conf > 80) { + else if (g_s.conf > 80) { crep = 1505; tperd(); } else { - s.mlieu = 23; + g_s.mlieu = 23; affrep(); } } if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); - debloc(s.mlieu); + debloc(g_s.mlieu); L2: - tmlieu(s.mlieu); + tmlieu(g_s.mlieu); } /** @@ -184,24 +184,24 @@ void fctTake() { avpoing(cx); if (crep != 139) { if (ipers > 0) - s.conf += 3; + g_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 (g_s.mlieu == 2) + g_s.iloic = 0; + if (g_s.mlieu == 13) { + if (g_s.iboul == caff) + g_s.iboul = 0; + if (g_s.ibag == caff) + g_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; + if (g_s.mlieu == 14) + g_s.icave = 0; + if (g_s.mlieu == 16) + g_s.icryp = 0; + if (g_s.mlieu == 17) + g_s.ivier = 0; + if (g_s.mlieu == 24) + g_s.ipuit = 0; mfouen(); obpart = false; affrep(); @@ -210,7 +210,7 @@ void fctTake() { tsuiv(); ++dobj; if (dobj > 6) { - s.conf += 2; + g_s.conf += 2; dobj = 0; } } @@ -224,46 +224,46 @@ void fctTake() { return; if (caff == 3) { tcoord(2); - if (num == 1) { + if (g_num == 1) { crep = 152; return; } } tcoord(5); - if ((num == 0) || ((num == 1) && (s.mlieu == 16))) { + if ((g_num == 0) || ((g_num == 1) && (g_s.mlieu == 16))) { tcoord(8); - if (num != 0) { + if (g_num != 0) { if (ipers > 0) - s.conf += 3; + g_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 ((g_s.mlieu == 2) && (g_s.iloic != 0)) + avpoing(g_s.iloic); + if ((g_s.mlieu == 13) && (g_num == 1) && (g_s.iboul != 0)) { + avpoing(g_s.iboul); if ((crep != 997) && (crep != 139)) aniof(2, 7); } - if ((s.mlieu == 13) && (num == 2) && (s.ibag != 0)) { - avpoing(s.ibag); + if ((g_s.mlieu == 13) && (g_num == 2) && (g_s.ibag != 0)) { + avpoing(g_s.ibag); if ((crep != 997) && (crep != 139)) aniof(2, 6); } - if ((s.mlieu == 14) && (s.icave != 0)) { - avpoing(s.icave); + if ((g_s.mlieu == 14) && (g_s.icave != 0)) { + avpoing(g_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 ((g_s.mlieu == 16) && (g_s.icryp != 0)) + avpoing(g_s.icryp); + if ((g_s.mlieu == 17) && (g_s.ivier != 0)) { + avpoing(g_s.ivier); if ((crep != 997) && (crep != 139)) { crep = 182; aniof(2, 1); } } - if ((s.mlieu == 24) && (s.ipuit != 0)) { - avpoing(s.ipuit); + if ((g_s.mlieu == 24) && (g_s.ipuit != 0)) { + avpoing(g_s.ipuit); if ((crep != 997) && (crep != 139)) aniof(2, 1); } @@ -271,15 +271,15 @@ void fctTake() { 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)) ) + if ( ((g_s.mlieu == 0) && (g_num == 3)) || ((g_s.mlieu == 1) && (g_num == 4)) + || ((g_s.mlieu == 2) && (g_num == 1)) || ((g_s.mlieu == 4) && (g_num == 3)) + || ((g_s.mlieu == 5) && (g_num == 6)) || ((g_s.mlieu == 6) && (g_num == 2)) + || ((g_s.mlieu == 7) && (g_num == 6)) || ((g_s.mlieu == 8) && (g_num == 4)) + || ((g_s.mlieu == 9) && (g_num == 4)) || ((g_s.mlieu == 10) && (g_num > 2)) + || ((g_s.mlieu == 11) && (g_num == 7)) || ((g_s.mlieu == 12) && (g_num == 6)) + || ((g_s.mlieu == 13) && (g_num > 4)) || ((g_s.mlieu > 13) && (g_s.mlieu != 23)) ) crep = 997; - else if (s.mlieu == 23) { + else if (g_s.mlieu == 23) { crep = 1504; tperd(); } else @@ -296,16 +296,16 @@ void fctInventoryTake() { cx = 0; do { ++cx; - } while (g_vm->_menu._inventoryMenu[cx] != msg[4]); + } while (g_vm->_menu._inventoryMenu[cx] != g_msg[4]); cz = 0; cy = 0; do { ++cy; - if (ord(s.sjer[cy]) != 0) + if (ord(g_s.sjer[cy]) != 0) ++cz; } while (cz != cx); - cz = ord(s.sjer[cy]); - s.sjer[cy] = chr(0); + cz = ord(g_s.sjer[cy]); + g_s.sjer[cy] = chr(0); modinv(); avpoing(cz); crep = 998; @@ -325,25 +325,25 @@ void fctLift() { if ((anyone) || (iesc)) return; tcoord(3); - if (num == 0) { + if (g_num == 0) { tcoord(8); - if (num != 0) { + if (g_num != 0) { if (ipers > 0) - ++s.conf; + ++g_s.conf; crep = 997; - if ((s.mlieu == 2) && (s.iloic != 0)) - treg(s.iloic); + if ((g_s.mlieu == 2) && (g_s.iloic != 0)) + treg(g_s.iloic); } return; } if (ipers > 0) - ++s.conf; - cx = s.mlieu; - if (s.mlieu == 16) + ++g_s.conf; + cx = g_s.mlieu; + if (g_s.mlieu == 16) cx = 14; - else if (s.mlieu == 19) + else if (g_s.mlieu == 19) cx = 15; - crep = tabdon[asoul + (cx << 3) + (num - 1)]; + crep = tabdon[asoul + (cx << 3) + (g_num - 1)]; if (crep == 255) crep = 997; } @@ -361,7 +361,7 @@ void fctRead() { tfleche(); if (!(anyone) && !(iesc)) { tcoord(4); - if (num != 0) + if (g_num != 0) crep = 107; } } @@ -372,10 +372,10 @@ void fctRead() { * @remarks Originally called 'tslire' */ void fctSelfRead() { - if (s.derobj == 0) + if (g_s.derobj == 0) crep = 186; else - st4(s.derobj); + st4(g_s.derobj); } /** @@ -395,64 +395,64 @@ void fctLook() { if ((anyone) || (iesc)) return; tcoord(5); - if (num == 0) { + if (g_num == 0) { tcoord(8); crep = 131; - if (num != 0) { - if (s.mlieu == 13) { - if (num == 1) { + if (g_num != 0) { + if (g_s.mlieu == 13) { + if (g_num == 1) { crep = 164; - if (s.ibag != 0) - treg(s.ibag); - else if (s.iboul != 0) - treg(s.iboul); + if (g_s.ibag != 0) + treg(g_s.ibag); + else if (g_s.iboul != 0) + treg(g_s.iboul); } else { crep = 193; - if (s.ibag != 0) - treg(s.ibag); + if (g_s.ibag != 0) + treg(g_s.ibag); } } - if (s.mlieu == 14) { + if (g_s.mlieu == 14) { crep = 164; - if (s.icave != 0) - treg(s.icave); + if (g_s.icave != 0) + treg(g_s.icave); } - if (s.mlieu == 17) { + if (g_s.mlieu == 17) { crep = 174; - if (s.ivier != 0) - treg(s.ivier); + if (g_s.ivier != 0) + treg(g_s.ivier); } - if (s.mlieu == 24) { + if (g_s.mlieu == 24) { crep = 131; - if (s.ipuit != 0) - treg(s.ipuit); + if (g_s.ipuit != 0) + treg(g_s.ipuit); } } return; } - cx = s.mlieu; - if (s.mlieu == 20) + cx = g_s.mlieu; + if (g_s.mlieu == 20) cx = 17; - if ((s.mlieu > 21) && (s.mlieu < 25)) + if ((g_s.mlieu > 21) && (g_s.mlieu < 25)) cx -= 4; - if (s.mlieu == 26) + if (g_s.mlieu == 26) cx = 21; - crep = tabdon[arega + (cx * 7) + num - 1]; - if ((s.mlieu == 13) && (num == 8)) + crep = tabdon[arega + (cx * 7) + g_num - 1]; + if ((g_s.mlieu == 13) && (g_num == 8)) crep = 126; - if (s.mlieu == 19) + if (g_s.mlieu == 19) crep = 103; if (crep == 255) crep = 131; - if ((s.mlieu == 1) && (num == 1)) + if ((g_s.mlieu == 1) && (g_num == 1)) treg(144); - if ((s.mlieu == 5) && (num == 3)) + if ((g_s.mlieu == 5) && (g_num == 3)) treg(147); - if ((s.mlieu == 8) && (num == 3)) + if ((g_s.mlieu == 8) && (g_num == 3)) treg(149); - if ((s.mlieu == 9) && (num == 2)) + if ((g_s.mlieu == 9) && (g_num == 2)) treg(30); - if ((s.mlieu == 10) && (num == 3)) + if ((g_s.mlieu == 10) && (g_num == 3)) treg(31); } @@ -461,8 +461,8 @@ void fctLook() { * @remarks Originally called 'tsregarder' */ void fctSelftLook() { - if (s.derobj != 0) - treg(s.derobj); + if (g_s.derobj != 0) + treg(g_s.derobj); else crep = 186; } @@ -486,25 +486,25 @@ void fctSearch() { if (anyone || iesc) return; - if (s.mlieu == 23) { + if (g_s.mlieu == 23) { crep = 1504; tperd(); return; } tcoord(6); - if (num == 0) { + if (g_num == 0) { tcoord(7); - if (num != 0) { + if (g_num != 0) { int cx = 0; do { ++cx; - } while ((cx <= 6) && (num != ord(touv[cx]))); - if (num != ord(touv[cx])) + } while ((cx <= 6) && (g_num != ord(touv[cx]))); + if (g_num != ord(touv[cx])) crep = 187; else { if (ipers > 0) - s.conf += 3; + g_s.conf += 3; rechai(mchai); if (mchai != 0) { @@ -519,43 +519,43 @@ void fctSearch() { } else { tcoord(8); crep = 997; - if (num != 0) { + if (g_num != 0) { if (ipers > 0) - s.conf += 3; - if ((s.mlieu != 24) && (s.mlieu != 17) && (s.mlieu != 13)) { - if (s.mlieu == 2) { + g_s.conf += 3; + if ((g_s.mlieu != 24) && (g_s.mlieu != 17) && (g_s.mlieu != 13)) { + if (g_s.mlieu == 2) { crep = 123; - if (s.iloic != 0) - treg(s.iloic); + if (g_s.iloic != 0) + treg(g_s.iloic); } - if (s.mlieu == 16) { + if (g_s.mlieu == 16) { crep = 123; - if (s.icryp != 0) - treg(s.icryp); + if (g_s.icryp != 0) + treg(g_s.icryp); } } } } } else { if (ipers > 0) - s.conf += 3; + g_s.conf += 3; crep = 997; - if (s.mlieu < 14) - crep = r[s.mlieu]; + if (g_s.mlieu < 14) + crep = r[g_s.mlieu]; - if ((s.mlieu == 3) && (num == 2)) + if ((g_s.mlieu == 3) && (g_num == 2)) crep = 162; - if (s.mlieu == 12) { - if ((num == 3) || (num == 4)) + if (g_s.mlieu == 12) { + if ((g_num == 3) || (g_num == 4)) crep = 162; - else if (num == 5) + else if (g_num == 5) crep = 159; } - if (s.mlieu == 19) + if (g_s.mlieu == 19) crep = 104; - else if (s.mlieu == 16) + else if (g_s.mlieu == 16) crep = 155; } } @@ -565,8 +565,8 @@ void fctSearch() { * @remarks Originally called 'tsfouiller' */ void fctSelfSearch() { - if (s.derobj != 0) - st7(s.derobj); + if (g_s.derobj != 0) + st7(g_s.derobj); else crep = 186; } @@ -581,7 +581,7 @@ void fctOpen() { if (caff == 26) { if (ment != 0) { - msg[4] = OPCODE_ENTER; + g_msg[4] = OPCODE_ENTER; syn = true; } else crep = 997; @@ -598,34 +598,34 @@ void fctOpen() { return; tcoord(7); - if (num != 0) { + if (g_num != 0) { if (ipers > 0) - s.conf += 2; + g_s.conf += 2; ++iouv; int cx = 0; do { ++cx; - } 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)) { + } while (!((cx > 6) || (ord(touv[cx]) == 0) || (ord(touv[cx]) == g_num))); + if (ord(touv[cx]) != g_num) { + if (!( ((g_num == 3) && ((g_s.mlieu == 0) || (g_s.mlieu == 9) || (g_s.mlieu == 5) || (g_s.mlieu == 7))) + || ((g_num == 4) && ((g_s.mlieu == 1) || (g_s.mlieu == 2) || (g_s.mlieu == 6))) + || ((g_s.mlieu == 4) && (g_num == 5)) + || ((g_num == 6) && ((g_s.mlieu == 7) || (g_s.mlieu == 10) || (g_s.mlieu == 8) || (g_s.mlieu == 13))) + || ((g_s.mlieu == 8) && (g_num == 2)) + || ((g_s.mlieu == 12) && (g_num == 7))) ) { + if ( ((g_s.mlieu > 10) && (g_s.mlieu < 14)) + || ((g_s.mlieu > 6) && (g_s.mlieu < 10)) + || (g_s.mlieu == 0) || (g_s.mlieu == 2) || (g_s.mlieu == 5)) { if (hazard(1, 4) == 3) parole(7, 9, 1); } - touv[cx] = chr(num); - aniof(1, num); + touv[cx] = chr(g_num); + aniof(1, g_num); } - cx = s.mlieu; - if (s.mlieu == 16) + cx = g_s.mlieu; + if (g_s.mlieu == 16) cx = 14; - crep = tabdon[aouvr + (cx * 7) + num - 1]; + crep = tabdon[aouvr + (cx * 7) + g_num - 1]; if (crep == 254) crep = 999; } else @@ -638,7 +638,7 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - if (s.derobj == 0) { + if (g_s.derobj == 0) { crep = 186; return; } @@ -654,32 +654,32 @@ void fctPlace() { return; tcoord(8); - if (num != 0) { + if (g_num != 0) { crep = 999; if (caff == 13) { - if (num == 1) { - if (s.iboul != 0) { + if (g_num == 1) { + if (g_s.iboul != 0) { crep = 188; } else { - s.iboul = s.derobj; - if (s.derobj == 141) + g_s.iboul = g_s.derobj; + if (g_s.derobj == 141) aniof(1, 7); } - } else if (s.ibag != 0) { + } else if (g_s.ibag != 0) { crep = 188; } else { - s.ibag = s.derobj; - if (s.derobj == 159) + g_s.ibag = g_s.derobj; + if (g_s.derobj == 159) aniof(1, 6); } } if (caff == 14) { - if (s.icave != 0) { + if (g_s.icave != 0) { crep = 188; } else { - s.icave = s.derobj; - if (s.derobj == 151) { + g_s.icave = g_s.derobj; + if (g_s.derobj == 151) { // Open hidden passage aniof(1, 2); aniof(1, 1); @@ -710,10 +710,10 @@ void fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { - s.mlieu = 17; + g_s.mlieu = 17; tmlieu(17); } else { - tmlieu(s.mlieu); + tmlieu(g_s.mlieu); writepal(14); dessin(0); aniof(1, 2); @@ -735,17 +735,17 @@ void fctPlace() { } if (caff == 16) { - if (s.icryp == 0) - s.icryp = s.derobj; + if (g_s.icryp == 0) + g_s.icryp = g_s.derobj; else crep = 188; } if (caff == 17) { - if (s.ivier != 0) { + if (g_s.ivier != 0) { crep = 188; - } else if (s.derobj == 143) { - s.ivier = 143; + } else if (g_s.derobj == 143) { + g_s.ivier = 143; aniof(1, 1); } else { crep = 1512; @@ -754,10 +754,10 @@ void fctPlace() { } if (caff == 24) { - if (s.ipuit != 0) { + if (g_s.ipuit != 0) { crep = 188; - } else if ((s.derobj == 140) || (s.derobj == 120)) { - s.ipuit = s.derobj; + } else if ((g_s.derobj == 140) || (g_s.derobj == 120)) { + g_s.ipuit = g_s.derobj; aniof(1, 1); } else { crep = 185; @@ -784,9 +784,9 @@ void fctTurn() { if ((anyone) || (iesc)) return; tcoord(9); - if (num != 0) { + if (g_num != 0) { crep = 997; - if ((s.mlieu == 13) && (s.ibag == 159) && (s.iboul == 141)) { + if ((g_s.mlieu == 13) && (g_s.ibag == 159) && (g_s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -795,13 +795,13 @@ void fctTurn() { else crep = 168; } - if ((s.mlieu == 17) && (s.ivier == 143)) { + if ((g_s.mlieu == 17) && (g_s.ivier == 143)) { repon(2, 175); clsf3(); parole(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { - s.mlieu = 16; + g_s.mlieu = 16; affrep(); } else crep = 176; @@ -819,7 +819,7 @@ void fctSelfHide() { tfleche(); if (!(anyone) && !(iesc)) { tcoord(10); - if (num == 0) + if (g_num == 0) cache = false; else { cache = true; @@ -833,7 +833,7 @@ void fctSelfHide() { * @remarks Originally called 'tattacher' */ void fctAttach() { - if (s.derobj == 0) + if (g_s.derobj == 0) crep = 186; else { if (!syn) @@ -842,10 +842,10 @@ void fctAttach() { if (!(anyone) && !(iesc)) { tcoord(8); crep = 997; - if ((num != 0) && (s.mlieu == 24)) { + if ((g_num != 0) && (g_s.mlieu == 24)) { crep = 999; - if ((s.derobj == 120) || (s.derobj == 140)) { - s.ipuit = s.derobj; + if ((g_s.derobj == 120) || (g_s.derobj == 140)) { + g_s.ipuit = g_s.derobj; aniof(1, 1); } else crep = 185; @@ -870,13 +870,13 @@ void fctClose() { if ((anyone) || (iesc)) return; tcoord(7); - if (num != 0) { + if (g_num != 0) { int cx = 0; do { ++cx; - } while ((cx <= 6) && (num != ord(touv[cx]))); - if (num == ord(touv[cx])) { - aniof(2, num); + } while ((cx <= 6) && (g_num != ord(touv[cx]))); + if (g_num == ord(touv[cx])) { + aniof(2, g_num); crep = 998; touv[cx] = chr(0); iouv = iouv - 1; @@ -901,15 +901,15 @@ void fctKnock() { if (!syn) ecr3(g_vm->getEngineString(S_HIT)); - if (s.mlieu == 15) { + if (g_s.mlieu == 15) { Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (s.mlieu < 25) { + if (g_s.mlieu < 25) { tfleche(); if (!(anyone) && !(iesc)) { - if ((s.mlieu < 19) && (s.mlieu != 15)) + if ((g_s.mlieu < 19) && (g_s.mlieu != 15)) crep = 133; else crep = 997; @@ -918,11 +918,11 @@ void fctKnock() { return; } - if (s.mlieu == 26) { + if (g_s.mlieu == 26) { int haz = (hazard(0, 8)) - 4; parole(11, haz, 1); int p; - ecfren(p, haz, s.conf, ment); + ecfren(p, haz, g_s.conf, ment); int l = ment; if (l != 0) { if (p != -500) { @@ -948,7 +948,7 @@ void fctKnock() { void fctSelfPut() { if (!syn) ecr3(g_vm->getEngineString(S_POSE)); - if (s.derobj == 0) + if (g_s.derobj == 0) crep = 186; else { if (caff > 99) { @@ -963,7 +963,7 @@ void fctSelfPut() { return; tcoord(7); crep = 124; - if (num != 0) { + if (g_num != 0) { int chai; rechai(chai); if (chai == 0) @@ -972,8 +972,8 @@ void fctSelfPut() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (num != ord(touv[cx]))); - if (num != ord(touv[cx])) + } while ((cx <= 6) && (g_num != ord(touv[cx]))); + if (g_num != ord(touv[cx])) crep = 187; else { mchai = chai; @@ -982,33 +982,33 @@ void fctSelfPut() { } } else { tcoord(8); - if (num != 0) { + if (g_num != 0) { crep = 998; if (caff == 2) { - if (s.iloic != 0) + if (g_s.iloic != 0) crep = 188; else - s.iloic = s.derobj; + g_s.iloic = g_s.derobj; } if (caff == 13) { - if (num == 1) { - if (s.iboul != 0) + if (g_num == 1) { + if (g_s.iboul != 0) crep = 188; else - s.iboul = s.derobj; - } else if (s.ibag != 0) { + g_s.iboul = g_s.derobj; + } else if (g_s.ibag != 0) { crep = 188; } else { - s.ibag = s.derobj; + g_s.ibag = g_s.derobj; } } if (caff == 16) { - if (s.icryp != 0) + if (g_s.icryp != 0) crep = 188; else - s.icryp = s.derobj; + g_s.icryp = g_s.derobj; } if (caff == 24) @@ -1019,7 +1019,7 @@ void fctSelfPut() { crep = 124; if (caff == 24) { tcoord(5); - if (num != 0) + if (g_num != 0) crep = 185; } } @@ -1040,13 +1040,13 @@ void fctSelfPut() { * @remarks Originally called 'tecouter' */ void fctListen() { - if (s.mlieu != 26) + if (g_s.mlieu != 26) crep = 101; else { if (ipers != 0) - ++s.conf; + ++g_s.conf; int p, haz; - ecfren(p, haz, s.conf, ment); + ecfren(p, haz, g_s.conf, ment); int l = ment; if (l != 0) { if (p != -500) { @@ -1078,19 +1078,19 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - if ((s.mlieu > 15) && (s.mlieu < 26)) { + if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { crep = 148; } else { tsort(); - s.mlieu = 10; + g_s.mlieu = 10; caff = 10; - debloc(s.mlieu); - tmlieu(s.mlieu); + debloc(g_s.mlieu); + tmlieu(g_s.mlieu); int j, h, m; calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { - s.conf = s.conf - (s.conf / 7); + g_s.conf -= (g_s.conf / 7); if (h == 12) { if (m == 0) h = 4; @@ -1121,16 +1121,16 @@ void fctEat() { void fctEnter() { // int x; - if ((s.mlieu == 21) || (s.mlieu == 22)) { + if ((g_s.mlieu == 21) || (g_s.mlieu == 22)) { t1sama(); - tmlieu(s.mlieu); - } else if (s.mlieu == 15) + tmlieu(g_s.mlieu); + } else if (g_s.mlieu == 15) aldepl(); else if (ment == 0) crep = 997; - else if ((ment == 9) && (s.derobj != 136)) { + else if ((ment == 9) && (g_s.derobj != 136)) { crep = 189; - s.teauto[8] = '*'; + g_s.teauto[8] = '*'; } else { int z = 0; if (! blo) @@ -1144,18 +1144,18 @@ void fctEnter() { aniof(1, 1); tip(z, g_x); - ++s.conf; - s.mlieu = 15; - msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._discussMenu[g_x]; + ++g_s.conf; + g_s.mlieu = 15; + g_msg[3] = MENU_DISCUSS; + g_msg[4] = g_vm->_menu._discussMenu[g_x]; syn = true; if (ment == 9) { - col = true; + g_col = true; caff = 70; afdes(0); repon(2, caff); } else - col = false; + g_col = false; debloc(ment); ment = 0; } @@ -1164,10 +1164,10 @@ void fctEnter() { parole(7, g_x, 1); aniof(1, 1); - s.mlieu = ment; + g_s.mlieu = ment; affrep(); - debloc(s.mlieu); - tmlieu(s.mlieu); + debloc(g_s.mlieu); + tmlieu(g_s.mlieu); ment = 0; mpers = 0; ipers = 0; @@ -1182,17 +1182,17 @@ void fctEnter() { void fctSleep() { int z, j, h, m; - if ((s.mlieu > 15) && (s.mlieu < 26)) { + if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { crep = 148; return; } - if (s.mlieu != 0) { + if (g_s.mlieu != 0) { tsort(); - s.mlieu = 0; + g_s.mlieu = 0; affrep(); afdes(0); - debloc(s.mlieu); - tmlieu(s.mlieu); + debloc(g_s.mlieu); + tmlieu(g_s.mlieu); } clsf3(); clsf2(); @@ -1203,7 +1203,7 @@ void fctSleep() { int answer; do { if (h < 8) { - s.conf = s.conf - (s.conf / 20); + g_s.conf -= (g_s.conf / 20); z = (7 - h) * 2; if (m == 30) --z; @@ -1219,7 +1219,7 @@ void fctSleep() { anyone = false; } while (answer != 1); crep = 998; - num = 0; + g_num = 0; } /** @@ -1233,11 +1233,11 @@ void fctForce() { tfleche(); if ((! anyone) && (! iesc)) { - if (s.mlieu != 26) + if (g_s.mlieu != 26) crep = 997; else { crep = 143; - s.conf += 2; + g_s.conf += 2; } } } @@ -1249,27 +1249,27 @@ void fctForce() { void fctLeave() { tsort(); crep = 0; - if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22) || (s.mlieu == 24)) + if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22) || (g_s.mlieu == 24)) crep = 997; else { int lx = 0; - if ((s.mlieu < 16) || (s.mlieu == 26)) + if ((g_s.mlieu < 16) || (g_s.mlieu == 26)) lx = 10; - if ((s.mlieu == 10) || (s.mlieu == 20)) + if ((g_s.mlieu == 10) || (g_s.mlieu == 20)) lx = 21; - if ((s.mlieu < 10) || (s.mlieu == 13)) + if ((g_s.mlieu < 10) || (g_s.mlieu == 13)) lx = 15; - if (s.mlieu == 16) { + if (g_s.mlieu == 16) { lx = 17; crep = 176; } - if (s.mlieu == 17) + if (g_s.mlieu == 17) t23coul(lx); - if (s.mlieu == 23) + if (g_s.mlieu == 23) lx = 24; if (crep != 997) - s.mlieu = lx; + g_s.mlieu = lx; caff = lx; if (crep == 0) crep = lx; @@ -1293,12 +1293,12 @@ void fctWait() { ++jh; tinke(); if (!blo) - t11(s.mlieu, quel); + t11(g_s.mlieu, quel); if ((ipers != 0) && (mpers == 0)) { crep = 998; - if ((s.mlieu == 13) || (s.mlieu == 14)) + if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) cavegre(); - if ((s.mlieu > 0) && (s.mlieu < 10)) + if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) anyone = true; mpers = ipers; if (!anyone) @@ -1324,7 +1324,7 @@ void fctSound() { tfleche(); if (!(anyone) && (!iesc)) crep = 145; - num = 0; + g_num = 0; } } @@ -1340,13 +1340,13 @@ void fctDiscuss() { bool f; finfouil(); - if (col) + if (g_col) suj = 128; else { cx = 0; do { ++cx; - } while (g_vm->_menu._discussMenu[cx] != msg[4]); + } while (g_vm->_menu._discussMenu[cx] != g_msg[4]); caff = 69 + cx; afdes(0); repon(2, caff); @@ -1377,11 +1377,13 @@ void fctDiscuss() { do { ++icm; g_vm->_screenSurface.putxy(co, lig); - if (s.teauto[icm] == '*') + if (g_s.teauto[icm] == '*') { if (te[icm]) writetp(lib[icm], 1); else writetp(lib[icm], 0); + } + if (icm == 23) { lig = 0; co = 320; @@ -1396,7 +1398,7 @@ void fctDiscuss() { CHECK_QUIT; getMousePos(x, y, c); - x = x * (3 - res); + x *= (3 - res); if (x > 319) cx = 41; else @@ -1435,7 +1437,7 @@ void fctDiscuss() { writetp(lib[choi], 1); te[choi] = ! te[choi]; } - if ((s.teauto[ix] == '*') || (ix == 46)) { + if ((g_s.teauto[ix] == '*') || (ix == 46)) { lig = ((ix - 1) % 23) << 3; if (ix > 23) co = 320; @@ -1456,9 +1458,9 @@ void fctDiscuss() { g_vm->setMouseClick(false); if (choi != 46) { int ix = choi - 1; - if (col) { - col = false; - s.mlieu = 15; + if (g_col) { + g_col = false; + g_s.mlieu = 15; if (iouv > 0) max = 8; else @@ -1468,14 +1470,14 @@ void fctDiscuss() { suj = 129; else { suj = 138; - s.conf = s.conf + (3 * (s.conf / 10)); + g_s.conf += (3 * (g_s.conf / 10)); } } else if (nbrep[caff - 69] < nbrepm[caff - 69]) { suj = tabdon[arep + (ix << 3) + (caff - 70)]; - s.conf += tabdon[arcf + ix]; + g_s.conf += tabdon[arcf + ix]; ++nbrep[caff - 69]; } else { - s.conf += 3; + g_s.conf += 3; suj = 139; } hideMouse(); @@ -1484,32 +1486,32 @@ void fctDiscuss() { sparl(0, suj); showMouse(); if ((suj == 84) || (suj == 86)) { - s.pourc[5] = '*'; - s.teauto[7] = '*'; + g_s.pourc[5] = '*'; + g_s.teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { for (int indx = 29; indx <= 31; ++indx) - s.teauto[indx] = '*'; - s.pourc[7] = '*'; + g_s.teauto[indx] = '*'; + g_s.pourc[7] = '*'; } if (suj == 70) { - s.pourc[8] = '*'; - s.teauto[32] = '*'; + g_s.pourc[8] = '*'; + g_s.teauto[32] = '*'; } hideMouse(); hirs(); showMouse(); } } while ((choi != 46) && (suj != 138)); - if (col) { - s.conf = s.conf + (3 * (s.conf / 10)); + if (g_col) { + g_s.conf += (3 * (g_s.conf / 10)); hideMouse(); hirs(); premtet(); sparl(0, 138); showMouse(); - col = false; - s.mlieu = 15; + g_col = false; + g_s.mlieu = 15; } ctrm = 0; hideMouse(); @@ -1521,7 +1523,7 @@ void fctDiscuss() { drawClock(); affrep(); /* chech;*/ - tmlieu(s.mlieu); + tmlieu(g_s.mlieu); clsf3(); } @@ -1540,7 +1542,7 @@ void fctSmell() { crep = 153; } else if (caff == 123) crep = 110; - num = 0; + g_num = 0; } /** @@ -1554,7 +1556,7 @@ void fctScratch() { ecr3(g_vm->getEngineString(S_SCRATCH)); tfleche(); } - num = 0; + g_num = 0; } /** @@ -1608,9 +1610,9 @@ void MortevielleEngine::loseGame() { vh = 10; vm = 0; vj = 0; - _minute = 0; - _hour = 10; - _day = 0; + g_minute = 0; + g_hour = 10; + g_day = 0; repon(2, 180); answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 9d7ea2fa4c..fec8b2f81f 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -326,7 +326,8 @@ bool Ques::show() { optionPosY = 35; maxLength = 0; - for (int j = firstOption, prevChoice = 1; j <= lastOption; ++j, ++prevChoice) { + prevChoice = 1; + for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) { tmpStr = deline(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); @@ -369,16 +370,16 @@ bool Ques::show() { ++currChoice; if (coor[currChoice].enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { - Common::String tmpStr = choiceArray[prevChoice] + '$'; + tmpStr = choiceArray[prevChoice] + '$'; afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { - Common::String tmpStr = choiceArray[currChoice] + '$'; + tmpStr = choiceArray[currChoice] + '$'; afftex(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { - Common::String tmpStr = choiceArray[prevChoice] + '$'; + tmpStr = choiceArray[prevChoice] + '$'; afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } @@ -438,15 +439,15 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { parole(SpeechNum, 0, 0); - waitForF3F8(key); + waitForF3F8(g_key); CHECK_QUIT; - if (_newGraphicalDevice != _currGraphicalDevice) { - _currGraphicalDevice = _newGraphicalDevice; + if (g_newGraphicalDevice != g_currGraphicalDevice) { + g_currGraphicalDevice = g_newGraphicalDevice; hirs(); aff50(drawAni50Fl); } - } while (key != 66); // keycode for F8 + } while (g_key != 66); // keycode for F8 } /** @@ -462,7 +463,7 @@ void f3f8::waitForF3F8(int &key) { void f3f8::aff50(bool drawAni50Fl) { caff = 50; - _maff = 0; + g_maff = 0; taffich(); dessine(ades, 63, 12); if (drawAni50Fl) diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 0cf22b35d8..d6ebe986df 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -42,7 +42,7 @@ int testou() { switch (ch) { case '\23' : - _soundOff = !_soundOff; + g_soundOff = !g_soundOff; break; case '\26' : if ((c_zzz == 1) || (c_zzz == 2)) { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index f90e1aa714..5030da9acb 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -68,7 +68,7 @@ void outbloc(int n, pattern p, t_nhom pal) { void writepal(int n) { t_nhom pal; - switch (_currGraphicalDevice) { + switch (g_currGraphicalDevice) { case MODE_TANDY: case MODE_EGA: case MODE_AMSTRAD1512: @@ -96,7 +96,7 @@ void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&mem[seg * 16 + dep]); - if (_currGraphicalDevice == MODE_HERCULES) { + if (g_currGraphicalDevice == MODE_HERCULES) { mem[0x7000 * 16 + 2] = 0; mem[0x7000 * 16 + 32] = 15; } @@ -109,13 +109,13 @@ void pictout(int seg, int dep, int x, int y) { void sauvecr(int y, int dy) { hideMouse(); - s_sauv(_currGraphicalDevice, y, dy); + s_sauv(g_currGraphicalDevice, y, dy); showMouse(); } void charecr(int y, int dy) { hideMouse(); - s_char(_currGraphicalDevice, y, dy); + s_char(g_currGraphicalDevice, y, dy); showMouse(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6ff97164f0..998b70fa35 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -154,7 +154,7 @@ void Menu::displayMenu() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * res; - if (_currGraphicalDevice == MODE_CGA) + if (g_currGraphicalDevice == MODE_CGA) color = 1; else color = 9; @@ -456,8 +456,8 @@ void Menu::mdn() { // A menu was clicked on choisi = (test0) && (msg4 != OPCODE_NONE); menuUp(msg3); - msg[4] = msg4; - msg[3] = msg3; + g_msg[4] = msg4; + g_msg[3] = msg3; msg3 = OPCODE_NONE; msg4 = OPCODE_NONE; @@ -513,8 +513,8 @@ void Menu::initMenu() { } msg3 = OPCODE_NONE; msg4 = OPCODE_NONE; - msg[3] = OPCODE_NONE; - msg[4] = OPCODE_NONE; + g_msg[3] = OPCODE_NONE; + g_msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 8b99fcc4a1..d3eb248574 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -114,7 +114,7 @@ void dessine(int ad, int x, int y) { void dessine_rouleau() { writepal(89); - if (_currGraphicalDevice == MODE_HERCULES) { + if (g_currGraphicalDevice == MODE_HERCULES) { mem[0x7000 * 16 + 14] = 15; } hideMouse(); @@ -236,11 +236,11 @@ void clsf10() { cod = 544; } g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (s.conf < 33) + if (g_s.conf < 33) st = g_vm->getEngineString(S_COOL); - else if (s.conf < 66) + else if (g_s.conf < 66) st = g_vm->getEngineString(S_LOURDE); - else if (s.conf > 65) + else if (g_s.conf > 65) st = g_vm->getEngineString(S_MALSAINE); co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); @@ -259,7 +259,7 @@ void clsf10() { void stop() { hirs(); - _currGraphicalDevice = MODE_AMSTRAD1512; + g_currGraphicalDevice = MODE_AMSTRAD1512; hirs(); g_vm->quitGame(); } @@ -267,7 +267,7 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - if (_currGraphicalDevice == MODE_CGA) + if (g_currGraphicalDevice == MODE_CGA) co = 3; else co = 11; @@ -280,7 +280,7 @@ int hazard(int min, int max) { void calch(int &j, int &h, int &m) { int nh = readclock(); - int th = jh + ((nh - mh) / t); + int th = jh + ((nh - mh) / g_t); m = ((th % 2) + vm) * 30; h = ((uint)th >> 1) + vh; if (m == 60) { @@ -357,12 +357,12 @@ void repon(int f, int m) { ecrf2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) - s.teauto[40] = '*'; + g_s.teauto[40] = '*'; if ((m == 104) && (caff == 14)) { - s.teauto[36] = '*'; - if (s.teauto[39] == '*') { - s.pourc[3] = '*'; - s.teauto[38] = '*'; + g_s.teauto[36] = '*'; + if (g_s.teauto[39] == '*') { + g_s.pourc[3] = '*'; + g_s.teauto[38] = '*'; } } } @@ -377,10 +377,10 @@ void repon(int f, int m) { afftex(tmpStr, 80, 40, 60, 25, i); if (m == 180) - s.pourc[6] = '*'; + g_s.pourc[6] = '*'; if (m == 179) - s.pourc[10] = '*'; + g_s.pourc[10] = '*'; } if (f == 7) { /* messint */ ecrf7(); @@ -635,17 +635,17 @@ void drawClock() { paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); - if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) + if ((g_currGraphicalDevice == MODE_CGA) || (g_currGraphicalDevice == MODE_HERCULES)) co = 0; else co = 1; - if (_minute == 0) + if (g_minute == 0) g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); else g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); - h = _hour; + h = g_hour; if (h > 12) h -= 12; if (h == 0) @@ -655,15 +655,15 @@ void drawClock() { showMouse(); g_vm->_screenSurface.putxy(568, 154); - if (_hour > 11) + if (g_hour > 11) g_vm->_screenSurface.writeg("PM ", 1); else g_vm->_screenSurface.writeg("AM ", 1); g_vm->_screenSurface.putxy(550, 160); - if ((_day >= 0) && (_day <= 8)) { + if ((g_day >= 0) && (g_day <= 8)) { Common::String tmp = g_vm->getEngineString(S_DAY); - tmp.insertChar((char)(_day + 49), 0); + tmp.insertChar((char)(g_day + 49), 0); g_vm->_screenSurface.writeg(tmp, 1); } } @@ -673,9 +673,9 @@ void drawClock() { *************/ void debloc(int l) { - num = 0; + g_num = 0; g_x = 0; - y = 0; + g_y = 0; if ((l != 26) && (l != 15)) t5(l); mpers = ipers; @@ -1033,46 +1033,44 @@ void phaz(int &haz, int &p, int cf) { } void inzon() { - int cx; - 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; + g_s.ipre = false; + g_s.derobj = 0; + g_s.icave = 0; + g_s.iboul = 0; + g_s.ibag = 0; + g_s.ipuit = 0; + g_s.ivier = 0; + g_s.iloic = 136; + g_s.icryp = 141; + g_s.conf = hazard(4, 10); + g_s.mlieu = 21; - for (cx = 2; cx <= 6; ++cx) - s.sjer[cx] = chr(0); + for (int cx = 2; cx <= 6; ++cx) + g_s.sjer[cx] = chr(0); - s.sjer[1] = chr(113); - s.heure = chr(20); + g_s.sjer[1] = chr(113); + g_s.heure = chr(20); - for (cx = 1; cx <= 10; ++cx) - s.pourc[cx] = ' '; + for (int cx = 1; cx <= 10; ++cx) + g_s.pourc[cx] = ' '; - for (cx = 1; cx <= 6; ++cx) - s.teauto[cx] = '*'; + for (int cx = 1; cx <= 6; ++cx) + g_s.teauto[cx] = '*'; - for (cx = 7; cx <= 9; ++cx) - s.teauto[cx] = ' '; + for (int cx = 7; cx <= 9; ++cx) + g_s.teauto[cx] = ' '; - for (cx = 10; cx <= 28; ++cx) - s.teauto[cx] = '*'; + for (int cx = 10; cx <= 28; ++cx) + g_s.teauto[cx] = '*'; - for (cx = 29; cx <= 42; ++cx) - s.teauto[cx] = ' '; + for (int cx = 29; cx <= 42; ++cx) + g_s.teauto[cx] = ' '; - s.teauto[33] = '*'; + g_s.teauto[33] = '*'; - for (cx = 1; cx <= 8; ++cx) + for (int cx = 1; cx <= 8; ++cx) nbrep[cx] = 0; init_nbrepm(); @@ -1081,9 +1079,9 @@ void inzon() { void dprog() { li = 21; jh = 0; - if (! s.ipre) + if (!g_s.ipre) blo = true; - t = ti1; + g_t = ti1; mh = readclock(); } @@ -1221,7 +1219,7 @@ void pl20(int cf) { void t11(int l11, int &a) { int p, haz; - ecfren(p, haz, s.conf, l11); + ecfren(p, haz, g_s.conf, l11); li = l11; if ((l11 > 0) && (l11 < 10)) { if (p != -500) { @@ -1253,7 +1251,7 @@ void t11(int l11, int &a) { cpl15(p); if (l11 == 20) cpl20(p, h); - p = p + s.conf; + p += g_s.conf; haz = hazard(1, 100); if (haz > p) { person(); @@ -1276,20 +1274,17 @@ void t11(int l11, int &a) { } void cavegre() { - int haz; - - s.conf = s.conf + 2; - if (s.conf > 69) - s.conf += (s.conf / 10); + g_s.conf += 2; + if (g_s.conf > 69) + g_s.conf += (g_s.conf / 10); clsf3(); ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); - haz = (hazard(0, 4)) - 2; + int haz = (hazard(0, 4)) - 2; parole(2, haz, 1); - // Useless? - for (haz = 0; haz <= 3000; ++haz) - ; + // The original was doing here a useless loop. + // It has been removed clsf3(); person(); @@ -1340,12 +1335,12 @@ void musique(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((prebru == 0) && (! s.ipre)) { + } else if ((prebru == 0) && (!g_s.ipre)) { parole(10, 1, 1); ++prebru; } else { bool i = false; - if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) { + if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22)) { int haz = hazard(1, 3); if (haz == 2) { haz = hazard(2, 4); @@ -1353,21 +1348,23 @@ void musique(int so) { i = true; } } - if (s.mlieu == 20) { + if (g_s.mlieu == 20) { int haz = hazard(1, 2); if (haz == 1) { parole(8, 1, 1); i = true; } } - if (s.mlieu == 24) { + + if (g_s.mlieu == 24) { int haz = hazard(1, 2); if (haz == 2) { parole(12, 1, 1); i = true; } } - if (s.mlieu == 23) { + + if (g_s.mlieu == 23) { parole(13, 1, 1); i = true; } @@ -1400,19 +1397,19 @@ void dessin(int ad) { } if (caff == 13) { - if (s.iboul == 141) + if (g_s.iboul == 141) aniof(1, 7); - if (s.ibag == 159) + if (g_s.ibag == 159) aniof(1, 6); } - if ((caff == 14) && (s.icave == 151)) + if ((caff == 14) && (g_s.icave == 151)) aniof(1, 2); - if ((caff == 17) && (s.ivier == 143)) + if ((caff == 17) && (g_s.ivier == 143)) aniof(1, 1); - if ((caff == 24) && (s.ipuit != 0)) + if ((caff == 24) && (g_s.ipuit != 0)) aniof(1, 1); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 8edafa8c2c..42e1d0f9fa 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -51,8 +51,8 @@ void tinke() { anyone = false; calch(j, h, m); - if (j != _day) { - _day = j; + if (j != g_day) { + g_day = j; cx = 0; do { ++cx; @@ -61,13 +61,13 @@ void tinke() { nbrep[cx] = 0; } while (cx != 8); } - if ((h > _hour) || ((h == 0) && (_hour == 23))) { - _hour = h; - _minute = 0; + if ((h > g_hour) || ((h == 0) && (g_hour == 23))) { + g_hour = h; + g_minute = 0; drawClock(); cf = 0; for (cx = 1; cx <= 10; ++cx) { - if (s.pourc[cx] == '*') + if (g_s.pourc[cx] == '*') ++cf; } @@ -89,8 +89,8 @@ void tinke() { _hintPctMessage += d6; _hintPctMessage += d4; } - if (m > _minute) { - _minute = 30; + if (m > g_minute) { + g_minute = 30; drawClock(); } if (y_s < 12) @@ -98,21 +98,21 @@ void tinke() { if (! blo) { if ((h == 12) || ((h > 18) && (h < 21)) || ((h >= 0) && (h < 7))) - t = ti2; + g_t = ti2; else - t = ti1; - cf = s.conf; + g_t = ti1; + cf = g_s.conf; if ((cf > 33) && (cf < 66)) - t -= (t / 3); + g_t -= (g_t / 3); if (cf > 65) - t -= ((t / 3) * 2); + g_t -= ((g_t / 3) * 2); int nh = readclock(); - if ((nh - mh) > t) { + if ((nh - mh) > g_t) { bool activeMenu = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); - jh += ((nh - mh) / t); + jh += ((nh - mh) / g_t); mh = nh; switch (li) { case 1: @@ -157,7 +157,7 @@ void tinke() { mpers = ipers; if ((mpers == 0) && (ipers > 0)) { - if ((s.mlieu == 13) || (s.mlieu == 14)) { + if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) { cavegre(); } else if (ipers == 10) { ipers = 0; @@ -186,7 +186,7 @@ void tinke() { nouvp(li, cx); brt = false; hdb = 0; - if ((s.mlieu > 0) && (s.mlieu < 10)) + if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) anyone = true; } } @@ -195,9 +195,9 @@ void fenat(char ans) { int coul; hideMouse(); - if (_currGraphicalDevice == MODE_CGA) + if (g_currGraphicalDevice == MODE_CGA) coul = 2; - else if (_currGraphicalDevice == MODE_HERCULES) + else if (g_currGraphicalDevice == MODE_HERCULES) coul = 1; else coul = 12; @@ -222,7 +222,7 @@ void tkey1(bool d) { hideMouse(); fenat('K'); while (keypressed()) - key = testou(); + g_key = testou(); do { if (d) @@ -265,20 +265,18 @@ void tlu(int af, int ob) { repon(2, 999); tkey1(true); caff = af; - msg[3] = OPCODE_NONE; + g_msg[3] = OPCODE_NONE; crep = 998; } void affrep() { - caff = s.mlieu; - crep = s.mlieu; + caff = g_s.mlieu; + crep = g_s.mlieu; } void mfouen() { - int cx; - - tmlieu(s.mlieu); - for (cx = 1; cx <= 11; ++cx) + tmlieu(g_s.mlieu); + for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(_actionMenu[cx]); g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); @@ -304,18 +302,18 @@ void tperd() { repon(9, crep); clsf2(); clsf3(); - col = false; + g_col = false; syn = false; okdes = false; } void tsort() { - if ((iouv > 0) && (s.mlieu != 0)) { - if (s.conf < 50) - s.conf += 2; + if ((iouv > 0) && (g_s.mlieu != 0)) { + if (g_s.conf < 50) + g_s.conf += 2; else - s.conf += (s.conf / 10); + g_s.conf += (g_s.conf / 10); } for (int cx = 1; cx <= 7; ++cx) @@ -323,7 +321,7 @@ void tsort() { ment = 0; iouv = 0; mchai = 0; - debloc(s.mlieu); + debloc(g_s.mlieu); } void st4(int ob) { @@ -361,14 +359,14 @@ void cherjer(int ob, bool &d) { d = false; for (cx = 1; cx <= 6; ++cx) - d = (d || (ord(s.sjer[cx]) == ob)); + d = (d || (ord(g_s.sjer[cx]) == ob)); - if (s.derobj == ob) + if (g_s.derobj == ob) d = true; } void st1sama() { - s.mlieu = 10; + g_s.mlieu = 10; affrep(); } @@ -378,9 +376,9 @@ void modinv() { int cy = 0; for (int cx = 1; cx <= 6; ++cx) - if (s.sjer[cx] != chr(0)) { + if (g_s.sjer[cx] != chr(0)) { ++cy; - r = (ord(s.sjer[cx]) + 400); + r = (ord(g_s.sjer[cx]) + 400); nomp = deline(r - 501 + c_st41); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); @@ -432,7 +430,7 @@ void mfoudi() { } void mennor() { - g_vm->_menu.menuUp(msg[3]); + g_vm->_menu.menuUp(g_msg[3]); } void premtet() { @@ -449,7 +447,7 @@ void ajchai() { } while ((cx <= 9) && (tabdon[cy + cx] != 0)); if (tabdon[cy + cx] == 0) { - int lderobj = s.derobj; + int lderobj = g_s.derobj; tabdon[cy + cx] = lderobj; } else crep = 192; @@ -459,10 +457,10 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(s.sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(g_s.sjer[cx]) != 0)); - if (ord(s.sjer[cx]) == 0) { - s.sjer[(cx)] = chr(ob); + if (ord(g_s.sjer[cx]) == 0) { + g_s.sjer[(cx)] = chr(ob); modinv(); } else crep = 139; @@ -472,7 +470,7 @@ void t1sama() { //Entering manor int j, h, m; calch(j, h, m); - if ((h < 5) && (s.mlieu > 18)) { + if ((h < 5) && (g_s.mlieu > 18)) { bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late @@ -480,7 +478,7 @@ void t1sama() { //Entering manor tperd(); } else st1sama(); - } else if (!s.ipre) { //Is it your first time? + } else if (!g_s.ipre) { //Is it your first time? ipers = 255; affper(ipers); caff = 77; @@ -496,21 +494,21 @@ void t1sama() { //Entering manor dessine_rouleau(); drawClock(); showMouse(); - s.mlieu = 0; + g_s.mlieu = 0; affrep(); t5(10); if (! blo) t11(0, m); ipers = 0; mpers = 0; - s.ipre = true; + g_s.ipre = true; /*chech;*/ } else st1sama(); } void t1vier() { - s.mlieu = 17; + g_s.mlieu = 17; affrep(); } @@ -521,19 +519,19 @@ void t1neig() { tperd(); } else { okdes = true; - s.mlieu = 19; + g_s.mlieu = 19; affrep(); } } void t1deva() { inei = 0; - s.mlieu = 21; + g_s.mlieu = 21; affrep(); } void t1derr() { - s.mlieu = 22; + g_s.mlieu = 22; affrep(); } @@ -565,21 +563,21 @@ L1: parole(4, 4, 1); if (iouv == 0) - s.conf += 2; - else if (s.conf < 50) - s.conf += 4; + g_s.conf += 2; + else if (g_s.conf < 50) + g_s.conf += 4; else - s.conf += 3 * (s.conf / 10); + g_s.conf += 3 * (g_s.conf / 10); tsort(); tmlieu(15); int cx; tip(ipers, cx); caff = 69 + cx; crep = caff; - msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._discussMenu[cx]; + g_msg[3] = MENU_DISCUSS; + g_msg[4] = g_vm->_menu._discussMenu[cx]; syn = true; - col = true; + g_col = true; } else { int haz = hazard(1, 3); if (haz == 2) { @@ -618,7 +616,7 @@ void tsuiv() { caff = tbcl; crep = caff + 400; if (ipers != 0) - s.conf = s.conf + 2; + g_s.conf = g_s.conf + 2; } else { affrep(); finfouil(); @@ -631,7 +629,7 @@ void tfleche() { bool qust; char touch; - if (num == 9999) + if (g_num == 9999) return; fenat(chr(152)); @@ -650,14 +648,14 @@ void tfleche() { if (qust && (touch == '\103')) Alert::show(_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (y != 0)) || (anyone) || (rect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (anyone) || (rect))); if (touch == '\73') iesc = true; if (rect) { g_x = x_s; - y = y_s; + g_y = y_s; } } @@ -666,7 +664,7 @@ void tcoord(int sx) { int ib; - num = 0; + g_num = 0; crep = 999; int a = 0; int atdon = amzon + 3; @@ -703,10 +701,10 @@ void tcoord(int sx) { ix = tabdon[a + cb] * res; iy = tabdon[(a + cb + 1)]; ++cy; - } while (!(((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); + } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); - if ((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) { - num = cy - 1; + if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { + g_num = cy - 1; return; } @@ -740,7 +738,7 @@ void treg(int ob) { int mdes = caff; caff = ob; - if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == OPCODE_SLOOK)) { + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { afdes(0); if ((caff > 29) && (caff < 33)) repon(2, caff); @@ -748,7 +746,7 @@ void treg(int ob) { repon(2, (caff + 400)); tkey1(true); caff = mdes; - msg[3] = 0; + g_msg[3] = 0; crep = 998; } else { obpart = true; @@ -759,22 +757,22 @@ void treg(int ob) { void avpoing(int &ob) { crep = 999; - if (s.derobj != 0) - ajjer(s.derobj); + if (g_s.derobj != 0) + ajjer(g_s.derobj); if (crep != 139) { modobj(ob + 400); - s.derobj = ob; + g_s.derobj = ob; ob = 0; } } void rechai(int &ch) { - int cx = s.mlieu; + int cx = g_s.mlieu; - if (s.mlieu == 16) + if (g_s.mlieu == 16) cx = 14; - ch = tabdon[achai + (cx * 7) + num - 1]; + ch = tabdon[achai + (cx * 7) + g_num - 1]; } void t23coul(int &l) { @@ -789,7 +787,7 @@ void t23coul(int &l) { } void maivid() { - s.derobj = 0; + g_s.derobj = 0; modobj(500); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 50631663e1..7d0e7bc8ed 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -121,7 +121,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - _currGraphicalDevice = MODE_EGA; + g_currGraphicalDevice = MODE_EGA; res = 2; _txxFileFl = false; @@ -142,8 +142,8 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - _currGraphicalDevice = MODE_EGA; - _newGraphicalDevice = _currGraphicalDevice; + g_currGraphicalDevice = MODE_EGA; + g_newGraphicalDevice = g_currGraphicalDevice; zuul = false; tesok = false; charpal(); @@ -155,15 +155,15 @@ Common::ErrorCode MortevielleEngine::initialise() { initMouse(); init_lieu(); - _soundOff = false; + g_soundOff = false; f2_all = false; teskbd(); dialpre(); - _newGraphicalDevice = _currGraphicalDevice; + g_newGraphicalDevice = g_currGraphicalDevice; teskbd(); - if (_newGraphicalDevice != _currGraphicalDevice) - _currGraphicalDevice = _newGraphicalDevice; + if (g_newGraphicalDevice != g_currGraphicalDevice) + g_currGraphicalDevice = g_newGraphicalDevice; hirs(); ades = 0x7000; @@ -558,7 +558,7 @@ void MortevielleEngine::handleAction() { g_vm->_menu.drawMenu(); imen = true; temps = 0; - key = 0; + g_key = 0; funct = false; inkey = '.'; @@ -578,24 +578,24 @@ void MortevielleEngine::handleAction() { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (choisi && (msg[3] == MENU_SAVE)) { - Common::String saveName = Common::String::format("Savegame #%d", msg[4] & 7); - g_vm->_savegameManager.saveGame(msg[4] & 7, saveName); + if (choisi && (g_msg[3] == MENU_SAVE)) { + Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7); + g_vm->_savegameManager.saveGame(g_msg[4] & 7, saveName); } - if (choisi && (msg[3] == MENU_LOAD)) - g_vm->_savegameManager.loadGame((msg[4] & 7) - 1); + if (choisi && (g_msg[3] == MENU_LOAD)) + g_vm->_savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { - if ((mnumo != OPCODE_NONE) && ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SELF))) { - msg[4] = mnumo; + if ((mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { + g_msg[4] = mnumo; ecr3(g_vm->getEngineString(S_IDEM)); } else return; } else if (inkey == '\104') { - if ((g_x != 0) && (y != 0)) - num = 9999; + if ((g_x != 0) && (g_y != 0)) + g_num = 9999; return; } } @@ -607,22 +607,22 @@ void MortevielleEngine::handleAction() { return; if (temps > lim) { repon(2, 141); - if (num == 9999) - num = 0; + if (g_num == 9999) + g_num = 0; } else { - mnumo = msg[3]; - if ((msg[3] == MENU_ACTION) || (msg[3] == MENU_SELF)) - mnumo = msg[4]; + mnumo = g_msg[3]; + if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) + mnumo = g_msg[4]; if (! anyone) { if ((fouil) || (obpart)) { if (y_s < 12) return; - if ((msg[4] == OPCODE_SOUND) || (msg[4] == OPCODE_LIFT)) { + if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { oo = true; - if ((msg[4] == OPCODE_LIFT) || (obpart)) { + if ((g_msg[4] == OPCODE_LIFT) || (obpart)) { finfouil(); - caff = s.mlieu; + caff = g_s.mlieu; crep = 998; } else tsuiv(); @@ -640,7 +640,7 @@ void MortevielleEngine::handleAction() { okdes = false; dessin(0); } - if ((! syn) || (col)) + if ((! syn) || (g_col)) repon(2, crep); } } while (syn); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d607b0597b..9baae57eb6 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -86,7 +86,7 @@ void hideMouse() { if (mouse_shwn == 0) { bool imp = odd(y_s); int j = p_o_s; - switch (_currGraphicalDevice) { + switch (g_currGraphicalDevice) { case MODE_CGA: { int k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); @@ -183,7 +183,7 @@ void showMouse() { j = p_o_s; imp = odd(y_s); i = x_s & 7; - switch (_currGraphicalDevice) { + switch (g_currGraphicalDevice) { case MODE_CGA: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); @@ -418,7 +418,7 @@ void moveMouse(bool &funct, char &key) { cy = 8; break; case '\23': - _soundOff = !_soundOff; + g_soundOff = !g_soundOff; return; break; case '\26': diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index e1374d4f04..7b2dcabee9 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -174,7 +174,7 @@ void music() { bool fin; /* debug('o3 music'); */ - if (_soundOff) + if (g_soundOff) return; rech_cfiec = true; @@ -244,8 +244,8 @@ void suite() { caff = 51; taffich(); teskbd(); - if (_newGraphicalDevice != _currGraphicalDevice) - _currGraphicalDevice = _newGraphicalDevice; + if (g_newGraphicalDevice != g_currGraphicalDevice) + g_currGraphicalDevice = g_newGraphicalDevice; hirs(); dessine(ades, 0, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 791bfd7d61..cbe460a43d 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -35,8 +35,8 @@ namespace Mortevielle { void spfrac(int wor) { c3.rep = (uint)wor >> 12; if ((typlec == 0) && (c3.code != 9)) - if (((c3.code > 4) && (c3.val != 20) && ((c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || - ((c3.code < 5) && ((c3.val != 19) && (c3.val != 22) && (c3.rep != 4) && (c3.rep != 9))))) { + if (((c3.code > 4) && (c3.val != 20) && (c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || + ((c3.code < 5) && ((c3.val != 19) && (c3.val != 22) && (c3.rep != 4) && (c3.rep != 9)))) { ++c3.rep; } diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 19b44191b0..2402e37195 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -87,17 +87,17 @@ void parole(int rep, int ht, int typ) { int savph[501]; int tempo; - if (_soundOff) + if (g_soundOff) return; num_ph = rep; - haut = ht; + g_haut = ht; typlec = typ; if (typlec != 0) { for (int i = 0; i <= 500; ++i) savph[i] = t_cph[i]; tempo = tempo_bruit; - } else if (haut > 5) + } else if (g_haut > 5) tempo = tempo_f; else tempo = tempo_m; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 635140f048..6dd8df10a6 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -45,7 +45,7 @@ namespace Mortevielle { */ void changeGraphicalDevice(int newDevice) { hideMouse(); - _currGraphicalDevice = newDevice; + g_currGraphicalDevice = newDevice; hirs(); initMouse(); showMouse(); @@ -58,7 +58,7 @@ void changeGraphicalDevice(int newDevice) { person(); clsf2(); clsf3(); - _maff = 68; + g_maff = 68; afdes(0); repon(2, crep); g_vm->_menu.displayMenu(); @@ -82,21 +82,21 @@ void MortevielleEngine::gameLoaded() { test[0] = false; test[1] = false; g[0] = '\040'; - col = false; + g_col = false; tesok = true; test[2] = false; g[7] = g[0]; g[2] = 'A'; cache = false; brt = false; - _maff = 68; + g_maff = 68; g[5] = 'E'; mnumo = 0; prebru = 0; g[4] = 'T'; g_x = 0; - y = 0; - num = 0; + g_y = 0; + g_num = 0; hdb = 0; hfb = 0; cs = 0; @@ -133,10 +133,10 @@ void MortevielleEngine::gameLoaded() { repon(2, crep); clsf3(); _endGame = false; - tmlieu(s.mlieu); + tmlieu(g_s.mlieu); modinv(); - if (s.derobj != 0) - modobj2(s.derobj + 400, test[1], test[2]); + if (g_s.derobj != 0) + modobj2(g_s.derobj + 400, test[1], test[2]); else tesok = test[1] || test[2]; showMouse(); @@ -153,82 +153,82 @@ void tmaj3() { m = 1; h += j * 24; m += h * 2; - s.heure = chr(m); + g_s.heure = chr(m); } void tsitu() { int h, j, m; - if (! col) + if (!g_col) clsf2(); syn = false; iesc = false; if (!anyone) { if (brt) - if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { + if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { ctrm = 4; mennor(); return; } - if (msg[3] == MENU_MOVE) + if (g_msg[3] == MENU_MOVE) fctMove(); - if (msg[3] == MENU_DISCUSS) + if (g_msg[3] == MENU_DISCUSS) fctDiscuss(); - if (msg[3] == MENU_INVENTORY) + if (g_msg[3] == MENU_INVENTORY) fctInventoryTake(); - if (msg[4] == OPCODE_ATTACH) + if (g_msg[4] == OPCODE_ATTACH) fctAttach(); - if (msg[4] == OPCODE_WAIT) + if (g_msg[4] == OPCODE_WAIT) fctWait(); - if (msg[4] == OPCODE_FORCE) + if (g_msg[4] == OPCODE_FORCE) fctForce(); - if (msg[4] == OPCODE_SLEEP) + if (g_msg[4] == OPCODE_SLEEP) fctSleep(); - if (msg[4] == OPCODE_LISTEN) + if (g_msg[4] == OPCODE_LISTEN) fctListen(); - if (msg[4] == OPCODE_ENTER) + if (g_msg[4] == OPCODE_ENTER) fctEnter(); - if (msg[4] == OPCODE_CLOSE) + if (g_msg[4] == OPCODE_CLOSE) fctClose(); - if (msg[4] == OPCODE_SEARCH) + if (g_msg[4] == OPCODE_SEARCH) fctSearch(); - if (msg[4] == OPCODE_KNOCK) + if (g_msg[4] == OPCODE_KNOCK) fctKnock(); - if (msg[4] == OPCODE_SCRATCH) + if (g_msg[4] == OPCODE_SCRATCH) fctScratch(); - if (msg[4] == OPCODE_READ) + if (g_msg[4] == OPCODE_READ) fctRead(); - if (msg[4] == OPCODE_EAT) + if (g_msg[4] == OPCODE_EAT) fctEat(); - if (msg[4] == OPCODE_PLACE) + if (g_msg[4] == OPCODE_PLACE) fctPlace(); - if (msg[4] == OPCODE_OPEN) + if (g_msg[4] == OPCODE_OPEN) fctOpen(); - if (msg[4] == OPCODE_TAKE) + if (g_msg[4] == OPCODE_TAKE) fctTake(); - if (msg[4] == OPCODE_LOOK) + if (g_msg[4] == OPCODE_LOOK) fctLook(); - if (msg[4] == OPCODE_SMELL) + if (g_msg[4] == OPCODE_SMELL) fctSmell(); - if (msg[4] == OPCODE_SOUND) + if (g_msg[4] == OPCODE_SOUND) fctSound(); - if (msg[4] == OPCODE_LEAVE) + if (g_msg[4] == OPCODE_LEAVE) fctLeave(); - if (msg[4] == OPCODE_LIFT) + if (g_msg[4] == OPCODE_LIFT) fctLift(); - if (msg[4] == OPCODE_TURN) + if (g_msg[4] == OPCODE_TURN) fctTurn(); - if (msg[4] == OPCODE_SSEARCH) + if (g_msg[4] == OPCODE_SSEARCH) fctSelfSearch(); - if (msg[4] == OPCODE_SREAD) + if (g_msg[4] == OPCODE_SREAD) fctSelfRead(); - if (msg[4] == OPCODE_SPUT) + if (g_msg[4] == OPCODE_SPUT) fctSelfPut(); - if (msg[4] == OPCODE_SLOOK) + if (g_msg[4] == OPCODE_SLOOK) fctSelftLook(); cache = false; - if (msg[4] == OPCODE_SHIDE) + if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { if (anyone) { @@ -239,16 +239,16 @@ void tsitu() { } } 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) && (!g_vm->_loseGame)) { - if ((s.conf > 99) && (h > 8) && (h < 16)) { + if ((((h == 12) || (h == 13) || (h == 19)) && (g_s.mlieu != 10)) || + ((h > 0) && (h < 6) && (g_s.mlieu != 0))) + ++g_s.conf; + if (((g_s.mlieu < 16) || (g_s.mlieu > 19)) && (g_s.mlieu != 23) + && (g_s.mlieu != 0) && (g_s.derobj != 152) && (!g_vm->_loseGame)) { + if ((g_s.conf > 99) && (h > 8) && (h < 16)) { crep = 1501; tperd(); } - if ((s.conf > 99) && (h > 0) && (h < 9)) { + if ((g_s.conf > 99) && (h > 0) && (h < 9)) { crep = 1508; tperd(); } @@ -263,16 +263,16 @@ void tsitu() { /* NIVEAU 1 */ void theure() { - vj = ord(s.heure); + vj = ord(g_s.heure); vh = vj % 48; vj /= 48; vm = vh % 2; vh /= 2; - _hour = vh; + g_hour = vh; if (vm == 1) - _minute = 30; + g_minute = 30; else - _minute = 0; + g_minute = 0; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 929b0880f6..7afaa47da0 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -85,7 +85,7 @@ void SavegameManager::takesav(int n) { Common::File f; if (stream == NULL) { if (!f.open(filename)) - error("Unable to open save file '%s'", filename); + error("Unable to open save file '%s'", filename.c_str()); stream = f.readStream(f.size()); f.close(); @@ -107,7 +107,7 @@ void SavegameManager::takesav(int n) { Common::Serializer sz(stream, NULL); sync_save(sz); - s = s1; + g_s = s1; for (i = 0; i <= 389; ++i) tabdon[i + acha] = bufcha[i]; @@ -143,7 +143,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { for (i = 0; i <= 389; ++i) bufcha[i] = tabdon[i + acha]; - s1 = s; + s1 = g_s; if (s1.mlieu == 26) s1.mlieu = 15; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 82abc27989..1694387964 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -106,42 +106,42 @@ void taffich() { else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; int b = a; - if (_maff == a) + if (g_maff == a) return; switch (a) { case 16: - s.pourc[9] = '*'; - s.teauto[42] = '*'; + g_s.pourc[9] = '*'; + g_s.teauto[42] = '*'; break; case 20: - s.teauto[39] = '*'; - if (s.teauto[36] == '*') { - s.pourc[3] = '*'; - s.teauto[38] = '*'; + g_s.teauto[39] = '*'; + if (g_s.teauto[36] == '*') { + g_s.pourc[3] = '*'; + g_s.teauto[38] = '*'; } break; case 24: - s.teauto[37] = '*'; + g_s.teauto[37] = '*'; break; case 30: - s.teauto[9] = '*'; + g_s.teauto[9] = '*'; break; case 31: - s.pourc[4] = '*'; - s.teauto[35] = '*'; + g_s.pourc[4] = '*'; + g_s.teauto[35] = '*'; break; case 118: - s.teauto[41] = '*'; + g_s.teauto[41] = '*'; break; case 143: - s.pourc[1] = '*'; + g_s.pourc[1] = '*'; break; case 150: - s.teauto[34] = '*'; + g_s.teauto[34] = '*'; break; case 151: - s.pourc[2] = '*'; + g_s.pourc[2] = '*'; break; default: break; @@ -160,7 +160,7 @@ void taffich() { m = 2010; if (a == 32) m = 2034; - if ((a == 17) && (_maff == 14)) + if ((a == 17) && (g_maff == 14)) m = 2018; if (a > 99) if ((is == 1) || (is == 0)) @@ -169,10 +169,10 @@ void taffich() { 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))) + if (((a < 27) && (((g_maff > 69) && (!g_s.ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; messint(m); - _maff = a; + g_maff = a; if (a == 159) a = 86; else if (a > 140) @@ -203,11 +203,11 @@ void taffich() { lgt = handle; handle = g_l[88]; } - _maff = a; + g_maff = a; npal = a + 37; } chardes(filename, lgt, handle); - if (_currGraphicalDevice == MODE_HERCULES) { + if (g_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { int palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); @@ -244,11 +244,11 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_s.mlieu == 15)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (! blo) - t11(s.mlieu, cx); + t11(g_s.mlieu, cx); mpers = 0; } } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 42fab06f7c..138b604c3a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -91,7 +91,7 @@ bool blo, bt7, bh9, - _soundOff, + g_soundOff, main1, choisi, test0, @@ -99,7 +99,7 @@ bool blo, imen, cache, iesc, - col, + g_col, syn, fouil, zuul, @@ -114,8 +114,8 @@ bool blo, int g_x, - y, - t, + g_y, + g_t, vj, li, vh, @@ -123,20 +123,19 @@ int g_x, jh, mh, cs, - _currGraphicalDevice, + g_currGraphicalDevice, hdb, hfb, - _hour, - _day, - key, - _minute, - num, - max, + g_hour, + g_day, + g_key, + g_minute, + g_num, res, ment, - haut, + g_haut, caff, - _maff, + g_maff, crep, ades, iouv, @@ -146,7 +145,7 @@ int g_x, msg3, msg4, mlec, - _newGraphicalDevice, + g_newGraphicalDevice, c_zzz, mchai, menup, @@ -162,7 +161,6 @@ int g_x, typlec, num_ph, numpal, - lderobj, nb_word, ptr_oct, k_tempo, @@ -179,9 +177,9 @@ byte mode; int nbrep[9]; int nbrepm[9]; -int msg[5]; +int g_msg[5]; byte touv[8]; -sav_chaine s, s1; +sav_chaine g_s, s1; byte bufcha[391]; byte lettres[7][24]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5769b61064..1ccea2c7b3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -232,7 +232,7 @@ extern bool blo, bt7, bh9, - _soundOff, + g_soundOff, main1, choisi, test0, @@ -240,7 +240,7 @@ extern bool blo, imen, cache, iesc, - col, + g_col, syn, fouil, zuul, @@ -254,8 +254,8 @@ extern bool blo, extern int g_x, - y, - t, + g_y, + g_t, vj, li, vh, @@ -263,20 +263,19 @@ extern int g_x, jh, mh, cs, - _currGraphicalDevice, + g_currGraphicalDevice, hdb, hfb, - _hour, - _day, - key, - _minute, - num, - max, + g_hour, + g_day, + g_key, + g_minute, + g_num, res, ment, - haut, + g_haut, caff, - _maff, + g_maff, crep, ades, iouv, @@ -286,7 +285,7 @@ extern int g_x, msg3, msg4, mlec, - _newGraphicalDevice, + g_newGraphicalDevice, c_zzz, mchai, menup, @@ -302,7 +301,6 @@ extern int g_x, typlec, num_ph, numpal, - lderobj, nb_word, ptr_oct, k_tempo, @@ -319,9 +317,9 @@ extern byte mode; extern int nbrep[9]; extern int nbrepm[9]; -extern int msg[5]; +extern int g_msg[5]; extern byte touv[8]; -extern sav_chaine s, s1; +extern sav_chaine g_s, s1; extern byte bufcha[391]; extern byte lettres[7][24]; -- cgit v1.2.3 From 7764caaadee89b9eb1922acc93abf157ce84e4f7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 2 Mar 2012 08:38:41 +0100 Subject: MORTEVIELLE: Start renaming globals --- engines/mortevielle/actions.cpp | 594 ++++++++++++++++++------------------ engines/mortevielle/dialogs.cpp | 34 +-- engines/mortevielle/graphics.cpp | 6 +- engines/mortevielle/keyboard.cpp | 4 +- engines/mortevielle/level15.cpp | 2 +- engines/mortevielle/menu.cpp | 122 ++++---- engines/mortevielle/mor.cpp | 250 +++++++-------- engines/mortevielle/mor2.cpp | 246 +++++++-------- engines/mortevielle/mortevielle.cpp | 64 ++-- engines/mortevielle/mouse.cpp | 24 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/ovd1.cpp | 12 +- engines/mortevielle/parole.cpp | 10 +- engines/mortevielle/parole2.cpp | 38 +-- engines/mortevielle/prog.cpp | 86 +++--- engines/mortevielle/taffich.cpp | 10 +- engines/mortevielle/var_mor.cpp | 144 ++++----- engines/mortevielle/var_mor.h | 142 ++++----- 18 files changed, 896 insertions(+), 894 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 56c87efdf8..d115ef3976 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -51,17 +51,17 @@ void fctMove() { if ((g_s.mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { g_s.mlieu = 15; - caff = g_s.mlieu; + g_caff = g_s.mlieu; afdes(0); repon(2, g_s.mlieu); } if ((g_s.mlieu == 15) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); - if (iesc) - okdes = false; - if ((anyone) || (iesc)) + if (g_iesc) + g_okdes = false; + if ((g_anyone) || (g_iesc)) return; tcoord(1); if (g_num == 0) @@ -75,9 +75,9 @@ void fctMove() { } else if (g_num != 6) g_s.mlieu = 26; if ((g_num > 1) && (g_num < 6)) - ment = g_num - 1; + g_ment = g_num - 1; if (g_num > 7) - ment = g_num - 3; + g_ment = g_num - 3; if (g_num != 6) affrep(); else @@ -156,11 +156,11 @@ void fctMove() { t1derr(); else if (cx == 17) { if ((g_s.ipuit != 120) && (g_s.ipuit != 140)) - crep = 997; + g_crep = 997; else if (g_s.ipuit == 120) - crep = 181; + g_crep = 181; else if (g_s.conf > 80) { - crep = 1505; + g_crep = 1505; tperd(); } else { g_s.mlieu = 23; @@ -179,19 +179,19 @@ L2: * @remarks Originally called 'tprendre' */ void fctTake() { - if (caff > 99) { - int cx = caff; + if (g_caff > 99) { + int cx = g_caff; avpoing(cx); - if (crep != 139) { - if (ipers > 0) + if (g_crep != 139) { + if (g_ipers > 0) g_s.conf += 3; - if (obpart) { + if (g_obpart) { if (g_s.mlieu == 2) g_s.iloic = 0; if (g_s.mlieu == 13) { - if (g_s.iboul == caff) + if (g_s.iboul == g_caff) g_s.iboul = 0; - if (g_s.ibag == caff) + if (g_s.ibag == g_caff) g_s.ibag = 0; } if (g_s.mlieu == 14) @@ -203,29 +203,29 @@ void fctTake() { if (g_s.mlieu == 24) g_s.ipuit = 0; mfouen(); - obpart = false; + g_obpart = false; affrep(); } else { - tabdon[acha + ((mchai - 1) * 10) + cs - 1] = 0; + tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; tsuiv(); - ++dobj; - if (dobj > 6) { + ++g_dobj; + if (g_dobj > 6) { g_s.conf += 2; - dobj = 0; + g_dobj = 0; } } } return; } - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_TAKE)); tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; - if (caff == 3) { + if (g_caff == 3) { tcoord(2); if (g_num == 1) { - crep = 152; + g_crep = 152; return; } } @@ -233,42 +233,42 @@ void fctTake() { if ((g_num == 0) || ((g_num == 1) && (g_s.mlieu == 16))) { tcoord(8); if (g_num != 0) { - if (ipers > 0) + if (g_ipers > 0) g_s.conf += 3; - crep = 997; + g_crep = 997; if ((g_s.mlieu == 2) && (g_s.iloic != 0)) avpoing(g_s.iloic); if ((g_s.mlieu == 13) && (g_num == 1) && (g_s.iboul != 0)) { avpoing(g_s.iboul); - if ((crep != 997) && (crep != 139)) + if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } if ((g_s.mlieu == 13) && (g_num == 2) && (g_s.ibag != 0)) { avpoing(g_s.ibag); - if ((crep != 997) && (crep != 139)) + if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } if ((g_s.mlieu == 14) && (g_s.icave != 0)) { avpoing(g_s.icave); - if ((crep != 997) && (crep != 139)) + if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } if ((g_s.mlieu == 16) && (g_s.icryp != 0)) avpoing(g_s.icryp); if ((g_s.mlieu == 17) && (g_s.ivier != 0)) { avpoing(g_s.ivier); - if ((crep != 997) && (crep != 139)) { - crep = 182; + if ((g_crep != 997) && (g_crep != 139)) { + g_crep = 182; aniof(2, 1); } } if ((g_s.mlieu == 24) && (g_s.ipuit != 0)) { avpoing(g_s.ipuit); - if ((crep != 997) && (crep != 139)) + if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); } - if ((crep != 997) && (crep != 182) && (crep != 139)) - crep = 999; + if ((g_crep != 997) && (g_crep != 182) && (g_crep != 139)) + g_crep = 999; } } else { if ( ((g_s.mlieu == 0) && (g_num == 3)) || ((g_s.mlieu == 1) && (g_num == 4)) @@ -278,12 +278,12 @@ void fctTake() { || ((g_s.mlieu == 9) && (g_num == 4)) || ((g_s.mlieu == 10) && (g_num > 2)) || ((g_s.mlieu == 11) && (g_num == 7)) || ((g_s.mlieu == 12) && (g_num == 6)) || ((g_s.mlieu == 13) && (g_num > 4)) || ((g_s.mlieu > 13) && (g_s.mlieu != 23)) ) - crep = 997; + g_crep = 997; else if (g_s.mlieu == 23) { - crep = 1504; + g_crep = 1504; tperd(); } else - crep = 120; + g_crep = 120; } } /** @@ -308,7 +308,7 @@ void fctInventoryTake() { g_s.sjer[cy] = chr(0); modinv(); avpoing(cz); - crep = 998; + g_crep = 998; clsf2(); } @@ -319,33 +319,33 @@ void fctInventoryTake() { void fctLift() { int cx; - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(3); if (g_num == 0) { tcoord(8); if (g_num != 0) { - if (ipers > 0) + if (g_ipers > 0) ++g_s.conf; - crep = 997; + g_crep = 997; if ((g_s.mlieu == 2) && (g_s.iloic != 0)) treg(g_s.iloic); } return; } - if (ipers > 0) + if (g_ipers > 0) ++g_s.conf; cx = g_s.mlieu; if (g_s.mlieu == 16) cx = 14; else if (g_s.mlieu == 19) cx = 15; - crep = tabdon[asoul + (cx << 3) + (g_num - 1)]; - if (crep == 255) - crep = 997; + g_crep = tabdon[asoul + (cx << 3) + (g_num - 1)]; + if (g_crep == 255) + g_crep = 997; } /** @@ -353,16 +353,16 @@ void fctLift() { * @remarks Originally called 'tlire' */ void fctRead() { - if (caff > 99) - st4(caff); + if (g_caff > 99) + st4(g_caff); else { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_READ)); tfleche(); - if (!(anyone) && !(iesc)) { + if (!(g_anyone) && !(g_iesc)) { tcoord(4); if (g_num != 0) - crep = 107; + g_crep = 107; } } } @@ -373,7 +373,7 @@ void fctRead() { */ void fctSelfRead() { if (g_s.derobj == 0) - crep = 186; + g_crep = 186; else st4(g_s.derobj); } @@ -385,45 +385,45 @@ void fctSelfRead() { void fctLook() { int cx; - if (caff > 99) { - crep = 103; + if (g_caff > 99) { + g_crep = 103; return; } - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_LOOK)); tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(5); if (g_num == 0) { tcoord(8); - crep = 131; + g_crep = 131; if (g_num != 0) { if (g_s.mlieu == 13) { if (g_num == 1) { - crep = 164; + g_crep = 164; if (g_s.ibag != 0) treg(g_s.ibag); else if (g_s.iboul != 0) treg(g_s.iboul); } else { - crep = 193; + g_crep = 193; if (g_s.ibag != 0) treg(g_s.ibag); } } if (g_s.mlieu == 14) { - crep = 164; + g_crep = 164; if (g_s.icave != 0) treg(g_s.icave); } if (g_s.mlieu == 17) { - crep = 174; + g_crep = 174; if (g_s.ivier != 0) treg(g_s.ivier); } if (g_s.mlieu == 24) { - crep = 131; + g_crep = 131; if (g_s.ipuit != 0) treg(g_s.ipuit); } @@ -437,13 +437,13 @@ void fctLook() { cx -= 4; if (g_s.mlieu == 26) cx = 21; - crep = tabdon[arega + (cx * 7) + g_num - 1]; + g_crep = tabdon[arega + (cx * 7) + g_num - 1]; if ((g_s.mlieu == 13) && (g_num == 8)) - crep = 126; + g_crep = 126; if (g_s.mlieu == 19) - crep = 103; - if (crep == 255) - crep = 131; + g_crep = 103; + if (g_crep == 255) + g_crep = 131; if ((g_s.mlieu == 1) && (g_num == 1)) treg(144); if ((g_s.mlieu == 5) && (g_num == 3)) @@ -464,7 +464,7 @@ void fctSelftLook() { if (g_s.derobj != 0) treg(g_s.derobj); else - crep = 186; + g_crep = 186; } /** @@ -474,20 +474,20 @@ void fctSelftLook() { void fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; - if (caff > 99) { - st7(caff); + if (g_caff > 99) { + st7(g_caff); return; } - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_SEARCH)); tfleche(); - if (anyone || iesc) + if (g_anyone || g_iesc) return; if (g_s.mlieu == 23) { - crep = 1504; + g_crep = 1504; tperd(); return; } @@ -501,35 +501,35 @@ void fctSearch() { ++cx; } while ((cx <= 6) && (g_num != ord(touv[cx]))); if (g_num != ord(touv[cx])) - crep = 187; + g_crep = 187; else { - if (ipers > 0) + if (g_ipers > 0) g_s.conf += 3; - rechai(mchai); - if (mchai != 0) { - cs = 0; + rechai(g_mchai); + if (g_mchai != 0) { + g_cs = 0; is = 0; - fouil = true; + g_fouil = true; mfoudi(); tsuiv(); } else - crep = 997; + g_crep = 997; } } else { tcoord(8); - crep = 997; + g_crep = 997; if (g_num != 0) { - if (ipers > 0) + if (g_ipers > 0) g_s.conf += 3; if ((g_s.mlieu != 24) && (g_s.mlieu != 17) && (g_s.mlieu != 13)) { if (g_s.mlieu == 2) { - crep = 123; + g_crep = 123; if (g_s.iloic != 0) treg(g_s.iloic); } if (g_s.mlieu == 16) { - crep = 123; + g_crep = 123; if (g_s.icryp != 0) treg(g_s.icryp); } @@ -537,26 +537,26 @@ void fctSearch() { } } } else { - if (ipers > 0) + if (g_ipers > 0) g_s.conf += 3; - crep = 997; + g_crep = 997; if (g_s.mlieu < 14) - crep = r[g_s.mlieu]; + g_crep = r[g_s.mlieu]; if ((g_s.mlieu == 3) && (g_num == 2)) - crep = 162; + g_crep = 162; if (g_s.mlieu == 12) { if ((g_num == 3) || (g_num == 4)) - crep = 162; + g_crep = 162; else if (g_num == 5) - crep = 159; + g_crep = 159; } if (g_s.mlieu == 19) - crep = 104; + g_crep = 104; else if (g_s.mlieu == 16) - crep = 155; + g_crep = 155; } } @@ -568,7 +568,7 @@ void fctSelfSearch() { if (g_s.derobj != 0) st7(g_s.derobj); else - crep = 186; + g_crep = 186; } /** @@ -576,32 +576,32 @@ void fctSelfSearch() { * @remarks Originally called 'touvrir' */ void fctOpen() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_OPEN)); - if (caff == 26) { - if (ment != 0) { + if (g_caff == 26) { + if (g_ment != 0) { g_msg[4] = OPCODE_ENTER; - syn = true; + g_syn = true; } else - crep = 997; + g_crep = 997; return; } - if (caff == 15) { + if (g_caff == 15) { aldepl(); return; } tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(7); if (g_num != 0) { - if (ipers > 0) + if (g_ipers > 0) g_s.conf += 2; - ++iouv; + ++g_iouv; int cx = 0; do { ++cx; @@ -625,11 +625,11 @@ void fctOpen() { cx = g_s.mlieu; if (g_s.mlieu == 16) cx = 14; - crep = tabdon[aouvr + (cx * 7) + g_num - 1]; - if (crep == 254) - crep = 999; + g_crep = tabdon[aouvr + (cx * 7) + g_num - 1]; + if (g_crep == 254) + g_crep = 999; } else - crep = 18; + g_crep = 18; } } @@ -639,34 +639,34 @@ void fctOpen() { */ void fctPlace() { if (g_s.derobj == 0) { - crep = 186; + g_crep = 186; return; } - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_PUT)); tfleche(); - if (iesc) - crep = 998; + if (g_iesc) + g_crep = 998; - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(8); if (g_num != 0) { - crep = 999; - if (caff == 13) { + g_crep = 999; + if (g_caff == 13) { if (g_num == 1) { if (g_s.iboul != 0) { - crep = 188; + g_crep = 188; } else { g_s.iboul = g_s.derobj; if (g_s.derobj == 141) aniof(1, 7); } } else if (g_s.ibag != 0) { - crep = 188; + g_crep = 188; } else { g_s.ibag = g_s.derobj; if (g_s.derobj == 159) @@ -674,9 +674,9 @@ void fctPlace() { } } - if (caff == 14) { + if (g_caff == 14) { if (g_s.icave != 0) { - crep = 188; + g_crep = 188; } else { g_s.icave = g_s.derobj; if (g_s.derobj == 151) { @@ -693,7 +693,7 @@ void fctPlace() { Common::String alertTxt = deline(582); Alert::show(alertTxt, 1); - tesok = false; + g_tesok = false; bool enterPassageFl = Ques::show(); hideMouse(); hirs(); @@ -703,8 +703,8 @@ void fctPlace() { showMouse(); tinke(); drawClock(); - if (ipers != 0) - affper(ipers); + if (g_ipers != 0) + affper(g_ipers); else person(); @@ -721,50 +721,50 @@ void fctPlace() { alertTxt = deline(577); Alert::show(alertTxt, 1); aniof(2, 1); - crep = 166; + g_crep = 166; } affrep(); } else { aniof(2, 1); - crep = 166; - tesok = true; + g_crep = 166; + g_tesok = true; } return; } } } - if (caff == 16) { + if (g_caff == 16) { if (g_s.icryp == 0) g_s.icryp = g_s.derobj; else - crep = 188; + g_crep = 188; } - if (caff == 17) { + if (g_caff == 17) { if (g_s.ivier != 0) { - crep = 188; + g_crep = 188; } else if (g_s.derobj == 143) { g_s.ivier = 143; aniof(1, 1); } else { - crep = 1512; + g_crep = 1512; tperd(); } } - if (caff == 24) { + if (g_caff == 24) { if (g_s.ipuit != 0) { - crep = 188; + g_crep = 188; } else if ((g_s.derobj == 140) || (g_s.derobj == 120)) { g_s.ipuit = g_s.derobj; aniof(1, 1); } else { - crep = 185; + g_crep = 185; } } - if (crep != 188) + if (g_crep != 188) maivid(); } } @@ -774,18 +774,18 @@ void fctPlace() { * @remarks Originally called 'ttourner' */ void fctTurn() { - if (caff > 99) { - crep = 149; + if (g_caff > 99) { + g_crep = 149; return; } - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_TURN)); tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(9); if (g_num != 0) { - crep = 997; + g_crep = 997; if ((g_s.mlieu == 13) && (g_s.ibag == 159) && (g_s.iboul == 141)) { repon(2, 167); parole(7, 9, 1); @@ -793,7 +793,7 @@ void fctTurn() { if (answer == 1) g_vm->_endGame = true; else - crep = 168; + g_crep = 168; } if ((g_s.mlieu == 17) && (g_s.ivier == 143)) { repon(2, 175); @@ -804,7 +804,7 @@ void fctTurn() { g_s.mlieu = 16; affrep(); } else - crep = 176; + g_crep = 176; } } } @@ -814,16 +814,16 @@ void fctTurn() { * @remarks Originally called 'tcacher' */ void fctSelfHide() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); - if (!(anyone) && !(iesc)) { + if (!(g_anyone) && !(g_iesc)) { tcoord(10); if (g_num == 0) - cache = false; + g_cache = false; else { - cache = true; - crep = 999; + g_cache = true; + g_crep = 999; } } } @@ -834,21 +834,21 @@ void fctSelfHide() { */ void fctAttach() { if (g_s.derobj == 0) - crep = 186; + g_crep = 186; else { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_TIE)); tfleche(); - if (!(anyone) && !(iesc)) { + if (!(g_anyone) && !(g_iesc)) { tcoord(8); - crep = 997; + g_crep = 997; if ((g_num != 0) && (g_s.mlieu == 24)) { - crep = 999; + g_crep = 999; if ((g_s.derobj == 120) || (g_s.derobj == 140)) { g_s.ipuit = g_s.derobj; aniof(1, 1); } else - crep = 185; + g_crep = 185; maivid(); } } @@ -860,14 +860,14 @@ void fctAttach() { * @remarks Originally called 'tfermer' */ void fctClose() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_CLOSE)); - if (caff < 26) { + if (g_caff < 26) { tfleche(); - if (iesc) - crep = 998; - if ((anyone) || (iesc)) + if (g_iesc) + g_crep = 998; + if ((g_anyone) || (g_iesc)) return; tcoord(7); if (g_num != 0) { @@ -877,20 +877,22 @@ void fctClose() { } while ((cx <= 6) && (g_num != ord(touv[cx]))); if (g_num == ord(touv[cx])) { aniof(2, g_num); - crep = 998; + g_crep = 998; touv[cx] = chr(0); - iouv = iouv - 1; - if (iouv < 0) - iouv = 0; + --g_iouv; + if (g_iouv < 0) + g_iouv = 0; int chai = 9999; rechai(chai); - if (mchai == chai) - mchai = 0; - } else crep = 187; + if (g_mchai == chai) + g_mchai = 0; + } else { + g_crep = 187; + } } } - if (caff == 26) - crep = 999; + if (g_caff == 26) + g_crep = 999; } /** @@ -898,7 +900,7 @@ void fctClose() { * @remarks Originally called 'tfrapper' */ void fctKnock() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_HIT)); if (g_s.mlieu == 15) { @@ -908,11 +910,11 @@ void fctKnock() { if (g_s.mlieu < 25) { tfleche(); - if (!(anyone) && !(iesc)) { + if (!(g_anyone) && !(g_iesc)) { if ((g_s.mlieu < 19) && (g_s.mlieu != 15)) - crep = 133; + g_crep = 133; else - crep = 997; + g_crep = 997; } return; @@ -922,12 +924,12 @@ void fctKnock() { int haz = (hazard(0, 8)) - 4; parole(11, haz, 1); int p; - ecfren(p, haz, g_s.conf, ment); - int l = ment; + ecfren(p, haz, g_s.conf, g_ment); + int l = g_ment; if (l != 0) { if (p != -500) { if (haz > p) - crep = 190; + g_crep = 190; else { becfren(l); frap(); @@ -936,8 +938,8 @@ void fctKnock() { frap(); } - if (ment == 8) - crep = 190; + if (g_ment == 8) + g_crep = 190; } } @@ -946,90 +948,90 @@ void fctKnock() { * @remarks Originally called 'tposer' */ void fctSelfPut() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_POSE)); if (g_s.derobj == 0) - crep = 186; + g_crep = 186; else { - if (caff > 99) { - crep = 999; + if (g_caff > 99) { + g_crep = 999; ajchai(); - if (crep != 192) + if (g_crep != 192) maivid(); return; } tfleche(); - if ((anyone) || (iesc)) + if ((g_anyone) || (g_iesc)) return; tcoord(7); - crep = 124; + g_crep = 124; if (g_num != 0) { int chai; rechai(chai); if (chai == 0) - crep = 997; + g_crep = 997; else { int cx = 0; do { ++cx; } while ((cx <= 6) && (g_num != ord(touv[cx]))); if (g_num != ord(touv[cx])) - crep = 187; + g_crep = 187; else { - mchai = chai; - crep = 999; + g_mchai = chai; + g_crep = 999; } } } else { tcoord(8); if (g_num != 0) { - crep = 998; - if (caff == 2) { + g_crep = 998; + if (g_caff == 2) { if (g_s.iloic != 0) - crep = 188; + g_crep = 188; else g_s.iloic = g_s.derobj; } - if (caff == 13) { + if (g_caff == 13) { if (g_num == 1) { if (g_s.iboul != 0) - crep = 188; + g_crep = 188; else g_s.iboul = g_s.derobj; } else if (g_s.ibag != 0) { - crep = 188; + g_crep = 188; } else { g_s.ibag = g_s.derobj; } } - if (caff == 16) { + if (g_caff == 16) { if (g_s.icryp != 0) - crep = 188; + g_crep = 188; else g_s.icryp = g_s.derobj; } - if (caff == 24) - crep = 185; - if ((caff == 14) || (caff == 17)) - crep = 124; + if (g_caff == 24) + g_crep = 185; + if ((g_caff == 14) || (g_caff == 17)) + g_crep = 124; } else { - crep = 124; - if (caff == 24) { + g_crep = 124; + if (g_caff == 24) { tcoord(5); if (g_num != 0) - crep = 185; + g_crep = 185; } } } - if (caff == 23) - crep = 185; - if ((crep == 999) || (crep == 185) || (crep == 998)) { - if (crep == 999) + if (g_caff == 23) + g_crep = 185; + if ((g_crep == 999) || (g_crep == 185) || (g_crep == 998)) { + if (g_crep == 999) ajchai(); - if (crep != 192) + if (g_crep != 192) maivid(); } } @@ -1041,17 +1043,17 @@ void fctSelfPut() { */ void fctListen() { if (g_s.mlieu != 26) - crep = 101; + g_crep = 101; else { - if (ipers != 0) + if (g_ipers != 0) ++g_s.conf; int p, haz; - ecfren(p, haz, g_s.conf, ment); - int l = ment; + ecfren(p, haz, g_s.conf, g_ment); + int l = g_ment; if (l != 0) { if (p != -500) { if (haz > p) - crep = 101; + g_crep = 101; else { becfren(l); int j, h, m; @@ -1059,16 +1061,16 @@ void fctListen() { haz = hazard(1, 100); if ((h >= 0) && (h < 8)) { if (haz > 30) - crep = 101; + g_crep = 101; else - crep = 178; + g_crep = 178; } else if (haz > 70) - crep = 101; + g_crep = 101; else - crep = 178; + g_crep = 178; } } else - crep = 178; + g_crep = 178; } } } @@ -1079,11 +1081,11 @@ void fctListen() { */ void fctEat() { if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { - crep = 148; + g_crep = 148; } else { tsort(); g_s.mlieu = 10; - caff = 10; + g_caff = 10; debloc(g_s.mlieu); tmlieu(g_s.mlieu); @@ -1105,11 +1107,11 @@ void fctEat() { h = 1; } - jh += h; - crep = 135; + g_jh += h; + g_crep = 135; tinke(); } else { - crep = 134; + g_crep = 134; } } } @@ -1126,18 +1128,18 @@ void fctEnter() { tmlieu(g_s.mlieu); } else if (g_s.mlieu == 15) aldepl(); - else if (ment == 0) - crep = 997; - else if ((ment == 9) && (g_s.derobj != 136)) { - crep = 189; + else if (g_ment == 0) + g_crep = 997; + else if ((g_ment == 9) && (g_s.derobj != 136)) { + g_crep = 189; g_s.teauto[8] = '*'; } else { int z = 0; - if (! blo) - t11(ment, z); + if (!g_blo) + t11(g_ment, z); if (z != 0) { - if ((ment == 3) || (ment == 7)) - crep = 179; + if ((g_ment == 3) || (g_ment == 7)) + g_crep = 179; else { g_x = (hazard(0, 10)) - 5; parole(7, g_x, 1); @@ -1148,29 +1150,29 @@ void fctEnter() { g_s.mlieu = 15; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; - syn = true; - if (ment == 9) { + g_syn = true; + if (g_ment == 9) { g_col = true; - caff = 70; + g_caff = 70; afdes(0); - repon(2, caff); + repon(2, g_caff); } else g_col = false; - debloc(ment); - ment = 0; + debloc(g_ment); + g_ment = 0; } } else { g_x = (hazard(0, 10)) - 5; parole(7, g_x, 1); aniof(1, 1); - g_s.mlieu = ment; + g_s.mlieu = g_ment; affrep(); debloc(g_s.mlieu); tmlieu(g_s.mlieu); - ment = 0; - mpers = 0; - ipers = 0; + g_ment = 0; + g_mpers = 0; + g_ipers = 0; } } } @@ -1183,7 +1185,7 @@ void fctSleep() { int z, j, h, m; if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { - crep = 148; + g_crep = 148; return; } if (g_s.mlieu != 0) { @@ -1207,18 +1209,18 @@ void fctSleep() { z = (7 - h) * 2; if (m == 30) --z; - jh += z; + g_jh += z; h = 7; } - jh += 2; + g_jh += 2; ++h; if (h > 23) h = 0; tinke(); answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); - anyone = false; + g_anyone = false; } while (answer != 1); - crep = 998; + g_crep = 998; g_num = 0; } @@ -1227,16 +1229,16 @@ void fctSleep() { * @remarks Originally called 'tdefoncer' */ void fctForce() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_SMASH)); - if (caff < 25) + if (g_caff < 25) tfleche(); - if ((! anyone) && (! iesc)) { + if ((!g_anyone) && (!g_iesc)) { if (g_s.mlieu != 26) - crep = 997; + g_crep = 997; else { - crep = 143; + g_crep = 143; g_s.conf += 2; } } @@ -1248,9 +1250,9 @@ void fctForce() { */ void fctLeave() { tsort(); - crep = 0; + g_crep = 0; if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22) || (g_s.mlieu == 24)) - crep = 997; + g_crep = 997; else { int lx = 0; @@ -1262,17 +1264,17 @@ void fctLeave() { lx = 15; if (g_s.mlieu == 16) { lx = 17; - crep = 176; + g_crep = 176; } if (g_s.mlieu == 17) t23coul(lx); if (g_s.mlieu == 23) lx = 24; - if (crep != 997) + if (g_crep != 997) g_s.mlieu = lx; - caff = lx; - if (crep == 0) - crep = lx; + g_caff = lx; + if (g_crep == 0) + g_crep = lx; debloc(lx); tmlieu(lx); } @@ -1285,31 +1287,31 @@ void fctLeave() { void fctWait() { int quel; - mpers = 0; + g_mpers = 0; clsf3(); int answer; do { - ++jh; + ++g_jh; tinke(); - if (!blo) + if (!g_blo) t11(g_s.mlieu, quel); - if ((ipers != 0) && (mpers == 0)) { - crep = 998; + if ((g_ipers != 0) && (g_mpers == 0)) { + g_crep = 998; if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) cavegre(); if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) - anyone = true; - mpers = ipers; - if (!anyone) + g_anyone = true; + g_mpers = g_ipers; + if (!g_anyone) tinke(); return; } repon(2, 102); answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); } while (answer != 2); - crep = 998; - if (!anyone) + g_crep = 998; + if (!g_anyone) tinke(); } @@ -1318,12 +1320,12 @@ void fctWait() { * @remarks Originally called 'tsonder' */ void fctSound() { - if (!syn) + if (!g_syn) ecr3(g_vm->getEngineString(S_PROBE2)); - if (caff < 27) { + if (g_caff < 27) { tfleche(); - if (!(anyone) && (!iesc)) - crep = 145; + if (!(g_anyone) && (!g_iesc)) + g_crep = 145; g_num = 0; } } @@ -1347,10 +1349,10 @@ void fctDiscuss() { do { ++cx; } while (g_vm->_menu._discussMenu[cx] != g_msg[4]); - caff = 69 + cx; + g_caff = 69 + cx; afdes(0); - repon(2, caff); - suj = caff + 60; + repon(2, g_caff); + suj = g_caff + 60; } tkey1(false); mennor(); @@ -1398,7 +1400,7 @@ void fctDiscuss() { CHECK_QUIT; getMousePos(x, y, c); - x *= (3 - res); + x *= (3 - g_res); if (x > 319) cx = 41; else @@ -1461,7 +1463,7 @@ void fctDiscuss() { if (g_col) { g_col = false; g_s.mlieu = 15; - if (iouv > 0) + if (g_iouv > 0) max = 8; else max = 4; @@ -1472,10 +1474,10 @@ void fctDiscuss() { suj = 138; g_s.conf += (3 * (g_s.conf / 10)); } - } else if (nbrep[caff - 69] < nbrepm[caff - 69]) { - suj = tabdon[arep + (ix << 3) + (caff - 70)]; + } else if (nbrep[g_caff - 69] < nbrepm[g_caff - 69]) { + suj = tabdon[arep + (ix << 3) + (g_caff - 70)]; g_s.conf += tabdon[arcf + ix]; - ++nbrep[caff - 69]; + ++nbrep[g_caff - 69]; } else { g_s.conf += 3; suj = 139; @@ -1513,12 +1515,12 @@ void fctDiscuss() { g_col = false; g_s.mlieu = 15; } - ctrm = 0; + g_ctrm = 0; hideMouse(); hirs(); dessine_rouleau(); showMouse(); - affper(ipers); + affper(g_ipers); tinke(); drawClock(); affrep(); @@ -1532,16 +1534,16 @@ void fctDiscuss() { * @remarks Originally called 'tsentir' */ void fctSmell() { - crep = 119; - if (caff < 26) { - if (!syn) + g_crep = 119; + if (g_caff < 26) { + if (!g_syn) ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); - if (!(anyone) && !(iesc)) - if (caff == 16) - crep = 153; - } else if (caff == 123) - crep = 110; + if (!(g_anyone) && !(g_iesc)) + if (g_caff == 16) + g_crep = 153; + } else if (g_caff == 123) + g_crep = 110; g_num = 0; } @@ -1550,9 +1552,9 @@ void fctSmell() { * @remarks Originally called 'tgratter' */ void fctScratch() { - crep = 155; - if (caff < 27) { - if (!syn) + g_crep = 155; + if (g_caff < 27) { + if (!g_syn) ecr3(g_vm->getEngineString(S_SCRATCH)); tfleche(); } @@ -1573,7 +1575,7 @@ void MortevielleEngine::endGame() { repon(9, 1509); tkey1(false); hideMouse(); - caff = 70; + g_caff = 70; taffich(); hirs(); premtet(); @@ -1583,7 +1585,7 @@ void MortevielleEngine::endGame() { repon(9, 1509); repon(2, 142); tkey1(false); - caff = 32; + g_caff = 32; afdes(0); repon(6, 34); repon(2, 35); @@ -1607,9 +1609,9 @@ void MortevielleEngine::loseGame() { maivid(); inzon(); dprog(); - vh = 10; - vm = 0; - vj = 0; + g_vh = 10; + g_vm__ = 0; + g_vj = 0; g_minute = 0; g_hour = 10; g_day = 0; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index fec8b2f81f..96264c8b5d 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -78,7 +78,7 @@ int Alert::show(const Common::String &msg, int n) { while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { ++i; st = st + chaine[i]; - if (res == 2) + if (g_res == 2) cx -= 3; else cx -= 5; @@ -95,12 +95,12 @@ int Alert::show(const Common::String &msg, int n) { esp = (uint)(nbcol - caseNumb * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); setButtonText(cas, coldep, caseNumb, &s[0], esp); - limit[1][1] = ((uint)(coldep) >> 1) * res; + limit[1][1] = ((uint)(coldep) >> 1) * g_res; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * res; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * g_res; limit[2][2] = (limit[2][1]) + 40; } showMouse(); @@ -221,7 +221,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li } ++i; choiceListStr = copy(inputStr, i, 30); - if (res == 2) + if (g_res == 2) col *= 6; else col *= 10; @@ -308,7 +308,7 @@ bool Ques::show() { showMouse(); ++indx; int dialogHeight; - if (res == 1) + if (g_res == 1) dialogHeight = 29; else dialogHeight = 23; @@ -338,8 +338,8 @@ bool Ques::show() { for (int j = 1; j <= lastOption - firstOption + 1; ++j) { rectangle &with = coor[j]; - with.x1 = 45 * res; - with.x2 = (maxLength * 3 + 55) * res; + with.x1 = 45 * g_res; + with.x2 = (maxLength * 3 + 55) * g_res; with.y1 = 27 + j * 8; with.y2 = 34 + j * 8; with.enabled = true; @@ -349,7 +349,7 @@ bool Ques::show() { } } coor[lastOption - firstOption + 2].enabled = false; - if (res == 1) + if (g_res == 1) rep = 10; else rep = 6; @@ -360,7 +360,7 @@ bool Ques::show() { warning("Expected answer: %d", correctAnswerArr[indx]); do { g_vm->setMouseClick(false); - tesok = false; + g_tesok = false; bool flag; moveMouse(flag, key); CHECK_QUIT0; @@ -400,7 +400,7 @@ bool Ques::show() { warning("Skipping protection check: testprot()"); protectionCheck = true; // tesok is set to true in testprot() - tesok = true; + g_tesok = true; } } while (indx != 10); @@ -462,10 +462,10 @@ void f3f8::waitForF3F8(int &key) { } void f3f8::aff50(bool drawAni50Fl) { - caff = 50; + g_caff = 50; g_maff = 0; taffich(); - dessine(ades, 63, 12); + dessine(g_ades, 63, 12); if (drawAni50Fl) ani50(); else @@ -476,11 +476,11 @@ void f3f8::aff50(bool drawAni50Fl) { } void f3f8::ani50() { - crep = animof(1, 1); - pictout(adani, crep, 63, 12); - crep = animof(2, 1); - pictout(adani, crep, 63, 12); - f2_all = (res == 1); + g_crep = animof(1, 1); + pictout(adani, g_crep, 63, 12); + g_crep = animof(2, 1); + pictout(adani, g_crep, 63, 12); + g_f2_all = (g_res == 1); repon(2, c_paroles + 143); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index bec7ef4073..3108594f40 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -985,7 +985,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (res == 1) { + if (g_res == 1) { x = (uint)x >> 1; dx = (uint)dx >> 1; } @@ -1052,7 +1052,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { hideMouse(); pt = _textPos; - if (res == 2) + if (g_res == 2) i = 6; else i = 10; @@ -1093,7 +1093,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (res == 2) ? 6 : 10; + int charWidth = (g_res == 2) ? 6 : 10; return s.size() * charWidth; } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index d6ebe986df..602d53deb2 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -45,9 +45,9 @@ int testou() { g_soundOff = !g_soundOff; break; case '\26' : - if ((c_zzz == 1) || (c_zzz == 2)) { + if ((g_c_zzz == 1) || (g_c_zzz == 2)) { zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - ++c_zzz; + ++g_c_zzz; return 61; } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 5030da9acb..68fff8aa00 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -101,7 +101,7 @@ void pictout(int seg, int dep, int x, int y) { mem[0x7000 * 16 + 32] = 15; } - if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) + if ((g_caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); g_vm->_screenSurface.drawPicture(surface, x, y); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 998b70fa35..ac199594b7 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,7 +48,7 @@ void Menu::menut(int no, Common::String name) { byte l = lo(no); Common::String s = name; - if (! tesok) + if (!g_tesok) g_vm->quitGame(); @@ -153,7 +153,7 @@ void Menu::displayMenu() { hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * res; + col = 28 * g_res; if (g_currGraphicalDevice == MODE_CGA) color = 1; else @@ -182,7 +182,7 @@ void Menu::displayMenu() { } while (k != 3); ++y; } while (y != 9); - col += 48 * res; + col += 48 * g_res; } while (num_letr != 6); showMouse(); } @@ -193,23 +193,23 @@ void Menu::displayMenu() { void Menu::drawMenu() { displayMenu(); _menuActive = true; - msg4 = OPCODE_NONE; - msg3 = OPCODE_NONE; - choisi = false; + g_msg4 = OPCODE_NONE; + g_msg3 = OPCODE_NONE; + g_choisi = false; g_vm->setMouseClick(false); - test0 = false; + g_test0 = false; } void Menu::invers(int ix) { Common::String s; - if (msg4 == OPCODE_NONE) + if (g_msg4 == OPCODE_NONE) return; - int menuIndex = lo(msg4); + int menuIndex = lo(g_msg4); - g_vm->_screenSurface.putxy(_menuConstants[msg3 - 1][0] << 3, (menuIndex + 1) << 3); - switch (msg3) { + g_vm->_screenSurface.putxy(_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + switch (g_msg3) { case 1: s = _inventoryStringArray[menuIndex]; break; @@ -248,31 +248,31 @@ void Menu::invers(int ix) { if ((s[0] != '*') && (s[0] != '<')) g_vm->_screenSurface.writeg(s, ix); else - msg4 = OPCODE_NONE; + g_msg4 = OPCODE_NONE; } void Menu::util(int x, int y) { - int ymx = (_menuConstants[msg3 - 1][3] << 3) + 16; - int dxcar = _menuConstants[msg3 - 1][2]; - int xmn = (_menuConstants[msg3 - 1][0] << 2) * res; + int ymx = (_menuConstants[g_msg3 - 1][3] << 3) + 16; + int dxcar = _menuConstants[g_msg3 - 1][2]; + int xmn = (_menuConstants[g_msg3 - 1][0] << 2) * g_res; int ix; - if (res == 1) + if (g_res == 1) ix = 5; else ix = 3; - int xmx = dxcar * ix * res + xmn + 2; + int xmx = dxcar * ix * g_res + xmn + 2; if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { - ix = (((uint)y >> 3) - 1) + (msg3 << 8); - if (ix != msg4) { + ix = (((uint)y >> 3) - 1) + (g_msg3 << 8); + if (ix != g_msg4) { invers(1); - msg4 = ix; + g_msg4 = ix; invers(0); } - } else if (msg4 != OPCODE_NONE) { + } else if (g_msg4 != OPCODE_NONE) { invers(1); - msg4 = OPCODE_NONE; + g_msg4 = OPCODE_NONE; } } @@ -294,7 +294,7 @@ void Menu::menuDown(int ii) { hideMouse(); sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; - if (res == 1) + if (g_res == 1) cx = 10; else cx = 6; @@ -352,7 +352,7 @@ void Menu::menuDown(int ii) { } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (cx != nb_lig); - test0 = true; + g_test0 = true; showMouse(); } @@ -361,7 +361,7 @@ void Menu::menuDown(int ii) { */ void Menu::menuUp(int xx) { /* debug('menuUp'); */ - if (test0) { + if (g_test0) { charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ @@ -375,7 +375,7 @@ void Menu::menuUp(int xx) { // Copy the data Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest); - test0 = false; + g_test0 = false; } } @@ -386,7 +386,7 @@ void Menu::eraseMenu() { /* debug('eraseMenu'); */ _menuActive = false; g_vm->setMouseClick(false); - menuUp(msg3); + menuUp(g_msg3); } /** @@ -399,67 +399,67 @@ void Menu::mdn() { int x = x_s; int y = y_s; if (!g_vm->getMouseClick()) { - if ((x == xprec) && (y == yprec)) + if ((x == g_xprec) && (y == g_yprec)) return; else { - xprec = x; - yprec = y; + g_xprec = x; + g_yprec = y; } bool tes = (y < 11) - && ((x >= (28 * res) && x <= (28 * res + 24)) - || (x >= (76 * res) && x <= (76 * res + 24)) - || ((x > 124 * res) && (x < 124 * res + 24)) - || ((x > 172 * res) && (x < 172 * res + 24)) - || ((x > 220 * res) && (x < 220 * res + 24)) - || ((x > 268 * res) && (x < 268 * res + 24))); + && ((x >= (28 * g_res) && x <= (28 * g_res + 24)) + || (x >= (76 * g_res) && x <= (76 * g_res + 24)) + || ((x > 124 * g_res) && (x < 124 * g_res + 24)) + || ((x > 172 * g_res) && (x < 172 * g_res + 24)) + || ((x > 220 * g_res) && (x < 220 * g_res + 24)) + || ((x > 268 * g_res) && (x < 268 * g_res + 24))); if (tes) { int ix; - if (x < 76 * res) + if (x < 76 * g_res) ix = MENU_INVENTORY; - else if (x < 124 * res) + else if (x < 124 * g_res) ix = MENU_MOVE; - else if (x < 172 * res) + else if (x < 172 * g_res) ix = MENU_ACTION; - else if (x < 220 * res) + else if (x < 220 * g_res) ix = MENU_SELF; - else if (x < 268 * res) + else if (x < 268 * g_res) ix = MENU_DISCUSS; else ix = MENU_FILE; - if ((ix != msg3) || (! test0)) - if (!((ix == MENU_FILE) && ((msg3 == MENU_SAVE) || (msg3 == MENU_LOAD)))) { - menuUp(msg3); + if ((ix != g_msg3) || (!g_test0)) + if (!((ix == MENU_FILE) && ((g_msg3 == MENU_SAVE) || (g_msg3 == MENU_LOAD)))) { + menuUp(g_msg3); menuDown(ix); - msg3 = ix; - msg4 = OPCODE_NONE; + g_msg3 = ix; + g_msg4 = OPCODE_NONE; } } else { // Not in the MenuTitle line - if ((y > 11) && (test0)) + if ((y > 11) && (g_test0)) util(x, y); } } else { // There was a click - if ((msg3 == MENU_FILE) && (msg4 != OPCODE_NONE)) { + if ((g_msg3 == MENU_FILE) && (g_msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); - menuUp(msg3); - if (lo(msg4) == 1) - msg3 = 7; + menuUp(g_msg3); + if (lo(g_msg4) == 1) + g_msg3 = 7; else - msg3 = 8; - menuDown(msg3); + g_msg3 = 8; + menuDown(g_msg3); g_vm->setMouseClick(false); } else { // A menu was clicked on - choisi = (test0) && (msg4 != OPCODE_NONE); - menuUp(msg3); - g_msg[4] = msg4; - g_msg[3] = msg3; - msg3 = OPCODE_NONE; - msg4 = OPCODE_NONE; + g_choisi = (g_test0) && (g_msg4 != OPCODE_NONE); + menuUp(g_msg3); + g_msg[4] = g_msg4; + g_msg[3] = g_msg3; + g_msg3 = OPCODE_NONE; + g_msg4 = OPCODE_NONE; g_vm->setMouseClick(false); } @@ -511,8 +511,8 @@ void Menu::initMenu() { if (i > 6) g_vm->_menu.disableMenuItem(_inventoryMenu[i]); } - msg3 = OPCODE_NONE; - msg4 = OPCODE_NONE; + g_msg3 = OPCODE_NONE; + g_msg4 = OPCODE_NONE; g_msg[3] = OPCODE_NONE; g_msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index d3eb248574..20882eb41a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -107,7 +107,7 @@ void modif(int &nu) { void dessine(int ad, int x, int y) { hideMouse(); - writepal(numpal); + writepal(g_numpal); pictout(ad, 0, x, y); showMouse(); } @@ -124,7 +124,7 @@ void dessine_rouleau() { void text_color(int c) { - color_txt = c; + g_color_txt = c; } /* NIVEAU 13 */ @@ -133,14 +133,14 @@ void text_color(int c) { void text1(int x, int y, int nb, int m) { int co; - if (res == 1) + if (g_res == 1) co = 10; else co = 6; Common::String tmpStr = deline(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; - afftex(tmpStr, x, y, nb, 20, color_txt); + afftex(tmpStr, x, y, nb, 20, g_color_txt); } void initouv() { @@ -162,10 +162,10 @@ void clsf1() { void clsf2() { hideMouse(); - if (f2_all) { + if (g_f2_all) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); - f2_all = false; + g_f2_all = false; } else { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); @@ -180,7 +180,7 @@ void ecrf2() { void ecr2(Common::String str_) { // Some dead code was present in the original: removed g_vm->_screenSurface.putxy(8, 177); - int tlig = 59 + (res - 1) * 36; + int tlig = 59 + (g_res - 1) * 36; if ((int)str_.size() < tlig) g_vm->_screenSurface.writeg(str_, 5); @@ -190,7 +190,7 @@ void ecr2(Common::String str_) { g_vm->_screenSurface.putxy(8, 182); g_vm->_screenSurface.writeg(copy(str_, tlig, tlig << 1), 5); } else { - f2_all = true; + g_f2_all = true; clsf2(); g_vm->_screenSurface.putxy(8, 176); g_vm->_screenSurface.writeg(copy(str_, 1, (tlig - 1)), 5); @@ -228,7 +228,7 @@ void clsf10() { Common::String st; hideMouse(); - if (res == 1) { + if (g_res == 1) { co = 634; cod = 534; } else { @@ -247,7 +247,7 @@ void clsf10() { g_vm->_screenSurface.putxy(co, 92); g_vm->_screenSurface.writeg(st, 4); - if (res == 1) + if (g_res == 1) co = 620; else co = 584; @@ -280,15 +280,15 @@ int hazard(int min, int max) { void calch(int &j, int &h, int &m) { int nh = readclock(); - int th = jh + ((nh - mh) / g_t); - m = ((th % 2) + vm) * 30; - h = ((uint)th >> 1) + vh; + int th = g_jh + ((nh - g_mh) / g_t); + m = ((th % 2) + g_vm__) * 30; + h = ((uint)th >> 1) + g_vh; if (m == 60) { m = 0; h = h + 1; } - j = (h / 24) + vj; - h = h - ((j - vj) * 24); + j = (h / 24) + g_vj; + h = h - ((j - g_vj) * 24); } void conv(int x, int &y) { @@ -302,7 +302,7 @@ void conv(int x, int &y) { /* NIVEAU 12 */ void okpas() { - tesok = true; + g_tesok = true; } void modobj(int m) { @@ -321,7 +321,7 @@ void modobj2(int m, bool t1, bool t2) { if (t1 || t2) okpas(); else - tesok = false;; + g_tesok = false;; if (m != 500) strp = deline(m - 501 + c_st41); @@ -339,10 +339,10 @@ void repon(int f, int m) { if ((m > 499) && (m < 563)) { tmpStr = deline(m - 501 + c_st41); - if ((int) tmpStr.size() > ((58 + (res - 1) * 37) << 1)) - f2_all = true; + if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) + g_f2_all = true; else - f2_all = false; + g_f2_all = false; clsf2(); afftex(tmpStr, 8, 176, 85, 3, 5); @@ -358,7 +358,7 @@ void repon(int f, int m) { text1(8, 182, 103, m); if ((m == 68) || (m == 69)) g_s.teauto[40] = '*'; - if ((m == 104) && (caff == 14)) { + if ((m == 104) && (g_caff == 14)) { g_s.teauto[36] = '*'; if (g_s.teauto[39] == '*') { g_s.pourc[3] = '*'; @@ -387,7 +387,7 @@ void repon(int f, int m) { tmpStr = deline(m); int xco, dx, caspe; - if (res == 1) { + if (g_res == 1) { xco = 252 - tmpStr.size() * 5; caspe = 100; dx = 80; @@ -407,33 +407,33 @@ void repon(int f, int m) { void t5(int cx) { if (cx == 10) - blo = false; + g_blo = false; if (cx != 1) { - bh1 = false; - bf1 = false; + g_bh1 = false; + g_bf1 = false; } if (cx != 2) - bh2 = false; + g_bh2 = false; if (cx != 4) { - bh4 = false; - bf4 = false; + g_bh4 = false; + g_bf4 = false; } if (cx != 5) - bh5 = false; + g_bh5 = false; if (cx != 6) - bh6 = false; + g_bh6 = false; if (cx != 8) - bh8 = false; + g_bh8 = false; if (cx != 3) - bt3 = false; + g_bt3 = false; if (cx != 7) - bt7 = false; + g_bt7 = false; if (cx != 9) - bh9 = false; + g_bh9 = false; } void affper(int per) { @@ -482,7 +482,7 @@ void affper(int per) { g_vm->_screenSurface.writeg("MAX", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[8]); } - ipers = per; + g_ipers = per; } void choix(int min, int max, int &per) { @@ -609,7 +609,7 @@ void person() { g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAlone) / 2), 70); g_vm->_screenSurface.writeg(sAlone, 4); - ipers = 0; + g_ipers = 0; } void chlm(int &per) { @@ -641,9 +641,9 @@ void drawClock() { co = 1; if (g_minute == 0) - g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y - rg), co); + g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); else - g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)x >> 1)*res, (y + rg), co); + g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); h = g_hour; if (h > 12) @@ -651,7 +651,7 @@ void drawClock() { if (h == 0) h = 12; - g_vm->_screenSurface.drawLine(((uint)x >> 1)*res, y, ((uint)(x + cv[0][h - 1]) >> 1)*res, y + cv[1][h - 1], co); + g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); showMouse(); g_vm->_screenSurface.putxy(568, 154); @@ -678,7 +678,7 @@ void debloc(int l) { g_y = 0; if ((l != 26) && (l != 15)) t5(l); - mpers = ipers; + g_mpers = g_ipers; } void cpl10(int &p, int &h) { @@ -773,40 +773,40 @@ void quelq1(int l) { per = hazard(1, 2); if (l == 1) { if (per == 1) - bh1 = true; + g_bh1 = true; else - bf1 = true; + g_bf1 = true; } else if (l == 4) { if (per == 1) - bh4 = true; + g_bh4 = true; else - bf4 = true; + g_bf4 = true; } - ipers = 10; + g_ipers = 10; } void quelq2() { - if (li == 2) - bh2 = true; + if (g_li == 2) + g_bh2 = true; else - bh9 = true; + g_bh9 = true; - ipers = 10; + g_ipers = 10; } void quelq5() { - bh5 = true; - ipers = 10; + g_bh5 = true; + g_ipers = 10; } void quelq6(int l) { if (l == 6) - bh6 = true; + g_bh6 = true; else if (l == 8) - bh8 = true; + g_bh8 = true; - ipers = 10; + g_ipers = 10; } void quelq10(int h, int &per) { @@ -865,14 +865,14 @@ void quelq15(int &per) { do { cx = hazard(1, 8); - test = (((cx == 1) && (bh2 || bh9)) || - ((cx == 2) && bh8) || - ((cx == 3) && bh4) || - ((cx == 4) && bf4) || - ((cx == 5) && bh6) || - ((cx == 6) && bh1) || - ((cx == 7) && bf1) || - ((cx == 8) && bh5)); + test = (((cx == 1) && (g_bh2 || g_bh9)) || + ((cx == 2) && g_bh8) || + ((cx == 3) && g_bh4) || + ((cx == 4) && g_bf4) || + ((cx == 5) && g_bh6) || + ((cx == 6) && g_bh1) || + ((cx == 7) && g_bf1) || + ((cx == 8) && g_bh5)); } while (test); conv(cx, per); @@ -905,37 +905,37 @@ void frap() { calch(j, h, m); if ((h >= 0) && (h < 8)) - crep = 190; + g_crep = 190; else { int haz = hazard(1, 100); if (haz > 70) - crep = 190; + g_crep = 190; else - crep = 147; + g_crep = 147; } } void nouvp(int l, int &p) { p = 0; if (l == 1) { - if (bh1) + if (g_bh1) p = 4; - if (bf1) + if (g_bf1) p = 2; - } else if (((l == 2) && (bh2)) || ((l == 9) && (bh9))) + } else if (((l == 2) && (g_bh2)) || ((l == 9) && (g_bh9))) p = 128; else if (l == 4) { - if (bh4) + if (g_bh4) p = 32; - if (bf4) + if (g_bf4) p = 16; - } else if ((l == 5) && (bh5)) + } else if ((l == 5) && (g_bh5)) p = 1; - else if ((l == 6) && (bh6)) + else if ((l == 6) && (g_bh6)) p = 8; - else if ((l == 8) && (bh8)) + else if ((l == 8) && (g_bh8)) p = 64; - else if (((l == 3) && (bt3)) || ((l == 7) && (bt7))) + else if (((l == 3) && (g_bt3)) || ((l == 7) && (g_bt7))) p = 9; if (p != 9) @@ -969,19 +969,19 @@ void ecfren(int &p, int &haz, int cf, int l) { person(); p = -500; haz = 0; - if (((l == 1) && (! bh1) && (! bf1)) || ((l == 4) && (! bh4) && (! bf4))) + if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4))) cpl1(p); - if ((l == 2) && (! bh2) && (! bh9)) + if ((l == 2) && (!g_bh2) && (!g_bh9)) cpl2(p); - if (((l == 3) && (! bt3)) || ((l == 7) && (! bt7))) + if (((l == 3) && (!g_bt3)) || ((l == 7) && (!g_bt7))) cpl3(p); - if ((l == 5) && (! bh5)) + if ((l == 5) && (!g_bh5)) cpl5(p); - if (((l == 6) && (! bh6)) || ((l == 8) && (! bh8))) + if (((l == 6) && (!g_bh6)) || ((l == 8) && (!g_bh8))) cpl6(p); - if ((l == 9) && (! bh9) && (! bh2)) + if ((l == 9) && (!g_bh9) && (!g_bh2)) p = 10; - if (((l == 2) && (bh9)) || ((l == 9) && (bh2))) + if (((l == 2) && (g_bh9)) || ((l == 9) && (g_bh2))) p = -400; if (p != -500) { p = p + cf; @@ -994,29 +994,29 @@ void becfren(int l) { int haz = hazard(1, 2); if (l == 1) { if (haz == 1) - bh1 = true; + g_bh1 = true; else - bf1 = true; + g_bf1 = true; } else { // l == 4 if (haz == 1) - bh4 = true; + g_bh4 = true; else - bf4 = true; + g_bf4 = true; } } else if (l == 2) - bh2 = true; + g_bh2 = true; else if (l == 3) - bt3 = true; + g_bt3 = true; else if (l == 5) - bh5 = true; + g_bh5 = true; else if (l == 6) - bh6 = true; + g_bh6 = true; else if (l == 7) - bt7 = true; + g_bt7 = true; else if (l == 8) - bh8 = true; + g_bh8 = true; else if (l == 9) - bh9 = true; + g_bh9 = true; } /* NIVEAU 10 */ @@ -1077,16 +1077,16 @@ void inzon() { } void dprog() { - li = 21; - jh = 0; + g_li = 21; + g_jh = 0; if (!g_s.ipre) - blo = true; + g_blo = true; g_t = ti1; - mh = readclock(); + g_mh = readclock(); } void pl1(int cf) { - if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) { + if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) { int p, haz; cpl1(p); phaz(haz, p, cf); @@ -1094,12 +1094,12 @@ void pl1(int cf) { if (haz > p) person(); else - quelq1(li); + quelq1(g_li); } } void pl2(int cf) { - if (! bh2) { + if (!g_bh2) { int p, haz; cpl2(p); phaz(haz, p, cf); @@ -1112,7 +1112,7 @@ void pl2(int cf) { } void pl5(int cf) { - if (! bh5) { + if (!g_bh5) { int p, haz; cpl5(p); phaz(haz, p, cf); @@ -1125,7 +1125,7 @@ void pl5(int cf) { } void pl6(int cf) { - if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) { + if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) { int p, haz; cpl6(p); phaz(haz, p, cf); @@ -1133,12 +1133,12 @@ void pl6(int cf) { if (haz > p) person(); else - quelq6(li); + quelq6(g_li); } } void pl9(int cf) { - if (! bh9) { + if (!g_bh9) { cf = -10; int p, haz; phaz(haz, p, cf); @@ -1220,18 +1220,18 @@ void t11(int l11, int &a) { int p, haz; ecfren(p, haz, g_s.conf, l11); - li = l11; + g_li = l11; if ((l11 > 0) && (l11 < 10)) { if (p != -500) { if (haz > p) { person(); a = 0; } else { - becfren(li); - nouvp(li, a); + becfren(g_li); + nouvp(g_li, a); } } else - nouvp(li, a); + nouvp(g_li, a); } if (l11 > 9) { @@ -1291,7 +1291,7 @@ void cavegre() { } void writetp(Common::String s, int t) { - if (res == 2) + if (g_res == 2) g_vm->_screenSurface.writeg(s, t); else g_vm->_screenSurface.writeg(copy(s, 1, 25), t); @@ -1308,13 +1308,13 @@ void messint(int nu) { } void aniof(int ouf, int num) { - if ((caff == 7) && ((num == 4) || (num == 5))) + if ((g_caff == 7) && ((num == 4) || (num == 5))) return; - if ((caff == 10) && (num == 7)) + if ((g_caff == 10) && (num == 7)) num = 6; - if (caff == 12) { + if (g_caff == 12) { if (num == 3) num = 4; else if (num == 4) @@ -1335,9 +1335,9 @@ void musique(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((prebru == 0) && (!g_s.ipre)) { + } else if ((g_prebru == 0) && (!g_s.ipre)) { parole(10, 1, 1); - ++prebru; + ++g_prebru; } else { bool i = false; if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22)) { @@ -1378,42 +1378,42 @@ void musique(int so) { /* NIVEAU 9 */ void dessin(int ad) { if (ad != 0) - dessine(ades, ((ad % 160) * 2), (ad / 160)); + dessine(g_ades, ((ad % 160) * 2), (ad / 160)); else { clsf1(); - if (caff > 99) { - dessine(ades, 60, 33); + if (g_caff > 99) { + dessine(g_ades, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box - } else if (caff > 69) { - dessine(ades, 112, 48); // Heads + } else if (g_caff > 69) { + dessine(g_ades, 112, 48); // Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { - dessine(ades, 0, 12); + dessine(g_ades, 0, 12); ecrf1(); - if ((caff < 30) || (caff > 32)) { + if ((g_caff < 30) || (g_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { if (ord(touv[cx]) != 0) aniof(1, ord(touv[cx])); } - if (caff == 13) { + if (g_caff == 13) { if (g_s.iboul == 141) aniof(1, 7); if (g_s.ibag == 159) aniof(1, 6); } - if ((caff == 14) && (g_s.icave == 151)) + if ((g_caff == 14) && (g_s.icave == 151)) aniof(1, 2); - if ((caff == 17) && (g_s.ivier == 143)) + if ((g_caff == 17) && (g_s.ivier == 143)) aniof(1, 1); - if ((caff == 24) && (g_s.ipuit != 0)) + if ((g_caff == 24) && (g_s.ipuit != 0)) aniof(1, 1); } - if (caff < 26) + if (g_caff < 26) musique(1); } } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 42e1d0f9fa..c592ddc996 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -49,7 +49,7 @@ void tinke() { int cx, cf, j, h, m; Common::String stpo; - anyone = false; + g_anyone = false; calch(j, h, m); if (j != g_day) { g_day = j; @@ -96,7 +96,7 @@ void tinke() { if (y_s < 12) return; - if (! blo) { + if (!g_blo) { if ((h == 12) || ((h > 18) && (h < 21)) || ((h >= 0) && (h < 7))) g_t = ti2; else @@ -109,12 +109,12 @@ void tinke() { g_t -= ((g_t / 3) * 2); int nh = readclock(); - if ((nh - mh) > g_t) { + if ((nh - g_mh) > g_t) { bool activeMenu = g_vm->_menu._menuActive; g_vm->_menu.eraseMenu(); - jh += ((nh - mh) / g_t); - mh = nh; - switch (li) { + g_jh += ((nh - g_mh) / g_t); + g_mh = nh; + switch (g_li) { case 1: case 4 : pl1(cf); @@ -153,17 +153,17 @@ void tinke() { pl20(cf); break; } - if ((mpers != 0) && (ipers != 10)) - mpers = ipers; + if ((g_mpers != 0) && (g_ipers != 10)) + g_mpers = g_ipers; - if ((mpers == 0) && (ipers > 0)) { + if ((g_mpers == 0) && (g_ipers > 0)) { if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) { cavegre(); - } else if (ipers == 10) { - ipers = 0; - if (! brt) { - brt = true; - hdb = readclock(); + } else if (g_ipers == 10) { + g_ipers = 0; + if (!g_brt) { + g_brt = true; + g_hdb = readclock(); int haz = hazard(1, 5); if (haz < 5) { clsf3(); @@ -181,13 +181,13 @@ void tinke() { g_vm->_menu.drawMenu(); } } - hfb = readclock(); - if ((brt) && ((hfb - hdb) > 17)) { - nouvp(li, cx); - brt = false; - hdb = 0; + g_hfb = readclock(); + if ((g_brt) && ((g_hfb - g_hdb) > 17)) { + nouvp(g_li, cx); + g_brt = false; + g_hdb = 0; if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) - anyone = true; + g_anyone = true; } } @@ -212,7 +212,7 @@ void fenat(char ans) { void afdes(int ad) { taffich(); dessin(ad); - okdes = false; + g_okdes = false; } void tkey1(bool d) { @@ -230,7 +230,7 @@ void tkey1(bool d) { quest = keypressed(); getMousePos(x, y, c); CHECK_QUIT; - } while (!(quest || (c != 0) || (d && anyone))); + } while (!(quest || (c != 0) || (d && g_anyone))); if (quest) testou(); g_vm->setMouseClick(false); @@ -259,19 +259,19 @@ void tmlieu(int mli) { /* NIVEAU 7 */ void tlu(int af, int ob) { - caff = 32; + g_caff = 32; afdes(0); repon(6, ob + 4000); repon(2, 999); tkey1(true); - caff = af; + g_caff = af; g_msg[3] = OPCODE_NONE; - crep = 998; + g_crep = 998; } void affrep() { - caff = g_s.mlieu; - crep = g_s.mlieu; + g_caff = g_s.mlieu; + g_crep = g_s.mlieu; } void mfouen() { @@ -287,11 +287,11 @@ void mfouen() { void tperd() { initouv(); - ment = 0; - iouv = 0; - mchai = 0; + g_ment = 0; + g_iouv = 0; + g_mchai = 0; mfouen(); - if (!blo) { + if (!g_blo) { int cx; t11(21, cx); } @@ -299,17 +299,17 @@ void tperd() { g_vm->_loseGame = true; clsf1(); g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, crep); + repon(9, g_crep); clsf2(); clsf3(); g_col = false; - syn = false; - okdes = false; + g_syn = false; + g_okdes = false; } void tsort() { - if ((iouv > 0) && (g_s.mlieu != 0)) { + if ((g_iouv > 0) && (g_s.mlieu != 0)) { if (g_s.conf < 50) g_s.conf += 2; else @@ -318,24 +318,24 @@ void tsort() { for (int cx = 1; cx <= 7; ++cx) touv[cx] = chr(0); - ment = 0; - iouv = 0; - mchai = 0; + g_ment = 0; + g_iouv = 0; + g_mchai = 0; debloc(g_s.mlieu); } void st4(int ob) { - crep = 997; + g_crep = 997; switch (ob) { case 114 : - crep = 109; + g_crep = 109; break; case 110 : - crep = 107; + g_crep = 107; break; case 158 : - crep = 113; + g_crep = 113; break; case 152: case 153: @@ -347,7 +347,7 @@ void st4(int ob) { case 157: case 160: case 161 : - tlu(caff, ob); + tlu(g_caff, ob); break; default: break; @@ -402,7 +402,7 @@ void sparl(float adr, float rep) { key = 0; do { - parole(repint, haut[caff - 69], 0); + parole(repint, haut[g_caff - 69], 0); f3f8::waitForF3F8(key); CHECK_QUIT; } while (key != 66); @@ -411,9 +411,9 @@ void sparl(float adr, float rep) { } void finfouil() { - fouil = false; - obpart = false; - cs = 0; + g_fouil = false; + g_obpart = false; + g_cs = 0; is = 0; mfouen(); } @@ -434,13 +434,13 @@ void mennor() { } void premtet() { - dessine(ades, 10, 80); + dessine(g_ades, 10, 80); g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); } /* NIVEAU 5 */ void ajchai() { - int cy = acha + ((mchai - 1) * 10) - 1; + int cy = acha + ((g_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; @@ -450,7 +450,7 @@ void ajchai() { int lderobj = g_s.derobj; tabdon[cy + cx] = lderobj; } else - crep = 192; + g_crep = 192; } void ajjer(int ob) { @@ -463,7 +463,7 @@ void ajjer(int ob) { g_s.sjer[(cx)] = chr(ob); modinv(); } else - crep = 139; + g_crep = 139; } void t1sama() { //Entering manor @@ -474,14 +474,14 @@ void t1sama() { //Entering manor bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late - crep = 1511; + g_crep = 1511; tperd(); } else st1sama(); } else if (!g_s.ipre) { //Is it your first time? - ipers = 255; - affper(ipers); - caff = 77; + g_ipers = 255; + affper(g_ipers); + g_caff = 77; afdes(0); g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); @@ -497,10 +497,10 @@ void t1sama() { //Entering manor g_s.mlieu = 0; affrep(); t5(10); - if (! blo) + if (!g_blo) t11(0, m); - ipers = 0; - mpers = 0; + g_ipers = 0; + g_mpers = 0; g_s.ipre = true; /*chech;*/ } else @@ -513,19 +513,19 @@ void t1vier() { } void t1neig() { - ++inei; - if (inei > 2) { - crep = 1506; + ++g_inei; + if (g_inei > 2) { + g_crep = 1506; tperd(); } else { - okdes = true; + g_okdes = true; g_s.mlieu = 19; affrep(); } } void t1deva() { - inei = 0; + g_inei = 0; g_s.mlieu = 21; affrep(); } @@ -536,33 +536,33 @@ void t1derr() { } void t1deau() { - crep = 1503; + g_crep = 1503; tperd(); } void tctrm() { - repon(2, (3000 + ctrm)); - ctrm = 0; + repon(2, (3000 + g_ctrm)); + g_ctrm = 0; } void quelquun() { - if (imen) + if (g_imen) g_vm->_menu.eraseMenu(); finfouil(); - crep = 997; + g_crep = 997; L1: - if (! cache) { - if (crep == 997) - crep = 138; - repon(2, crep); - if (crep == 138) + if (!g_cache) { + if (g_crep == 997) + g_crep = 138; + repon(2, g_crep); + if (g_crep == 138) parole(5, 2, 1); else parole(4, 4, 1); - if (iouv == 0) + if (g_iouv == 0) g_s.conf += 2; else if (g_s.conf < 50) g_s.conf += 4; @@ -571,18 +571,18 @@ L1: tsort(); tmlieu(15); int cx; - tip(ipers, cx); - caff = 69 + cx; - crep = caff; + tip(g_ipers, cx); + g_caff = 69 + cx; + g_crep = g_caff; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[cx]; - syn = true; + g_syn = true; g_col = true; } else { int haz = hazard(1, 3); if (haz == 2) { - cache = false; - crep = 137; + g_cache = false; + g_crep = 137; goto L1; } else { repon(2, 136); @@ -594,7 +594,7 @@ L1: affrep(); } } - if (imen) + if (g_imen) g_vm->_menu.drawMenu(); } @@ -602,26 +602,26 @@ void tsuiv() { int tbcl; int cl; - int cy = acha + ((mchai - 1) * 10) - 1; + int cy = acha + ((g_mchai - 1) * 10) - 1; int cx = 0; do { cx = cx + 1; - cs = cs + 1; - cl = cy + cs; + g_cs = g_cs + 1; + cl = cy + g_cs; tbcl = tabdon[cl]; - } while ((tbcl == 0) && (cs <= 9)); + } while ((tbcl == 0) && (g_cs <= 9)); - if ((tbcl != 0) && (cs < 11)) { + if ((tbcl != 0) && (g_cs < 11)) { is = is + 1; - caff = tbcl; - crep = caff + 400; - if (ipers != 0) + g_caff = tbcl; + g_crep = g_caff + 400; + if (g_ipers != 0) g_s.conf = g_s.conf + 2; } else { affrep(); finfouil(); if (cx > 9) - crep = 131; + g_crep = 131; } } @@ -633,7 +633,7 @@ void tfleche() { return; fenat(chr(152)); - rect = false; + g_rect = false; do { touch = '\0'; @@ -642,18 +642,18 @@ void tfleche() { CHECK_QUIT; if (g_vm->getMouseClick()) - rect = (x_s < 256 * res) && (y_s < 176) && (y_s > 12); + g_rect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); tinke(); - } while (!(qust || rect || anyone)); + } while (!(qust || g_rect || g_anyone)); if (qust && (touch == '\103')) Alert::show(_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (anyone) || (rect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_anyone) || (g_rect))); if (touch == '\73') - iesc = true; + g_iesc = true; - if (rect) { + if (g_rect) { g_x = x_s; g_y = y_s; } @@ -665,18 +665,18 @@ void tcoord(int sx) { g_num = 0; - crep = 999; + g_crep = 999; int a = 0; int atdon = amzon + 3; int cy = 0; - while (cy < caff) { + while (cy < g_caff) { a += tabdon[atdon]; atdon += 4; ++cy; } if (tabdon[atdon] == 0) { - crep = 997; + g_crep = 997; return; } @@ -688,17 +688,17 @@ void tcoord(int sx) { } ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; if (ib == 0) { - crep = 997; + g_crep = 997; return; } cy = 1; do { cb += 2; - sx = tabdon[a + cb] * res; + sx = tabdon[a + cb] * g_res; sy = tabdon[(a + cb + 1)]; cb += 2; - ix = tabdon[a + cb] * res; + ix = tabdon[a + cb] * g_res; iy = tabdon[(a + cb + 1)]; ++cy; } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); @@ -708,7 +708,7 @@ void tcoord(int sx) { return; } - crep = 997; + g_crep = 997; } @@ -716,51 +716,51 @@ void st7(int ob) { switch (ob) { case 116: case 144: - crep = 104; + g_crep = 104; break; case 126: case 111: - crep = 108; + g_crep = 108; break; case 132: - crep = 111; + g_crep = 111; break; case 142: - crep = 112; + g_crep = 112; break; default: - crep = 183; + g_crep = 183; st4(ob); } } void treg(int ob) { - int mdes = caff; - caff = ob; + int mdes = g_caff; + g_caff = ob; - if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { + if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { afdes(0); - if ((caff > 29) && (caff < 33)) - repon(2, caff); + if ((g_caff > 29) && (g_caff < 33)) + repon(2, g_caff); else - repon(2, (caff + 400)); + repon(2, g_caff + 400); tkey1(true); - caff = mdes; + g_caff = mdes; g_msg[3] = 0; - crep = 998; + g_crep = 998; } else { - obpart = true; - crep = caff + 400; + g_obpart = true; + g_crep = g_caff + 400; mfoudi(); } } void avpoing(int &ob) { - crep = 999; + g_crep = 999; if (g_s.derobj != 0) ajjer(g_s.derobj); - if (crep != 139) { + if (g_crep != 139) { modobj(ob + 400); g_s.derobj = ob; ob = 0; @@ -781,7 +781,7 @@ void t23coul(int &l) { cherjer(143, d); l = 14; if (!d) { - crep = 1512; + g_crep = 1512; tperd(); } } @@ -797,9 +797,9 @@ void st13(int ob) { (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || (ob == 150) || (ob == 152)) - crep = 999; + g_crep = 999; else - crep = 105; + g_crep = 105; } void aldepl() { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7d0e7bc8ed..dceb5c7d55 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -122,7 +122,7 @@ Common::ErrorCode MortevielleEngine::initialise() { // Set the screen mode g_currGraphicalDevice = MODE_EGA; - res = 2; + g_res = 2; _txxFileFl = false; // Load texts from TXX files @@ -144,19 +144,19 @@ Common::ErrorCode MortevielleEngine::initialise() { g_currGraphicalDevice = MODE_EGA; g_newGraphicalDevice = g_currGraphicalDevice; - zuul = false; - tesok = false; + g_zuul = false; + g_tesok = false; charpal(); charge_cfiph(); charge_cfiec(); zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - c_zzz = 1; + g_c_zzz = 1; init_nbrepm(); initMouse(); init_lieu(); g_soundOff = false; - f2_all = false; + g_f2_all = false; teskbd(); dialpre(); @@ -165,7 +165,7 @@ Common::ErrorCode MortevielleEngine::initialise() { if (g_newGraphicalDevice != g_currGraphicalDevice) g_currGraphicalDevice = g_newGraphicalDevice; hirs(); - ades = 0x7000; + g_ades = 0x7000; return Common::kNoError; } @@ -481,7 +481,7 @@ Common::Error MortevielleEngine::run() { */ void MortevielleEngine::showIntroduction() { f3f8::aff50(false); - mlec = 0; + g_mlec = 0; f3f8::checkForF8(142, false); CHECK_QUIT; @@ -500,10 +500,10 @@ void MortevielleEngine::showIntroduction() { * loses, and chooses to start playing the game again. */ void MortevielleEngine::mainGame() { - if (rech_cfiec) + if (g_rech_cfiec) charge_cfiec(); - for (crep = 1; crep <= c_zzz; ++crep) + for (g_crep = 1; g_crep <= g_c_zzz; ++g_crep) zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); charge_bruit5(); @@ -553,10 +553,10 @@ void MortevielleEngine::handleAction() { clsf3(); oo = false; - ctrm = 0; - if (! iesc) { + g_ctrm = 0; + if (!g_iesc) { g_vm->_menu.drawMenu(); - imen = true; + g_imen = true; temps = 0; g_key = 0; funct = false; @@ -569,27 +569,27 @@ void MortevielleEngine::handleAction() { moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; - } while (!((choisi) || (temps > lim) || (funct) || (anyone))); + } while (!((g_choisi) || (temps > lim) || (funct) || (g_anyone))); _inMainGameLoop = false; g_vm->_menu.eraseMenu(); - imen = false; + g_imen = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (choisi && (g_msg[3] == MENU_SAVE)) { + if (g_choisi && (g_msg[3] == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7); g_vm->_savegameManager.saveGame(g_msg[4] & 7, saveName); } - if (choisi && (g_msg[3] == MENU_LOAD)) + if (g_choisi && (g_msg[3] == MENU_LOAD)) g_vm->_savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { - if ((mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { - g_msg[4] = mnumo; + if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { + g_msg[4] = g_mnumo; ecr3(g_vm->getEngineString(S_IDEM)); } else return; @@ -610,20 +610,20 @@ void MortevielleEngine::handleAction() { if (g_num == 9999) g_num = 0; } else { - mnumo = g_msg[3]; + g_mnumo = g_msg[3]; if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) - mnumo = g_msg[4]; - if (! anyone) { - if ((fouil) || (obpart)) { + g_mnumo = g_msg[4]; + if (!g_anyone) { + if ((g_fouil) || (g_obpart)) { if (y_s < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { oo = true; - if ((g_msg[4] == OPCODE_LIFT) || (obpart)) { + if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) { finfouil(); - caff = g_s.mlieu; - crep = 998; + g_caff = g_s.mlieu; + g_crep = 998; } else tsuiv(); mennor(); @@ -634,17 +634,17 @@ void MortevielleEngine::handleAction() { if (! oo) tsitu(); - if ((ctrm == 0) && (! _loseGame) && (! _endGame)) { + if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); - if (okdes) { - okdes = false; + if (g_okdes) { + g_okdes = false; dessin(0); } - if ((! syn) || (g_col)) - repon(2, crep); + if ((!g_syn) || (g_col)) + repon(2, g_crep); } - } while (syn); - if (ctrm != 0) + } while (g_syn); + if (g_ctrm != 0) tctrm(); } } diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 9baae57eb6..f26c7051a6 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -260,8 +260,8 @@ void showMouse() { * @remarks Originally called 'pos_mouse' */ void setMousePos(int x, int y) { - if (x > 314 * res) - x = 314 * res; + if (x > 314 * g_res) + x = 314 * g_res; else if (x < 0) x = 0; if (y > 199) @@ -331,16 +331,16 @@ void moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * res; + cx = 315 * g_res; cy = 1; break; case '3': cy = 190; - cx = 315 * res; + cx = 315 * g_res; break; case '5': cy = 100; - cx = 155 * res; + cx = 155 * g_res; break; case ' ': case '\15': @@ -394,27 +394,27 @@ void moveMouse(bool &funct, char &key) { } break; case 'I': - cx = res * 32; + cx = g_res * 32; cy = 8; break; case 'D': - cx = 80 * res; + cx = 80 * g_res; cy = 8; break; case 'A': - cx = 126 * res; + cx = 126 * g_res; cy = 8; break; case 'S': - cx = 174 * res; + cx = 174 * g_res; cy = 8; break; case 'P': - cx = 222 * res; + cx = 222 * g_res; cy = 8; break; case 'F': - cx = res * 270; + cx = g_res * 270; cy = 8; break; case '\23': @@ -422,7 +422,7 @@ void moveMouse(bool &funct, char &key) { return; break; case '\26': - zuul = true; + g_zuul = true; return; break; case '\24': // ^T => mode tandy diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 3cc9b342fd..80eeaa7cab 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -174,7 +174,7 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { /* debug(' .. Afftex');*/ g_vm->_screenSurface.putxy(x, y); - if (res == 1) + if (g_res == 1) tab = 10; else tab = 6; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 7b2dcabee9..1ad58ed996 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -149,7 +149,7 @@ void chartex() { */ void dialpre() { /* debug('o3 dialpre'); */ - crep = 998; + g_crep = 998; int_m = true; } @@ -177,7 +177,7 @@ void music() { if (g_soundOff) return; - rech_cfiec = true; + g_rech_cfiec = true; if (!fic.open("mort.img")) error("Missing file - mort.img"); @@ -222,7 +222,7 @@ void charge_cfiec() { f.read(&adcfiec[0], 822 * 128); f.close(); - rech_cfiec = false; + g_rech_cfiec = false; } @@ -241,16 +241,16 @@ void charge_cfiph() { void suite() { hirs(); repon(7, 2035); - caff = 51; + g_caff = 51; taffich(); teskbd(); if (g_newGraphicalDevice != g_currGraphicalDevice) g_currGraphicalDevice = g_newGraphicalDevice; hirs(); - dessine(ades, 0, 0); + dessine(g_ades, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - g_vm->_screenSurface.putxy(104 + 72 * res, 185); + g_vm->_screenSurface.putxy(104 + 72 * g_res, 185); g_vm->_screenSurface.writeg(cpr, 0); } diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index cbe460a43d..9bfbaaf560 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -34,7 +34,7 @@ namespace Mortevielle { void spfrac(int wor) { c3.rep = (uint)wor >> 12; - if ((typlec == 0) && (c3.code != 9)) + if ((g_typlec == 0) && (c3.code != 9)) if (((c3.code > 4) && (c3.val != 20) && (c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || ((c3.code < 5) && ((c3.val != 19) && (c3.val != 22) && (c3.rep != 4) && (c3.rep != 9)))) { ++c3.rep; @@ -47,7 +47,7 @@ void spfrac(int wor) { void charg_car() { int wor, int_; - wor = swap(READ_LE_UINT16(&mem[adword + ptr_word])); + wor = swap(READ_LE_UINT16(&mem[adword + g_ptr_word])); int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { @@ -82,13 +82,13 @@ void charg_car() { } spfrac(wor); - ptr_word = ptr_word + 2; + g_ptr_word += 2; } void entroct(byte o) { - mem[adtroct * 16 + ptr_oct] = o; - ++ptr_oct; + mem[adtroct * 16 + g_ptr_oct] = o; + ++g_ptr_oct; } void veracf(byte b) { diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 2402e37195..a96edde281 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -54,27 +54,27 @@ void init_chariot() { void trait_ph() { const int deca[3] = {300, 30, 40}; - ptr_tcph = num_ph - 1; - ledeb = swap(t_cph[ptr_tcph]) + deca[typlec]; - lefin = swap(t_cph[ptr_tcph + 1]) + deca[typlec]; - nb_word = lefin - ledeb; - ptr_tcph = (uint)ledeb >> 1; - ptr_word = 0; + g_ptr_tcph = g_num_ph - 1; + g_ledeb = swap(t_cph[g_ptr_tcph]) + deca[g_typlec]; + g_lefin = swap(t_cph[g_ptr_tcph + 1]) + deca[g_typlec]; + g_nb_word = g_lefin - g_ledeb; + g_ptr_tcph = (uint)g_ledeb >> 1; + g_ptr_word = 0; do { - WRITE_LE_UINT16(&mem[adword + ptr_word], t_cph[ptr_tcph]); - ptr_word = ptr_word + 2; - ptr_tcph = ptr_tcph + 1; - } while (ptr_tcph < (int)((uint)lefin >> 1)); + WRITE_LE_UINT16(&mem[adword + g_ptr_word], t_cph[g_ptr_tcph]); + g_ptr_word += 2; + ++g_ptr_tcph; + } while (g_ptr_tcph < (int)((uint)g_lefin >> 1)); - ptr_oct = 0; - ptr_word = 0; + g_ptr_oct = 0; + g_ptr_word = 0; init_chariot(); do { rot_chariot(); charg_car(); trait_car(); - } while (ptr_word < nb_word); + } while (g_ptr_word < g_nb_word); rot_chariot(); trait_car(); @@ -90,10 +90,10 @@ void parole(int rep, int ht, int typ) { if (g_soundOff) return; - num_ph = rep; + g_num_ph = rep; g_haut = ht; - typlec = typ; - if (typlec != 0) { + g_typlec = typ; + if (g_typlec != 0) { for (int i = 0; i <= 500; ++i) savph[i] = t_cph[i]; tempo = tempo_bruit; @@ -118,12 +118,12 @@ void parole(int rep, int ht, int typ) { } trait_ph(); g_vm->_soundManager.litph(tbi, typ, tempo); - if (typlec != 0) + if (g_typlec != 0) for (int i = 0; i <= 500; ++i) { t_cph[i] = savph[i]; - mlec = typlec; + g_mlec = g_typlec; } - writepal(numpal); + writepal(g_numpal); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 6dd8df10a6..b34e64aa5a 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -52,15 +52,15 @@ void changeGraphicalDevice(int newDevice) { dessine_rouleau(); tinke(); drawClock(); - if (ipers != 0) - affper(ipers); + if (g_ipers != 0) + affper(g_ipers); else person(); clsf2(); clsf3(); g_maff = 68; afdes(0); - repon(2, crep); + repon(2, g_crep); g_vm->_menu.displayMenu(); } @@ -74,44 +74,44 @@ void MortevielleEngine::gameLoaded() { char g[8]; hideMouse(); - imen = false; + g_imen = false; g[1] = 'M'; _loseGame = true; - anyone = false; - okdes = true; + g_anyone = false; + g_okdes = true; test[0] = false; test[1] = false; g[0] = '\040'; g_col = false; - tesok = true; + g_tesok = true; test[2] = false; g[7] = g[0]; g[2] = 'A'; - cache = false; - brt = false; + g_cache = false; + g_brt = false; g_maff = 68; g[5] = 'E'; - mnumo = 0; - prebru = 0; + g_mnumo = 0; + g_prebru = 0; g[4] = 'T'; g_x = 0; g_y = 0; g_num = 0; - hdb = 0; - hfb = 0; - cs = 0; + g_hdb = 0; + g_hfb = 0; + g_cs = 0; is = 0; k = 0; - ment = 0; - syn = true; - fouil = true; - mchai = 0; - inei = 0; + g_ment = 0; + g_syn = true; + g_fouil = true; + g_mchai = 0; + g_inei = 0; initouv(); g[3] = 'S'; g[6] = 'R'; - iouv = 0; - dobj = 0; + g_iouv = 0; + g_dobj = 0; affrep(); _hintPctMessage = deline(580); while ((test[k] == false) && (k < 2)) { @@ -121,16 +121,16 @@ void MortevielleEngine::gameLoaded() { // presumably for copy protection. This has been replaced with hardcoded success test[k] = true; - okdes = false; + g_okdes = false; _endGame = true; _loseGame = false; - fouil = false; + g_fouil = false; } person(); tinke(); drawClock(); afdes(0); - repon(2, crep); + repon(2, g_crep); clsf3(); _endGame = false; tmlieu(g_s.mlieu); @@ -138,7 +138,7 @@ void MortevielleEngine::gameLoaded() { if (g_s.derobj != 0) modobj2(g_s.derobj + 400, test[1], test[2]); else - tesok = test[1] || test[2]; + g_tesok = test[1] || test[2]; showMouse(); } @@ -161,12 +161,12 @@ void tsitu() { if (!g_col) clsf2(); - syn = false; - iesc = false; - if (!anyone) { - if (brt) + g_syn = false; + g_iesc = false; + if (!g_anyone) { + if (g_brt) if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { - ctrm = 4; + g_ctrm = 4; mennor(); return; } @@ -226,14 +226,14 @@ void tsitu() { fctSelfPut(); if (g_msg[4] == OPCODE_SLOOK) fctSelftLook(); - cache = false; + g_cache = false; if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { - if (anyone) { + if (g_anyone) { quelquun(); - anyone = false; + g_anyone = false; mennor(); return; } @@ -245,15 +245,15 @@ void tsitu() { if (((g_s.mlieu < 16) || (g_s.mlieu > 19)) && (g_s.mlieu != 23) && (g_s.mlieu != 0) && (g_s.derobj != 152) && (!g_vm->_loseGame)) { if ((g_s.conf > 99) && (h > 8) && (h < 16)) { - crep = 1501; + g_crep = 1501; tperd(); } if ((g_s.conf > 99) && (h > 0) && (h < 9)) { - crep = 1508; + g_crep = 1508; tperd(); } if ((j > 1) && (h > 8) && (!g_vm->_loseGame)) { - crep = 1502; + g_crep = 1502; tperd(); } } @@ -263,13 +263,13 @@ void tsitu() { /* NIVEAU 1 */ void theure() { - vj = ord(g_s.heure); - vh = vj % 48; - vj /= 48; - vm = vh % 2; - vh /= 2; - g_hour = vh; - if (vm == 1) + g_vj = ord(g_s.heure); + g_vh = g_vj % 48; + g_vj /= 48; + g_vm__ = g_vh % 2; + g_vh /= 2; + g_hour = g_vh; + if (g_vm__ == 1) g_minute = 30; else g_minute = 0; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 1694387964..8d9e67f818 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -100,7 +100,7 @@ void taffich() { int alllum[16]; - int a = caff; + int a = g_caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) @@ -147,7 +147,7 @@ void taffich() { break; } - okdes = true; + g_okdes = true; hideMouse(); lgt = 0; Common::String filename; @@ -221,7 +221,7 @@ void taffich() { alllum[k] = -1; } } - numpal = npal; + g_numpal = npal; writepal(npal); if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { @@ -247,9 +247,9 @@ void taffich() { if ((a < 27) && ((g_maff < 27) || (g_s.mlieu == 15)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); - else if (! blo) + else if (!g_blo) t11(g_s.mlieu, cx); - mpers = 0; + g_mpers = 0; } } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 138b604c3a..8873c7e70a 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -78,95 +78,95 @@ const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool blo, - bh1, - bf1, - bh2, - bh4, - bf4, - bh5, - bh6, - bh8, - bt3, - bt7, - bh9, +bool g_blo, + g_bh1, + g_bf1, + g_bh2, + g_bh4, + g_bf4, + g_bh5, + g_bh6, + g_bh8, + g_bt3, + g_bt7, + g_bh9, g_soundOff, - main1, - choisi, - test0, - f2_all, - imen, - cache, - iesc, + g_main1, + g_choisi, + g_test0, + g_f2_all, + g_imen, + g_cache, + g_iesc, g_col, - syn, - fouil, - zuul, - tesok, - obpart, - okdes, - arret, - anyone, - brt, - rect, - rech_cfiec; + g_syn, + g_fouil, + g_zuul, + g_tesok, + g_obpart, + g_okdes, + g_arret, + g_anyone, + g_brt, + g_rect, + g_rech_cfiec; int g_x, g_y, g_t, - vj, - li, - vh, - vm, - jh, - mh, - cs, + g_vj, + g_li, + g_vh, + g_vm__, + g_jh, + g_mh, + g_cs, g_currGraphicalDevice, - hdb, - hfb, + g_hdb, + g_hfb, g_hour, g_day, g_key, g_minute, g_num, - res, - ment, + g_res, + g_ment, g_haut, - caff, + g_caff, g_maff, - crep, - ades, - iouv, - inei, - ctrm, - dobj, - msg3, - msg4, - mlec, + g_crep, + g_ades, + g_iouv, + g_inei, + g_ctrm, + g_dobj, + g_msg3, + g_msg4, + g_mlec, g_newGraphicalDevice, - c_zzz, - mchai, - menup, - ipers, - ledeb, - lefin, - mpers, - mnumo, - xprec, - yprec, - perdep, - prebru, - typlec, - num_ph, - numpal, - nb_word, - ptr_oct, - k_tempo, - ptr_tcph, - ptr_word, - color_txt; + g_c_zzz, + g_mchai, + g_menup, + g_ipers, + g_ledeb, + g_lefin, + g_mpers, + g_mnumo, + g_xprec, + g_yprec, + g_perdep, + g_prebru, + g_typlec, + g_num_ph, + g_numpal, + g_nb_word, + g_ptr_oct, + g_k_tempo, + g_ptr_tcph, + g_ptr_word, + g_color_txt; int t_cph[6401]; byte tabdon[4001]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 1ccea2c7b3..3b2e44d843 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -219,94 +219,94 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -extern bool blo, - bh1, - bf1, - bh2, - bh4, - bf4, - bh5, - bh6, - bh8, - bt3, - bt7, - bh9, +extern bool g_blo, + g_bh1, + g_bf1, + g_bh2, + g_bh4, + g_bf4, + g_bh5, + g_bh6, + g_bh8, + g_bt3, + g_bt7, + g_bh9, g_soundOff, - main1, - choisi, - test0, - f2_all, - imen, - cache, - iesc, + g_main1, + g_choisi, + g_test0, + g_f2_all, + g_imen, + g_cache, + g_iesc, g_col, - syn, - fouil, - zuul, - tesok, - obpart, - okdes, - anyone, - brt, - rect, - rech_cfiec; + g_syn, + g_fouil, + g_zuul, + g_tesok, + g_obpart, + g_okdes, + g_anyone, + g_brt, + g_rect, + g_rech_cfiec; extern int g_x, g_y, g_t, - vj, - li, - vh, - vm, - jh, - mh, - cs, + g_vj, + g_li, + g_vh, + g_vm__, + g_jh, + g_mh, + g_cs, g_currGraphicalDevice, - hdb, - hfb, + g_hdb, + g_hfb, g_hour, g_day, g_key, g_minute, g_num, - res, - ment, + g_res, + g_ment, g_haut, - caff, + g_caff, g_maff, - crep, - ades, - iouv, - inei, - ctrm, - dobj, - msg3, - msg4, - mlec, + g_crep, + g_ades, + g_iouv, + g_inei, + g_ctrm, + g_dobj, + g_msg3, + g_msg4, + g_mlec, g_newGraphicalDevice, - c_zzz, - mchai, - menup, - ipers, - ledeb, - lefin, - mpers, - mnumo, - xprec, - yprec, - perdep, - prebru, - typlec, - num_ph, - numpal, - nb_word, - ptr_oct, - k_tempo, - ptr_tcph, - ptr_word, - color_txt; + g_c_zzz, + g_mchai, + g_menup, + g_ipers, + g_ledeb, + g_lefin, + g_mpers, + g_mnumo, + g_xprec, + g_yprec, + g_perdep, + g_prebru, + g_typlec, + g_num_ph, + g_numpal, + g_nb_word, + g_ptr_oct, + g_k_tempo, + g_ptr_tcph, + g_ptr_word, + g_color_txt; extern int t_cph[6401]; extern byte tabdon[4001]; -- cgit v1.2.3 From b2b16cefce08dbdad76b9057ff97d08c7e14c56e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Mar 2012 00:23:27 +0100 Subject: MORTEVIELLE: rename more globals and constants, remove t_nhom usage --- engines/mortevielle/actions.cpp | 524 ++++++++++++++++++------------------ engines/mortevielle/dialogs.cpp | 24 +- engines/mortevielle/level15.cpp | 41 +-- engines/mortevielle/level15.h | 4 +- engines/mortevielle/menu.cpp | 34 +-- engines/mortevielle/mor.cpp | 108 ++++---- engines/mortevielle/mor2.cpp | 155 ++++++----- engines/mortevielle/mortevielle.cpp | 6 +- engines/mortevielle/mouse.cpp | 10 +- engines/mortevielle/outtext.cpp | 4 +- engines/mortevielle/ovd1.cpp | 28 +- engines/mortevielle/parole.cpp | 216 +++++++-------- engines/mortevielle/parole2.cpp | 28 +- engines/mortevielle/prog.cpp | 28 +- engines/mortevielle/saveload.cpp | 46 ++-- engines/mortevielle/taffich.cpp | 45 ++-- engines/mortevielle/var_mor.cpp | 37 ++- engines/mortevielle/var_mor.h | 121 ++++----- 18 files changed, 733 insertions(+), 726 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index d115ef3976..8441315bd7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -49,13 +49,13 @@ namespace Mortevielle { void fctMove() { int cx; - if ((g_s.mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - g_s.mlieu = 15; - g_caff = g_s.mlieu; + if ((g_s._mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + g_s._mlieu = 15; + g_caff = g_s._mlieu; afdes(0); - repon(2, g_s.mlieu); + repon(2, g_s._mlieu); } - if ((g_s.mlieu == 15) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s._mlieu == 15) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { if (!g_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); @@ -67,13 +67,13 @@ void fctMove() { if (g_num == 0) return; if (g_num == 1) { - g_s.mlieu = 0; + g_s._mlieu = 0; tmlieu(0); } else if (g_num == 7) { - g_s.mlieu = 13; + g_s._mlieu = 13; tmlieu(13); } else if (g_num != 6) - g_s.mlieu = 26; + g_s._mlieu = 26; if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; if (g_num > 7) @@ -89,55 +89,60 @@ void fctMove() { do { ++cx; } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); - if (g_s.mlieu == 19) { + + if (g_s._mlieu == 19) { if (cx == 1) t1deva(); if (cx == 2) t1neig(); goto L2; } - if (g_s.mlieu == 23) { + + if (g_s._mlieu == 23) { if (cx == 1) t1deau(); if (cx == 2) t1derr(); goto L2; } - if ((g_s.mlieu == 11) && (cx == 1)) + + if ((g_s._mlieu == 11) && (cx == 1)) cx = 6; - if (g_s.mlieu == 12) { + + if (g_s._mlieu == 12) { if (cx == 2) cx = 6; if (cx == 5) cx = 16; } - if ((g_s.mlieu == 14) && (cx == 3)) + + if ((g_s._mlieu == 14) && (cx == 3)) cx = 6; - if (((g_s.mlieu == 15) || (g_s.mlieu == 26)) && (cx == 4)) + if (((g_s._mlieu == 15) || (g_s._mlieu == 26)) && (cx == 4)) cx = 6; - if ((g_s.mlieu > 19) && (g_s.mlieu != 26)) + if ((g_s._mlieu > 19) && (g_s._mlieu != 26)) cx += 10; - if ((g_s.mlieu == 20) && (cx == 13)) + if ((g_s._mlieu == 20) && (cx == 13)) cx = 16; - if (g_s.mlieu == 21) { + if (g_s._mlieu == 21) { if (cx == 12) cx = 16; else if (cx > 13) cx = 15; } - if ((g_s.mlieu == 22) && (cx > 14)) + if ((g_s._mlieu == 22) && (cx > 14)) cx = 15; - if ((g_s.mlieu == 24) && (cx != 17)) + if ((g_s._mlieu == 24) && (cx != 17)) if (cx > 13) cx = 15; if (cx == 1) - g_s.mlieu = 11; + g_s._mlieu = 11; else if (cx == 2) - g_s.mlieu = 12; + g_s._mlieu = 12; else if (cx == 3) - g_s.mlieu = 14; + g_s._mlieu = 14; else if (cx == 4) - g_s.mlieu = 15; + g_s._mlieu = 15; else if (cx == 5) cx = 12; if (cx == 6) @@ -147,31 +152,31 @@ void fctMove() { else if (cx == 12) t1deva(); else if (cx == 13) - g_s.mlieu = 20; + g_s._mlieu = 20; else if (cx == 14) - g_s.mlieu = 24; + g_s._mlieu = 24; else if (cx == 15) t1neig(); else if (cx == 16) t1derr(); else if (cx == 17) { - if ((g_s.ipuit != 120) && (g_s.ipuit != 140)) + if ((g_s._ipuit != 120) && (g_s._ipuit != 140)) g_crep = 997; - else if (g_s.ipuit == 120) + else if (g_s._ipuit == 120) g_crep = 181; - else if (g_s.conf > 80) { + else if (g_s._conf > 80) { g_crep = 1505; tperd(); } else { - g_s.mlieu = 23; + g_s._mlieu = 23; affrep(); } } if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); - debloc(g_s.mlieu); + debloc(g_s._mlieu); L2: - tmlieu(g_s.mlieu); + tmlieu(g_s._mlieu); } /** @@ -184,33 +189,33 @@ void fctTake() { avpoing(cx); if (g_crep != 139) { if (g_ipers > 0) - g_s.conf += 3; + g_s._conf += 3; if (g_obpart) { - if (g_s.mlieu == 2) - g_s.iloic = 0; - if (g_s.mlieu == 13) { - if (g_s.iboul == g_caff) - g_s.iboul = 0; - if (g_s.ibag == g_caff) - g_s.ibag = 0; + if (g_s._mlieu == 2) + g_s._iloic = 0; + if (g_s._mlieu == 13) { + if (g_s._iboul == g_caff) + g_s._iboul = 0; + if (g_s._ibag == g_caff) + g_s._ibag = 0; } - if (g_s.mlieu == 14) - g_s.icave = 0; - if (g_s.mlieu == 16) - g_s.icryp = 0; - if (g_s.mlieu == 17) - g_s.ivier = 0; - if (g_s.mlieu == 24) - g_s.ipuit = 0; + if (g_s._mlieu == 14) + g_s._icave = 0; + if (g_s._mlieu == 16) + g_s._icryp = 0; + if (g_s._mlieu == 17) + g_s._ivier = 0; + if (g_s._mlieu == 24) + g_s._ipuit = 0; mfouen(); g_obpart = false; affrep(); } else { - tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; + g_tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; tsuiv(); ++g_dobj; if (g_dobj > 6) { - g_s.conf += 2; + g_s._conf += 2; g_dobj = 0; } } @@ -230,40 +235,40 @@ void fctTake() { } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (g_s.mlieu == 16))) { + if ((g_num == 0) || ((g_num == 1) && (g_s._mlieu == 16))) { tcoord(8); if (g_num != 0) { if (g_ipers > 0) - g_s.conf += 3; + g_s._conf += 3; g_crep = 997; - if ((g_s.mlieu == 2) && (g_s.iloic != 0)) - avpoing(g_s.iloic); - if ((g_s.mlieu == 13) && (g_num == 1) && (g_s.iboul != 0)) { - avpoing(g_s.iboul); + if ((g_s._mlieu == 2) && (g_s._iloic != 0)) + avpoing(g_s._iloic); + if ((g_s._mlieu == 13) && (g_num == 1) && (g_s._iboul != 0)) { + avpoing(g_s._iboul); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } - if ((g_s.mlieu == 13) && (g_num == 2) && (g_s.ibag != 0)) { - avpoing(g_s.ibag); + if ((g_s._mlieu == 13) && (g_num == 2) && (g_s._ibag != 0)) { + avpoing(g_s._ibag); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } - if ((g_s.mlieu == 14) && (g_s.icave != 0)) { - avpoing(g_s.icave); + if ((g_s._mlieu == 14) && (g_s._icave != 0)) { + avpoing(g_s._icave); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } - if ((g_s.mlieu == 16) && (g_s.icryp != 0)) - avpoing(g_s.icryp); - if ((g_s.mlieu == 17) && (g_s.ivier != 0)) { - avpoing(g_s.ivier); + if ((g_s._mlieu == 16) && (g_s._icryp != 0)) + avpoing(g_s._icryp); + if ((g_s._mlieu == 17) && (g_s._ivier != 0)) { + avpoing(g_s._ivier); if ((g_crep != 997) && (g_crep != 139)) { g_crep = 182; aniof(2, 1); } } - if ((g_s.mlieu == 24) && (g_s.ipuit != 0)) { - avpoing(g_s.ipuit); + if ((g_s._mlieu == 24) && (g_s._ipuit != 0)) { + avpoing(g_s._ipuit); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); } @@ -271,15 +276,15 @@ void fctTake() { g_crep = 999; } } else { - if ( ((g_s.mlieu == 0) && (g_num == 3)) || ((g_s.mlieu == 1) && (g_num == 4)) - || ((g_s.mlieu == 2) && (g_num == 1)) || ((g_s.mlieu == 4) && (g_num == 3)) - || ((g_s.mlieu == 5) && (g_num == 6)) || ((g_s.mlieu == 6) && (g_num == 2)) - || ((g_s.mlieu == 7) && (g_num == 6)) || ((g_s.mlieu == 8) && (g_num == 4)) - || ((g_s.mlieu == 9) && (g_num == 4)) || ((g_s.mlieu == 10) && (g_num > 2)) - || ((g_s.mlieu == 11) && (g_num == 7)) || ((g_s.mlieu == 12) && (g_num == 6)) - || ((g_s.mlieu == 13) && (g_num > 4)) || ((g_s.mlieu > 13) && (g_s.mlieu != 23)) ) + if ( ((g_s._mlieu == 0) && (g_num == 3)) || ((g_s._mlieu == 1) && (g_num == 4)) + || ((g_s._mlieu == 2) && (g_num == 1)) || ((g_s._mlieu == 4) && (g_num == 3)) + || ((g_s._mlieu == 5) && (g_num == 6)) || ((g_s._mlieu == 6) && (g_num == 2)) + || ((g_s._mlieu == 7) && (g_num == 6)) || ((g_s._mlieu == 8) && (g_num == 4)) + || ((g_s._mlieu == 9) && (g_num == 4)) || ((g_s._mlieu == 10) && (g_num > 2)) + || ((g_s._mlieu == 11) && (g_num == 7)) || ((g_s._mlieu == 12) && (g_num == 6)) + || ((g_s._mlieu == 13) && (g_num > 4)) || ((g_s._mlieu > 13) && (g_s._mlieu != 23)) ) g_crep = 997; - else if (g_s.mlieu == 23) { + else if (g_s._mlieu == 23) { g_crep = 1504; tperd(); } else @@ -301,11 +306,11 @@ void fctInventoryTake() { cy = 0; do { ++cy; - if (ord(g_s.sjer[cy]) != 0) + if (ord(g_s._sjer[cy]) != 0) ++cz; } while (cz != cx); - cz = ord(g_s.sjer[cy]); - g_s.sjer[cy] = chr(0); + cz = ord(g_s._sjer[cy]); + g_s._sjer[cy] = chr(0); modinv(); avpoing(cz); g_crep = 998; @@ -329,21 +334,21 @@ void fctLift() { tcoord(8); if (g_num != 0) { if (g_ipers > 0) - ++g_s.conf; + ++g_s._conf; g_crep = 997; - if ((g_s.mlieu == 2) && (g_s.iloic != 0)) - treg(g_s.iloic); + if ((g_s._mlieu == 2) && (g_s._iloic != 0)) + treg(g_s._iloic); } return; } if (g_ipers > 0) - ++g_s.conf; - cx = g_s.mlieu; - if (g_s.mlieu == 16) + ++g_s._conf; + cx = g_s._mlieu; + if (g_s._mlieu == 16) cx = 14; - else if (g_s.mlieu == 19) + else if (g_s._mlieu == 19) cx = 15; - g_crep = tabdon[asoul + (cx << 3) + (g_num - 1)]; + g_crep = g_tabdon[asoul + (cx << 3) + (g_num - 1)]; if (g_crep == 255) g_crep = 997; } @@ -372,10 +377,10 @@ void fctRead() { * @remarks Originally called 'tslire' */ void fctSelfRead() { - if (g_s.derobj == 0) + if (g_s._derobj == 0) g_crep = 186; else - st4(g_s.derobj); + st4(g_s._derobj); } /** @@ -399,60 +404,60 @@ void fctLook() { tcoord(8); g_crep = 131; if (g_num != 0) { - if (g_s.mlieu == 13) { + if (g_s._mlieu == 13) { if (g_num == 1) { g_crep = 164; - if (g_s.ibag != 0) - treg(g_s.ibag); - else if (g_s.iboul != 0) - treg(g_s.iboul); + if (g_s._ibag != 0) + treg(g_s._ibag); + else if (g_s._iboul != 0) + treg(g_s._iboul); } else { g_crep = 193; - if (g_s.ibag != 0) - treg(g_s.ibag); + if (g_s._ibag != 0) + treg(g_s._ibag); } } - if (g_s.mlieu == 14) { + if (g_s._mlieu == 14) { g_crep = 164; - if (g_s.icave != 0) - treg(g_s.icave); + if (g_s._icave != 0) + treg(g_s._icave); } - if (g_s.mlieu == 17) { + if (g_s._mlieu == 17) { g_crep = 174; - if (g_s.ivier != 0) - treg(g_s.ivier); + if (g_s._ivier != 0) + treg(g_s._ivier); } - if (g_s.mlieu == 24) { + if (g_s._mlieu == 24) { g_crep = 131; - if (g_s.ipuit != 0) - treg(g_s.ipuit); + if (g_s._ipuit != 0) + treg(g_s._ipuit); } } return; } - cx = g_s.mlieu; - if (g_s.mlieu == 20) + cx = g_s._mlieu; + if (g_s._mlieu == 20) cx = 17; - if ((g_s.mlieu > 21) && (g_s.mlieu < 25)) + if ((g_s._mlieu > 21) && (g_s._mlieu < 25)) cx -= 4; - if (g_s.mlieu == 26) + if (g_s._mlieu == 26) cx = 21; - g_crep = tabdon[arega + (cx * 7) + g_num - 1]; - if ((g_s.mlieu == 13) && (g_num == 8)) + g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; + if ((g_s._mlieu == 13) && (g_num == 8)) g_crep = 126; - if (g_s.mlieu == 19) + if (g_s._mlieu == 19) g_crep = 103; if (g_crep == 255) g_crep = 131; - if ((g_s.mlieu == 1) && (g_num == 1)) + if ((g_s._mlieu == 1) && (g_num == 1)) treg(144); - if ((g_s.mlieu == 5) && (g_num == 3)) + if ((g_s._mlieu == 5) && (g_num == 3)) treg(147); - if ((g_s.mlieu == 8) && (g_num == 3)) + if ((g_s._mlieu == 8) && (g_num == 3)) treg(149); - if ((g_s.mlieu == 9) && (g_num == 2)) + if ((g_s._mlieu == 9) && (g_num == 2)) treg(30); - if ((g_s.mlieu == 10) && (g_num == 3)) + if ((g_s._mlieu == 10) && (g_num == 3)) treg(31); } @@ -461,8 +466,8 @@ void fctLook() { * @remarks Originally called 'tsregarder' */ void fctSelftLook() { - if (g_s.derobj != 0) - treg(g_s.derobj); + if (g_s._derobj != 0) + treg(g_s._derobj); else g_crep = 186; } @@ -486,7 +491,7 @@ void fctSearch() { if (g_anyone || g_iesc) return; - if (g_s.mlieu == 23) { + if (g_s._mlieu == 23) { g_crep = 1504; tperd(); return; @@ -499,17 +504,17 @@ void fctSearch() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(touv[cx]))); - if (g_num != ord(touv[cx])) + } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); + if (g_num != ord(g_touv[cx])) g_crep = 187; else { if (g_ipers > 0) - g_s.conf += 3; + g_s._conf += 3; rechai(g_mchai); if (g_mchai != 0) { g_cs = 0; - is = 0; + g_is = 0; g_fouil = true; mfoudi(); tsuiv(); @@ -521,41 +526,41 @@ void fctSearch() { g_crep = 997; if (g_num != 0) { if (g_ipers > 0) - g_s.conf += 3; - if ((g_s.mlieu != 24) && (g_s.mlieu != 17) && (g_s.mlieu != 13)) { - if (g_s.mlieu == 2) { + g_s._conf += 3; + if ((g_s._mlieu != 24) && (g_s._mlieu != 17) && (g_s._mlieu != 13)) { + if (g_s._mlieu == 2) { g_crep = 123; - if (g_s.iloic != 0) - treg(g_s.iloic); + if (g_s._iloic != 0) + treg(g_s._iloic); } - if (g_s.mlieu == 16) { + if (g_s._mlieu == 16) { g_crep = 123; - if (g_s.icryp != 0) - treg(g_s.icryp); + if (g_s._icryp != 0) + treg(g_s._icryp); } } } } } else { if (g_ipers > 0) - g_s.conf += 3; + g_s._conf += 3; g_crep = 997; - if (g_s.mlieu < 14) - g_crep = r[g_s.mlieu]; + if (g_s._mlieu < 14) + g_crep = r[g_s._mlieu]; - if ((g_s.mlieu == 3) && (g_num == 2)) + if ((g_s._mlieu == 3) && (g_num == 2)) g_crep = 162; - if (g_s.mlieu == 12) { + if (g_s._mlieu == 12) { if ((g_num == 3) || (g_num == 4)) g_crep = 162; else if (g_num == 5) g_crep = 159; } - if (g_s.mlieu == 19) + if (g_s._mlieu == 19) g_crep = 104; - else if (g_s.mlieu == 16) + else if (g_s._mlieu == 16) g_crep = 155; } } @@ -565,8 +570,8 @@ void fctSearch() { * @remarks Originally called 'tsfouiller' */ void fctSelfSearch() { - if (g_s.derobj != 0) - st7(g_s.derobj); + if (g_s._derobj != 0) + st7(g_s._derobj); else g_crep = 186; } @@ -600,32 +605,32 @@ void fctOpen() { tcoord(7); if (g_num != 0) { if (g_ipers > 0) - g_s.conf += 2; + g_s._conf += 2; ++g_iouv; int cx = 0; do { ++cx; - } while (!((cx > 6) || (ord(touv[cx]) == 0) || (ord(touv[cx]) == g_num))); - if (ord(touv[cx]) != g_num) { - if (!( ((g_num == 3) && ((g_s.mlieu == 0) || (g_s.mlieu == 9) || (g_s.mlieu == 5) || (g_s.mlieu == 7))) - || ((g_num == 4) && ((g_s.mlieu == 1) || (g_s.mlieu == 2) || (g_s.mlieu == 6))) - || ((g_s.mlieu == 4) && (g_num == 5)) - || ((g_num == 6) && ((g_s.mlieu == 7) || (g_s.mlieu == 10) || (g_s.mlieu == 8) || (g_s.mlieu == 13))) - || ((g_s.mlieu == 8) && (g_num == 2)) - || ((g_s.mlieu == 12) && (g_num == 7))) ) { - if ( ((g_s.mlieu > 10) && (g_s.mlieu < 14)) - || ((g_s.mlieu > 6) && (g_s.mlieu < 10)) - || (g_s.mlieu == 0) || (g_s.mlieu == 2) || (g_s.mlieu == 5)) { + } while (!((cx > 6) || (ord(g_touv[cx]) == 0) || (ord(g_touv[cx]) == g_num))); + if (ord(g_touv[cx]) != g_num) { + if (!( ((g_num == 3) && ((g_s._mlieu == 0) || (g_s._mlieu == 9) || (g_s._mlieu == 5) || (g_s._mlieu == 7))) + || ((g_num == 4) && ((g_s._mlieu == 1) || (g_s._mlieu == 2) || (g_s._mlieu == 6))) + || ((g_s._mlieu == 4) && (g_num == 5)) + || ((g_num == 6) && ((g_s._mlieu == 7) || (g_s._mlieu == 10) || (g_s._mlieu == 8) || (g_s._mlieu == 13))) + || ((g_s._mlieu == 8) && (g_num == 2)) + || ((g_s._mlieu == 12) && (g_num == 7))) ) { + if ( ((g_s._mlieu > 10) && (g_s._mlieu < 14)) + || ((g_s._mlieu > 6) && (g_s._mlieu < 10)) + || (g_s._mlieu == 0) || (g_s._mlieu == 2) || (g_s._mlieu == 5)) { if (hazard(1, 4) == 3) parole(7, 9, 1); } - touv[cx] = chr(g_num); + g_touv[cx] = chr(g_num); aniof(1, g_num); } - cx = g_s.mlieu; - if (g_s.mlieu == 16) + cx = g_s._mlieu; + if (g_s._mlieu == 16) cx = 14; - g_crep = tabdon[aouvr + (cx * 7) + g_num - 1]; + g_crep = g_tabdon[aouvr + (cx * 7) + g_num - 1]; if (g_crep == 254) g_crep = 999; } else @@ -638,7 +643,7 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - if (g_s.derobj == 0) { + if (g_s._derobj == 0) { g_crep = 186; return; } @@ -658,28 +663,28 @@ void fctPlace() { g_crep = 999; if (g_caff == 13) { if (g_num == 1) { - if (g_s.iboul != 0) { + if (g_s._iboul != 0) { g_crep = 188; } else { - g_s.iboul = g_s.derobj; - if (g_s.derobj == 141) + g_s._iboul = g_s._derobj; + if (g_s._derobj == 141) aniof(1, 7); } - } else if (g_s.ibag != 0) { + } else if (g_s._ibag != 0) { g_crep = 188; } else { - g_s.ibag = g_s.derobj; - if (g_s.derobj == 159) + g_s._ibag = g_s._derobj; + if (g_s._derobj == 159) aniof(1, 6); } } if (g_caff == 14) { - if (g_s.icave != 0) { + if (g_s._icave != 0) { g_crep = 188; } else { - g_s.icave = g_s.derobj; - if (g_s.derobj == 151) { + g_s._icave = g_s._derobj; + if (g_s._derobj == 151) { // Open hidden passage aniof(1, 2); aniof(1, 1); @@ -689,7 +694,7 @@ void fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); - if (answer== 1) { + if (answer == 1) { Common::String alertTxt = deline(582); Alert::show(alertTxt, 1); @@ -710,10 +715,10 @@ void fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { - g_s.mlieu = 17; + g_s._mlieu = 17; tmlieu(17); } else { - tmlieu(g_s.mlieu); + tmlieu(g_s._mlieu); writepal(14); dessin(0); aniof(1, 2); @@ -735,17 +740,17 @@ void fctPlace() { } if (g_caff == 16) { - if (g_s.icryp == 0) - g_s.icryp = g_s.derobj; + if (g_s._icryp == 0) + g_s._icryp = g_s._derobj; else g_crep = 188; } if (g_caff == 17) { - if (g_s.ivier != 0) { + if (g_s._ivier != 0) { g_crep = 188; - } else if (g_s.derobj == 143) { - g_s.ivier = 143; + } else if (g_s._derobj == 143) { + g_s._ivier = 143; aniof(1, 1); } else { g_crep = 1512; @@ -754,10 +759,10 @@ void fctPlace() { } if (g_caff == 24) { - if (g_s.ipuit != 0) { + if (g_s._ipuit != 0) { g_crep = 188; - } else if ((g_s.derobj == 140) || (g_s.derobj == 120)) { - g_s.ipuit = g_s.derobj; + } else if ((g_s._derobj == 140) || (g_s._derobj == 120)) { + g_s._ipuit = g_s._derobj; aniof(1, 1); } else { g_crep = 185; @@ -786,7 +791,7 @@ void fctTurn() { tcoord(9); if (g_num != 0) { g_crep = 997; - if ((g_s.mlieu == 13) && (g_s.ibag == 159) && (g_s.iboul == 141)) { + if ((g_s._mlieu == 13) && (g_s._ibag == 159) && (g_s._iboul == 141)) { repon(2, 167); parole(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -795,13 +800,13 @@ void fctTurn() { else g_crep = 168; } - if ((g_s.mlieu == 17) && (g_s.ivier == 143)) { + if ((g_s._mlieu == 17) && (g_s._ivier == 143)) { repon(2, 175); clsf3(); parole(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { - g_s.mlieu = 16; + g_s._mlieu = 16; affrep(); } else g_crep = 176; @@ -833,7 +838,7 @@ void fctSelfHide() { * @remarks Originally called 'tattacher' */ void fctAttach() { - if (g_s.derobj == 0) + if (g_s._derobj == 0) g_crep = 186; else { if (!g_syn) @@ -842,10 +847,10 @@ void fctAttach() { if (!(g_anyone) && !(g_iesc)) { tcoord(8); g_crep = 997; - if ((g_num != 0) && (g_s.mlieu == 24)) { + if ((g_num != 0) && (g_s._mlieu == 24)) { g_crep = 999; - if ((g_s.derobj == 120) || (g_s.derobj == 140)) { - g_s.ipuit = g_s.derobj; + if ((g_s._derobj == 120) || (g_s._derobj == 140)) { + g_s._ipuit = g_s._derobj; aniof(1, 1); } else g_crep = 185; @@ -874,11 +879,11 @@ void fctClose() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(touv[cx]))); - if (g_num == ord(touv[cx])) { + } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); + if (g_num == ord(g_touv[cx])) { aniof(2, g_num); g_crep = 998; - touv[cx] = chr(0); + g_touv[cx] = chr(0); --g_iouv; if (g_iouv < 0) g_iouv = 0; @@ -903,15 +908,15 @@ void fctKnock() { if (!g_syn) ecr3(g_vm->getEngineString(S_HIT)); - if (g_s.mlieu == 15) { + if (g_s._mlieu == 15) { Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (g_s.mlieu < 25) { + if (g_s._mlieu < 25) { tfleche(); if (!(g_anyone) && !(g_iesc)) { - if ((g_s.mlieu < 19) && (g_s.mlieu != 15)) + if ((g_s._mlieu < 19) && (g_s._mlieu != 15)) g_crep = 133; else g_crep = 997; @@ -920,11 +925,11 @@ void fctKnock() { return; } - if (g_s.mlieu == 26) { + if (g_s._mlieu == 26) { int haz = (hazard(0, 8)) - 4; parole(11, haz, 1); int p; - ecfren(p, haz, g_s.conf, g_ment); + ecfren(p, haz, g_s._conf, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -950,7 +955,7 @@ void fctKnock() { void fctSelfPut() { if (!g_syn) ecr3(g_vm->getEngineString(S_POSE)); - if (g_s.derobj == 0) + if (g_s._derobj == 0) g_crep = 186; else { if (g_caff > 99) { @@ -974,8 +979,8 @@ void fctSelfPut() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(touv[cx]))); - if (g_num != ord(touv[cx])) + } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); + if (g_num != ord(g_touv[cx])) g_crep = 187; else { g_mchai = chai; @@ -987,30 +992,30 @@ void fctSelfPut() { if (g_num != 0) { g_crep = 998; if (g_caff == 2) { - if (g_s.iloic != 0) + if (g_s._iloic != 0) g_crep = 188; else - g_s.iloic = g_s.derobj; + g_s._iloic = g_s._derobj; } if (g_caff == 13) { if (g_num == 1) { - if (g_s.iboul != 0) + if (g_s._iboul != 0) g_crep = 188; else - g_s.iboul = g_s.derobj; - } else if (g_s.ibag != 0) { + g_s._iboul = g_s._derobj; + } else if (g_s._ibag != 0) { g_crep = 188; } else { - g_s.ibag = g_s.derobj; + g_s._ibag = g_s._derobj; } } if (g_caff == 16) { - if (g_s.icryp != 0) + if (g_s._icryp != 0) g_crep = 188; else - g_s.icryp = g_s.derobj; + g_s._icryp = g_s._derobj; } if (g_caff == 24) @@ -1042,13 +1047,13 @@ void fctSelfPut() { * @remarks Originally called 'tecouter' */ void fctListen() { - if (g_s.mlieu != 26) + if (g_s._mlieu != 26) g_crep = 101; else { if (g_ipers != 0) - ++g_s.conf; + ++g_s._conf; int p, haz; - ecfren(p, haz, g_s.conf, g_ment); + ecfren(p, haz, g_s._conf, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -1080,19 +1085,19 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { + if ((g_s._mlieu > 15) && (g_s._mlieu < 26)) { g_crep = 148; } else { tsort(); - g_s.mlieu = 10; + g_s._mlieu = 10; g_caff = 10; - debloc(g_s.mlieu); - tmlieu(g_s.mlieu); + debloc(g_s._mlieu); + tmlieu(g_s._mlieu); int j, h, m; calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { - g_s.conf -= (g_s.conf / 7); + g_s._conf -= (g_s._conf / 7); if (h == 12) { if (m == 0) h = 4; @@ -1123,16 +1128,16 @@ void fctEat() { void fctEnter() { // int x; - if ((g_s.mlieu == 21) || (g_s.mlieu == 22)) { + if ((g_s._mlieu == 21) || (g_s._mlieu == 22)) { t1sama(); - tmlieu(g_s.mlieu); - } else if (g_s.mlieu == 15) + tmlieu(g_s._mlieu); + } else if (g_s._mlieu == 15) aldepl(); else if (g_ment == 0) g_crep = 997; - else if ((g_ment == 9) && (g_s.derobj != 136)) { + else if ((g_ment == 9) && (g_s._derobj != 136)) { g_crep = 189; - g_s.teauto[8] = '*'; + g_s._teauto[8] = '*'; } else { int z = 0; if (!g_blo) @@ -1146,8 +1151,8 @@ void fctEnter() { aniof(1, 1); tip(z, g_x); - ++g_s.conf; - g_s.mlieu = 15; + ++g_s._conf; + g_s._mlieu = 15; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; g_syn = true; @@ -1166,10 +1171,10 @@ void fctEnter() { parole(7, g_x, 1); aniof(1, 1); - g_s.mlieu = g_ment; + g_s._mlieu = g_ment; affrep(); - debloc(g_s.mlieu); - tmlieu(g_s.mlieu); + debloc(g_s._mlieu); + tmlieu(g_s._mlieu); g_ment = 0; g_mpers = 0; g_ipers = 0; @@ -1184,17 +1189,17 @@ void fctEnter() { void fctSleep() { int z, j, h, m; - if ((g_s.mlieu > 15) && (g_s.mlieu < 26)) { + if ((g_s._mlieu > 15) && (g_s._mlieu < 26)) { g_crep = 148; return; } - if (g_s.mlieu != 0) { + if (g_s._mlieu != 0) { tsort(); - g_s.mlieu = 0; + g_s._mlieu = 0; affrep(); afdes(0); - debloc(g_s.mlieu); - tmlieu(g_s.mlieu); + debloc(g_s._mlieu); + tmlieu(g_s._mlieu); } clsf3(); clsf2(); @@ -1205,7 +1210,7 @@ void fctSleep() { int answer; do { if (h < 8) { - g_s.conf -= (g_s.conf / 20); + g_s._conf -= (g_s._conf / 20); z = (7 - h) * 2; if (m == 30) --z; @@ -1235,11 +1240,11 @@ void fctForce() { tfleche(); if ((!g_anyone) && (!g_iesc)) { - if (g_s.mlieu != 26) + if (g_s._mlieu != 26) g_crep = 997; else { g_crep = 143; - g_s.conf += 2; + g_s._conf += 2; } } } @@ -1251,27 +1256,27 @@ void fctForce() { void fctLeave() { tsort(); g_crep = 0; - if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22) || (g_s.mlieu == 24)) + if ((g_s._mlieu == 19) || (g_s._mlieu == 21) || (g_s._mlieu == 22) || (g_s._mlieu == 24)) g_crep = 997; else { int lx = 0; - if ((g_s.mlieu < 16) || (g_s.mlieu == 26)) + if ((g_s._mlieu < 16) || (g_s._mlieu == 26)) lx = 10; - if ((g_s.mlieu == 10) || (g_s.mlieu == 20)) + if ((g_s._mlieu == 10) || (g_s._mlieu == 20)) lx = 21; - if ((g_s.mlieu < 10) || (g_s.mlieu == 13)) + if ((g_s._mlieu < 10) || (g_s._mlieu == 13)) lx = 15; - if (g_s.mlieu == 16) { + if (g_s._mlieu == 16) { lx = 17; g_crep = 176; } - if (g_s.mlieu == 17) + if (g_s._mlieu == 17) t23coul(lx); - if (g_s.mlieu == 23) + if (g_s._mlieu == 23) lx = 24; if (g_crep != 997) - g_s.mlieu = lx; + g_s._mlieu = lx; g_caff = lx; if (g_crep == 0) g_crep = lx; @@ -1295,12 +1300,12 @@ void fctWait() { ++g_jh; tinke(); if (!g_blo) - t11(g_s.mlieu, quel); + t11(g_s._mlieu, quel); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; - if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) + if ((g_s._mlieu == 13) || (g_s._mlieu == 14)) cavegre(); - if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) + if ((g_s._mlieu > 0) && (g_s._mlieu < 10)) g_anyone = true; g_mpers = g_ipers; if (!g_anyone) @@ -1364,7 +1369,7 @@ void fctDiscuss() { for (int ix = 1; ix <= 46; ++ix) te[ix] = false; for (int ix = 1; ix <= 45; ++ix) { - lib[ix] = deline(ix + c_tparler); + lib[ix] = deline(ix + kQuestionStringIndex); for (i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } @@ -1379,7 +1384,7 @@ void fctDiscuss() { do { ++icm; g_vm->_screenSurface.putxy(co, lig); - if (g_s.teauto[icm] == '*') { + if (g_s._teauto[icm] == '*') { if (te[icm]) writetp(lib[icm], 1); else @@ -1439,7 +1444,7 @@ void fctDiscuss() { writetp(lib[choi], 1); te[choi] = ! te[choi]; } - if ((g_s.teauto[ix] == '*') || (ix == 46)) { + if ((g_s._teauto[ix] == '*') || (ix == 46)) { lig = ((ix - 1) % 23) << 3; if (ix > 23) co = 320; @@ -1462,7 +1467,7 @@ void fctDiscuss() { int ix = choi - 1; if (g_col) { g_col = false; - g_s.mlieu = 15; + g_s._mlieu = 15; if (g_iouv > 0) max = 8; else @@ -1472,14 +1477,14 @@ void fctDiscuss() { suj = 129; else { suj = 138; - g_s.conf += (3 * (g_s.conf / 10)); + g_s._conf += (3 * (g_s._conf / 10)); } - } else if (nbrep[g_caff - 69] < nbrepm[g_caff - 69]) { - suj = tabdon[arep + (ix << 3) + (g_caff - 70)]; - g_s.conf += tabdon[arcf + ix]; - ++nbrep[g_caff - 69]; + } else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) { + suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)]; + g_s._conf += g_tabdon[arcf + ix]; + ++g_nbrep[g_caff - 69]; } else { - g_s.conf += 3; + g_s._conf += 3; suj = 139; } hideMouse(); @@ -1488,17 +1493,17 @@ void fctDiscuss() { sparl(0, suj); showMouse(); if ((suj == 84) || (suj == 86)) { - g_s.pourc[5] = '*'; - g_s.teauto[7] = '*'; + g_s._pourc[5] = '*'; + g_s._teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { for (int indx = 29; indx <= 31; ++indx) - g_s.teauto[indx] = '*'; - g_s.pourc[7] = '*'; + g_s._teauto[indx] = '*'; + g_s._pourc[7] = '*'; } if (suj == 70) { - g_s.pourc[8] = '*'; - g_s.teauto[32] = '*'; + g_s._pourc[8] = '*'; + g_s._teauto[32] = '*'; } hideMouse(); hirs(); @@ -1506,14 +1511,14 @@ void fctDiscuss() { } } while ((choi != 46) && (suj != 138)); if (g_col) { - g_s.conf += (3 * (g_s.conf / 10)); + g_s._conf += (3 * (g_s._conf / 10)); hideMouse(); hirs(); premtet(); sparl(0, 138); showMouse(); g_col = false; - g_s.mlieu = 15; + g_s._mlieu = 15; } g_ctrm = 0; hideMouse(); @@ -1525,7 +1530,7 @@ void fctDiscuss() { drawClock(); affrep(); /* chech;*/ - tmlieu(g_s.mlieu); + tmlieu(g_s._mlieu); clsf3(); } @@ -1601,8 +1606,6 @@ void MortevielleEngine::endGame() { * @remarks Originally called 'tencore' */ void MortevielleEngine::loseGame() { - int answer; - clsf2(); musique(0); tkey1(false); @@ -1616,7 +1619,8 @@ void MortevielleEngine::loseGame() { g_hour = 10; g_day = 0; repon(2, 180); - answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + + int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 96264c8b5d..a586ccf972 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -294,7 +294,7 @@ bool Ques::show() { int rep; int firstOption, lastOption; char key; - rectangle coor[max_rect]; + rectangle coor[kMaxRect]; Common::String choiceArray[15]; int currChoice, prevChoice; @@ -336,19 +336,17 @@ bool Ques::show() { optionPosY += 8; } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - rectangle &with = coor[j]; - - with.x1 = 45 * g_res; - with.x2 = (maxLength * 3 + 55) * g_res; - with.y1 = 27 + j * 8; - with.y2 = 34 + j * 8; - with.enabled = true; + coor[j]._x1 = 45 * g_res; + coor[j]._x2 = (maxLength * 3 + 55) * g_res; + coor[j]._y1 = 27 + j * 8; + coor[j]._y2 = 34 + j * 8; + coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { choiceArray[j] += ' '; } } - coor[lastOption - firstOption + 2].enabled = false; + coor[lastOption - firstOption + 2]._enabled = false; if (g_res == 1) rep = 10; else @@ -366,9 +364,9 @@ bool Ques::show() { CHECK_QUIT0; currChoice = 1; - while (coor[currChoice].enabled && !dans_rect(coor[currChoice])) + while (coor[currChoice]._enabled && !isMouseIn(coor[currChoice])) ++currChoice; - if (coor[currChoice].enabled) { + if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); @@ -469,7 +467,7 @@ void f3f8::aff50(bool drawAni50Fl) { if (drawAni50Fl) ani50(); else - repon(2, c_paroles + 142); + repon(2, kDialogStringIndex + 142); // Draw the f3/f8 dialog draw(); @@ -481,7 +479,7 @@ void f3f8::ani50() { g_crep = animof(2, 1); pictout(adani, g_crep, 63, 12); g_f2_all = (g_res == 1); - repon(2, c_paroles + 143); + repon(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 68fff8aa00..aabbe29528 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -39,35 +39,37 @@ namespace Mortevielle { void copcha() { int i = acha; do { - tabdon[i] = tabdon[i + 390]; + g_tabdon[i] = g_tabdon[i + 390]; ++i; } while (i != acha + 390); } -bool dans_rect(rectangle r) { +/** + * Engine function : Is mouse in a given rect? + * @remarks Originally called 'dans_rect' + */ +bool isMouseIn(rectangle r) { int x, y, c; getMousePos(x, y, c); - if ((x > r.x1) && (x < r.x2) && (y > r.y1) && (y < r.y2)) + if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) return true; return false; } -void outbloc(int n, pattern p, t_nhom pal) { +void outbloc(int n, pattern p, nhom *pal) { int ad = n * 404 + 0xd700; - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p.tax); - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p.tay); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p._tax); + WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p._tay); ad += 4; - for (int i = 1; i <= p.tax; ++i) - for (int j = 1; j <= p.tay; ++j) - mem[(0x6000 * 16) + ad + (j - 1) * p.tax + i - 1] = pal[n].hom[p.des[i][j]]; + for (int i = 1; i <= p._tax; ++i) + for (int j = 1; j <= p._tay; ++j) + mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; } void writepal(int n) { - t_nhom pal; - switch (g_currGraphicalDevice) { case MODE_TANDY: case MODE_EGA: @@ -77,14 +79,19 @@ void writepal(int n) { mem[(0x7000 * 16) + (2 * i) + 1] = tabpal[n][i].y; } break; - case MODE_CGA: + case MODE_CGA: { warning("TODO: If this code is needed, resolve the incompatible types"); -// pal = palcga[n].a; + nhom pal[16]; + for (int i = 0; i < 16; ++i) { + pal[i] = palcga[n]._a[i]; + } +// nhom pal[16] = palcga[n]._a; if (n < 89) - palette(palcga[n].p); + palette(palcga[n]._p); for (int i = 0; i <= 15; ++i) - outbloc(i, tpt[pal[i].n], pal); + outbloc(i, tpt[pal[i]._id], pal); + } break; default: break; @@ -125,13 +132,13 @@ void adzon() { if (!f.open("don.mor")) error("Missing file - don.mor"); - f.read(tabdon, 7 * 256); + f.read(g_tabdon, 7 * 256); f.close(); if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); - f.read(&tabdon[fleche], 1 * 1916); + f.read(&g_tabdon[fleche], 1 * 1916); f.close(); if (!f.open("dec.mor")) diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h index c3df5e5d6c..34e1026f2c 100644 --- a/engines/mortevielle/level15.h +++ b/engines/mortevielle/level15.h @@ -34,8 +34,8 @@ namespace Mortevielle { /* NIVEAU 15 */ extern void copcha(); -extern bool dans_rect(rectangle r); -extern void outbloc(int n, pattern p, t_nhom pal); +extern bool isMouseIn(rectangle r); +extern void outbloc(int n, pattern p, nhom *pal); extern void writepal(int n); extern void pictout(int seg, int dep, int x, int y); // extern int calad(int x, int y); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index ac199594b7..7de738dc28 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -169,7 +169,7 @@ void Menu::displayMenu() { do { // One line after the other msk = 0x80; for (pt = 0; pt <= 7; ++pt) { - if ((lettres[num_letr - 1][ind_tabl] & msk) != 0) { + if ((g_lettres[num_letr - 1][ind_tabl] & msk) != 0) { g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y), color); @@ -208,7 +208,7 @@ void Menu::invers(int ix) { int menuIndex = lo(g_msg4); - g_vm->_screenSurface.putxy(_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + g_vm->_screenSurface.putxy(g_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); switch (g_msg3) { case 1: s = _inventoryStringArray[menuIndex]; @@ -253,9 +253,9 @@ void Menu::invers(int ix) { void Menu::util(int x, int y) { - int ymx = (_menuConstants[g_msg3 - 1][3] << 3) + 16; - int dxcar = _menuConstants[g_msg3 - 1][2]; - int xmn = (_menuConstants[g_msg3 - 1][0] << 2) * g_res; + int ymx = (g_menuConstants[g_msg3 - 1][3] << 3) + 16; + int dxcar = g_menuConstants[g_msg3 - 1][2]; + int xmn = (g_menuConstants[g_msg3 - 1][0] << 2) * g_res; int ix; if (g_res == 1) @@ -289,19 +289,19 @@ void Menu::menuDown(int ii) { g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); // Draw the menu - xco = _menuConstants[ii - 1][0]; - nb_lig = _menuConstants[ii - 1][3]; + xco = g_menuConstants[ii - 1][0]; + nb_lig = g_menuConstants[ii - 1][3]; hideMouse(); - sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); + sauvecr(10, (g_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (g_res == 1) cx = 10; else cx = 6; - xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6; - g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); + xcc = xco + (g_menuConstants[ii - 1][2] * cx) + 6; + g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (g_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (g_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (g_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (g_menuConstants[ii - 1][1] << 1))); g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { @@ -362,7 +362,7 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int xx) { /* debug('menuUp'); */ if (g_test0) { - charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); + charecr(10, (g_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); @@ -475,7 +475,7 @@ void Menu::initMenu() { if (!f.open("menu.mor")) error("Missing file - menufr.mor or menual.mor or menu.mor"); - f.read(lettres, 7 * 24); + f.read(g_lettres, 7 * 24); f.close(); // Ask to swap floppy @@ -488,18 +488,18 @@ void Menu::initMenu() { _moveStringArray[i] = "* "; i = 1; do { - _actionStringArray[i] = deline(i + c_action); + _actionStringArray[i] = deline(i + kMenuActionStringIndex); while (_actionStringArray[i].size() < 10) _actionStringArray[i] += ' '; if (i < 9) { if (i < 6) { - _selfStringArray[i] = deline(i + c_saction); + _selfStringArray[i] = deline(i + kMenuSelfStringIndex); while (_selfStringArray[i].size() < 10) _selfStringArray[i] += ' '; } - _discussStringArray[i] = deline(i + c_dis) + ' '; + _discussStringArray[i] = deline(i + kMenuSayStringIndex) + ' '; } ++i; } while (i != 22); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 20882eb41a..ab3467e89f 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -145,7 +145,7 @@ void text1(int x, int y, int nb, int m) { void initouv() { for (int cx = 1; cx <= 7; ++cx) - touv[cx] = chr(0); + g_touv[cx] = chr(0); } void ecrf1() { @@ -236,11 +236,11 @@ void clsf10() { cod = 544; } g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s.conf < 33) + if (g_s._conf < 33) st = g_vm->getEngineString(S_COOL); - else if (g_s.conf < 66) + else if (g_s._conf < 66) st = g_vm->getEngineString(S_LOURDE); - else if (g_s.conf > 65) + else if (g_s._conf > 65) st = g_vm->getEngineString(S_MALSAINE); co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); @@ -309,7 +309,7 @@ void modobj(int m) { Common::String strp = Common::String(' '); if (m != 500) - strp = deline(m - 501 + c_st41); + strp = deline(m - 501 + kInventoryStringIndex); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); @@ -324,7 +324,7 @@ void modobj2(int m, bool t1, bool t2) { g_tesok = false;; if (m != 500) - strp = deline(m - 501 + c_st41); + strp = deline(m - 501 + kInventoryStringIndex); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); @@ -337,7 +337,7 @@ void repon(int f, int m) { Common::String tmpStr; if ((m > 499) && (m < 563)) { - tmpStr = deline(m - 501 + c_st41); + tmpStr = deline(m - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) g_f2_all = true; @@ -357,12 +357,12 @@ void repon(int f, int m) { ecrf2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) - g_s.teauto[40] = '*'; + g_s._teauto[40] = '*'; if ((m == 104) && (g_caff == 14)) { - g_s.teauto[36] = '*'; - if (g_s.teauto[39] == '*') { - g_s.pourc[3] = '*'; - g_s.teauto[38] = '*'; + g_s._teauto[36] = '*'; + if (g_s._teauto[39] == '*') { + g_s._pourc[3] = '*'; + g_s._teauto[38] = '*'; } } } @@ -377,10 +377,10 @@ void repon(int f, int m) { afftex(tmpStr, 80, 40, 60, 25, i); if (m == 180) - g_s.pourc[6] = '*'; + g_s._pourc[6] = '*'; if (m == 179) - g_s.pourc[10] = '*'; + g_s._pourc[10] = '*'; } if (f == 7) { /* messint */ ecrf7(); @@ -1024,7 +1024,7 @@ void init_nbrepm() { const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; for (int idx = 0; idx < 9; ++idx) - nbrepm[idx] = ipm[idx]; + g_nbrepm[idx] = ipm[idx]; } void phaz(int &haz, int &p, int cf) { @@ -1035,43 +1035,43 @@ void phaz(int &haz, int &p, int cf) { void inzon() { copcha(); - g_s.ipre = false; - g_s.derobj = 0; - g_s.icave = 0; - g_s.iboul = 0; - g_s.ibag = 0; - g_s.ipuit = 0; - g_s.ivier = 0; - g_s.iloic = 136; - g_s.icryp = 141; - g_s.conf = hazard(4, 10); - g_s.mlieu = 21; + g_s._ipre = false; + g_s._derobj = 0; + g_s._icave = 0; + g_s._iboul = 0; + g_s._ibag = 0; + g_s._ipuit = 0; + g_s._ivier = 0; + g_s._iloic = 136; + g_s._icryp = 141; + g_s._conf = hazard(4, 10); + g_s._mlieu = 21; for (int cx = 2; cx <= 6; ++cx) - g_s.sjer[cx] = chr(0); + g_s._sjer[cx] = chr(0); - g_s.sjer[1] = chr(113); - g_s.heure = chr(20); + g_s._sjer[1] = chr(113); + g_s._heure = chr(20); for (int cx = 1; cx <= 10; ++cx) - g_s.pourc[cx] = ' '; + g_s._pourc[cx] = ' '; for (int cx = 1; cx <= 6; ++cx) - g_s.teauto[cx] = '*'; + g_s._teauto[cx] = '*'; for (int cx = 7; cx <= 9; ++cx) - g_s.teauto[cx] = ' '; + g_s._teauto[cx] = ' '; for (int cx = 10; cx <= 28; ++cx) - g_s.teauto[cx] = '*'; + g_s._teauto[cx] = '*'; for (int cx = 29; cx <= 42; ++cx) - g_s.teauto[cx] = ' '; + g_s._teauto[cx] = ' '; - g_s.teauto[33] = '*'; + g_s._teauto[33] = '*'; for (int cx = 1; cx <= 8; ++cx) - nbrep[cx] = 0; + g_nbrep[cx] = 0; init_nbrepm(); } @@ -1079,7 +1079,7 @@ void inzon() { void dprog() { g_li = 21; g_jh = 0; - if (!g_s.ipre) + if (!g_s._ipre) g_blo = true; g_t = ti1; g_mh = readclock(); @@ -1219,7 +1219,7 @@ void pl20(int cf) { void t11(int l11, int &a) { int p, haz; - ecfren(p, haz, g_s.conf, l11); + ecfren(p, haz, g_s._conf, l11); g_li = l11; if ((l11 > 0) && (l11 < 10)) { if (p != -500) { @@ -1251,7 +1251,7 @@ void t11(int l11, int &a) { cpl15(p); if (l11 == 20) cpl20(p, h); - p += g_s.conf; + p += g_s._conf; haz = hazard(1, 100); if (haz > p) { person(); @@ -1274,9 +1274,9 @@ void t11(int l11, int &a) { } void cavegre() { - g_s.conf += 2; - if (g_s.conf > 69) - g_s.conf += (g_s.conf / 10); + g_s._conf += 2; + if (g_s._conf > 69) + g_s._conf += (g_s._conf / 10); clsf3(); ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); @@ -1335,12 +1335,12 @@ void musique(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((g_prebru == 0) && (!g_s.ipre)) { + } else if ((g_prebru == 0) && (!g_s._ipre)) { parole(10, 1, 1); ++g_prebru; } else { bool i = false; - if ((g_s.mlieu == 19) || (g_s.mlieu == 21) || (g_s.mlieu == 22)) { + if ((g_s._mlieu == 19) || (g_s._mlieu == 21) || (g_s._mlieu == 22)) { int haz = hazard(1, 3); if (haz == 2) { haz = hazard(2, 4); @@ -1348,7 +1348,7 @@ void musique(int so) { i = true; } } - if (g_s.mlieu == 20) { + if (g_s._mlieu == 20) { int haz = hazard(1, 2); if (haz == 1) { parole(8, 1, 1); @@ -1356,7 +1356,7 @@ void musique(int so) { } } - if (g_s.mlieu == 24) { + if (g_s._mlieu == 24) { int haz = hazard(1, 2); if (haz == 2) { parole(12, 1, 1); @@ -1364,7 +1364,7 @@ void musique(int so) { } } - if (g_s.mlieu == 23) { + if (g_s._mlieu == 23) { parole(13, 1, 1); i = true; } @@ -1392,24 +1392,24 @@ void dessin(int ad) { ecrf1(); if ((g_caff < 30) || (g_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { - if (ord(touv[cx]) != 0) - aniof(1, ord(touv[cx])); + if (ord(g_touv[cx]) != 0) + aniof(1, ord(g_touv[cx])); } if (g_caff == 13) { - if (g_s.iboul == 141) + if (g_s._iboul == 141) aniof(1, 7); - if (g_s.ibag == 159) + if (g_s._ibag == 159) aniof(1, 6); } - if ((g_caff == 14) && (g_s.icave == 151)) + if ((g_caff == 14) && (g_s._icave == 151)) aniof(1, 2); - if ((g_caff == 17) && (g_s.ivier == 143)) + if ((g_caff == 17) && (g_s._ivier == 143)) aniof(1, 1); - if ((g_caff == 24) && (g_s.ipuit != 0)) + if ((g_caff == 24) && (g_s._ipuit != 0)) aniof(1, 1); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c592ddc996..326010ad8c 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -56,9 +56,9 @@ void tinke() { cx = 0; do { ++cx; - if (nbrepm[cx] != 0) - --nbrepm[cx]; - nbrep[cx] = 0; + if (g_nbrepm[cx] != 0) + --g_nbrepm[cx]; + g_nbrep[cx] = 0; } while (cx != 8); } if ((h > g_hour) || ((h == 0) && (g_hour == 23))) { @@ -67,7 +67,7 @@ void tinke() { drawClock(); cf = 0; for (cx = 1; cx <= 10; ++cx) { - if (g_s.pourc[cx] == '*') + if (g_s._pourc[cx] == '*') ++cf; } @@ -76,18 +76,18 @@ void tinke() { else stpo = chr(cf + 48); - _hintPctMessage = Common::String(d3); - _hintPctMessage += d5; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d1; - _hintPctMessage += stpo; - _hintPctMessage += '0'; - _hintPctMessage += d2; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d6; - _hintPctMessage += d4; + g_hintPctMessage = Common::String(d3); + g_hintPctMessage += d5; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d1; + g_hintPctMessage += stpo; + g_hintPctMessage += '0'; + g_hintPctMessage += d2; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d6; + g_hintPctMessage += d4; } if (m > g_minute) { g_minute = 30; @@ -101,7 +101,7 @@ void tinke() { g_t = ti2; else g_t = ti1; - cf = g_s.conf; + cf = g_s._conf; if ((cf > 33) && (cf < 66)) g_t -= (g_t / 3); @@ -157,7 +157,7 @@ void tinke() { g_mpers = g_ipers; if ((g_mpers == 0) && (g_ipers > 0)) { - if ((g_s.mlieu == 13) || (g_s.mlieu == 14)) { + if ((g_s._mlieu == 13) || (g_s._mlieu == 14)) { cavegre(); } else if (g_ipers == 10) { g_ipers = 0; @@ -186,7 +186,7 @@ void tinke() { nouvp(g_li, cx); g_brt = false; g_hdb = 0; - if ((g_s.mlieu > 0) && (g_s.mlieu < 10)) + if ((g_s._mlieu > 0) && (g_s._mlieu < 10)) g_anyone = true; } } @@ -245,7 +245,7 @@ void tmlieu(int mli) { int i = 1; while ((i < 8) && (v_lieu[i][mli] != 0)) { - nomp = deline(v_lieu[i][mli] + c_tmlieu); + nomp = deline(v_lieu[i][mli] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; g_vm->_menu.menut(g_vm->_menu._moveMenu[i], nomp); @@ -270,12 +270,12 @@ void tlu(int af, int ob) { } void affrep() { - g_caff = g_s.mlieu; - g_crep = g_s.mlieu; + g_caff = g_s._mlieu; + g_crep = g_s._mlieu; } void mfouen() { - tmlieu(g_s.mlieu); + tmlieu(g_s._mlieu); for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(_actionMenu[cx]); @@ -309,19 +309,19 @@ void tperd() { void tsort() { - if ((g_iouv > 0) && (g_s.mlieu != 0)) { - if (g_s.conf < 50) - g_s.conf += 2; + if ((g_iouv > 0) && (g_s._mlieu != 0)) { + if (g_s._conf < 50) + g_s._conf += 2; else - g_s.conf += (g_s.conf / 10); + g_s._conf += (g_s._conf / 10); } for (int cx = 1; cx <= 7; ++cx) - touv[cx] = chr(0); + g_touv[cx] = chr(0); g_ment = 0; g_iouv = 0; g_mchai = 0; - debloc(g_s.mlieu); + debloc(g_s._mlieu); } void st4(int ob) { @@ -359,14 +359,14 @@ void cherjer(int ob, bool &d) { d = false; for (cx = 1; cx <= 6; ++cx) - d = (d || (ord(g_s.sjer[cx]) == ob)); + d = (d || (ord(g_s._sjer[cx]) == ob)); - if (g_s.derobj == ob) + if (g_s._derobj == ob) d = true; } void st1sama() { - g_s.mlieu = 10; + g_s._mlieu = 10; affrep(); } @@ -376,10 +376,10 @@ void modinv() { int cy = 0; for (int cx = 1; cx <= 6; ++cx) - if (g_s.sjer[cx] != chr(0)) { + if (g_s._sjer[cx] != chr(0)) { ++cy; - r = (ord(g_s.sjer[cx]) + 400); - nomp = deline(r - 501 + c_st41); + r = (ord(g_s._sjer[cx]) + 400); + nomp = deline(r - 501 + kInventoryStringIndex); g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); } @@ -396,7 +396,7 @@ void sparl(float adr, float rep) { repint = abs((int)rep); hideMouse(); - Common::String tmpStr = deline(repint + c_paroles); + Common::String tmpStr = deline(repint + kDialogStringIndex); afftex(tmpStr, 230, 4, 65, 24, 5); f3f8::draw(); @@ -414,7 +414,7 @@ void finfouil() { g_fouil = false; g_obpart = false; g_cs = 0; - is = 0; + g_is = 0; mfouen(); } @@ -444,12 +444,11 @@ void ajchai() { int cx = 0; do { ++cx; - } while ((cx <= 9) && (tabdon[cy + cx] != 0)); + } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); - if (tabdon[cy + cx] == 0) { - int lderobj = g_s.derobj; - tabdon[cy + cx] = lderobj; - } else + if (g_tabdon[cy + cx] == 0) + g_tabdon[cy + cx] = g_s._derobj; + else g_crep = 192; } @@ -457,10 +456,10 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(g_s.sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); - if (ord(g_s.sjer[cx]) == 0) { - g_s.sjer[(cx)] = chr(ob); + if (ord(g_s._sjer[cx]) == 0) { + g_s._sjer[(cx)] = chr(ob); modinv(); } else g_crep = 139; @@ -470,7 +469,7 @@ void t1sama() { //Entering manor int j, h, m; calch(j, h, m); - if ((h < 5) && (g_s.mlieu > 18)) { + if ((h < 5) && (g_s._mlieu > 18)) { bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late @@ -478,7 +477,7 @@ void t1sama() { //Entering manor tperd(); } else st1sama(); - } else if (!g_s.ipre) { //Is it your first time? + } else if (!g_s._ipre) { //Is it your first time? g_ipers = 255; affper(g_ipers); g_caff = 77; @@ -494,21 +493,21 @@ void t1sama() { //Entering manor dessine_rouleau(); drawClock(); showMouse(); - g_s.mlieu = 0; + g_s._mlieu = 0; affrep(); t5(10); if (!g_blo) t11(0, m); g_ipers = 0; g_mpers = 0; - g_s.ipre = true; + g_s._ipre = true; /*chech;*/ } else st1sama(); } void t1vier() { - g_s.mlieu = 17; + g_s._mlieu = 17; affrep(); } @@ -519,19 +518,19 @@ void t1neig() { tperd(); } else { g_okdes = true; - g_s.mlieu = 19; + g_s._mlieu = 19; affrep(); } } void t1deva() { g_inei = 0; - g_s.mlieu = 21; + g_s._mlieu = 21; affrep(); } void t1derr() { - g_s.mlieu = 22; + g_s._mlieu = 22; affrep(); } @@ -563,11 +562,11 @@ L1: parole(4, 4, 1); if (g_iouv == 0) - g_s.conf += 2; - else if (g_s.conf < 50) - g_s.conf += 4; + g_s._conf += 2; + else if (g_s._conf < 50) + g_s._conf += 4; else - g_s.conf += 3 * (g_s.conf / 10); + g_s._conf += 3 * (g_s._conf / 10); tsort(); tmlieu(15); int cx; @@ -605,18 +604,18 @@ void tsuiv() { int cy = acha + ((g_mchai - 1) * 10) - 1; int cx = 0; do { - cx = cx + 1; - g_cs = g_cs + 1; + ++cx; + ++g_cs; cl = cy + g_cs; - tbcl = tabdon[cl]; + tbcl = g_tabdon[cl]; } while ((tbcl == 0) && (g_cs <= 9)); if ((tbcl != 0) && (g_cs < 11)) { - is = is + 1; + ++g_is; g_caff = tbcl; g_crep = g_caff + 400; if (g_ipers != 0) - g_s.conf = g_s.conf + 2; + g_s._conf += 2; } else { affrep(); finfouil(); @@ -647,7 +646,7 @@ void tfleche() { } while (!(qust || g_rect || g_anyone)); if (qust && (touch == '\103')) - Alert::show(_hintPctMessage, 1); + Alert::show(g_hintPctMessage, 1); } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_anyone) || (g_rect))); if (touch == '\73') @@ -670,12 +669,12 @@ void tcoord(int sx) { int atdon = amzon + 3; int cy = 0; while (cy < g_caff) { - a += tabdon[atdon]; + a += g_tabdon[atdon]; atdon += 4; ++cy; } - if (tabdon[atdon] == 0) { + if (g_tabdon[atdon] == 0) { g_crep = 997; return; } @@ -683,10 +682,10 @@ void tcoord(int sx) { a += fleche; int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } - ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; if (ib == 0) { g_crep = 997; return; @@ -695,11 +694,11 @@ void tcoord(int sx) { cy = 1; do { cb += 2; - sx = tabdon[a + cb] * g_res; - sy = tabdon[(a + cb + 1)]; + sx = g_tabdon[a + cb] * g_res; + sy = g_tabdon[(a + cb + 1)]; cb += 2; - ix = tabdon[a + cb] * g_res; - iy = tabdon[(a + cb + 1)]; + ix = g_tabdon[a + cb] * g_res; + iy = g_tabdon[(a + cb + 1)]; ++cy; } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); @@ -757,22 +756,22 @@ void treg(int ob) { void avpoing(int &ob) { g_crep = 999; - if (g_s.derobj != 0) - ajjer(g_s.derobj); + if (g_s._derobj != 0) + ajjer(g_s._derobj); if (g_crep != 139) { modobj(ob + 400); - g_s.derobj = ob; + g_s._derobj = ob; ob = 0; } } void rechai(int &ch) { - int cx = g_s.mlieu; + int cx = g_s._mlieu; - if (g_s.mlieu == 16) + if (g_s._mlieu == 16) cx = 14; - ch = tabdon[achai + (cx * 7) + g_num - 1]; + ch = g_tabdon[achai + (cx * 7) + g_num - 1]; } void t23coul(int &l) { @@ -787,7 +786,7 @@ void t23coul(int &l) { } void maivid() { - g_s.derobj = 0; + g_s._derobj = 0; modobj(500); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index dceb5c7d55..4a410f0b81 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -134,7 +134,7 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - _hintPctMessage = deline(580); // You should have noticed %d hints + g_hintPctMessage = deline(580); // You should have noticed %d hints // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -585,7 +585,7 @@ void MortevielleEngine::handleAction() { if (g_choisi && (g_msg[3] == MENU_LOAD)) g_vm->_savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ - temps = Alert::show(_hintPctMessage, 1); + temps = Alert::show(g_hintPctMessage, 1); return; } else if (inkey == '\77') { if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { @@ -622,7 +622,7 @@ void MortevielleEngine::handleAction() { oo = true; if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) { finfouil(); - g_caff = g_s.mlieu; + g_caff = g_s._mlieu; g_crep = 998; } else tsuiv(); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index f26c7051a6..ca88a79da3 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -64,13 +64,13 @@ void initMouse() { int_m = false; if (int_m) { - reg.ax = 0; + reg._ax = 0; intr(0x33, reg); - int_m = (reg.ax == -1); + int_m = (reg._ax == -1); if (int_m) { - reg.ax = 4; - reg.cx = 0; - reg.dx = 0; + reg._ax = 4; + reg._cx = 0; + reg._dx = 0; intr(0x33, reg); } diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 80eeaa7cab..4d54040749 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -134,8 +134,8 @@ Common::String deline(int num) { } else if (!g_vm->_txxFileFl) { wrkStr = g_vm->getGameString(num); } else { - int i = t_rec[num].indis; - byte k = t_rec[num].point; + int i = t_rec[num]._indis; + byte k = t_rec[num]._point; int length = 0; bool endFl = false; char let; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 1ad58ed996..e69e7ae64c 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -78,23 +78,23 @@ void charpal() { error("Missing file - cxx.mor"); for (int j = 0; j <= 90; ++j) { - palcga[j].p = fb.readByte(); + palcga[j]._p = fb.readByte(); for (int i = 0; i <= 15; ++i) { - nhom &with = palcga[j].a[i]; + nhom &with = palcga[j]._a[i]; b = fb.readByte(); - with.n = (uint)b >> 4; - with.hom[0] = ((uint)b >> 2) & 3; - with.hom[1] = b & 3; + with._id = (uint)b >> 4; + with._hom[0] = ((uint)b >> 2) & 3; + with._hom[1] = b & 3; } } - palcga[10].a[9] = palcga[10].a[5]; + palcga[10]._a[9] = palcga[10]._a[5]; for (int j = 0; j <= 14; ++j) { - tpt[j].tax = fb.readByte(); - tpt[j].tay = fb.readByte(); + tpt[j]._tax = fb.readByte(); + tpt[j]._tay = fb.readByte(); for (int i = 1; i <= 20; ++i) for (int k = 1; k <= 20; ++k) - tpt[j].des[i][k] = fb.readByte(); + tpt[j]._des[i][k] = fb.readByte(); } fb.close(); } @@ -134,8 +134,8 @@ void chartex() { inpFile.close(); for (int i = 0; i < (ntpFile.size() / 3); ++i) { - t_rec[i].indis = ntpFile.readSint16LE(); - t_rec[i].point = ntpFile.readByte(); + t_rec[i]._indis = ntpFile.readSint16LE(); + t_rec[i]._point = ntpFile.readByte(); } ntpFile.close(); @@ -187,14 +187,14 @@ void music() { fic.close(); g_vm->_soundManager.decodeMusic(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); - addfix = (float)((tempo_mus - addv[1])) / 256; + addfix = (float)((kTempoMusic - g_addv[1])) / 256; cctable(tbi); fin = false; k = 0; do { fin = keypressed(); - g_vm->_soundManager.musyc(tbi, 9958 , tempo_mus); + g_vm->_soundManager.musyc(tbi, 9958, kTempoMusic); ++k; fin = fin | keypressed() | (k >= 5); } while (!fin); @@ -233,7 +233,7 @@ void charge_cfiph() { error("Missing file - cfiph.mor"); for (int i = 0; i < (f.size() / 2); ++i) - t_cph[i] = f.readSint16LE(); + g_t_cph[i] = f.readSint16LE(); f.close(); } diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 9bfbaaf560..f0d755201f 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -33,15 +33,15 @@ namespace Mortevielle { void spfrac(int wor) { - c3.rep = (uint)wor >> 12; - if ((g_typlec == 0) && (c3.code != 9)) - if (((c3.code > 4) && (c3.val != 20) && (c3.rep != 3) && (c3.rep != 6) && (c3.rep != 9)) || - ((c3.code < 5) && ((c3.val != 19) && (c3.val != 22) && (c3.rep != 4) && (c3.rep != 9)))) { - ++c3.rep; + c3._rep = (uint)wor >> 12; + if ((g_typlec == 0) && (c3._code != 9)) + if (((c3._code > 4) && (c3._val != 20) && (c3._rep != 3) && (c3._rep != 6) && (c3._rep != 9)) || + ((c3._code < 5) && ((c3._val != 19) && (c3._val != 22) && (c3._rep != 4) && (c3._rep != 9)))) { + ++c3._rep; } - c3.freq = ((uint)wor >> 6) & 7; - c3.acc = ((uint)wor >> 9) & 7; + c3._freq = ((uint)wor >> 6) & 7; + c3._acc = ((uint)wor >> 9) & 7; } void charg_car() { @@ -51,31 +51,31 @@ void charg_car() { int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { - c3.val = int_; - c3.code = 5; + c3._val = int_; + c3._code = 5; } else if ((int_ >= 14) && (int_ <= 21)) { - c3.val = int_; - c3.code = 6; + c3._val = int_; + c3._code = 6; } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; - c3.val = int_; - c3.code = typcon[int_]; + c3._val = int_; + c3._code = g_typcon[int_]; } else if ((int_ >= 48) && (int_ <= 56)) { - c3.val = int_ - 22; - c3.code = 4; + c3._val = int_ - 22; + c3._code = 4; } else { switch (int_) { case 60: - c3.val = 32; /* " " */ - c3.code = 9; + c3._val = 32; /* " " */ + c3._code = 9; break; case 61: - c3.val = 46; /* "." */ - c3.code = 9; + c3._val = 46; /* "." */ + c3._code = 9; break; case 62: - c3.val = 35; /* "#" */ - c3.code = 9; + c3._val = 35; /* "#" */ + c3._code = 9; default: break; } @@ -109,7 +109,7 @@ void regenbruit() { int i = offsetb3 + 8590; int j = 0; do { - t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); + g_t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); i += 2; ++j; } while (i < offsetb3 + 8790); @@ -134,7 +134,7 @@ void charge_phbruit() { error("Missing file - phbrui.mor"); for (int i = 1; i <= 3; ++i) - t_cph[i] = f.readSint16LE(); + g_t_cph[i] = f.readSint16LE(); f.close(); } @@ -158,40 +158,40 @@ void trait_car() { byte d3; int d2, i; - switch (c2.code) { + switch (c2._code) { case 9: - if (c2.val != ord('#')) - for (i = 0; i <= c2.rep; ++i) - entroct(c2.val); + 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]; + if (c2._code == 6) + d3 = g_tabdph[(c2._val - 14) << 1]; else d3 = null; - if (c1.code >= 5) { - veracf(c2.acc); - if (c1.code == 9) { + if (c1._code >= 5) { + veracf(c2._acc); + if (c1._code == 9) { entroct(4); if (d3 == null) - entroct(c2.val); + entroct(c2._val); else entroct(d3); entroct(22); } } - switch (c2.rep) { + switch (c2._rep) { case 0: entroct(0); - entroct(c2.val); + entroct(c2._val); if (d3 == null) - if (c3.code == 9) + if (c3._code == 9) entroct(2); else entroct(4); - else if (c3.code == 9) + else if (c3._code == 9) entroct(0); else entroct(1); @@ -199,13 +199,13 @@ void trait_car() { case 4: case 5: case 6: - if (c2.rep != 4) { - i = c2.rep - 5; + if (c2._rep != 4) { + i = c2._rep - 5; do { --i; entroct(0); if (d3 == null) - entroct(c2.val); + entroct(c2._val); else entroct(d3); entroct(3); @@ -213,24 +213,24 @@ void trait_car() { } if (d3 == null) { entroct(4); - entroct(c2.val); + entroct(c2._val); entroct(0); } else { entroct(0); - entroct(c2.val); + entroct(c2._val); entroct(3); } break; case 7: case 8: case 9: - if (c2.rep != 7) { - i = c2.rep - 8; + if (c2._rep != 7) { + i = c2._rep - 8; do { --i; entroct(0); if (d3 == null) - entroct(c2.val); + entroct(c2._val); else entroct(d3); entroct(3); @@ -238,32 +238,32 @@ void trait_car() { } if (d3 == null) { entroct(0); - entroct(c2.val); + entroct(c2._val); entroct(2); } else { entroct(0); - entroct(c2.val); + entroct(c2._val); entroct(0); } break; case 1: case 2: case 3: - if (c2.rep != 1) { - i = c2.rep - 2; + if (c2._rep != 1) { + i = c2._rep - 2; do { --i; entroct(0); if (d3 == null) - entroct(c2.val); + entroct(c2._val); else entroct(d3); entroct(3); } while (i >= 0); } entroct(0); - entroct(c2.val); - if (c3.code == 9) + entroct(c2._val); + if (c3._code == 9) entroct(0); else entroct(1); @@ -275,16 +275,16 @@ void trait_car() { case 2: case 3: - d3 = c2.code + 5; // 7 ou 8 => Corresponding vowel - if (c1.code > 4) { - veracf(c2.acc); - if (c1.code == 9) { + d3 = c2._code + 5; // 7 ou 8 => Corresponding vowel + if (c1._code > 4) { + veracf(c2._acc); + if (c1._code == 9) { entroct(4); entroct(d3); entroct(22); } } - i = c2.rep; + i = c2._rep; assert(i >= 0); if (i != 0) { do { @@ -294,24 +294,24 @@ void trait_car() { entroct(3); } while (i > 0); } - veracf(c3.acc); - if (c3.code == 6) { + veracf(c3._acc); + if (c3._code == 6) { entroct(4); - entroct(tabdph[(c3.val - 14) << 1]); - entroct(c2.val); + entroct(g_tabdph[(c3._val - 14) << 1]); + entroct(c2._val); } else { entroct(4); - if (c3.val == 4) + if (c3._val == 4) entroct(3); else - entroct(c3.val); - entroct(c2.val); + entroct(c3._val); + entroct(c2._val); } break; case 0: case 1: - veracf(c2.acc); - switch (c3.code) { + veracf(c2._acc); + switch (c3._code) { case 2: d2 = 7; break; @@ -319,130 +319,130 @@ void trait_car() { d2 = 8; break; case 6: - d2 = tabdph[(c3.val - 14) << 1]; + d2 = g_tabdph[(c3._val - 14) << 1]; break; case 5: - d2 = c3.val; + d2 = c3._val; break; default: d2 = 10; break; - } // switch c3.code - d2 = d2 * 26 + c2.val; - if (tnocon[d2] == 0) + } // switch c3._code + d2 = d2 * 26 + c2._val; + if (g_tnocon[d2] == 0) d3 = 2; else d3 = 6; - if (c2.rep >= 5) { - c2.rep = c2.rep - 5; + if (c2._rep >= 5) { + c2._rep = c2._rep - 5; d3 = 8 - d3; // Swap 2 and 6 } - if (c2.code == 0) { - i = c2.rep; + if (c2._code == 0) { + i = c2._rep; if (i != 0) { do { --i; entroct(d3); - entroct(c2.val); + entroct(c2._val); entroct(3); } while (i > 0); } entroct(d3); - entroct(c2.val); + entroct(c2._val); entroct(4); } else { entroct(d3); - entroct(c2.val); + entroct(c2._val); entroct(3); - i = c2.rep; + i = c2._rep; if (i != 0) { do { --i; entroct(d3); - entroct(c2.val); + entroct(c2._val); entroct(4); } while (i > 0); } } - if (c3.code == 9) { + if (c3._code == 9) { entroct(d3); - entroct(c2.val); + entroct(c2._val); entroct(5); - } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { - veracf(c3.acc); - switch (c3.code) { + } else if ((c3._code != 0) && (c3._code != 1) && (c3._code != 4)) { + veracf(c3._acc); + switch (c3._code) { case 3: d2 = 8; break; case 6: - d2 = tabdph[(c3.val - 14) << 1]; + d2 = g_tabdph[(c3._val - 14) << 1]; break; case 5: - d2 = c3.val; + d2 = c3._val; break; default: d2 = 7; break; - } // switch c3.code + } // switch c3._code if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) - ++c2.val; + if (g_intcon[c2._val] != 0) + ++c2._val; - if ((c2.val == 17) || (c2.val == 18)) - c2.val = 16; + if ((c2._val == 17) || (c2._val == 18)) + c2._val = 16; entroct(4); entroct(d2); - entroct(c2.val); + entroct(c2._val); } break; case 4: - veracf(c2.acc); - i = c2.rep; + veracf(c2._acc); + i = c2._rep; if (i != 0) { do { --i; entroct(2); - entroct(c2.val); + entroct(c2._val); entroct(3); } while (i > 0); } entroct(2); - entroct(c2.val); + entroct(c2._val); entroct(4); - if (c3.code == 9) { + if (c3._code == 9) { entroct(2); - entroct(c2.val); + entroct(c2._val); entroct(5); - } else if ((c3.code != 0) && (c3.code != 1) && (c3.code != 4)) { - veracf(c3.acc); - switch (c3.code) { + } else if ((c3._code != 0) && (c3._code != 1) && (c3._code != 4)) { + veracf(c3._acc); + switch (c3._code) { case 3: d2 = 8; break; case 6: - d2 = tabdph[(c3.val - 14) << 1]; + d2 = g_tabdph[(c3._val - 14) << 1]; break; case 5: - d2 = c3.val; + d2 = c3._val; break; default: d2 = 7; break; - } // switch c3.code + } // switch c3._code if (d2 == 4) d2 = 3; - if (intcon[c2.val] != 0) - ++c2.val; + if (g_intcon[c2._val] != 0) + ++c2._val; entroct(4); entroct(d2); - entroct(tabdbc[((c2.val - 26) << 1) + 1]); + entroct(g_tabdbc[((c2._val - 26) << 1) + 1]); } break; diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index a96edde281..8d781b74fc 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -38,14 +38,14 @@ namespace Mortevielle { void rot_chariot() { c1 = c2; c2 = c3; - c3.val = 32; - c3.code = 9; + c3._val = 32; + c3._code = 9; } void init_chariot() { - c3.rep = 0; - c3.freq = 0; - c3.acc = 0; + c3._rep = 0; + c3._freq = 0; + c3._acc = 0; rot_chariot(); rot_chariot(); } @@ -55,13 +55,13 @@ void trait_ph() { const int deca[3] = {300, 30, 40}; g_ptr_tcph = g_num_ph - 1; - g_ledeb = swap(t_cph[g_ptr_tcph]) + deca[g_typlec]; - g_lefin = swap(t_cph[g_ptr_tcph + 1]) + deca[g_typlec]; + g_ledeb = swap(g_t_cph[g_ptr_tcph]) + deca[g_typlec]; + g_lefin = swap(g_t_cph[g_ptr_tcph + 1]) + deca[g_typlec]; g_nb_word = g_lefin - g_ledeb; g_ptr_tcph = (uint)g_ledeb >> 1; g_ptr_word = 0; do { - WRITE_LE_UINT16(&mem[adword + g_ptr_word], t_cph[g_ptr_tcph]); + WRITE_LE_UINT16(&mem[adword + g_ptr_word], g_t_cph[g_ptr_tcph]); g_ptr_word += 2; ++g_ptr_tcph; } while (g_ptr_tcph < (int)((uint)g_lefin >> 1)); @@ -95,13 +95,13 @@ void parole(int rep, int ht, int typ) { g_typlec = typ; if (g_typlec != 0) { for (int i = 0; i <= 500; ++i) - savph[i] = t_cph[i]; - tempo = tempo_bruit; + savph[i] = g_t_cph[i]; + tempo = kTempoNoise; } else if (g_haut > 5) - tempo = tempo_f; + tempo = kTempoF; else - tempo = tempo_m; - addfix = (float)((tempo - addv[0])) / 256; + tempo = kTempoM; + addfix = (float)((tempo - g_addv[0])) / 256; cctable(tbi); switch (typ) { case 1: @@ -120,7 +120,7 @@ void parole(int rep, int ht, int typ) { g_vm->_soundManager.litph(tbi, typ, tempo); if (g_typlec != 0) for (int i = 0; i <= 500; ++i) { - t_cph[i] = savph[i]; + g_t_cph[i] = savph[i]; g_mlec = g_typlec; } writepal(g_numpal); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index b34e64aa5a..0731418023 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -100,7 +100,7 @@ void MortevielleEngine::gameLoaded() { g_hdb = 0; g_hfb = 0; g_cs = 0; - is = 0; + g_is = 0; k = 0; g_ment = 0; g_syn = true; @@ -113,7 +113,7 @@ void MortevielleEngine::gameLoaded() { g_iouv = 0; g_dobj = 0; affrep(); - _hintPctMessage = deline(580); + g_hintPctMessage = deline(580); while ((test[k] == false) && (k < 2)) { ++k; @@ -133,10 +133,10 @@ void MortevielleEngine::gameLoaded() { repon(2, g_crep); clsf3(); _endGame = false; - tmlieu(g_s.mlieu); + tmlieu(g_s._mlieu); modinv(); - if (g_s.derobj != 0) - modobj2(g_s.derobj + 400, test[1], test[2]); + if (g_s._derobj != 0) + modobj2(g_s._derobj + 400, test[1], test[2]); else g_tesok = test[1] || test[2]; showMouse(); @@ -153,7 +153,7 @@ void tmaj3() { m = 1; h += j * 24; m += h * 2; - g_s.heure = chr(m); + g_s._heure = chr(m); } void tsitu() { @@ -239,16 +239,16 @@ void tsitu() { } } calch(j, h, m); - if ((((h == 12) || (h == 13) || (h == 19)) && (g_s.mlieu != 10)) || - ((h > 0) && (h < 6) && (g_s.mlieu != 0))) - ++g_s.conf; - if (((g_s.mlieu < 16) || (g_s.mlieu > 19)) && (g_s.mlieu != 23) - && (g_s.mlieu != 0) && (g_s.derobj != 152) && (!g_vm->_loseGame)) { - if ((g_s.conf > 99) && (h > 8) && (h < 16)) { + if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._mlieu != 10)) || + ((h > 0) && (h < 6) && (g_s._mlieu != 0))) + ++g_s._conf; + if (((g_s._mlieu < 16) || (g_s._mlieu > 19)) && (g_s._mlieu != 23) + && (g_s._mlieu != 0) && (g_s._derobj != 152) && (!g_vm->_loseGame)) { + if ((g_s._conf > 99) && (h > 8) && (h < 16)) { g_crep = 1501; tperd(); } - if ((g_s.conf > 99) && (h > 0) && (h < 9)) { + if ((g_s._conf > 99) && (h > 0) && (h < 9)) { g_crep = 1508; tperd(); } @@ -263,7 +263,7 @@ void tsitu() { /* NIVEAU 1 */ void theure() { - g_vj = ord(g_s.heure); + g_vj = ord(g_s._heure); g_vh = g_vj % 48; g_vj /= 48; g_vm__ = g_vh % 2; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 7afaa47da0..cbff7b7d3f 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -49,23 +49,23 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { * Handle saving or loading savegame data */ void SavegameManager::sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(s1.conf); - sz.syncBytes((byte *)&s1.pourc[0], 11); - sz.syncBytes((byte *)&s1.teauto[0], 43); - sz.syncBytes((byte *)&s1.sjer[0], 31); - sz.syncAsSint16LE(s1.mlieu); - sz.syncAsSint16LE(s1.iboul); - sz.syncAsSint16LE(s1.ibag); - sz.syncAsSint16LE(s1.icave); - sz.syncAsSint16LE(s1.ivier); - sz.syncAsSint16LE(s1.ipuit); - sz.syncAsSint16LE(s1.derobj); - sz.syncAsSint16LE(s1.iloic); - sz.syncAsSint16LE(s1.icryp); - sz.syncAsByte(s1.ipre); - sz.syncAsByte(s1.heure); - - sz.syncBytes(bufcha, 391); + sz.syncAsSint16LE(g_s1._conf); + sz.syncBytes((byte *)&g_s1._pourc[0], 11); + sz.syncBytes((byte *)&g_s1._teauto[0], 43); + sz.syncBytes((byte *)&g_s1._sjer[0], 31); + sz.syncAsSint16LE(g_s1._mlieu); + sz.syncAsSint16LE(g_s1._iboul); + sz.syncAsSint16LE(g_s1._ibag); + sz.syncAsSint16LE(g_s1._icave); + sz.syncAsSint16LE(g_s1._ivier); + sz.syncAsSint16LE(g_s1._ipuit); + sz.syncAsSint16LE(g_s1._derobj); + sz.syncAsSint16LE(g_s1._iloic); + sz.syncAsSint16LE(g_s1._icryp); + sz.syncAsByte(g_s1._ipre); + sz.syncAsByte(g_s1._heure); + + sz.syncBytes(g_bufcha, 391); } /** @@ -107,9 +107,9 @@ void SavegameManager::takesav(int n) { Common::Serializer sz(stream, NULL); sync_save(sz); - g_s = s1; + g_s = g_s1; for (i = 0; i <= 389; ++i) - tabdon[i + acha] = bufcha[i]; + g_tabdon[i + acha] = g_bufcha[i]; // Close the stream delete stream; @@ -142,10 +142,10 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { tmaj3(); for (i = 0; i <= 389; ++i) - bufcha[i] = tabdon[i + acha]; - s1 = g_s; - if (s1.mlieu == 26) - s1.mlieu = 15; + g_bufcha[i] = g_tabdon[i + acha]; + g_s1 = g_s; + if (g_s1._mlieu == 26) + g_s1._mlieu = 15; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 8d9e67f818..d49feacedd 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -111,37 +111,37 @@ void taffich() { switch (a) { case 16: - g_s.pourc[9] = '*'; - g_s.teauto[42] = '*'; + g_s._pourc[9] = '*'; + g_s._teauto[42] = '*'; break; case 20: - g_s.teauto[39] = '*'; - if (g_s.teauto[36] == '*') { - g_s.pourc[3] = '*'; - g_s.teauto[38] = '*'; + g_s._teauto[39] = '*'; + if (g_s._teauto[36] == '*') { + g_s._pourc[3] = '*'; + g_s._teauto[38] = '*'; } break; case 24: - g_s.teauto[37] = '*'; + g_s._teauto[37] = '*'; break; case 30: - g_s.teauto[9] = '*'; + g_s._teauto[9] = '*'; break; case 31: - g_s.pourc[4] = '*'; - g_s.teauto[35] = '*'; + g_s._pourc[4] = '*'; + g_s._teauto[35] = '*'; break; case 118: - g_s.teauto[41] = '*'; + g_s._teauto[41] = '*'; break; case 143: - g_s.pourc[1] = '*'; + g_s._pourc[1] = '*'; break; case 150: - g_s.teauto[34] = '*'; + g_s._teauto[34] = '*'; break; case 151: - g_s.pourc[2] = '*'; + g_s._pourc[2] = '*'; break; default: break; @@ -162,15 +162,20 @@ void taffich() { m = 2034; if ((a == 17) && (g_maff == 14)) m = 2018; - if (a > 99) - if ((is == 1) || (is == 0)) + + if (a > 99) { + if ((g_is == 1) || (g_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) && (((g_maff > 69) && (!g_s.ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + + if (((a < 27) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; + messint(m); g_maff = a; if (a == 159) @@ -217,7 +222,7 @@ void taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - mem[(0x7000 * 16) + 2 + (k << 1)] = rang[i]; + mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; alllum[k] = -1; } } @@ -244,11 +249,11 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s.mlieu == 15)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_s._mlieu == 15)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (!g_blo) - t11(g_s.mlieu, cx); + t11(g_s._mlieu, cx); g_mpers = 0; } } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 8873c7e70a..0b8a5d7432 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -37,11 +37,11 @@ namespace Mortevielle { /*------------------------------ CONSTANTS ------------------------------*/ /*---------------------------------------------------------------------------*/ -const byte tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -const byte tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte typcon[26] = {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 byte intcon[26] = {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 byte tnocon[364] = { +const byte g_tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; +const byte g_tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; +const byte g_typcon[26] = {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 byte g_intcon[26] = {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 byte g_tnocon[364] = { 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, @@ -59,7 +59,7 @@ const byte tnocon[364] = { }; -const byte _menuConstants[8][4] = { +const byte g_menuConstants[8][4] = { { 7, 37, 22, 8}, {19, 33, 23, 7}, {31, 89, 10, 21}, @@ -70,9 +70,9 @@ const byte _menuConstants[8][4] = { {62, 25, 13, 5} }; -const byte addv[2] = {8, 8}; +const byte g_addv[2] = {8, 8}; -const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; +const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*---------------------------------------------------------------------------*/ /*------------------------------ VARIABLES ------------------------------*/ @@ -168,21 +168,20 @@ int g_x, g_ptr_word, g_color_txt; -int t_cph[6401]; -byte tabdon[4001]; +int g_t_cph[6401]; +byte g_tabdon[4001]; -Common::String _hintPctMessage; // Provides the % of hints -byte is; -byte mode; +Common::String g_hintPctMessage; // Provides the % of hints +byte g_is; -int nbrep[9]; -int nbrepm[9]; +int g_nbrep[9]; +int g_nbrepm[9]; int g_msg[5]; -byte touv[8]; -sav_chaine g_s, s1; -byte bufcha[391]; +byte g_touv[8]; +sav_chaine g_s, g_s1; +byte g_bufcha[391]; -byte lettres[7][24]; +byte g_lettres[7][24]; byte palher[16]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 3b2e44d843..cff75128de 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -95,27 +95,26 @@ const int offsetb3 = 6; const int null = 255; -const int tempo_mus = 71; -const int tempo_bruit = 78; -const int tempo_f = 80; -const int tempo_m = 89; +const int kTempoMusic = 71; +const int kTempoNoise = 78; +const int kTempoF = 80; +const int kTempoM = 89; const int ti1 = 410; const int ti2 = 250; const int maxti = 7975; const int maxtd = 600; -const int max_rect = 14; - -const int c_repon = 0; -const int c_st41 = 186; -const int c_tparler = 247; -const int c_paroles = 292; -const int c_tmlieu = 435; -const int c_dialpre = 456; -const int c_action = 476; -const int c_saction = 497; -const int c_dis = 502; -const int c_fin = 510; /* => n'existe pas ; si !! */ +const int kMaxRect = 14; + +const int kDescriptionStringIndex = 0; // Unused +const int kInventoryStringIndex = 186; +const int kQuestionStringIndex = 247; +const int kDialogStringIndex = 292; +const int kMenuPlaceStringIndex = 435; +const int kMenuActionStringIndex = 476; +const int kMenuSelfStringIndex = 497; +const int kMenuSayStringIndex = 502; +const int kSecretPassageQuestionStringIndex = 510; // Unusued? const int arega = 0; const int asoul = 154; @@ -128,7 +127,6 @@ const int amzon = 1650; const int fleche = 1758; const int OPCODE_NONE = 0; - enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, @@ -136,73 +134,71 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, OPCODE_SLOOK = 0x405}; -const int max_patt = 20; +const int kMaxPatt = 20; -extern const byte tabdbc[18]; -extern const byte tabdph[16]; -extern const byte typcon[26]; -extern const byte intcon[26]; -extern const byte tnocon[364]; +extern const byte g_tabdbc[18]; +extern const byte g_tabdph[16]; +extern const byte g_typcon[26]; +extern const byte g_intcon[26]; +extern const byte g_tnocon[364]; -extern const byte _menuConstants[8][4]; +extern const byte g_menuConstants[8][4]; -extern const byte addv[2]; +extern const byte g_addv[2]; -extern const byte rang[16]; +extern const byte g_rang[16]; /*---------------------------------------------------------------------------*/ /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ struct sav_chaine { - int conf; - byte pourc[11]; - byte teauto[43]; - byte sjer[31]; - int mlieu, iboul, ibag, icave, ivier, ipuit; - int derobj, iloic, icryp; - bool ipre; - byte heure; + int _conf; + byte _pourc[11]; + byte _teauto[43]; + byte _sjer[31]; + int _mlieu, _iboul, _ibag, _icave, _ivier, _ipuit; + int _derobj, _iloic, _icryp; + bool _ipre; + byte _heure; }; struct registres { - int ax, bx, cx, dx, bp, si, di, ds, es, flags; + int _ax, _bx, _cx, _dx, _bp, _si, _di, _ds, _es, _flags; }; struct ind { - int indis; - byte point; + int _indis; + byte _point; }; struct chariot { - int val, - code, - acc, - freq, - rep; + int _val, + _code, + _acc, + _freq, + _rep; }; struct rectangle { - int x1, x2, y1, y2; - bool enabled; + int _x1, _x2, _y1, _y2; + bool _enabled; }; struct pattern { - byte tay, tax; - byte des[max_patt+1][max_patt+1]; + byte _tay, _tax; + byte _des[kMaxPatt + 1][kMaxPatt + 1]; }; struct nhom { - byte n; /* numero entre 0 et 32 */ - byte hom[4]; + byte _id; /* number betwwen 0 and 32 */ + byte _hom[4]; }; -typedef nhom t_nhom[16]; - struct t_pcga { - byte p; - nhom a[16]; + byte _p; + nhom _a[16]; }; typedef int tablint[256]; @@ -308,21 +304,20 @@ extern int g_x, g_ptr_word, g_color_txt; -extern int t_cph[6401]; -extern byte tabdon[4001]; +extern int g_t_cph[6401]; +extern byte g_tabdon[4001]; -extern Common::String _hintPctMessage; // gives the pct of hints found -extern byte is; -extern byte mode; +extern Common::String g_hintPctMessage; // gives the pct of hints found +extern byte g_is; -extern int nbrep[9]; -extern int nbrepm[9]; +extern int g_nbrep[9]; +extern int g_nbrepm[9]; extern int g_msg[5]; -extern byte touv[8]; -extern sav_chaine g_s, s1; -extern byte bufcha[391]; +extern byte g_touv[8]; +extern sav_chaine g_s, g_s1; +extern byte g_bufcha[391]; -extern byte lettres[7][24]; +extern byte g_lettres[7][24]; extern byte palher[16]; -- cgit v1.2.3 From 2a32c9d1f48f04b46b0d65d43a94f93d56e8307a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Mar 2012 09:12:15 +0100 Subject: MORTEVIELLE: Rename more globals --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/level15.cpp | 35 +++--- engines/mortevielle/level15.h | 6 - engines/mortevielle/mor.cpp | 4 +- engines/mortevielle/mor2.cpp | 10 +- engines/mortevielle/mor2.h | 2 +- engines/mortevielle/mortevielle.cpp | 4 +- engines/mortevielle/mouse.cpp | 60 +++++----- engines/mortevielle/outtext.cpp | 12 +- engines/mortevielle/ovd1.cpp | 74 ++++++------ engines/mortevielle/parole.cpp | 222 ++++++++++++++++++------------------ engines/mortevielle/parole2.cpp | 22 ++-- engines/mortevielle/taffich.cpp | 12 +- engines/mortevielle/var_mor.cpp | 31 +++-- engines/mortevielle/var_mor.h | 31 +++-- 16 files changed, 254 insertions(+), 275 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3108594f40..ce02915208 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -911,7 +911,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &mem[0x7000 * 16 + 2]; + const byte *paletteMap = &g_mem[0x7000 * 16 + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 602d53deb2..72fc6e94aa 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -46,7 +46,7 @@ int testou() { break; case '\26' : if ((g_c_zzz == 1) || (g_c_zzz == 2)) { - zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); ++g_c_zzz; return 61; diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index aabbe29528..444a810b0e 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -61,12 +61,13 @@ bool isMouseIn(rectangle r) { void outbloc(int n, pattern p, nhom *pal) { int ad = n * 404 + 0xd700; - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad], p._tax); - WRITE_LE_UINT16(&mem[0x6000 * 16 + ad + 2], p._tay); + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); ad += 4; - for (int i = 1; i <= p._tax; ++i) + for (int i = 1; i <= p._tax; ++i) { for (int j = 1; j <= p._tay; ++j) - mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; + g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; + } } void writepal(int n) { @@ -75,22 +76,22 @@ void writepal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - mem[(0x7000 * 16) + (2 * i)] = tabpal[n][i].x; - mem[(0x7000 * 16) + (2 * i) + 1] = tabpal[n][i].y; + g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; + g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; } break; case MODE_CGA: { warning("TODO: If this code is needed, resolve the incompatible types"); nhom pal[16]; for (int i = 0; i < 16; ++i) { - pal[i] = palcga[n]._a[i]; + pal[i] = g_palcga[n]._a[i]; } // nhom pal[16] = palcga[n]._a; if (n < 89) - palette(palcga[n]._p); + palette(g_palcga[n]._p); for (int i = 0; i <= 15; ++i) - outbloc(i, tpt[pal[i]._id], pal); + outbloc(i, g_tpt[pal[i]._id], pal); } break; default: @@ -101,15 +102,15 @@ void writepal(int n) { void pictout(int seg, int dep, int x, int y) { GfxSurface surface; - surface.decode(&mem[seg * 16 + dep]); + surface.decode(&g_mem[seg * 16 + dep]); if (g_currGraphicalDevice == MODE_HERCULES) { - mem[0x7000 * 16 + 2] = 0; - mem[0x7000 * 16 + 32] = 15; + g_mem[0x7000 * 16 + 2] = 0; + g_mem[0x7000 * 16 + 32] = 15; } - if ((g_caff != 51) && (READ_LE_UINT16(&mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&mem[0x7000 * 16 + 0x4138], 0x100); + if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); g_vm->_screenSurface.drawPicture(surface, x, y); } @@ -144,7 +145,7 @@ void adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&mem[0x73a2 * 16 + 0], 1 * 1664); + f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); f.close(); } @@ -152,12 +153,12 @@ void adzon() { * Returns the offset within the compressed image data resource of the desired image */ int animof(int ouf, int num) { - int nani = mem[adani * 16 + 1]; + int nani = g_mem[adani * 16 + 1]; int aux = num; if (ouf != 1) aux += nani; - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&mem[adani * 16 + (aux << 1)]); + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); return animof_result; } diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h index 34e1026f2c..2d7c0d47ae 100644 --- a/engines/mortevielle/level15.h +++ b/engines/mortevielle/level15.h @@ -38,16 +38,10 @@ extern bool isMouseIn(rectangle r); extern void outbloc(int n, pattern p, nhom *pal); extern void writepal(int n); extern void pictout(int seg, int dep, int x, int y); -// extern int calad(int x, int y); extern void sauvecr(int y, int dy); extern void charecr(int y, int dy); -// extern int peek(int ad); -// extern int peekw(int ad); -// extern real peekl(int ad); -// extern void procedure poke(int ad, int n); extern void adzon(); extern int animof(int ouf, int num); -// extern void affgd(int offs, int dep, int x, int y); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ab3467e89f..ddfa188d45 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -115,7 +115,7 @@ void dessine(int ad, int x, int y) { void dessine_rouleau() { writepal(89); if (g_currGraphicalDevice == MODE_HERCULES) { - mem[0x7000 * 16 + 14] = 15; + g_mem[0x7000 * 16 + 14] = 15; } hideMouse(); pictout(0x73a2, 0, 0, 0); @@ -1325,7 +1325,7 @@ void aniof(int ouf, int num) { int offset = animof(ouf, num); GfxSurface surface; - surface.decode(&mem[ad * 16 + offset]); + surface.decode(&g_mem[ad * 16 + offset]); g_vm->_screenSurface.drawPicture(surface, 0, 12); ecrf1(); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 326010ad8c..19a9e855a8 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -237,15 +237,15 @@ void tkey1(bool d) { showMouse(); } -void tmlieu(int mli) { +void tmlieu(int roomId) { Common::String nomp; - if (mli == 26) - mli = 15; + if (roomId == 26) + roomId = 15; int i = 1; - while ((i < 8) && (v_lieu[i][mli] != 0)) { - nomp = deline(v_lieu[i][mli] + kMenuPlaceStringIndex); + while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { + nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; g_vm->_menu.menut(g_vm->_menu._moveMenu[i], nomp); diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 8dc0e1a974..64eed71865 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -43,7 +43,7 @@ extern void fenat(char ans); /* NIVEAU 8 */ extern void afdes(int ad); extern void tkey1(bool d); -extern void tmlieu(int mli); +extern void tmlieu(int roomId); /* NIVEAU 7 */ extern void tlu(int af, int ob); extern void affrep(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4a410f0b81..52bb1fe90e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -149,7 +149,7 @@ Common::ErrorCode MortevielleEngine::initialise() { charpal(); charge_cfiph(); charge_cfiec(); - zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); g_c_zzz = 1; init_nbrepm(); initMouse(); @@ -504,7 +504,7 @@ void MortevielleEngine::mainGame() { charge_cfiec(); for (g_crep = 1; g_crep <= g_c_zzz; ++g_crep) - zzuul(&adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); charge_bruit5(); _menu.initMenu(); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index ca88a79da3..4fcbb02fd0 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -60,7 +60,7 @@ void initMouse() { g_vm->setMouseClick(false); m_show = m_arrow; - if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) + if ((READ_LE_UINT16(&g_mem[0xcc]) == 0) && (READ_LE_UINT16(&g_mem[0xce]) == 0)) int_m = false; if (int_m) { @@ -91,10 +91,10 @@ void hideMouse() { int k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { - WRITE_LE_UINT16(&mem[0xb000 * 16 + j], s_s[0][k]); - WRITE_LE_UINT16(&mem[0xb800 * 16 + j + 2], s_s[1][k]); - WRITE_LE_UINT16(&mem[0xba00 * 16 + j], s_s[2][k]); - WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]); + WRITE_LE_UINT16(&g_mem[0xb000 * 16 + j], s_s[0][k]); + WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j + 2], s_s[1][k]); + WRITE_LE_UINT16(&g_mem[0xba00 * 16 + j], s_s[2][k]); + WRITE_LE_UINT16(&g_mem[0xba00 * 16 + j + 2], s_s[3][k]); j += 80; ++k; } while (k < 5); @@ -102,15 +102,15 @@ void hideMouse() { break; case MODE_AMSTRAD1512: for (int i = 0; i <= 3; ++i) { - port[0x3dd] = 1 << i; + g_port[0x3dd] = 1 << i; int k = 0; j = p_o_s; do { if (imp) { - WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j], s_s[i][k]); j += 80 - 0x2000; } else { - WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j], s_s[i][k]); j += 0x2000; } imp = !imp; @@ -119,22 +119,22 @@ void hideMouse() { } break; case MODE_EGA: { - port[0x3c4] = 2; - port[0x3ce] = 8; - port[0x3cf] = 255; + g_port[0x3c4] = 2; + g_port[0x3ce] = 8; + g_port[0x3cf] = 255; int i = 0; do { - port[0x3c5] = 1 << i; + g_port[0x3c5] = 1 << i; int k = 0; j = p_o_s; do { // Useless ? // ps = mem[0xa000 * 16 + j]; - mem[0xa000 * 16 + j] = lo(s_s[i][k]); + g_mem[0xa000 * 16 + j] = lo(s_s[i][k]); // Useless ?? // ps = mem[0xa000 * 16 + j + 1]; - mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); + g_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; } while (k < 8); @@ -146,7 +146,7 @@ void hideMouse() { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (int i = 0; i <= 5; ++i) { for (int k = 0; k <= 3; ++k) - WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } break; @@ -155,8 +155,8 @@ void hideMouse() { int k = 0; do { for (int i = 0; i <= 3; ++i) { - WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); - WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); + WRITE_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); + WRITE_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; ++k; @@ -188,10 +188,10 @@ void showMouse() { k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); do { - s_s[0][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); - s_s[1][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j + 2]); - s_s[2][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j]); - s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]); + s_s[0][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); + s_s[1][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j + 2]); + s_s[2][k] = READ_LE_UINT16(&g_mem[0xba00 * 16 + j]); + s_s[3][k] = READ_LE_UINT16(&g_mem[0xba00 * 16 + j + 2]); j += 80; ++k; } while (k < 5); @@ -200,14 +200,14 @@ void showMouse() { for (i = 0; i <= 3; ++i) { j = p_o_s; imp = odd(y_s); - port[0x3de] = i; + g_port[0x3de] = i; k = 0; do { if (imp) { - s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); j += 80 - 0x2000; } else { - s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); j += 0x2000; } imp = !imp; @@ -216,14 +216,14 @@ void showMouse() { } break; case MODE_EGA: - port[0x3ce] = 4; + g_port[0x3ce] = 4; l = 0; do { - port[0x3cf] = l; + g_port[0x3cf] = l; k = 0; j = p_o_s; do { - s_s[l][k] = mem[0xa000 * 16 + j] + (mem[(0xa000 * 16) + j + 1] << 8); + s_s[l][k] = g_mem[0xa000 * 16 + j] + (g_mem[(0xa000 * 16) + j + 1] << 8); j += 80; ++k; } while (k < 8); @@ -234,7 +234,7 @@ void showMouse() { j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) - s_s[i][k] = READ_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j]); + s_s[i][k] = READ_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j]); j += 80; } break; @@ -243,8 +243,8 @@ void showMouse() { k = 0; do { for (i = 0; i <= 3; ++i) { - s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]); - s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]); + s_s[k][i + (k << 2)] = READ_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j]); + s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j + 2]); } j += 160; ++k; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4d54040749..43a038649f 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -76,13 +76,13 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { uint16 oct, ocd; /* 5-8 */ - oct = t_mot[idx]; + oct = g_t_mot[idx]; oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { ++idx; oct = oct << (5 - pt); pt += 11; - oct = oct | ((uint)t_mot[idx] >> pt); + oct = oct | ((uint)g_t_mot[idx] >> pt); } else { pt -= 5; oct = (uint)oct >> pt; @@ -95,13 +95,13 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { break; case 30: case 31: - ocd = t_mot[idx]; + ocd = g_t_mot[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { ++idx; ocd = ocd << (5 - pt); pt += 11; - ocd = ocd | ((uint)t_mot[idx] >> pt); + ocd = ocd | ((uint)g_t_mot[idx] >> pt); } else { pt -= 5; ocd = (uint)ocd >> pt; @@ -134,8 +134,8 @@ Common::String deline(int num) { } else if (!g_vm->_txxFileFl) { wrkStr = g_vm->getGameString(num); } else { - int i = t_rec[num]._indis; - byte k = t_rec[num]._point; + int i = g_t_rec[num]._indis; + byte k = g_t_rec[num]._point; int length = 0; bool endFl = false; char let; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index e69e7ae64c..303323590c 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -68,8 +68,8 @@ void charpal() { error("Missing file - plxx.mor"); for (int i = 0; i <= 90; ++i) { for (int j = 1; j <= 16; ++j) { - tabpal[i][j].x = f.readByte(); - tabpal[i][j].y = f.readByte(); + g_tabpal[i][j].x = f.readByte(); + g_tabpal[i][j].y = f.readByte(); } } f.close(); @@ -78,9 +78,9 @@ void charpal() { error("Missing file - cxx.mor"); for (int j = 0; j <= 90; ++j) { - palcga[j]._p = fb.readByte(); + g_palcga[j]._p = fb.readByte(); for (int i = 0; i <= 15; ++i) { - nhom &with = palcga[j]._a[i]; + nhom &with = g_palcga[j]._a[i]; b = fb.readByte(); with._id = (uint)b >> 4; @@ -88,13 +88,13 @@ void charpal() { with._hom[1] = b & 3; } } - palcga[10]._a[9] = palcga[10]._a[5]; + g_palcga[10]._a[9] = g_palcga[10]._a[5]; for (int j = 0; j <= 14; ++j) { - tpt[j]._tax = fb.readByte(); - tpt[j]._tay = fb.readByte(); + g_tpt[j]._tax = fb.readByte(); + g_tpt[j]._tay = fb.readByte(); for (int i = 1; i <= 20; ++i) for (int k = 1; k <= 20; ++k) - tpt[j]._des[i][k] = fb.readByte(); + g_tpt[j]._des[i][k] = fb.readByte(); } fb.close(); } @@ -112,35 +112,29 @@ void chartex() { if (!inpFile.open("TXX.INP")) { if (!inpFile.open("TXX.MOR")) { warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; } - } - - if (!ntpFile.open("TXX.NTP")) { - if (!ntpFile.open("TXX.IND")) { - warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); - return; - } - } - - if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { + } else if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { warning("TXX file - Unexpected format - Switching to DAT file"); return; + } else { + for (int i = 0; i < inpFile.size() / 2; ++i) + g_t_mot[i] = inpFile.readUint16LE(); + + inpFile.close(); + g_vm->_txxFileFl = true; } - for (int i = 0; i < inpFile.size() / 2; ++i) - t_mot[i] = inpFile.readUint16LE(); - - inpFile.close(); + if (!ntpFile.open("TXX.NTP")) { + error("Missing file - TXX.NTP"); + } for (int i = 0; i < (ntpFile.size() / 3); ++i) { - t_rec[i]._indis = ntpFile.readSint16LE(); - t_rec[i]._point = ntpFile.readByte(); + g_t_rec[i]._indis = ntpFile.readSint16LE(); + g_t_rec[i]._point = ntpFile.readByte(); } ntpFile.close(); - g_vm->_txxFileFl = true; } /** @@ -154,17 +148,17 @@ void dialpre() { } void init_lieu() { - Common::File f_lieu; // tab_mlieu + Common::File f; - /* debug('o3 init_lieu'); */ - if (!f_lieu.open("MXX.mor")) + if (!f.open("MXX.mor")) error("Missing file - MXX.mor"); - for (int i = 1; i < 8; ++i) + for (int i = 1; i < 8; ++i) { for (int j = 0; j < 25; ++j) - v_lieu[i][j] = f_lieu.readByte(); + g_v_lieu[i][j] = f.readByte(); + } - f_lieu.close(); + f.close(); } @@ -182,19 +176,19 @@ void music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&mem[0x3800 * 16 + 0], 500); - fic.read(&mem[0x47a0 * 16 + 0], 123); + fic.read(&g_mem[0x3800 * 16 + 0], 500); + fic.read(&g_mem[0x47a0 * 16 + 0], 123); fic.close(); - g_vm->_soundManager.decodeMusic(&mem[0x3800 * 16], &mem[0x5000 * 16], 623); - addfix = (float)((kTempoMusic - g_addv[1])) / 256; - cctable(tbi); + g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); + g_addfix = (float)((kTempoMusic - g_addv[1])) / 256; + cctable(g_tbi); fin = false; k = 0; do { fin = keypressed(); - g_vm->_soundManager.musyc(tbi, 9958, kTempoMusic); + g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic); ++k; fin = fin | keypressed() | (k >= 5); } while (!fin); @@ -209,7 +203,7 @@ void charge_bruit5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&mem[adbruit5 * 16 + 0], 149 * 128); + f.read(&g_mem[adbruit5 * 16 + 0], 149 * 128); f.close(); } @@ -219,7 +213,7 @@ void charge_cfiec() { if (!f.open("cfiec.mor")) error("Missing file - cfiec.mor"); - f.read(&adcfiec[0], 822 * 128); + f.read(&g_adcfiec[0], 822 * 128); f.close(); g_rech_cfiec = false; diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index f0d755201f..8974b45977 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -33,49 +33,49 @@ namespace Mortevielle { void spfrac(int wor) { - c3._rep = (uint)wor >> 12; - if ((g_typlec == 0) && (c3._code != 9)) - if (((c3._code > 4) && (c3._val != 20) && (c3._rep != 3) && (c3._rep != 6) && (c3._rep != 9)) || - ((c3._code < 5) && ((c3._val != 19) && (c3._val != 22) && (c3._rep != 4) && (c3._rep != 9)))) { - ++c3._rep; + g_c3._rep = (uint)wor >> 12; + if ((g_typlec == 0) && (g_c3._code != 9)) + if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || + ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { + ++g_c3._rep; } - c3._freq = ((uint)wor >> 6) & 7; - c3._acc = ((uint)wor >> 9) & 7; + g_c3._freq = ((uint)wor >> 6) & 7; + g_c3._acc = ((uint)wor >> 9) & 7; } void charg_car() { int wor, int_; - wor = swap(READ_LE_UINT16(&mem[adword + g_ptr_word])); + wor = swap(READ_LE_UINT16(&g_mem[adword + g_ptr_word])); int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { - c3._val = int_; - c3._code = 5; + g_c3._val = int_; + g_c3._code = 5; } else if ((int_ >= 14) && (int_ <= 21)) { - c3._val = int_; - c3._code = 6; + g_c3._val = int_; + g_c3._code = 6; } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; - c3._val = int_; - c3._code = g_typcon[int_]; + g_c3._val = int_; + g_c3._code = g_typcon[int_]; } else if ((int_ >= 48) && (int_ <= 56)) { - c3._val = int_ - 22; - c3._code = 4; + g_c3._val = int_ - 22; + g_c3._code = 4; } else { switch (int_) { case 60: - c3._val = 32; /* " " */ - c3._code = 9; + g_c3._val = 32; /* " " */ + g_c3._code = 9; break; case 61: - c3._val = 46; /* "." */ - c3._code = 9; + g_c3._val = 46; /* "." */ + g_c3._code = 9; break; case 62: - c3._val = 35; /* "#" */ - c3._code = 9; + g_c3._val = 35; /* "#" */ + g_c3._code = 9; default: break; } @@ -87,7 +87,7 @@ void charg_car() { void entroct(byte o) { - mem[adtroct * 16 + g_ptr_oct] = o; + g_mem[adtroct * 16 + g_ptr_oct] = o; ++g_ptr_oct; } @@ -100,7 +100,7 @@ void cctable(tablint &t) { tb[0] = 0; for (int k = 0; k <= 255; ++k) { - tb[k + 1] = addfix + tb[k]; + tb[k + 1] = g_addfix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } @@ -109,7 +109,7 @@ void regenbruit() { int i = offsetb3 + 8590; int j = 0; do { - g_t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]); + g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); i += 2; ++j; } while (i < offsetb3 + 8790); @@ -121,9 +121,9 @@ void charge_son() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&mem[0x7414 * 16 + 0], 273); + f.read(&g_mem[0x7414 * 16 + 0], 273); - g_vm->_soundManager.decodeMusic(&mem[0x7414 * 16], &mem[adson * 16], 273); + g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); f.close(); } @@ -146,10 +146,10 @@ void charge_bruit() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&mem[adbruit * 16 + 0], 250); + f.read(&g_mem[adbruit * 16 + 0], 250); for (i = 0; i <= 19013; ++i) - mem[adbruit * 16 + 32000 + i] = mem[adbruit5 + i]; - f.read(&mem[adbruit1 * 16 + offsetb1], 149); + g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; + f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); f.close(); } @@ -158,40 +158,40 @@ void trait_car() { byte d3; int d2, i; - switch (c2._code) { + switch (g_c2._code) { case 9: - if (c2._val != ord('#')) - for (i = 0; i <= c2._rep; ++i) - entroct(c2._val); + if (g_c2._val != ord('#')) + for (i = 0; i <= g_c2._rep; ++i) + entroct(g_c2._val); break; case 5: case 6: - if (c2._code == 6) - d3 = g_tabdph[(c2._val - 14) << 1]; + if (g_c2._code == 6) + d3 = g_tabdph[(g_c2._val - 14) << 1]; else d3 = null; - if (c1._code >= 5) { - veracf(c2._acc); - if (c1._code == 9) { + if (g_c1._code >= 5) { + veracf(g_c2._acc); + if (g_c1._code == 9) { entroct(4); if (d3 == null) - entroct(c2._val); + entroct(g_c2._val); else entroct(d3); entroct(22); } } - switch (c2._rep) { + switch (g_c2._rep) { case 0: entroct(0); - entroct(c2._val); + entroct(g_c2._val); if (d3 == null) - if (c3._code == 9) + if (g_c3._code == 9) entroct(2); else entroct(4); - else if (c3._code == 9) + else if (g_c3._code == 9) entroct(0); else entroct(1); @@ -199,13 +199,13 @@ void trait_car() { case 4: case 5: case 6: - if (c2._rep != 4) { - i = c2._rep - 5; + if (g_c2._rep != 4) { + i = g_c2._rep - 5; do { --i; entroct(0); if (d3 == null) - entroct(c2._val); + entroct(g_c2._val); else entroct(d3); entroct(3); @@ -213,24 +213,24 @@ void trait_car() { } if (d3 == null) { entroct(4); - entroct(c2._val); + entroct(g_c2._val); entroct(0); } else { entroct(0); - entroct(c2._val); + entroct(g_c2._val); entroct(3); } break; case 7: case 8: case 9: - if (c2._rep != 7) { - i = c2._rep - 8; + if (g_c2._rep != 7) { + i = g_c2._rep - 8; do { --i; entroct(0); if (d3 == null) - entroct(c2._val); + entroct(g_c2._val); else entroct(d3); entroct(3); @@ -238,32 +238,32 @@ void trait_car() { } if (d3 == null) { entroct(0); - entroct(c2._val); + entroct(g_c2._val); entroct(2); } else { entroct(0); - entroct(c2._val); + entroct(g_c2._val); entroct(0); } break; case 1: case 2: case 3: - if (c2._rep != 1) { - i = c2._rep - 2; + if (g_c2._rep != 1) { + i = g_c2._rep - 2; do { --i; entroct(0); if (d3 == null) - entroct(c2._val); + entroct(g_c2._val); else entroct(d3); entroct(3); } while (i >= 0); } entroct(0); - entroct(c2._val); - if (c3._code == 9) + entroct(g_c2._val); + if (g_c3._code == 9) entroct(0); else entroct(1); @@ -275,16 +275,16 @@ void trait_car() { case 2: case 3: - d3 = c2._code + 5; // 7 ou 8 => Corresponding vowel - if (c1._code > 4) { - veracf(c2._acc); - if (c1._code == 9) { + d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel + if (g_c1._code > 4) { + veracf(g_c2._acc); + if (g_c1._code == 9) { entroct(4); entroct(d3); entroct(22); } } - i = c2._rep; + i = g_c2._rep; assert(i >= 0); if (i != 0) { do { @@ -294,24 +294,24 @@ void trait_car() { entroct(3); } while (i > 0); } - veracf(c3._acc); - if (c3._code == 6) { + veracf(g_c3._acc); + if (g_c3._code == 6) { entroct(4); - entroct(g_tabdph[(c3._val - 14) << 1]); - entroct(c2._val); + entroct(g_tabdph[(g_c3._val - 14) << 1]); + entroct(g_c2._val); } else { entroct(4); - if (c3._val == 4) + if (g_c3._val == 4) entroct(3); else - entroct(c3._val); - entroct(c2._val); + entroct(g_c3._val); + entroct(g_c2._val); } break; case 0: case 1: - veracf(c2._acc); - switch (c3._code) { + veracf(g_c2._acc); + switch (g_c3._code) { case 2: d2 = 7; break; @@ -319,66 +319,66 @@ void trait_car() { d2 = 8; break; case 6: - d2 = g_tabdph[(c3._val - 14) << 1]; + d2 = g_tabdph[(g_c3._val - 14) << 1]; break; case 5: - d2 = c3._val; + d2 = g_c3._val; break; default: d2 = 10; break; } // switch c3._code - d2 = d2 * 26 + c2._val; + d2 = (d2 * 26) + g_c2._val; if (g_tnocon[d2] == 0) d3 = 2; else d3 = 6; - if (c2._rep >= 5) { - c2._rep = c2._rep - 5; + if (g_c2._rep >= 5) { + g_c2._rep = g_c2._rep - 5; d3 = 8 - d3; // Swap 2 and 6 } - if (c2._code == 0) { - i = c2._rep; + if (g_c2._code == 0) { + i = g_c2._rep; if (i != 0) { do { --i; entroct(d3); - entroct(c2._val); + entroct(g_c2._val); entroct(3); } while (i > 0); } entroct(d3); - entroct(c2._val); + entroct(g_c2._val); entroct(4); } else { entroct(d3); - entroct(c2._val); + entroct(g_c2._val); entroct(3); - i = c2._rep; + i = g_c2._rep; if (i != 0) { do { --i; entroct(d3); - entroct(c2._val); + entroct(g_c2._val); entroct(4); } while (i > 0); } } - if (c3._code == 9) { + if (g_c3._code == 9) { entroct(d3); - entroct(c2._val); + entroct(g_c2._val); entroct(5); - } else if ((c3._code != 0) && (c3._code != 1) && (c3._code != 4)) { - veracf(c3._acc); - switch (c3._code) { + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { case 3: d2 = 8; break; case 6: - d2 = g_tabdph[(c3._val - 14) << 1]; + d2 = g_tabdph[(g_c3._val - 14) << 1]; break; case 5: - d2 = c3._val; + d2 = g_c3._val; break; default: d2 = 7; @@ -387,47 +387,47 @@ void trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[c2._val] != 0) - ++c2._val; + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; - if ((c2._val == 17) || (c2._val == 18)) - c2._val = 16; + if ((g_c2._val == 17) || (g_c2._val == 18)) + g_c2._val = 16; entroct(4); entroct(d2); - entroct(c2._val); + entroct(g_c2._val); } break; case 4: - veracf(c2._acc); - i = c2._rep; + veracf(g_c2._acc); + i = g_c2._rep; if (i != 0) { do { --i; entroct(2); - entroct(c2._val); + entroct(g_c2._val); entroct(3); } while (i > 0); } entroct(2); - entroct(c2._val); + entroct(g_c2._val); entroct(4); - if (c3._code == 9) { + if (g_c3._code == 9) { entroct(2); - entroct(c2._val); + entroct(g_c2._val); entroct(5); - } else if ((c3._code != 0) && (c3._code != 1) && (c3._code != 4)) { - veracf(c3._acc); - switch (c3._code) { + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { case 3: d2 = 8; break; case 6: - d2 = g_tabdph[(c3._val - 14) << 1]; + d2 = g_tabdph[(g_c3._val - 14) << 1]; break; case 5: - d2 = c3._val; + d2 = g_c3._val; break; default: d2 = 7; @@ -437,12 +437,12 @@ void trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[c2._val] != 0) - ++c2._val; + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; entroct(4); entroct(d2); - entroct(g_tabdbc[((c2._val - 26) << 1) + 1]); + entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); } break; diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 8d781b74fc..3682dc99d0 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -36,16 +36,16 @@ namespace Mortevielle { void rot_chariot() { - c1 = c2; - c2 = c3; - c3._val = 32; - c3._code = 9; + g_c1 = g_c2; + g_c2 = g_c3; + g_c3._val = 32; + g_c3._code = 9; } void init_chariot() { - c3._rep = 0; - c3._freq = 0; - c3._acc = 0; + g_c3._rep = 0; + g_c3._freq = 0; + g_c3._acc = 0; rot_chariot(); rot_chariot(); } @@ -61,7 +61,7 @@ void trait_ph() { g_ptr_tcph = (uint)g_ledeb >> 1; g_ptr_word = 0; do { - WRITE_LE_UINT16(&mem[adword + g_ptr_word], g_t_cph[g_ptr_tcph]); + WRITE_LE_UINT16(&g_mem[adword + g_ptr_word], g_t_cph[g_ptr_tcph]); g_ptr_word += 2; ++g_ptr_tcph; } while (g_ptr_tcph < (int)((uint)g_lefin >> 1)); @@ -101,8 +101,8 @@ void parole(int rep, int ht, int typ) { tempo = kTempoF; else tempo = kTempoM; - addfix = (float)((tempo - g_addv[0])) / 256; - cctable(tbi); + g_addfix = (float)((tempo - g_addv[0])) / 256; + cctable(g_tbi); switch (typ) { case 1: charge_bruit(); @@ -117,7 +117,7 @@ void parole(int rep, int ht, int typ) { break; } trait_ph(); - g_vm->_soundManager.litph(tbi, typ, tempo); + g_vm->_soundManager.litph(g_tbi, typ, tempo); if (g_typlec != 0) for (int i = 0; i <= 500; ++i) { g_t_cph[i] = savph[i]; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index d49feacedd..6e9a66ce30 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -52,7 +52,7 @@ void chardes(Common::String filename, int32 skipSize, int length) { int totalLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (totalLength > 0) { - f.read(&mem[memIndx], 128); + f.read(&g_mem[memIndx], 128); testfi(); totalLength -= 128; memIndx += 128; @@ -60,7 +60,7 @@ void chardes(Common::String filename, int32 skipSize, int length) { f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - mem[0x7000 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; + g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; } void charani(Common::String filename, int32 skipSize, int length) { @@ -80,7 +80,7 @@ void charani(Common::String filename, int32 skipSize, int length) { int fullLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (fullLength > 0) { - f.read(&mem[memIndx], 128); + f.read(&g_mem[memIndx], 128); testfi(); fullLength -= 128; memIndx += 128; @@ -88,7 +88,7 @@ void charani(Common::String filename, int32 skipSize, int length) { f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - mem[0x7314 * 16 + i - remainingSkipSize] = mem[0x6000 * 16 + i]; + g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; } void taffich() { @@ -214,7 +214,7 @@ void taffich() { chardes(filename, lgt, handle); if (g_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&mem[(0x7000 * 16) + ((i + 1) << 1)]); + int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -222,7 +222,7 @@ void taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; + g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0b8a5d7432..7b27e243a9 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -183,24 +183,19 @@ byte g_bufcha[391]; byte g_lettres[7][24]; -byte palher[16]; - -uint16 t_mot[maxti + 1]; -int tay_tchar; -ind t_rec[maxtd + 1]; -//file sauv_t; -//untyped_file fibyte; -byte v_lieu[8][25]; +uint16 g_t_mot[maxti + 1]; +int g_tay_tchar; +ind g_t_rec[maxtd + 1]; +byte g_v_lieu[8][25]; int g_l[108]; -int tbi[256]; -chariot c1, c2, c3; -float addfix; -t_pcga palsav[91]; -Common::Point tabpal[91][17]; -t_pcga palcga[91]; -pattern tpt[15]; +int g_tbi[256]; +chariot g_c1, g_c2, g_c3; +float g_addfix; +Common::Point g_tabpal[91][17]; +t_pcga g_palcga[91]; +pattern g_tpt[15]; -byte adcfiec[(4088 * 16) + (311 * 0x80)]; +byte g_adcfiec[(4088 * 16) + (311 * 0x80)]; /*---------------------------------------------------------------------------*/ /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ @@ -236,8 +231,8 @@ Common::String copy(const Common::String &s, int idx, size_t size) { /*------------------------------ STUBS ------------------------------*/ /*---------------------------------------------------------------------------*/ -int port[0xfff]; -byte mem[65536 * 16]; +int g_port[0xfff]; +byte g_mem[65536 * 16]; void intr(int intNum, registres ®s) { warning("STUBBED: Call to DOS interrupt #%d", intNum); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index cff75128de..5fd5f235f4 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -319,24 +319,19 @@ extern byte g_bufcha[391]; extern byte g_lettres[7][24]; -extern byte palher[16]; - -extern uint16 t_mot[maxti + 1]; -extern int tay_tchar; -extern ind t_rec[maxtd + 1]; -//file sauv_t; -//untyped_file fibyte; -extern byte v_lieu[8][25]; +extern uint16 g_t_mot[maxti + 1]; +extern int g_tay_tchar; +extern ind g_t_rec[maxtd + 1]; +extern byte g_v_lieu[8][25]; extern int g_l[108]; -extern int tbi[256]; -extern chariot c1, c2, c3; -extern float addfix; -extern t_pcga palsav[91]; -extern Common::Point tabpal[91][17]; -extern t_pcga palcga[91]; -extern pattern tpt[15]; +extern int g_tbi[256]; +extern chariot g_c1, g_c2, g_c3; +extern float g_addfix; +extern Common::Point g_tabpal[91][17]; +extern t_pcga g_palcga[91]; +extern pattern g_tpt[15]; -extern byte adcfiec[822 * 128]; +extern byte g_adcfiec[822 * 128]; /*---------------------------------------------------------------------------*/ /*------------------- PROCEDURES AND FONCTIONS ------------------------*/ @@ -351,8 +346,8 @@ void Val(const Common::String &s, int &V, int Code); /*---------------------------------------------------------------------------*/ // TODO: Replace the following with proper implementations, or refactor out the code using them -extern int port[0xfff]; -extern byte mem[65536 * 16]; +extern int g_port[0xfff]; +extern byte g_mem[65536 * 16]; #define hires {} -- cgit v1.2.3 From 8948be3b2ec000b6f1c0ed1e74480f3af6ade348 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Mar 2012 18:18:32 +0100 Subject: MORTEVIELLE: Refactor KnowledgeCheck --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/dialogs.cpp | 34 +++++++++++++++++----------------- engines/mortevielle/dialogs.h | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 8441315bd7..fcecc9b77a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -699,7 +699,7 @@ void fctPlace() { Alert::show(alertTxt, 1); g_tesok = false; - bool enterPassageFl = Ques::show(); + bool enterPassageFl = KnowledgeCheck::show(); hideMouse(); hirs(); dessine_rouleau(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index a586ccf972..42e726e66e 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -285,9 +285,9 @@ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::Stri /** * Questions asked before entering the hidden passage */ -bool Ques::show() { - const int textIndexArr[11] = {0, 511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; - const int correctAnswerArr[11] = {0, 4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; +bool KnowledgeCheck::show() { + const int textIndexArr[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; + const int correctAnswerArr[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; int optionPosY; int maxLength; @@ -302,11 +302,10 @@ bool Ques::show() { int correctCount = 0; bool protectionCheck = false; - do { + for (indx = 0; indx < 10; ++indx) { hideMouse(); hirs(); showMouse(); - ++indx; int dialogHeight; if (g_res == 1) dialogHeight = 29; @@ -316,7 +315,7 @@ bool Ques::show() { Common::String tmpStr = deline(textIndexArr[indx]); afftex(tmpStr, 20, 15, 100, 2, 0); - if (indx != 10) { + if (indx != 9) { firstOption = textIndexArr[indx] + 1; lastOption = textIndexArr[indx + 1] - 1; } else { @@ -335,6 +334,7 @@ bool Ques::show() { choiceArray[prevChoice] = tmpStr; optionPosY += 8; } + for (int j = 1; j <= lastOption - firstOption + 1; ++j) { coor[j]._x1 = 45 * g_res; coor[j]._x2 = (maxLength * 3 + 55) * g_res; @@ -388,19 +388,19 @@ bool Ques::show() { ++correctCount; else { // Skip questions that may give hints on previous wrong answer - if (indx == 5) + if (indx == 4) ++indx; - - if ((indx == 7) || (indx == 8)) - indx = 10; - } - if (indx == 10) { - warning("Skipping protection check: testprot()"); - protectionCheck = true; - // tesok is set to true in testprot() - g_tesok = true; + else if ((indx == 6) || (indx == 7)) + indx = 9; } - } while (indx != 10); + } + + if (correctCount == 10) { + warning("Skipping protection check: testprot()"); + protectionCheck = true; + // tesok is set to true in testprot() + g_tesok = true; + } return (correctCount == 10) && protectionCheck; } diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 661c544b13..c3f33e899c 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -44,7 +44,7 @@ public: static int show(const Common::String &s, int n); }; -class Ques { +class KnowledgeCheck { public: static bool show(); }; -- cgit v1.2.3 From 47a00c8257767ca2212e28975eb3ca0acc4ba03e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Mar 2012 18:27:08 +0100 Subject: MORTEVIELLE: Properly remove protection checks --- engines/mortevielle/actions.cpp | 2 -- engines/mortevielle/dialogs.cpp | 14 ++------------ engines/mortevielle/menu.cpp | 4 ---- engines/mortevielle/mor.cpp | 20 -------------------- engines/mortevielle/mor.h | 2 -- engines/mortevielle/mortevielle.cpp | 1 - engines/mortevielle/prog.cpp | 5 +---- engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 1 - 9 files changed, 3 insertions(+), 47 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index fcecc9b77a..67c9562fb0 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -698,7 +698,6 @@ void fctPlace() { Common::String alertTxt = deline(582); Alert::show(alertTxt, 1); - g_tesok = false; bool enterPassageFl = KnowledgeCheck::show(); hideMouse(); hirs(); @@ -732,7 +731,6 @@ void fctPlace() { } else { aniof(2, 1); g_crep = 166; - g_tesok = true; } return; } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 42e726e66e..b50c6e9f37 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -298,11 +298,9 @@ bool KnowledgeCheck::show() { Common::String choiceArray[15]; int currChoice, prevChoice; - int indx = 0; int correctCount = 0; - bool protectionCheck = false; - for (indx = 0; indx < 10; ++indx) { + for (int indx = 0; indx < 10; ++indx) { hideMouse(); hirs(); showMouse(); @@ -358,7 +356,6 @@ bool KnowledgeCheck::show() { warning("Expected answer: %d", correctAnswerArr[indx]); do { g_vm->setMouseClick(false); - g_tesok = false; bool flag; moveMouse(flag, key); CHECK_QUIT0; @@ -395,14 +392,7 @@ bool KnowledgeCheck::show() { } } - if (correctCount == 10) { - warning("Skipping protection check: testprot()"); - protectionCheck = true; - // tesok is set to true in testprot() - g_tesok = true; - } - - return (correctCount == 10) && protectionCheck; + return (correctCount == 10); } /*------------------------------------------------------------------------*/ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 7de738dc28..3abe06aa11 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,10 +48,6 @@ void Menu::menut(int no, Common::String name) { byte l = lo(no); Common::String s = name; - if (!g_tesok) - g_vm->quitGame(); - - while (s.size() < 20) s += ' '; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ddfa188d45..d27c1357f5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -301,10 +301,6 @@ void conv(int x, int &y) { } /* NIVEAU 12 */ -void okpas() { - g_tesok = true; -} - void modobj(int m) { Common::String strp = Common::String(' '); @@ -315,22 +311,6 @@ void modobj(int m) { g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); } -void modobj2(int m, bool t1, bool t2) { - Common::String strp = Common::String(' '); - - if (t1 || t2) - okpas(); - else - g_tesok = false;; - - if (m != 500) - strp = deline(m - 501 + kInventoryStringIndex); - - g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); -} - - void repon(int f, int m) { Common::String str_; Common::String str1; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 0351bd0b7c..afb9963fa7 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -58,9 +58,7 @@ extern int hazard(int min, int max); extern void calch(int &j, int &h, int &m); extern void conv(int x, int &y); /* NIVEAU 12 */ -extern void okpas(); extern void modobj(int m); -extern void modobj2(int m, bool t1, bool t2); extern void repon(int f, int m); extern void t5(int cx); extern void affper(int per); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 52bb1fe90e..2347fa0a4a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -145,7 +145,6 @@ Common::ErrorCode MortevielleEngine::initialise() { g_currGraphicalDevice = MODE_EGA; g_newGraphicalDevice = g_currGraphicalDevice; g_zuul = false; - g_tesok = false; charpal(); charge_cfiph(); charge_cfiec(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 0731418023..5ceb0d447e 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -83,7 +83,6 @@ void MortevielleEngine::gameLoaded() { test[1] = false; g[0] = '\040'; g_col = false; - g_tesok = true; test[2] = false; g[7] = g[0]; g[2] = 'A'; @@ -136,9 +135,7 @@ void MortevielleEngine::gameLoaded() { tmlieu(g_s._mlieu); modinv(); if (g_s._derobj != 0) - modobj2(g_s._derobj + 400, test[1], test[2]); - else - g_tesok = test[1] || test[2]; + modobj(g_s._derobj + 400); showMouse(); } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 7b27e243a9..98d629a6e6 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -103,7 +103,6 @@ bool g_blo, g_syn, g_fouil, g_zuul, - g_tesok, g_obpart, g_okdes, g_arret, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 5fd5f235f4..f1a332fad3 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -240,7 +240,6 @@ extern bool g_blo, g_syn, g_fouil, g_zuul, - g_tesok, g_obpart, g_okdes, g_anyone, -- cgit v1.2.3 From e92369be21638bf2daa94aa8c8b52faf5a3afe00 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Mar 2012 10:17:27 +0100 Subject: MORTEVIELLE: Rename some variables and functions related to 'Search' action --- engines/mortevielle/actions.cpp | 60 ++++++++++++++++++------------------- engines/mortevielle/dialogs.cpp | 10 +++---- engines/mortevielle/mor.cpp | 22 +++++++------- engines/mortevielle/mor2.cpp | 44 +++++++++++++++++---------- engines/mortevielle/mor2.h | 6 ++-- engines/mortevielle/mortevielle.cpp | 4 +-- engines/mortevielle/outtext.cpp | 28 ++++++++--------- engines/mortevielle/outtext.h | 2 +- engines/mortevielle/prog.cpp | 26 +++++----------- engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.cpp | 2 +- engines/mortevielle/var_mor.h | 4 +-- 12 files changed, 106 insertions(+), 104 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 67c9562fb0..1edf1cd9c7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -207,7 +207,7 @@ void fctTake() { g_s._ivier = 0; if (g_s._mlieu == 24) g_s._ipuit = 0; - mfouen(); + unsetSearchMenu(); g_obpart = false; affrep(); } else { @@ -377,10 +377,10 @@ void fctRead() { * @remarks Originally called 'tslire' */ void fctSelfRead() { - if (g_s._derobj == 0) + if (g_s._selectedObjectId == 0) g_crep = 186; else - st4(g_s._derobj); + st4(g_s._selectedObjectId); } /** @@ -466,8 +466,8 @@ void fctLook() { * @remarks Originally called 'tsregarder' */ void fctSelftLook() { - if (g_s._derobj != 0) - treg(g_s._derobj); + if (g_s._selectedObjectId != 0) + treg(g_s._selectedObjectId); else g_crep = 186; } @@ -515,8 +515,8 @@ void fctSearch() { if (g_mchai != 0) { g_cs = 0; g_is = 0; - g_fouil = true; - mfoudi(); + g_heroSearching = true; + setSearchMenu(); tsuiv(); } else g_crep = 997; @@ -570,8 +570,8 @@ void fctSearch() { * @remarks Originally called 'tsfouiller' */ void fctSelfSearch() { - if (g_s._derobj != 0) - st7(g_s._derobj); + if (g_s._selectedObjectId != 0) + st7(g_s._selectedObjectId); else g_crep = 186; } @@ -643,7 +643,7 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - if (g_s._derobj == 0) { + if (g_s._selectedObjectId == 0) { g_crep = 186; return; } @@ -666,15 +666,15 @@ void fctPlace() { if (g_s._iboul != 0) { g_crep = 188; } else { - g_s._iboul = g_s._derobj; - if (g_s._derobj == 141) + g_s._iboul = g_s._selectedObjectId; + if (g_s._selectedObjectId == 141) aniof(1, 7); } } else if (g_s._ibag != 0) { g_crep = 188; } else { - g_s._ibag = g_s._derobj; - if (g_s._derobj == 159) + g_s._ibag = g_s._selectedObjectId; + if (g_s._selectedObjectId == 159) aniof(1, 6); } } @@ -683,8 +683,8 @@ void fctPlace() { if (g_s._icave != 0) { g_crep = 188; } else { - g_s._icave = g_s._derobj; - if (g_s._derobj == 151) { + g_s._icave = g_s._selectedObjectId; + if (g_s._selectedObjectId == 151) { // Open hidden passage aniof(1, 2); aniof(1, 1); @@ -739,7 +739,7 @@ void fctPlace() { if (g_caff == 16) { if (g_s._icryp == 0) - g_s._icryp = g_s._derobj; + g_s._icryp = g_s._selectedObjectId; else g_crep = 188; } @@ -747,7 +747,7 @@ void fctPlace() { if (g_caff == 17) { if (g_s._ivier != 0) { g_crep = 188; - } else if (g_s._derobj == 143) { + } else if (g_s._selectedObjectId == 143) { g_s._ivier = 143; aniof(1, 1); } else { @@ -759,8 +759,8 @@ void fctPlace() { if (g_caff == 24) { if (g_s._ipuit != 0) { g_crep = 188; - } else if ((g_s._derobj == 140) || (g_s._derobj == 120)) { - g_s._ipuit = g_s._derobj; + } else if ((g_s._selectedObjectId == 140) || (g_s._selectedObjectId == 120)) { + g_s._ipuit = g_s._selectedObjectId; aniof(1, 1); } else { g_crep = 185; @@ -836,7 +836,7 @@ void fctSelfHide() { * @remarks Originally called 'tattacher' */ void fctAttach() { - if (g_s._derobj == 0) + if (g_s._selectedObjectId == 0) g_crep = 186; else { if (!g_syn) @@ -847,8 +847,8 @@ void fctAttach() { g_crep = 997; if ((g_num != 0) && (g_s._mlieu == 24)) { g_crep = 999; - if ((g_s._derobj == 120) || (g_s._derobj == 140)) { - g_s._ipuit = g_s._derobj; + if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) { + g_s._ipuit = g_s._selectedObjectId; aniof(1, 1); } else g_crep = 185; @@ -953,7 +953,7 @@ void fctKnock() { void fctSelfPut() { if (!g_syn) ecr3(g_vm->getEngineString(S_POSE)); - if (g_s._derobj == 0) + if (g_s._selectedObjectId == 0) g_crep = 186; else { if (g_caff > 99) { @@ -993,7 +993,7 @@ void fctSelfPut() { if (g_s._iloic != 0) g_crep = 188; else - g_s._iloic = g_s._derobj; + g_s._iloic = g_s._selectedObjectId; } if (g_caff == 13) { @@ -1001,11 +1001,11 @@ void fctSelfPut() { if (g_s._iboul != 0) g_crep = 188; else - g_s._iboul = g_s._derobj; + g_s._iboul = g_s._selectedObjectId; } else if (g_s._ibag != 0) { g_crep = 188; } else { - g_s._ibag = g_s._derobj; + g_s._ibag = g_s._selectedObjectId; } } @@ -1013,7 +1013,7 @@ void fctSelfPut() { if (g_s._icryp != 0) g_crep = 188; else - g_s._icryp = g_s._derobj; + g_s._icryp = g_s._selectedObjectId; } if (g_caff == 24) @@ -1133,7 +1133,7 @@ void fctEnter() { aldepl(); else if (g_ment == 0) g_crep = 997; - else if ((g_ment == 9) && (g_s._derobj != 136)) { + else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) { g_crep = 189; g_s._teauto[8] = '*'; } else { @@ -1344,7 +1344,7 @@ void fctDiscuss() { Common::String lib[47]; bool f; - finfouil(); + endSearch(); if (g_col) suj = 128; else { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b50c6e9f37..d538774842 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -311,7 +311,7 @@ bool KnowledgeCheck::show() { dialogHeight = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = deline(textIndexArr[indx]); - afftex(tmpStr, 20, 15, 100, 2, 0); + displayStr(tmpStr, 20, 15, 100, 2, 0); if (indx != 9) { firstOption = textIndexArr[indx] + 1; @@ -328,7 +328,7 @@ bool KnowledgeCheck::show() { tmpStr = deline(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); - afftex(tmpStr, 100, optionPosY, 100, 1, 0); + displayStr(tmpStr, 100, optionPosY, 100, 1, 0); choiceArray[prevChoice] = tmpStr; optionPosY += 8; } @@ -366,16 +366,16 @@ bool KnowledgeCheck::show() { if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; - afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { tmpStr = choiceArray[currChoice] + '$'; - afftex(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); + displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { tmpStr = choiceArray[prevChoice] + '$'; - afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } } while (!((prevChoice != 0) && g_vm->getMouseClick())); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index d27c1357f5..2cb44c7ddf 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -140,7 +140,7 @@ void text1(int x, int y, int nb, int m) { Common::String tmpStr = deline(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; - afftex(tmpStr, x, y, nb, 20, g_color_txt); + displayStr(tmpStr, x, y, nb, 20, g_color_txt); } void initouv() { @@ -325,7 +325,7 @@ void repon(int f, int m) { g_f2_all = false; clsf2(); - afftex(tmpStr, 8, 176, 85, 3, 5); + displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); if (f == 8) @@ -354,7 +354,7 @@ void repon(int f, int m) { i = 5; tmpStr = deline(m); - afftex(tmpStr, 80, 40, 60, 25, i); + displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) g_s._pourc[6] = '*'; @@ -366,21 +366,21 @@ void repon(int f, int m) { ecrf7(); tmpStr = deline(m); - int xco, dx, caspe; + int xSmallStr, xLargeStr, dx; if (g_res == 1) { - xco = 252 - tmpStr.size() * 5; - caspe = 100; + xSmallStr = 252 - tmpStr.size() * 5; + xLargeStr = 100; dx = 80; } else { - xco = 252 - tmpStr.size() * 3; - caspe = 144; + xSmallStr = 252 - tmpStr.size() * 3; + xLargeStr = 144; dx = 50; } if (tmpStr.size() < 40) - afftex(tmpStr, xco, 86, dx, 3, 5); + displayStr(tmpStr, xSmallStr, 86, dx, 3, 5); else - afftex(tmpStr, caspe, 86, dx, 3, 5); + displayStr(tmpStr, xLargeStr, 86, dx, 3, 5); } } } @@ -1016,7 +1016,7 @@ void inzon() { copcha(); g_s._ipre = false; - g_s._derobj = 0; + g_s._selectedObjectId = 0; g_s._icave = 0; g_s._iboul = 0; g_s._ibag = 0; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 19a9e855a8..0d6069b4d5 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -274,7 +274,11 @@ void affrep() { g_crep = g_s._mlieu; } -void mfouen() { +/** + * Engine function - Switch action menu from "Search" mode back to normal mode + * @remarks Originally called 'mfouen' + */ +void unsetSearchMenu() { tmlieu(g_s._mlieu); for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(_actionMenu[cx]); @@ -290,7 +294,7 @@ void tperd() { g_ment = 0; g_iouv = 0; g_mchai = 0; - mfouen(); + unsetSearchMenu(); if (!g_blo) { int cx; t11(21, cx); @@ -361,7 +365,7 @@ void cherjer(int ob, bool &d) { for (cx = 1; cx <= 6; ++cx) d = (d || (ord(g_s._sjer[cx]) == ob)); - if (g_s._derobj == ob) + if (g_s._selectedObjectId == ob) d = true; } @@ -397,7 +401,7 @@ void sparl(float adr, float rep) { repint = abs((int)rep); hideMouse(); Common::String tmpStr = deline(repint + kDialogStringIndex); - afftex(tmpStr, 230, 4, 65, 24, 5); + displayStr(tmpStr, 230, 4, 65, 24, 5); f3f8::draw(); key = 0; @@ -410,15 +414,23 @@ void sparl(float adr, float rep) { showMouse(); } -void finfouil() { - g_fouil = false; +/** + * Engine function - End of Search: reset globals + * @remarks Originally called 'finfouill' + */ +void endSearch() { + g_heroSearching = false; g_obpart = false; g_cs = 0; g_is = 0; - mfouen(); + unsetSearchMenu(); } -void mfoudi() { +/** + * Engine function - Switch action menu to "Search" mode + * @remarks Originally called 'mfoudi' + */ +void setSearchMenu() { for (int cx = 1; cx <= 7; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); @@ -447,7 +459,7 @@ void ajchai() { } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_s._derobj; + g_tabdon[cy + cx] = g_s._selectedObjectId; else g_crep = 192; } @@ -549,7 +561,7 @@ void quelquun() { if (g_imen) g_vm->_menu.eraseMenu(); - finfouil(); + endSearch(); g_crep = 997; L1: if (!g_cache) { @@ -618,7 +630,7 @@ void tsuiv() { g_s._conf += 2; } else { affrep(); - finfouil(); + endSearch(); if (cx > 9) g_crep = 131; } @@ -750,18 +762,18 @@ void treg(int ob) { } else { g_obpart = true; g_crep = g_caff + 400; - mfoudi(); + setSearchMenu(); } } void avpoing(int &ob) { g_crep = 999; - if (g_s._derobj != 0) - ajjer(g_s._derobj); + if (g_s._selectedObjectId != 0) + ajjer(g_s._selectedObjectId); if (g_crep != 139) { modobj(ob + 400); - g_s._derobj = ob; + g_s._selectedObjectId = ob; ob = 0; } } @@ -786,7 +798,7 @@ void t23coul(int &l) { } void maivid() { - g_s._derobj = 0; + g_s._selectedObjectId = 0; modobj(500); } diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h index 64eed71865..910791303f 100644 --- a/engines/mortevielle/mor2.h +++ b/engines/mortevielle/mor2.h @@ -47,7 +47,7 @@ extern void tmlieu(int roomId); /* NIVEAU 7 */ extern void tlu(int af, int ob); extern void affrep(); -extern void mfouen(); +extern void unsetSearchMenu(); /* NIVEAU 6 */ extern void tperd(); extern void tsort(); @@ -56,8 +56,8 @@ extern void cherjer(int ob, bool &d); extern void st1sama(); extern void modinv(); extern void sparl(float adr, float rep); -extern void finfouil(); -extern void mfoudi(); +extern void endSearch(); +extern void setSearchMenu(); extern void mennor(); extern void premtet(); /* NIVEAU 5 */ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 2347fa0a4a..51f0d95c8e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -613,14 +613,14 @@ void MortevielleEngine::handleAction() { if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) g_mnumo = g_msg[4]; if (!g_anyone) { - if ((g_fouil) || (g_obpart)) { + if ((g_heroSearching) || (g_obpart)) { if (y_s < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { oo = true; if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) { - finfouil(); + endSearch(); g_caff = g_s._mlieu; g_crep = 998; } else diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 43a038649f..02c03b8668 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -163,16 +163,18 @@ static int l_motsuiv(int p, const char *ch, int &tab) { return tab * (p - c); } -void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { - bool the_end; +/** + * Engine function - Display Text + * @remarks Originally called 'afftex' + */ +void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) { int tab; Common::String s; int i, j; // Safeguard: add $ just in case - ch += '$'; + inputStr += '$'; - /* debug(' .. Afftex');*/ g_vm->_screenSurface.putxy(x, y); if (g_res == 1) tab = 10; @@ -184,12 +186,11 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { int yc = y; int xf = x + dx; int yf = y + dy; -// int p = 1; int p = 0; - the_end = (ch[p] == '$'); + bool stringParsed = (inputStr[p] == '$'); s = ""; - while (!the_end) { - switch (ch[p]) { + while (!stringParsed) { + switch (inputStr[p]) { case '@': g_vm->_screenSurface.writeg(s, typ); s = ""; @@ -202,15 +203,14 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { s += ' '; xc += tab; ++p; - if (l_motsuiv(p, ch.c_str(), tab) + xc > xf) { + if (l_motsuiv(p, inputStr.c_str(), tab) + xc > xf) { g_vm->_screenSurface.writeg(s, typ); s = ""; xc = x; yc += 6; if (yc > yf) { - do { + while (!keypressed()) ; - } while (!keypressed()); i = y; do { j = x; @@ -227,15 +227,15 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) { } break; case '$': - the_end = true; + stringParsed = true; g_vm->_screenSurface.writeg(s, typ); break; default: - s += ch[p]; + s += inputStr[p]; ++p; xc += tab; break; - } /* case */ + } } } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index d2e5f6bd3b..55e0ec5aab 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -33,7 +33,7 @@ namespace Mortevielle { extern Common::String deline(int num); -extern void afftex(Common::String ch, int x, int y, int dx, int dy, int typ); +extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 5ceb0d447e..85a5f140bb 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -70,7 +70,6 @@ void changeGraphicalDevice(int newDevice) { */ void MortevielleEngine::gameLoaded() { int k; - bool test[3]; char g[8]; hideMouse(); @@ -79,11 +78,8 @@ void MortevielleEngine::gameLoaded() { _loseGame = true; g_anyone = false; g_okdes = true; - test[0] = false; - test[1] = false; g[0] = '\040'; g_col = false; - test[2] = false; g[7] = g[0]; g[2] = 'A'; g_cache = false; @@ -103,7 +99,7 @@ void MortevielleEngine::gameLoaded() { k = 0; g_ment = 0; g_syn = true; - g_fouil = true; + g_heroSearching = true; g_mchai = 0; g_inei = 0; initouv(); @@ -113,18 +109,12 @@ void MortevielleEngine::gameLoaded() { g_dobj = 0; affrep(); g_hintPctMessage = deline(580); - while ((test[k] == false) && (k < 2)) { - ++k; - // Original read in the boot sector here of each drive and did some calculations - - // presumably for copy protection. This has been replaced with hardcoded success - test[k] = true; + g_okdes = false; + _endGame = true; + _loseGame = false; + g_heroSearching = false; - g_okdes = false; - _endGame = true; - _loseGame = false; - g_fouil = false; - } person(); tinke(); drawClock(); @@ -134,8 +124,8 @@ void MortevielleEngine::gameLoaded() { _endGame = false; tmlieu(g_s._mlieu); modinv(); - if (g_s._derobj != 0) - modobj(g_s._derobj + 400); + if (g_s._selectedObjectId != 0) + modobj(g_s._selectedObjectId + 400); showMouse(); } @@ -240,7 +230,7 @@ void tsitu() { ((h > 0) && (h < 6) && (g_s._mlieu != 0))) ++g_s._conf; if (((g_s._mlieu < 16) || (g_s._mlieu > 19)) && (g_s._mlieu != 23) - && (g_s._mlieu != 0) && (g_s._derobj != 152) && (!g_vm->_loseGame)) { + && (g_s._mlieu != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { if ((g_s._conf > 99) && (h > 8) && (h < 16)) { g_crep = 1501; tperd(); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index cbff7b7d3f..53a147c86c 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -59,7 +59,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_s1._icave); sz.syncAsSint16LE(g_s1._ivier); sz.syncAsSint16LE(g_s1._ipuit); - sz.syncAsSint16LE(g_s1._derobj); + sz.syncAsSint16LE(g_s1._selectedObjectId); sz.syncAsSint16LE(g_s1._iloic); sz.syncAsSint16LE(g_s1._icryp); sz.syncAsByte(g_s1._ipre); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 98d629a6e6..e668a6d678 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -101,7 +101,7 @@ bool g_blo, g_iesc, g_col, g_syn, - g_fouil, + g_heroSearching, g_zuul, g_obpart, g_okdes, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index f1a332fad3..a9652cee5d 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -158,7 +158,7 @@ struct sav_chaine { byte _teauto[43]; byte _sjer[31]; int _mlieu, _iboul, _ibag, _icave, _ivier, _ipuit; - int _derobj, _iloic, _icryp; + int _selectedObjectId, _iloic, _icryp; bool _ipre; byte _heure; }; @@ -238,7 +238,7 @@ extern bool g_blo, g_iesc, g_col, g_syn, - g_fouil, + g_heroSearching, g_zuul, g_obpart, g_okdes, -- cgit v1.2.3 From 27a5ce90e3e61360e05a9f298f1be4da7b5c9859 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Mar 2012 22:21:03 +1100 Subject: MORTEVIELLE: Replaced mort.dat with latest generated dat file --- dists/engine-data/mort.dat | Bin 1799 -> 51315 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index b2caafee96..2f31c0a7d9 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 0d814bba1f3f3755185dd40f85c46665f5d4f320 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Mar 2012 20:50:39 +0100 Subject: MORTEVIELLE: Start using place names (as enums) instead of magic values --- engines/mortevielle/actions.cpp | 200 ++++++++++++++++++++-------------------- engines/mortevielle/mor.cpp | 8 +- engines/mortevielle/mor2.cpp | 18 ++-- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.h | 26 ++++-- 6 files changed, 132 insertions(+), 124 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1edf1cd9c7..1520edef14 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -50,12 +50,12 @@ void fctMove() { int cx; if ((g_s._mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - g_s._mlieu = 15; + g_s._mlieu = LANDING; g_caff = g_s._mlieu; afdes(0); repon(2, g_s._mlieu); } - if ((g_s._mlieu == 15) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s._mlieu == LANDING) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { if (!g_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); @@ -67,10 +67,10 @@ void fctMove() { if (g_num == 0) return; if (g_num == 1) { - g_s._mlieu = 0; + g_s._mlieu = OWN_ROOM; tmlieu(0); } else if (g_num == 7) { - g_s._mlieu = 13; + g_s._mlieu = ATTIC; tmlieu(13); } else if (g_num != 6) g_s._mlieu = 26; @@ -90,7 +90,7 @@ void fctMove() { ++cx; } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); - if (g_s._mlieu == 19) { + if (g_s._mlieu == MOUNTAIN) { if (cx == 1) t1deva(); if (cx == 2) @@ -106,43 +106,43 @@ void fctMove() { goto L2; } - if ((g_s._mlieu == 11) && (cx == 1)) + if ((g_s._mlieu == BUREAU) && (cx == 1)) cx = 6; - if (g_s._mlieu == 12) { + if (g_s._mlieu == KITCHEN) { if (cx == 2) cx = 6; if (cx == 5) cx = 16; } - if ((g_s._mlieu == 14) && (cx == 3)) + if ((g_s._mlieu == CELLAR) && (cx == 3)) cx = 6; - if (((g_s._mlieu == 15) || (g_s._mlieu == 26)) && (cx == 4)) + if (((g_s._mlieu == LANDING) || (g_s._mlieu == 26)) && (cx == 4)) cx = 6; - if ((g_s._mlieu > 19) && (g_s._mlieu != 26)) + if ((g_s._mlieu > MOUNTAIN) && (g_s._mlieu != 26)) cx += 10; - if ((g_s._mlieu == 20) && (cx == 13)) + if ((g_s._mlieu == CHAPEL) && (cx == 13)) cx = 16; - if (g_s._mlieu == 21) { + if (g_s._mlieu == MANOR_FRONT) { if (cx == 12) cx = 16; else if (cx > 13) cx = 15; } - if ((g_s._mlieu == 22) && (cx > 14)) + if ((g_s._mlieu == MANOR_BACK) && (cx > 14)) cx = 15; - if ((g_s._mlieu == 24) && (cx != 17)) + if ((g_s._mlieu == WELL) && (cx != 17)) if (cx > 13) cx = 15; if (cx == 1) - g_s._mlieu = 11; + g_s._mlieu = BUREAU; else if (cx == 2) - g_s._mlieu = 12; + g_s._mlieu = KITCHEN; else if (cx == 3) - g_s._mlieu = 14; + g_s._mlieu = CELLAR; else if (cx == 4) - g_s._mlieu = 15; + g_s._mlieu = LANDING; else if (cx == 5) cx = 12; if (cx == 6) @@ -152,9 +152,9 @@ void fctMove() { else if (cx == 12) t1deva(); else if (cx == 13) - g_s._mlieu = 20; + g_s._mlieu = CHAPEL; else if (cx == 14) - g_s._mlieu = 24; + g_s._mlieu = WELL; else if (cx == 15) t1neig(); else if (cx == 16) @@ -191,21 +191,21 @@ void fctTake() { if (g_ipers > 0) g_s._conf += 3; if (g_obpart) { - if (g_s._mlieu == 2) + if (g_s._mlieu == PURPLE_ROOM) g_s._iloic = 0; - if (g_s._mlieu == 13) { + if (g_s._mlieu == ATTIC) { if (g_s._iboul == g_caff) g_s._iboul = 0; if (g_s._ibag == g_caff) g_s._ibag = 0; } - if (g_s._mlieu == 14) + if (g_s._mlieu == CELLAR) g_s._icave = 0; - if (g_s._mlieu == 16) + if (g_s._mlieu == CRYPT) g_s._icryp = 0; - if (g_s._mlieu == 17) + if (g_s._mlieu == SECRET_PASSAGE) g_s._ivier = 0; - if (g_s._mlieu == 24) + if (g_s._mlieu == WELL) g_s._ipuit = 0; unsetSearchMenu(); g_obpart = false; @@ -235,39 +235,39 @@ void fctTake() { } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (g_s._mlieu == 16))) { + if ((g_num == 0) || ((g_num == 1) && (g_s._mlieu == CRYPT))) { tcoord(8); if (g_num != 0) { if (g_ipers > 0) g_s._conf += 3; g_crep = 997; - if ((g_s._mlieu == 2) && (g_s._iloic != 0)) + if ((g_s._mlieu == PURPLE_ROOM) && (g_s._iloic != 0)) avpoing(g_s._iloic); - if ((g_s._mlieu == 13) && (g_num == 1) && (g_s._iboul != 0)) { + if ((g_s._mlieu == ATTIC) && (g_num == 1) && (g_s._iboul != 0)) { avpoing(g_s._iboul); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } - if ((g_s._mlieu == 13) && (g_num == 2) && (g_s._ibag != 0)) { + if ((g_s._mlieu == ATTIC) && (g_num == 2) && (g_s._ibag != 0)) { avpoing(g_s._ibag); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } - if ((g_s._mlieu == 14) && (g_s._icave != 0)) { + if ((g_s._mlieu == CELLAR) && (g_s._icave != 0)) { avpoing(g_s._icave); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } - if ((g_s._mlieu == 16) && (g_s._icryp != 0)) + if ((g_s._mlieu == CRYPT) && (g_s._icryp != 0)) avpoing(g_s._icryp); - if ((g_s._mlieu == 17) && (g_s._ivier != 0)) { + if ((g_s._mlieu == SECRET_PASSAGE) && (g_s._ivier != 0)) { avpoing(g_s._ivier); if ((g_crep != 997) && (g_crep != 139)) { g_crep = 182; aniof(2, 1); } } - if ((g_s._mlieu == 24) && (g_s._ipuit != 0)) { + if ((g_s._mlieu == WELL) && (g_s._ipuit != 0)) { avpoing(g_s._ipuit); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); @@ -276,13 +276,13 @@ void fctTake() { g_crep = 999; } } else { - if ( ((g_s._mlieu == 0) && (g_num == 3)) || ((g_s._mlieu == 1) && (g_num == 4)) - || ((g_s._mlieu == 2) && (g_num == 1)) || ((g_s._mlieu == 4) && (g_num == 3)) - || ((g_s._mlieu == 5) && (g_num == 6)) || ((g_s._mlieu == 6) && (g_num == 2)) - || ((g_s._mlieu == 7) && (g_num == 6)) || ((g_s._mlieu == 8) && (g_num == 4)) - || ((g_s._mlieu == 9) && (g_num == 4)) || ((g_s._mlieu == 10) && (g_num > 2)) - || ((g_s._mlieu == 11) && (g_num == 7)) || ((g_s._mlieu == 12) && (g_num == 6)) - || ((g_s._mlieu == 13) && (g_num > 4)) || ((g_s._mlieu > 13) && (g_s._mlieu != 23)) ) + if ( ((g_s._mlieu == OWN_ROOM) && (g_num == 3)) || ((g_s._mlieu == GREEN_ROOM) && (g_num == 4)) + || ((g_s._mlieu == PURPLE_ROOM) && (g_num == 1)) || ((g_s._mlieu == DARKBLUE_ROOM) && (g_num == 3)) + || ((g_s._mlieu == BLUE_ROOM) && (g_num == 6)) || ((g_s._mlieu == RED_ROOM) && (g_num == 2)) + || ((g_s._mlieu == BATHROOM) && (g_num == 6)) || ((g_s._mlieu == GREEN_ROOM2) && (g_num == 4)) + || ((g_s._mlieu == 9) && (g_num == 4)) || ((g_s._mlieu == DINING_ROOM) && (g_num > 2)) + || ((g_s._mlieu == BUREAU) && (g_num == 7)) || ((g_s._mlieu == KITCHEN) && (g_num == 6)) + || ((g_s._mlieu == ATTIC) && (g_num > 4)) || ((g_s._mlieu > ATTIC) && (g_s._mlieu != 23)) ) g_crep = 997; else if (g_s._mlieu == 23) { g_crep = 1504; @@ -336,7 +336,7 @@ void fctLift() { if (g_ipers > 0) ++g_s._conf; g_crep = 997; - if ((g_s._mlieu == 2) && (g_s._iloic != 0)) + if ((g_s._mlieu == PURPLE_ROOM) && (g_s._iloic != 0)) treg(g_s._iloic); } return; @@ -344,9 +344,9 @@ void fctLift() { if (g_ipers > 0) ++g_s._conf; cx = g_s._mlieu; - if (g_s._mlieu == 16) + if (g_s._mlieu == CRYPT) cx = 14; - else if (g_s._mlieu == 19) + else if (g_s._mlieu == MOUNTAIN) cx = 15; g_crep = g_tabdon[asoul + (cx << 3) + (g_num - 1)]; if (g_crep == 255) @@ -404,7 +404,7 @@ void fctLook() { tcoord(8); g_crep = 131; if (g_num != 0) { - if (g_s._mlieu == 13) { + if (g_s._mlieu == ATTIC) { if (g_num == 1) { g_crep = 164; if (g_s._ibag != 0) @@ -417,17 +417,17 @@ void fctLook() { treg(g_s._ibag); } } - if (g_s._mlieu == 14) { + if (g_s._mlieu == CELLAR) { g_crep = 164; if (g_s._icave != 0) treg(g_s._icave); } - if (g_s._mlieu == 17) { + if (g_s._mlieu == SECRET_PASSAGE) { g_crep = 174; if (g_s._ivier != 0) treg(g_s._ivier); } - if (g_s._mlieu == 24) { + if (g_s._mlieu == WELL) { g_crep = 131; if (g_s._ipuit != 0) treg(g_s._ipuit); @@ -436,28 +436,28 @@ void fctLook() { return; } cx = g_s._mlieu; - if (g_s._mlieu == 20) + if (g_s._mlieu == CHAPEL) cx = 17; - if ((g_s._mlieu > 21) && (g_s._mlieu < 25)) + if ((g_s._mlieu > MANOR_FRONT) && (g_s._mlieu < DOOR)) cx -= 4; if (g_s._mlieu == 26) cx = 21; g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; - if ((g_s._mlieu == 13) && (g_num == 8)) + if ((g_s._mlieu == ATTIC) && (g_num == 8)) g_crep = 126; - if (g_s._mlieu == 19) + if (g_s._mlieu == MOUNTAIN) g_crep = 103; if (g_crep == 255) g_crep = 131; - if ((g_s._mlieu == 1) && (g_num == 1)) + if ((g_s._mlieu == GREEN_ROOM) && (g_num == 1)) treg(144); - if ((g_s._mlieu == 5) && (g_num == 3)) + if ((g_s._mlieu == BLUE_ROOM) && (g_num == 3)) treg(147); - if ((g_s._mlieu == 8) && (g_num == 3)) + if ((g_s._mlieu == GREEN_ROOM2) && (g_num == 3)) treg(149); if ((g_s._mlieu == 9) && (g_num == 2)) treg(30); - if ((g_s._mlieu == 10) && (g_num == 3)) + if ((g_s._mlieu == DINING_ROOM) && (g_num == 3)) treg(31); } @@ -527,13 +527,13 @@ void fctSearch() { if (g_num != 0) { if (g_ipers > 0) g_s._conf += 3; - if ((g_s._mlieu != 24) && (g_s._mlieu != 17) && (g_s._mlieu != 13)) { - if (g_s._mlieu == 2) { + if ((g_s._mlieu != WELL) && (g_s._mlieu != SECRET_PASSAGE) && (g_s._mlieu != ATTIC)) { + if (g_s._mlieu == PURPLE_ROOM) { g_crep = 123; if (g_s._iloic != 0) treg(g_s._iloic); } - if (g_s._mlieu == 16) { + if (g_s._mlieu == CRYPT) { g_crep = 123; if (g_s._icryp != 0) treg(g_s._icryp); @@ -545,22 +545,22 @@ void fctSearch() { if (g_ipers > 0) g_s._conf += 3; g_crep = 997; - if (g_s._mlieu < 14) + if (g_s._mlieu < CELLAR) g_crep = r[g_s._mlieu]; - if ((g_s._mlieu == 3) && (g_num == 2)) + if ((g_s._mlieu == TOILETS) && (g_num == 2)) g_crep = 162; - if (g_s._mlieu == 12) { + if (g_s._mlieu == KITCHEN) { if ((g_num == 3) || (g_num == 4)) g_crep = 162; else if (g_num == 5) g_crep = 159; } - if (g_s._mlieu == 19) + if (g_s._mlieu == MOUNTAIN) g_crep = 104; - else if (g_s._mlieu == 16) + else if (g_s._mlieu == CRYPT) g_crep = 155; } } @@ -612,15 +612,15 @@ void fctOpen() { ++cx; } while (!((cx > 6) || (ord(g_touv[cx]) == 0) || (ord(g_touv[cx]) == g_num))); if (ord(g_touv[cx]) != g_num) { - if (!( ((g_num == 3) && ((g_s._mlieu == 0) || (g_s._mlieu == 9) || (g_s._mlieu == 5) || (g_s._mlieu == 7))) - || ((g_num == 4) && ((g_s._mlieu == 1) || (g_s._mlieu == 2) || (g_s._mlieu == 6))) - || ((g_s._mlieu == 4) && (g_num == 5)) - || ((g_num == 6) && ((g_s._mlieu == 7) || (g_s._mlieu == 10) || (g_s._mlieu == 8) || (g_s._mlieu == 13))) - || ((g_s._mlieu == 8) && (g_num == 2)) - || ((g_s._mlieu == 12) && (g_num == 7))) ) { - if ( ((g_s._mlieu > 10) && (g_s._mlieu < 14)) - || ((g_s._mlieu > 6) && (g_s._mlieu < 10)) - || (g_s._mlieu == 0) || (g_s._mlieu == 2) || (g_s._mlieu == 5)) { + if (!( ((g_num == 3) && ((g_s._mlieu == OWN_ROOM) || (g_s._mlieu == 9) || (g_s._mlieu == BLUE_ROOM) || (g_s._mlieu == BATHROOM))) + || ((g_num == 4) && ((g_s._mlieu == GREEN_ROOM) || (g_s._mlieu == PURPLE_ROOM) || (g_s._mlieu == RED_ROOM))) + || ((g_s._mlieu == DARKBLUE_ROOM) && (g_num == 5)) + || ((g_num == 6) && ((g_s._mlieu == BATHROOM) || (g_s._mlieu == DINING_ROOM) || (g_s._mlieu == GREEN_ROOM2) || (g_s._mlieu == ATTIC))) + || ((g_s._mlieu == GREEN_ROOM2) && (g_num == 2)) + || ((g_s._mlieu == KITCHEN) && (g_num == 7))) ) { + if ( ((g_s._mlieu > DINING_ROOM) && (g_s._mlieu < CELLAR)) + || ((g_s._mlieu > RED_ROOM) && (g_s._mlieu < DINING_ROOM)) + || (g_s._mlieu == OWN_ROOM) || (g_s._mlieu == PURPLE_ROOM) || (g_s._mlieu == BLUE_ROOM)) { if (hazard(1, 4) == 3) parole(7, 9, 1); } @@ -628,7 +628,7 @@ void fctOpen() { aniof(1, g_num); } cx = g_s._mlieu; - if (g_s._mlieu == 16) + if (g_s._mlieu == CRYPT) cx = 14; g_crep = g_tabdon[aouvr + (cx * 7) + g_num - 1]; if (g_crep == 254) @@ -714,7 +714,7 @@ void fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { - g_s._mlieu = 17; + g_s._mlieu = SECRET_PASSAGE; tmlieu(17); } else { tmlieu(g_s._mlieu); @@ -789,7 +789,7 @@ void fctTurn() { tcoord(9); if (g_num != 0) { g_crep = 997; - if ((g_s._mlieu == 13) && (g_s._ibag == 159) && (g_s._iboul == 141)) { + if ((g_s._mlieu == ATTIC) && (g_s._ibag == 159) && (g_s._iboul == 141)) { repon(2, 167); parole(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -798,13 +798,13 @@ void fctTurn() { else g_crep = 168; } - if ((g_s._mlieu == 17) && (g_s._ivier == 143)) { + if ((g_s._mlieu == SECRET_PASSAGE) && (g_s._ivier == 143)) { repon(2, 175); clsf3(); parole(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { - g_s._mlieu = 16; + g_s._mlieu = CRYPT; affrep(); } else g_crep = 176; @@ -845,7 +845,7 @@ void fctAttach() { if (!(g_anyone) && !(g_iesc)) { tcoord(8); g_crep = 997; - if ((g_num != 0) && (g_s._mlieu == 24)) { + if ((g_num != 0) && (g_s._mlieu == WELL)) { g_crep = 999; if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) { g_s._ipuit = g_s._selectedObjectId; @@ -903,18 +903,20 @@ void fctClose() { * @remarks Originally called 'tfrapper' */ void fctKnock() { + warning("Knock - mlieu %d", g_s._mlieu); + if (!g_syn) ecr3(g_vm->getEngineString(S_HIT)); - if (g_s._mlieu == 15) { + if (g_s._mlieu == LANDING) { Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (g_s._mlieu < 25) { + if (g_s._mlieu < DOOR) { tfleche(); if (!(g_anyone) && !(g_iesc)) { - if ((g_s._mlieu < 19) && (g_s._mlieu != 15)) + if ((g_s._mlieu < MOUNTAIN) && (g_s._mlieu != LANDING)) g_crep = 133; else g_crep = 997; @@ -1083,11 +1085,11 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - if ((g_s._mlieu > 15) && (g_s._mlieu < 26)) { + if ((g_s._mlieu > LANDING) && (g_s._mlieu < 26)) { g_crep = 148; } else { tsort(); - g_s._mlieu = 10; + g_s._mlieu = DINING_ROOM; g_caff = 10; debloc(g_s._mlieu); tmlieu(g_s._mlieu); @@ -1124,12 +1126,10 @@ void fctEat() { * @remarks Originally called 'tentrer' */ void fctEnter() { -// int x; - - if ((g_s._mlieu == 21) || (g_s._mlieu == 22)) { + if ((g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK)) { t1sama(); tmlieu(g_s._mlieu); - } else if (g_s._mlieu == 15) + } else if (g_s._mlieu == LANDING) aldepl(); else if (g_ment == 0) g_crep = 997; @@ -1150,7 +1150,7 @@ void fctEnter() { tip(z, g_x); ++g_s._conf; - g_s._mlieu = 15; + g_s._mlieu = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; g_syn = true; @@ -1187,13 +1187,13 @@ void fctEnter() { void fctSleep() { int z, j, h, m; - if ((g_s._mlieu > 15) && (g_s._mlieu < 26)) { + if ((g_s._mlieu > LANDING) && (g_s._mlieu < 26)) { g_crep = 148; return; } - if (g_s._mlieu != 0) { + if (g_s._mlieu != OWN_ROOM) { tsort(); - g_s._mlieu = 0; + g_s._mlieu = OWN_ROOM; affrep(); afdes(0); debloc(g_s._mlieu); @@ -1254,22 +1254,22 @@ void fctForce() { void fctLeave() { tsort(); g_crep = 0; - if ((g_s._mlieu == 19) || (g_s._mlieu == 21) || (g_s._mlieu == 22) || (g_s._mlieu == 24)) + if ((g_s._mlieu == MOUNTAIN) || (g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK) || (g_s._mlieu == WELL)) g_crep = 997; else { int lx = 0; - if ((g_s._mlieu < 16) || (g_s._mlieu == 26)) + if ((g_s._mlieu < CRYPT) || (g_s._mlieu == 26)) lx = 10; - if ((g_s._mlieu == 10) || (g_s._mlieu == 20)) + if ((g_s._mlieu == DINING_ROOM) || (g_s._mlieu == CHAPEL)) lx = 21; - if ((g_s._mlieu < 10) || (g_s._mlieu == 13)) + if ((g_s._mlieu < DINING_ROOM) || (g_s._mlieu == ATTIC)) lx = 15; - if (g_s._mlieu == 16) { + if (g_s._mlieu == CRYPT) { lx = 17; g_crep = 176; } - if (g_s._mlieu == 17) + if (g_s._mlieu == SECRET_PASSAGE) t23coul(lx); if (g_s._mlieu == 23) lx = 24; @@ -1301,9 +1301,9 @@ void fctWait() { t11(g_s._mlieu, quel); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; - if ((g_s._mlieu == 13) || (g_s._mlieu == 14)) + if ((g_s._mlieu == ATTIC) || (g_s._mlieu == CELLAR)) cavegre(); - if ((g_s._mlieu > 0) && (g_s._mlieu < 10)) + if ((g_s._mlieu > OWN_ROOM) && (g_s._mlieu < DINING_ROOM)) g_anyone = true; g_mpers = g_ipers; if (!g_anyone) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 2cb44c7ddf..b951a81be5 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1025,7 +1025,7 @@ void inzon() { g_s._iloic = 136; g_s._icryp = 141; g_s._conf = hazard(4, 10); - g_s._mlieu = 21; + g_s._mlieu = MANOR_FRONT; for (int cx = 2; cx <= 6; ++cx) g_s._sjer[cx] = chr(0); @@ -1320,7 +1320,7 @@ void musique(int so) { ++g_prebru; } else { bool i = false; - if ((g_s._mlieu == 19) || (g_s._mlieu == 21) || (g_s._mlieu == 22)) { + if ((g_s._mlieu == MOUNTAIN) || (g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK)) { int haz = hazard(1, 3); if (haz == 2) { haz = hazard(2, 4); @@ -1328,7 +1328,7 @@ void musique(int so) { i = true; } } - if (g_s._mlieu == 20) { + if (g_s._mlieu == CHAPEL) { int haz = hazard(1, 2); if (haz == 1) { parole(8, 1, 1); @@ -1336,7 +1336,7 @@ void musique(int so) { } } - if (g_s._mlieu == 24) { + if (g_s._mlieu == WELL) { int haz = hazard(1, 2); if (haz == 2) { parole(12, 1, 1); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 0d6069b4d5..70cfc8850e 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -157,7 +157,7 @@ void tinke() { g_mpers = g_ipers; if ((g_mpers == 0) && (g_ipers > 0)) { - if ((g_s._mlieu == 13) || (g_s._mlieu == 14)) { + if ((g_s._mlieu == ATTIC) || (g_s._mlieu == CELLAR)) { cavegre(); } else if (g_ipers == 10) { g_ipers = 0; @@ -186,7 +186,7 @@ void tinke() { nouvp(g_li, cx); g_brt = false; g_hdb = 0; - if ((g_s._mlieu > 0) && (g_s._mlieu < 10)) + if ((g_s._mlieu > OWN_ROOM) && (g_s._mlieu < DINING_ROOM)) g_anyone = true; } } @@ -370,7 +370,7 @@ void cherjer(int ob, bool &d) { } void st1sama() { - g_s._mlieu = 10; + g_s._mlieu = DINING_ROOM; affrep(); } @@ -505,7 +505,7 @@ void t1sama() { //Entering manor dessine_rouleau(); drawClock(); showMouse(); - g_s._mlieu = 0; + g_s._mlieu = OWN_ROOM; affrep(); t5(10); if (!g_blo) @@ -519,7 +519,7 @@ void t1sama() { //Entering manor } void t1vier() { - g_s._mlieu = 17; + g_s._mlieu = SECRET_PASSAGE; affrep(); } @@ -530,19 +530,19 @@ void t1neig() { tperd(); } else { g_okdes = true; - g_s._mlieu = 19; + g_s._mlieu = MOUNTAIN; affrep(); } } void t1deva() { g_inei = 0; - g_s._mlieu = 21; + g_s._mlieu = MANOR_FRONT; affrep(); } void t1derr() { - g_s._mlieu = 22; + g_s._mlieu = MANOR_BACK; affrep(); } @@ -781,7 +781,7 @@ void avpoing(int &ob) { void rechai(int &ch) { int cx = g_s._mlieu; - if (g_s._mlieu == 16) + if (g_s._mlieu == CRYPT) cx = 14; ch = g_tabdon[achai + (cx * 7) + g_num - 1]; } diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 85a5f140bb..8479538879 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -229,7 +229,7 @@ void tsitu() { if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._mlieu != 10)) || ((h > 0) && (h < 6) && (g_s._mlieu != 0))) ++g_s._conf; - if (((g_s._mlieu < 16) || (g_s._mlieu > 19)) && (g_s._mlieu != 23) + if (((g_s._mlieu < CRYPT) || (g_s._mlieu > MOUNTAIN)) && (g_s._mlieu != 23) && (g_s._mlieu != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { if ((g_s._conf > 99) && (h > 8) && (h < 16)) { g_crep = 1501; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 6e9a66ce30..096a076001 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -249,7 +249,7 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s._mlieu == 15)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_s._mlieu == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (!g_blo) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a9652cee5d..a1b22d4299 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -33,15 +33,6 @@ namespace Mortevielle { -/* 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 ) - */ - /*---------------------------------------------------------------------------*/ /*------------------- MEMORY MAP ------------------------*/ /*---------------------------------------------------------------------------*/ @@ -152,6 +143,23 @@ extern const byte g_rang[16]; /*-------------------------------- TYPES --------------------------------*/ /*---------------------------------------------------------------------------*/ +/* +9 "A glance at the forbidden$", +18 "It's already open$", +23 "Strange horoscope$", +26 "A photograph$", +27 "The coat of arms$", +*/ + +enum places { + OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, + BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, + DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, + LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, MOUNTAIN = 19, + CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, WELL = 24, + DOOR = 25 +}; + struct sav_chaine { int _conf; byte _pourc[11]; -- cgit v1.2.3 From fd17d93919fd869d2ad35df86511df35aafe33ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Mar 2012 22:02:26 +0100 Subject: MORTEVIELLE: rename variables and functions related to random number generation --- engines/mortevielle/actions.cpp | 31 ++++---- engines/mortevielle/mor.cpp | 154 +++++++++++++++++++--------------------- engines/mortevielle/mor.h | 7 +- engines/mortevielle/mor2.cpp | 14 ++-- engines/mortevielle/var_mor.cpp | 5 +- engines/mortevielle/var_mor.h | 2 +- 6 files changed, 101 insertions(+), 112 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1520edef14..b988f441c4 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -621,7 +621,7 @@ void fctOpen() { if ( ((g_s._mlieu > DINING_ROOM) && (g_s._mlieu < CELLAR)) || ((g_s._mlieu > RED_ROOM) && (g_s._mlieu < DINING_ROOM)) || (g_s._mlieu == OWN_ROOM) || (g_s._mlieu == PURPLE_ROOM) || (g_s._mlieu == BLUE_ROOM)) { - if (hazard(1, 4) == 3) + if (getRandomNumber(1, 4) == 3) parole(7, 9, 1); } g_touv[cx] = chr(g_num); @@ -926,14 +926,14 @@ void fctKnock() { } if (g_s._mlieu == 26) { - int haz = (hazard(0, 8)) - 4; - parole(11, haz, 1); + int rand = (getRandomNumber(0, 8)) - 4; + parole(11, rand, 1); int p; - ecfren(p, haz, g_s._conf, g_ment); + ecfren(p, rand, g_s._conf, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { - if (haz > p) + if (rand > p) g_crep = 190; else { becfren(l); @@ -1052,24 +1052,24 @@ void fctListen() { else { if (g_ipers != 0) ++g_s._conf; - int p, haz; - ecfren(p, haz, g_s._conf, g_ment); + int p, rand; + ecfren(p, rand, g_s._conf, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { - if (haz > p) + if (rand > p) g_crep = 101; else { becfren(l); int j, h, m; calch(j, h, m); - haz = hazard(1, 100); + rand = getRandomNumber(1, 100); if ((h >= 0) && (h < 8)) { - if (haz > 30) + if (rand > 30) g_crep = 101; else g_crep = 178; - } else if (haz > 70) + } else if (rand > 70) g_crep = 101; else g_crep = 178; @@ -1144,7 +1144,7 @@ void fctEnter() { if ((g_ment == 3) || (g_ment == 7)) g_crep = 179; else { - g_x = (hazard(0, 10)) - 5; + g_x = (getRandomNumber(0, 10)) - 5; parole(7, g_x, 1); aniof(1, 1); @@ -1165,7 +1165,7 @@ void fctEnter() { g_ment = 0; } } else { - g_x = (hazard(0, 10)) - 5; + g_x = (getRandomNumber(0, 10)) - 5; parole(7, g_x, 1); aniof(1, 1); @@ -1339,7 +1339,7 @@ void fctSound() { */ void fctDiscuss() { bool te[47]; - int cy, cx, max, haz, suj, co, lig, icm, i, choi, x, y, c; + int cy, cx, max, suj, co, lig, icm, i, choi, x, y, c; char tou; Common::String lib[47]; bool f; @@ -1470,8 +1470,7 @@ void fctDiscuss() { max = 8; else max = 4; - haz = hazard(1, max); - if (haz == 2) + if (getRandomNumber(1, max) == 2) suj = 129; else { suj = 138; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index b951a81be5..52b71c7994 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -274,10 +274,6 @@ void paint_rect(int x, int y, int dx, int dy) { g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } -int hazard(int min, int max) { - return get_random_number(min, max); -} - void calch(int &j, int &h, int &m) { int nh = readclock(); int th = g_jh + ((nh - g_mh) / g_t); @@ -469,17 +465,17 @@ void choix(int min, int max, int &per) { bool i; int cz; - int haz = hazard(min, max); - if (haz > 4) { - haz = 8 - haz; + int rand = getRandomNumber(min, max); + if (rand > 4) { + rand = 8 - rand; i = true; } else i = false; int cx = 0; per = 0; - while (cx < haz) { - int cy = hazard(1, 8); + while (cx < rand) { + int cy = getRandomNumber(1, 8); conv(cy, cz); if ((per & cz) != cz) { ++cx; @@ -592,9 +588,12 @@ void person() { g_ipers = 0; } -void chlm(int &per) { - per = hazard(1, 2); - if (per == 2) per = 128; +int chlm() { + int retval = getRandomNumber(1, 2); + if (retval == 2) + retval = 128; + + return retval; } /** @@ -750,7 +749,7 @@ void cpl20(int &p, int &h) { void quelq1(int l) { int per; - per = hazard(1, 2); + per = getRandomNumber(1, 2); if (l == 1) { if (per == 1) g_bh1 = true; @@ -791,7 +790,7 @@ void quelq6(int l) { void quelq10(int h, int &per) { if ((h >= 0) && (h < 8)) - chlm(per); + per = chlm(); else { int min = 0, max = 0; if ((h > 7) && (h < 10)) { @@ -814,7 +813,7 @@ void quelq10(int h, int &per) { void quelq11(int h, int &per) { if ((h >= 0) && (h < 8)) - chlm(per); + per = chlm(); else { int min = 0, max = 0; if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { @@ -833,7 +832,7 @@ void quelq11(int h, int &per) { } void quelq12(int &per) { - chlm(per); + per = chlm(); affper(per); } @@ -844,7 +843,7 @@ void quelq15(int &per) { per = 0; do { - cx = hazard(1, 8); + cx = getRandomNumber(1, 8); test = (((cx == 1) && (g_bh2 || g_bh9)) || ((cx == 2) && g_bh8) || ((cx == 3) && g_bh4) || @@ -861,7 +860,7 @@ void quelq15(int &per) { void quelq20(int h, int &per) { if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) - chlm(per); + per = chlm(); else { int min = 0, max = 0; if ((h > 9) && (h < 12)) { @@ -887,8 +886,7 @@ void frap() { if ((h >= 0) && (h < 8)) g_crep = 190; else { - int haz = hazard(1, 100); - if (haz > 70) + if (getRandomNumber(1, 100) > 70) g_crep = 190; else g_crep = 147; @@ -944,11 +942,11 @@ void tip(int ip, int &cx) { } -void ecfren(int &p, int &haz, int cf, int l) { +void ecfren(int &p, int &rand, int cf, int l) { if (l == 0) person(); p = -500; - haz = 0; + rand = 0; if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4))) cpl1(p); if ((l == 2) && (!g_bh2) && (!g_bh9)) @@ -965,20 +963,20 @@ void ecfren(int &p, int &haz, int cf, int l) { p = -400; if (p != -500) { p = p + cf; - haz = hazard(1, 100); + rand = getRandomNumber(1, 100); } } void becfren(int l) { if ((l == 1) || (l == 4)) { - int haz = hazard(1, 2); + int rand = getRandomNumber(1, 2); if (l == 1) { - if (haz == 1) + if (rand == 1) g_bh1 = true; else g_bf1 = true; } else { // l == 4 - if (haz == 1) + if (rand == 1) g_bh4 = true; else g_bf4 = true; @@ -1007,9 +1005,9 @@ void init_nbrepm() { g_nbrepm[idx] = ipm[idx]; } -void phaz(int &haz, int &p, int cf) { +void phaz(int &rand, int &p, int cf) { p += cf; - haz = hazard(1, 100); + rand = getRandomNumber(1, 100); } void inzon() { @@ -1024,7 +1022,7 @@ void inzon() { g_s._ivier = 0; g_s._iloic = 136; g_s._icryp = 141; - g_s._conf = hazard(4, 10); + g_s._conf = getRandomNumber(4, 10); g_s._mlieu = MANOR_FRONT; for (int cx = 2; cx <= 6; ++cx) @@ -1067,11 +1065,11 @@ void dprog() { void pl1(int cf) { if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) { - int p, haz; + int p, rand; cpl1(p); - phaz(haz, p, cf); + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq1(g_li); @@ -1080,11 +1078,11 @@ void pl1(int cf) { void pl2(int cf) { if (!g_bh2) { - int p, haz; + int p, rand; cpl2(p); - phaz(haz, p, cf); + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq2(); @@ -1093,11 +1091,11 @@ void pl2(int cf) { void pl5(int cf) { if (!g_bh5) { - int p, haz; + int p, rand; cpl5(p); - phaz(haz, p, cf); + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq5(); @@ -1106,11 +1104,11 @@ void pl5(int cf) { void pl6(int cf) { if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) { - int p, haz; + int p, rand; cpl6(p); - phaz(haz, p, cf); + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq6(g_li); @@ -1120,10 +1118,10 @@ void pl6(int cf) { void pl9(int cf) { if (!g_bh9) { cf = -10; - int p, haz; - phaz(haz, p, cf); + int p, rand; + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq2(); @@ -1131,79 +1129,79 @@ void pl9(int cf) { } void pl10(int cf) { - int p, h, haz; + int p, h, rand; cpl10(p, h); - phaz(haz, p, cf); + phaz(rand, p, cf); - if (haz > p) + if (rand > p) person(); else quelq10(h, p); } void pl11(int cf) { - int p, h, haz; + int p, h, rand; cpl11(p, h); - phaz(haz, p, cf); - if (haz > p) + phaz(rand, p, cf); + if (rand > p) person(); else quelq11(h, p); } void pl12(int cf) { - int p, haz; + int p, rand; cpl12(p); - phaz(haz, p, cf); - if (haz > p) + phaz(rand, p, cf); + if (rand > p) person(); else quelq12(p); } void pl13(int cf) { - int p, haz; + int p, rand; cpl13(p); - phaz(haz, p, cf); - if (haz > p) + phaz(rand, p, cf); + if (rand > p) person(); else quelq12(p); } void pl15(int cf) { - int p, haz; + int p, rand; cpl15(p); - phaz(haz, p, cf); - if (haz > p) + phaz(rand, p, cf); + if (rand > p) person(); else quelq15(p); } void pl20(int cf) { - int p, h, haz; + int p, h, rand; cpl20(p, h); - phaz(haz, p, cf); - if (haz > p) + phaz(rand, p, cf); + if (rand > p) person(); else quelq20(h, p); } void t11(int l11, int &a) { - int p, haz; + int p, rand; - ecfren(p, haz, g_s._conf, l11); + ecfren(p, rand, g_s._conf, l11); g_li = l11; if ((l11 > 0) && (l11 < 10)) { if (p != -500) { - if (haz > p) { + if (rand > p) { person(); a = 0; } else { @@ -1232,8 +1230,8 @@ void t11(int l11, int &a) { if (l11 == 20) cpl20(p, h); p += g_s._conf; - haz = hazard(1, 100); - if (haz > p) { + rand = getRandomNumber(1, 100); + if (rand > p) { person(); a = 0; } else { @@ -1260,8 +1258,8 @@ void cavegre() { clsf3(); ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); - int haz = (hazard(0, 4)) - 2; - parole(2, haz, 1); + int rand = (getRandomNumber(0, 4)) - 2; + parole(2, rand, 1); // The original was doing here a useless loop. // It has been removed @@ -1321,24 +1319,20 @@ void musique(int so) { } else { bool i = false; if ((g_s._mlieu == MOUNTAIN) || (g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK)) { - int haz = hazard(1, 3); - if (haz == 2) { - haz = hazard(2, 4); - parole(9, haz, 1); + if (getRandomNumber(1, 3) == 2) { + parole(9, getRandomNumber(2, 4), 1); i = true; } } if (g_s._mlieu == CHAPEL) { - int haz = hazard(1, 2); - if (haz == 1) { + if (getRandomNumber(1, 2) == 1) { parole(8, 1, 1); i = true; } } if (g_s._mlieu == WELL) { - int haz = hazard(1, 2); - if (haz == 2) { + if (getRandomNumber(1, 2) == 2) { parole(12, 1, 1); i = true; } @@ -1348,10 +1342,8 @@ void musique(int so) { parole(13, 1, 1); i = true; } - if (! i) { - int haz = hazard(1, 17); - parole(haz, 1, 2); - } + if (!i) + parole(getRandomNumber(1, 17), 1, 2); } } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index afb9963fa7..f649195f24 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -54,7 +54,6 @@ extern void ecrf7(); extern void clsf10(); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); -extern int hazard(int min, int max); extern void calch(int &j, int &h, int &m); extern void conv(int x, int &y); /* NIVEAU 12 */ @@ -69,7 +68,7 @@ extern void cpl3(int &p); extern void cpl5(int &p); extern void cpl6(int &p); extern void person(); -extern void chlm(int &per); +extern int chlm(); extern void drawClock(); /************* * NIVEAU 11 * @@ -93,11 +92,11 @@ extern void quelq20(int h, int &per); extern void frap(); extern void nouvp(int l, int &p); extern void tip(int ip, int &cx); -extern void ecfren(int &p, int &haz, int cf, int l); +extern void ecfren(int &p, int &rand, int cf, int l); extern void becfren(int l); /* NIVEAU 10 */ extern void init_nbrepm(); -extern void phaz(int &haz, int &p, int cf); +extern void phaz(int &rand, int &p, int cf); extern void inzon(); extern void dprog(); extern void pl1(int cf); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 70cfc8850e..05002a3a62 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -164,13 +164,12 @@ void tinke() { if (!g_brt) { g_brt = true; g_hdb = readclock(); - int haz = hazard(1, 5); - if (haz < 5) { + if (getRandomNumber(1, 5) < 5) { clsf3(); ecrf2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - haz = (hazard(0, 4)) - 2; - parole(1, haz, 1); + int rand = (getRandomNumber(0, 4)) - 2; + parole(1, rand, 1); clsf3(); } } @@ -590,15 +589,14 @@ L1: g_syn = true; g_col = true; } else { - int haz = hazard(1, 3); - if (haz == 2) { + if (getRandomNumber(1, 3) == 2) { g_cache = false; g_crep = 137; goto L1; } else { repon(2, 136); - haz = (hazard(0, 4)) - 2; - parole(3, haz, 1); + int rand = (getRandomNumber(0, 4)) - 2; + parole(3, rand, 1); clsf2(); person(); debloc(21); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index e668a6d678..9218cadb53 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -238,9 +238,10 @@ void intr(int intNum, registres ®s) { } /** - * Get a random number between two values + * Engine function - Get a random number between two values + * @remarks Originally called 'get_random_number' and 'hazard' */ -int get_random_number(int minval, int maxval) { +int getRandomNumber(int minval, int maxval) { return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval; } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a1b22d4299..dd65f39c07 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -364,7 +364,7 @@ extern char get_ch(); extern void palette(int v1); extern void intr(int intNum, registres ®s); -extern int get_random_number(int minval, int maxval); +extern int getRandomNumber(int minval, int maxval); // (* external 'c:\mc\charecr.com'; *) extern void s_char(int Gd, int y, int dy); -- cgit v1.2.3 From 573925641204aac35361c1750af73658641edd8a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Mar 2012 00:00:48 +0100 Subject: MORTEVIELLE: rename several globals --- engines/mortevielle/actions.cpp | 420 ++++++++++++++++++------------------ engines/mortevielle/mor.cpp | 44 ++-- engines/mortevielle/mor.h | 1 - engines/mortevielle/mor2.cpp | 36 ++-- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/prog.cpp | 10 +- engines/mortevielle/saveload.cpp | 20 +- engines/mortevielle/taffich.cpp | 5 +- engines/mortevielle/var_mor.h | 4 +- 9 files changed, 267 insertions(+), 275 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b988f441c4..6b9388ab33 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -49,13 +49,13 @@ namespace Mortevielle { void fctMove() { int cx; - if ((g_s._mlieu == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - g_s._mlieu = LANDING; - g_caff = g_s._mlieu; + if ((g_s._currPlace == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + g_s._currPlace = LANDING; + g_caff = g_s._currPlace; afdes(0); - repon(2, g_s._mlieu); + repon(2, g_s._currPlace); } - if ((g_s._mlieu == LANDING) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s._currPlace == LANDING) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { if (!g_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); @@ -67,13 +67,13 @@ void fctMove() { if (g_num == 0) return; if (g_num == 1) { - g_s._mlieu = OWN_ROOM; + g_s._currPlace = OWN_ROOM; tmlieu(0); } else if (g_num == 7) { - g_s._mlieu = ATTIC; + g_s._currPlace = ATTIC; tmlieu(13); } else if (g_num != 6) - g_s._mlieu = 26; + g_s._currPlace = 26; if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; if (g_num > 7) @@ -90,7 +90,7 @@ void fctMove() { ++cx; } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); - if (g_s._mlieu == MOUNTAIN) { + if (g_s._currPlace == MOUNTAIN) { if (cx == 1) t1deva(); if (cx == 2) @@ -98,7 +98,7 @@ void fctMove() { goto L2; } - if (g_s._mlieu == 23) { + if (g_s._currPlace == 23) { if (cx == 1) t1deau(); if (cx == 2) @@ -106,43 +106,43 @@ void fctMove() { goto L2; } - if ((g_s._mlieu == BUREAU) && (cx == 1)) + if ((g_s._currPlace == BUREAU) && (cx == 1)) cx = 6; - if (g_s._mlieu == KITCHEN) { + if (g_s._currPlace == KITCHEN) { if (cx == 2) cx = 6; if (cx == 5) cx = 16; } - if ((g_s._mlieu == CELLAR) && (cx == 3)) + if ((g_s._currPlace == CELLAR) && (cx == 3)) cx = 6; - if (((g_s._mlieu == LANDING) || (g_s._mlieu == 26)) && (cx == 4)) + if (((g_s._currPlace == LANDING) || (g_s._currPlace == 26)) && (cx == 4)) cx = 6; - if ((g_s._mlieu > MOUNTAIN) && (g_s._mlieu != 26)) + if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != 26)) cx += 10; - if ((g_s._mlieu == CHAPEL) && (cx == 13)) + if ((g_s._currPlace == CHAPEL) && (cx == 13)) cx = 16; - if (g_s._mlieu == MANOR_FRONT) { + if (g_s._currPlace == MANOR_FRONT) { if (cx == 12) cx = 16; else if (cx > 13) cx = 15; } - if ((g_s._mlieu == MANOR_BACK) && (cx > 14)) + if ((g_s._currPlace == MANOR_BACK) && (cx > 14)) cx = 15; - if ((g_s._mlieu == WELL) && (cx != 17)) + if ((g_s._currPlace == WELL) && (cx != 17)) if (cx > 13) cx = 15; if (cx == 1) - g_s._mlieu = BUREAU; + g_s._currPlace = BUREAU; else if (cx == 2) - g_s._mlieu = KITCHEN; + g_s._currPlace = KITCHEN; else if (cx == 3) - g_s._mlieu = CELLAR; + g_s._currPlace = CELLAR; else if (cx == 4) - g_s._mlieu = LANDING; + g_s._currPlace = LANDING; else if (cx == 5) cx = 12; if (cx == 6) @@ -152,31 +152,31 @@ void fctMove() { else if (cx == 12) t1deva(); else if (cx == 13) - g_s._mlieu = CHAPEL; + g_s._currPlace = CHAPEL; else if (cx == 14) - g_s._mlieu = WELL; + g_s._currPlace = WELL; else if (cx == 15) t1neig(); else if (cx == 16) t1derr(); else if (cx == 17) { - if ((g_s._ipuit != 120) && (g_s._ipuit != 140)) + if ((g_s._wellObjectId != 120) && (g_s._wellObjectId != 140)) g_crep = 997; - else if (g_s._ipuit == 120) + else if (g_s._wellObjectId == 120) g_crep = 181; else if (g_s._conf > 80) { g_crep = 1505; tperd(); } else { - g_s._mlieu = 23; + g_s._currPlace = 23; affrep(); } } if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); - debloc(g_s._mlieu); + debloc(g_s._currPlace); L2: - tmlieu(g_s._mlieu); + tmlieu(g_s._currPlace); } /** @@ -191,22 +191,22 @@ void fctTake() { if (g_ipers > 0) g_s._conf += 3; if (g_obpart) { - if (g_s._mlieu == PURPLE_ROOM) - g_s._iloic = 0; - if (g_s._mlieu == ATTIC) { - if (g_s._iboul == g_caff) - g_s._iboul = 0; - if (g_s._ibag == g_caff) - g_s._ibag = 0; + if (g_s._currPlace == PURPLE_ROOM) + g_s._purpleRoomObjectId = 0; + if (g_s._currPlace == ATTIC) { + if (g_s._atticBallHoleObjectId == g_caff) + g_s._atticBallHoleObjectId = 0; + if (g_s._atticRodHoleObjectId == g_caff) + g_s._atticRodHoleObjectId = 0; } - if (g_s._mlieu == CELLAR) - g_s._icave = 0; - if (g_s._mlieu == CRYPT) - g_s._icryp = 0; - if (g_s._mlieu == SECRET_PASSAGE) - g_s._ivier = 0; - if (g_s._mlieu == WELL) - g_s._ipuit = 0; + if (g_s._currPlace == CELLAR) + g_s._cellarObjectId = 0; + if (g_s._currPlace == CRYPT) + g_s._cryptObjectId = 0; + if (g_s._currPlace == SECRET_PASSAGE) + g_s._secretPassageObjectId = 0; + if (g_s._currPlace == WELL) + g_s._wellObjectId = 0; unsetSearchMenu(); g_obpart = false; affrep(); @@ -235,40 +235,41 @@ void fctTake() { } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (g_s._mlieu == CRYPT))) { + if ((g_num == 0) || ((g_num == 1) && (g_s._currPlace == CRYPT))) { tcoord(8); if (g_num != 0) { if (g_ipers > 0) g_s._conf += 3; g_crep = 997; - if ((g_s._mlieu == PURPLE_ROOM) && (g_s._iloic != 0)) - avpoing(g_s._iloic); - if ((g_s._mlieu == ATTIC) && (g_num == 1) && (g_s._iboul != 0)) { - avpoing(g_s._iboul); + if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) + avpoing(g_s._purpleRoomObjectId); + if ((g_s._currPlace == ATTIC) && (g_num == 1) && (g_s._atticBallHoleObjectId != 0)) { + avpoing(g_s._atticBallHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } - if ((g_s._mlieu == ATTIC) && (g_num == 2) && (g_s._ibag != 0)) { - avpoing(g_s._ibag); + if ((g_s._currPlace == ATTIC) && (g_num == 2) && (g_s._atticRodHoleObjectId != 0)) { + avpoing(g_s._atticRodHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } - if ((g_s._mlieu == CELLAR) && (g_s._icave != 0)) { - avpoing(g_s._icave); + if ((g_s._currPlace == CELLAR) && (g_s._cellarObjectId != 0)) { + avpoing(g_s._cellarObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } - if ((g_s._mlieu == CRYPT) && (g_s._icryp != 0)) - avpoing(g_s._icryp); - if ((g_s._mlieu == SECRET_PASSAGE) && (g_s._ivier != 0)) { - avpoing(g_s._ivier); + if ((g_s._currPlace == CRYPT) && (g_s._cryptObjectId != 0)) + avpoing(g_s._cryptObjectId); + + if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId != 0)) { + avpoing(g_s._secretPassageObjectId); if ((g_crep != 997) && (g_crep != 139)) { g_crep = 182; aniof(2, 1); } } - if ((g_s._mlieu == WELL) && (g_s._ipuit != 0)) { - avpoing(g_s._ipuit); + if ((g_s._currPlace == WELL) && (g_s._wellObjectId != 0)) { + avpoing(g_s._wellObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); } @@ -276,15 +277,15 @@ void fctTake() { g_crep = 999; } } else { - if ( ((g_s._mlieu == OWN_ROOM) && (g_num == 3)) || ((g_s._mlieu == GREEN_ROOM) && (g_num == 4)) - || ((g_s._mlieu == PURPLE_ROOM) && (g_num == 1)) || ((g_s._mlieu == DARKBLUE_ROOM) && (g_num == 3)) - || ((g_s._mlieu == BLUE_ROOM) && (g_num == 6)) || ((g_s._mlieu == RED_ROOM) && (g_num == 2)) - || ((g_s._mlieu == BATHROOM) && (g_num == 6)) || ((g_s._mlieu == GREEN_ROOM2) && (g_num == 4)) - || ((g_s._mlieu == 9) && (g_num == 4)) || ((g_s._mlieu == DINING_ROOM) && (g_num > 2)) - || ((g_s._mlieu == BUREAU) && (g_num == 7)) || ((g_s._mlieu == KITCHEN) && (g_num == 6)) - || ((g_s._mlieu == ATTIC) && (g_num > 4)) || ((g_s._mlieu > ATTIC) && (g_s._mlieu != 23)) ) + if ( ((g_s._currPlace == OWN_ROOM) && (g_num == 3)) || ((g_s._currPlace == GREEN_ROOM) && (g_num == 4)) + || ((g_s._currPlace == PURPLE_ROOM) && (g_num == 1)) || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 3)) + || ((g_s._currPlace == BLUE_ROOM) && (g_num == 6)) || ((g_s._currPlace == RED_ROOM) && (g_num == 2)) + || ((g_s._currPlace == BATHROOM) && (g_num == 6)) || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) + || ((g_s._currPlace == 9) && (g_num == 4)) || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) + || ((g_s._currPlace == BUREAU) && (g_num == 7)) || ((g_s._currPlace == KITCHEN) && (g_num == 6)) + || ((g_s._currPlace == ATTIC) && (g_num > 4)) || ((g_s._currPlace > ATTIC) && (g_s._currPlace != 23)) ) g_crep = 997; - else if (g_s._mlieu == 23) { + else if (g_s._currPlace == 23) { g_crep = 1504; tperd(); } else @@ -322,7 +323,7 @@ void fctInventoryTake() { * @remarks Originally called 'tsoulever' */ void fctLift() { - int cx; +// int cx; if (!g_syn) ecr3(g_vm->getEngineString(S_LIFT)); @@ -336,19 +337,19 @@ void fctLift() { if (g_ipers > 0) ++g_s._conf; g_crep = 997; - if ((g_s._mlieu == PURPLE_ROOM) && (g_s._iloic != 0)) - treg(g_s._iloic); + if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) + treg(g_s._purpleRoomObjectId); } return; } if (g_ipers > 0) ++g_s._conf; - cx = g_s._mlieu; - if (g_s._mlieu == CRYPT) - cx = 14; - else if (g_s._mlieu == MOUNTAIN) - cx = 15; - g_crep = g_tabdon[asoul + (cx << 3) + (g_num - 1)]; + int tmpPlace = g_s._currPlace; + if (g_s._currPlace == CRYPT) + tmpPlace = 14; + else if (g_s._currPlace == MOUNTAIN) + tmpPlace = 15; + g_crep = g_tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; if (g_crep == 255) g_crep = 997; } @@ -404,60 +405,60 @@ void fctLook() { tcoord(8); g_crep = 131; if (g_num != 0) { - if (g_s._mlieu == ATTIC) { + if (g_s._currPlace == ATTIC) { if (g_num == 1) { g_crep = 164; - if (g_s._ibag != 0) - treg(g_s._ibag); - else if (g_s._iboul != 0) - treg(g_s._iboul); + if (g_s._atticRodHoleObjectId != 0) + treg(g_s._atticRodHoleObjectId); + else if (g_s._atticBallHoleObjectId != 0) + treg(g_s._atticBallHoleObjectId); } else { g_crep = 193; - if (g_s._ibag != 0) - treg(g_s._ibag); + if (g_s._atticRodHoleObjectId != 0) + treg(g_s._atticRodHoleObjectId); } } - if (g_s._mlieu == CELLAR) { + if (g_s._currPlace == CELLAR) { g_crep = 164; - if (g_s._icave != 0) - treg(g_s._icave); + if (g_s._cellarObjectId != 0) + treg(g_s._cellarObjectId); } - if (g_s._mlieu == SECRET_PASSAGE) { + if (g_s._currPlace == SECRET_PASSAGE) { g_crep = 174; - if (g_s._ivier != 0) - treg(g_s._ivier); + if (g_s._secretPassageObjectId != 0) + treg(g_s._secretPassageObjectId); } - if (g_s._mlieu == WELL) { + if (g_s._currPlace == WELL) { g_crep = 131; - if (g_s._ipuit != 0) - treg(g_s._ipuit); + if (g_s._wellObjectId != 0) + treg(g_s._wellObjectId); } } return; } - cx = g_s._mlieu; - if (g_s._mlieu == CHAPEL) + cx = g_s._currPlace; + if (g_s._currPlace == CHAPEL) cx = 17; - if ((g_s._mlieu > MANOR_FRONT) && (g_s._mlieu < DOOR)) + if ((g_s._currPlace > MANOR_FRONT) && (g_s._currPlace < DOOR)) cx -= 4; - if (g_s._mlieu == 26) + if (g_s._currPlace == 26) cx = 21; g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; - if ((g_s._mlieu == ATTIC) && (g_num == 8)) + if ((g_s._currPlace == ATTIC) && (g_num == 8)) g_crep = 126; - if (g_s._mlieu == MOUNTAIN) + if (g_s._currPlace == MOUNTAIN) g_crep = 103; if (g_crep == 255) g_crep = 131; - if ((g_s._mlieu == GREEN_ROOM) && (g_num == 1)) + if ((g_s._currPlace == GREEN_ROOM) && (g_num == 1)) treg(144); - if ((g_s._mlieu == BLUE_ROOM) && (g_num == 3)) + if ((g_s._currPlace == BLUE_ROOM) && (g_num == 3)) treg(147); - if ((g_s._mlieu == GREEN_ROOM2) && (g_num == 3)) + if ((g_s._currPlace == GREEN_ROOM2) && (g_num == 3)) treg(149); - if ((g_s._mlieu == 9) && (g_num == 2)) + if ((g_s._currPlace == 9) && (g_num == 2)) treg(30); - if ((g_s._mlieu == DINING_ROOM) && (g_num == 3)) + if ((g_s._currPlace == DINING_ROOM) && (g_num == 3)) treg(31); } @@ -491,7 +492,7 @@ void fctSearch() { if (g_anyone || g_iesc) return; - if (g_s._mlieu == 23) { + if (g_s._currPlace == 23) { g_crep = 1504; tperd(); return; @@ -527,16 +528,16 @@ void fctSearch() { if (g_num != 0) { if (g_ipers > 0) g_s._conf += 3; - if ((g_s._mlieu != WELL) && (g_s._mlieu != SECRET_PASSAGE) && (g_s._mlieu != ATTIC)) { - if (g_s._mlieu == PURPLE_ROOM) { + if ((g_s._currPlace != WELL) && (g_s._currPlace != SECRET_PASSAGE) && (g_s._currPlace != ATTIC)) { + if (g_s._currPlace == PURPLE_ROOM) { g_crep = 123; - if (g_s._iloic != 0) - treg(g_s._iloic); + if (g_s._purpleRoomObjectId != 0) + treg(g_s._purpleRoomObjectId); } - if (g_s._mlieu == CRYPT) { + if (g_s._currPlace == CRYPT) { g_crep = 123; - if (g_s._icryp != 0) - treg(g_s._icryp); + if (g_s._cryptObjectId != 0) + treg(g_s._cryptObjectId); } } } @@ -545,22 +546,22 @@ void fctSearch() { if (g_ipers > 0) g_s._conf += 3; g_crep = 997; - if (g_s._mlieu < CELLAR) - g_crep = r[g_s._mlieu]; + if (g_s._currPlace < CELLAR) + g_crep = r[g_s._currPlace]; - if ((g_s._mlieu == TOILETS) && (g_num == 2)) + if ((g_s._currPlace == TOILETS) && (g_num == 2)) g_crep = 162; - if (g_s._mlieu == KITCHEN) { + if (g_s._currPlace == KITCHEN) { if ((g_num == 3) || (g_num == 4)) g_crep = 162; else if (g_num == 5) g_crep = 159; } - if (g_s._mlieu == MOUNTAIN) + if (g_s._currPlace == MOUNTAIN) g_crep = 104; - else if (g_s._mlieu == CRYPT) + else if (g_s._currPlace == CRYPT) g_crep = 155; } } @@ -607,30 +608,30 @@ void fctOpen() { if (g_ipers > 0) g_s._conf += 2; ++g_iouv; - int cx = 0; + int tmpPlace = 0; do { - ++cx; - } while (!((cx > 6) || (ord(g_touv[cx]) == 0) || (ord(g_touv[cx]) == g_num))); - if (ord(g_touv[cx]) != g_num) { - if (!( ((g_num == 3) && ((g_s._mlieu == OWN_ROOM) || (g_s._mlieu == 9) || (g_s._mlieu == BLUE_ROOM) || (g_s._mlieu == BATHROOM))) - || ((g_num == 4) && ((g_s._mlieu == GREEN_ROOM) || (g_s._mlieu == PURPLE_ROOM) || (g_s._mlieu == RED_ROOM))) - || ((g_s._mlieu == DARKBLUE_ROOM) && (g_num == 5)) - || ((g_num == 6) && ((g_s._mlieu == BATHROOM) || (g_s._mlieu == DINING_ROOM) || (g_s._mlieu == GREEN_ROOM2) || (g_s._mlieu == ATTIC))) - || ((g_s._mlieu == GREEN_ROOM2) && (g_num == 2)) - || ((g_s._mlieu == KITCHEN) && (g_num == 7))) ) { - if ( ((g_s._mlieu > DINING_ROOM) && (g_s._mlieu < CELLAR)) - || ((g_s._mlieu > RED_ROOM) && (g_s._mlieu < DINING_ROOM)) - || (g_s._mlieu == OWN_ROOM) || (g_s._mlieu == PURPLE_ROOM) || (g_s._mlieu == BLUE_ROOM)) { + ++tmpPlace; + } while (!((tmpPlace > 6) || (ord(g_touv[tmpPlace]) == 0) || (ord(g_touv[tmpPlace]) == g_num))); + if (ord(g_touv[tmpPlace]) != g_num) { + if (!( ((g_num == 3) && ((g_s._currPlace == OWN_ROOM) || (g_s._currPlace == 9) || (g_s._currPlace == BLUE_ROOM) || (g_s._currPlace == BATHROOM))) + || ((g_num == 4) && ((g_s._currPlace == GREEN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == RED_ROOM))) + || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 5)) + || ((g_num == 6) && ((g_s._currPlace == BATHROOM) || (g_s._currPlace == DINING_ROOM) || (g_s._currPlace == GREEN_ROOM2) || (g_s._currPlace == ATTIC))) + || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 2)) + || ((g_s._currPlace == KITCHEN) && (g_num == 7))) ) { + if ( ((g_s._currPlace > DINING_ROOM) && (g_s._currPlace < CELLAR)) + || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) + || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) parole(7, 9, 1); } - g_touv[cx] = chr(g_num); + g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); } - cx = g_s._mlieu; - if (g_s._mlieu == CRYPT) - cx = 14; - g_crep = g_tabdon[aouvr + (cx * 7) + g_num - 1]; + tmpPlace = g_s._currPlace; + if (g_s._currPlace == CRYPT) + tmpPlace = CELLAR; + g_crep = g_tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; if (g_crep == 254) g_crep = 999; } else @@ -663,27 +664,27 @@ void fctPlace() { g_crep = 999; if (g_caff == 13) { if (g_num == 1) { - if (g_s._iboul != 0) { + if (g_s._atticBallHoleObjectId != 0) { g_crep = 188; } else { - g_s._iboul = g_s._selectedObjectId; + g_s._atticBallHoleObjectId = g_s._selectedObjectId; if (g_s._selectedObjectId == 141) aniof(1, 7); } - } else if (g_s._ibag != 0) { + } else if (g_s._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._ibag = g_s._selectedObjectId; + g_s._atticRodHoleObjectId = g_s._selectedObjectId; if (g_s._selectedObjectId == 159) aniof(1, 6); } } if (g_caff == 14) { - if (g_s._icave != 0) { + if (g_s._cellarObjectId != 0) { g_crep = 188; } else { - g_s._icave = g_s._selectedObjectId; + g_s._cellarObjectId = g_s._selectedObjectId; if (g_s._selectedObjectId == 151) { // Open hidden passage aniof(1, 2); @@ -714,10 +715,10 @@ void fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { - g_s._mlieu = SECRET_PASSAGE; + g_s._currPlace = SECRET_PASSAGE; tmlieu(17); } else { - tmlieu(g_s._mlieu); + tmlieu(g_s._currPlace); writepal(14); dessin(0); aniof(1, 2); @@ -738,17 +739,17 @@ void fctPlace() { } if (g_caff == 16) { - if (g_s._icryp == 0) - g_s._icryp = g_s._selectedObjectId; + if (g_s._cryptObjectId == 0) + g_s._cryptObjectId = g_s._selectedObjectId; else g_crep = 188; } if (g_caff == 17) { - if (g_s._ivier != 0) { + if (g_s._secretPassageObjectId != 0) { g_crep = 188; } else if (g_s._selectedObjectId == 143) { - g_s._ivier = 143; + g_s._secretPassageObjectId = 143; aniof(1, 1); } else { g_crep = 1512; @@ -757,10 +758,10 @@ void fctPlace() { } if (g_caff == 24) { - if (g_s._ipuit != 0) { + if (g_s._wellObjectId != 0) { g_crep = 188; } else if ((g_s._selectedObjectId == 140) || (g_s._selectedObjectId == 120)) { - g_s._ipuit = g_s._selectedObjectId; + g_s._wellObjectId = g_s._selectedObjectId; aniof(1, 1); } else { g_crep = 185; @@ -789,7 +790,7 @@ void fctTurn() { tcoord(9); if (g_num != 0) { g_crep = 997; - if ((g_s._mlieu == ATTIC) && (g_s._ibag == 159) && (g_s._iboul == 141)) { + if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { repon(2, 167); parole(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -798,13 +799,13 @@ void fctTurn() { else g_crep = 168; } - if ((g_s._mlieu == SECRET_PASSAGE) && (g_s._ivier == 143)) { + if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { repon(2, 175); clsf3(); parole(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { - g_s._mlieu = CRYPT; + g_s._currPlace = CRYPT; affrep(); } else g_crep = 176; @@ -845,10 +846,10 @@ void fctAttach() { if (!(g_anyone) && !(g_iesc)) { tcoord(8); g_crep = 997; - if ((g_num != 0) && (g_s._mlieu == WELL)) { + if ((g_num != 0) && (g_s._currPlace == WELL)) { g_crep = 999; if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) { - g_s._ipuit = g_s._selectedObjectId; + g_s._wellObjectId = g_s._selectedObjectId; aniof(1, 1); } else g_crep = 185; @@ -903,20 +904,20 @@ void fctClose() { * @remarks Originally called 'tfrapper' */ void fctKnock() { - warning("Knock - mlieu %d", g_s._mlieu); + warning("Knock - _currPlace %d", g_s._currPlace); if (!g_syn) ecr3(g_vm->getEngineString(S_HIT)); - if (g_s._mlieu == LANDING) { + if (g_s._currPlace == LANDING) { Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (g_s._mlieu < DOOR) { + if (g_s._currPlace < DOOR) { tfleche(); if (!(g_anyone) && !(g_iesc)) { - if ((g_s._mlieu < MOUNTAIN) && (g_s._mlieu != LANDING)) + if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) g_crep = 133; else g_crep = 997; @@ -925,7 +926,7 @@ void fctKnock() { return; } - if (g_s._mlieu == 26) { + if (g_s._currPlace == 26) { int rand = (getRandomNumber(0, 8)) - 4; parole(11, rand, 1); int p; @@ -991,40 +992,40 @@ void fctSelfPut() { tcoord(8); if (g_num != 0) { g_crep = 998; - if (g_caff == 2) { - if (g_s._iloic != 0) + if (g_caff == PURPLE_ROOM) { + if (g_s._purpleRoomObjectId != 0) g_crep = 188; else - g_s._iloic = g_s._selectedObjectId; + g_s._purpleRoomObjectId = g_s._selectedObjectId; } - if (g_caff == 13) { + if (g_caff == ATTIC) { if (g_num == 1) { - if (g_s._iboul != 0) + if (g_s._atticBallHoleObjectId != 0) g_crep = 188; else - g_s._iboul = g_s._selectedObjectId; - } else if (g_s._ibag != 0) { + g_s._atticBallHoleObjectId = g_s._selectedObjectId; + } else if (g_s._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._ibag = g_s._selectedObjectId; + g_s._atticRodHoleObjectId = g_s._selectedObjectId; } } - if (g_caff == 16) { - if (g_s._icryp != 0) + if (g_caff == CRYPT) { + if (g_s._cryptObjectId != 0) g_crep = 188; else - g_s._icryp = g_s._selectedObjectId; + g_s._cryptObjectId = g_s._selectedObjectId; } - if (g_caff == 24) + if (g_caff == WELL) g_crep = 185; - if ((g_caff == 14) || (g_caff == 17)) + if ((g_caff == CELLAR) || (g_caff == SECRET_PASSAGE)) g_crep = 124; } else { g_crep = 124; - if (g_caff == 24) { + if (g_caff == WELL) { tcoord(5); if (g_num != 0) g_crep = 185; @@ -1047,7 +1048,7 @@ void fctSelfPut() { * @remarks Originally called 'tecouter' */ void fctListen() { - if (g_s._mlieu != 26) + if (g_s._currPlace != 26) g_crep = 101; else { if (g_ipers != 0) @@ -1085,14 +1086,14 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - if ((g_s._mlieu > LANDING) && (g_s._mlieu < 26)) { + if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { g_crep = 148; } else { tsort(); - g_s._mlieu = DINING_ROOM; + g_s._currPlace = DINING_ROOM; g_caff = 10; - debloc(g_s._mlieu); - tmlieu(g_s._mlieu); + debloc(g_s._currPlace); + tmlieu(g_s._currPlace); int j, h, m; calch(j, h, m); @@ -1126,10 +1127,10 @@ void fctEat() { * @remarks Originally called 'tentrer' */ void fctEnter() { - if ((g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK)) { + if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { t1sama(); - tmlieu(g_s._mlieu); - } else if (g_s._mlieu == LANDING) + tmlieu(g_s._currPlace); + } else if (g_s._currPlace == LANDING) aldepl(); else if (g_ment == 0) g_crep = 997; @@ -1150,7 +1151,7 @@ void fctEnter() { tip(z, g_x); ++g_s._conf; - g_s._mlieu = LANDING; + g_s._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; g_syn = true; @@ -1169,10 +1170,10 @@ void fctEnter() { parole(7, g_x, 1); aniof(1, 1); - g_s._mlieu = g_ment; + g_s._currPlace = g_ment; affrep(); - debloc(g_s._mlieu); - tmlieu(g_s._mlieu); + debloc(g_s._currPlace); + tmlieu(g_s._currPlace); g_ment = 0; g_mpers = 0; g_ipers = 0; @@ -1187,17 +1188,17 @@ void fctEnter() { void fctSleep() { int z, j, h, m; - if ((g_s._mlieu > LANDING) && (g_s._mlieu < 26)) { + if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { g_crep = 148; return; } - if (g_s._mlieu != OWN_ROOM) { + if (g_s._currPlace != OWN_ROOM) { tsort(); - g_s._mlieu = OWN_ROOM; + g_s._currPlace = OWN_ROOM; affrep(); afdes(0); - debloc(g_s._mlieu); - tmlieu(g_s._mlieu); + debloc(g_s._currPlace); + tmlieu(g_s._currPlace); } clsf3(); clsf2(); @@ -1238,7 +1239,7 @@ void fctForce() { tfleche(); if ((!g_anyone) && (!g_iesc)) { - if (g_s._mlieu != 26) + if (g_s._currPlace != 26) g_crep = 997; else { g_crep = 143; @@ -1254,27 +1255,27 @@ void fctForce() { void fctLeave() { tsort(); g_crep = 0; - if ((g_s._mlieu == MOUNTAIN) || (g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK) || (g_s._mlieu == WELL)) + if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) g_crep = 997; else { int lx = 0; - if ((g_s._mlieu < CRYPT) || (g_s._mlieu == 26)) + if ((g_s._currPlace < CRYPT) || (g_s._currPlace == 26)) lx = 10; - if ((g_s._mlieu == DINING_ROOM) || (g_s._mlieu == CHAPEL)) + if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) lx = 21; - if ((g_s._mlieu < DINING_ROOM) || (g_s._mlieu == ATTIC)) + if ((g_s._currPlace < DINING_ROOM) || (g_s._currPlace == ATTIC)) lx = 15; - if (g_s._mlieu == CRYPT) { + if (g_s._currPlace == CRYPT) { lx = 17; g_crep = 176; } - if (g_s._mlieu == SECRET_PASSAGE) + if (g_s._currPlace == SECRET_PASSAGE) t23coul(lx); - if (g_s._mlieu == 23) + if (g_s._currPlace == 23) lx = 24; if (g_crep != 997) - g_s._mlieu = lx; + g_s._currPlace = lx; g_caff = lx; if (g_crep == 0) g_crep = lx; @@ -1298,12 +1299,12 @@ void fctWait() { ++g_jh; tinke(); if (!g_blo) - t11(g_s._mlieu, quel); + t11(g_s._currPlace, quel); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; - if ((g_s._mlieu == ATTIC) || (g_s._mlieu == CELLAR)) + if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) cavegre(); - if ((g_s._mlieu > OWN_ROOM) && (g_s._mlieu < DINING_ROOM)) + if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) g_anyone = true; g_mpers = g_ipers; if (!g_anyone) @@ -1465,7 +1466,7 @@ void fctDiscuss() { int ix = choi - 1; if (g_col) { g_col = false; - g_s._mlieu = 15; + g_s._currPlace = 15; if (g_iouv > 0) max = 8; else @@ -1515,7 +1516,7 @@ void fctDiscuss() { sparl(0, 138); showMouse(); g_col = false; - g_s._mlieu = 15; + g_s._currPlace = 15; } g_ctrm = 0; hideMouse(); @@ -1527,7 +1528,7 @@ void fctDiscuss() { drawClock(); affrep(); /* chech;*/ - tmlieu(g_s._mlieu); + tmlieu(g_s._currPlace); clsf3(); } @@ -1593,8 +1594,11 @@ void MortevielleEngine::endGame() { repon(2, 35); musique(0); tkey1(false); - messint(2036); - tkey1(false); + // A wait message was displayed. + // tkey1 was called before and after. + // Most likely the double call is useless, thus removed + // + // tkey1(false); inzon(); } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 52b71c7994..d6d52367e4 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1015,15 +1015,15 @@ void inzon() { g_s._ipre = false; g_s._selectedObjectId = 0; - g_s._icave = 0; - g_s._iboul = 0; - g_s._ibag = 0; - g_s._ipuit = 0; - g_s._ivier = 0; - g_s._iloic = 136; - g_s._icryp = 141; + g_s._cellarObjectId = 0; + g_s._atticBallHoleObjectId = 0; + g_s._atticRodHoleObjectId = 0; + g_s._wellObjectId = 0; + g_s._secretPassageObjectId = 0; + g_s._purpleRoomObjectId = 136; + g_s._cryptObjectId = 141; g_s._conf = getRandomNumber(4, 10); - g_s._mlieu = MANOR_FRONT; + g_s._currPlace = MANOR_FRONT; for (int cx = 2; cx <= 6; ++cx) g_s._sjer[cx] = chr(0); @@ -1275,16 +1275,6 @@ void writetp(Common::String s, int t) { g_vm->_screenSurface.writeg(copy(s, 1, 25), t); } -/** - * Shows the waiting message when changing scenes. - * @remarks Because modern computesr are so much quicker. There's no point in showing - * a waiting message between scenes. - */ -void messint(int nu) { - // Method is deprecated - warning("DEPRECATED: messint"); -} - void aniof(int ouf, int num) { if ((g_caff == 7) && ((num == 4) || (num == 5))) return; @@ -1318,27 +1308,27 @@ void musique(int so) { ++g_prebru; } else { bool i = false; - if ((g_s._mlieu == MOUNTAIN) || (g_s._mlieu == MANOR_FRONT) || (g_s._mlieu == MANOR_BACK)) { + if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { if (getRandomNumber(1, 3) == 2) { parole(9, getRandomNumber(2, 4), 1); i = true; } } - if (g_s._mlieu == CHAPEL) { + if (g_s._currPlace == CHAPEL) { if (getRandomNumber(1, 2) == 1) { parole(8, 1, 1); i = true; } } - if (g_s._mlieu == WELL) { + if (g_s._currPlace == WELL) { if (getRandomNumber(1, 2) == 2) { parole(12, 1, 1); i = true; } } - if (g_s._mlieu == 23) { + if (g_s._currPlace == 23) { parole(13, 1, 1); i = true; } @@ -1369,19 +1359,19 @@ void dessin(int ad) { } if (g_caff == 13) { - if (g_s._iboul == 141) + if (g_s._atticBallHoleObjectId == 141) aniof(1, 7); - if (g_s._ibag == 159) + if (g_s._atticRodHoleObjectId == 159) aniof(1, 6); } - if ((g_caff == 14) && (g_s._icave == 151)) + if ((g_caff == 14) && (g_s._cellarObjectId == 151)) aniof(1, 2); - if ((g_caff == 17) && (g_s._ivier == 143)) + if ((g_caff == 17) && (g_s._secretPassageObjectId == 143)) aniof(1, 1); - if ((g_caff == 24) && (g_s._ipuit != 0)) + if ((g_caff == 24) && (g_s._wellObjectId != 0)) aniof(1, 1); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index f649195f24..87238c4217 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -113,7 +113,6 @@ extern void pl20(int cf); extern void t11(int l11, int &a); extern void cavegre(); extern void writetp(Common::String s, int t); -extern void messint(int nu); extern void aniof(int ouf, int num); extern void musique(int so); /* NIVEAU 9 */ diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 05002a3a62..28692eac83 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -157,7 +157,7 @@ void tinke() { g_mpers = g_ipers; if ((g_mpers == 0) && (g_ipers > 0)) { - if ((g_s._mlieu == ATTIC) || (g_s._mlieu == CELLAR)) { + if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { cavegre(); } else if (g_ipers == 10) { g_ipers = 0; @@ -185,7 +185,7 @@ void tinke() { nouvp(g_li, cx); g_brt = false; g_hdb = 0; - if ((g_s._mlieu > OWN_ROOM) && (g_s._mlieu < DINING_ROOM)) + if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) g_anyone = true; } } @@ -269,8 +269,8 @@ void tlu(int af, int ob) { } void affrep() { - g_caff = g_s._mlieu; - g_crep = g_s._mlieu; + g_caff = g_s._currPlace; + g_crep = g_s._currPlace; } /** @@ -278,7 +278,7 @@ void affrep() { * @remarks Originally called 'mfouen' */ void unsetSearchMenu() { - tmlieu(g_s._mlieu); + tmlieu(g_s._currPlace); for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(_actionMenu[cx]); @@ -312,7 +312,7 @@ void tperd() { void tsort() { - if ((g_iouv > 0) && (g_s._mlieu != 0)) { + if ((g_iouv > 0) && (g_s._currPlace != 0)) { if (g_s._conf < 50) g_s._conf += 2; else @@ -324,7 +324,7 @@ void tsort() { g_ment = 0; g_iouv = 0; g_mchai = 0; - debloc(g_s._mlieu); + debloc(g_s._currPlace); } void st4(int ob) { @@ -369,7 +369,7 @@ void cherjer(int ob, bool &d) { } void st1sama() { - g_s._mlieu = DINING_ROOM; + g_s._currPlace = DINING_ROOM; affrep(); } @@ -480,7 +480,7 @@ void t1sama() { //Entering manor int j, h, m; calch(j, h, m); - if ((h < 5) && (g_s._mlieu > 18)) { + if ((h < 5) && (g_s._currPlace > 18)) { bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late @@ -504,7 +504,7 @@ void t1sama() { //Entering manor dessine_rouleau(); drawClock(); showMouse(); - g_s._mlieu = OWN_ROOM; + g_s._currPlace = OWN_ROOM; affrep(); t5(10); if (!g_blo) @@ -518,7 +518,7 @@ void t1sama() { //Entering manor } void t1vier() { - g_s._mlieu = SECRET_PASSAGE; + g_s._currPlace = SECRET_PASSAGE; affrep(); } @@ -529,19 +529,19 @@ void t1neig() { tperd(); } else { g_okdes = true; - g_s._mlieu = MOUNTAIN; + g_s._currPlace = MOUNTAIN; affrep(); } } void t1deva() { g_inei = 0; - g_s._mlieu = MANOR_FRONT; + g_s._currPlace = MANOR_FRONT; affrep(); } void t1derr() { - g_s._mlieu = MANOR_BACK; + g_s._currPlace = MANOR_BACK; affrep(); } @@ -777,11 +777,11 @@ void avpoing(int &ob) { } void rechai(int &ch) { - int cx = g_s._mlieu; + int tmpPlace = g_s._currPlace; - if (g_s._mlieu == CRYPT) - cx = 14; - ch = g_tabdon[achai + (cx * 7) + g_num - 1]; + if (g_s._currPlace == CRYPT) + tmpPlace = CELLAR; + ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } void t23coul(int &l) { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 51f0d95c8e..7ed3e921a5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -621,7 +621,7 @@ void MortevielleEngine::handleAction() { oo = true; if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) { endSearch(); - g_caff = g_s._mlieu; + g_caff = g_s._currPlace; g_crep = 998; } else tsuiv(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 8479538879..46bde5ee53 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -122,7 +122,7 @@ void MortevielleEngine::gameLoaded() { repon(2, g_crep); clsf3(); _endGame = false; - tmlieu(g_s._mlieu); + tmlieu(g_s._currPlace); modinv(); if (g_s._selectedObjectId != 0) modobj(g_s._selectedObjectId + 400); @@ -226,11 +226,11 @@ void tsitu() { } } calch(j, h, m); - if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._mlieu != 10)) || - ((h > 0) && (h < 6) && (g_s._mlieu != 0))) + if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._currPlace != 10)) || + ((h > 0) && (h < 6) && (g_s._currPlace != 0))) ++g_s._conf; - if (((g_s._mlieu < CRYPT) || (g_s._mlieu > MOUNTAIN)) && (g_s._mlieu != 23) - && (g_s._mlieu != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { + if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) + && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { if ((g_s._conf > 99) && (h > 8) && (h < 16)) { g_crep = 1501; tperd(); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 53a147c86c..386fd95ef5 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -53,15 +53,15 @@ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncBytes((byte *)&g_s1._pourc[0], 11); sz.syncBytes((byte *)&g_s1._teauto[0], 43); sz.syncBytes((byte *)&g_s1._sjer[0], 31); - sz.syncAsSint16LE(g_s1._mlieu); - sz.syncAsSint16LE(g_s1._iboul); - sz.syncAsSint16LE(g_s1._ibag); - sz.syncAsSint16LE(g_s1._icave); - sz.syncAsSint16LE(g_s1._ivier); - sz.syncAsSint16LE(g_s1._ipuit); + sz.syncAsSint16LE(g_s1._currPlace); + sz.syncAsSint16LE(g_s1._atticBallHoleObjectId); + sz.syncAsSint16LE(g_s1._atticRodHoleObjectId); + sz.syncAsSint16LE(g_s1._cellarObjectId); + sz.syncAsSint16LE(g_s1._secretPassageObjectId); + sz.syncAsSint16LE(g_s1._wellObjectId); sz.syncAsSint16LE(g_s1._selectedObjectId); - sz.syncAsSint16LE(g_s1._iloic); - sz.syncAsSint16LE(g_s1._icryp); + sz.syncAsSint16LE(g_s1._purpleRoomObjectId); + sz.syncAsSint16LE(g_s1._cryptObjectId); sz.syncAsByte(g_s1._ipre); sz.syncAsByte(g_s1._heure); @@ -144,8 +144,8 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { for (i = 0; i <= 389; ++i) g_bufcha[i] = g_tabdon[i + acha]; g_s1 = g_s; - if (g_s1._mlieu == 26) - g_s1._mlieu = 15; + if (g_s1._currPlace == 26) + g_s1._currPlace = 15; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 096a076001..00d9dca3ef 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -176,7 +176,6 @@ void taffich() { if (((a < 27) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; - messint(m); g_maff = a; if (a == 159) a = 86; @@ -249,11 +248,11 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s._mlieu == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (!g_blo) - t11(g_s._mlieu, cx); + t11(g_s._currPlace, cx); g_mpers = 0; } } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index dd65f39c07..8c661437a9 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -165,8 +165,8 @@ struct sav_chaine { byte _pourc[11]; byte _teauto[43]; byte _sjer[31]; - int _mlieu, _iboul, _ibag, _icave, _ivier, _ipuit; - int _selectedObjectId, _iloic, _icryp; + int _currPlace, _atticBallHoleObjectId, _atticRodHoleObjectId, _cellarObjectId, _secretPassageObjectId, _wellObjectId; + int _selectedObjectId, _purpleRoomObjectId, _cryptObjectId; bool _ipre; byte _heure; }; -- cgit v1.2.3 From 1ee4429601c0e009196d66d3e676deeb85b11b49 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Mar 2012 07:45:43 +0100 Subject: MORTEVIELLE: Rename some more functions and globals --- engines/mortevielle/actions.cpp | 42 +++++----- engines/mortevielle/mor.cpp | 174 +++++++++++++++++++++++++-------------- engines/mortevielle/mor.h | 18 ++-- engines/mortevielle/mor2.cpp | 18 ++-- engines/mortevielle/prog.cpp | 6 +- engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.h | 2 +- 7 files changed, 155 insertions(+), 107 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6b9388ab33..22c12d6a67 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -164,7 +164,7 @@ void fctMove() { g_crep = 997; else if (g_s._wellObjectId == 120) g_crep = 181; - else if (g_s._conf > 80) { + else if (g_s._faithScore > 80) { g_crep = 1505; tperd(); } else { @@ -189,7 +189,7 @@ void fctTake() { avpoing(cx); if (g_crep != 139) { if (g_ipers > 0) - g_s._conf += 3; + g_s._faithScore += 3; if (g_obpart) { if (g_s._currPlace == PURPLE_ROOM) g_s._purpleRoomObjectId = 0; @@ -215,7 +215,7 @@ void fctTake() { tsuiv(); ++g_dobj; if (g_dobj > 6) { - g_s._conf += 2; + g_s._faithScore += 2; g_dobj = 0; } } @@ -239,7 +239,7 @@ void fctTake() { tcoord(8); if (g_num != 0) { if (g_ipers > 0) - g_s._conf += 3; + g_s._faithScore += 3; g_crep = 997; if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) avpoing(g_s._purpleRoomObjectId); @@ -335,7 +335,7 @@ void fctLift() { tcoord(8); if (g_num != 0) { if (g_ipers > 0) - ++g_s._conf; + ++g_s._faithScore; g_crep = 997; if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) treg(g_s._purpleRoomObjectId); @@ -343,7 +343,7 @@ void fctLift() { return; } if (g_ipers > 0) - ++g_s._conf; + ++g_s._faithScore; int tmpPlace = g_s._currPlace; if (g_s._currPlace == CRYPT) tmpPlace = 14; @@ -510,7 +510,7 @@ void fctSearch() { g_crep = 187; else { if (g_ipers > 0) - g_s._conf += 3; + g_s._faithScore += 3; rechai(g_mchai); if (g_mchai != 0) { @@ -527,7 +527,7 @@ void fctSearch() { g_crep = 997; if (g_num != 0) { if (g_ipers > 0) - g_s._conf += 3; + g_s._faithScore += 3; if ((g_s._currPlace != WELL) && (g_s._currPlace != SECRET_PASSAGE) && (g_s._currPlace != ATTIC)) { if (g_s._currPlace == PURPLE_ROOM) { g_crep = 123; @@ -544,7 +544,7 @@ void fctSearch() { } } else { if (g_ipers > 0) - g_s._conf += 3; + g_s._faithScore += 3; g_crep = 997; if (g_s._currPlace < CELLAR) g_crep = r[g_s._currPlace]; @@ -606,7 +606,7 @@ void fctOpen() { tcoord(7); if (g_num != 0) { if (g_ipers > 0) - g_s._conf += 2; + g_s._faithScore += 2; ++g_iouv; int tmpPlace = 0; do { @@ -930,7 +930,7 @@ void fctKnock() { int rand = (getRandomNumber(0, 8)) - 4; parole(11, rand, 1); int p; - ecfren(p, rand, g_s._conf, g_ment); + ecfren(p, rand, g_s._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -1052,9 +1052,9 @@ void fctListen() { g_crep = 101; else { if (g_ipers != 0) - ++g_s._conf; + ++g_s._faithScore; int p, rand; - ecfren(p, rand, g_s._conf, g_ment); + ecfren(p, rand, g_s._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -1098,7 +1098,7 @@ void fctEat() { int j, h, m; calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { - g_s._conf -= (g_s._conf / 7); + g_s._faithScore -= (g_s._faithScore / 7); if (h == 12) { if (m == 0) h = 4; @@ -1150,7 +1150,7 @@ void fctEnter() { aniof(1, 1); tip(z, g_x); - ++g_s._conf; + ++g_s._faithScore; g_s._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; @@ -1209,7 +1209,7 @@ void fctSleep() { int answer; do { if (h < 8) { - g_s._conf -= (g_s._conf / 20); + g_s._faithScore -= (g_s._faithScore / 20); z = (7 - h) * 2; if (m == 30) --z; @@ -1243,7 +1243,7 @@ void fctForce() { g_crep = 997; else { g_crep = 143; - g_s._conf += 2; + g_s._faithScore += 2; } } } @@ -1475,14 +1475,14 @@ void fctDiscuss() { suj = 129; else { suj = 138; - g_s._conf += (3 * (g_s._conf / 10)); + g_s._faithScore += (3 * (g_s._faithScore / 10)); } } else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) { suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)]; - g_s._conf += g_tabdon[arcf + ix]; + g_s._faithScore += g_tabdon[arcf + ix]; ++g_nbrep[g_caff - 69]; } else { - g_s._conf += 3; + g_s._faithScore += 3; suj = 139; } hideMouse(); @@ -1509,7 +1509,7 @@ void fctDiscuss() { } } while ((choi != 46) && (suj != 138)); if (g_col) { - g_s._conf += (3 * (g_s._conf / 10)); + g_s._faithScore += (3 * (g_s._faithScore / 10)); hideMouse(); hirs(); premtet(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index d6d52367e4..82d0ef1979 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -236,11 +236,11 @@ void clsf10() { cod = 544; } g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s._conf < 33) + if (g_s._faithScore < 33) st = g_vm->getEngineString(S_COOL); - else if (g_s._conf < 66) + else if (g_s._faithScore < 66) st = g_vm->getEngineString(S_LOURDE); - else if (g_s._conf > 65) + else if (g_s._faithScore > 65) st = g_vm->getEngineString(S_MALSAINE); co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); @@ -746,10 +746,12 @@ void cpl20(int &p, int &h) { p = -5; } -void quelq1(int l) { - int per; - - per = getRandomNumber(1, 2); +/** + * Engine function - Check who is in the Green Room + * @remarks Originally called 'quelq1' + */ +void setPresenceGreenRoom(int l) { + int per = getRandomNumber(1, 2); if (l == 1) { if (per == 1) g_bh1 = true; @@ -765,7 +767,11 @@ void quelq1(int l) { g_ipers = 10; } -void quelq2() { +/** + * Engine function - Check who is in the Purple Room + * @remarks Originally called 'quelq2' + */ +void setPresencePurpleRoom() { if (g_li == 2) g_bh2 = true; else @@ -774,12 +780,20 @@ void quelq2() { g_ipers = 10; } -void quelq5() { +/** + * Engine function - Check who is in the Blue Room + * @remarks Originally called 'quelq5' + */ +void setPresenceBlueRoom() { g_bh5 = true; g_ipers = 10; } -void quelq6(int l) { +/** + * Engine function - Check who is in the Red Room + * @remarks Originally called 'quelq6' + */ +void setPresenceRedRoom(int l) { if (l == 6) g_bh6 = true; else if (l == 8) @@ -788,9 +802,15 @@ void quelq6(int l) { g_ipers = 10; } -void quelq10(int h, int &per) { +/** + * Engine function - Check who is in the Dining Room + * @remarks Originally called 'quelq10' + */ +int setPresenceDiningRoom(int h) { + int retVal = 0; + if ((h >= 0) && (h < 8)) - per = chlm(); + retVal = chlm(); else { int min = 0, max = 0; if ((h > 7) && (h < 10)) { @@ -806,14 +826,22 @@ void quelq10(int h, int &per) { min = 1; max = 5; } - choix(min, max, per); + choix(min, max, retVal); } - affper(per); + affper(retVal); + + return retVal; } -void quelq11(int h, int &per) { +/** + * Engine function - Check who is in the Bureau + * @remarks Originally called 'quelq11' + */ +int setPresenceBureau(int h) { + int retVal = 0; + if ((h >= 0) && (h < 8)) - per = chlm(); + retVal = chlm(); else { int min = 0, max = 0; if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { @@ -826,41 +854,59 @@ void quelq11(int h, int &per) { min = 1; max = 2; } - choix(min, max, per); + choix(min, max, retVal); } - affper(per); -} + affper(retVal); -void quelq12(int &per) { - per = chlm(); - affper(per); + return retVal; } -void quelq15(int &per) { - int cx; - bool test; +/** + * Engine function - Check who is in the Kitchen + * @remarks Originally called 'quelq12' + */ +int setPresenceKitchen() { + int retVal = chlm(); + affper(retVal); - per = 0; + return retVal; +} +/** + * Engine function - Check who is in the Landing + * @remarks Originally called 'quelq15' + */ +int setPresenceLanding() { + bool test = false; + int rand = 0; do { - cx = getRandomNumber(1, 8); - test = (((cx == 1) && (g_bh2 || g_bh9)) || - ((cx == 2) && g_bh8) || - ((cx == 3) && g_bh4) || - ((cx == 4) && g_bf4) || - ((cx == 5) && g_bh6) || - ((cx == 6) && g_bh1) || - ((cx == 7) && g_bf1) || - ((cx == 8) && g_bh5)); + rand = getRandomNumber(1, 8); + test = (((rand == 1) && (g_bh2 || g_bh9)) || + ((rand == 2) && g_bh8) || + ((rand == 3) && g_bh4) || + ((rand == 4) && g_bf4) || + ((rand == 5) && g_bh6) || + ((rand == 6) && g_bh1) || + ((rand == 7) && g_bf1) || + ((rand == 8) && g_bh5)); } while (test); - conv(cx, per); - affper(per); + int retVal = 0; + conv(rand, retVal); + affper(retVal); + + return retVal; } -void quelq20(int h, int &per) { +/** + * Engine function - Check who is in the chapel + * @remarks Originally called 'quelq20' + */ +int setPresenceChapel(int h) { + int retVal = 0; + if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) - per = chlm(); + retVal = chlm(); else { int min = 0, max = 0; if ((h > 9) && (h < 12)) { @@ -873,9 +919,11 @@ void quelq20(int h, int &per) { min = 2; max = 4; } - choix(min, max, per); + choix(min, max, retVal); } - affper(per); + affper(retVal); + + return retVal; } @@ -1022,7 +1070,7 @@ void inzon() { g_s._secretPassageObjectId = 0; g_s._purpleRoomObjectId = 136; g_s._cryptObjectId = 141; - g_s._conf = getRandomNumber(4, 10); + g_s._faithScore = getRandomNumber(4, 10); g_s._currPlace = MANOR_FRONT; for (int cx = 2; cx <= 6; ++cx) @@ -1072,7 +1120,7 @@ void pl1(int cf) { if (rand > p) person(); else - quelq1(g_li); + setPresenceGreenRoom(g_li); } } @@ -1085,7 +1133,7 @@ void pl2(int cf) { if (rand > p) person(); else - quelq2(); + setPresencePurpleRoom(); } } @@ -1098,7 +1146,7 @@ void pl5(int cf) { if (rand > p) person(); else - quelq5(); + setPresenceBlueRoom(); } } @@ -1111,7 +1159,7 @@ void pl6(int cf) { if (rand > p) person(); else - quelq6(g_li); + setPresenceRedRoom(g_li); } } @@ -1124,7 +1172,7 @@ void pl9(int cf) { if (rand > p) person(); else - quelq2(); + setPresencePurpleRoom(); } } @@ -1136,7 +1184,7 @@ void pl10(int cf) { if (rand > p) person(); else - quelq10(h, p); + p = setPresenceDiningRoom(h); } void pl11(int cf) { @@ -1147,7 +1195,7 @@ void pl11(int cf) { if (rand > p) person(); else - quelq11(h, p); + p = setPresenceBureau(h); } void pl12(int cf) { @@ -1158,7 +1206,7 @@ void pl12(int cf) { if (rand > p) person(); else - quelq12(p); + p = setPresenceKitchen(); } void pl13(int cf) { @@ -1169,7 +1217,7 @@ void pl13(int cf) { if (rand > p) person(); else - quelq12(p); + p = setPresenceKitchen(); } void pl15(int cf) { @@ -1180,7 +1228,7 @@ void pl15(int cf) { if (rand > p) person(); else - quelq15(p); + p = setPresenceLanding(); } void pl20(int cf) { @@ -1191,13 +1239,13 @@ void pl20(int cf) { if (rand > p) person(); else - quelq20(h, p); + p = setPresenceChapel(h); } void t11(int l11, int &a) { int p, rand; - ecfren(p, rand, g_s._conf, l11); + ecfren(p, rand, g_s._faithScore, l11); g_li = l11; if ((l11 > 0) && (l11 < 10)) { if (p != -500) { @@ -1229,22 +1277,22 @@ void t11(int l11, int &a) { cpl15(p); if (l11 == 20) cpl20(p, h); - p += g_s._conf; + p += g_s._faithScore; rand = getRandomNumber(1, 100); if (rand > p) { person(); a = 0; } else { if (l11 == 10) - quelq10(h, p); + p = setPresenceDiningRoom(h); if (l11 == 11) - quelq11(h, p); + p = setPresenceBureau(h); if ((l11 == 12) || (l11 == 13) || (l11 == 14)) - quelq12(p); + p = setPresenceKitchen(); if ((l11 == 15) || (l11 == 26)) - quelq15(p); + p = setPresenceLanding(); if (l11 == 20) - quelq20(h, p); + p = setPresenceChapel(h); a = p; } } @@ -1252,9 +1300,9 @@ void t11(int l11, int &a) { } void cavegre() { - g_s._conf += 2; - if (g_s._conf > 69) - g_s._conf += (g_s._conf / 10); + g_s._faithScore += 2; + if (g_s._faithScore > 69) + g_s._faithScore += (g_s._faithScore / 10); clsf3(); ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 87238c4217..14172c74b8 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -80,15 +80,15 @@ extern void cpl12(int &p); extern void cpl13(int &p); extern void cpl15(int &p); extern void cpl20(int &p, int &h); -extern void quelq1(int l); -extern void quelq2(); -extern void quelq5(); -extern void quelq6(int l); -extern void quelq10(int h, int &per); -extern void quelq11(int h, int &per); -extern void quelq12(int &per); -extern void quelq15(int &per); -extern void quelq20(int h, int &per); +extern void setPresenceGreenRoom(int l); +extern void setPresencePurpleRoom(); +extern void setPresenceBlueRoom(); +extern void setPresenceRedRoom(int l); +extern int setPresenceDiningRoom(int h); +extern int setPresenceBureau(int h); +extern int setPresenceKitchen(); +extern int setPresenceLanding(); +extern int setPresenceChapel(int h); extern void frap(); extern void nouvp(int l, int &p); extern void tip(int ip, int &cx); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 28692eac83..a35a4e9860 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -101,7 +101,7 @@ void tinke() { g_t = ti2; else g_t = ti1; - cf = g_s._conf; + cf = g_s._faithScore; if ((cf > 33) && (cf < 66)) g_t -= (g_t / 3); @@ -313,10 +313,10 @@ void tperd() { void tsort() { if ((g_iouv > 0) && (g_s._currPlace != 0)) { - if (g_s._conf < 50) - g_s._conf += 2; + if (g_s._faithScore < 50) + g_s._faithScore += 2; else - g_s._conf += (g_s._conf / 10); + g_s._faithScore += (g_s._faithScore / 10); } for (int cx = 1; cx <= 7; ++cx) @@ -573,11 +573,11 @@ L1: parole(4, 4, 1); if (g_iouv == 0) - g_s._conf += 2; - else if (g_s._conf < 50) - g_s._conf += 4; + g_s._faithScore += 2; + else if (g_s._faithScore < 50) + g_s._faithScore += 4; else - g_s._conf += 3 * (g_s._conf / 10); + g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); tmlieu(15); int cx; @@ -625,7 +625,7 @@ void tsuiv() { g_caff = tbcl; g_crep = g_caff + 400; if (g_ipers != 0) - g_s._conf += 2; + g_s._faithScore += 2; } else { affrep(); endSearch(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 46bde5ee53..078813b9a0 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -228,14 +228,14 @@ void tsitu() { calch(j, h, m); if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._currPlace != 10)) || ((h > 0) && (h < 6) && (g_s._currPlace != 0))) - ++g_s._conf; + ++g_s._faithScore; if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { - if ((g_s._conf > 99) && (h > 8) && (h < 16)) { + if ((g_s._faithScore > 99) && (h > 8) && (h < 16)) { g_crep = 1501; tperd(); } - if ((g_s._conf > 99) && (h > 0) && (h < 9)) { + if ((g_s._faithScore > 99) && (h > 0) && (h < 9)) { g_crep = 1508; tperd(); } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 386fd95ef5..a53d218c86 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -49,7 +49,7 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { * Handle saving or loading savegame data */ void SavegameManager::sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(g_s1._conf); + sz.syncAsSint16LE(g_s1._faithScore); sz.syncBytes((byte *)&g_s1._pourc[0], 11); sz.syncBytes((byte *)&g_s1._teauto[0], 43); sz.syncBytes((byte *)&g_s1._sjer[0], 31); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 8c661437a9..11bc4e0fe4 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -161,7 +161,7 @@ enum places { }; struct sav_chaine { - int _conf; + int _faithScore; byte _pourc[11]; byte _teauto[43]; byte _sjer[31]; -- cgit v1.2.3 From d5c02ab69c482523dbce82007385363cc8da142c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Mar 2012 21:25:07 +1100 Subject: MORTEVIELLE: Properly implement transparency when drawing images --- engines/mortevielle/graphics.cpp | 25 ++++++++++++++++--------- engines/mortevielle/graphics.h | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index ce02915208..775075c35f 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -83,6 +83,8 @@ void PaletteManager::setDefaultPalette() { void GfxSurface::decode(const byte *pSrc) { _width = _height = 0; + // If no transparency, use invalid (for EGA) palette index of 16. Otherwise get index to use + _transparency = (*pSrc == 0) ? 16 : *(pSrc + 2); bool offsetFlag = *pSrc++ == 0; int entryCount = *pSrc++; pSrc += 2; @@ -114,7 +116,7 @@ void GfxSurface::decode(const byte *pSrc) { // Temporary output buffer byte outputBuffer[65536]; - Common::fill(&outputBuffer[0], &outputBuffer[65536], 0); + Common::fill(&outputBuffer[0], &outputBuffer[65536], _transparency); byte *pDest = &outputBuffer[0]; const byte *pSrcStart = pSrc; @@ -922,15 +924,20 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2); for (int xp = 0; xp < surface.w; ++xp, ++pSrc) { - // Draw the pixel using the specified index in the palette map - *pDest = paletteMap[*pSrc * 2]; - *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2]; - ++pDest; + if (*pSrc == surface._transparency) { + // Transparent point, so skip pixels + pDest += 2; + } else { + // Draw the pixel using the specified index in the palette map + *pDest = paletteMap[*pSrc * 2]; + *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2]; + ++pDest; - // Use the secondary mapping value to draw the secondary column pixel - *pDest = paletteMap[*pSrc * 2 + 1]; - *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1]; - ++pDest; + // Use the secondary mapping value to draw the secondary column pixel + *pDest = paletteMap[*pSrc * 2 + 1]; + *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1]; + ++pDest; + } } } } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 28a9d64b7c..253b708d70 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -67,6 +67,8 @@ private: public: // Specifies offset when drawing the image Common::Point _offset; + // Transparency palette index + int _transparency; public: ~GfxSurface(); -- cgit v1.2.3 From 83c32aeb2ab4b91a42d5be08dbbd48e78d69b148 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Mar 2012 21:43:22 +1100 Subject: MORTEVIELLE: Bugfixes for correctly displaying people present in a room --- engines/mortevielle/actions.cpp | 4 ++-- engines/mortevielle/mor.cpp | 42 ++++++++++++++++++++--------------------- engines/mortevielle/mor.h | 2 +- engines/mortevielle/mor2.cpp | 2 +- engines/mortevielle/prog.cpp | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 22c12d6a67..01dd5b4665 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -709,7 +709,7 @@ void fctPlace() { tinke(); drawClock(); if (g_ipers != 0) - affper(g_ipers); + showPeoplePresent(g_ipers); else person(); @@ -1523,7 +1523,7 @@ void fctDiscuss() { hirs(); dessine_rouleau(); showMouse(); - affper(g_ipers); + showPeoplePresent(g_ipers); tinke(); drawClock(); affrep(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 82d0ef1979..e2a7facfcf 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -247,12 +247,7 @@ void clsf10() { g_vm->_screenSurface.putxy(co, 92); g_vm->_screenSurface.writeg(st, 4); - if (g_res == 1) - co = 620; - else - co = 584; - - g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, co, 86)); + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); /* rempli(69,12,32,5,255);*/ showMouse(); } @@ -412,49 +407,54 @@ void t5(int cx) { g_bh9 = false; } -void affper(int per) { +/** + * Engine function - Show the people present in the given room + * @remarks Originally called 'affper' + */ +void showPeoplePresent(int per) { int cx; + int xp = 580 - (g_vm->_screenSurface.getStringWidth("LEO") / 2); for (cx = 1; cx <= 8; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cx]); clsf10(); if ((per & 128) == 128) { - g_vm->_screenSurface.putxy(560, 24); + g_vm->_screenSurface.putxy(xp, 24); g_vm->_screenSurface.writeg("LEO", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[1]); } if ((per & 64) == 64) { - g_vm->_screenSurface.putxy(560, 32); + g_vm->_screenSurface.putxy(xp, 32); g_vm->_screenSurface.writeg("PAT", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[2]); } if ((per & 32) == 32) { - g_vm->_screenSurface.putxy(560, 40); + g_vm->_screenSurface.putxy(xp, 40); g_vm->_screenSurface.writeg("GUY", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[3]); } if ((per & 16) == 16) { - g_vm->_screenSurface.putxy(560, 48); + g_vm->_screenSurface.putxy(xp, 48); g_vm->_screenSurface.writeg("EVA", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[4]); } if ((per & 8) == 8) { - g_vm->_screenSurface.putxy(560, 56); + g_vm->_screenSurface.putxy(xp, 56); g_vm->_screenSurface.writeg("BOB", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[5]); } if ((per & 4) == 4) { - g_vm->_screenSurface.putxy(560, 64); + g_vm->_screenSurface.putxy(xp, 64); g_vm->_screenSurface.writeg("LUC", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[6]); } if ((per & 2) == 2) { - g_vm->_screenSurface.putxy(560, 72); + g_vm->_screenSurface.putxy(xp, 72); g_vm->_screenSurface.writeg("IDA", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[7]); } if ((per & 1) == 1) { - g_vm->_screenSurface.putxy(560, 80); + g_vm->_screenSurface.putxy(xp, 80); g_vm->_screenSurface.writeg("MAX", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[8]); } @@ -828,7 +828,7 @@ int setPresenceDiningRoom(int h) { } choix(min, max, retVal); } - affper(retVal); + showPeoplePresent(retVal); return retVal; } @@ -856,7 +856,7 @@ int setPresenceBureau(int h) { } choix(min, max, retVal); } - affper(retVal); + showPeoplePresent(retVal); return retVal; } @@ -867,7 +867,7 @@ int setPresenceBureau(int h) { */ int setPresenceKitchen() { int retVal = chlm(); - affper(retVal); + showPeoplePresent(retVal); return retVal; } @@ -893,7 +893,7 @@ int setPresenceLanding() { int retVal = 0; conv(rand, retVal); - affper(retVal); + showPeoplePresent(retVal); return retVal; } @@ -921,7 +921,7 @@ int setPresenceChapel(int h) { } choix(min, max, retVal); } - affper(retVal); + showPeoplePresent(retVal); return retVal; } @@ -965,7 +965,7 @@ void nouvp(int l, int &p) { p = 9; if (p != 9) - affper(p); + showPeoplePresent(p); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 14172c74b8..514bd73d98 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -60,7 +60,7 @@ extern void conv(int x, int &y); extern void modobj(int m); extern void repon(int f, int m); extern void t5(int cx); -extern void affper(int per); +extern void showPeoplePresent(int per); extern void choix(int min, int max, int &per); extern void cpl1(int &p); extern void cpl2(int &p); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index a35a4e9860..25793c817f 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -490,7 +490,7 @@ void t1sama() { //Entering manor st1sama(); } else if (!g_s._ipre) { //Is it your first time? g_ipers = 255; - affper(g_ipers); + showPeoplePresent(g_ipers); g_caff = 77; afdes(0); g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 078813b9a0..606b417cef 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -53,7 +53,7 @@ void changeGraphicalDevice(int newDevice) { tinke(); drawClock(); if (g_ipers != 0) - affper(g_ipers); + showPeoplePresent(g_ipers); else person(); clsf2(); -- cgit v1.2.3 From ec71b9bfd6d557888ccb63cb0b58291929169267 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Mar 2012 22:07:17 +1100 Subject: MORTEVIELLE: Bugfix to ignore previous mouse click when waiting in tkey1 --- engines/mortevielle/mor2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 25793c817f..c98b399114 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -220,9 +220,16 @@ void tkey1(bool d) { hideMouse(); fenat('K'); + + // Wait for release from any key or mouse button while (keypressed()) g_key = testou(); - + do { + getMousePos(x, y, c); + keypressed(); + } while (c != 0); + + // Event loop do { if (d) tinke(); -- cgit v1.2.3 From 203dcdaf4afdf42024fa013a1375a8865bf34875 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 Mar 2012 22:35:32 +1100 Subject: MORTEVIELLE: Added extra width to the Self menu for the English version --- engines/mortevielle/menu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 3abe06aa11..b60c70b4af 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -295,6 +295,10 @@ void Menu::menuDown(int ii) { else cx = 6; xcc = xco + (g_menuConstants[ii - 1][2] * cx) + 6; + if ((ii == 4) && (g_vm->getLanguage() == Common::EN_ANY)) + // Extra width needed for Self menu in English version + xcc = 435; + g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (g_menuConstants[ii - 1][1] << 1))); g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (g_menuConstants[ii - 1][1] << 1))); g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (g_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (g_menuConstants[ii - 1][1] << 1))); -- cgit v1.2.3 From b40b00b1c46a615ea346f6eea4c6f42f2d4e356d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Mar 2012 23:59:21 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 8 +- engines/mortevielle/mor.cpp | 441 +++++++++++++++++++++------------------- engines/mortevielle/mor.h | 32 +-- engines/mortevielle/mor2.cpp | 27 ++- engines/mortevielle/prog.cpp | 33 ++- engines/mortevielle/taffich.cpp | 2 +- 6 files changed, 282 insertions(+), 261 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 01dd5b4665..0bcfd67046 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -711,7 +711,7 @@ void fctPlace() { if (g_ipers != 0) showPeoplePresent(g_ipers); else - person(); + displayAloneText(); g_vm->_menu.displayMenu(); if (enterPassageFl) { @@ -1063,7 +1063,7 @@ void fctListen() { else { becfren(l); int j, h, m; - calch(j, h, m); + updateHour(j, h, m); rand = getRandomNumber(1, 100); if ((h >= 0) && (h < 8)) { if (rand > 30) @@ -1096,7 +1096,7 @@ void fctEat() { tmlieu(g_s._currPlace); int j, h, m; - calch(j, h, m); + updateHour(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { g_s._faithScore -= (g_s._faithScore / 7); if (h == 12) { @@ -1204,7 +1204,7 @@ void fctSleep() { clsf2(); ecrf2(); ecr2(g_vm->getEngineString(S_WANT_TO_WAKE_UP)); - calch(j, h, m); + updateHour(j, h, m); int answer; do { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e2a7facfcf..ef5800e993 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -269,17 +269,21 @@ void paint_rect(int x, int y, int dx, int dy) { g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } -void calch(int &j, int &h, int &m) { - int nh = readclock(); - int th = g_jh + ((nh - g_mh) / g_t); - m = ((th % 2) + g_vm__) * 30; - h = ((uint)th >> 1) + g_vh; - if (m == 60) { - m = 0; - h = h + 1; +/** + * Engine function - Update hour + * @remarks Originally called 'calch' + */ +void updateHour(int &day, int &hour, int &minute) { + int newHour = readclock(); + int th = g_jh + ((newHour - g_mh) / g_t); + minute = ((th % 2) + g_vm__) * 30; + hour = ((uint)th >> 1) + g_vh; + if (minute == 60) { + minute = 0; + ++hour; } - j = (h / 24) + g_vj; - h = h - ((j - g_vj) * 24); + day = (hour / 24) + g_vj; + hour = hour - ((day - g_vj) * 24); } void conv(int x, int &y) { @@ -486,90 +490,106 @@ void choix(int min, int max, int &per) { per = 255 - per; } -void cpl1(int &p) { - int j, h, m; +int cpl1() { + int day, hour, minute; + int retVal = 0; - calch(j, h, m); + updateHour(day, hour, minute); // The original uses an || instead of an &&, resulting // in an always true condition. Based on the other tests, // and on other scenes, we use an && instead. - // if ((h > 7) || (h < 11)) - if ((h > 7) && (h < 11)) - p = 25; - else if ((h > 10) && (h < 14)) - p = 35; - else if ((h > 13) && (h < 16)) - p = 50; - else if ((h > 15) && (h < 18)) - p = 5; - else if ((h > 17) && (h < 22)) - p = 35; - else if ((h > 21) && (h < 24)) - p = 50; - else if ((h >= 0) && (h < 8)) - p = 70; + if ((hour > 7) && (hour < 11)) + retVal = 25; + else if ((hour > 10) && (hour < 14)) + retVal = 35; + else if ((hour > 13) && (hour < 16)) + retVal = 50; + else if ((hour > 15) && (hour < 18)) + retVal = 5; + else if ((hour > 17) && (hour < 22)) + retVal = 35; + else if ((hour > 21) && (hour < 24)) + retVal = 50; + else if ((hour >= 0) && (hour < 8)) + retVal = 70; g_vm->_menu.mdn(); + + return retVal; } -void cpl2(int &p) { - int j, h, m; +int cpl2() { + int day, hour, minute; + int retVal = 0; - 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; + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 11)) + retVal = -2; + else if (hour == 11) + retVal = 100; + else if ((hour > 11) && (hour < 23)) + retVal = 10; + else if (hour == 23) + retVal = 20; + else if ((hour >= 0) && (hour < 8)) + retVal = 50; + + return retVal; } -void cpl3(int &p) { - int j, h, m; +int cpl3() { + int day, hour, minute; + int retVal = 0; - 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; + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 10)) || ((hour > 19) && (hour < 24))) + retVal = 34; + else if (((hour > 9) && (hour < 20)) || ((hour >= 0) && (hour < 9))) + retVal = 0; + + return retVal; } -void cpl5(int &p) { - int j, h, m; +int cpl5() { + int day, hour, minute; + int retVal = 0; - 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; + updateHour(day, hour, minute); + if ((hour > 6) && (hour < 10)) + retVal = 0; + else if (hour == 10) + retVal = 100; + else if ((hour > 10) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 7)) + retVal = 50; + + return retVal; } -void cpl6(int &p) { - int j, h, m; +int cpl6() { + int day, hour, minute; + int retVal = 0; - 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; + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 13)) || ((hour > 17) && (hour < 20))) + retVal = -2; + else if (((hour > 12) && (hour < 17)) || ((hour > 19) && (hour < 24))) + retVal = 35; + else if (hour == 17) + retVal = 100; + else if ((hour >= 0) && (hour < 8)) + retVal = 60; + + return retVal; } /** - * Shows the you are alone message in the status area on the right hand side of the screen + * Shows the "you are alone" message in the status area + * on the right hand side of the screen + * @remarks Originally called 'person' */ -void person() { +void displayAloneText() { for (int cf = 1; cf <= 8; ++cf) g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cf]); @@ -660,89 +680,95 @@ void debloc(int l) { g_mpers = g_ipers; } -void cpl10(int &p, int &h) { - int j, m; +void cpl10(int &p, int &hour) { + int day, minute; - calch(j, h, m); - if (((h > 7) && (h < 11)) || ((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) p = 100; - if ((h == 11) || ((h > 20) && (h < 24))) + else if ((hour == 11) || ((hour > 20) && (hour < 24))) p = 45; - if (((h > 13) && (h < 17)) || (h == 18)) + else if (((hour > 13) && (hour < 17)) || (hour == 18)) p = 35; - if (h == 17) + else if (hour == 17) p = 60; - if ((h >= 0) && (h < 8)) + else if ((hour >= 0) && (hour < 8)) p = 5; } -void cpl11(int &p, int &h) { - int j, m; +void cpl11(int &p, int &hour) { + int day, minute; - calch(j, h, m); - if (((h > 8) && (h < 12)) || ((h > 20) && (h < 24))) + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) p = 25; - if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) + else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) p = 5; - if ((h > 13) && (h < 17)) + else if ((hour > 13) && (hour < 17)) p = 55; - if ((h > 16) && (h < 19)) + else if ((hour > 16) && (hour < 19)) p = 45; - if ((h >= 0) && (h < 9)) + else if ((hour >= 0) && (hour < 9)) p = 0; } -void cpl12(int &p) { - int j, h, m; +int cpl12() { + int day, hour, minute; + int retVal = 0; - 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; + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 15)) || ((hour > 16) && (hour < 22))) + retVal = 55; + else if (((hour > 14) && (hour < 17)) || ((hour > 21) && (hour < 24))) + retVal = 25; + else if ((hour >= 0) && (hour < 5)) + retVal = 0; + else if ((hour > 4) && (hour < 9)) + retVal = 15; + + return retVal; } -void cpl13(int &p) { - p = 0; +int cpl13() { + return 0; } -void cpl15(int &p) { - int j, h, m; +int cpl15() { + int day, hour, minute; + int retVal = 0; - calch(j, h, m); - if ((h > 7) && (h < 12)) - p = 25; - else if ((h > 11) && (h < 14)) - p = 0; - else if ((h > 13) && (h < 18)) - p = 10; - else if ((h > 17) && (h < 20)) - p = 55; - else if ((h > 19) && (h < 22)) - p = 5; - else if ((h > 21) && (h < 24)) - p = 15; - else if ((h >= 0) && (h < 8)) - p = -15; + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 12)) + retVal = 25; + else if ((hour > 11) && (hour < 14)) + retVal = 0; + else if ((hour > 13) && (hour < 18)) + retVal = 10; + else if ((hour > 17) && (hour < 20)) + retVal = 55; + else if ((hour > 19) && (hour < 22)) + retVal = 5; + else if ((hour > 21) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 8)) + retVal = -15; + + return retVal; } -void cpl20(int &p, int &h) { - int j, m; +void cpl20(int &p, int &hour) { + int day, minute; - calch(j, h, m); - if (h == 10) + updateHour(day, hour, minute); + if (hour == 10) p = 65; - else if ((h > 10) && (h < 21)) + else if ((hour > 10) && (hour < 21)) p = 5; - else if ((h > 20) && (h < 24)) + else if ((hour > 20) && (hour < 24)) p = -15; - else if ((h >= 0) && (h < 5)) + else if ((hour >= 0) && (hour < 5)) p = -300; - else if ((h > 4) && (h < 10)) + else if ((hour > 4) && (hour < 10)) p = -5; } @@ -806,23 +832,23 @@ void setPresenceRedRoom(int l) { * Engine function - Check who is in the Dining Room * @remarks Originally called 'quelq10' */ -int setPresenceDiningRoom(int h) { +int setPresenceDiningRoom(int hour) { int retVal = 0; - if ((h >= 0) && (h < 8)) + if ((hour >= 0) && (hour < 8)) retVal = chlm(); else { int min = 0, max = 0; - if ((h > 7) && (h < 10)) { + if ((hour > 7) && (hour < 10)) { min = 5; max = 7; - } else if ((h > 9) && (h < 12)) { + } else if ((hour > 9) && (hour < 12)) { min = 1; max = 4; - } else if (((h > 11) && (h < 15)) || ((h > 18) && (h < 21))) { + } else if (((hour > 11) && (hour < 15)) || ((hour > 18) && (hour < 21))) { min = 6; max = 8; - } else if (((h > 14) && (h < 19)) || ((h > 20) && (h < 24))) { + } else if (((hour > 14) && (hour < 19)) || ((hour > 20) && (hour < 24))) { min = 1; max = 5; } @@ -837,20 +863,20 @@ int setPresenceDiningRoom(int h) { * Engine function - Check who is in the Bureau * @remarks Originally called 'quelq11' */ -int setPresenceBureau(int h) { +int setPresenceBureau(int hour) { int retVal = 0; - if ((h >= 0) && (h < 8)) + if ((hour >= 0) && (hour < 8)) retVal = chlm(); else { int min = 0, max = 0; - if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) { + if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { min = 1; max = 3; - } else if (((h > 9) && (h < 12)) || ((h > 13) && (h < 19))) { + } else if (((hour > 9) && (hour < 12)) || ((hour > 13) && (hour < 19))) { min = 1; max = 4; - } else if (((h > 11) && (h < 14)) || ((h > 18) && (h < 21))) { + } else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) { min = 1; max = 2; } @@ -902,20 +928,20 @@ int setPresenceLanding() { * Engine function - Check who is in the chapel * @remarks Originally called 'quelq20' */ -int setPresenceChapel(int h) { +int setPresenceChapel(int hour) { int retVal = 0; - if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24))) + if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) retVal = chlm(); else { int min = 0, max = 0; - if ((h > 9) && (h < 12)) { + if ((hour > 9) && (hour < 12)) { min = 3; max = 7; - } else if ((h > 11) && (h < 18)) { + } else if ((hour > 11) && (hour < 18)) { min = 1; max = 2; - } else if (h == 18) { + } else if (hour == 18) { min = 2; max = 4; } @@ -928,10 +954,10 @@ int setPresenceChapel(int h) { void frap() { - int j, h, m; + int day, hour, minute; - calch(j, h, m); - if ((h >= 0) && (h < 8)) + updateHour(day, hour, minute); + if ((hour >= 0) && (hour < 8)) g_crep = 190; else { if (getRandomNumber(1, 100) > 70) @@ -992,25 +1018,25 @@ void tip(int ip, int &cx) { void ecfren(int &p, int &rand, int cf, int l) { if (l == 0) - person(); + displayAloneText(); p = -500; rand = 0; if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4))) - cpl1(p); + p = cpl1(); if ((l == 2) && (!g_bh2) && (!g_bh9)) - cpl2(p); + p = cpl2(); if (((l == 3) && (!g_bt3)) || ((l == 7) && (!g_bt7))) - cpl3(p); + p = cpl3(); if ((l == 5) && (!g_bh5)) - cpl5(p); + p = cpl5(); if (((l == 6) && (!g_bh6)) || ((l == 8) && (!g_bh8))) - cpl6(p); + p = cpl6(); if ((l == 9) && (!g_bh9) && (!g_bh2)) p = 10; if (((l == 2) && (g_bh9)) || ((l == 9) && (g_bh2))) p = -400; if (p != -500) { - p = p + cf; + p += cf; rand = getRandomNumber(1, 100); } } @@ -1113,12 +1139,12 @@ void dprog() { void pl1(int cf) { if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) { - int p, rand; - cpl1(p); + int p = cpl1(); + int rand; phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else setPresenceGreenRoom(g_li); } @@ -1126,12 +1152,12 @@ void pl1(int cf) { void pl2(int cf) { if (!g_bh2) { - int p, rand; - cpl2(p); + int p = cpl2(); + int rand; phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else setPresencePurpleRoom(); } @@ -1139,12 +1165,13 @@ void pl2(int cf) { void pl5(int cf) { if (!g_bh5) { - int p, rand; - cpl5(p); + int p = cpl5(); + int rand; + phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else setPresenceBlueRoom(); } @@ -1152,12 +1179,13 @@ void pl5(int cf) { void pl6(int cf) { if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) { - int p, rand; - cpl6(p); + int p = cpl6(); + int rand; + phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else setPresenceRedRoom(g_li); } @@ -1170,7 +1198,7 @@ void pl9(int cf) { phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else setPresencePurpleRoom(); } @@ -1182,9 +1210,9 @@ void pl10(int cf) { phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceDiningRoom(h); + setPresenceDiningRoom(h); } void pl11(int cf) { @@ -1193,42 +1221,42 @@ void pl11(int cf) { cpl11(p, h); phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceBureau(h); + setPresenceBureau(h); } void pl12(int cf) { int p, rand; - cpl12(p); + p = cpl12(); phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceKitchen(); + setPresenceKitchen(); } void pl13(int cf) { int p, rand; - cpl13(p); + p = cpl13(); phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceKitchen(); + setPresenceKitchen(); } void pl15(int cf) { int p, rand; - cpl15(p); + p = cpl15(); phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceLanding(); + setPresenceLanding(); } void pl20(int cf) { @@ -1237,9 +1265,9 @@ void pl20(int cf) { cpl20(p, h); phaz(rand, p, cf); if (rand > p) - person(); + displayAloneText(); else - p = setPresenceChapel(h); + setPresenceChapel(h); } void t11(int l11, int &a) { @@ -1250,7 +1278,7 @@ void t11(int l11, int &a) { if ((l11 > 0) && (l11 < 10)) { if (p != -500) { if (rand > p) { - person(); + displayAloneText(); a = 0; } else { becfren(g_li); @@ -1262,36 +1290,36 @@ void t11(int l11, int &a) { if (l11 > 9) { if ((l11 > 15) && (l11 != 20) && (l11 != 26)) - person(); + displayAloneText(); else { int h = 0; if (l11 == 10) cpl10(p, h); - if (l11 == 11) + else 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) + else if (l11 == 12) + p = cpl12(); + else if ((l11 == 13) || (l11 == 14)) + p = cpl13(); + else if ((l11 == 15) || (l11 == 26)) + p = cpl15(); + else if (l11 == 20) cpl20(p, h); p += g_s._faithScore; rand = getRandomNumber(1, 100); if (rand > p) { - person(); + displayAloneText(); a = 0; } else { if (l11 == 10) p = setPresenceDiningRoom(h); - if (l11 == 11) + else if (l11 == 11) p = setPresenceBureau(h); - if ((l11 == 12) || (l11 == 13) || (l11 == 14)) + else if ((l11 == 12) || (l11 == 13) || (l11 == 14)) p = setPresenceKitchen(); - if ((l11 == 15) || (l11 == 26)) + else if ((l11 == 15) || (l11 == 26)) p = setPresenceLanding(); - if (l11 == 20) + else if (l11 == 20) p = setPresenceChapel(h); a = p; } @@ -1313,7 +1341,7 @@ void cavegre() { // It has been removed clsf3(); - person(); + displayAloneText(); } void writetp(Common::String s, int t) { @@ -1329,8 +1357,7 @@ void aniof(int ouf, int num) { if ((g_caff == 10) && (num == 7)) num = 6; - - if (g_caff == 12) { + else if (g_caff == 12) { if (num == 3) num = 4; else if (num == 4) @@ -1362,24 +1389,23 @@ void musique(int so) { i = true; } } - if (g_s._currPlace == CHAPEL) { + else if (g_s._currPlace == CHAPEL) { if (getRandomNumber(1, 2) == 1) { parole(8, 1, 1); i = true; } } - - if (g_s._currPlace == WELL) { + else if (g_s._currPlace == WELL) { if (getRandomNumber(1, 2) == 2) { parole(12, 1, 1); i = true; } } - - if (g_s._currPlace == 23) { + else if (g_s._currPlace == 23) { parole(13, 1, 1); i = true; } + if (!i) parole(getRandomNumber(1, 17), 1, 2); } @@ -1412,14 +1438,11 @@ void dessin(int ad) { if (g_s._atticRodHoleObjectId == 159) aniof(1, 6); - } - if ((g_caff == 14) && (g_s._cellarObjectId == 151)) + } else if ((g_caff == 14) && (g_s._cellarObjectId == 151)) aniof(1, 2); - - if ((g_caff == 17) && (g_s._secretPassageObjectId == 143)) + else if ((g_caff == 17) && (g_s._secretPassageObjectId == 143)) aniof(1, 1); - - if ((g_caff == 24) && (g_s._wellObjectId != 0)) + else if ((g_caff == 24) && (g_s._wellObjectId != 0)) aniof(1, 1); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 514bd73d98..066392c879 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -54,7 +54,7 @@ extern void ecrf7(); extern void clsf10(); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); -extern void calch(int &j, int &h, int &m); +extern void updateHour(int &day, int &hour, int &minute); extern void conv(int x, int &y); /* NIVEAU 12 */ extern void modobj(int m); @@ -62,33 +62,33 @@ extern void repon(int f, int m); extern void t5(int cx); extern void showPeoplePresent(int per); extern void choix(int min, int max, int &per); -extern void cpl1(int &p); -extern void cpl2(int &p); -extern void cpl3(int &p); -extern void cpl5(int &p); -extern void cpl6(int &p); -extern void person(); +extern int cpl1(); +extern int cpl2(); +extern int cpl3(); +extern int cpl5(); +extern int cpl6(); +extern void displayAloneText(); extern int chlm(); extern void drawClock(); /************* * NIVEAU 11 * *************/ extern void debloc(int l); -extern void cpl10(int &p, int &h); -extern void cpl11(int &p, int &h); -extern void cpl12(int &p); -extern void cpl13(int &p); -extern void cpl15(int &p); -extern void cpl20(int &p, int &h); +extern void cpl10(int &p, int &hour); +extern void cpl11(int &p, int &hour); +extern int cpl12(); +extern int cpl13(); +extern int cpl15(); +extern void cpl20(int &p, int &hour); extern void setPresenceGreenRoom(int l); extern void setPresencePurpleRoom(); extern void setPresenceBlueRoom(); extern void setPresenceRedRoom(int l); -extern int setPresenceDiningRoom(int h); -extern int setPresenceBureau(int h); +extern int setPresenceDiningRoom(int hour); +extern int setPresenceBureau(int hour); extern int setPresenceKitchen(); extern int setPresenceLanding(); -extern int setPresenceChapel(int h); +extern int setPresenceChapel(int hour); extern void frap(); extern void nouvp(int l, int &p); extern void tip(int ip, int &cx); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index c98b399114..8776336002 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -46,13 +46,13 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; Common::String d6 = g_vm->getEngineString(S_OK); - int cx, cf, j, h, m; + int cx, cf, day, hour, minute; Common::String stpo; g_anyone = false; - calch(j, h, m); - if (j != g_day) { - g_day = j; + updateHour(day, hour, minute); + if (day != g_day) { + g_day = day; cx = 0; do { ++cx; @@ -61,8 +61,8 @@ void tinke() { g_nbrep[cx] = 0; } while (cx != 8); } - if ((h > g_hour) || ((h == 0) && (g_hour == 23))) { - g_hour = h; + if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { + g_hour = hour; g_minute = 0; drawClock(); cf = 0; @@ -89,7 +89,7 @@ void tinke() { g_hintPctMessage += d6; g_hintPctMessage += d4; } - if (m > g_minute) { + if (minute > g_minute) { g_minute = 30; drawClock(); } @@ -97,7 +97,7 @@ void tinke() { return; if (!g_blo) { - if ((h == 12) || ((h > 18) && (h < 21)) || ((h >= 0) && (h < 7))) + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) g_t = ti2; else g_t = ti1; @@ -484,10 +484,10 @@ void ajjer(int ob) { } void t1sama() { //Entering manor - int j, h, m; + int day, hour, minute; - calch(j, h, m); - if ((h < 5) && (g_s._currPlace > 18)) { + updateHour(day, hour, minute); + if ((hour < 5) && (g_s._currPlace > 18)) { bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late @@ -515,11 +515,10 @@ void t1sama() { //Entering manor affrep(); t5(10); if (!g_blo) - t11(0, m); + t11(0, minute); g_ipers = 0; g_mpers = 0; g_s._ipre = true; - /*chech;*/ } else st1sama(); } @@ -605,7 +604,7 @@ L1: int rand = (getRandomNumber(0, 4)) - 2; parole(3, rand, 1); clsf2(); - person(); + displayAloneText(); debloc(21); affrep(); } diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 606b417cef..f011cc891f 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -55,7 +55,7 @@ void changeGraphicalDevice(int newDevice) { if (g_ipers != 0) showPeoplePresent(g_ipers); else - person(); + displayAloneText(); clsf2(); clsf3(); g_maff = 68; @@ -115,7 +115,7 @@ void MortevielleEngine::gameLoaded() { _loseGame = false; g_heroSearching = false; - person(); + displayAloneText(); tinke(); drawClock(); afdes(0); @@ -133,19 +133,17 @@ void MortevielleEngine::gameLoaded() { /* NIVEAU 3 */ /* procedure PROGRAMME */ void tmaj3() { - int j, h, m; + int day, hour, minute; - calch(j, h, m); - if (m == 30) - m = 1; - h += j * 24; - m += h * 2; - g_s._heure = chr(m); + updateHour(day, hour, minute); + if (minute == 30) + minute = 1; + hour += day * 24; + minute += hour * 2; + g_s._heure = chr(minute); } void tsitu() { - int h, j, m; - if (!g_col) clsf2(); g_syn = false; @@ -225,21 +223,22 @@ void tsitu() { return; } } - calch(j, h, m); - if ((((h == 12) || (h == 13) || (h == 19)) && (g_s._currPlace != 10)) || - ((h > 0) && (h < 6) && (g_s._currPlace != 0))) + int hour, day, minute; + updateHour(day, hour, minute); + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || + ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) ++g_s._faithScore; if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { - if ((g_s._faithScore > 99) && (h > 8) && (h < 16)) { + if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; tperd(); } - if ((g_s._faithScore > 99) && (h > 0) && (h < 9)) { + if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { g_crep = 1508; tperd(); } - if ((j > 1) && (h > 8) && (!g_vm->_loseGame)) { + if ((day > 1) && (hour > 8) && (!g_vm->_loseGame)) { g_crep = 1502; tperd(); } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 00d9dca3ef..3e21a35742 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -250,7 +250,7 @@ void taffich() { showMouse(); if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) - person(); + displayAloneText(); else if (!g_blo) t11(g_s._currPlace, cx); g_mpers = 0; -- cgit v1.2.3 From f9b793126d7995316687514ee15830da8f6e7d66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Mar 2012 00:00:46 +0100 Subject: MORTEVIELLE: Remove useless variables from gameLoaded() --- engines/mortevielle/prog.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index f011cc891f..1407e0e219 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -69,26 +69,17 @@ void changeGraphicalDevice(int newDevice) { * @remarks Originally called 'antegame' */ void MortevielleEngine::gameLoaded() { - int k; - char g[8]; - hideMouse(); g_imen = false; - g[1] = 'M'; _loseGame = true; g_anyone = false; g_okdes = true; - g[0] = '\040'; g_col = false; - g[7] = g[0]; - g[2] = 'A'; g_cache = false; g_brt = false; g_maff = 68; - g[5] = 'E'; g_mnumo = 0; g_prebru = 0; - g[4] = 'T'; g_x = 0; g_y = 0; g_num = 0; @@ -96,15 +87,12 @@ void MortevielleEngine::gameLoaded() { g_hfb = 0; g_cs = 0; g_is = 0; - k = 0; g_ment = 0; g_syn = true; g_heroSearching = true; g_mchai = 0; g_inei = 0; initouv(); - g[3] = 'S'; - g[6] = 'R'; g_iouv = 0; g_dobj = 0; affrep(); -- cgit v1.2.3 From 8f2a33e29257490bd61a1ad96e06f2a4109e03c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Mar 2012 08:29:06 +0100 Subject: MORTEVIELLE: Some more renaming and refactoring --- engines/mortevielle/actions.cpp | 6 +-- engines/mortevielle/graphics.cpp | 25 ++++++----- engines/mortevielle/mor.cpp | 96 ++++++++++++++++++++++------------------ engines/mortevielle/mor.h | 8 ++-- engines/mortevielle/mor2.cpp | 3 +- 5 files changed, 73 insertions(+), 65 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 0bcfd67046..be0407ca50 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1149,7 +1149,7 @@ void fctEnter() { parole(7, g_x, 1); aniof(1, 1); - tip(z, g_x); + g_x = convertBitIndexToCharacterIndex(z); ++g_s._faithScore; g_s._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; @@ -1599,7 +1599,7 @@ void MortevielleEngine::endGame() { // Most likely the double call is useless, thus removed // // tkey1(false); - inzon(); + resetVariables(); } /** @@ -1611,7 +1611,7 @@ void MortevielleEngine::loseGame() { musique(0); tkey1(false); maivid(); - inzon(); + resetVariables(); dprog(); g_vh = 10; g_vm__ = 0; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 775075c35f..f3737607de 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1067,26 +1067,27 @@ void ScreenSurface::writeg(const Common::String &l, int c) { switch (c) { case 1: - case 3 : { + case 3: { cecr = 0; g_vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); - } - break; - case 4 : { + } + break; + case 4: cecr = 0; - } - break; - case 5 : { + break; + case 5: cecr = 15; - } - break; + break; case 0: - case 2 : { + case 2: { cecr = 15; g_vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + } + break; + default: + break; } - break; - } + pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ef5800e993..b3ae537768 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -286,13 +286,12 @@ void updateHour(int &day, int &hour, int &minute) { hour = hour - ((day - g_vj) * 24); } -void conv(int x, int &y) { - int cx = 1; - y = 128; - while (cx < x) { - y = (uint)y >> 1; - ++cx; - } +/** + * Engine function - Convert character index to bit index + * @remarks Originally called 'conv' + */ +int convertCharacterIndexToBitIndex(int characterIndex) { + return 128 >> (characterIndex - 1); } /* NIVEAU 12 */ @@ -465,29 +464,29 @@ void showPeoplePresent(int per) { g_ipers = per; } -void choix(int min, int max, int &per) { - bool i; - int cz; - +int selectCharacters(int min, int max) { + bool invertSelection = false; int rand = getRandomNumber(min, max); + if (rand > 4) { rand = 8 - rand; - i = true; - } else - i = false; + invertSelection = true; + } int cx = 0; - per = 0; + int retVal = 0; while (cx < rand) { - int cy = getRandomNumber(1, 8); - conv(cy, cz); - if ((per & cz) != cz) { + int charIndex = getRandomNumber(1, 8); + int charBitIndex = convertCharacterIndexToBitIndex(charIndex); + if ((retVal & charBitIndex) != charBitIndex) { ++cx; - per |= cz; + retVal |= charBitIndex; } } - if (i) - per = 255 - per; + if (invertSelection) + retVal = 255 - retVal; + + return retVal; } int cpl1() { @@ -852,7 +851,7 @@ int setPresenceDiningRoom(int hour) { min = 1; max = 5; } - choix(min, max, retVal); + retVal = selectCharacters(min, max); } showPeoplePresent(retVal); @@ -880,7 +879,7 @@ int setPresenceBureau(int hour) { min = 1; max = 2; } - choix(min, max, retVal); + retVal = selectCharacters(min, max); } showPeoplePresent(retVal); @@ -917,8 +916,7 @@ int setPresenceLanding() { ((rand == 8) && g_bh5)); } while (test); - int retVal = 0; - conv(rand, retVal); + int retVal = convertCharacterIndexToBitIndex(rand); showPeoplePresent(retVal); return retVal; @@ -945,7 +943,7 @@ int setPresenceChapel(int hour) { min = 2; max = 4; } - choix(min, max, retVal); + retVal = selectCharacters(min, max); } showPeoplePresent(retVal); @@ -994,25 +992,31 @@ void nouvp(int l, int &p) { showPeoplePresent(p); } +/** + * Engine function - Convert bit index to character index + * @remarks Originally called 'tip' + */ +int convertBitIndexToCharacterIndex(int bitIndex) { + int retVal = 0; + if (bitIndex == 128) + retVal = 1; + else if (bitIndex == 64) + retVal = 2; + else if (bitIndex == 32) + retVal = 3; + else if (bitIndex == 16) + retVal = 4; + else if (bitIndex == 8) + retVal = 5; + else if (bitIndex == 4) + retVal = 6; + else if (bitIndex == 2) + retVal = 7; + else if (bitIndex == 1) + retVal = 8; -void tip(int ip, int &cx) { - 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; + return retVal; } @@ -1084,7 +1088,11 @@ void phaz(int &rand, int &p, int cf) { rand = getRandomNumber(1, 100); } -void inzon() { +/** + * Engine function - When restarting the game, reset the main variables used by the engine + * @remarks Originally called 'inzon' + */ +void resetVariables() { copcha(); g_s._ipre = false; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 066392c879..4e35e19652 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -55,13 +55,13 @@ extern void clsf10(); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); extern void updateHour(int &day, int &hour, int &minute); -extern void conv(int x, int &y); +extern int convertCharacterIndexToBitIndex(int characterIndex); /* NIVEAU 12 */ extern void modobj(int m); extern void repon(int f, int m); extern void t5(int cx); extern void showPeoplePresent(int per); -extern void choix(int min, int max, int &per); +extern int selectCharacters(int min, int max); extern int cpl1(); extern int cpl2(); extern int cpl3(); @@ -91,13 +91,13 @@ extern int setPresenceLanding(); extern int setPresenceChapel(int hour); extern void frap(); extern void nouvp(int l, int &p); -extern void tip(int ip, int &cx); +extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int l); extern void becfren(int l); /* NIVEAU 10 */ extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); -extern void inzon(); +extern void resetVariables(); extern void dprog(); extern void pl1(int cf); extern void pl2(int cf); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 8776336002..d026ccf080 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -586,8 +586,7 @@ L1: g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); tmlieu(15); - int cx; - tip(g_ipers, cx); + int cx = convertBitIndexToCharacterIndex(g_ipers); g_caff = 69 + cx; g_crep = g_caff; g_msg[3] = MENU_DISCUSS; -- cgit v1.2.3 From 9e21d04e26f7378e3eb2fc5c7961987ed869ea5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Mar 2012 22:47:25 +0100 Subject: MORTEVIELLE: Rename some more functions --- engines/mortevielle/actions.cpp | 4 +- engines/mortevielle/mor.cpp | 161 +++++++++++++++++++++++++++------------- engines/mortevielle/mor.h | 24 +++--- 3 files changed, 122 insertions(+), 67 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index be0407ca50..7766272cf7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -938,10 +938,10 @@ void fctKnock() { g_crep = 190; else { becfren(l); - frap(); + getKnockAnswer(); } } else - frap(); + getKnockAnswer(); } if (g_ment == 8) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index b3ae537768..ebce8e4a14 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -489,7 +489,11 @@ int selectCharacters(int min, int max) { return retVal; } -int cpl1() { +/** + * Engine function - Get Presence Statistics - Green Room + * @remarks Originally called 'cpl1' + */ +int getPresenceStatsGreenRoom() { int day, hour, minute; int retVal = 0; @@ -516,8 +520,11 @@ int cpl1() { return retVal; } - -int cpl2() { +/** + * Engine function - Get Presence Statistics - Purple Room + * @remarks Originally called 'cpl2' + */ +int getPresenceStatsPurpleRoom() { int day, hour, minute; int retVal = 0; @@ -536,7 +543,11 @@ int cpl2() { return retVal; } -int cpl3() { +/** + * Engine function - Get Presence Statistics - Toilets + * @remarks Originally called 'cpl3' + */ +int getPresenceStatsToilets() { int day, hour, minute; int retVal = 0; @@ -549,7 +560,11 @@ int cpl3() { return retVal; } -int cpl5() { +/** + * Engine function - Get Presence Statistics - Blue Room + * @remarks Originally called 'cpl5' + */ +int getPresenceStatsBlueRoom() { int day, hour, minute; int retVal = 0; @@ -566,7 +581,11 @@ int cpl5() { return retVal; } -int cpl6() { +/** + * Engine function - Get Presence Statistics - Red Room + * @remarks Originally called 'cpl6' + */ +int getPresenceStatsRedRoom() { int day, hour, minute; int retVal = 0; @@ -679,39 +698,57 @@ void debloc(int l) { g_mpers = g_ipers; } -void cpl10(int &p, int &hour) { +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl10' + */ +int getPresenceStatsDiningRoom(int &hour) { int day, minute; + int retVal = 0; updateHour(day, hour, minute); if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - p = 100; + retVal = 100; else if ((hour == 11) || ((hour > 20) && (hour < 24))) - p = 45; + retVal = 45; else if (((hour > 13) && (hour < 17)) || (hour == 18)) - p = 35; + retVal = 35; else if (hour == 17) - p = 60; + retVal = 60; else if ((hour >= 0) && (hour < 8)) - p = 5; + retVal = 5; + + return retVal; } -void cpl11(int &p, int &hour) { +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl11' + */ +int getPresenceStatsBureau(int &hour) { int day, minute; + int retVal = 0; updateHour(day, hour, minute); if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) - p = 25; + retVal = 25; else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - p = 5; + retVal = 5; else if ((hour > 13) && (hour < 17)) - p = 55; + retVal = 55; else if ((hour > 16) && (hour < 19)) - p = 45; + retVal = 45; else if ((hour >= 0) && (hour < 9)) - p = 0; + retVal = 0; + + return retVal; } -int cpl12() { +/** + * Engine function - Get Presence Statistics - Room Kitchen + * @remarks Originally called 'cpl12' + */ +int getPresenceStatsKitchen() { int day, hour, minute; int retVal = 0; @@ -728,11 +765,19 @@ int cpl12() { return retVal; } -int cpl13() { +/** + * Engine function - Get Presence Statistics - Room Attic + * @remarks Originally called 'cpl13' + */ +int getPresenceStatsAttic() { return 0; } -int cpl15() { +/** + * Engine function - Get Presence Statistics - Room Landing + * @remarks Originally called 'cpl15' + */ +int getPresenceStatsLanding() { int day, hour, minute; int retVal = 0; @@ -755,20 +800,27 @@ int cpl15() { return retVal; } -void cpl20(int &p, int &hour) { +/** + * Engine function - Get Presence Statistics - Room Chapel + * @remarks Originally called 'cpl20' + */ +int getPresenceStatsChapel(int &hour) { int day, minute; + int retVal = 0; updateHour(day, hour, minute); if (hour == 10) - p = 65; + retVal = 65; else if ((hour > 10) && (hour < 21)) - p = 5; + retVal = 5; else if ((hour > 20) && (hour < 24)) - p = -15; + retVal = -15; else if ((hour >= 0) && (hour < 5)) - p = -300; + retVal = -300; else if ((hour > 4) && (hour < 10)) - p = -5; + retVal = -5; + + return retVal; } /** @@ -950,8 +1002,11 @@ int setPresenceChapel(int hour) { return retVal; } - -void frap() { +/** + * Engine function - Get the answer after you known a door + * @remarks Originally called 'frap' + */ +void getKnockAnswer() { int day, hour, minute; updateHour(day, hour, minute); @@ -1026,15 +1081,15 @@ void ecfren(int &p, int &rand, int cf, int l) { p = -500; rand = 0; if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4))) - p = cpl1(); + p = getPresenceStatsGreenRoom(); if ((l == 2) && (!g_bh2) && (!g_bh9)) - p = cpl2(); + p = getPresenceStatsPurpleRoom(); if (((l == 3) && (!g_bt3)) || ((l == 7) && (!g_bt7))) - p = cpl3(); + p = getPresenceStatsToilets(); if ((l == 5) && (!g_bh5)) - p = cpl5(); + p = getPresenceStatsBlueRoom(); if (((l == 6) && (!g_bh6)) || ((l == 8) && (!g_bh8))) - p = cpl6(); + p = getPresenceStatsRedRoom(); if ((l == 9) && (!g_bh9) && (!g_bh2)) p = 10; if (((l == 2) && (g_bh9)) || ((l == 9) && (g_bh2))) @@ -1147,7 +1202,7 @@ void dprog() { void pl1(int cf) { if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) { - int p = cpl1(); + int p = getPresenceStatsGreenRoom(); int rand; phaz(rand, p, cf); @@ -1160,7 +1215,7 @@ void pl1(int cf) { void pl2(int cf) { if (!g_bh2) { - int p = cpl2(); + int p = getPresenceStatsPurpleRoom(); int rand; phaz(rand, p, cf); @@ -1173,7 +1228,7 @@ void pl2(int cf) { void pl5(int cf) { if (!g_bh5) { - int p = cpl5(); + int p = getPresenceStatsBlueRoom(); int rand; phaz(rand, p, cf); @@ -1187,7 +1242,7 @@ void pl5(int cf) { void pl6(int cf) { if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) { - int p = cpl6(); + int p = getPresenceStatsRedRoom(); int rand; phaz(rand, p, cf); @@ -1213,8 +1268,8 @@ void pl9(int cf) { } void pl10(int cf) { - int p, h, rand; - cpl10(p, h); + int h, rand; + int p = getPresenceStatsDiningRoom(h); phaz(rand, p, cf); if (rand > p) @@ -1224,9 +1279,9 @@ void pl10(int cf) { } void pl11(int cf) { - int p, h, rand; + int h, rand; - cpl11(p, h); + int p = getPresenceStatsBureau(h); phaz(rand, p, cf); if (rand > p) displayAloneText(); @@ -1237,7 +1292,7 @@ void pl11(int cf) { void pl12(int cf) { int p, rand; - p = cpl12(); + p = getPresenceStatsKitchen(); phaz(rand, p, cf); if (rand > p) displayAloneText(); @@ -1248,7 +1303,7 @@ void pl12(int cf) { void pl13(int cf) { int p, rand; - p = cpl13(); + p = getPresenceStatsAttic(); phaz(rand, p, cf); if (rand > p) displayAloneText(); @@ -1259,7 +1314,7 @@ void pl13(int cf) { void pl15(int cf) { int p, rand; - p = cpl15(); + p = getPresenceStatsLanding(); phaz(rand, p, cf); if (rand > p) displayAloneText(); @@ -1268,9 +1323,9 @@ void pl15(int cf) { } void pl20(int cf) { - int p, h, rand; + int h, rand; - cpl20(p, h); + int p = getPresenceStatsChapel(h); phaz(rand, p, cf); if (rand > p) displayAloneText(); @@ -1302,17 +1357,17 @@ void t11(int l11, int &a) { else { int h = 0; if (l11 == 10) - cpl10(p, h); + p = getPresenceStatsDiningRoom(h); else if (l11 == 11) - cpl11(p, h); + p = getPresenceStatsBureau(h); else if (l11 == 12) - p = cpl12(); + p = getPresenceStatsKitchen(); else if ((l11 == 13) || (l11 == 14)) - p = cpl13(); + p = getPresenceStatsAttic(); else if ((l11 == 15) || (l11 == 26)) - p = cpl15(); + p = getPresenceStatsLanding(); else if (l11 == 20) - cpl20(p, h); + p = getPresenceStatsChapel(h); p += g_s._faithScore; rand = getRandomNumber(1, 100); if (rand > p) { diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 4e35e19652..05dba14d6d 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -62,11 +62,11 @@ extern void repon(int f, int m); extern void t5(int cx); extern void showPeoplePresent(int per); extern int selectCharacters(int min, int max); -extern int cpl1(); -extern int cpl2(); -extern int cpl3(); -extern int cpl5(); -extern int cpl6(); +extern int getPresenceStatsGreenRoom(); +extern int getPresenceStatsPurpleRoom(); +extern int getPresenceStatsToilets(); +extern int getPresenceStatsBlueRoom(); +extern int getPresenceStatsRedRoom(); extern void displayAloneText(); extern int chlm(); extern void drawClock(); @@ -74,12 +74,12 @@ extern void drawClock(); * NIVEAU 11 * *************/ extern void debloc(int l); -extern void cpl10(int &p, int &hour); -extern void cpl11(int &p, int &hour); -extern int cpl12(); -extern int cpl13(); -extern int cpl15(); -extern void cpl20(int &p, int &hour); +extern int getPresenceStatsDiningRoom(int &hour); +extern int getPresenceStatsBureau(int &hour); +extern int getPresenceStatsKitchen(); +extern int getPresenceStatsAttic(); +extern int getPresenceStatsLanding(); +extern int getPresenceStatsChapel(int &hour); extern void setPresenceGreenRoom(int l); extern void setPresencePurpleRoom(); extern void setPresenceBlueRoom(); @@ -89,7 +89,7 @@ extern int setPresenceBureau(int hour); extern int setPresenceKitchen(); extern int setPresenceLanding(); extern int setPresenceChapel(int hour); -extern void frap(); +extern void getKnockAnswer(); extern void nouvp(int l, int &p); extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int l); -- cgit v1.2.3 From 6217fa5e3ee08790cfe5b775256740eeec8a0a1a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Mar 2012 08:33:48 +0100 Subject: MORTEVIELLE: some more renaming, match menu item size in setText() --- engines/mortevielle/actions.cpp | 35 +++++++-------- engines/mortevielle/dialogs.cpp | 20 ++++----- engines/mortevielle/graphics.cpp | 8 ++-- engines/mortevielle/graphics.h | 2 +- engines/mortevielle/menu.cpp | 50 ++++++++++----------- engines/mortevielle/menu.h | 6 +-- engines/mortevielle/mor.cpp | 88 +++++++++++++++++++------------------ engines/mortevielle/mor.h | 2 +- engines/mortevielle/mor2.cpp | 34 +++++++------- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mouse.cpp | 9 ++-- engines/mortevielle/outtext.cpp | 8 ++-- engines/mortevielle/ovd1.cpp | 9 +--- engines/mortevielle/ovd1.h | 2 - engines/mortevielle/parole2.cpp | 2 +- engines/mortevielle/parole2.h | 2 +- engines/mortevielle/prog.cpp | 4 +- engines/mortevielle/saveload.cpp | 3 +- engines/mortevielle/var_mor.cpp | 2 +- engines/mortevielle/var_mor.h | 6 +-- 20 files changed, 143 insertions(+), 151 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 7766272cf7..8f30e0da6b 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -47,8 +47,6 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void fctMove() { - int cx; - if ((g_s._currPlace == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; @@ -85,7 +83,7 @@ void fctMove() { return; } tsort(); - cx = 0; + int cx = 0; do { ++cx; } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); @@ -95,7 +93,8 @@ void fctMove() { t1deva(); if (cx == 2) t1neig(); - goto L2; + tmlieu(g_s._currPlace); + return; } if (g_s._currPlace == 23) { @@ -103,7 +102,8 @@ void fctMove() { t1deau(); if (cx == 2) t1derr(); - goto L2; + tmlieu(g_s._currPlace); + return; } if ((g_s._currPlace == BUREAU) && (cx == 1)) @@ -175,7 +175,6 @@ void fctMove() { if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); debloc(g_s._currPlace); -L2: tmlieu(g_s._currPlace); } @@ -315,7 +314,7 @@ void fctInventoryTake() { modinv(); avpoing(cz); g_crep = 998; - clsf2(); + clearScreenType2(); } /** @@ -623,7 +622,7 @@ void fctOpen() { || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - parole(7, 9, 1); + startSpeech(7, 9, 1); } g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); @@ -691,7 +690,7 @@ void fctPlace() { aniof(1, 1); repon(2, 165); maivid(); - parole(6, -9, 1); + startSpeech(6, -9, 1); // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -703,7 +702,7 @@ void fctPlace() { hideMouse(); hirs(); dessine_rouleau(); - clsf2(); + clearScreenType2(); clsf3(); showMouse(); tinke(); @@ -792,7 +791,7 @@ void fctTurn() { g_crep = 997; if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { repon(2, 167); - parole(7, 9, 1); + startSpeech(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) g_vm->_endGame = true; @@ -802,7 +801,7 @@ void fctTurn() { if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { repon(2, 175); clsf3(); - parole(6, -9, 1); + startSpeech(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { g_s._currPlace = CRYPT; @@ -928,7 +927,7 @@ void fctKnock() { if (g_s._currPlace == 26) { int rand = (getRandomNumber(0, 8)) - 4; - parole(11, rand, 1); + startSpeech(11, rand, 1); int p; ecfren(p, rand, g_s._faithScore, g_ment); int l = g_ment; @@ -1146,7 +1145,7 @@ void fctEnter() { g_crep = 179; else { g_x = (getRandomNumber(0, 10)) - 5; - parole(7, g_x, 1); + startSpeech(7, g_x, 1); aniof(1, 1); g_x = convertBitIndexToCharacterIndex(z); @@ -1167,7 +1166,7 @@ void fctEnter() { } } else { g_x = (getRandomNumber(0, 10)) - 5; - parole(7, g_x, 1); + startSpeech(7, g_x, 1); aniof(1, 1); g_s._currPlace = g_ment; @@ -1201,7 +1200,7 @@ void fctSleep() { tmlieu(g_s._currPlace); } clsf3(); - clsf2(); + clearScreenType2(); ecrf2(); ecr2(g_vm->getEngineString(S_WANT_TO_WAKE_UP)); updateHour(j, h, m); @@ -1573,7 +1572,7 @@ void MortevielleEngine::endGame() { tlu(13, 152); maivid(); clsf1(); - clsf2(); + clearScreenType2(); clsf3(); repon(9, 1509); tkey1(false); @@ -1607,7 +1606,7 @@ void MortevielleEngine::endGame() { * @remarks Originally called 'tencore' */ void MortevielleEngine::loseGame() { - clsf2(); + clearScreenType2(); musique(0); tkey1(false); maivid(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index d538774842..717a256b8f 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -85,7 +85,7 @@ int Alert::show(const Common::String &msg, int n) { } g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); g_vm->_screenSurface._textPos.y += 6; - g_vm->_screenSurface.writeg(st, 4); + g_vm->_screenSurface.drawString(st, 4); ++i; } while (chaine[i] != ']'); } @@ -134,14 +134,14 @@ int Alert::show(const Common::String &msg, int n) { Common::String tmp(" "); tmp += s[quoi]; tmp += " "; - g_vm->_screenSurface.writeg(tmp, 0); + g_vm->_screenSurface.drawString(tmp, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += s[ix]; tmp2 += " "; - g_vm->_screenSurface.writeg(tmp2, 1); + g_vm->_screenSurface.drawString(tmp2, 1); quoi = ix; showMouse(); @@ -155,7 +155,7 @@ int Alert::show(const Common::String &msg, int n) { Common::String tmp3(" "); tmp3 += s[quoi]; tmp3 += " "; - g_vm->_screenSurface.writeg(tmp3, 0); + g_vm->_screenSurface.drawString(tmp3, 0); quoi = 0; showMouse(); @@ -171,7 +171,7 @@ int Alert::show(const Common::String &msg, int n) { Common::String tmp4(" "); tmp4 += s[n]; tmp4 += " "; - g_vm->_screenSurface.writeg(tmp4, 1); + g_vm->_screenSurface.drawString(tmp4, 1); } charecr(50, (NUM_LINES + 1) << 4); showMouse(); @@ -275,7 +275,7 @@ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::Stri tmp += str[l]; tmp += " "; - g_vm->_screenSurface.writeg(tmp, 0); + g_vm->_screenSurface.drawString(tmp, 0); x += esp + 40; } } @@ -406,9 +406,9 @@ void f3f8::draw() { // Write the F3 and F8 text strings g_vm->_screenSurface.putxy(3, 44); - g_vm->_screenSurface.writeg(f3, 5); + g_vm->_screenSurface.drawString(f3, 5); g_vm->_screenSurface._textPos.y = 51; - g_vm->_screenSurface.writeg(f8, 5); + g_vm->_screenSurface.drawString(f8, 5); // Get the width of the written text strings int f3Width = g_vm->_screenSurface.getStringWidth(f3); @@ -426,7 +426,7 @@ void f3f8::draw() { void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { - parole(SpeechNum, 0, 0); + startSpeech(SpeechNum, 0, 0); waitForF3F8(g_key); CHECK_QUIT; @@ -468,7 +468,7 @@ void f3f8::ani50() { pictout(adani, g_crep, 63, 12); g_crep = animof(2, 1); pictout(adani, g_crep, 63, 12); - g_f2_all = (g_res == 1); + g_largestClearScreen = (g_res == 1); repon(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index f3737607de..1c26a5cea1 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1046,16 +1046,16 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { /** * Write out a string + * @remarks Originally called 'writeg' */ -void ScreenSurface::writeg(const Common::String &l, int c) { +void ScreenSurface::drawString(const Common::String &l, int command) { int i, x; Common::Point pt; int cecr = 0; - /* debug('writeg : '+l);*/ - if (l == "") return; + hideMouse(); pt = _textPos; @@ -1065,7 +1065,7 @@ void ScreenSurface::writeg(const Common::String &l, int c) { i = 10; x = pt.x + i * l.size(); - switch (c) { + switch (command) { case 1: case 3: { cecr = 0; diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 253b708d70..9f4a4799ab 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -92,7 +92,7 @@ public: void fillRect(int colour, const Common::Rect &bounds); void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } - void writeg(const Common::String &l, int c); + void drawString(const Common::String &l, int command); int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index b60c70b4af..f2f19b6eee 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -42,13 +42,14 @@ namespace Mortevielle { /** * Setup a menu's contents + * @remarks Originally called 'menut' */ -void Menu::menut(int no, Common::String name) { - byte h = hi(no); - byte l = lo(no); +void Menu::setText(int menuId, Common::String name) { + byte h = hi(menuId); + byte l = lo(menuId); Common::String s = name; - while (s.size() < 20) + while (s.size() < 30) s += ' '; switch (h) { @@ -77,11 +78,11 @@ void Menu::menut(int no, Common::String name) { /** * _disable a menu item - * @param no Hi byte represents menu number, lo byte reprsents item index + * @param menuId Hi byte represents menu number, lo byte reprsents item index */ -void Menu::disableMenuItem(int no) { - byte h = hi(no); - byte l = lo(no); +void Menu::disableMenuItem(int menuId) { + byte h = hi(menuId); + byte l = lo(menuId); switch (h) { case MENU_INVENTORY: @@ -110,12 +111,12 @@ void Menu::disableMenuItem(int no) { /** * Enable a menu item - * @param no Hi byte represents menu number, lo byte reprsents item index + * @param menuId Hi byte represents menu number, lo byte reprsents item index * @remarks Originally called menu_enable */ -void Menu::enableMenuItem(int no) { - byte h = hi(no); - byte l = lo(no); +void Menu::enableMenuItem(int menuId) { + byte h = hi(menuId); + byte l = lo(menuId); switch (h) { case MENU_INVENTORY: @@ -242,7 +243,7 @@ void Menu::invers(int ix) { break; } if ((s[0] != '*') && (s[0] != '<')) - g_vm->_screenSurface.writeg(s, ix); + g_vm->_screenSurface.drawString(s, ix); else g_msg4 = OPCODE_NONE; } @@ -309,42 +310,42 @@ void Menu::menuDown(int ii) { switch (ii) { case 1: if (_inventoryStringArray[cx][0] != '*') - g_vm->_screenSurface.writeg(_inventoryStringArray[cx], 4); + g_vm->_screenSurface.drawString(_inventoryStringArray[cx], 4); break; case 2: if (_moveStringArray[cx][0] != '*') - g_vm->_screenSurface.writeg(_moveStringArray[cx], 4); + g_vm->_screenSurface.drawString(_moveStringArray[cx], 4); break; case 3: if (_actionStringArray[cx][0] != '*') - g_vm->_screenSurface.writeg(_actionStringArray[cx], 4); + g_vm->_screenSurface.drawString(_actionStringArray[cx], 4); break; case 4: if (_selfStringArray[cx][0] != '*') - g_vm->_screenSurface.writeg(_selfStringArray[cx], 4); + g_vm->_screenSurface.drawString(_selfStringArray[cx], 4); break; case 5: if (_discussStringArray[cx][0] != '*') - g_vm->_screenSurface.writeg(_discussStringArray[cx], 4); + g_vm->_screenSurface.drawString(_discussStringArray[cx], 4); break; case 6: - g_vm->_screenSurface.writeg(g_vm->getEngineString(S_SAVE_LOAD + cx), 4); + g_vm->_screenSurface.drawString(g_vm->getEngineString(S_SAVE_LOAD + cx), 4); break; case 7: { Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); - g_vm->_screenSurface.writeg(s, 4); + g_vm->_screenSurface.drawString(s, 4); } break; case 8: if (cx == 1) - g_vm->_screenSurface.writeg(g_vm->getEngineString(S_RESTART), 4); + g_vm->_screenSurface.drawString(g_vm->getEngineString(S_RESTART), 4); else { Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + cx); - g_vm->_screenSurface.writeg(s, 4); + g_vm->_screenSurface.drawString(s, 4); } break; default: @@ -360,7 +361,6 @@ void Menu::menuDown(int ii) { * Menu is being removed, so restore the previous background area. */ void Menu::menuUp(int xx) { - /* debug('menuUp'); */ if (g_test0) { charecr(10, (g_menuConstants[xx - 1][1] + 1) << 1); @@ -383,7 +383,6 @@ void Menu::menuUp(int xx) { * Erase the menu */ void Menu::eraseMenu() { - /* debug('eraseMenu'); */ _menuActive = false; g_vm->setMouseClick(false); menuUp(g_msg3); @@ -478,8 +477,7 @@ void Menu::initMenu() { f.read(g_lettres, 7 * 24); f.close(); - // Ask to swap floppy - dem2(); + // Skipped: dialog asking to swap floppy for (i = 1; i <= 8; ++i) _inventoryStringArray[i] = "* "; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 923c5aa3b6..cdd343a9ed 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -48,9 +48,9 @@ public: int _inventoryMenu[9]; int _moveMenu[8]; public: - void menut(int no, Common::String name); - void disableMenuItem(int no); - void enableMenuItem(int no); + void setText(int menuId, Common::String name); + void disableMenuItem(int menuId); + void enableMenuItem(int menuId); void displayMenu(); void drawMenu(); void menuUp(int xx); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ebce8e4a14..36e06115c1 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -160,12 +160,16 @@ void clsf1() { showMouse(); } -void clsf2() { +/** + * Engine function - Clear Screen - Type 2 + * @remarks Originally called 'clsf2' + */ +void clearScreenType2() { hideMouse(); - if (g_f2_all) { + if (g_largestClearScreen) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); - g_f2_all = false; + g_largestClearScreen = false; } else { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); @@ -183,21 +187,21 @@ void ecr2(Common::String str_) { int tlig = 59 + (g_res - 1) * 36; if ((int)str_.size() < tlig) - g_vm->_screenSurface.writeg(str_, 5); + g_vm->_screenSurface.drawString(str_, 5); else if ((int)str_.size() < (tlig << 1)) { g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.writeg(copy(str_, 1, (tlig - 1)), 5); + g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.writeg(copy(str_, tlig, tlig << 1), 5); + g_vm->_screenSurface.drawString(copy(str_, tlig, tlig << 1), 5); } else { - g_f2_all = true; - clsf2(); + g_largestClearScreen = true; + clearScreenType2(); g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.writeg(copy(str_, 1, (tlig - 1)), 5); + g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.writeg(copy(str_, tlig, ((tlig << 1) - 1)), 5); + g_vm->_screenSurface.drawString(copy(str_, tlig, ((tlig << 1) - 1)), 5); g_vm->_screenSurface.putxy(8, 190); - g_vm->_screenSurface.writeg(copy(str_, tlig << 1, tlig * 3), 5); + g_vm->_screenSurface.drawString(copy(str_, tlig << 1, tlig * 3), 5); } } @@ -211,7 +215,7 @@ void clsf3() { void ecr3(Common::String text) { clsf3(); g_vm->_screenSurface.putxy(8, 192); - g_vm->_screenSurface.writeg(text, 5); + g_vm->_screenSurface.drawString(text, 5); } void ecrf6() { @@ -245,7 +249,7 @@ void clsf10() { co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); g_vm->_screenSurface.putxy(co, 92); - g_vm->_screenSurface.writeg(st, 4); + g_vm->_screenSurface.drawString(st, 4); g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); /* rempli(69,12,32,5,255);*/ @@ -301,7 +305,7 @@ void modobj(int m) { if (m != 500) strp = deline(m - 501 + kInventoryStringIndex); - g_vm->_menu.menut(g_vm->_menu._inventoryMenu[8], strp); + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); } @@ -314,11 +318,11 @@ void repon(int f, int m) { tmpStr = deline(m - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) - g_f2_all = true; + g_largestClearScreen = true; else - g_f2_all = false; + g_largestClearScreen = false; - clsf2(); + clearScreenType2(); displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); @@ -327,7 +331,7 @@ void repon(int f, int m) { if (f == 1) f = 6; if (f == 2) { - clsf2(); + clearScreenType2(); ecrf2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) @@ -423,42 +427,42 @@ void showPeoplePresent(int per) { clsf10(); if ((per & 128) == 128) { g_vm->_screenSurface.putxy(xp, 24); - g_vm->_screenSurface.writeg("LEO", 4); + g_vm->_screenSurface.drawString("LEO", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[1]); } if ((per & 64) == 64) { g_vm->_screenSurface.putxy(xp, 32); - g_vm->_screenSurface.writeg("PAT", 4); + g_vm->_screenSurface.drawString("PAT", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[2]); } if ((per & 32) == 32) { g_vm->_screenSurface.putxy(xp, 40); - g_vm->_screenSurface.writeg("GUY", 4); + g_vm->_screenSurface.drawString("GUY", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[3]); } if ((per & 16) == 16) { g_vm->_screenSurface.putxy(xp, 48); - g_vm->_screenSurface.writeg("EVA", 4); + g_vm->_screenSurface.drawString("EVA", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[4]); } if ((per & 8) == 8) { g_vm->_screenSurface.putxy(xp, 56); - g_vm->_screenSurface.writeg("BOB", 4); + g_vm->_screenSurface.drawString("BOB", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[5]); } if ((per & 4) == 4) { g_vm->_screenSurface.putxy(xp, 64); - g_vm->_screenSurface.writeg("LUC", 4); + g_vm->_screenSurface.drawString("LUC", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[6]); } if ((per & 2) == 2) { g_vm->_screenSurface.putxy(xp, 72); - g_vm->_screenSurface.writeg("IDA", 4); + g_vm->_screenSurface.drawString("IDA", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[7]); } if ((per & 1) == 1) { g_vm->_screenSurface.putxy(xp, 80); - g_vm->_screenSurface.writeg("MAX", 4); + g_vm->_screenSurface.drawString("MAX", 4); g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[8]); } g_ipers = per; @@ -617,11 +621,11 @@ void displayAloneText() { clsf10(); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sYou) / 2), 30); - g_vm->_screenSurface.writeg(sYou, 4); + g_vm->_screenSurface.drawString(sYou, 4); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAre) / 2), 50); - g_vm->_screenSurface.writeg(sAre, 4); + g_vm->_screenSurface.drawString(sAre, 4); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAlone) / 2), 70); - g_vm->_screenSurface.writeg(sAlone, 4); + g_vm->_screenSurface.drawString(sAlone, 4); g_ipers = 0; } @@ -673,15 +677,15 @@ void drawClock() { g_vm->_screenSurface.putxy(568, 154); if (g_hour > 11) - g_vm->_screenSurface.writeg("PM ", 1); + g_vm->_screenSurface.drawString("PM ", 1); else - g_vm->_screenSurface.writeg("AM ", 1); + g_vm->_screenSurface.drawString("AM ", 1); g_vm->_screenSurface.putxy(550, 160); if ((g_day >= 0) && (g_day <= 8)) { Common::String tmp = g_vm->getEngineString(S_DAY); tmp.insertChar((char)(g_day + 49), 0); - g_vm->_screenSurface.writeg(tmp, 1); + g_vm->_screenSurface.drawString(tmp, 1); } } @@ -1196,7 +1200,7 @@ void dprog() { g_jh = 0; if (!g_s._ipre) g_blo = true; - g_t = ti1; + g_t = kTime1; g_mh = readclock(); } @@ -1398,7 +1402,7 @@ void cavegre() { ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - parole(2, rand, 1); + startSpeech(2, rand, 1); // The original was doing here a useless loop. // It has been removed @@ -1409,9 +1413,9 @@ void cavegre() { void writetp(Common::String s, int t) { if (g_res == 2) - g_vm->_screenSurface.writeg(s, t); + g_vm->_screenSurface.drawString(s, t); else - g_vm->_screenSurface.writeg(copy(s, 1, 25), t); + g_vm->_screenSurface.drawString(copy(s, 1, 25), t); } void aniof(int ouf, int num) { @@ -1442,35 +1446,35 @@ void musique(int so) { /* musik(0) */ ; } else if ((g_prebru == 0) && (!g_s._ipre)) { - parole(10, 1, 1); + startSpeech(10, 1, 1); ++g_prebru; } else { bool i = false; if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { if (getRandomNumber(1, 3) == 2) { - parole(9, getRandomNumber(2, 4), 1); + startSpeech(9, getRandomNumber(2, 4), 1); i = true; } } else if (g_s._currPlace == CHAPEL) { if (getRandomNumber(1, 2) == 1) { - parole(8, 1, 1); + startSpeech(8, 1, 1); i = true; } } else if (g_s._currPlace == WELL) { if (getRandomNumber(1, 2) == 2) { - parole(12, 1, 1); + startSpeech(12, 1, 1); i = true; } } else if (g_s._currPlace == 23) { - parole(13, 1, 1); + startSpeech(13, 1, 1); i = true; } if (!i) - parole(getRandomNumber(1, 17), 1, 2); + startSpeech(getRandomNumber(1, 17), 1, 2); } } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 05dba14d6d..fcabee51d2 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -44,7 +44,7 @@ extern void text1(int x, int y, int nb, int m); extern void initouv(); extern void ecrf1(); extern void clsf1(); -extern void clsf2(); +extern void clearScreenType2(); extern void ecrf2(); extern void ecr2(Common::String str_); extern void clsf3(); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index d026ccf080..48ca45e4da 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -98,9 +98,9 @@ void tinke() { if (!g_blo) { if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = ti2; + g_t = kTime2; else - g_t = ti1; + g_t = kTime1; cf = g_s._faithScore; if ((cf > 33) && (cf < 66)) g_t -= (g_t / 3); @@ -169,7 +169,7 @@ void tinke() { ecrf2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - parole(1, rand, 1); + startSpeech(1, rand, 1); clsf3(); } } @@ -254,12 +254,12 @@ void tmlieu(int roomId) { nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; - g_vm->_menu.menut(g_vm->_menu._moveMenu[i], nomp); + g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); ++i; } nomp = "* "; for (int cx = 7; cx >= i; --cx) - g_vm->_menu.menut(g_vm->_menu._moveMenu[cx], nomp); + g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); } @@ -289,8 +289,8 @@ void unsetSearchMenu() { for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.enableMenuItem(_actionMenu[cx]); - g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); } /* NIVEAU 6 */ @@ -310,7 +310,7 @@ void tperd() { clsf1(); g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); repon(9, g_crep); - clsf2(); + clearScreenType2(); clsf3(); g_col = false; g_syn = false; @@ -390,12 +390,12 @@ void modinv() { ++cy; r = (ord(g_s._sjer[cx]) + 400); nomp = deline(r - 501 + kInventoryStringIndex); - g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cy], nomp); + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); } if (cy < 6) for (int cx = cy + 1; cx <= 6; ++cx) { - g_vm->_menu.menut(g_vm->_menu._inventoryMenu[cx], " "); + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); } } @@ -412,7 +412,7 @@ void sparl(float adr, float rep) { key = 0; do { - parole(repint, haut[g_caff - 69], 0); + startSpeech(repint, haut[g_caff - 69], 0); f3f8::waitForF3F8(key); CHECK_QUIT; } while (key != 66); @@ -443,8 +443,8 @@ void setSearchMenu() { for (int cx = 1; cx <= 11; ++cx) g_vm->_menu.disableMenuItem(_actionMenu[cx]); - g_vm->_menu.menut(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - g_vm->_menu.menut(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); } void mennor() { @@ -574,9 +574,9 @@ L1: g_crep = 138; repon(2, g_crep); if (g_crep == 138) - parole(5, 2, 1); + startSpeech(5, 2, 1); else - parole(4, 4, 1); + startSpeech(4, 4, 1); if (g_iouv == 0) g_s._faithScore += 2; @@ -601,8 +601,8 @@ L1: } else { repon(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - parole(3, rand, 1); - clsf2(); + startSpeech(3, rand, 1); + clearScreenType2(); displayAloneText(); debloc(21); affrep(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7ed3e921a5..8dd5ac3b35 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -155,7 +155,7 @@ Common::ErrorCode MortevielleEngine::initialise() { init_lieu(); g_soundOff = false; - g_f2_all = false; + g_largestClearScreen = false; teskbd(); dialpre(); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 4fcbb02fd0..3b381dd1b0 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -174,15 +174,14 @@ void hideMouse() { * @remarks Originally called 'show_mouse' */ void showMouse() { - int i, j, k, l; - bool imp; + int k, l; mouse_shwn = mouse_shwn + 1; if (mouse_shwn != 1) return; - j = p_o_s; - imp = odd(y_s); - i = x_s & 7; + int j = p_o_s; + bool imp = odd(y_s); + int i = x_s & 7; switch (g_currGraphicalDevice) { case MODE_CGA: k = 0; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 02c03b8668..d8e2309a4c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -192,7 +192,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) while (!stringParsed) { switch (inputStr[p]) { case '@': - g_vm->_screenSurface.writeg(s, typ); + g_vm->_screenSurface.drawString(s, typ); s = ""; ++p; xc = x; @@ -204,7 +204,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) xc += tab; ++p; if (l_motsuiv(p, inputStr.c_str(), tab) + xc > xf) { - g_vm->_screenSurface.writeg(s, typ); + g_vm->_screenSurface.drawString(s, typ); s = ""; xc = x; yc += 6; @@ -216,7 +216,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) j = x; do { g_vm->_screenSurface.putxy(j, i); - g_vm->_screenSurface.writeg(" ", 0); + g_vm->_screenSurface.drawString(" ", 0); j += 6; } while (j <= xf); i += 6; @@ -228,7 +228,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) break; case '$': stringParsed = true; - g_vm->_screenSurface.writeg(s, typ); + g_vm->_screenSurface.drawString(s, typ); break; default: s += inputStr[p]; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 303323590c..d5bb43a83a 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -45,13 +45,6 @@ namespace Mortevielle { // For ScummVM, we need to do check for file errors where we do the file access const int ioresult = 0; -/** - * Check for disk 2 being in the drive - */ -void dem2() { - // Deprecated under ScummVM -} - void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx @@ -245,7 +238,7 @@ void suite() { Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; g_vm->_screenSurface.putxy(104 + 72 * g_res, 185); - g_vm->_screenSurface.writeg(cpr, 0); + g_vm->_screenSurface.drawString(cpr, 0); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 13a8f5db2e..25633a4111 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -30,8 +30,6 @@ namespace Mortevielle { -extern void dem2(); -//extern void apzuul(); extern void charpal(); extern void chartex(); extern void dialpre(); diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index 3682dc99d0..ff6ad7faec 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -83,7 +83,7 @@ void trait_ph() { -void parole(int rep, int ht, int typ) { +void startSpeech(int rep, int ht, int typ) { int savph[501]; int tempo; diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h index 01cf277422..3fab74d02f 100644 --- a/engines/mortevielle/parole2.h +++ b/engines/mortevielle/parole2.h @@ -33,7 +33,7 @@ namespace Mortevielle { extern void rot_chariot(); extern void init_chariot(); extern void trait_ph(); -extern void parole(int rep, int ht, int typ); +extern void startSpeech(int rep, int ht, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 1407e0e219..36d5265ed3 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -56,7 +56,7 @@ void changeGraphicalDevice(int newDevice) { showPeoplePresent(g_ipers); else displayAloneText(); - clsf2(); + clearScreenType2(); clsf3(); g_maff = 68; afdes(0); @@ -133,7 +133,7 @@ void tmaj3() { void tsitu() { if (!g_col) - clsf2(); + clearScreenType2(); g_syn = false; g_iesc = false; if (!g_anyone) { diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index a53d218c86..0efafe7fba 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -164,8 +164,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { // Close the save file f->finalize(); delete f; + + // Skipped: dialog asking to swap floppy - dem2(); showMouse(); return Common::kNoError; } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 9218cadb53..0fe22fc64d 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -95,7 +95,7 @@ bool g_blo, g_main1, g_choisi, g_test0, - g_f2_all, + g_largestClearScreen, g_imen, g_cache, g_iesc, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 11bc4e0fe4..7517beb992 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -91,8 +91,8 @@ const int kTempoNoise = 78; const int kTempoF = 80; const int kTempoM = 89; -const int ti1 = 410; -const int ti2 = 250; +const int kTime1 = 410; +const int kTime2 = 250; const int maxti = 7975; const int maxtd = 600; const int kMaxRect = 14; @@ -240,7 +240,7 @@ extern bool g_blo, g_main1, g_choisi, g_test0, - g_f2_all, + g_largestClearScreen, g_imen, g_cache, g_iesc, -- cgit v1.2.3 From 09c157b3b33122b645f93c81f8b524caabbd62d5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Mar 2012 23:44:12 +0100 Subject: MORTEVIELLE: Some more renaming. Move globals to the MortevielleEngine class --- engines/mortevielle/actions.cpp | 8 +- engines/mortevielle/keyboard.cpp | 3 +- engines/mortevielle/mor.cpp | 181 ++++++++++++++++++------------------ engines/mortevielle/mor.h | 6 +- engines/mortevielle/mor2.cpp | 12 +-- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 17 ++++ engines/mortevielle/mouse.cpp | 2 +- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/parole2.cpp | 2 +- engines/mortevielle/taffich.cpp | 5 +- engines/mortevielle/var_mor.h | 15 +-- 12 files changed, 133 insertions(+), 122 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 8f30e0da6b..d4a53780e1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1138,8 +1138,8 @@ void fctEnter() { g_s._teauto[8] = '*'; } else { int z = 0; - if (!g_blo) - t11(g_ment, z); + if (!g_vm->g_blo) + z = t11(g_ment); if (z != 0) { if ((g_ment == 3) || (g_ment == 7)) g_crep = 179; @@ -1297,8 +1297,8 @@ void fctWait() { do { ++g_jh; tinke(); - if (!g_blo) - t11(g_s._currPlace, quel); + if (!g_vm->g_blo) + quel = t11(g_s._currPlace); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 72fc6e94aa..f28e309f66 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -25,6 +25,7 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "mortevielle/mortevielle.h" #include "mortevielle/keyboard.h" #include "mortevielle/var_mor.h" #include "mortevielle/asm.h" @@ -42,7 +43,7 @@ int testou() { switch (ch) { case '\23' : - g_soundOff = !g_soundOff; + g_vm->_soundOff = !g_vm->_soundOff; break; case '\26' : if ((g_c_zzz == 1) || (g_c_zzz == 2)) { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 36e06115c1..24548fab13 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -385,33 +385,33 @@ void repon(int f, int m) { void t5(int cx) { if (cx == 10) - g_blo = false; + g_vm->g_blo = false; if (cx != 1) { - g_bh1 = false; - g_bf1 = false; + g_vm->_roomPresenceLuc = false; + g_vm->_roomPresenceIda = false; } if (cx != 2) - g_bh2 = false; + g_vm->_purpleRoomPresenceLeo = false; if (cx != 4) { - g_bh4 = false; - g_bf4 = false; + g_vm->_roomPresenceGuy = false; + g_vm->_roomPresenceEva = false; } if (cx != 5) - g_bh5 = false; + g_vm->_roomPresenceMax = false; if (cx != 6) - g_bh6 = false; + g_vm->_roomPresenceBob = false; if (cx != 8) - g_bh8 = false; + g_vm->_roomPresencePat = false; if (cx != 3) - g_bt3 = false; + g_vm->_toiletsPresenceBobMax = false; if (cx != 7) - g_bt7 = false; + g_vm->_bathRoomPresenceBobMax = false; if (cx != 9) - g_bh9 = false; + g_vm->_room9PresenceLeo = false; } /** @@ -831,18 +831,18 @@ int getPresenceStatsChapel(int &hour) { * Engine function - Check who is in the Green Room * @remarks Originally called 'quelq1' */ -void setPresenceGreenRoom(int l) { - int per = getRandomNumber(1, 2); - if (l == 1) { - if (per == 1) - g_bh1 = true; +void setPresenceGreenRoom(int roomId) { + int rand = getRandomNumber(1, 2); + if (roomId == GREEN_ROOM) { + if (rand == 1) + g_vm->_roomPresenceLuc = true; else - g_bf1 = true; - } else if (l == 4) { - if (per == 1) - g_bh4 = true; + g_vm->_roomPresenceIda = true; + } else if (roomId == DARKBLUE_ROOM) { + if (rand == 1) + g_vm->_roomPresenceGuy = true; else - g_bf4 = true; + g_vm->_roomPresenceEva = true; } g_ipers = 10; @@ -854,9 +854,9 @@ void setPresenceGreenRoom(int l) { */ void setPresencePurpleRoom() { if (g_li == 2) - g_bh2 = true; + g_vm->_purpleRoomPresenceLeo = true; else - g_bh9 = true; + g_vm->_room9PresenceLeo = true; g_ipers = 10; } @@ -866,7 +866,7 @@ void setPresencePurpleRoom() { * @remarks Originally called 'quelq5' */ void setPresenceBlueRoom() { - g_bh5 = true; + g_vm->_roomPresenceMax = true; g_ipers = 10; } @@ -876,9 +876,9 @@ void setPresenceBlueRoom() { */ void setPresenceRedRoom(int l) { if (l == 6) - g_bh6 = true; + g_vm->_roomPresenceBob = true; else if (l == 8) - g_bh8 = true; + g_vm->_roomPresencePat = true; g_ipers = 10; } @@ -962,14 +962,14 @@ int setPresenceLanding() { int rand = 0; do { rand = getRandomNumber(1, 8); - test = (((rand == 1) && (g_bh2 || g_bh9)) || - ((rand == 2) && g_bh8) || - ((rand == 3) && g_bh4) || - ((rand == 4) && g_bf4) || - ((rand == 5) && g_bh6) || - ((rand == 6) && g_bh1) || - ((rand == 7) && g_bf1) || - ((rand == 8) && g_bh5)); + test = (((rand == 1) && (g_vm->_purpleRoomPresenceLeo || g_vm->_room9PresenceLeo)) || + ((rand == 2) && g_vm->_roomPresencePat) || + ((rand == 3) && g_vm->_roomPresenceGuy) || + ((rand == 4) && g_vm->_roomPresenceEva) || + ((rand == 5) && g_vm->_roomPresenceBob) || + ((rand == 6) && g_vm->_roomPresenceLuc) || + ((rand == 7) && g_vm->_roomPresenceIda) || + ((rand == 8) && g_vm->_roomPresenceMax)); } while (test); int retVal = convertCharacterIndexToBitIndex(rand); @@ -1024,31 +1024,33 @@ void getKnockAnswer() { } } -void nouvp(int l, int &p) { - p = 0; +int nouvp(int l) { + int bitIndex = 0; if (l == 1) { - if (g_bh1) - p = 4; - if (g_bf1) - p = 2; - } else if (((l == 2) && (g_bh2)) || ((l == 9) && (g_bh9))) - p = 128; + if (g_vm->_roomPresenceLuc) + bitIndex = 4; // LUC + if (g_vm->_roomPresenceIda) + bitIndex = 2; // IDA + } else if (((l == 2) && (g_vm->_purpleRoomPresenceLeo)) || ((l == 9) && (g_vm->_room9PresenceLeo))) + bitIndex = 128; // LEO else if (l == 4) { - if (g_bh4) - p = 32; - if (g_bf4) - p = 16; - } else if ((l == 5) && (g_bh5)) - p = 1; - else if ((l == 6) && (g_bh6)) - p = 8; - else if ((l == 8) && (g_bh8)) - p = 64; - else if (((l == 3) && (g_bt3)) || ((l == 7) && (g_bt7))) - p = 9; - - if (p != 9) - showPeoplePresent(p); + if (g_vm->_roomPresenceGuy) + bitIndex = 32; // GUY + if (g_vm->_roomPresenceEva) + bitIndex = 16; // EVA + } else if ((l == 5) && (g_vm->_roomPresenceMax)) + bitIndex = 1; // MAX + else if ((l == 6) && (g_vm->_roomPresenceBob)) + bitIndex = 8; // BOB + else if ((l == 8) && (g_vm->_roomPresencePat)) + bitIndex = 64; // PAT + else if (((l == 3) && (g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (g_vm->_bathRoomPresenceBobMax))) + bitIndex = 9; // BOB + MAX + + if (bitIndex != 9) + showPeoplePresent(bitIndex); + + return bitIndex; } /** @@ -1084,19 +1086,19 @@ void ecfren(int &p, int &rand, int cf, int l) { displayAloneText(); p = -500; rand = 0; - if (((l == 1) && (!g_bh1) && (!g_bf1)) || ((l == 4) && (!g_bh4) && (!g_bf4))) + if (((l == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((l == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva))) p = getPresenceStatsGreenRoom(); - if ((l == 2) && (!g_bh2) && (!g_bh9)) + if ((l == 2) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo)) p = getPresenceStatsPurpleRoom(); - if (((l == 3) && (!g_bt3)) || ((l == 7) && (!g_bt7))) + if (((l == 3) && (!g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (!g_vm->_bathRoomPresenceBobMax))) p = getPresenceStatsToilets(); - if ((l == 5) && (!g_bh5)) + if ((l == 5) && (!g_vm->_roomPresenceMax)) p = getPresenceStatsBlueRoom(); - if (((l == 6) && (!g_bh6)) || ((l == 8) && (!g_bh8))) + if (((l == 6) && (!g_vm->_roomPresenceBob)) || ((l == 8) && (!g_vm->_roomPresencePat))) p = getPresenceStatsRedRoom(); - if ((l == 9) && (!g_bh9) && (!g_bh2)) + if ((l == 9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo)) p = 10; - if (((l == 2) && (g_bh9)) || ((l == 9) && (g_bh2))) + if (((l == 2) && (g_vm->_room9PresenceLeo)) || ((l == 9) && (g_vm->_purpleRoomPresenceLeo))) p = -400; if (p != -500) { p += cf; @@ -1109,29 +1111,29 @@ void becfren(int l) { int rand = getRandomNumber(1, 2); if (l == 1) { if (rand == 1) - g_bh1 = true; + g_vm->_roomPresenceLuc = true; else - g_bf1 = true; + g_vm->_roomPresenceIda = true; } else { // l == 4 if (rand == 1) - g_bh4 = true; + g_vm->_roomPresenceGuy = true; else - g_bf4 = true; + g_vm->_roomPresenceEva = true; } } else if (l == 2) - g_bh2 = true; + g_vm->_purpleRoomPresenceLeo = true; else if (l == 3) - g_bt3 = true; + g_vm->_toiletsPresenceBobMax = true; else if (l == 5) - g_bh5 = true; + g_vm->_roomPresenceMax = true; else if (l == 6) - g_bh6 = true; + g_vm->_roomPresenceBob = true; else if (l == 7) - g_bt7 = true; + g_vm->_bathRoomPresenceBobMax = true; else if (l == 8) - g_bh8 = true; + g_vm->_roomPresencePat = true; else if (l == 9) - g_bh9 = true; + g_vm->_room9PresenceLeo = true; } /* NIVEAU 10 */ @@ -1199,13 +1201,13 @@ void dprog() { g_li = 21; g_jh = 0; if (!g_s._ipre) - g_blo = true; + g_vm->g_blo = true; g_t = kTime1; g_mh = readclock(); } void pl1(int cf) { - if (((g_li == 1) && (!g_bh1) && (!g_bf1)) || ((g_li == 4) && (!g_bh4) && (!g_bf4))) { + if (((g_li == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((g_li == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva))) { int p = getPresenceStatsGreenRoom(); int rand; phaz(rand, p, cf); @@ -1218,7 +1220,7 @@ void pl1(int cf) { } void pl2(int cf) { - if (!g_bh2) { + if (!g_vm->_purpleRoomPresenceLeo) { int p = getPresenceStatsPurpleRoom(); int rand; phaz(rand, p, cf); @@ -1231,7 +1233,7 @@ void pl2(int cf) { } void pl5(int cf) { - if (!g_bh5) { + if (!g_vm->_roomPresenceMax) { int p = getPresenceStatsBlueRoom(); int rand; @@ -1245,7 +1247,7 @@ void pl5(int cf) { } void pl6(int cf) { - if (((g_li == 6) && (!g_bh6)) || ((g_li == 8) && (!g_bh8))) { + if (((g_li == 6) && (!g_vm->_roomPresenceBob)) || ((g_li == 8) && (!g_vm->_roomPresencePat))) { int p = getPresenceStatsRedRoom(); int rand; @@ -1259,7 +1261,7 @@ void pl6(int cf) { } void pl9(int cf) { - if (!g_bh9) { + if (!g_vm->_room9PresenceLeo) { cf = -10; int p, rand; phaz(rand, p, cf); @@ -1337,7 +1339,8 @@ void pl20(int cf) { setPresenceChapel(h); } -void t11(int l11, int &a) { +int t11(int l11) { + int retVal = 0; int p, rand; ecfren(p, rand, g_s._faithScore, l11); @@ -1346,13 +1349,13 @@ void t11(int l11, int &a) { if (p != -500) { if (rand > p) { displayAloneText(); - a = 0; + retVal = 0; } else { becfren(g_li); - nouvp(g_li, a); + retVal = nouvp(g_li); } } else - nouvp(g_li, a); + retVal = nouvp(g_li); } if (l11 > 9) { @@ -1376,7 +1379,7 @@ void t11(int l11, int &a) { rand = getRandomNumber(1, 100); if (rand > p) { displayAloneText(); - a = 0; + retVal = 0; } else { if (l11 == 10) p = setPresenceDiningRoom(h); @@ -1388,10 +1391,12 @@ void t11(int l11, int &a) { p = setPresenceLanding(); else if (l11 == 20) p = setPresenceChapel(h); - a = p; + retVal = p; } } } + + return retVal; } void cavegre() { diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index fcabee51d2..59555fb511 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -80,7 +80,7 @@ extern int getPresenceStatsKitchen(); extern int getPresenceStatsAttic(); extern int getPresenceStatsLanding(); extern int getPresenceStatsChapel(int &hour); -extern void setPresenceGreenRoom(int l); +extern void setPresenceGreenRoom(int roomId); extern void setPresencePurpleRoom(); extern void setPresenceBlueRoom(); extern void setPresenceRedRoom(int l); @@ -90,7 +90,7 @@ extern int setPresenceKitchen(); extern int setPresenceLanding(); extern int setPresenceChapel(int hour); extern void getKnockAnswer(); -extern void nouvp(int l, int &p); +extern int nouvp(int l); extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int l); extern void becfren(int l); @@ -110,7 +110,7 @@ extern void pl12(int cf); extern void pl13(int cf); extern void pl15(int cf); extern void pl20(int cf); -extern void t11(int l11, int &a); +extern int t11(int l11); extern void cavegre(); extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 48ca45e4da..bbe4a7734e 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -96,7 +96,7 @@ void tinke() { if (y_s < 12) return; - if (!g_blo) { + if (!g_vm->g_blo) { if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) g_t = kTime2; else @@ -182,7 +182,7 @@ void tinke() { } g_hfb = readclock(); if ((g_brt) && ((g_hfb - g_hdb) > 17)) { - nouvp(g_li, cx); + cx = nouvp(g_li); g_brt = false; g_hdb = 0; if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) @@ -301,9 +301,9 @@ void tperd() { g_iouv = 0; g_mchai = 0; unsetSearchMenu(); - if (!g_blo) { + if (!g_vm->g_blo) { int cx; - t11(21, cx); + cx = t11(21); } g_vm->_loseGame = true; @@ -514,8 +514,8 @@ void t1sama() { //Entering manor g_s._currPlace = OWN_ROOM; affrep(); t5(10); - if (!g_blo) - t11(0, minute); + if (!g_vm->g_blo) + minute = t11(0); g_ipers = 0; g_mpers = 0; g_s._ipre = true; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8dd5ac3b35..95701ca3bd 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -154,7 +154,7 @@ Common::ErrorCode MortevielleEngine::initialise() { initMouse(); init_lieu(); - g_soundOff = false; + g_vm->_soundOff = false; g_largestClearScreen = false; teskbd(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c44daff1bd..d00d318d96 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -88,6 +88,8 @@ private: bool _inMainGameLoop; // Flag when the main game loop is active Common::StringArray _engineStrings; Common::StringArray _gameStrings; + + Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); void readStaticStrings(Common::File &f, int dataSize, DataType dataType); @@ -100,6 +102,21 @@ private: void playGame(); void handleAction(); public: + bool g_blo; + bool _roomPresenceLuc; + bool _roomPresenceIda; + bool _purpleRoomPresenceLeo; + bool _roomPresenceGuy; + bool _roomPresenceEva; + bool _roomPresenceMax; + bool _roomPresenceBob; + bool _roomPresencePat; + bool _toiletsPresenceBobMax; + bool _bathRoomPresenceBobMax; + bool _room9PresenceLeo; + + bool _soundOff; + ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 3b381dd1b0..d6ffb116de 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -417,7 +417,7 @@ void moveMouse(bool &funct, char &key) { cy = 8; break; case '\23': - g_soundOff = !g_soundOff; + g_vm->_soundOff = !g_vm->_soundOff; return; break; case '\26': diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index d5bb43a83a..cab69c0a07 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -161,7 +161,7 @@ void music() { bool fin; /* debug('o3 music'); */ - if (g_soundOff) + if (g_vm->_soundOff) return; g_rech_cfiec = true; diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index ff6ad7faec..e08cbeb475 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -87,7 +87,7 @@ void startSpeech(int rep, int ht, int typ) { int savph[501]; int tempo; - if (g_soundOff) + if (g_vm->_soundOff) return; g_num_ph = rep; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 3e21a35742..47954804ce 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -27,6 +27,7 @@ #include "common/file.h" #include "common/str.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/level15.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" @@ -251,8 +252,8 @@ void taffich() { if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) displayAloneText(); - else if (!g_blo) - t11(g_s._currPlace, cx); + else if (!g_vm->g_blo) + cx = t11(g_s._currPlace); g_mpers = 0; } } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 7517beb992..1a5f137be1 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -223,20 +223,7 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -extern bool g_blo, - g_bh1, - g_bf1, - g_bh2, - g_bh4, - g_bf4, - g_bh5, - g_bh6, - g_bh8, - g_bt3, - g_bt7, - g_bh9, - - g_soundOff, +extern bool g_main1, g_choisi, g_test0, -- cgit v1.2.3 From 36a65ad3c9c858f72ba62d16d58b6996228b27fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 8 Mar 2012 08:24:54 +0100 Subject: MORTEVIELLE: Move (and rename) some more globals to MortevielleEngine --- engines/mortevielle/actions.cpp | 66 ++++++++++++++++++------------------- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/menu.cpp | 16 ++++----- engines/mortevielle/menu.h | 5 ++- engines/mortevielle/mor.cpp | 14 ++++---- engines/mortevielle/mor2.cpp | 20 +++++------ engines/mortevielle/mortevielle.cpp | 18 +++++----- engines/mortevielle/mortevielle.h | 8 ++++- engines/mortevielle/prog.cpp | 12 +++---- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 24 +------------- engines/mortevielle/var_mor.h | 8 ----- 12 files changed, 86 insertions(+), 109 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index d4a53780e1..cd08177bcc 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -57,9 +57,9 @@ void fctMove() { if (!g_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); - if (g_iesc) + if (g_vm->_keyPressedEsc) g_okdes = false; - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(1); if (g_num == 0) @@ -224,7 +224,7 @@ void fctTake() { if (!g_syn) ecr3(g_vm->getEngineString(S_TAKE)); tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; if (g_caff == 3) { tcoord(2); @@ -322,12 +322,10 @@ void fctInventoryTake() { * @remarks Originally called 'tsoulever' */ void fctLift() { -// int cx; - if (!g_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(3); if (g_num == 0) { @@ -364,7 +362,7 @@ void fctRead() { if (!g_syn) ecr3(g_vm->getEngineString(S_READ)); tfleche(); - if (!(g_anyone) && !(g_iesc)) { + if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(4); if (g_num != 0) g_crep = 107; @@ -397,7 +395,7 @@ void fctLook() { if (!g_syn) ecr3(g_vm->getEngineString(S_LOOK)); tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(5); if (g_num == 0) { @@ -488,7 +486,7 @@ void fctSearch() { ecr3(g_vm->getEngineString(S_SEARCH)); tfleche(); - if (g_anyone || g_iesc) + if (g_anyone || g_vm->_keyPressedEsc) return; if (g_s._currPlace == 23) { @@ -599,7 +597,7 @@ void fctOpen() { } tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); @@ -652,10 +650,10 @@ void fctPlace() { ecr3(g_vm->getEngineString(S_PUT)); tfleche(); - if (g_iesc) + if (g_vm->_keyPressedEsc) g_crep = 998; - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(8); @@ -784,7 +782,7 @@ void fctTurn() { if (!g_syn) ecr3(g_vm->getEngineString(S_TURN)); tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(9); if (g_num != 0) { @@ -820,12 +818,12 @@ void fctSelfHide() { if (!g_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); - if (!(g_anyone) && !(g_iesc)) { + if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(10); if (g_num == 0) - g_cache = false; + g_vm->_hiddenHero = false; else { - g_cache = true; + g_vm->_hiddenHero = true; g_crep = 999; } } @@ -842,7 +840,7 @@ void fctAttach() { if (!g_syn) ecr3(g_vm->getEngineString(S_TIE)); tfleche(); - if (!(g_anyone) && !(g_iesc)) { + if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(8); g_crep = 997; if ((g_num != 0) && (g_s._currPlace == WELL)) { @@ -868,9 +866,9 @@ void fctClose() { if (g_caff < 26) { tfleche(); - if (g_iesc) + if (g_vm->_keyPressedEsc) g_crep = 998; - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); if (g_num != 0) { @@ -915,7 +913,7 @@ void fctKnock() { if (g_s._currPlace < DOOR) { tfleche(); - if (!(g_anyone) && !(g_iesc)) { + if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) g_crep = 133; else @@ -966,7 +964,7 @@ void fctSelfPut() { return; } tfleche(); - if ((g_anyone) || (g_iesc)) + if ((g_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); g_crep = 124; @@ -1138,7 +1136,7 @@ void fctEnter() { g_s._teauto[8] = '*'; } else { int z = 0; - if (!g_vm->g_blo) + if (!g_vm->_blo) z = t11(g_ment); if (z != 0) { if ((g_ment == 3) || (g_ment == 7)) @@ -1155,12 +1153,12 @@ void fctEnter() { g_msg[4] = g_vm->_menu._discussMenu[g_x]; g_syn = true; if (g_ment == 9) { - g_col = true; + g_vm->_col = true; g_caff = 70; afdes(0); repon(2, g_caff); } else - g_col = false; + g_vm->_col = false; debloc(g_ment); g_ment = 0; } @@ -1237,7 +1235,7 @@ void fctForce() { if (g_caff < 25) tfleche(); - if ((!g_anyone) && (!g_iesc)) { + if ((!g_anyone) && (!g_vm->_keyPressedEsc)) { if (g_s._currPlace != 26) g_crep = 997; else { @@ -1297,7 +1295,7 @@ void fctWait() { do { ++g_jh; tinke(); - if (!g_vm->g_blo) + if (!g_vm->_blo) quel = t11(g_s._currPlace); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; @@ -1327,7 +1325,7 @@ void fctSound() { ecr3(g_vm->getEngineString(S_PROBE2)); if (g_caff < 27) { tfleche(); - if (!(g_anyone) && (!g_iesc)) + if (!(g_anyone) && (!g_vm->_keyPressedEsc)) g_crep = 145; g_num = 0; } @@ -1345,7 +1343,7 @@ void fctDiscuss() { bool f; endSearch(); - if (g_col) + if (g_vm->_col) suj = 128; else { cx = 0; @@ -1463,8 +1461,8 @@ void fctDiscuss() { g_vm->setMouseClick(false); if (choi != 46) { int ix = choi - 1; - if (g_col) { - g_col = false; + if (g_vm->_col) { + g_vm->_col = false; g_s._currPlace = 15; if (g_iouv > 0) max = 8; @@ -1507,15 +1505,15 @@ void fctDiscuss() { showMouse(); } } while ((choi != 46) && (suj != 138)); - if (g_col) { + if (g_vm->_col) { g_s._faithScore += (3 * (g_s._faithScore / 10)); hideMouse(); hirs(); premtet(); sparl(0, 138); showMouse(); - g_col = false; - g_s._currPlace = 15; + g_vm->_col = false; + g_s._currPlace = LANDING; } g_ctrm = 0; hideMouse(); @@ -1541,7 +1539,7 @@ void fctSmell() { if (!g_syn) ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); - if (!(g_anyone) && !(g_iesc)) + if (!(g_anyone) && !(g_vm->_keyPressedEsc)) if (g_caff == 16) g_crep = 153; } else if (g_caff == 123) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 717a256b8f..c4b476c73e 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -468,7 +468,7 @@ void f3f8::ani50() { pictout(adani, g_crep, 63, 12); g_crep = animof(2, 1); pictout(adani, g_crep, 63, 12); - g_largestClearScreen = (g_res == 1); + g_vm->_largestClearScreen = (g_res == 1); repon(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f2f19b6eee..9a0bcec2de 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -192,9 +192,9 @@ void Menu::drawMenu() { _menuActive = true; g_msg4 = OPCODE_NONE; g_msg3 = OPCODE_NONE; - g_choisi = false; + _menuSelected = false; g_vm->setMouseClick(false); - g_test0 = false; + _multiTitle = false; } void Menu::invers(int ix) { @@ -353,7 +353,7 @@ void Menu::menuDown(int ii) { } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (cx != nb_lig); - g_test0 = true; + _multiTitle = true; showMouse(); } @@ -361,7 +361,7 @@ void Menu::menuDown(int ii) { * Menu is being removed, so restore the previous background area. */ void Menu::menuUp(int xx) { - if (g_test0) { + if (_multiTitle) { charecr(10, (g_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ @@ -375,7 +375,7 @@ void Menu::menuUp(int xx) { // Copy the data Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest); - g_test0 = false; + _multiTitle = false; } } @@ -428,7 +428,7 @@ void Menu::mdn() { else ix = MENU_FILE; - if ((ix != g_msg3) || (!g_test0)) + if ((ix != g_msg3) || (!_multiTitle)) if (!((ix == MENU_FILE) && ((g_msg3 == MENU_SAVE) || (g_msg3 == MENU_LOAD)))) { menuUp(g_msg3); menuDown(ix); @@ -436,7 +436,7 @@ void Menu::mdn() { g_msg4 = OPCODE_NONE; } } else { // Not in the MenuTitle line - if ((y > 11) && (g_test0)) + if ((y > 11) && (_multiTitle)) util(x, y); } } else { // There was a click @@ -453,7 +453,7 @@ void Menu::mdn() { g_vm->setMouseClick(false); } else { // A menu was clicked on - g_choisi = (g_test0) && (g_msg4 != OPCODE_NONE); + _menuSelected = (_multiTitle) && (g_msg4 != OPCODE_NONE); menuUp(g_msg3); g_msg[4] = g_msg4; g_msg[3] = g_msg3; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index cdd343a9ed..5672ef7864 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -39,6 +39,9 @@ private: void menuDown(int ii); public: bool _menuActive; + bool _menuSelected; + bool _multiTitle; + bool _menuDisplayed; Common::String _inventoryStringArray[9]; Common::String _moveStringArray[8]; Common::String _actionStringArray[22]; @@ -47,7 +50,7 @@ public: int _discussMenu[9]; int _inventoryMenu[9]; int _moveMenu[8]; -public: + void setText(int menuId, Common::String name); void disableMenuItem(int menuId); void enableMenuItem(int menuId); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 24548fab13..e3bc5243f9 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -166,10 +166,10 @@ void clsf1() { */ void clearScreenType2() { hideMouse(); - if (g_largestClearScreen) { + if (g_vm->_largestClearScreen) { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); - g_largestClearScreen = false; + g_vm->_largestClearScreen = false; } else { g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); @@ -194,7 +194,7 @@ void ecr2(Common::String str_) { g_vm->_screenSurface.putxy(8, 182); g_vm->_screenSurface.drawString(copy(str_, tlig, tlig << 1), 5); } else { - g_largestClearScreen = true; + g_vm->_largestClearScreen = true; clearScreenType2(); g_vm->_screenSurface.putxy(8, 176); g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); @@ -318,9 +318,9 @@ void repon(int f, int m) { tmpStr = deline(m - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) - g_largestClearScreen = true; + g_vm->_largestClearScreen = true; else - g_largestClearScreen = false; + g_vm->_largestClearScreen = false; clearScreenType2(); displayStr(tmpStr, 8, 176, 85, 3, 5); @@ -385,7 +385,7 @@ void repon(int f, int m) { void t5(int cx) { if (cx == 10) - g_vm->g_blo = false; + g_vm->_blo = false; if (cx != 1) { g_vm->_roomPresenceLuc = false; @@ -1201,7 +1201,7 @@ void dprog() { g_li = 21; g_jh = 0; if (!g_s._ipre) - g_vm->g_blo = true; + g_vm->_blo = true; g_t = kTime1; g_mh = readclock(); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index bbe4a7734e..4c3342b900 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -96,7 +96,7 @@ void tinke() { if (y_s < 12) return; - if (!g_vm->g_blo) { + if (!g_vm->_blo) { if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) g_t = kTime2; else @@ -301,7 +301,7 @@ void tperd() { g_iouv = 0; g_mchai = 0; unsetSearchMenu(); - if (!g_vm->g_blo) { + if (!g_vm->_blo) { int cx; cx = t11(21); } @@ -312,7 +312,7 @@ void tperd() { repon(9, g_crep); clearScreenType2(); clsf3(); - g_col = false; + g_vm->_col = false; g_syn = false; g_okdes = false; } @@ -514,7 +514,7 @@ void t1sama() { //Entering manor g_s._currPlace = OWN_ROOM; affrep(); t5(10); - if (!g_vm->g_blo) + if (!g_vm->_blo) minute = t11(0); g_ipers = 0; g_mpers = 0; @@ -563,13 +563,13 @@ void tctrm() { void quelquun() { - if (g_imen) + if (g_vm->_menu._menuDisplayed) g_vm->_menu.eraseMenu(); endSearch(); g_crep = 997; L1: - if (!g_cache) { + if (!g_vm->_hiddenHero) { if (g_crep == 997) g_crep = 138; repon(2, g_crep); @@ -592,10 +592,10 @@ L1: g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[cx]; g_syn = true; - g_col = true; + g_vm->_col = true; } else { if (getRandomNumber(1, 3) == 2) { - g_cache = false; + g_vm->_hiddenHero = false; g_crep = 137; goto L1; } else { @@ -608,7 +608,7 @@ L1: affrep(); } } - if (g_imen) + if (g_vm->_menu._menuDisplayed) g_vm->_menu.drawMenu(); } @@ -665,7 +665,7 @@ void tfleche() { } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_anyone) || (g_rect))); if (touch == '\73') - g_iesc = true; + g_vm->_keyPressedEsc = true; if (g_rect) { g_x = x_s; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 95701ca3bd..42c714e456 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -154,8 +154,8 @@ Common::ErrorCode MortevielleEngine::initialise() { initMouse(); init_lieu(); - g_vm->_soundOff = false; - g_largestClearScreen = false; + _soundOff = false; + _largestClearScreen = false; teskbd(); dialpre(); @@ -553,9 +553,9 @@ void MortevielleEngine::handleAction() { clsf3(); oo = false; g_ctrm = 0; - if (!g_iesc) { + if (!_keyPressedEsc) { g_vm->_menu.drawMenu(); - g_imen = true; + g_vm->_menu._menuDisplayed = true; temps = 0; g_key = 0; funct = false; @@ -568,20 +568,20 @@ void MortevielleEngine::handleAction() { moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; - } while (!((g_choisi) || (temps > lim) || (funct) || (g_anyone))); + } while (!((g_vm->_menu._menuSelected) || (temps > lim) || (funct) || (g_anyone))); _inMainGameLoop = false; g_vm->_menu.eraseMenu(); - g_imen = false; + g_vm->_menu._menuDisplayed = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (g_choisi && (g_msg[3] == MENU_SAVE)) { + if (g_vm->_menu._menuSelected && (g_msg[3] == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7); g_vm->_savegameManager.saveGame(g_msg[4] & 7, saveName); } - if (g_choisi && (g_msg[3] == MENU_LOAD)) + if (g_vm->_menu._menuSelected && (g_msg[3] == MENU_LOAD)) g_vm->_savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(g_hintPctMessage, 1); @@ -639,7 +639,7 @@ void MortevielleEngine::handleAction() { g_okdes = false; dessin(0); } - if ((!g_syn) || (g_col)) + if ((!g_syn) || (_col)) repon(2, g_crep); } } while (g_syn); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index d00d318d96..30b1b982e9 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -102,7 +102,6 @@ private: void playGame(); void handleAction(); public: - bool g_blo; bool _roomPresenceLuc; bool _roomPresenceIda; bool _purpleRoomPresenceLeo; @@ -116,6 +115,13 @@ public: bool _room9PresenceLeo; bool _soundOff; + bool _largestClearScreen; + bool _hiddenHero; + bool _keyPressedEsc; + + bool _blo; + bool _col; + ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 36d5265ed3..a74def2eb4 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -70,12 +70,12 @@ void changeGraphicalDevice(int newDevice) { */ void MortevielleEngine::gameLoaded() { hideMouse(); - g_imen = false; + _menu._menuDisplayed = false; _loseGame = true; g_anyone = false; g_okdes = true; - g_col = false; - g_cache = false; + _col = false; + _hiddenHero = false; g_brt = false; g_maff = 68; g_mnumo = 0; @@ -132,10 +132,10 @@ void tmaj3() { } void tsitu() { - if (!g_col) + if (!g_vm->_col) clearScreenType2(); g_syn = false; - g_iesc = false; + g_vm->_keyPressedEsc = false; if (!g_anyone) { if (g_brt) if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { @@ -199,7 +199,7 @@ void tsitu() { fctSelfPut(); if (g_msg[4] == OPCODE_SLOOK) fctSelftLook(); - g_cache = false; + g_vm->_hiddenHero = false; if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 47954804ce..6fe9f61b60 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -252,7 +252,7 @@ void taffich() { if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) displayAloneText(); - else if (!g_vm->g_blo) + else if (!g_vm->_blo) cx = t11(g_s._currPlace); g_mpers = 0; } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 0fe22fc64d..d9aa291e3f 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -78,29 +78,7 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool g_blo, - g_bh1, - g_bf1, - g_bh2, - g_bh4, - g_bf4, - g_bh5, - g_bh6, - g_bh8, - g_bt3, - g_bt7, - g_bh9, - - g_soundOff, - g_main1, - g_choisi, - g_test0, - g_largestClearScreen, - g_imen, - g_cache, - g_iesc, - g_col, - g_syn, +bool g_syn, g_heroSearching, g_zuul, g_obpart, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 1a5f137be1..610b302e45 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -224,14 +224,6 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU /*---------------------------------------------------------------------------*/ extern bool - g_main1, - g_choisi, - g_test0, - g_largestClearScreen, - g_imen, - g_cache, - g_iesc, - g_col, g_syn, g_heroSearching, g_zuul, -- cgit v1.2.3 From 24866fe395ebee1e127e749ee9209f45b98e729d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 9 Mar 2012 20:44:10 +1100 Subject: MORTEVIELLE: Fix crash in chartex method for French version --- engines/mortevielle/ovd1.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index cab69c0a07..8641a18501 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -105,21 +105,24 @@ void chartex() { if (!inpFile.open("TXX.INP")) { if (!inpFile.open("TXX.MOR")) { warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; } - } else if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { - warning("TXX file - Unexpected format - Switching to DAT file"); + } + if (!ntpFile.open("TXX.NTP")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); return; - } else { - for (int i = 0; i < inpFile.size() / 2; ++i) - g_t_mot[i] = inpFile.readUint16LE(); - - inpFile.close(); - g_vm->_txxFileFl = true; } + + if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { + warning("TXX file - Unexpected format - Switching to DAT file"); + return; + } - if (!ntpFile.open("TXX.NTP")) { - error("Missing file - TXX.NTP"); - } + for (int i = 0; i < inpFile.size() / 2; ++i) + g_t_mot[i] = inpFile.readUint16LE(); + + inpFile.close(); + g_vm->_txxFileFl = true; for (int i = 0; i < (ntpFile.size() / 3); ++i) { g_t_rec[i]._indis = ntpFile.readSint16LE(); -- cgit v1.2.3 From 61afdadcb6493d0e349104ccb467faa4905d7eb7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Mar 2012 20:09:19 +0100 Subject: MORTEVIELLE: Some more renaming, fix a couple of GCC warnings --- engines/mortevielle/actions.cpp | 50 ++++++++++++++++++------------------- engines/mortevielle/mor2.cpp | 16 ++++++------ engines/mortevielle/mortevielle.cpp | 10 ++++---- engines/mortevielle/mortevielle.h | 4 +++ engines/mortevielle/mouse.cpp | 2 +- engines/mortevielle/prog.cpp | 8 +++--- engines/mortevielle/var_mor.cpp | 6 +---- engines/mortevielle/var_mor.h | 4 --- 8 files changed, 46 insertions(+), 54 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index cd08177bcc..cabd0522dd 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -54,7 +54,7 @@ void fctMove() { repon(2, g_s._currPlace); } if ((g_s._currPlace == LANDING) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); if (g_vm->_keyPressedEsc) @@ -189,7 +189,7 @@ void fctTake() { if (g_crep != 139) { if (g_ipers > 0) g_s._faithScore += 3; - if (g_obpart) { + if (g_vm->_obpart) { if (g_s._currPlace == PURPLE_ROOM) g_s._purpleRoomObjectId = 0; if (g_s._currPlace == ATTIC) { @@ -207,7 +207,7 @@ void fctTake() { if (g_s._currPlace == WELL) g_s._wellObjectId = 0; unsetSearchMenu(); - g_obpart = false; + g_vm->_obpart = false; affrep(); } else { g_tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; @@ -221,7 +221,7 @@ void fctTake() { } return; } - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TAKE)); tfleche(); if ((g_anyone) || (g_vm->_keyPressedEsc)) @@ -322,7 +322,7 @@ void fctInventoryTake() { * @remarks Originally called 'tsoulever' */ void fctLift() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); if ((g_anyone) || (g_vm->_keyPressedEsc)) @@ -359,7 +359,7 @@ void fctRead() { if (g_caff > 99) st4(g_caff); else { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_READ)); tfleche(); if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { @@ -392,7 +392,7 @@ void fctLook() { g_crep = 103; return; } - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LOOK)); tfleche(); if ((g_anyone) || (g_vm->_keyPressedEsc)) @@ -482,7 +482,7 @@ void fctSearch() { return; } - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SEARCH)); tfleche(); @@ -513,7 +513,7 @@ void fctSearch() { if (g_mchai != 0) { g_cs = 0; g_is = 0; - g_heroSearching = true; + g_vm->_heroSearching = true; setSearchMenu(); tsuiv(); } else @@ -579,13 +579,13 @@ void fctSelfSearch() { * @remarks Originally called 'touvrir' */ void fctOpen() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_OPEN)); if (g_caff == 26) { if (g_ment != 0) { g_msg[4] = OPCODE_ENTER; - g_syn = true; + g_vm->_syn = true; } else g_crep = 997; return; @@ -646,7 +646,7 @@ void fctPlace() { return; } - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_PUT)); tfleche(); @@ -779,7 +779,7 @@ void fctTurn() { g_crep = 149; return; } - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TURN)); tfleche(); if ((g_anyone) || (g_vm->_keyPressedEsc)) @@ -815,7 +815,7 @@ void fctTurn() { * @remarks Originally called 'tcacher' */ void fctSelfHide() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { @@ -837,7 +837,7 @@ void fctAttach() { if (g_s._selectedObjectId == 0) g_crep = 186; else { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TIE)); tfleche(); if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { @@ -861,7 +861,7 @@ void fctAttach() { * @remarks Originally called 'tfermer' */ void fctClose() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_CLOSE)); if (g_caff < 26) { @@ -903,7 +903,7 @@ void fctClose() { void fctKnock() { warning("Knock - _currPlace %d", g_s._currPlace); - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_HIT)); if (g_s._currPlace == LANDING) { @@ -951,7 +951,7 @@ void fctKnock() { * @remarks Originally called 'tposer' */ void fctSelfPut() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_POSE)); if (g_s._selectedObjectId == 0) g_crep = 186; @@ -1151,7 +1151,7 @@ void fctEnter() { g_s._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[g_x]; - g_syn = true; + g_vm->_syn = true; if (g_ment == 9) { g_vm->_col = true; g_caff = 70; @@ -1230,7 +1230,7 @@ void fctSleep() { * @remarks Originally called 'tdefoncer' */ void fctForce() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMASH)); if (g_caff < 25) tfleche(); @@ -1286,8 +1286,6 @@ void fctLeave() { * @remarks Originally called 'tattendre' */ void fctWait() { - int quel; - g_mpers = 0; clsf3(); @@ -1296,7 +1294,7 @@ void fctWait() { ++g_jh; tinke(); if (!g_vm->_blo) - quel = t11(g_s._currPlace); + t11(g_s._currPlace); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) @@ -1321,7 +1319,7 @@ void fctWait() { * @remarks Originally called 'tsonder' */ void fctSound() { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_PROBE2)); if (g_caff < 27) { tfleche(); @@ -1536,7 +1534,7 @@ void fctDiscuss() { void fctSmell() { g_crep = 119; if (g_caff < 26) { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); if (!(g_anyone) && !(g_vm->_keyPressedEsc)) @@ -1554,7 +1552,7 @@ void fctSmell() { void fctScratch() { g_crep = 155; if (g_caff < 27) { - if (!g_syn) + if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SCRATCH)); tfleche(); } diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 4c3342b900..bf62fe3857 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -301,10 +301,8 @@ void tperd() { g_iouv = 0; g_mchai = 0; unsetSearchMenu(); - if (!g_vm->_blo) { - int cx; - cx = t11(21); - } + if (!g_vm->_blo) + t11(21); g_vm->_loseGame = true; clsf1(); @@ -313,7 +311,7 @@ void tperd() { clearScreenType2(); clsf3(); g_vm->_col = false; - g_syn = false; + g_vm->_syn = false; g_okdes = false; } @@ -425,8 +423,8 @@ void sparl(float adr, float rep) { * @remarks Originally called 'finfouill' */ void endSearch() { - g_heroSearching = false; - g_obpart = false; + g_vm->_heroSearching = false; + g_vm->_obpart = false; g_cs = 0; g_is = 0; unsetSearchMenu(); @@ -591,7 +589,7 @@ L1: g_crep = g_caff; g_msg[3] = MENU_DISCUSS; g_msg[4] = g_vm->_menu._discussMenu[cx]; - g_syn = true; + g_vm->_syn = true; g_vm->_col = true; } else { if (getRandomNumber(1, 3) == 2) { @@ -763,7 +761,7 @@ void treg(int ob) { g_msg[3] = 0; g_crep = 998; } else { - g_obpart = true; + g_vm->_obpart = true; g_crep = g_caff + 400; setSearchMenu(); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 42c714e456..8677798477 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -144,7 +144,7 @@ Common::ErrorCode MortevielleEngine::initialise() { g_currGraphicalDevice = MODE_EGA; g_newGraphicalDevice = g_currGraphicalDevice; - g_zuul = false; + _zuul = false; charpal(); charge_cfiph(); charge_cfiec(); @@ -613,13 +613,13 @@ void MortevielleEngine::handleAction() { if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) g_mnumo = g_msg[4]; if (!g_anyone) { - if ((g_heroSearching) || (g_obpart)) { + if ((g_vm->_heroSearching) || (_obpart)) { if (y_s < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { oo = true; - if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) { + if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) { endSearch(); g_caff = g_s._currPlace; g_crep = 998; @@ -639,10 +639,10 @@ void MortevielleEngine::handleAction() { g_okdes = false; dessin(0); } - if ((!g_syn) || (_col)) + if ((!g_vm->_syn) || (_col)) repon(2, g_crep); } - } while (g_syn); + } while (g_vm->_syn); if (g_ctrm != 0) tctrm(); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 30b1b982e9..b2a8ff6b9b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -117,10 +117,14 @@ public: bool _soundOff; bool _largestClearScreen; bool _hiddenHero; + bool _heroSearching; bool _keyPressedEsc; bool _blo; bool _col; + bool _syn; + bool _zuul; + bool _obpart; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index d6ffb116de..55edea5738 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -421,7 +421,7 @@ void moveMouse(bool &funct, char &key) { return; break; case '\26': - g_zuul = true; + g_vm->_zuul = true; return; break; case '\24': // ^T => mode tandy diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index a74def2eb4..eb6b979368 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -88,8 +88,8 @@ void MortevielleEngine::gameLoaded() { g_cs = 0; g_is = 0; g_ment = 0; - g_syn = true; - g_heroSearching = true; + g_vm->_syn = true; + g_vm->_heroSearching = true; g_mchai = 0; g_inei = 0; initouv(); @@ -101,7 +101,7 @@ void MortevielleEngine::gameLoaded() { g_okdes = false; _endGame = true; _loseGame = false; - g_heroSearching = false; + g_vm->_heroSearching = false; displayAloneText(); tinke(); @@ -134,7 +134,7 @@ void tmaj3() { void tsitu() { if (!g_vm->_col) clearScreenType2(); - g_syn = false; + g_vm->_syn = false; g_vm->_keyPressedEsc = false; if (!g_anyone) { if (g_brt) diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index d9aa291e3f..2903abfc43 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -78,11 +78,7 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool g_syn, - g_heroSearching, - g_zuul, - g_obpart, - g_okdes, +bool g_okdes, g_arret, g_anyone, g_brt, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 610b302e45..0402cd6d48 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -224,10 +224,6 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU /*---------------------------------------------------------------------------*/ extern bool - g_syn, - g_heroSearching, - g_zuul, - g_obpart, g_okdes, g_anyone, g_brt, -- cgit v1.2.3 From 2035dca6df49e492c281a940952ce507fec62cbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Mar 2012 20:14:31 +0100 Subject: MORTEVIELLE: Remove global variable zuul --- engines/mortevielle/mortevielle.cpp | 1 - engines/mortevielle/mortevielle.h | 1 - engines/mortevielle/mouse.cpp | 4 ---- 3 files changed, 6 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8677798477..38b2343c26 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -144,7 +144,6 @@ Common::ErrorCode MortevielleEngine::initialise() { g_currGraphicalDevice = MODE_EGA; g_newGraphicalDevice = g_currGraphicalDevice; - _zuul = false; charpal(); charge_cfiph(); charge_cfiec(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b2a8ff6b9b..69446ae8b9 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -123,7 +123,6 @@ public: bool _blo; bool _col; bool _syn; - bool _zuul; bool _obpart; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 55edea5738..8ae863523d 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -420,10 +420,6 @@ void moveMouse(bool &funct, char &key) { g_vm->_soundOff = !g_vm->_soundOff; return; break; - case '\26': - g_vm->_zuul = true; - return; - break; case '\24': // ^T => mode tandy funct = true; key = '\11'; -- cgit v1.2.3 From 78b3939168a3b77e7087c2844fe10e94a6402d74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Mar 2012 22:25:28 +0100 Subject: MORTEVIELLE: Fix regression due to uninitialized variable, move remaining global booleans --- engines/mortevielle/actions.cpp | 44 ++++++++++++++++++------------------ engines/mortevielle/mor2.cpp | 30 ++++++++++++------------- engines/mortevielle/mortevielle.cpp | 45 +++++++++++++++++++++++++++++-------- engines/mortevielle/mortevielle.h | 4 ++++ engines/mortevielle/ovd1.cpp | 10 ++++----- engines/mortevielle/ovd1.h | 6 ++--- engines/mortevielle/prog.cpp | 22 +++++++++--------- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 7 +----- engines/mortevielle/var_mor.h | 8 ------- 10 files changed, 98 insertions(+), 80 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index cabd0522dd..6733d24117 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -58,8 +58,8 @@ void fctMove() { ecr3(g_vm->getEngineString(S_GO_TO)); tfleche(); if (g_vm->_keyPressedEsc) - g_okdes = false; - if ((g_anyone) || (g_vm->_keyPressedEsc)) + g_vm->_okdes = false; + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(1); if (g_num == 0) @@ -224,7 +224,7 @@ void fctTake() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TAKE)); tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; if (g_caff == 3) { tcoord(2); @@ -325,7 +325,7 @@ void fctLift() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(3); if (g_num == 0) { @@ -362,7 +362,7 @@ void fctRead() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_READ)); tfleche(); - if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(4); if (g_num != 0) g_crep = 107; @@ -395,7 +395,7 @@ void fctLook() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LOOK)); tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(5); if (g_num == 0) { @@ -486,7 +486,7 @@ void fctSearch() { ecr3(g_vm->getEngineString(S_SEARCH)); tfleche(); - if (g_anyone || g_vm->_keyPressedEsc) + if (g_vm->_anyone || g_vm->_keyPressedEsc) return; if (g_s._currPlace == 23) { @@ -597,7 +597,7 @@ void fctOpen() { } tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); @@ -653,7 +653,7 @@ void fctPlace() { if (g_vm->_keyPressedEsc) g_crep = 998; - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(8); @@ -782,7 +782,7 @@ void fctTurn() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TURN)); tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(9); if (g_num != 0) { @@ -818,7 +818,7 @@ void fctSelfHide() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); - if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(10); if (g_num == 0) g_vm->_hiddenHero = false; @@ -840,7 +840,7 @@ void fctAttach() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_TIE)); tfleche(); - if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { tcoord(8); g_crep = 997; if ((g_num != 0) && (g_s._currPlace == WELL)) { @@ -868,7 +868,7 @@ void fctClose() { tfleche(); if (g_vm->_keyPressedEsc) g_crep = 998; - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); if (g_num != 0) { @@ -913,7 +913,7 @@ void fctKnock() { if (g_s._currPlace < DOOR) { tfleche(); - if (!(g_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) g_crep = 133; else @@ -964,7 +964,7 @@ void fctSelfPut() { return; } tfleche(); - if ((g_anyone) || (g_vm->_keyPressedEsc)) + if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) return; tcoord(7); g_crep = 124; @@ -1219,7 +1219,7 @@ void fctSleep() { h = 0; tinke(); answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); - g_anyone = false; + g_vm->_anyone = false; } while (answer != 1); g_crep = 998; g_num = 0; @@ -1235,7 +1235,7 @@ void fctForce() { if (g_caff < 25) tfleche(); - if ((!g_anyone) && (!g_vm->_keyPressedEsc)) { + if ((!g_vm->_anyone) && (!g_vm->_keyPressedEsc)) { if (g_s._currPlace != 26) g_crep = 997; else { @@ -1300,9 +1300,9 @@ void fctWait() { if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) cavegre(); if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) - g_anyone = true; + g_vm->_anyone = true; g_mpers = g_ipers; - if (!g_anyone) + if (!g_vm->_anyone) tinke(); return; } @@ -1310,7 +1310,7 @@ void fctWait() { answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); } while (answer != 2); g_crep = 998; - if (!g_anyone) + if (!g_vm->_anyone) tinke(); } @@ -1323,7 +1323,7 @@ void fctSound() { ecr3(g_vm->getEngineString(S_PROBE2)); if (g_caff < 27) { tfleche(); - if (!(g_anyone) && (!g_vm->_keyPressedEsc)) + if (!(g_vm->_anyone) && (!g_vm->_keyPressedEsc)) g_crep = 145; g_num = 0; } @@ -1537,7 +1537,7 @@ void fctSmell() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); - if (!(g_anyone) && !(g_vm->_keyPressedEsc)) + if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) if (g_caff == 16) g_crep = 153; } else if (g_caff == 123) diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index bf62fe3857..e6abc8e915 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -49,7 +49,7 @@ void tinke() { int cx, cf, day, hour, minute; Common::String stpo; - g_anyone = false; + g_vm->_anyone = false; updateHour(day, hour, minute); if (day != g_day) { g_day = day; @@ -161,8 +161,8 @@ void tinke() { cavegre(); } else if (g_ipers == 10) { g_ipers = 0; - if (!g_brt) { - g_brt = true; + if (!g_vm->_brt) { + g_vm->_brt = true; g_hdb = readclock(); if (getRandomNumber(1, 5) < 5) { clsf3(); @@ -181,12 +181,12 @@ void tinke() { } } g_hfb = readclock(); - if ((g_brt) && ((g_hfb - g_hdb) > 17)) { + if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { cx = nouvp(g_li); - g_brt = false; + g_vm->_brt = false; g_hdb = 0; if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) - g_anyone = true; + g_vm->_anyone = true; } } @@ -211,7 +211,7 @@ void fenat(char ans) { void afdes(int ad) { taffich(); dessin(ad); - g_okdes = false; + g_vm->_okdes = false; } void tkey1(bool d) { @@ -236,7 +236,7 @@ void tkey1(bool d) { quest = keypressed(); getMousePos(x, y, c); CHECK_QUIT; - } while (!(quest || (c != 0) || (d && g_anyone))); + } while (!(quest || (c != 0) || (d && g_vm->_anyone))); if (quest) testou(); g_vm->setMouseClick(false); @@ -312,7 +312,7 @@ void tperd() { clsf3(); g_vm->_col = false; g_vm->_syn = false; - g_okdes = false; + g_vm->_okdes = false; } void tsort() { @@ -532,7 +532,7 @@ void t1neig() { g_crep = 1506; tperd(); } else { - g_okdes = true; + g_vm->_okdes = true; g_s._currPlace = MOUNTAIN; affrep(); } @@ -645,7 +645,7 @@ void tfleche() { return; fenat(chr(152)); - g_rect = false; + bool inRect = false; do { touch = '\0'; @@ -654,18 +654,18 @@ void tfleche() { CHECK_QUIT; if (g_vm->getMouseClick()) - g_rect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); + inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); tinke(); - } while (!(qust || g_rect || g_anyone)); + } while (!(qust || inRect || g_vm->_anyone)); if (qust && (touch == '\103')) Alert::show(g_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_anyone) || (g_rect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); if (touch == '\73') g_vm->_keyPressedEsc = true; - if (g_rect) { + if (inRect) { g_x = x_s; g_y = y_s; } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 38b2343c26..01ef472084 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -58,6 +58,33 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _mouseClick = false; _inMainGameLoop = false; _quitGame = false; + + _roomPresenceLuc = false; + _roomPresenceIda = false; + _purpleRoomPresenceLeo = false; + _roomPresenceGuy = false; + _roomPresenceEva = false; + _roomPresenceMax = false; + _roomPresenceBob = false; + _roomPresencePat = false; + _toiletsPresenceBobMax = false; + _bathRoomPresenceBobMax = false; + _room9PresenceLeo = false; + + _soundOff = false; + _largestClearScreen = false; + _hiddenHero = false; + _heroSearching = false; + _keyPressedEsc = false; + _reloadCFIEC = false; + + _blo = false; + _col = false; + _syn = false; + _obpart = false; + _okdes = false; + _anyone = false; + _brt = false; } MortevielleEngine::~MortevielleEngine() { @@ -145,8 +172,8 @@ Common::ErrorCode MortevielleEngine::initialise() { g_currGraphicalDevice = MODE_EGA; g_newGraphicalDevice = g_currGraphicalDevice; charpal(); - charge_cfiph(); - charge_cfiec(); + loadCFIPH(); + loadCFIEC(); zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); g_c_zzz = 1; init_nbrepm(); @@ -498,13 +525,13 @@ void MortevielleEngine::showIntroduction() { * loses, and chooses to start playing the game again. */ void MortevielleEngine::mainGame() { - if (g_rech_cfiec) - charge_cfiec(); + if (_reloadCFIEC) + loadCFIEC(); for (g_crep = 1; g_crep <= g_c_zzz; ++g_crep) zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - charge_bruit5(); + loadBRUIT5(); _menu.initMenu(); theure(); @@ -567,7 +594,7 @@ void MortevielleEngine::handleAction() { moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; - } while (!((g_vm->_menu._menuSelected) || (temps > lim) || (funct) || (g_anyone))); + } while (!((g_vm->_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; g_vm->_menu.eraseMenu(); @@ -611,7 +638,7 @@ void MortevielleEngine::handleAction() { g_mnumo = g_msg[3]; if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) g_mnumo = g_msg[4]; - if (!g_anyone) { + if (!_anyone) { if ((g_vm->_heroSearching) || (_obpart)) { if (y_s < 12) return; @@ -634,8 +661,8 @@ void MortevielleEngine::handleAction() { if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); - if (g_okdes) { - g_okdes = false; + if (g_vm->_okdes) { + g_vm->_okdes = false; dessin(0); } if ((!g_vm->_syn) || (_col)) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 69446ae8b9..5a8c0f911a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -119,11 +119,15 @@ public: bool _hiddenHero; bool _heroSearching; bool _keyPressedEsc; + bool _reloadCFIEC; bool _blo; bool _col; bool _syn; bool _obpart; + bool _okdes; + bool _anyone; + bool _brt; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 8641a18501..374a5f75df 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -167,7 +167,7 @@ void music() { if (g_vm->_soundOff) return; - g_rech_cfiec = true; + g_vm->_reloadCFIEC = true; if (!fic.open("mort.img")) error("Missing file - mort.img"); @@ -193,7 +193,7 @@ void music() { } -void charge_bruit5() { +void loadBRUIT5() { Common::File f; if (!f.open("bruit5")) @@ -203,7 +203,7 @@ void charge_bruit5() { f.close(); } -void charge_cfiec() { +void loadCFIEC() { Common::File f; if (!f.open("cfiec.mor")) @@ -212,11 +212,11 @@ void charge_cfiec() { f.read(&g_adcfiec[0], 822 * 128); f.close(); - g_rech_cfiec = false; + g_vm->_reloadCFIEC = false; } -void charge_cfiph() { +void loadCFIPH() { Common::File f; if (!f.open("cfiph.mor")) diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index 25633a4111..ef9f401232 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -35,9 +35,9 @@ extern void chartex(); extern void dialpre(); extern void init_lieu(); extern void music(); -extern void charge_bruit5(); -extern void charge_cfiec(); -extern void charge_cfiph(); +extern void loadBRUIT5(); +extern void loadCFIEC(); +extern void loadCFIPH(); extern void suite(); } // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index eb6b979368..95e8c011d7 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -72,11 +72,11 @@ void MortevielleEngine::gameLoaded() { hideMouse(); _menu._menuDisplayed = false; _loseGame = true; - g_anyone = false; - g_okdes = true; + _anyone = false; + _okdes = true; _col = false; _hiddenHero = false; - g_brt = false; + _brt = false; g_maff = 68; g_mnumo = 0; g_prebru = 0; @@ -88,8 +88,8 @@ void MortevielleEngine::gameLoaded() { g_cs = 0; g_is = 0; g_ment = 0; - g_vm->_syn = true; - g_vm->_heroSearching = true; + _syn = true; + _heroSearching = true; g_mchai = 0; g_inei = 0; initouv(); @@ -98,10 +98,10 @@ void MortevielleEngine::gameLoaded() { affrep(); g_hintPctMessage = deline(580); - g_okdes = false; + _okdes = false; _endGame = true; _loseGame = false; - g_vm->_heroSearching = false; + _heroSearching = false; displayAloneText(); tinke(); @@ -136,8 +136,8 @@ void tsitu() { clearScreenType2(); g_vm->_syn = false; g_vm->_keyPressedEsc = false; - if (!g_anyone) { - if (g_brt) + if (!g_vm->_anyone) { + if (g_vm->_brt) if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { g_ctrm = 4; mennor(); @@ -204,9 +204,9 @@ void tsitu() { if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { - if (g_anyone) { + if (g_vm->_anyone) { quelquun(); - g_anyone = false; + g_vm->_anyone = false; mennor(); return; } diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 6fe9f61b60..5bb172f527 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -148,7 +148,7 @@ void taffich() { break; } - g_okdes = true; + g_vm->_okdes = true; hideMouse(); lgt = 0; Common::String filename; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 2903abfc43..14f440fff8 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -78,12 +78,7 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool g_okdes, - g_arret, - g_anyone, - g_brt, - g_rect, - g_rech_cfiec; +bool g_rech_cfiec; int g_x, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 0402cd6d48..cf7d6084e1 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -223,14 +223,6 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -extern bool - g_okdes, - g_anyone, - g_brt, - g_rect, - g_rech_cfiec; - - extern int g_x, g_y, g_t, -- cgit v1.2.3 From 60730190832def71a6f36eec5f86ade96a705709 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Mar 2012 08:21:09 +0100 Subject: MORTEVIELLE: Move some more globals, get rid of some others --- engines/mortevielle/dialogs.cpp | 4 ++-- engines/mortevielle/keyboard.cpp | 4 ++-- engines/mortevielle/level15.cpp | 8 ++++---- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/mor.cpp | 25 ++++++++++++++----------- engines/mortevielle/mor.h | 2 +- engines/mortevielle/mor2.cpp | 4 ++-- engines/mortevielle/mortevielle.cpp | 23 +++++++++++++++-------- engines/mortevielle/mortevielle.h | 6 ++++++ engines/mortevielle/mouse.cpp | 4 ++-- engines/mortevielle/ovd1.cpp | 14 +++++--------- engines/mortevielle/parole.cpp | 6 +++--- engines/mortevielle/parole.h | 2 +- engines/mortevielle/parole2.cpp | 23 +++++++++-------------- engines/mortevielle/prog.cpp | 2 +- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.cpp | 14 +------------- engines/mortevielle/var_mor.h | 11 +---------- 18 files changed, 71 insertions(+), 85 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index c4b476c73e..754e0141c3 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -430,8 +430,8 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { waitForF3F8(g_key); CHECK_QUIT; - if (g_newGraphicalDevice != g_currGraphicalDevice) { - g_currGraphicalDevice = g_newGraphicalDevice; + if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { + g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; hirs(); aff50(drawAni50Fl); } diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index f28e309f66..faf47192a7 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -46,9 +46,9 @@ int testou() { g_vm->_soundOff = !g_vm->_soundOff; break; case '\26' : - if ((g_c_zzz == 1) || (g_c_zzz == 2)) { + if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) { zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - ++g_c_zzz; + ++g_vm->_c_zzz; return 61; } diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp index 444a810b0e..17f4943d75 100644 --- a/engines/mortevielle/level15.cpp +++ b/engines/mortevielle/level15.cpp @@ -71,7 +71,7 @@ void outbloc(int n, pattern p, nhom *pal) { } void writepal(int n) { - switch (g_currGraphicalDevice) { + switch (g_vm->_currGraphicalDevice) { case MODE_TANDY: case MODE_EGA: case MODE_AMSTRAD1512: @@ -104,7 +104,7 @@ void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&g_mem[seg * 16 + dep]); - if (g_currGraphicalDevice == MODE_HERCULES) { + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 2] = 0; g_mem[0x7000 * 16 + 32] = 15; } @@ -117,13 +117,13 @@ void pictout(int seg, int dep, int x, int y) { void sauvecr(int y, int dy) { hideMouse(); - s_sauv(g_currGraphicalDevice, y, dy); + s_sauv(g_vm->_currGraphicalDevice, y, dy); showMouse(); } void charecr(int y, int dy) { hideMouse(); - s_char(g_currGraphicalDevice, y, dy); + s_char(g_vm->_currGraphicalDevice, y, dy); showMouse(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9a0bcec2de..22bf269b56 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -151,7 +151,7 @@ void Menu::displayMenu() { g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * g_res; - if (g_currGraphicalDevice == MODE_CGA) + if (g_vm->_currGraphicalDevice == MODE_CGA) color = 1; else color = 9; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e3bc5243f9..c8b5b7e39a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -114,7 +114,7 @@ void dessine(int ad, int x, int y) { void dessine_rouleau() { writepal(89); - if (g_currGraphicalDevice == MODE_HERCULES) { + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; } hideMouse(); @@ -122,9 +122,12 @@ void dessine_rouleau() { showMouse(); } - -void text_color(int c) { - g_color_txt = c; +/** + * Set Text Color + * @remarks Originally called 'text_color' + */ +void setTextColor(int c) { + g_vm->_textColor = c; } /* NIVEAU 13 */ @@ -140,7 +143,7 @@ void text1(int x, int y, int nb, int m) { Common::String tmpStr = deline(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; - displayStr(tmpStr, x, y, nb, 20, g_color_txt); + displayStr(tmpStr, x, y, nb, 20, g_vm->_textColor); } void initouv() { @@ -178,7 +181,7 @@ void clearScreenType2() { } void ecrf2() { - text_color(5); + setTextColor(5); } void ecr2(Common::String str_) { @@ -219,12 +222,12 @@ void ecr3(Common::String text) { } void ecrf6() { - text_color(5); + setTextColor(5); g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15); } void ecrf7() { - text_color(4); + setTextColor(4); } void clsf10() { @@ -258,7 +261,7 @@ void clsf10() { void stop() { hirs(); - g_currGraphicalDevice = MODE_AMSTRAD1512; + g_vm->_currGraphicalDevice = MODE_AMSTRAD1512; hirs(); g_vm->quitGame(); } @@ -266,7 +269,7 @@ void stop() { void paint_rect(int x, int y, int dx, int dy) { int co; - if (g_currGraphicalDevice == MODE_CGA) + if (g_vm->_currGraphicalDevice == MODE_CGA) co = 3; else co = 11; @@ -656,7 +659,7 @@ void drawClock() { paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); - if ((g_currGraphicalDevice == MODE_CGA) || (g_currGraphicalDevice == MODE_HERCULES)) + if ((g_vm->_currGraphicalDevice == MODE_CGA) || (g_vm->_currGraphicalDevice == MODE_HERCULES)) co = 0; else co = 1; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 59555fb511..67c7bdd9a8 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -38,7 +38,7 @@ extern int readclock(); extern void modif(int &nu); extern void dessine(int ad, int x, int y); extern void dessine_rouleau(); -extern void text_color(int c); +extern void setTextColor(int c); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); extern void initouv(); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index e6abc8e915..380959e3c3 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -194,9 +194,9 @@ void fenat(char ans) { int coul; hideMouse(); - if (g_currGraphicalDevice == MODE_CGA) + if (g_vm->_currGraphicalDevice == MODE_CGA) coul = 2; - else if (g_currGraphicalDevice == MODE_HERCULES) + else if (g_vm->_currGraphicalDevice == MODE_HERCULES) coul = 1; else coul = 12; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 01ef472084..0e65ca2fdb 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -85,6 +85,13 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _okdes = false; _anyone = false; _brt = false; + + _textColor = 0; + _currGraphicalDevice = -1; + _newGraphicalDevice = -1; + + _c_zzz = -1; + } MortevielleEngine::~MortevielleEngine() { @@ -148,7 +155,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - g_currGraphicalDevice = MODE_EGA; + g_vm->_currGraphicalDevice = MODE_EGA; g_res = 2; _txxFileFl = false; @@ -169,13 +176,13 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - g_currGraphicalDevice = MODE_EGA; - g_newGraphicalDevice = g_currGraphicalDevice; + g_vm->_currGraphicalDevice = MODE_EGA; + g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice; charpal(); loadCFIPH(); loadCFIEC(); zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - g_c_zzz = 1; + g_vm->_c_zzz = 1; init_nbrepm(); initMouse(); @@ -185,10 +192,10 @@ Common::ErrorCode MortevielleEngine::initialise() { teskbd(); dialpre(); - g_newGraphicalDevice = g_currGraphicalDevice; + g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice; teskbd(); - if (g_newGraphicalDevice != g_currGraphicalDevice) - g_currGraphicalDevice = g_newGraphicalDevice; + if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) + g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; hirs(); g_ades = 0x7000; @@ -528,7 +535,7 @@ void MortevielleEngine::mainGame() { if (_reloadCFIEC) loadCFIEC(); - for (g_crep = 1; g_crep <= g_c_zzz; ++g_crep) + for (g_crep = 1; g_crep <= g_vm->_c_zzz; ++g_crep) zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 5a8c0f911a..0d1f5670ca 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -129,6 +129,12 @@ public: bool _anyone; bool _brt; + int _textColor; + int _currGraphicalDevice; + int _newGraphicalDevice; + + int _c_zzz; + int ptr_word; ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 8ae863523d..1240fa4165 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -86,7 +86,7 @@ void hideMouse() { if (mouse_shwn == 0) { bool imp = odd(y_s); int j = p_o_s; - switch (g_currGraphicalDevice) { + switch (g_vm->_currGraphicalDevice) { case MODE_CGA: { int k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); @@ -182,7 +182,7 @@ void showMouse() { int j = p_o_s; bool imp = odd(y_s); int i = x_s & 7; - switch (g_currGraphicalDevice) { + switch (g_vm->_currGraphicalDevice) { case MODE_CGA: k = 0; j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 374a5f75df..14b3e3eba8 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -159,16 +159,12 @@ void init_lieu() { void music() { - Common::File fic; - int k; - bool fin; - - /* debug('o3 music'); */ if (g_vm->_soundOff) return; g_vm->_reloadCFIEC = true; + Common::File fic; if (!fic.open("mort.img")) error("Missing file - mort.img"); @@ -180,8 +176,8 @@ void music() { g_addfix = (float)((kTempoMusic - g_addv[1])) / 256; cctable(g_tbi); - fin = false; - k = 0; + bool fin = false; + int k = 0; do { fin = keypressed(); g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic); @@ -234,8 +230,8 @@ void suite() { g_caff = 51; taffich(); teskbd(); - if (g_newGraphicalDevice != g_currGraphicalDevice) - g_currGraphicalDevice = g_newGraphicalDevice; + if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) + g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; hirs(); dessine(g_ades, 0, 0); diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp index 8974b45977..b2266dc8ff 100644 --- a/engines/mortevielle/parole.cpp +++ b/engines/mortevielle/parole.cpp @@ -44,10 +44,10 @@ void spfrac(int wor) { g_c3._acc = ((uint)wor >> 9) & 7; } -void charg_car() { +void charg_car(int &currWordNumb) { int wor, int_; - wor = swap(READ_LE_UINT16(&g_mem[adword + g_ptr_word])); + wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { @@ -82,7 +82,7 @@ void charg_car() { } spfrac(wor); - g_ptr_word += 2; + currWordNumb += 2; } diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h index 4168187a24..46d55abab0 100644 --- a/engines/mortevielle/parole.h +++ b/engines/mortevielle/parole.h @@ -34,7 +34,7 @@ namespace Mortevielle { extern void spfrac(int wor); -extern void charg_car(); +extern void charg_car(int &currWordNumb); extern void entroct(byte o); extern void veracf(byte b); extern void cctable(tablint &t); diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp index e08cbeb475..950f2940bc 100644 --- a/engines/mortevielle/parole2.cpp +++ b/engines/mortevielle/parole2.cpp @@ -54,27 +54,22 @@ void init_chariot() { void trait_ph() { const int deca[3] = {300, 30, 40}; - g_ptr_tcph = g_num_ph - 1; - g_ledeb = swap(g_t_cph[g_ptr_tcph]) + deca[g_typlec]; - g_lefin = swap(g_t_cph[g_ptr_tcph + 1]) + deca[g_typlec]; - g_nb_word = g_lefin - g_ledeb; - g_ptr_tcph = (uint)g_ledeb >> 1; - g_ptr_word = 0; - do { - WRITE_LE_UINT16(&g_mem[adword + g_ptr_word], g_t_cph[g_ptr_tcph]); - g_ptr_word += 2; - ++g_ptr_tcph; - } while (g_ptr_tcph < (int)((uint)g_lefin >> 1)); + int ptr_tcph = g_num_ph - 1; + int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; + int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; + int wordCount = endPos - startPos; + for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) + WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); g_ptr_oct = 0; - g_ptr_word = 0; + int currWord = 0; init_chariot(); do { rot_chariot(); - charg_car(); + charg_car(currWord); trait_car(); - } while (g_ptr_word < g_nb_word); + } while (currWord < wordCount); rot_chariot(); trait_car(); diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 95e8c011d7..b56aba64e8 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -45,7 +45,7 @@ namespace Mortevielle { */ void changeGraphicalDevice(int newDevice) { hideMouse(); - g_currGraphicalDevice = newDevice; + g_vm->_currGraphicalDevice = newDevice; hirs(); initMouse(); showMouse(); diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 5bb172f527..a65cecd8a8 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -212,7 +212,7 @@ void taffich() { npal = a + 37; } chardes(filename, lgt, handle); - if (g_currGraphicalDevice == MODE_HERCULES) { + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 14f440fff8..62f983458f 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -78,9 +78,6 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ -bool g_rech_cfiec; - - int g_x, g_y, g_t, @@ -91,7 +88,6 @@ int g_x, g_jh, g_mh, g_cs, - g_currGraphicalDevice, g_hdb, g_hfb, g_hour, @@ -113,13 +109,9 @@ int g_x, g_msg3, g_msg4, g_mlec, - g_newGraphicalDevice, - g_c_zzz, g_mchai, g_menup, g_ipers, - g_ledeb, - g_lefin, g_mpers, g_mnumo, g_xprec, @@ -129,12 +121,8 @@ int g_x, g_typlec, g_num_ph, g_numpal, - g_nb_word, g_ptr_oct, - g_k_tempo, - g_ptr_tcph, - g_ptr_word, - g_color_txt; + g_k_tempo; int g_t_cph[6401]; byte g_tabdon[4001]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index cf7d6084e1..50c73974d8 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -233,7 +233,6 @@ extern int g_x, g_jh, g_mh, g_cs, - g_currGraphicalDevice, g_hdb, g_hfb, g_hour, @@ -255,13 +254,9 @@ extern int g_x, g_msg3, g_msg4, g_mlec, - g_newGraphicalDevice, - g_c_zzz, g_mchai, g_menup, g_ipers, - g_ledeb, - g_lefin, g_mpers, g_mnumo, g_xprec, @@ -271,12 +266,8 @@ extern int g_x, g_typlec, g_num_ph, g_numpal, - g_nb_word, g_ptr_oct, - g_k_tempo, - g_ptr_tcph, - g_ptr_word, - g_color_txt; + g_k_tempo; extern int g_t_cph[6401]; extern byte g_tabdon[4001]; -- cgit v1.2.3 From 79dd91803338380c62a6a1aa2ba3dd0690e565be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Mar 2012 09:46:51 +0100 Subject: MORTEVIELLE: regroup several files --- engines/mortevielle/actions.cpp | 5 +- engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/level15.cpp | 166 ------- engines/mortevielle/level15.h | 47 -- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/module.mk | 6 +- engines/mortevielle/mor.cpp | 916 +++++++++++++++++++++++++++++++++++- engines/mortevielle/mor.h | 62 ++- engines/mortevielle/mor2.cpp | 821 -------------------------------- engines/mortevielle/mor2.h | 87 ---- engines/mortevielle/mortevielle.cpp | 5 +- engines/mortevielle/outtext.cpp | 226 ++++++++- engines/mortevielle/outtext.h | 5 + engines/mortevielle/ovd1.cpp | 7 +- engines/mortevielle/parole.cpp | 454 ------------------ engines/mortevielle/parole.h | 48 -- engines/mortevielle/parole2.cpp | 124 ----- engines/mortevielle/parole2.h | 40 -- engines/mortevielle/prog.cpp | 2 - engines/mortevielle/saveload.cpp | 1 - engines/mortevielle/speech.cpp | 543 +++++++++++++++++++++ engines/mortevielle/speech.h | 53 +++ engines/mortevielle/taffich.cpp | 261 ---------- engines/mortevielle/taffich.h | 41 -- 24 files changed, 1799 insertions(+), 2127 deletions(-) delete mode 100644 engines/mortevielle/level15.cpp delete mode 100644 engines/mortevielle/level15.h delete mode 100644 engines/mortevielle/mor2.cpp delete mode 100644 engines/mortevielle/mor2.h delete mode 100644 engines/mortevielle/parole.cpp delete mode 100644 engines/mortevielle/parole.h delete mode 100644 engines/mortevielle/parole2.cpp delete mode 100644 engines/mortevielle/parole2.h create mode 100644 engines/mortevielle/speech.cpp create mode 100644 engines/mortevielle/speech.h delete mode 100644 engines/mortevielle/taffich.cpp delete mode 100644 engines/mortevielle/taffich.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6733d24117..5f511fc7ee 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -28,15 +28,12 @@ #include "common/scummsys.h" #include "mortevielle/actions.h" #include "mortevielle/dialogs.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" +#include "mortevielle/speech.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 754e0141c3..b37e0a53c5 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -28,13 +28,11 @@ #include "common/str.h" #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" +#include "mortevielle/speech.h" namespace Mortevielle { diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp deleted file mode 100644 index 17f4943d75..0000000000 --- a/engines/mortevielle/level15.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/system.h" -#include "common/file.h" -#include "mortevielle/graphics.h" -#include "mortevielle/level15.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/* NIVEAU 15 */ -void copcha() { - int i = acha; - do { - g_tabdon[i] = g_tabdon[i + 390]; - ++i; - } while (i != acha + 390); -} - -/** - * Engine function : Is mouse in a given rect? - * @remarks Originally called 'dans_rect' - */ -bool isMouseIn(rectangle r) { - int x, y, c; - - getMousePos(x, y, c); - if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) - return true; - - return false; -} - -void outbloc(int n, pattern p, nhom *pal) { - int ad = n * 404 + 0xd700; - - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); - ad += 4; - for (int i = 1; i <= p._tax; ++i) { - for (int j = 1; j <= p._tay; ++j) - g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; - } -} - -void writepal(int n) { - switch (g_vm->_currGraphicalDevice) { - case MODE_TANDY: - case MODE_EGA: - case MODE_AMSTRAD1512: - for (int i = 1; i <= 16; ++i) { - g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; - g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; - } - break; - case MODE_CGA: { - warning("TODO: If this code is needed, resolve the incompatible types"); - nhom pal[16]; - for (int i = 0; i < 16; ++i) { - pal[i] = g_palcga[n]._a[i]; - } -// nhom pal[16] = palcga[n]._a; - if (n < 89) - palette(g_palcga[n]._p); - - for (int i = 0; i <= 15; ++i) - outbloc(i, g_tpt[pal[i]._id], pal); - } - break; - default: - break; - } -} - - -void pictout(int seg, int dep, int x, int y) { - GfxSurface surface; - surface.decode(&g_mem[seg * 16 + dep]); - - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - g_mem[0x7000 * 16 + 2] = 0; - g_mem[0x7000 * 16 + 32] = 15; - } - - if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); - - g_vm->_screenSurface.drawPicture(surface, x, y); -} - -void sauvecr(int y, int dy) { - hideMouse(); - s_sauv(g_vm->_currGraphicalDevice, y, dy); - showMouse(); -} - -void charecr(int y, int dy) { - hideMouse(); - s_char(g_vm->_currGraphicalDevice, y, dy); - showMouse(); -} - -void adzon() { - Common::File f; - - if (!f.open("don.mor")) - error("Missing file - don.mor"); - - f.read(g_tabdon, 7 * 256); - f.close(); - - if (!f.open("bmor.mor")) - error("Missing file - bmor.mor"); - - f.read(&g_tabdon[fleche], 1 * 1916); - f.close(); - - if (!f.open("dec.mor")) - error("Missing file - dec.mor"); - - f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); - f.close(); -} - -/** - * Returns the offset within the compressed image data resource of the desired image - */ -int animof(int ouf, int num) { - int nani = g_mem[adani * 16 + 1]; - int aux = num; - if (ouf != 1) - aux += nani; - - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); - - return animof_result; -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/level15.h b/engines/mortevielle/level15.h deleted file mode 100644 index 2d7c0d47ae..0000000000 --- a/engines/mortevielle/level15.h +++ /dev/null @@ -1,47 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_LEVEL15_H -#define MORTEVIELLE_LEVEL15_H - -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/* NIVEAU 15 */ -extern void copcha(); -extern bool isMouseIn(rectangle r); -extern void outbloc(int n, pattern p, nhom *pal); -extern void writepal(int n); -extern void pictout(int seg, int dep, int x, int y); -extern void sauvecr(int y, int dy); -extern void charecr(int y, int dy); -extern void adzon(); -extern int animof(int ouf, int num); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 22bf269b56..6604b1bee5 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -28,8 +28,8 @@ #include "common/scummsys.h" #include "common/str.h" #include "common/textconsole.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" +#include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 16f56bc5b0..103a4fcd4e 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -7,20 +7,16 @@ MODULE_OBJS := \ dialogs.o \ graphics.o \ keyboard.o \ - level15.o \ menu.o \ mor.o \ - mor2.o \ mortevielle.o \ mouse.o \ outtext.o \ ovd1.o \ - parole.o \ - parole2.o \ prog.o \ saveload.o \ sound.o \ - taffich.o \ + speech.o \ var_mor.o # This module can be built as a plugin diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index c8b5b7e39a..7c92d9aab0 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -26,31 +26,150 @@ */ #include "common/endian.h" +#include "common/file.h" #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" #include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" +#include "mortevielle/speech.h" #include "mortevielle/var_mor.h" +#include "mortevielle/keyboard.h" + namespace Mortevielle { -// For ScummVM, we need to do check for file errors where we do the file access -const int ioresult = 0; +/* NIVEAU 15 */ +void copcha() { + int i = acha; + do { + g_tabdon[i] = g_tabdon[i + 390]; + ++i; + } while (i != acha + 390); +} + +/** + * Engine function : Is mouse in a given rect? + * @remarks Originally called 'dans_rect' + */ +bool isMouseIn(rectangle r) { + int x, y, c; + + getMousePos(x, y, c); + if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) + return true; + + return false; +} + +void outbloc(int n, pattern p, nhom *pal) { + int ad = n * 404 + 0xd700; + + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); + ad += 4; + for (int i = 1; i <= p._tax; ++i) { + for (int j = 1; j <= p._tay; ++j) + g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; + } +} + +void writepal(int n) { + switch (g_vm->_currGraphicalDevice) { + case MODE_TANDY: + case MODE_EGA: + case MODE_AMSTRAD1512: + for (int i = 1; i <= 16; ++i) { + g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; + g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; + } + break; + case MODE_CGA: { + warning("TODO: If this code is needed, resolve the incompatible types"); + nhom pal[16]; + for (int i = 0; i < 16; ++i) { + pal[i] = g_palcga[n]._a[i]; + } +// nhom pal[16] = palcga[n]._a; + if (n < 89) + palette(g_palcga[n]._p); + + for (int i = 0; i <= 15; ++i) + outbloc(i, g_tpt[pal[i]._id], pal); + } + break; + default: + break; + } +} + -void testfi() { - if (ioresult != 0) { - // Theoritical message - warning("IO Error"); - g_vm->quitGame(); +void pictout(int seg, int dep, int x, int y) { + GfxSurface surface; + surface.decode(&g_mem[seg * 16 + dep]); + + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + g_mem[0x7000 * 16 + 2] = 0; + g_mem[0x7000 * 16 + 32] = 15; } + + if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); + + g_vm->_screenSurface.drawPicture(surface, x, y); +} + +void sauvecr(int y, int dy) { + hideMouse(); + s_sauv(g_vm->_currGraphicalDevice, y, dy); + showMouse(); +} + +void charecr(int y, int dy) { + hideMouse(); + s_char(g_vm->_currGraphicalDevice, y, dy); + showMouse(); +} + +void adzon() { + Common::File f; + + if (!f.open("don.mor")) + error("Missing file - don.mor"); + + f.read(g_tabdon, 7 * 256); + f.close(); + + if (!f.open("bmor.mor")) + error("Missing file - bmor.mor"); + + f.read(&g_tabdon[fleche], 1 * 1916); + f.close(); + + if (!f.open("dec.mor")) + error("Missing file - dec.mor"); + + f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); + f.close(); +} + +/** + * Returns the offset within the compressed image data resource of the desired image + */ +int animof(int ouf, int num) { + int nani = g_mem[adani * 16 + 1]; + int aux = num; + if (ouf != 1) + aux += nani; + + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); + + return animof_result; } /** @@ -1527,4 +1646,783 @@ void dessin(int ad) { } } +void tinke() { + Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); + const char d3 = '['; + const char d4 = ']'; + const char d5 = '1'; + Common::String d6 = g_vm->getEngineString(S_OK); + int cx, cf, day, hour, minute; + Common::String stpo; + + g_vm->_anyone = false; + updateHour(day, hour, minute); + if (day != g_day) { + g_day = day; + cx = 0; + do { + ++cx; + if (g_nbrepm[cx] != 0) + --g_nbrepm[cx]; + g_nbrep[cx] = 0; + } while (cx != 8); + } + if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { + g_hour = hour; + g_minute = 0; + drawClock(); + cf = 0; + for (cx = 1; cx <= 10; ++cx) { + if (g_s._pourc[cx] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); + + g_hintPctMessage = Common::String(d3); + g_hintPctMessage += d5; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d1; + g_hintPctMessage += stpo; + g_hintPctMessage += '0'; + g_hintPctMessage += d2; + g_hintPctMessage += d4; + g_hintPctMessage += d3; + g_hintPctMessage += d6; + g_hintPctMessage += d4; + } + if (minute > g_minute) { + g_minute = 30; + drawClock(); + } + if (y_s < 12) + return; + + if (!g_vm->_blo) { + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) + g_t = kTime2; + else + g_t = kTime1; + cf = g_s._faithScore; + if ((cf > 33) && (cf < 66)) + g_t -= (g_t / 3); + + if (cf > 65) + g_t -= ((g_t / 3) * 2); + + int nh = readclock(); + if ((nh - g_mh) > g_t) { + bool activeMenu = g_vm->_menu._menuActive; + g_vm->_menu.eraseMenu(); + g_jh += ((nh - g_mh) / g_t); + g_mh = nh; + switch (g_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 ((g_mpers != 0) && (g_ipers != 10)) + g_mpers = g_ipers; + + if ((g_mpers == 0) && (g_ipers > 0)) { + if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { + cavegre(); + } else if (g_ipers == 10) { + g_ipers = 0; + if (!g_vm->_brt) { + g_vm->_brt = true; + g_hdb = readclock(); + if (getRandomNumber(1, 5) < 5) { + clsf3(); + ecrf2(); + ecr3(g_vm->getEngineString(S_HEAR_NOISE)); + int rand = (getRandomNumber(0, 4)) - 2; + startSpeech(1, rand, 1); + clsf3(); + } + } + } + } + + if (activeMenu) + g_vm->_menu.drawMenu(); + } + } + g_hfb = readclock(); + if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { + cx = nouvp(g_li); + g_vm->_brt = false; + g_hdb = 0; + if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) + g_vm->_anyone = true; + } +} + +void fenat(char ans) { + int coul; + + hideMouse(); + if (g_vm->_currGraphicalDevice == MODE_CGA) + coul = 2; + else if (g_vm->_currGraphicalDevice == MODE_HERCULES) + coul = 1; + else + coul = 12; + + g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); + showMouse(); +} + + +/* NIVEAU 8 */ +void afdes(int ad) { + taffich(); + dessin(ad); + g_vm->_okdes = false; +} + +void tkey1(bool d) { + bool quest; + int x, y, c; + + hideMouse(); + fenat('K'); + + // Wait for release from any key or mouse button + while (keypressed()) + g_key = testou(); + do { + getMousePos(x, y, c); + keypressed(); + } while (c != 0); + + // Event loop + do { + if (d) + tinke(); + quest = keypressed(); + getMousePos(x, y, c); + CHECK_QUIT; + } while (!(quest || (c != 0) || (d && g_vm->_anyone))); + if (quest) + testou(); + g_vm->setMouseClick(false); + showMouse(); +} + +void tmlieu(int roomId) { + Common::String nomp; + + if (roomId == 26) + roomId = 15; + + int i = 1; + while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { + nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); + while (nomp.size() < 20) + nomp += ' '; + g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); + ++i; + } + nomp = "* "; + for (int cx = 7; cx >= i; --cx) + g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); +} + + +/* NIVEAU 7 */ +void tlu(int af, int ob) { + g_caff = 32; + afdes(0); + repon(6, ob + 4000); + repon(2, 999); + tkey1(true); + g_caff = af; + g_msg[3] = OPCODE_NONE; + g_crep = 998; +} + +void affrep() { + g_caff = g_s._currPlace; + g_crep = g_s._currPlace; +} + +/** + * Engine function - Switch action menu from "Search" mode back to normal mode + * @remarks Originally called 'mfouen' + */ +void unsetSearchMenu() { + tmlieu(g_s._currPlace); + for (int cx = 1; cx <= 11; ++cx) + g_vm->_menu.enableMenuItem(_actionMenu[cx]); + + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); +} + +/* NIVEAU 6 */ + +void tperd() { + initouv(); + g_ment = 0; + g_iouv = 0; + g_mchai = 0; + unsetSearchMenu(); + if (!g_vm->_blo) + t11(21); + + g_vm->_loseGame = true; + clsf1(); + g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); + repon(9, g_crep); + clearScreenType2(); + clsf3(); + g_vm->_col = false; + g_vm->_syn = false; + g_vm->_okdes = false; +} + +void tsort() { + + if ((g_iouv > 0) && (g_s._currPlace != 0)) { + if (g_s._faithScore < 50) + g_s._faithScore += 2; + else + g_s._faithScore += (g_s._faithScore / 10); + } + + for (int cx = 1; cx <= 7; ++cx) + g_touv[cx] = chr(0); + g_ment = 0; + g_iouv = 0; + g_mchai = 0; + debloc(g_s._currPlace); +} + +void st4(int ob) { + g_crep = 997; + + switch (ob) { + case 114 : + g_crep = 109; + break; + case 110 : + g_crep = 107; + break; + case 158 : + g_crep = 113; + break; + case 152: + case 153: + case 154: + case 155: + case 156: + case 150: + case 100: + case 157: + case 160: + case 161 : + tlu(g_caff, ob); + break; + default: + break; + } +} + +void cherjer(int ob, bool &d) { + int cx; + + d = false; + for (cx = 1; cx <= 6; ++cx) + d = (d || (ord(g_s._sjer[cx]) == ob)); + + if (g_s._selectedObjectId == ob) + d = true; +} + +void st1sama() { + g_s._currPlace = DINING_ROOM; + affrep(); +} + +void modinv() { + int r; + Common::String nomp; + + int cy = 0; + for (int cx = 1; cx <= 6; ++cx) + if (g_s._sjer[cx] != chr(0)) { + ++cy; + r = (ord(g_s._sjer[cx]) + 400); + nomp = deline(r - 501 + kInventoryStringIndex); + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); + g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); + } + if (cy < 6) + for (int cx = cy + 1; cx <= 6; ++cx) { + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); + } +} + +void sparl(float adr, float rep) { + const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; + int key, repint; + + repint = abs((int)rep); + hideMouse(); + Common::String tmpStr = deline(repint + kDialogStringIndex); + displayStr(tmpStr, 230, 4, 65, 24, 5); + f3f8::draw(); + + key = 0; + do { + startSpeech(repint, haut[g_caff - 69], 0); + f3f8::waitForF3F8(key); + CHECK_QUIT; + } while (key != 66); + hirs(); + showMouse(); +} + +/** + * Engine function - End of Search: reset globals + * @remarks Originally called 'finfouill' + */ +void endSearch() { + g_vm->_heroSearching = false; + g_vm->_obpart = false; + g_cs = 0; + g_is = 0; + unsetSearchMenu(); +} + +/** + * Engine function - Switch action menu to "Search" mode + * @remarks Originally called 'mfoudi' + */ +void setSearchMenu() { + for (int cx = 1; cx <= 7; ++cx) + g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); + + for (int cx = 1; cx <= 11; ++cx) + g_vm->_menu.disableMenuItem(_actionMenu[cx]); + + g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); +} + +void mennor() { + g_vm->_menu.menuUp(g_msg[3]); +} + +void premtet() { + dessine(g_ades, 10, 80); + g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); +} + +/* NIVEAU 5 */ +void ajchai() { + int cy = acha + ((g_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); + + if (g_tabdon[cy + cx] == 0) + g_tabdon[cy + cx] = g_s._selectedObjectId; + else + g_crep = 192; +} + +void ajjer(int ob) { + int cx = 0; + do { + ++cx; + } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); + + if (ord(g_s._sjer[cx]) == 0) { + g_s._sjer[(cx)] = chr(ob); + modinv(); + } else + g_crep = 139; +} + +void t1sama() { //Entering manor + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour < 5) && (g_s._currPlace > 18)) { + bool d; + cherjer(137, d); + if (!d) { //You don't have the keys, and it's late + g_crep = 1511; + tperd(); + } else + st1sama(); + } else if (!g_s._ipre) { //Is it your first time? + g_ipers = 255; + showPeoplePresent(g_ipers); + g_caff = 77; + afdes(0); + g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); + repon(2, 33); + tkey1(false); + mennor(); + hideMouse(); + hirs(); + premtet(); + sparl(0, 140); + dessine_rouleau(); + drawClock(); + showMouse(); + g_s._currPlace = OWN_ROOM; + affrep(); + t5(10); + if (!g_vm->_blo) + minute = t11(0); + g_ipers = 0; + g_mpers = 0; + g_s._ipre = true; + } else + st1sama(); +} + +void t1vier() { + g_s._currPlace = SECRET_PASSAGE; + affrep(); +} + +void t1neig() { + ++g_inei; + if (g_inei > 2) { + g_crep = 1506; + tperd(); + } else { + g_vm->_okdes = true; + g_s._currPlace = MOUNTAIN; + affrep(); + } +} + +void t1deva() { + g_inei = 0; + g_s._currPlace = MANOR_FRONT; + affrep(); +} + +void t1derr() { + g_s._currPlace = MANOR_BACK; + affrep(); +} + +void t1deau() { + g_crep = 1503; + tperd(); +} + +void tctrm() { + repon(2, (3000 + g_ctrm)); + g_ctrm = 0; +} + + +void quelquun() { + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.eraseMenu(); + + endSearch(); + g_crep = 997; +L1: + if (!g_vm->_hiddenHero) { + if (g_crep == 997) + g_crep = 138; + repon(2, g_crep); + if (g_crep == 138) + startSpeech(5, 2, 1); + else + startSpeech(4, 4, 1); + + if (g_iouv == 0) + g_s._faithScore += 2; + else if (g_s._faithScore < 50) + g_s._faithScore += 4; + else + g_s._faithScore += 3 * (g_s._faithScore / 10); + tsort(); + tmlieu(15); + int cx = convertBitIndexToCharacterIndex(g_ipers); + g_caff = 69 + cx; + g_crep = g_caff; + g_msg[3] = MENU_DISCUSS; + g_msg[4] = g_vm->_menu._discussMenu[cx]; + g_vm->_syn = true; + g_vm->_col = true; + } else { + if (getRandomNumber(1, 3) == 2) { + g_vm->_hiddenHero = false; + g_crep = 137; + goto L1; + } else { + repon(2, 136); + int rand = (getRandomNumber(0, 4)) - 2; + startSpeech(3, rand, 1); + clearScreenType2(); + displayAloneText(); + debloc(21); + affrep(); + } + } + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.drawMenu(); +} + +void tsuiv() { + int tbcl; + int cl; + + int cy = acha + ((g_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + ++g_cs; + cl = cy + g_cs; + tbcl = g_tabdon[cl]; + } while ((tbcl == 0) && (g_cs <= 9)); + + if ((tbcl != 0) && (g_cs < 11)) { + ++g_is; + g_caff = tbcl; + g_crep = g_caff + 400; + if (g_ipers != 0) + g_s._faithScore += 2; + } else { + affrep(); + endSearch(); + if (cx > 9) + g_crep = 131; + } +} + +void tfleche() { + bool qust; + char touch; + + if (g_num == 9999) + return; + + fenat(chr(152)); + bool inRect = false; + do { + touch = '\0'; + + do { + moveMouse(qust, touch); + CHECK_QUIT; + + if (g_vm->getMouseClick()) + inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); + tinke(); + } while (!(qust || inRect || g_vm->_anyone)); + + if (qust && (touch == '\103')) + Alert::show(g_hintPctMessage, 1); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); + + if (touch == '\73') + g_vm->_keyPressedEsc = true; + + if (inRect) { + g_x = x_s; + g_y = y_s; + } +} + +void tcoord(int sx) { + int sy, ix, iy; + int ib; + + + g_num = 0; + g_crep = 999; + int a = 0; + int atdon = amzon + 3; + int cy = 0; + while (cy < g_caff) { + a += g_tabdon[atdon]; + atdon += 4; + ++cy; + } + + if (g_tabdon[atdon] == 0) { + g_crep = 997; + return; + } + + a += fleche; + int cb = 0; + for (cy = 0; cy <= (sx - 2); ++cy) { + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + cb += (ib * 4) + 2; + } + ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + if (ib == 0) { + g_crep = 997; + return; + } + + cy = 1; + do { + cb += 2; + sx = g_tabdon[a + cb] * g_res; + sy = g_tabdon[(a + cb + 1)]; + cb += 2; + ix = g_tabdon[a + cb] * g_res; + iy = g_tabdon[(a + cb + 1)]; + ++cy; + } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); + + if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { + g_num = cy - 1; + return; + } + + g_crep = 997; +} + + +void st7(int ob) { + switch (ob) { + case 116: + case 144: + g_crep = 104; + break; + case 126: + case 111: + g_crep = 108; + break; + case 132: + g_crep = 111; + break; + case 142: + g_crep = 112; + break; + default: + g_crep = 183; + st4(ob); + } +} + +void treg(int ob) { + int mdes = g_caff; + g_caff = ob; + + if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { + afdes(0); + if ((g_caff > 29) && (g_caff < 33)) + repon(2, g_caff); + else + repon(2, g_caff + 400); + tkey1(true); + g_caff = mdes; + g_msg[3] = 0; + g_crep = 998; + } else { + g_vm->_obpart = true; + g_crep = g_caff + 400; + setSearchMenu(); + } +} + +void avpoing(int &ob) { + g_crep = 999; + if (g_s._selectedObjectId != 0) + ajjer(g_s._selectedObjectId); + + if (g_crep != 139) { + modobj(ob + 400); + g_s._selectedObjectId = ob; + ob = 0; + } +} + +void rechai(int &ch) { + int tmpPlace = g_s._currPlace; + + if (g_s._currPlace == CRYPT) + tmpPlace = CELLAR; + ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; +} + +void t23coul(int &l) { + bool d; + + cherjer(143, d); + l = 14; + if (!d) { + g_crep = 1512; + tperd(); + } +} + +void maivid() { + g_s._selectedObjectId = 0; + modobj(500); +} + +void st13(int ob) { + if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || + (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || + (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || + (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || + (ob == 150) || (ob == 152)) + g_crep = 999; + else + g_crep = 105; +} + +void aldepl() { + Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 67c7bdd9a8..73f6df22b7 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -29,11 +29,21 @@ #define MORTEVIELLE_MOR_H #include "common/str.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { +/* NIVEAU 15 */ +extern void copcha(); +extern bool isMouseIn(rectangle r); +extern void outbloc(int n, pattern p, nhom *pal); +extern void writepal(int n); +extern void pictout(int seg, int dep, int x, int y); +extern void sauvecr(int y, int dy); +extern void charecr(int y, int dy); +extern void adzon(); +extern int animof(int ouf, int num); /* Niveau 14 suite */ -extern void testfi(); extern int readclock(); extern void modif(int &nu); extern void dessine(int ad, int x, int y); @@ -118,5 +128,55 @@ extern void musique(int so); /* NIVEAU 9 */ extern void dessin(int ad); +static const int _actionMenu[12] = { OPCODE_NONE, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + +extern void tinke(); +extern void fenat(char ans); +/* NIVEAU 8 */ +extern void afdes(int ad); +extern void tkey1(bool d); +extern void tmlieu(int roomId); +/* NIVEAU 7 */ +extern void tlu(int af, int ob); +extern void affrep(); +extern void unsetSearchMenu(); +/* NIVEAU 6 */ +extern void tperd(); +extern void tsort(); +extern void st4(int ob); +extern void cherjer(int ob, bool &d); +extern void st1sama(); +extern void modinv(); +extern void sparl(float adr, float rep); +extern void endSearch(); +extern void setSearchMenu(); +extern void mennor(); +extern void premtet(); +/* NIVEAU 5 */ +extern void ajchai(); +extern void ajjer(int ob); +extern void t1sama(); +extern void t1vier(); +extern void t1neig(); +extern void t1deva(); +extern void t1derr(); +extern void t1deau(); +extern void tctrm(); +extern void quelquun(); +extern void tsuiv(); +extern void tfleche(); +extern void tcoord(int sx); +extern void st7(int ob); +extern void treg(int ob); +extern void avpoing(int &ob); +extern void rechai(int &ch); +extern void t23coul(int &l); +extern void maivid(); +extern void st13(int ob); +extern void aldepl(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp deleted file mode 100644 index 380959e3c3..0000000000 --- a/engines/mortevielle/mor2.cpp +++ /dev/null @@ -1,821 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/mor2.h" -#include "mortevielle/dialogs.h" -#include "mortevielle/keyboard.h" -#include "mortevielle/menu.h" -#include "mortevielle/mor.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" -#include "mortevielle/parole2.h" -#include "mortevielle/taffich.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void tinke() { - Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); - const char d3 = '['; - const char d4 = ']'; - const char d5 = '1'; - Common::String d6 = g_vm->getEngineString(S_OK); - int cx, cf, day, hour, minute; - Common::String stpo; - - g_vm->_anyone = false; - updateHour(day, hour, minute); - if (day != g_day) { - g_day = day; - cx = 0; - do { - ++cx; - if (g_nbrepm[cx] != 0) - --g_nbrepm[cx]; - g_nbrep[cx] = 0; - } while (cx != 8); - } - if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { - g_hour = hour; - g_minute = 0; - drawClock(); - cf = 0; - for (cx = 1; cx <= 10; ++cx) { - if (g_s._pourc[cx] == '*') - ++cf; - } - - if (cf == 10) - stpo = "10"; - else - stpo = chr(cf + 48); - - g_hintPctMessage = Common::String(d3); - g_hintPctMessage += d5; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d1; - g_hintPctMessage += stpo; - g_hintPctMessage += '0'; - g_hintPctMessage += d2; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d6; - g_hintPctMessage += d4; - } - if (minute > g_minute) { - g_minute = 30; - drawClock(); - } - if (y_s < 12) - return; - - if (!g_vm->_blo) { - if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = kTime2; - else - g_t = kTime1; - cf = g_s._faithScore; - if ((cf > 33) && (cf < 66)) - g_t -= (g_t / 3); - - if (cf > 65) - g_t -= ((g_t / 3) * 2); - - int nh = readclock(); - if ((nh - g_mh) > g_t) { - bool activeMenu = g_vm->_menu._menuActive; - g_vm->_menu.eraseMenu(); - g_jh += ((nh - g_mh) / g_t); - g_mh = nh; - switch (g_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 ((g_mpers != 0) && (g_ipers != 10)) - g_mpers = g_ipers; - - if ((g_mpers == 0) && (g_ipers > 0)) { - if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { - cavegre(); - } else if (g_ipers == 10) { - g_ipers = 0; - if (!g_vm->_brt) { - g_vm->_brt = true; - g_hdb = readclock(); - if (getRandomNumber(1, 5) < 5) { - clsf3(); - ecrf2(); - ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(1, rand, 1); - clsf3(); - } - } - } - } - - if (activeMenu) - g_vm->_menu.drawMenu(); - } - } - g_hfb = readclock(); - if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - cx = nouvp(g_li); - g_vm->_brt = false; - g_hdb = 0; - if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) - g_vm->_anyone = true; - } -} - -void fenat(char ans) { - int coul; - - hideMouse(); - if (g_vm->_currGraphicalDevice == MODE_CGA) - coul = 2; - else if (g_vm->_currGraphicalDevice == MODE_HERCULES) - coul = 1; - else - coul = 12; - - g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - showMouse(); -} - - -/* NIVEAU 8 */ -void afdes(int ad) { - taffich(); - dessin(ad); - g_vm->_okdes = false; -} - -void tkey1(bool d) { - bool quest; - int x, y, c; - - hideMouse(); - fenat('K'); - - // Wait for release from any key or mouse button - while (keypressed()) - g_key = testou(); - do { - getMousePos(x, y, c); - keypressed(); - } while (c != 0); - - // Event loop - do { - if (d) - tinke(); - quest = keypressed(); - getMousePos(x, y, c); - CHECK_QUIT; - } while (!(quest || (c != 0) || (d && g_vm->_anyone))); - if (quest) - testou(); - g_vm->setMouseClick(false); - showMouse(); -} - -void tmlieu(int roomId) { - Common::String nomp; - - if (roomId == 26) - roomId = 15; - - int i = 1; - while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { - nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); - while (nomp.size() < 20) - nomp += ' '; - g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); - ++i; - } - nomp = "* "; - for (int cx = 7; cx >= i; --cx) - g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); -} - - -/* NIVEAU 7 */ -void tlu(int af, int ob) { - g_caff = 32; - afdes(0); - repon(6, ob + 4000); - repon(2, 999); - tkey1(true); - g_caff = af; - g_msg[3] = OPCODE_NONE; - g_crep = 998; -} - -void affrep() { - g_caff = g_s._currPlace; - g_crep = g_s._currPlace; -} - -/** - * Engine function - Switch action menu from "Search" mode back to normal mode - * @remarks Originally called 'mfouen' - */ -void unsetSearchMenu() { - tmlieu(g_s._currPlace); - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.enableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); -} - -/* NIVEAU 6 */ - -void tperd() { - initouv(); - g_ment = 0; - g_iouv = 0; - g_mchai = 0; - unsetSearchMenu(); - if (!g_vm->_blo) - t11(21); - - g_vm->_loseGame = true; - clsf1(); - g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, g_crep); - clearScreenType2(); - clsf3(); - g_vm->_col = false; - g_vm->_syn = false; - g_vm->_okdes = false; -} - -void tsort() { - - if ((g_iouv > 0) && (g_s._currPlace != 0)) { - if (g_s._faithScore < 50) - g_s._faithScore += 2; - else - g_s._faithScore += (g_s._faithScore / 10); - } - - for (int cx = 1; cx <= 7; ++cx) - g_touv[cx] = chr(0); - g_ment = 0; - g_iouv = 0; - g_mchai = 0; - debloc(g_s._currPlace); -} - -void st4(int ob) { - g_crep = 997; - - switch (ob) { - case 114 : - g_crep = 109; - break; - case 110 : - g_crep = 107; - break; - case 158 : - g_crep = 113; - break; - case 152: - case 153: - case 154: - case 155: - case 156: - case 150: - case 100: - case 157: - case 160: - case 161 : - tlu(g_caff, ob); - break; - default: - break; - } -} - -void cherjer(int ob, bool &d) { - int cx; - - d = false; - for (cx = 1; cx <= 6; ++cx) - d = (d || (ord(g_s._sjer[cx]) == ob)); - - if (g_s._selectedObjectId == ob) - d = true; -} - -void st1sama() { - g_s._currPlace = DINING_ROOM; - affrep(); -} - -void modinv() { - int r; - Common::String nomp; - - int cy = 0; - for (int cx = 1; cx <= 6; ++cx) - if (g_s._sjer[cx] != chr(0)) { - ++cy; - r = (ord(g_s._sjer[cx]) + 400); - nomp = deline(r - 501 + kInventoryStringIndex); - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); - g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); - } - if (cy < 6) - for (int cx = cy + 1; cx <= 6; ++cx) { - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); - } -} - -void sparl(float adr, float rep) { - const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, repint; - - repint = abs((int)rep); - hideMouse(); - Common::String tmpStr = deline(repint + kDialogStringIndex); - displayStr(tmpStr, 230, 4, 65, 24, 5); - f3f8::draw(); - - key = 0; - do { - startSpeech(repint, haut[g_caff - 69], 0); - f3f8::waitForF3F8(key); - CHECK_QUIT; - } while (key != 66); - hirs(); - showMouse(); -} - -/** - * Engine function - End of Search: reset globals - * @remarks Originally called 'finfouill' - */ -void endSearch() { - g_vm->_heroSearching = false; - g_vm->_obpart = false; - g_cs = 0; - g_is = 0; - unsetSearchMenu(); -} - -/** - * Engine function - Switch action menu to "Search" mode - * @remarks Originally called 'mfoudi' - */ -void setSearchMenu() { - for (int cx = 1; cx <= 7; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); - - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.disableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); -} - -void mennor() { - g_vm->_menu.menuUp(g_msg[3]); -} - -void premtet() { - dessine(g_ades, 10, 80); - g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); -} - -/* NIVEAU 5 */ -void ajchai() { - int cy = acha + ((g_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); - - if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_s._selectedObjectId; - else - g_crep = 192; -} - -void ajjer(int ob) { - int cx = 0; - do { - ++cx; - } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); - - if (ord(g_s._sjer[cx]) == 0) { - g_s._sjer[(cx)] = chr(ob); - modinv(); - } else - g_crep = 139; -} - -void t1sama() { //Entering manor - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > 18)) { - bool d; - cherjer(137, d); - if (!d) { //You don't have the keys, and it's late - g_crep = 1511; - tperd(); - } else - st1sama(); - } else if (!g_s._ipre) { //Is it your first time? - g_ipers = 255; - showPeoplePresent(g_ipers); - g_caff = 77; - afdes(0); - g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); - repon(2, 33); - tkey1(false); - mennor(); - hideMouse(); - hirs(); - premtet(); - sparl(0, 140); - dessine_rouleau(); - drawClock(); - showMouse(); - g_s._currPlace = OWN_ROOM; - affrep(); - t5(10); - if (!g_vm->_blo) - minute = t11(0); - g_ipers = 0; - g_mpers = 0; - g_s._ipre = true; - } else - st1sama(); -} - -void t1vier() { - g_s._currPlace = SECRET_PASSAGE; - affrep(); -} - -void t1neig() { - ++g_inei; - if (g_inei > 2) { - g_crep = 1506; - tperd(); - } else { - g_vm->_okdes = true; - g_s._currPlace = MOUNTAIN; - affrep(); - } -} - -void t1deva() { - g_inei = 0; - g_s._currPlace = MANOR_FRONT; - affrep(); -} - -void t1derr() { - g_s._currPlace = MANOR_BACK; - affrep(); -} - -void t1deau() { - g_crep = 1503; - tperd(); -} - -void tctrm() { - repon(2, (3000 + g_ctrm)); - g_ctrm = 0; -} - - -void quelquun() { - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.eraseMenu(); - - endSearch(); - g_crep = 997; -L1: - if (!g_vm->_hiddenHero) { - if (g_crep == 997) - g_crep = 138; - repon(2, g_crep); - if (g_crep == 138) - startSpeech(5, 2, 1); - else - startSpeech(4, 4, 1); - - if (g_iouv == 0) - g_s._faithScore += 2; - else if (g_s._faithScore < 50) - g_s._faithScore += 4; - else - g_s._faithScore += 3 * (g_s._faithScore / 10); - tsort(); - tmlieu(15); - int cx = convertBitIndexToCharacterIndex(g_ipers); - g_caff = 69 + cx; - g_crep = g_caff; - g_msg[3] = MENU_DISCUSS; - g_msg[4] = g_vm->_menu._discussMenu[cx]; - g_vm->_syn = true; - g_vm->_col = true; - } else { - if (getRandomNumber(1, 3) == 2) { - g_vm->_hiddenHero = false; - g_crep = 137; - goto L1; - } else { - repon(2, 136); - int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(3, rand, 1); - clearScreenType2(); - displayAloneText(); - debloc(21); - affrep(); - } - } - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.drawMenu(); -} - -void tsuiv() { - int tbcl; - int cl; - - int cy = acha + ((g_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - ++g_cs; - cl = cy + g_cs; - tbcl = g_tabdon[cl]; - } while ((tbcl == 0) && (g_cs <= 9)); - - if ((tbcl != 0) && (g_cs < 11)) { - ++g_is; - g_caff = tbcl; - g_crep = g_caff + 400; - if (g_ipers != 0) - g_s._faithScore += 2; - } else { - affrep(); - endSearch(); - if (cx > 9) - g_crep = 131; - } -} - -void tfleche() { - bool qust; - char touch; - - if (g_num == 9999) - return; - - fenat(chr(152)); - bool inRect = false; - do { - touch = '\0'; - - do { - moveMouse(qust, touch); - CHECK_QUIT; - - if (g_vm->getMouseClick()) - inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); - tinke(); - } while (!(qust || inRect || g_vm->_anyone)); - - if (qust && (touch == '\103')) - Alert::show(g_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); - - if (touch == '\73') - g_vm->_keyPressedEsc = true; - - if (inRect) { - g_x = x_s; - g_y = y_s; - } -} - -void tcoord(int sx) { - int sy, ix, iy; - int ib; - - - g_num = 0; - g_crep = 999; - int a = 0; - int atdon = amzon + 3; - int cy = 0; - while (cy < g_caff) { - a += g_tabdon[atdon]; - atdon += 4; - ++cy; - } - - if (g_tabdon[atdon] == 0) { - g_crep = 997; - return; - } - - a += fleche; - int cb = 0; - for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; - cb += (ib * 4) + 2; - } - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; - if (ib == 0) { - g_crep = 997; - return; - } - - cy = 1; - do { - cb += 2; - sx = g_tabdon[a + cb] * g_res; - sy = g_tabdon[(a + cb + 1)]; - cb += 2; - ix = g_tabdon[a + cb] * g_res; - iy = g_tabdon[(a + cb + 1)]; - ++cy; - } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); - - if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { - g_num = cy - 1; - return; - } - - g_crep = 997; -} - - -void st7(int ob) { - switch (ob) { - case 116: - case 144: - g_crep = 104; - break; - case 126: - case 111: - g_crep = 108; - break; - case 132: - g_crep = 111; - break; - case 142: - g_crep = 112; - break; - default: - g_crep = 183; - st4(ob); - } -} - -void treg(int ob) { - int mdes = g_caff; - g_caff = ob; - - if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { - afdes(0); - if ((g_caff > 29) && (g_caff < 33)) - repon(2, g_caff); - else - repon(2, g_caff + 400); - tkey1(true); - g_caff = mdes; - g_msg[3] = 0; - g_crep = 998; - } else { - g_vm->_obpart = true; - g_crep = g_caff + 400; - setSearchMenu(); - } -} - -void avpoing(int &ob) { - g_crep = 999; - if (g_s._selectedObjectId != 0) - ajjer(g_s._selectedObjectId); - - if (g_crep != 139) { - modobj(ob + 400); - g_s._selectedObjectId = ob; - ob = 0; - } -} - -void rechai(int &ch) { - int tmpPlace = g_s._currPlace; - - if (g_s._currPlace == CRYPT) - tmpPlace = CELLAR; - ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; -} - -void t23coul(int &l) { - bool d; - - cherjer(143, d); - l = 14; - if (!d) { - g_crep = 1512; - tperd(); - } -} - -void maivid() { - g_s._selectedObjectId = 0; - modobj(500); -} - -void st13(int ob) { - if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || - (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || - (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || - (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || - (ob == 150) || (ob == 152)) - g_crep = 999; - else - g_crep = 105; -} - -void aldepl() { - Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/mor2.h b/engines/mortevielle/mor2.h deleted file mode 100644 index 910791303f..0000000000 --- a/engines/mortevielle/mor2.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_MOR2_H -#define MORTEVIELLE_MOR2_H - -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - -extern void tinke(); -extern void fenat(char ans); -/* NIVEAU 8 */ -extern void afdes(int ad); -extern void tkey1(bool d); -extern void tmlieu(int roomId); -/* NIVEAU 7 */ -extern void tlu(int af, int ob); -extern void affrep(); -extern void unsetSearchMenu(); -/* NIVEAU 6 */ -extern void tperd(); -extern void tsort(); -extern void st4(int ob); -extern void cherjer(int ob, bool &d); -extern void st1sama(); -extern void modinv(); -extern void sparl(float adr, float rep); -extern void endSearch(); -extern void setSearchMenu(); -extern void mennor(); -extern void premtet(); -/* NIVEAU 5 */ -extern void ajchai(); -extern void ajjer(int ob); -extern void t1sama(); -extern void t1vier(); -extern void t1neig(); -extern void t1deva(); -extern void t1derr(); -extern void t1deau(); -extern void tctrm(); -extern void quelquun(); -extern void tsuiv(); -extern void tfleche(); -extern void tcoord(int sx); -extern void st7(int ob); -extern void treg(int ob); -extern void avpoing(int &ob); -extern void rechai(int &ch); -extern void t23coul(int &l); -extern void maivid(); -extern void st13(int ob); -extern void aldepl(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 0e65ca2fdb..509301349d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -33,17 +33,14 @@ #include "mortevielle/dialogs.h" #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/parole2.h" #include "mortevielle/prog.h" #include "mortevielle/saveload.h" -#include "mortevielle/taffich.h" +#include "mortevielle/outtext.h" #include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d8e2309a4c..9d7c38d864 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -25,12 +25,14 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/file.h" +#include "common/str.h" +#include "mortevielle/mor.h" +#include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/graphics.h" -#include "mortevielle/level15.h" #include "mortevielle/mortevielle.h" #include "mortevielle/var_mor.h" -#include "common/str.h" namespace Mortevielle { @@ -239,4 +241,224 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) } } +void chardes(Common::String filename, int32 skipSize, int length) { + Common::File f; + if (!f.open(filename)) + error("Missing file %s", filename.c_str()); + + int skipBlock = 0; + while (skipSize > 127) { + ++skipBlock; + skipSize -= 128; + } + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int totalLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (totalLength > 0) { + f.read(&g_mem[memIndx], 128); + totalLength -= 128; + memIndx += 128; + } + f.close(); + + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) + g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; +} + +void charani(Common::String filename, int32 skipSize, int length) { + Common::File f; + if (!f.open(filename)) + error("Missing file - %s", filename.c_str()); + + int skipBlock = 0; + while (skipSize > 127) { + skipSize = skipSize - 128; + ++skipBlock; + } + if (skipBlock != 0) + f.seek(skipBlock * 0x80); + + int remainingSkipSize = abs(skipSize); + int fullLength = length + remainingSkipSize; + int memIndx = 0x6000 * 16; + while (fullLength > 0) { + f.read(&g_mem[memIndx], 128); + fullLength -= 128; + memIndx += 128; + } + f.close(); + + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) + g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; +} + +void taffich() { + byte tran1[] = { 121, 121, 138, 139, 120 }; + byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; + + int cx, handle, npal; + int32 lgt; + int alllum[16]; + + + int a = g_caff; + if ((a >= 153) && (a <= 161)) + a = tran2[a - 153]; + else if ((a >= 136) && (a <= 140)) + a = tran1[a - 136]; + int b = a; + if (g_maff == a) + return; + + switch (a) { + case 16: + g_s._pourc[9] = '*'; + g_s._teauto[42] = '*'; + break; + case 20: + g_s._teauto[39] = '*'; + if (g_s._teauto[36] == '*') { + g_s._pourc[3] = '*'; + g_s._teauto[38] = '*'; + } + break; + case 24: + g_s._teauto[37] = '*'; + break; + case 30: + g_s._teauto[9] = '*'; + break; + case 31: + g_s._pourc[4] = '*'; + g_s._teauto[35] = '*'; + break; + case 118: + g_s._teauto[41] = '*'; + break; + case 143: + g_s._pourc[1] = '*'; + break; + case 150: + g_s._teauto[34] = '*'; + break; + case 151: + g_s._pourc[2] = '*'; + break; + default: + break; + } + + g_vm->_okdes = true; + hideMouse(); + lgt = 0; + Common::String filename; + + if ((a != 50) && (a != 51)) { + int m = a + 2000; + if ((m > 2001) && (m < 2010)) + m = 2001; + if (m == 2011) + m = 2010; + if (a == 32) + m = 2034; + if ((a == 17) && (g_maff == 14)) + m = 2018; + + if (a > 99) { + if ((g_is == 1) || (g_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) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + m = 2033; + + g_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 + g_l[cx]; + handle = g_l[a]; + + filename = "DXX.mor"; + } else { + filename = "DZZ.mor"; + handle = g_l[87]; + if (a == 51) { + lgt = handle; + handle = g_l[88]; + } + g_maff = a; + npal = a + 37; + } + chardes(filename, lgt, handle); + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + for (int i = 0; i <= 15; ++i) { + int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); + alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); + } + for (int i = 0; i <= 15; ++i) { + int k = 0; + for (int j = 0; j <= 15; ++j) + if (alllum[j] > alllum[k]) + k = j; + g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; + alllum[k] = -1; + } + } + g_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; + for (cx = 0; cx <= (b - 1); ++cx) + lgt += g_l[cx + 89]; + handle = g_l[b + 89]; + filename = "AXX.mor"; + } else if (b == 50) { + filename = "AZZ.mor"; + handle = 1260; + } + charani(filename, lgt, handle); + } + showMouse(); + if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a == 13) || (a == 14)) + displayAloneText(); + else if (!g_vm->_blo) + cx = t11(g_s._currPlace); + g_mpers = 0; + } +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 55e0ec5aab..03523d7086 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -28,6 +28,7 @@ #ifndef MORTEVIELLE_OUTTEXT_H #define MORTEVIELLE_OUTTEXT_H +#include "common/str.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -35,5 +36,9 @@ namespace Mortevielle { extern Common::String deline(int num); extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); +extern void chardes(Common::String filename, int32 passe, int long_); +extern void charani(Common::String filename, int32 skipSize, int length); +extern void taffich(); + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 14b3e3eba8..53da43402e 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -28,23 +28,18 @@ #include "common/file.h" #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" -#include "mortevielle/level15.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/parole.h" +#include "mortevielle/speech.h" #include "mortevielle/sound.h" -#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" namespace Mortevielle { -// For ScummVM, we need to do check for file errors where we do the file access -const int ioresult = 0; - void charpal() { Common::File f; // tabdb records Common::File ft; // tfxx diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp deleted file mode 100644 index b2266dc8ff..0000000000 --- a/engines/mortevielle/parole.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "mortevielle/parole.h" -#include "mortevielle/sound.h" -#include "mortevielle/mortevielle.h" - -namespace Mortevielle { - -void spfrac(int wor) { - g_c3._rep = (uint)wor >> 12; - if ((g_typlec == 0) && (g_c3._code != 9)) - if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || - ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { - ++g_c3._rep; - } - - g_c3._freq = ((uint)wor >> 6) & 7; - g_c3._acc = ((uint)wor >> 9) & 7; -} - -void charg_car(int &currWordNumb) { - int wor, int_; - - wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); - int_ = wor & 0x3f; - - if ((int_ >= 0) && (int_ <= 13)) { - g_c3._val = int_; - g_c3._code = 5; - } else if ((int_ >= 14) && (int_ <= 21)) { - g_c3._val = int_; - g_c3._code = 6; - } else if ((int_ >= 22) && (int_ <= 47)) { - int_ = int_ - 22; - g_c3._val = int_; - g_c3._code = g_typcon[int_]; - } else if ((int_ >= 48) && (int_ <= 56)) { - g_c3._val = int_ - 22; - g_c3._code = 4; - } else { - switch (int_) { - case 60: - g_c3._val = 32; /* " " */ - g_c3._code = 9; - break; - case 61: - g_c3._val = 46; /* "." */ - g_c3._code = 9; - break; - case 62: - g_c3._val = 35; /* "#" */ - g_c3._code = 9; - default: - break; - } - } - - spfrac(wor); - currWordNumb += 2; -} - - -void entroct(byte o) { - g_mem[adtroct * 16 + g_ptr_oct] = o; - ++g_ptr_oct; -} - -void veracf(byte b) { - ; -} - -void cctable(tablint &t) { - float tb[257]; - - tb[0] = 0; - for (int k = 0; k <= 255; ++k) { - tb[k + 1] = g_addfix + tb[k]; - t[255 - k] = abs((int)tb[k] + 1); - } -} - -void regenbruit() { - int i = offsetb3 + 8590; - int j = 0; - do { - g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); - i += 2; - ++j; - } while (i < offsetb3 + 8790); -} - -void charge_son() { - Common::File f; - - if (!f.open("sonmus.mor")) - error("Missing file - sonmus.mor"); - - f.read(&g_mem[0x7414 * 16 + 0], 273); - - g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); - f.close(); -} - -void charge_phbruit() { - Common::File f; - - if (!f.open("phbrui.mor")) - error("Missing file - phbrui.mor"); - - for (int i = 1; i <= 3; ++i) - g_t_cph[i] = f.readSint16LE(); - - f.close(); -} - -void charge_bruit() { - Common::File f; - int i; - - if (!f.open("bruits")) //Translation: "noise" - error("Missing file - bruits"); - - f.read(&g_mem[adbruit * 16 + 0], 250); - for (i = 0; i <= 19013; ++i) - g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; - f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); - - f.close(); -} - -void trait_car() { - byte d3; - int d2, i; - - switch (g_c2._code) { - case 9: - if (g_c2._val != ord('#')) - for (i = 0; i <= g_c2._rep; ++i) - entroct(g_c2._val); - break; - case 5: - case 6: - if (g_c2._code == 6) - d3 = g_tabdph[(g_c2._val - 14) << 1]; - else - d3 = null; - if (g_c1._code >= 5) { - veracf(g_c2._acc); - if (g_c1._code == 9) { - entroct(4); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(22); - } - } - - switch (g_c2._rep) { - case 0: - entroct(0); - entroct(g_c2._val); - if (d3 == null) - if (g_c3._code == 9) - entroct(2); - else - entroct(4); - else if (g_c3._code == 9) - entroct(0); - else - entroct(1); - break; - case 4: - case 5: - case 6: - if (g_c2._rep != 4) { - i = g_c2._rep - 5; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == null) { - entroct(4); - entroct(g_c2._val); - entroct(0); - } else { - entroct(0); - entroct(g_c2._val); - entroct(3); - } - break; - case 7: - case 8: - case 9: - if (g_c2._rep != 7) { - i = g_c2._rep - 8; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == null) { - entroct(0); - entroct(g_c2._val); - entroct(2); - } else { - entroct(0); - entroct(g_c2._val); - entroct(0); - } - break; - case 1: - case 2: - case 3: - if (g_c2._rep != 1) { - i = g_c2._rep - 2; - do { - --i; - entroct(0); - if (d3 == null) - entroct(g_c2._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - entroct(0); - entroct(g_c2._val); - if (g_c3._code == 9) - entroct(0); - else - entroct(1); - break; - default: - break; - } // switch c2.rep - break; - - case 2: - case 3: - d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel - if (g_c1._code > 4) { - veracf(g_c2._acc); - if (g_c1._code == 9) { - entroct(4); - entroct(d3); - entroct(22); - } - } - i = g_c2._rep; - assert(i >= 0); - if (i != 0) { - do { - --i; - entroct(0); - entroct(d3); - entroct(3); - } while (i > 0); - } - veracf(g_c3._acc); - if (g_c3._code == 6) { - entroct(4); - entroct(g_tabdph[(g_c3._val - 14) << 1]); - entroct(g_c2._val); - } else { - entroct(4); - if (g_c3._val == 4) - entroct(3); - else - entroct(g_c3._val); - entroct(g_c2._val); - } - break; - case 0: - case 1: - veracf(g_c2._acc); - switch (g_c3._code) { - case 2: - d2 = 7; - break; - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 10; - break; - } // switch c3._code - d2 = (d2 * 26) + g_c2._val; - if (g_tnocon[d2] == 0) - d3 = 2; - else - d3 = 6; - if (g_c2._rep >= 5) { - g_c2._rep = g_c2._rep - 5; - d3 = 8 - d3; // Swap 2 and 6 - } - if (g_c2._code == 0) { - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(g_c2._val); - entroct(3); - } while (i > 0); - } - entroct(d3); - entroct(g_c2._val); - entroct(4); - } else { - entroct(d3); - entroct(g_c2._val); - entroct(3); - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(g_c2._val); - entroct(4); - } while (i > 0); - } - } - if (g_c3._code == 9) { - entroct(d3); - entroct(g_c2._val); - entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - if (d2 == 4) - d2 = 3; - - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; - - if ((g_c2._val == 17) || (g_c2._val == 18)) - g_c2._val = 16; - - entroct(4); - entroct(d2); - entroct(g_c2._val); - } - - break; - case 4: - veracf(g_c2._acc); - i = g_c2._rep; - if (i != 0) { - do { - --i; - entroct(2); - entroct(g_c2._val); - entroct(3); - } while (i > 0); - } - entroct(2); - entroct(g_c2._val); - entroct(4); - if (g_c3._code == 9) { - entroct(2); - entroct(g_c2._val); - entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; - break; - case 5: - d2 = g_c3._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - - if (d2 == 4) - d2 = 3; - - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; - - entroct(4); - entroct(d2); - entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); - } - - break; - default: - break; - } // switch c2.code -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole.h b/engines/mortevielle/parole.h deleted file mode 100644 index 46d55abab0..0000000000 --- a/engines/mortevielle/parole.h +++ /dev/null @@ -1,48 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_PAROLE_H -#define MORTEVIELLE_PAROLE_H - -#include "common/scummsys.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -extern void spfrac(int wor); -extern void charg_car(int &currWordNumb); -extern void entroct(byte o); -extern void veracf(byte b); -extern void cctable(tablint &t); -extern void regenbruit(); -extern void charge_son(); -extern void charge_phbruit(); -extern void charge_bruit(); -extern void trait_car(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp deleted file mode 100644 index 950f2940bc..0000000000 --- a/engines/mortevielle/parole2.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/endian.h" -#include "mortevielle/level15.h" -#include "mortevielle/parole2.h" -#include "mortevielle/parole.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/sound.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void rot_chariot() { - g_c1 = g_c2; - g_c2 = g_c3; - g_c3._val = 32; - g_c3._code = 9; -} - -void init_chariot() { - g_c3._rep = 0; - g_c3._freq = 0; - g_c3._acc = 0; - rot_chariot(); - rot_chariot(); -} - - -void trait_ph() { - const int deca[3] = {300, 30, 40}; - - int ptr_tcph = g_num_ph - 1; - int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; - int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; - int wordCount = endPos - startPos; - for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); - - g_ptr_oct = 0; - int currWord = 0; - init_chariot(); - - do { - rot_chariot(); - charg_car(currWord); - trait_car(); - } while (currWord < wordCount); - - rot_chariot(); - trait_car(); - entroct(ord('#')); -} - - - -void startSpeech(int rep, int ht, int typ) { - int savph[501]; - int tempo; - - if (g_vm->_soundOff) - return; - - g_num_ph = rep; - g_haut = ht; - g_typlec = typ; - if (g_typlec != 0) { - for (int i = 0; i <= 500; ++i) - savph[i] = g_t_cph[i]; - tempo = kTempoNoise; - } else if (g_haut > 5) - tempo = kTempoF; - else - tempo = kTempoM; - g_addfix = (float)((tempo - g_addv[0])) / 256; - cctable(g_tbi); - switch (typ) { - case 1: - charge_bruit(); - /*if zuul then zzuul(adbruit,0,1095);*/ - regenbruit(); - break; - case 2: - charge_son(); - charge_phbruit(); - break; - default: - break; - } - trait_ph(); - g_vm->_soundManager.litph(g_tbi, typ, tempo); - if (g_typlec != 0) - for (int i = 0; i <= 500; ++i) { - g_t_cph[i] = savph[i]; - g_mlec = g_typlec; - } - writepal(g_numpal); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/parole2.h b/engines/mortevielle/parole2.h deleted file mode 100644 index 3fab74d02f..0000000000 --- a/engines/mortevielle/parole2.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_PAROLE2_H -#define MORTEVIELLE_PAROLE2_H - -namespace Mortevielle { - -extern void rot_chariot(); -extern void init_chariot(); -extern void trait_ph(); -extern void startSpeech(int rep, int ht, int typ); - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index b56aba64e8..a6ccfcb143 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -29,10 +29,8 @@ #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/prog.h" -#include "mortevielle/taffich.h" #include "mortevielle/var_mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 0efafe7fba..2c2af49a5f 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -29,7 +29,6 @@ #include "common/system.h" #include "mortevielle/dialogs.h" #include "mortevielle/mor.h" -#include "mortevielle/mor2.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/ovd1.h" diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp new file mode 100644 index 0000000000..2ad5c0514f --- /dev/null +++ b/engines/mortevielle/speech.cpp @@ -0,0 +1,543 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#include "common/endian.h" +#include "common/file.h" +#include "mortevielle/speech.h" +#include "mortevielle/sound.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/mor.h" +#include "mortevielle/var_mor.h" + +namespace Mortevielle { + +void spfrac(int wor) { + g_c3._rep = (uint)wor >> 12; + if ((g_typlec == 0) && (g_c3._code != 9)) + if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || + ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { + ++g_c3._rep; + } + + g_c3._freq = ((uint)wor >> 6) & 7; + g_c3._acc = ((uint)wor >> 9) & 7; +} + +void charg_car(int &currWordNumb) { + int wor, int_; + + wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); + int_ = wor & 0x3f; + + if ((int_ >= 0) && (int_ <= 13)) { + g_c3._val = int_; + g_c3._code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + g_c3._val = int_; + g_c3._code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { + int_ = int_ - 22; + g_c3._val = int_; + g_c3._code = g_typcon[int_]; + } else if ((int_ >= 48) && (int_ <= 56)) { + g_c3._val = int_ - 22; + g_c3._code = 4; + } else { + switch (int_) { + case 60: + g_c3._val = 32; /* " " */ + g_c3._code = 9; + break; + case 61: + g_c3._val = 46; /* "." */ + g_c3._code = 9; + break; + case 62: + g_c3._val = 35; /* "#" */ + g_c3._code = 9; + default: + break; + } + } + + spfrac(wor); + currWordNumb += 2; +} + + +void entroct(byte o) { + g_mem[adtroct * 16 + g_ptr_oct] = o; + ++g_ptr_oct; +} + +void veracf(byte b) { + ; +} + +void cctable(tablint &t) { + float tb[257]; + + tb[0] = 0; + for (int k = 0; k <= 255; ++k) { + tb[k + 1] = g_addfix + tb[k]; + t[255 - k] = abs((int)tb[k] + 1); + } +} + +void regenbruit() { + int i = offsetb3 + 8590; + int j = 0; + do { + g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); + i += 2; + ++j; + } while (i < offsetb3 + 8790); +} + +void charge_son() { + Common::File f; + + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + f.read(&g_mem[0x7414 * 16 + 0], 273); + + g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); + f.close(); +} + +void charge_phbruit() { + Common::File f; + + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= 3; ++i) + g_t_cph[i] = f.readSint16LE(); + + f.close(); +} + +void charge_bruit() { + Common::File f; + int i; + + if (!f.open("bruits")) //Translation: "noise" + error("Missing file - bruits"); + + f.read(&g_mem[adbruit * 16 + 0], 250); + for (i = 0; i <= 19013; ++i) + g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; + f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); + + f.close(); +} + +void trait_car() { + byte d3; + int d2, i; + + switch (g_c2._code) { + case 9: + if (g_c2._val != ord('#')) + for (i = 0; i <= g_c2._rep; ++i) + entroct(g_c2._val); + break; + case 5: + case 6: + if (g_c2._code == 6) + d3 = g_tabdph[(g_c2._val - 14) << 1]; + else + d3 = null; + if (g_c1._code >= 5) { + veracf(g_c2._acc); + if (g_c1._code == 9) { + entroct(4); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(22); + } + } + + switch (g_c2._rep) { + case 0: + entroct(0); + entroct(g_c2._val); + if (d3 == null) + if (g_c3._code == 9) + entroct(2); + else + entroct(4); + else if (g_c3._code == 9) + entroct(0); + else + entroct(1); + break; + case 4: + case 5: + case 6: + if (g_c2._rep != 4) { + i = g_c2._rep - 5; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == null) { + entroct(4); + entroct(g_c2._val); + entroct(0); + } else { + entroct(0); + entroct(g_c2._val); + entroct(3); + } + break; + case 7: + case 8: + case 9: + if (g_c2._rep != 7) { + i = g_c2._rep - 8; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == null) { + entroct(0); + entroct(g_c2._val); + entroct(2); + } else { + entroct(0); + entroct(g_c2._val); + entroct(0); + } + break; + case 1: + case 2: + case 3: + if (g_c2._rep != 1) { + i = g_c2._rep - 2; + do { + --i; + entroct(0); + if (d3 == null) + entroct(g_c2._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + entroct(0); + entroct(g_c2._val); + if (g_c3._code == 9) + entroct(0); + else + entroct(1); + break; + default: + break; + } // switch c2.rep + break; + + case 2: + case 3: + d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel + if (g_c1._code > 4) { + veracf(g_c2._acc); + if (g_c1._code == 9) { + entroct(4); + entroct(d3); + entroct(22); + } + } + i = g_c2._rep; + assert(i >= 0); + if (i != 0) { + do { + --i; + entroct(0); + entroct(d3); + entroct(3); + } while (i > 0); + } + veracf(g_c3._acc); + if (g_c3._code == 6) { + entroct(4); + entroct(g_tabdph[(g_c3._val - 14) << 1]); + entroct(g_c2._val); + } else { + entroct(4); + if (g_c3._val == 4) + entroct(3); + else + entroct(g_c3._val); + entroct(g_c2._val); + } + break; + case 0: + case 1: + veracf(g_c2._acc); + switch (g_c3._code) { + case 2: + d2 = 7; + break; + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 10; + break; + } // switch c3._code + d2 = (d2 * 26) + g_c2._val; + if (g_tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; + if (g_c2._rep >= 5) { + g_c2._rep = g_c2._rep - 5; + d3 = 8 - d3; // Swap 2 and 6 + } + if (g_c2._code == 0) { + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(g_c2._val); + entroct(3); + } while (i > 0); + } + entroct(d3); + entroct(g_c2._val); + entroct(4); + } else { + entroct(d3); + entroct(g_c2._val); + entroct(3); + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(g_c2._val); + entroct(4); + } while (i > 0); + } + } + if (g_c3._code == 9) { + entroct(d3); + entroct(g_c2._val); + entroct(5); + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + if (d2 == 4) + d2 = 3; + + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; + + if ((g_c2._val == 17) || (g_c2._val == 18)) + g_c2._val = 16; + + entroct(4); + entroct(d2); + entroct(g_c2._val); + } + + break; + case 4: + veracf(g_c2._acc); + i = g_c2._rep; + if (i != 0) { + do { + --i; + entroct(2); + entroct(g_c2._val); + entroct(3); + } while (i > 0); + } + entroct(2); + entroct(g_c2._val); + entroct(4); + if (g_c3._code == 9) { + entroct(2); + entroct(g_c2._val); + entroct(5); + } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { + veracf(g_c3._acc); + switch (g_c3._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = g_tabdph[(g_c3._val - 14) << 1]; + break; + case 5: + d2 = g_c3._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + + if (d2 == 4) + d2 = 3; + + if (g_intcon[g_c2._val] != 0) + ++g_c2._val; + + entroct(4); + entroct(d2); + entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); + } + + break; + default: + break; + } // switch c2.code +} + +void rot_chariot() { + g_c1 = g_c2; + g_c2 = g_c3; + g_c3._val = 32; + g_c3._code = 9; +} + +void init_chariot() { + g_c3._rep = 0; + g_c3._freq = 0; + g_c3._acc = 0; + rot_chariot(); + rot_chariot(); +} + + +void trait_ph() { + const int deca[3] = {300, 30, 40}; + + int ptr_tcph = g_num_ph - 1; + int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; + int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; + int wordCount = endPos - startPos; + for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) + WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); + + g_ptr_oct = 0; + int currWord = 0; + init_chariot(); + + do { + rot_chariot(); + charg_car(currWord); + trait_car(); + } while (currWord < wordCount); + + rot_chariot(); + trait_car(); + entroct(ord('#')); +} + + + +void startSpeech(int rep, int ht, int typ) { + int savph[501]; + int tempo; + + if (g_vm->_soundOff) + return; + + g_num_ph = rep; + g_haut = ht; + g_typlec = typ; + if (g_typlec != 0) { + for (int i = 0; i <= 500; ++i) + savph[i] = g_t_cph[i]; + tempo = kTempoNoise; + } else if (g_haut > 5) + tempo = kTempoF; + else + tempo = kTempoM; + g_addfix = (float)((tempo - g_addv[0])) / 256; + cctable(g_tbi); + switch (typ) { + case 1: + charge_bruit(); + /*if zuul then zzuul(adbruit,0,1095);*/ + regenbruit(); + break; + case 2: + charge_son(); + charge_phbruit(); + break; + default: + break; + } + trait_ph(); + g_vm->_soundManager.litph(g_tbi, typ, tempo); + if (g_typlec != 0) + for (int i = 0; i <= 500; ++i) { + g_t_cph[i] = savph[i]; + g_mlec = g_typlec; + } + writepal(g_numpal); +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h new file mode 100644 index 0000000000..0e249b8e00 --- /dev/null +++ b/engines/mortevielle/speech.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1988-1989 Lankhor + */ + +#ifndef MORTEVIELLE_PAROLE_H +#define MORTEVIELLE_PAROLE_H + +#include "common/scummsys.h" +#include "mortevielle/var_mor.h" + +namespace Mortevielle { + +extern void spfrac(int wor); +extern void charg_car(int &currWordNumb); +extern void entroct(byte o); +extern void veracf(byte b); +extern void cctable(tablint &t); +extern void regenbruit(); +extern void charge_son(); +extern void charge_phbruit(); +extern void charge_bruit(); +extern void trait_car(); + +extern void rot_chariot(); +extern void init_chariot(); +extern void trait_ph(); +extern void startSpeech(int rep, int ht, int typ); + +} // End of namespace Mortevielle +#endif diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp deleted file mode 100644 index a65cecd8a8..0000000000 --- a/engines/mortevielle/taffich.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "common/str.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/level15.h" -#include "mortevielle/mor.h" -#include "mortevielle/mouse.h" -#include "mortevielle/taffich.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void chardes(Common::String filename, int32 skipSize, int length) { - Common::File f; - if (!f.open(filename)) - error("Missing file %s", filename.c_str()); - - int skipBlock = 0; - while (skipSize > 127) { - ++skipBlock; - skipSize -= 128; - } - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int totalLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; - while (totalLength > 0) { - f.read(&g_mem[memIndx], 128); - testfi(); - totalLength -= 128; - memIndx += 128; - } - f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; -} - -void charani(Common::String filename, int32 skipSize, int length) { - Common::File f; - if (!f.open(filename)) - error("Missing file - %s", filename.c_str()); - - int skipBlock = 0; - while (skipSize > 127) { - skipSize = skipSize - 128; - ++skipBlock; - } - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int fullLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; - while (fullLength > 0) { - f.read(&g_mem[memIndx], 128); - testfi(); - fullLength -= 128; - memIndx += 128; - } - f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; -} - -void taffich() { - byte tran1[] = { 121, 121, 138, 139, 120 }; // array<136, 140, byte> - byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; // array<153, 161, byte> - - int cx, handle, npal; - int32 lgt; - int alllum[16]; - - - int a = g_caff; - if ((a >= 153) && (a <= 161)) - a = tran2[a - 153]; - else if ((a >= 136) && (a <= 140)) - a = tran1[a - 136]; - int b = a; - if (g_maff == a) - return; - - switch (a) { - case 16: - g_s._pourc[9] = '*'; - g_s._teauto[42] = '*'; - break; - case 20: - g_s._teauto[39] = '*'; - if (g_s._teauto[36] == '*') { - g_s._pourc[3] = '*'; - g_s._teauto[38] = '*'; - } - break; - case 24: - g_s._teauto[37] = '*'; - break; - case 30: - g_s._teauto[9] = '*'; - break; - case 31: - g_s._pourc[4] = '*'; - g_s._teauto[35] = '*'; - break; - case 118: - g_s._teauto[41] = '*'; - break; - case 143: - g_s._pourc[1] = '*'; - break; - case 150: - g_s._teauto[34] = '*'; - break; - case 151: - g_s._pourc[2] = '*'; - break; - default: - break; - } - - g_vm->_okdes = true; - hideMouse(); - lgt = 0; - Common::String filename; - - if ((a != 50) && (a != 51)) { - int m = a + 2000; - if ((m > 2001) && (m < 2010)) - m = 2001; - if (m == 2011) - m = 2010; - if (a == 32) - m = 2034; - if ((a == 17) && (g_maff == 14)) - m = 2018; - - if (a > 99) { - if ((g_is == 1) || (g_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) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) - m = 2033; - - g_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 + g_l[cx]; - handle = g_l[a]; - - filename = "DXX.mor"; - } else { - filename = "DZZ.mor"; - handle = g_l[87]; - if (a == 51) { - lgt = handle; - handle = g_l[88]; - } - g_maff = a; - npal = a + 37; - } - chardes(filename, lgt, handle); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); - alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); - } - for (int i = 0; i <= 15; ++i) { - int k = 0; - for (int j = 0; j <= 15; ++j) - if (alllum[j] > alllum[k]) - k = j; - g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; - alllum[k] = -1; - } - } - g_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; - for (cx = 0; cx <= (b - 1); ++cx) - lgt += g_l[cx + 89]; - handle = g_l[b + 89]; - filename = "AXX.mor"; - } else if (b == 50) { - filename = "AZZ.mor"; - handle = 1260; - } - charani(filename, lgt, handle); - } - showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { - if ((a == 13) || (a == 14)) - displayAloneText(); - else if (!g_vm->_blo) - cx = t11(g_s._currPlace); - g_mpers = 0; - } -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/taffich.h b/engines/mortevielle/taffich.h deleted file mode 100644 index 4bb5e77de1..0000000000 --- a/engines/mortevielle/taffich.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_TAFFICH_H -#define MORTEVIELLE_TAFFICH_H - -#include "common/str.h" - -namespace Mortevielle { - -extern void chardes(Common::String filename, int32 passe, int long_); -extern void charani(Common::String filename, int32 skipSize, int length); -extern void taffich(); - -} // End of namespace Mortevielle - -#endif -- cgit v1.2.3 From b5d2fa7e5f11ed02bc8b52459265a07c9d61440b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Mar 2012 10:06:44 +0100 Subject: MORTEVIELLE: Merge prog and mor files --- engines/mortevielle/actions.cpp | 1 - engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 210 ++++++++++++++++++++++++++++++ engines/mortevielle/mor.h | 10 ++ engines/mortevielle/mortevielle.cpp | 1 - engines/mortevielle/prog.cpp | 250 ------------------------------------ engines/mortevielle/prog.h | 44 ------- engines/mortevielle/saveload.cpp | 1 - 8 files changed, 220 insertions(+), 298 deletions(-) delete mode 100644 engines/mortevielle/prog.cpp delete mode 100644 engines/mortevielle/prog.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5f511fc7ee..59a99ef811 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -38,7 +38,6 @@ namespace Mortevielle { - /** * Engine function - Move * @remarks Originally called 'taller' diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 103a4fcd4e..07631ea264 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -13,7 +13,6 @@ MODULE_OBJS := \ mouse.o \ outtext.o \ ovd1.o \ - prog.o \ saveload.o \ sound.o \ speech.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 7c92d9aab0..ef55e316a8 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -30,6 +30,7 @@ #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" +#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" @@ -2425,4 +2426,213 @@ void aldepl() { Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); } +/** + * Engine function - Change Graphical Device + * @remarks Originally called 'change_gd' + */ +void changeGraphicalDevice(int newDevice) { + hideMouse(); + g_vm->_currGraphicalDevice = newDevice; + hirs(); + initMouse(); + showMouse(); + dessine_rouleau(); + tinke(); + drawClock(); + if (g_ipers != 0) + showPeoplePresent(g_ipers); + else + displayAloneText(); + clearScreenType2(); + clsf3(); + g_maff = 68; + afdes(0); + repon(2, g_crep); + g_vm->_menu.displayMenu(); +} + +/** + * Called when a savegame has been loaded. + * @remarks Originally called 'antegame' + */ +void MortevielleEngine::gameLoaded() { + hideMouse(); + _menu._menuDisplayed = false; + _loseGame = true; + _anyone = false; + _okdes = true; + _col = false; + _hiddenHero = false; + _brt = false; + g_maff = 68; + g_mnumo = 0; + g_prebru = 0; + g_x = 0; + g_y = 0; + g_num = 0; + g_hdb = 0; + g_hfb = 0; + g_cs = 0; + g_is = 0; + g_ment = 0; + _syn = true; + _heroSearching = true; + g_mchai = 0; + g_inei = 0; + initouv(); + g_iouv = 0; + g_dobj = 0; + affrep(); + g_hintPctMessage = deline(580); + + _okdes = false; + _endGame = true; + _loseGame = false; + _heroSearching = false; + + displayAloneText(); + tinke(); + drawClock(); + afdes(0); + repon(2, g_crep); + clsf3(); + _endGame = false; + tmlieu(g_s._currPlace); + modinv(); + if (g_s._selectedObjectId != 0) + modobj(g_s._selectedObjectId + 400); + showMouse(); +} + + +/* NIVEAU 3 */ +/* procedure PROGRAMME */ +void tmaj3() { + int day, hour, minute; + + updateHour(day, hour, minute); + if (minute == 30) + minute = 1; + hour += day * 24; + minute += hour * 2; + g_s._heure = chr(minute); +} + +void tsitu() { + if (!g_vm->_col) + clearScreenType2(); + g_vm->_syn = false; + g_vm->_keyPressedEsc = false; + if (!g_vm->_anyone) { + if (g_vm->_brt) + if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { + g_ctrm = 4; + mennor(); + return; + } + if (g_msg[3] == MENU_MOVE) + fctMove(); + if (g_msg[3] == MENU_DISCUSS) + fctDiscuss(); + if (g_msg[3] == MENU_INVENTORY) + fctInventoryTake(); + if (g_msg[4] == OPCODE_ATTACH) + fctAttach(); + if (g_msg[4] == OPCODE_WAIT) + fctWait(); + if (g_msg[4] == OPCODE_FORCE) + fctForce(); + if (g_msg[4] == OPCODE_SLEEP) + fctSleep(); + if (g_msg[4] == OPCODE_LISTEN) + fctListen(); + if (g_msg[4] == OPCODE_ENTER) + fctEnter(); + if (g_msg[4] == OPCODE_CLOSE) + fctClose(); + if (g_msg[4] == OPCODE_SEARCH) + fctSearch(); + if (g_msg[4] == OPCODE_KNOCK) + fctKnock(); + if (g_msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (g_msg[4] == OPCODE_READ) + fctRead(); + if (g_msg[4] == OPCODE_EAT) + fctEat(); + if (g_msg[4] == OPCODE_PLACE) + fctPlace(); + if (g_msg[4] == OPCODE_OPEN) + fctOpen(); + if (g_msg[4] == OPCODE_TAKE) + fctTake(); + if (g_msg[4] == OPCODE_LOOK) + fctLook(); + if (g_msg[4] == OPCODE_SMELL) + fctSmell(); + if (g_msg[4] == OPCODE_SOUND) + fctSound(); + if (g_msg[4] == OPCODE_LEAVE) + fctLeave(); + if (g_msg[4] == OPCODE_LIFT) + fctLift(); + if (g_msg[4] == OPCODE_TURN) + fctTurn(); + if (g_msg[4] == OPCODE_SSEARCH) + fctSelfSearch(); + if (g_msg[4] == OPCODE_SREAD) + fctSelfRead(); + if (g_msg[4] == OPCODE_SPUT) + fctSelfPut(); + if (g_msg[4] == OPCODE_SLOOK) + fctSelftLook(); + g_vm->_hiddenHero = false; + + if (g_msg[4] == OPCODE_SHIDE) + fctSelfHide(); + } else { + if (g_vm->_anyone) { + quelquun(); + g_vm->_anyone = false; + mennor(); + return; + } + } + int hour, day, minute; + updateHour(day, hour, minute); + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || + ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) + ++g_s._faithScore; + if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) + && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { + if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { + g_crep = 1501; + tperd(); + } + if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { + g_crep = 1508; + tperd(); + } + if ((day > 1) && (hour > 8) && (!g_vm->_loseGame)) { + g_crep = 1502; + tperd(); + } + } + mennor(); +} + +/* NIVEAU 1 */ + +void theure() { + g_vj = ord(g_s._heure); + g_vh = g_vj % 48; + g_vj /= 48; + g_vm__ = g_vh % 2; + g_vh /= 2; + g_hour = g_vh; + if (g_vm__ == 1) + g_minute = 30; + else + g_minute = 0; +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 73f6df22b7..d7d5c8739f 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -178,5 +178,15 @@ extern void t23coul(int &l); extern void maivid(); extern void st13(int ob); extern void aldepl(); + +extern void changeGraphicalDevice(int newDevice); + +/* NIVEAU 3 */ +/* procedure PROGRAMME */ +extern void tmaj3(); +extern void tsitu(); + +/* NIVEAU 1 */ +extern void theure(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 509301349d..4b8c2678b3 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -38,7 +38,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" -#include "mortevielle/prog.h" #include "mortevielle/saveload.h" #include "mortevielle/outtext.h" #include "mortevielle/var_mor.h" diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp deleted file mode 100644 index a6ccfcb143..0000000000 --- a/engines/mortevielle/prog.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/actions.h" -#include "mortevielle/dialogs.h" -#include "mortevielle/menu.h" -#include "mortevielle/mor.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/prog.h" -#include "mortevielle/var_mor.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" - -namespace Mortevielle { - -/** - * Engine function - Change Graphical Device - * @remarks Originally called 'change_gd' - */ -void changeGraphicalDevice(int newDevice) { - hideMouse(); - g_vm->_currGraphicalDevice = newDevice; - hirs(); - initMouse(); - showMouse(); - dessine_rouleau(); - tinke(); - drawClock(); - if (g_ipers != 0) - showPeoplePresent(g_ipers); - else - displayAloneText(); - clearScreenType2(); - clsf3(); - g_maff = 68; - afdes(0); - repon(2, g_crep); - g_vm->_menu.displayMenu(); -} - -/** - * Called when a savegame has been loaded. - * @remarks Originally called 'antegame' - */ -void MortevielleEngine::gameLoaded() { - hideMouse(); - _menu._menuDisplayed = false; - _loseGame = true; - _anyone = false; - _okdes = true; - _col = false; - _hiddenHero = false; - _brt = false; - g_maff = 68; - g_mnumo = 0; - g_prebru = 0; - g_x = 0; - g_y = 0; - g_num = 0; - g_hdb = 0; - g_hfb = 0; - g_cs = 0; - g_is = 0; - g_ment = 0; - _syn = true; - _heroSearching = true; - g_mchai = 0; - g_inei = 0; - initouv(); - g_iouv = 0; - g_dobj = 0; - affrep(); - g_hintPctMessage = deline(580); - - _okdes = false; - _endGame = true; - _loseGame = false; - _heroSearching = false; - - displayAloneText(); - tinke(); - drawClock(); - afdes(0); - repon(2, g_crep); - clsf3(); - _endGame = false; - tmlieu(g_s._currPlace); - modinv(); - if (g_s._selectedObjectId != 0) - modobj(g_s._selectedObjectId + 400); - showMouse(); -} - - -/* NIVEAU 3 */ -/* procedure PROGRAMME */ -void tmaj3() { - int day, hour, minute; - - updateHour(day, hour, minute); - if (minute == 30) - minute = 1; - hour += day * 24; - minute += hour * 2; - g_s._heure = chr(minute); -} - -void tsitu() { - if (!g_vm->_col) - clearScreenType2(); - g_vm->_syn = false; - g_vm->_keyPressedEsc = false; - if (!g_vm->_anyone) { - if (g_vm->_brt) - if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { - g_ctrm = 4; - mennor(); - return; - } - if (g_msg[3] == MENU_MOVE) - fctMove(); - if (g_msg[3] == MENU_DISCUSS) - fctDiscuss(); - if (g_msg[3] == MENU_INVENTORY) - fctInventoryTake(); - if (g_msg[4] == OPCODE_ATTACH) - fctAttach(); - if (g_msg[4] == OPCODE_WAIT) - fctWait(); - if (g_msg[4] == OPCODE_FORCE) - fctForce(); - if (g_msg[4] == OPCODE_SLEEP) - fctSleep(); - if (g_msg[4] == OPCODE_LISTEN) - fctListen(); - if (g_msg[4] == OPCODE_ENTER) - fctEnter(); - if (g_msg[4] == OPCODE_CLOSE) - fctClose(); - if (g_msg[4] == OPCODE_SEARCH) - fctSearch(); - if (g_msg[4] == OPCODE_KNOCK) - fctKnock(); - if (g_msg[4] == OPCODE_SCRATCH) - fctScratch(); - if (g_msg[4] == OPCODE_READ) - fctRead(); - if (g_msg[4] == OPCODE_EAT) - fctEat(); - if (g_msg[4] == OPCODE_PLACE) - fctPlace(); - if (g_msg[4] == OPCODE_OPEN) - fctOpen(); - if (g_msg[4] == OPCODE_TAKE) - fctTake(); - if (g_msg[4] == OPCODE_LOOK) - fctLook(); - if (g_msg[4] == OPCODE_SMELL) - fctSmell(); - if (g_msg[4] == OPCODE_SOUND) - fctSound(); - if (g_msg[4] == OPCODE_LEAVE) - fctLeave(); - if (g_msg[4] == OPCODE_LIFT) - fctLift(); - if (g_msg[4] == OPCODE_TURN) - fctTurn(); - if (g_msg[4] == OPCODE_SSEARCH) - fctSelfSearch(); - if (g_msg[4] == OPCODE_SREAD) - fctSelfRead(); - if (g_msg[4] == OPCODE_SPUT) - fctSelfPut(); - if (g_msg[4] == OPCODE_SLOOK) - fctSelftLook(); - g_vm->_hiddenHero = false; - - if (g_msg[4] == OPCODE_SHIDE) - fctSelfHide(); - } else { - if (g_vm->_anyone) { - quelquun(); - g_vm->_anyone = false; - mennor(); - return; - } - } - int hour, day, minute; - updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) - ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) - && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { - if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { - g_crep = 1501; - tperd(); - } - if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { - g_crep = 1508; - tperd(); - } - if ((day > 1) && (hour > 8) && (!g_vm->_loseGame)) { - g_crep = 1502; - tperd(); - } - } - mennor(); -} - -/* NIVEAU 1 */ - -void theure() { - g_vj = ord(g_s._heure); - g_vh = g_vj % 48; - g_vj /= 48; - g_vm__ = g_vh % 2; - g_vh /= 2; - g_hour = g_vh; - if (g_vm__ == 1) - g_minute = 30; - else - g_minute = 0; -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/prog.h b/engines/mortevielle/prog.h deleted file mode 100644 index c6ccca8920..0000000000 --- a/engines/mortevielle/prog.h +++ /dev/null @@ -1,44 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_PROG_H -#define MORTEVIELLE_PROG_H - -namespace Mortevielle { - -extern void changeGraphicalDevice(int newDevice); - -/* NIVEAU 3 */ -/* procedure PROGRAMME */ -extern void tmaj3(); -extern void tsitu(); - -/* NIVEAU 1 */ -extern void theure(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 2c2af49a5f..a86432253c 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -32,7 +32,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/ovd1.h" -#include "mortevielle/prog.h" #include "mortevielle/saveload.h" #include "mortevielle/var_mor.h" -- cgit v1.2.3 From 1ff2cb051d035f587314bf4e312d759bbfd036f9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Mar 2012 14:17:05 +0100 Subject: MORTEVIELLE: Move opcode functions to MortevielleEngine class --- engines/mortevielle/actions.cpp | 61 ++++++++++++++++----------------- engines/mortevielle/actions.h | 68 ------------------------------------- engines/mortevielle/mor.cpp | 37 ++++++++++---------- engines/mortevielle/mor.h | 1 - engines/mortevielle/mortevielle.cpp | 5 ++- engines/mortevielle/mortevielle.h | 32 +++++++++++++++++ engines/mortevielle/mouse.cpp | 4 +-- engines/mortevielle/mouse.h | 2 +- 8 files changed, 87 insertions(+), 123 deletions(-) delete mode 100644 engines/mortevielle/actions.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 59a99ef811..49496e8daf 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -26,7 +26,6 @@ */ #include "common/scummsys.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -42,7 +41,7 @@ namespace Mortevielle { * Engine function - Move * @remarks Originally called 'taller' */ -void fctMove() { +void MortevielleEngine::fctMove() { if ((g_s._currPlace == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; @@ -178,7 +177,7 @@ void fctMove() { * Engine function - Take * @remarks Originally called 'tprendre' */ -void fctTake() { +void MortevielleEngine::fctTake() { if (g_caff > 99) { int cx = g_caff; avpoing(cx); @@ -291,7 +290,7 @@ void fctTake() { * Engine function - Inventory / Take * @remarks Originally called 'tsprendre' */ -void fctInventoryTake() { +void MortevielleEngine::fctInventoryTake() { int cx, cy, cz; cx = 0; @@ -317,7 +316,7 @@ void fctInventoryTake() { * Engine function - Lift * @remarks Originally called 'tsoulever' */ -void fctLift() { +void MortevielleEngine::fctLift() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); @@ -351,7 +350,7 @@ void fctLift() { * Engine function - Read * @remarks Originally called 'tlire' */ -void fctRead() { +void MortevielleEngine::fctRead() { if (g_caff > 99) st4(g_caff); else { @@ -370,7 +369,7 @@ void fctRead() { * Engine function - Self / Read * @remarks Originally called 'tslire' */ -void fctSelfRead() { +void MortevielleEngine::fctSelfRead() { if (g_s._selectedObjectId == 0) g_crep = 186; else @@ -381,7 +380,7 @@ void fctSelfRead() { * Engine function - Look * @remarks Originally called 'tregarder' */ -void fctLook() { +void MortevielleEngine::fctLook() { int cx; if (g_caff > 99) { @@ -459,7 +458,7 @@ void fctLook() { * Engine function - Self / Look * @remarks Originally called 'tsregarder' */ -void fctSelftLook() { +void MortevielleEngine::fctSelftLook() { if (g_s._selectedObjectId != 0) treg(g_s._selectedObjectId); else @@ -470,7 +469,7 @@ void fctSelftLook() { * Engine function - Search * @remarks Originally called 'tfouiller' */ -void fctSearch() { +void MortevielleEngine::fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; if (g_caff > 99) { @@ -563,7 +562,7 @@ void fctSearch() { * Engine function - Self / Search * @remarks Originally called 'tsfouiller' */ -void fctSelfSearch() { +void MortevielleEngine::fctSelfSearch() { if (g_s._selectedObjectId != 0) st7(g_s._selectedObjectId); else @@ -574,7 +573,7 @@ void fctSelfSearch() { * Engine function - Open * @remarks Originally called 'touvrir' */ -void fctOpen() { +void MortevielleEngine::fctOpen() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_OPEN)); @@ -636,7 +635,7 @@ void fctOpen() { * Engine function - Place * @remarks Originally called 'tmettre' */ -void fctPlace() { +void MortevielleEngine::fctPlace() { if (g_s._selectedObjectId == 0) { g_crep = 186; return; @@ -770,7 +769,7 @@ void fctPlace() { * Engine function - Turn * @remarks Originally called 'ttourner' */ -void fctTurn() { +void MortevielleEngine::fctTurn() { if (g_caff > 99) { g_crep = 149; return; @@ -810,7 +809,7 @@ void fctTurn() { * Engine function - Hide Self * @remarks Originally called 'tcacher' */ -void fctSelfHide() { +void MortevielleEngine::fctSelfHide() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); @@ -829,7 +828,7 @@ void fctSelfHide() { * Engine function - Attach * @remarks Originally called 'tattacher' */ -void fctAttach() { +void MortevielleEngine::fctAttach() { if (g_s._selectedObjectId == 0) g_crep = 186; else { @@ -856,7 +855,7 @@ void fctAttach() { * Engine function - Close * @remarks Originally called 'tfermer' */ -void fctClose() { +void MortevielleEngine::fctClose() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_CLOSE)); @@ -896,7 +895,7 @@ void fctClose() { * Engine function - Knock * @remarks Originally called 'tfrapper' */ -void fctKnock() { +void MortevielleEngine::fctKnock() { warning("Knock - _currPlace %d", g_s._currPlace); if (!g_vm->_syn) @@ -946,7 +945,7 @@ void fctKnock() { * Engine function - Self / Put * @remarks Originally called 'tposer' */ -void fctSelfPut() { +void MortevielleEngine::fctSelfPut() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_POSE)); if (g_s._selectedObjectId == 0) @@ -1040,7 +1039,7 @@ void fctSelfPut() { * Engine function - Listen * @remarks Originally called 'tecouter' */ -void fctListen() { +void MortevielleEngine::fctListen() { if (g_s._currPlace != 26) g_crep = 101; else { @@ -1078,7 +1077,7 @@ void fctListen() { * Engine function - Eat * @remarks Originally called 'tmanger' */ -void fctEat() { +void MortevielleEngine::fctEat() { if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { g_crep = 148; } else { @@ -1119,7 +1118,7 @@ void fctEat() { * Engine function - Enter * @remarks Originally called 'tentrer' */ -void fctEnter() { +void MortevielleEngine::fctEnter() { if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { t1sama(); tmlieu(g_s._currPlace); @@ -1178,7 +1177,7 @@ void fctEnter() { * Engine function - Sleep * @remarks Originally called 'tdormir' */ -void fctSleep() { +void MortevielleEngine::fctSleep() { int z, j, h, m; if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { @@ -1225,7 +1224,7 @@ void fctSleep() { * Engine function - Force * @remarks Originally called 'tdefoncer' */ -void fctForce() { +void MortevielleEngine::fctForce() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMASH)); if (g_caff < 25) @@ -1245,7 +1244,7 @@ void fctForce() { * Engine function - Leave * @remarks Originally called 'tsortir' */ -void fctLeave() { +void MortevielleEngine::fctLeave() { tsort(); g_crep = 0; if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) @@ -1281,7 +1280,7 @@ void fctLeave() { * Engine function - Wait * @remarks Originally called 'tattendre' */ -void fctWait() { +void MortevielleEngine::fctWait() { g_mpers = 0; clsf3(); @@ -1314,7 +1313,7 @@ void fctWait() { * Engine function - Sound * @remarks Originally called 'tsonder' */ -void fctSound() { +void MortevielleEngine::fctSound() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_PROBE2)); if (g_caff < 27) { @@ -1329,7 +1328,7 @@ void fctSound() { * Engine function - Discuss * @remarks Originally called 'tparler' */ -void fctDiscuss() { +void MortevielleEngine::fctDiscuss() { bool te[47]; int cy, cx, max, suj, co, lig, icm, i, choi, x, y, c; char tou; @@ -1394,7 +1393,7 @@ void fctDiscuss() { moveMouse(f, tou); CHECK_QUIT; - getMousePos(x, y, c); + getMousePos_(x, y, c); x *= (3 - g_res); if (x > 319) cx = 41; @@ -1527,7 +1526,7 @@ void fctDiscuss() { * Engine function - Smell * @remarks Originally called 'tsentir' */ -void fctSmell() { +void MortevielleEngine::fctSmell() { g_crep = 119; if (g_caff < 26) { if (!g_vm->_syn) @@ -1545,7 +1544,7 @@ void fctSmell() { * Engine function - Scratch * @remarks Originally called 'tgratter' */ -void fctScratch() { +void MortevielleEngine::fctScratch() { g_crep = 155; if (g_caff < 27) { if (!g_vm->_syn) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h deleted file mode 100644 index 74d4e5c046..0000000000 --- a/engines/mortevielle/actions.h +++ /dev/null @@ -1,68 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_ACTIONS_H -#define MORTEVIELLE_ACTIONS_H - -namespace Mortevielle { - -/* NIVEAU 4 */ -extern void fctMove(); -extern void fctTake(); -extern void fctInventoryTake(); -extern void fctLift(); -extern void fctRead(); -extern void fctSelfRead(); -extern void fctLook(); -extern void fctSelftLook(); -extern void fctSearch(); -extern void fctSelfSearch(); -extern void fctOpen(); -extern void fctPlace(); -extern void fctTurn(); -extern void fctSelfHide(); -extern void fctAttach(); -extern void fctClose(); -extern void fctKnock(); -extern void fctSelfPut(); -extern void fctListen(); -extern void fctEat(); -extern void fctEnter(); -extern void fctSleep(); -extern void fctForce(); -extern void fctLeave(); -extern void fctWait(); -extern void fctSound(); -extern void fctDiscuss(); -extern void fctSmell(); -extern void fctScratch(); -/* NIVEAU 2 */ -extern void endGame(); -extern void loseGame(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ef55e316a8..c973fabc0a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -30,7 +30,6 @@ #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" @@ -61,7 +60,7 @@ void copcha() { bool isMouseIn(rectangle r) { int x, y, c; - getMousePos(x, y, c); + getMousePos_(x, y, c); if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) return true; @@ -91,12 +90,11 @@ void writepal(int n) { } break; case MODE_CGA: { - warning("TODO: If this code is needed, resolve the incompatible types"); nhom pal[16]; for (int i = 0; i < 16; ++i) { pal[i] = g_palcga[n]._a[i]; } -// nhom pal[16] = palcga[n]._a; + if (n < 89) palette(g_palcga[n]._p); @@ -1833,7 +1831,7 @@ void tkey1(bool d) { while (keypressed()) g_key = testou(); do { - getMousePos(x, y, c); + getMousePos_(x, y, c); keypressed(); } while (c != 0); @@ -1842,7 +1840,7 @@ void tkey1(bool d) { if (d) tinke(); quest = keypressed(); - getMousePos(x, y, c); + getMousePos_(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && g_vm->_anyone))); if (quest) @@ -2518,18 +2516,23 @@ void tmaj3() { g_s._heure = chr(minute); } -void tsitu() { - if (!g_vm->_col) +/** + * Engine function - Handle OpCodes + * @remarks Originally called 'tsitu' + */ +void MortevielleEngine::handleOpcode() { + if (!_col) clearScreenType2(); - g_vm->_syn = false; - g_vm->_keyPressedEsc = false; - if (!g_vm->_anyone) { - if (g_vm->_brt) + _syn = false; + _keyPressedEsc = false; + if (!_anyone) { + if (_brt) { if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { g_ctrm = 4; mennor(); return; } + } if (g_msg[3] == MENU_MOVE) fctMove(); if (g_msg[3] == MENU_DISCUSS) @@ -2586,14 +2589,14 @@ void tsitu() { fctSelfPut(); if (g_msg[4] == OPCODE_SLOOK) fctSelftLook(); - g_vm->_hiddenHero = false; + _hiddenHero = false; if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { - if (g_vm->_anyone) { + if (_anyone) { quelquun(); - g_vm->_anyone = false; + _anyone = false; mennor(); return; } @@ -2604,7 +2607,7 @@ void tsitu() { ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) ++g_s._faithScore; if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) - && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { + && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!_loseGame)) { if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; tperd(); @@ -2613,7 +2616,7 @@ void tsitu() { g_crep = 1508; tperd(); } - if ((day > 1) && (hour > 8) && (!g_vm->_loseGame)) { + if ((day > 1) && (hour > 8) && (!_loseGame)) { g_crep = 1502; tperd(); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index d7d5c8739f..2336bc4022 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -184,7 +184,6 @@ extern void changeGraphicalDevice(int newDevice); /* NIVEAU 3 */ /* procedure PROGRAMME */ extern void tmaj3(); -extern void tsitu(); /* NIVEAU 1 */ extern void theure(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4b8c2678b3..1ef69a6b5b 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -29,7 +29,6 @@ #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" @@ -552,7 +551,7 @@ void MortevielleEngine::mainGame() { /** * This method handles playing a loaded game - * @remarks Originally called tojouer + * @remarks Originally called tjouer */ void MortevielleEngine::playGame() { gameLoaded(); @@ -660,7 +659,7 @@ void MortevielleEngine::handleAction() { } do { if (! oo) - tsitu(); + handleOpcode(); if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0d1f5670ca..c1ed2ad855 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -169,10 +169,42 @@ public: void delay(int amount); Common::String getEngineString(int idx) const { return _engineStrings[idx]; } Common::String getGameString(int idx) const { return _gameStrings[idx]; } + void handleOpcode(); void endGame(); void loseGame(); void gameLoaded(); + +/* NIVEAU 4 */ + void fctMove(); + void fctTake(); + void fctInventoryTake(); + void fctLift(); + void fctRead(); + void fctSelfRead(); + void fctLook(); + void fctSelftLook(); + void fctSearch(); + void fctSelfSearch(); + void fctOpen(); + void fctPlace(); + void fctTurn(); + void fctSelfHide(); + void fctAttach(); + void fctClose(); + void fctKnock(); + void fctSelfPut(); + void fctListen(); + void fctEat(); + void fctEnter(); + void fctSleep(); + void fctForce(); + void fctLeave(); + void fctWait(); + void fctSound(); + void fctDiscuss(); + void fctSmell(); + void fctScratch(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 1240fa4165..2eec6ab2b5 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -278,7 +278,7 @@ void setMousePos(int x, int y) { * Get mouse poisition * @remarks Originally called 'read_pos_mouse' */ -void getMousePos(int &x, int &y, int &c) { +void getMousePos_(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; c = g_vm->getMouseClick() ? 1 : 0; @@ -307,7 +307,7 @@ void moveMouse(bool &funct, char &key) { CHECK_QUIT; in1 = get_ch(); - getMousePos(cx, cy, cd); + getMousePos_(cx, cy, cd); switch (toupper(in1)) { case '4': cx = cx - 8; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index d17654c19e..532644a255 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -44,7 +44,7 @@ void initMouse(); extern void hideMouse(); extern void showMouse(); extern void setMousePos(int x, int y); -extern void getMousePos(int &x, int &y, int &c); +extern void getMousePos_(int &x, int &y, int &c); extern void moveMouse(bool &funct, char &key); } // End of namespace Mortevielle -- cgit v1.2.3 From 28eaf257038f6ecc86b4138eb683e3fb29d6ed74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Mar 2012 01:28:57 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/dialogs.cpp | 4 +-- engines/mortevielle/dialogs.h | 1 + engines/mortevielle/mor.cpp | 6 ++-- engines/mortevielle/mor.h | 3 ++ engines/mortevielle/mortevielle.h | 10 ++++++ engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/outtext.h | 3 +- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/speech.cpp | 72 +++++++++++++++++++++++---------------- engines/mortevielle/speech.h | 31 +++++++++++++++-- engines/mortevielle/var_mor.h | 39 --------------------- 11 files changed, 93 insertions(+), 80 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b37e0a53c5..b5cf83162c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -463,9 +463,9 @@ void f3f8::aff50(bool drawAni50Fl) { void f3f8::ani50() { g_crep = animof(1, 1); - pictout(adani, g_crep, 63, 12); + pictout(kAdrAni, g_crep, 63, 12); g_crep = animof(2, 1); - pictout(adani, g_crep, 63, 12); + pictout(kAdrAni, g_crep, 63, 12); g_vm->_largestClearScreen = (g_res == 1); repon(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index c3f33e899c..eaab56d7e2 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -33,6 +33,7 @@ namespace Mortevielle { static const int NUM_LINES = 7; +const int kMaxRect = 14; class Alert { private: diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index c973fabc0a..a19bb2dccd 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -161,12 +161,12 @@ void adzon() { * Returns the offset within the compressed image data resource of the desired image */ int animof(int ouf, int num) { - int nani = g_mem[adani * 16 + 1]; + int nani = g_mem[kAdrAni * 16 + 1]; int aux = num; if (ouf != 1) aux += nani; - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[adani * 16 + (aux << 1)]); + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[kAdrAni * 16 + (aux << 1)]); return animof_result; } @@ -1557,7 +1557,7 @@ void aniof(int ouf, int num) { num = 3; } - int ad = adani; + int ad = kAdrAni; int offset = animof(ouf, num); GfxSurface surface; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 2336bc4022..5f47a17360 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -33,6 +33,9 @@ namespace Mortevielle { +const int kTime1 = 410; +const int kTime2 = 250; + /* NIVEAU 15 */ extern void copcha(); extern bool isMouseIn(rectangle r); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c1ed2ad855..345db2c724 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -78,6 +78,16 @@ enum DataType { #define MORT_DAT "mort.dat" #define GAME_FRAME_DELAY (1000 / 50) +const int asoul = 154; +const int aouvr = 282; +const int achai = 387; +const int acha = 492; +const int arcf = 1272; +const int arep = 1314; +const int amzon = 1650; +const int fleche = 1758; +const int arega = 0; + class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 9d7c38d864..0d3216d370 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -292,7 +292,7 @@ void charani(Common::String filename, int32 skipSize, int length) { f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7314 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; + g_mem[kAdrAni * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; } void taffich() { diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 03523d7086..cd109ffea5 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -33,9 +33,10 @@ namespace Mortevielle { +const int kAdrAni = 0x7314; + extern Common::String deline(int num); extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); - extern void chardes(Common::String filename, int32 passe, int long_); extern void charani(Common::String filename, int32 skipSize, int length); extern void taffich(); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 53da43402e..058a880a41 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -190,7 +190,7 @@ void loadBRUIT5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&g_mem[adbruit5 * 16 + 0], 149 * 128); + f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128); f.close(); } diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 2ad5c0514f..dae6e83ae3 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -48,10 +48,8 @@ void spfrac(int wor) { } void charg_car(int &currWordNumb) { - int wor, int_; - - wor = swap(READ_LE_UINT16(&g_mem[adword + currWordNumb])); - int_ = wor & 0x3f; + int wor = swap(READ_LE_UINT16(&g_mem[kAdrWord + currWordNumb])); + int int_ = wor & 0x3f; if ((int_ >= 0) && (int_ <= 13)) { g_c3._val = int_; @@ -90,7 +88,7 @@ void charg_car(int &currWordNumb) { void entroct(byte o) { - g_mem[adtroct * 16 + g_ptr_oct] = o; + g_mem[kAdrTroct * 16 + g_ptr_oct] = o; ++g_ptr_oct; } @@ -109,16 +107,20 @@ void cctable(tablint &t) { } void regenbruit() { - int i = offsetb3 + 8590; + int i = kOffsetB3 + 8590; int j = 0; do { - g_t_cph[j] = READ_LE_UINT16(&g_mem[adbruit3 + i]); + g_t_cph[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]); i += 2; ++j; - } while (i < offsetb3 + 8790); + } while (i < kOffsetB3 + 8790); } -void charge_son() { +/** + * Load sonmus.mor file + * @remarks Originally called 'charge_son' + */ +void loadMusicSound() { Common::File f; if (!f.open("sonmus.mor")) @@ -126,11 +128,15 @@ void charge_son() { f.read(&g_mem[0x7414 * 16 + 0], 273); - g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[adson * 16], 273); + g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[kAdrNoise * 16], 273); f.close(); } -void charge_phbruit() { +/** + * Load phoneme sound file + * @remarks Originally called 'charge_phbruit' + */ +void loadPhonemeSounds() { Common::File f; if (!f.open("phbrui.mor")) @@ -142,17 +148,21 @@ void charge_phbruit() { f.close(); } -void charge_bruit() { +/** + * Speech function - Load Noise file + * @remarks Originally called 'charge_bruit' + */ +void loadNoise() { Common::File f; int i; if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&g_mem[adbruit * 16 + 0], 250); + f.read(&g_mem[kAdrNoise * 16 + 0], 250); for (i = 0; i <= 19013; ++i) - g_mem[adbruit * 16 + 32000 + i] = g_mem[adbruit5 + i]; - f.read(&g_mem[adbruit1 * 16 + offsetb1], 149); + g_mem[kAdrNoise * 16 + 32000 + i] = g_mem[kAdrNoise5 + i]; + f.read(&g_mem[kAdrNoise1 * 16 + kOffsetB1], 149); f.close(); } @@ -172,12 +182,12 @@ void trait_car() { if (g_c2._code == 6) d3 = g_tabdph[(g_c2._val - 14) << 1]; else - d3 = null; + d3 = kNullValue; if (g_c1._code >= 5) { veracf(g_c2._acc); if (g_c1._code == 9) { entroct(4); - if (d3 == null) + if (d3 == kNullValue) entroct(g_c2._val); else entroct(d3); @@ -189,7 +199,7 @@ void trait_car() { case 0: entroct(0); entroct(g_c2._val); - if (d3 == null) + if (d3 == kNullValue) if (g_c3._code == 9) entroct(2); else @@ -207,14 +217,14 @@ void trait_car() { do { --i; entroct(0); - if (d3 == null) + if (d3 == kNullValue) entroct(g_c2._val); else entroct(d3); entroct(3); } while (i >= 0); } - if (d3 == null) { + if (d3 == kNullValue) { entroct(4); entroct(g_c2._val); entroct(0); @@ -232,14 +242,14 @@ void trait_car() { do { --i; entroct(0); - if (d3 == null) + if (d3 == kNullValue) entroct(g_c2._val); else entroct(d3); entroct(3); } while (i >= 0); } - if (d3 == null) { + if (d3 == kNullValue) { entroct(0); entroct(g_c2._val); entroct(2); @@ -257,7 +267,7 @@ void trait_car() { do { --i; entroct(0); - if (d3 == null) + if (d3 == kNullValue) entroct(g_c2._val); else entroct(d3); @@ -478,7 +488,7 @@ void trait_ph() { int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_mem[adword + currWord], g_t_cph[i]); + WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], g_t_cph[i]); g_ptr_oct = 0; int currWord = 0; @@ -495,8 +505,10 @@ void trait_ph() { entroct(ord('#')); } - - +/** + * Start speech + * @remarks Originally called 'parole' + */ void startSpeech(int rep, int ht, int typ) { int savph[501]; int tempo; @@ -519,13 +531,13 @@ void startSpeech(int rep, int ht, int typ) { cctable(g_tbi); switch (typ) { case 1: - charge_bruit(); - /*if zuul then zzuul(adbruit,0,1095);*/ + loadNoise(); + /*if zuul then zzuul(kAdrNoise,0,1095);*/ regenbruit(); break; case 2: - charge_son(); - charge_phbruit(); + loadMusicSound(); + loadPhonemeSounds(); break; default: break; diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 0e249b8e00..7947ee4472 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -33,15 +33,40 @@ namespace Mortevielle { +const int kAdrNoise = 0x5cb0;/*2C00;*/ +const int kAdrNoise1 = 0x6924; +const int kAdrNoise3 = 0x6ba6;/*3AF6;*/ +const int kAdrNoise5 = 0x3b50; +const int kAdrTroct = 0x406b; +const int kAdrWord = 0x4000; +const int kOffsetB1 = 6; +const int kOffsetB3 = 6; + +const float freq0 = 1.19318e6; +const int kNullValue = 255; +const int kTempoMusic = 71; +const int kTempoNoise = 78; +const int kTempoF = 80; +const int kTempoM = 89; + + +// Useless constants +//const int segdon = 0x6c00; +//const int adbruit2 = 0x6b30;/*3A80;*/ +//const int adson2 = 0x60b0;/*3000;*/ +//const int seg_syst = 0x6fed; +//const int offsetb2 = 4; + + extern void spfrac(int wor); extern void charg_car(int &currWordNumb); extern void entroct(byte o); extern void veracf(byte b); extern void cctable(tablint &t); extern void regenbruit(); -extern void charge_son(); -extern void charge_phbruit(); -extern void charge_bruit(); +extern void loadMusicSound(); +extern void loadPhonemeSounds(); +extern void loadNoise(); extern void trait_car(); extern void rot_chariot(); diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 50c73974d8..9d81a8e16e 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -64,38 +64,8 @@ namespace Mortevielle { /*------------------------- CONSTANTS ----------------------------------*/ /*---------------------------------------------------------------------------*/ -const float freq0 = 1.19318e6; - -const int adani = 0x7314; -const int adbruit = 0x5cb0;/*2C00;*/ -const int adbruit1 = 0x6924; -const int adbruit3 = 0x6ba6;/*3AF6;*/ -const int adbruit5 = 0x3b50; -const int adson = 0x5cb0;/*2C00;*/ -const int adtroct = 0x406b; -const int adword = 0x4000; -const int offsetb1 = 6; -const int offsetb3 = 6; - -// Useless constants -//const int segdon = 0x6c00; -//const int adbruit2 = 0x6b30;/*3A80;*/ -//const int adson2 = 0x60b0;/*3000;*/ -//const int seg_syst = 0x6fed; -//const int offsetb2 = 4; - -const int null = 255; - -const int kTempoMusic = 71; -const int kTempoNoise = 78; -const int kTempoF = 80; -const int kTempoM = 89; - -const int kTime1 = 410; -const int kTime2 = 250; const int maxti = 7975; const int maxtd = 600; -const int kMaxRect = 14; const int kDescriptionStringIndex = 0; // Unused const int kInventoryStringIndex = 186; @@ -107,15 +77,6 @@ const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; const int kSecretPassageQuestionStringIndex = 510; // Unusued? -const int arega = 0; -const int asoul = 154; -const int aouvr = 282; -const int achai = 387; -const int acha = 492; -const int arcf = 1272; -const int arep = 1314; -const int amzon = 1650; -const int fleche = 1758; const int OPCODE_NONE = 0; enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, -- cgit v1.2.3 From aa184ef1b44832365886eaa9e364b03457f8feee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Mar 2012 23:06:33 +0100 Subject: MORTEVIELLE: move couple of functions to menu class, more renaming --- engines/mortevielle/actions.cpp | 30 +++++++++---------- engines/mortevielle/menu.cpp | 50 ++++++++++++++++++++++++++++++++ engines/mortevielle/menu.h | 4 +++ engines/mortevielle/mor.cpp | 58 ++++--------------------------------- engines/mortevielle/mor.h | 3 -- engines/mortevielle/mortevielle.cpp | 20 ++++++++++++- engines/mortevielle/mortevielle.h | 4 +++ engines/mortevielle/ovd1.cpp | 40 ++++++++----------------- engines/mortevielle/ovd1.h | 1 - engines/mortevielle/speech.cpp | 40 +++++++++++++++---------- engines/mortevielle/speech.h | 7 ++--- engines/mortevielle/var_mor.cpp | 3 +- engines/mortevielle/var_mor.h | 7 ++--- 13 files changed, 141 insertions(+), 126 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 49496e8daf..e7e1fddd1a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -61,10 +61,10 @@ void MortevielleEngine::fctMove() { return; if (g_num == 1) { g_s._currPlace = OWN_ROOM; - tmlieu(0); + g_vm->_menu.setDestinationMenuText(OWN_ROOM); } else if (g_num == 7) { g_s._currPlace = ATTIC; - tmlieu(13); + g_vm->_menu.setDestinationMenuText(ATTIC); } else if (g_num != 6) g_s._currPlace = 26; if ((g_num > 1) && (g_num < 6)) @@ -88,7 +88,7 @@ void MortevielleEngine::fctMove() { t1deva(); if (cx == 2) t1neig(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); return; } @@ -97,7 +97,7 @@ void MortevielleEngine::fctMove() { t1deau(); if (cx == 2) t1derr(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); return; } @@ -170,7 +170,7 @@ void MortevielleEngine::fctMove() { if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } /** @@ -201,7 +201,7 @@ void MortevielleEngine::fctTake() { g_s._secretPassageObjectId = 0; if (g_s._currPlace == WELL) g_s._wellObjectId = 0; - unsetSearchMenu(); + g_vm->_menu.unsetSearchMenu(); g_vm->_obpart = false; affrep(); } else { @@ -509,7 +509,7 @@ void MortevielleEngine::fctSearch() { g_cs = 0; g_is = 0; g_vm->_heroSearching = true; - setSearchMenu(); + g_vm->_menu.setSearchMenu(); tsuiv(); } else g_crep = 997; @@ -708,9 +708,9 @@ void MortevielleEngine::fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { g_s._currPlace = SECRET_PASSAGE; - tmlieu(17); + g_vm->_menu.setDestinationMenuText(SECRET_PASSAGE); } else { - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); writepal(14); dessin(0); aniof(1, 2); @@ -1085,7 +1085,7 @@ void MortevielleEngine::fctEat() { g_s._currPlace = DINING_ROOM; g_caff = 10; debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); int j, h, m; updateHour(j, h, m); @@ -1121,7 +1121,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { t1sama(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } else if (g_s._currPlace == LANDING) aldepl(); else if (g_ment == 0) @@ -1165,7 +1165,7 @@ void MortevielleEngine::fctEnter() { g_s._currPlace = g_ment; affrep(); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); g_ment = 0; g_mpers = 0; g_ipers = 0; @@ -1190,7 +1190,7 @@ void MortevielleEngine::fctSleep() { affrep(); afdes(0); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } clsf3(); clearScreenType2(); @@ -1272,7 +1272,7 @@ void MortevielleEngine::fctLeave() { if (g_crep == 0) g_crep = lx; debloc(lx); - tmlieu(lx); + g_vm->_menu.setDestinationMenuText(lx); } } @@ -1518,7 +1518,7 @@ void MortevielleEngine::fctDiscuss() { drawClock(); affrep(); /* chech;*/ - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); clsf3(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6604b1bee5..a28df25634 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -76,6 +76,28 @@ void Menu::setText(int menuId, Common::String name) { } } +/** + * Init destination menu + * @remarks Originally called 'tmlieu' + */ +void Menu::setDestinationMenuText(int roomId) { + Common::String nomp; + + if (roomId == 26) + roomId = LANDING; + + int destinationId = 0; + for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) { + nomp = deline(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); + while (nomp.size() < 20) + nomp += ' '; + setText(_moveMenu[destinationId + 1], nomp); + } + nomp = "* "; + for (int i = 7; i >= destinationId + 1; --i) + setText(_moveMenu[i], nomp); +} + /** * _disable a menu item * @param menuId Hi byte represents menu number, lo byte reprsents item index @@ -516,4 +538,32 @@ void Menu::initMenu() { g_vm->setMouseClick(false); } +/** + * Engine function - Switch action menu to "Search" mode + * @remarks Originally called 'mfoudi' + */ +void Menu::setSearchMenu() { + for (int i = 1; i <= 7; ++i) + disableMenuItem(_moveMenu[i]); + + for (int i = 1; i <= 11; ++i) + disableMenuItem(_actionMenu[i]); + + setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); +} + +/** + * Engine function - Switch action menu from "Search" mode back to normal mode + * @remarks Originally called 'mfouen' + */ +void Menu::unsetSearchMenu() { + setDestinationMenuText(g_s._currPlace); + for (int i = 1; i <= 11; ++i) + enableMenuItem(_actionMenu[i]); + + setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 5672ef7864..adfe35981e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -52,6 +52,7 @@ public: int _moveMenu[8]; void setText(int menuId, Common::String name); + void setDestinationMenuText(int roomId); void disableMenuItem(int menuId); void enableMenuItem(int menuId); void displayMenu(); @@ -60,6 +61,9 @@ public: void eraseMenu(); void mdn(); void initMenu(); + + void setSearchMenu(); + void unsetSearchMenu(); }; enum { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index a19bb2dccd..4e56300074 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1849,26 +1849,6 @@ void tkey1(bool d) { showMouse(); } -void tmlieu(int roomId) { - Common::String nomp; - - if (roomId == 26) - roomId = 15; - - int i = 1; - while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { - nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); - while (nomp.size() < 20) - nomp += ' '; - g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); - ++i; - } - nomp = "* "; - for (int cx = 7; cx >= i; --cx) - g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); -} - - /* NIVEAU 7 */ void tlu(int af, int ob) { g_caff = 32; @@ -1886,19 +1866,6 @@ void affrep() { g_crep = g_s._currPlace; } -/** - * Engine function - Switch action menu from "Search" mode back to normal mode - * @remarks Originally called 'mfouen' - */ -void unsetSearchMenu() { - tmlieu(g_s._currPlace); - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.enableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); -} - /* NIVEAU 6 */ void tperd() { @@ -1906,7 +1873,7 @@ void tperd() { g_ment = 0; g_iouv = 0; g_mchai = 0; - unsetSearchMenu(); + g_vm->_menu.unsetSearchMenu(); if (!g_vm->_blo) t11(21); @@ -2033,22 +2000,7 @@ void endSearch() { g_vm->_obpart = false; g_cs = 0; g_is = 0; - unsetSearchMenu(); -} - -/** - * Engine function - Switch action menu to "Search" mode - * @remarks Originally called 'mfoudi' - */ -void setSearchMenu() { - for (int cx = 1; cx <= 7; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); - - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.disableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); + g_vm->_menu.unsetSearchMenu(); } void mennor() { @@ -2189,7 +2141,7 @@ L1: else g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); - tmlieu(15); + g_vm->_menu.setDestinationMenuText(LANDING); int cx = convertBitIndexToCharacterIndex(g_ipers); g_caff = 69 + cx; g_crep = g_caff; @@ -2369,7 +2321,7 @@ void treg(int ob) { } else { g_vm->_obpart = true; g_crep = g_caff + 400; - setSearchMenu(); + g_vm->_menu.setSearchMenu(); } } @@ -2495,7 +2447,7 @@ void MortevielleEngine::gameLoaded() { repon(2, g_crep); clsf3(); _endGame = false; - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); modinv(); if (g_s._selectedObjectId != 0) modobj(g_s._selectedObjectId + 400); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 5f47a17360..269a566b4b 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -142,11 +142,9 @@ extern void fenat(char ans); /* NIVEAU 8 */ extern void afdes(int ad); extern void tkey1(bool d); -extern void tmlieu(int roomId); /* NIVEAU 7 */ extern void tlu(int af, int ob); extern void affrep(); -extern void unsetSearchMenu(); /* NIVEAU 6 */ extern void tperd(); extern void tsort(); @@ -156,7 +154,6 @@ extern void st1sama(); extern void modinv(); extern void sparl(float adr, float rep); extern void endSearch(); -extern void setSearchMenu(); extern void mennor(); extern void premtet(); /* NIVEAU 5 */ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1ef69a6b5b..b328271fc9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -181,7 +181,7 @@ Common::ErrorCode MortevielleEngine::initialise() { init_nbrepm(); initMouse(); - init_lieu(); + loadPlaces(); _soundOff = false; _largestClearScreen = false; @@ -677,4 +677,22 @@ void MortevielleEngine::handleAction() { } } +/** + * Engine function - Init Places + * @remarks Originally called 'init_lieu' + */ +void MortevielleEngine::loadPlaces() { + Common::File f; + + if (!f.open("MXX.mor")) + error("Missing file - MXX.mor"); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 25; ++j) + _v_lieu[i][j] = f.readByte(); + } + + f.close(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 345db2c724..84a739ea03 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -146,6 +146,8 @@ public: int _c_zzz; int ptr_word; + byte _v_lieu[7][25]; + ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; @@ -215,6 +217,8 @@ public: void fctDiscuss(); void fctSmell(); void fctScratch(); + + void loadPlaces(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 058a880a41..b81c817edf 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -41,16 +41,14 @@ namespace Mortevielle { void charpal() { - Common::File f; // tabdb records - Common::File ft; // tfxx - Common::File fb; // byte values + Common::File f; byte b; - if (!ft.open("fxx.mor")) + if (!f.open("fxx.mor")) error("Missing file - fxx.mor"); for (int i = 0; i < 108; ++i) - g_l[i] = ft.readSint16LE(); - ft.close(); + g_l[i] = f.readSint16LE(); + f.close(); if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); @@ -62,29 +60,30 @@ void charpal() { } f.close(); - if (!fb.open("cxx.mor")) + if (!f.open("cxx.mor")) error("Missing file - cxx.mor"); for (int j = 0; j <= 90; ++j) { - g_palcga[j]._p = fb.readByte(); + g_palcga[j]._p = f.readByte(); for (int i = 0; i <= 15; ++i) { nhom &with = g_palcga[j]._a[i]; - b = fb.readByte(); + b = f.readByte(); with._id = (uint)b >> 4; with._hom[0] = ((uint)b >> 2) & 3; with._hom[1] = b & 3; } } + g_palcga[10]._a[9] = g_palcga[10]._a[5]; for (int j = 0; j <= 14; ++j) { - g_tpt[j]._tax = fb.readByte(); - g_tpt[j]._tay = fb.readByte(); + g_tpt[j]._tax = f.readByte(); + g_tpt[j]._tay = f.readByte(); for (int i = 1; i <= 20; ++i) for (int k = 1; k <= 20; ++k) - g_tpt[j]._des[i][k] = fb.readByte(); + g_tpt[j]._des[i][k] = f.readByte(); } - fb.close(); + f.close(); } void chartex() { @@ -138,21 +137,6 @@ void dialpre() { int_m = true; } -void init_lieu() { - Common::File f; - - if (!f.open("MXX.mor")) - error("Missing file - MXX.mor"); - - for (int i = 1; i < 8; ++i) { - for (int j = 0; j < 25; ++j) - g_v_lieu[i][j] = f.readByte(); - } - - f.close(); -} - - void music() { if (g_vm->_soundOff) return; diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index ef9f401232..90f9c0d235 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -33,7 +33,6 @@ namespace Mortevielle { extern void charpal(); extern void chartex(); extern void dialpre(); -extern void init_lieu(); extern void music(); extern void loadBRUIT5(); extern void loadCFIEC(); diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index dae6e83ae3..2fb933b74f 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -49,7 +49,7 @@ void spfrac(int wor) { void charg_car(int &currWordNumb) { int wor = swap(READ_LE_UINT16(&g_mem[kAdrWord + currWordNumb])); - int int_ = wor & 0x3f; + int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { g_c3._val = int_; @@ -464,43 +464,53 @@ void trait_car() { } // switch c2.code } -void rot_chariot() { +/** + * Make the queue evolve by 1 value + * @remarks Originally called 'rot_chariot' + */ +void moveQueue() { g_c1 = g_c2; g_c2 = g_c3; g_c3._val = 32; g_c3._code = 9; } -void init_chariot() { +/** + * initialize the queue + * @remarks Originally called 'init_chariot' + */ +void initQueue() { g_c3._rep = 0; g_c3._freq = 0; g_c3._acc = 0; - rot_chariot(); - rot_chariot(); + moveQueue(); + moveQueue(); } - -void trait_ph() { +/** + * Handle a phoneme + * @remarks Originally called 'trait_ph' + */ +void handlePhoneme() { const int deca[3] = {300, 30, 40}; - int ptr_tcph = g_num_ph - 1; - int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; - int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; + int startPos = swap(g_t_cph[g_phonemeNumb - 1]) + deca[g_typlec]; + int endPos = swap(g_t_cph[g_phonemeNumb]) + deca[g_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], g_t_cph[i]); g_ptr_oct = 0; int currWord = 0; - init_chariot(); + initQueue(); do { - rot_chariot(); + moveQueue(); charg_car(currWord); trait_car(); } while (currWord < wordCount); - rot_chariot(); + moveQueue(); trait_car(); entroct(ord('#')); } @@ -516,7 +526,7 @@ void startSpeech(int rep, int ht, int typ) { if (g_vm->_soundOff) return; - g_num_ph = rep; + g_phonemeNumb = rep; g_haut = ht; g_typlec = typ; if (g_typlec != 0) { @@ -542,7 +552,7 @@ void startSpeech(int rep, int ht, int typ) { default: break; } - trait_ph(); + handlePhoneme(); g_vm->_soundManager.litph(g_tbi, typ, tempo); if (g_typlec != 0) for (int i = 0; i <= 500; ++i) { diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 7947ee4472..03caa83afa 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -49,7 +49,6 @@ const int kTempoNoise = 78; const int kTempoF = 80; const int kTempoM = 89; - // Useless constants //const int segdon = 0x6c00; //const int adbruit2 = 0x6b30;/*3A80;*/ @@ -69,9 +68,9 @@ extern void loadPhonemeSounds(); extern void loadNoise(); extern void trait_car(); -extern void rot_chariot(); -extern void init_chariot(); -extern void trait_ph(); +extern void moveQueue(); +extern void initQueue(); +extern void handlePhoneme(); extern void startSpeech(int rep, int ht, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 62f983458f..78ff6ef0bd 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -119,7 +119,7 @@ int g_x, g_perdep, g_prebru, g_typlec, - g_num_ph, + g_phonemeNumb, g_numpal, g_ptr_oct, g_k_tempo; @@ -142,7 +142,6 @@ byte g_lettres[7][24]; uint16 g_t_mot[maxti + 1]; int g_tay_tchar; ind g_t_rec[maxtd + 1]; -byte g_v_lieu[8][25]; int g_l[108]; int g_tbi[256]; chariot g_c1, g_c2, g_c3; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 9d81a8e16e..26131c7e66 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -224,13 +224,13 @@ extern int g_x, g_yprec, g_perdep, g_prebru, - g_typlec, - g_num_ph, + g_typlec, // Speech + g_phonemeNumb, // Speech g_numpal, g_ptr_oct, g_k_tempo; -extern int g_t_cph[6401]; +extern int g_t_cph[6401]; // Speech extern byte g_tabdon[4001]; extern Common::String g_hintPctMessage; // gives the pct of hints found @@ -248,7 +248,6 @@ extern byte g_lettres[7][24]; extern uint16 g_t_mot[maxti + 1]; extern int g_tay_tchar; extern ind g_t_rec[maxtd + 1]; -extern byte g_v_lieu[8][25]; extern int g_l[108]; extern int g_tbi[256]; extern chariot g_c1, g_c2, g_c3; -- cgit v1.2.3 From 8bb6e92bc9ff3a898668b99a3edbc5eefa752064 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Mar 2012 23:21:34 +0100 Subject: MORTEVIELLE: Remove extre usage of g_vm --- engines/mortevielle/mortevielle.cpp | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b328271fc9..cc3ee98fb8 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -150,7 +150,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - g_vm->_currGraphicalDevice = MODE_EGA; + _currGraphicalDevice = MODE_EGA; g_res = 2; _txxFileFl = false; @@ -171,13 +171,13 @@ Common::ErrorCode MortevielleEngine::initialise() { // Setup the mouse cursor initMouse(); - g_vm->_currGraphicalDevice = MODE_EGA; - g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice; + _currGraphicalDevice = MODE_EGA; + _newGraphicalDevice = _currGraphicalDevice; charpal(); loadCFIPH(); loadCFIEC(); zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); - g_vm->_c_zzz = 1; + _c_zzz = 1; init_nbrepm(); initMouse(); @@ -187,10 +187,10 @@ Common::ErrorCode MortevielleEngine::initialise() { teskbd(); dialpre(); - g_vm->_newGraphicalDevice = g_vm->_currGraphicalDevice; + _newGraphicalDevice = _currGraphicalDevice; teskbd(); - if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) - g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; + if (_newGraphicalDevice != _currGraphicalDevice) + _currGraphicalDevice = _newGraphicalDevice; hirs(); g_ades = 0x7000; @@ -294,7 +294,7 @@ bool MortevielleEngine::keyPressed() { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - g_vm->_screenSurface.updateScreen(); + _screenSurface.updateScreen(); } // Delay briefly to keep CPU usage down @@ -466,7 +466,7 @@ void MortevielleEngine::delay(int amount) { while (g_system->getMillis() < endTime) { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - g_vm->_screenSurface.updateScreen(); + _screenSurface.updateScreen(); } g_system->delayMillis(10); @@ -530,7 +530,7 @@ void MortevielleEngine::mainGame() { if (_reloadCFIEC) loadCFIEC(); - for (g_crep = 1; g_crep <= g_vm->_c_zzz; ++g_crep) + for (g_crep = 1; g_crep <= _c_zzz; ++g_crep) zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); @@ -582,8 +582,8 @@ void MortevielleEngine::handleAction() { oo = false; g_ctrm = 0; if (!_keyPressedEsc) { - g_vm->_menu.drawMenu(); - g_vm->_menu._menuDisplayed = true; + _menu.drawMenu(); + _menu._menuDisplayed = true; temps = 0; g_key = 0; funct = false; @@ -591,33 +591,33 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { - g_vm->_menu.mdn(); + _menu.mdn(); tinke(); moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; - } while (!((g_vm->_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); + } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; - g_vm->_menu.eraseMenu(); - g_vm->_menu._menuDisplayed = false; + _menu.eraseMenu(); + _menu._menuDisplayed = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (g_vm->_menu._menuSelected && (g_msg[3] == MENU_SAVE)) { + if (_menu._menuSelected && (g_msg[3] == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7); - g_vm->_savegameManager.saveGame(g_msg[4] & 7, saveName); + _savegameManager.saveGame(g_msg[4] & 7, saveName); } - if (g_vm->_menu._menuSelected && (g_msg[3] == MENU_LOAD)) - g_vm->_savegameManager.loadGame((g_msg[4] & 7) - 1); + if (_menu._menuSelected && (g_msg[3] == MENU_LOAD)) + _savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(g_hintPctMessage, 1); return; } else if (inkey == '\77') { if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { g_msg[4] = g_mnumo; - ecr3(g_vm->getEngineString(S_IDEM)); + ecr3(getEngineString(S_IDEM)); } else return; } else if (inkey == '\104') { @@ -641,7 +641,7 @@ void MortevielleEngine::handleAction() { if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) g_mnumo = g_msg[4]; if (!_anyone) { - if ((g_vm->_heroSearching) || (_obpart)) { + if ((_heroSearching) || (_obpart)) { if (y_s < 12) return; @@ -663,14 +663,14 @@ void MortevielleEngine::handleAction() { if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); - if (g_vm->_okdes) { - g_vm->_okdes = false; + if (_okdes) { + _okdes = false; dessin(0); } - if ((!g_vm->_syn) || (_col)) + if ((!_syn) || (_col)) repon(2, g_crep); } - } while (g_vm->_syn); + } while (_syn); if (g_ctrm != 0) tctrm(); } -- cgit v1.2.3 From af9af49c343198cefa6da953da14ef5a8cecf0dd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Mar 2012 01:26:02 +0100 Subject: MORTEVIELLE: get rid of several magic values, introduce SpeechManager, some more renaming --- engines/mortevielle/actions.cpp | 34 ++-- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/mor.cpp | 303 +++++++++++++++++++----------------- engines/mortevielle/mor.h | 20 +-- engines/mortevielle/mortevielle.cpp | 4 +- engines/mortevielle/mortevielle.h | 3 +- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/speech.cpp | 28 ++-- engines/mortevielle/speech.h | 32 ++-- engines/mortevielle/var_mor.h | 4 +- 10 files changed, 228 insertions(+), 204 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index e7e1fddd1a..b007966ae2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -615,7 +615,7 @@ void MortevielleEngine::fctOpen() { || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - startSpeech(7, 9, 1); + g_vm->_speechManager.startSpeech(7, 9, 1); } g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); @@ -683,7 +683,7 @@ void MortevielleEngine::fctPlace() { aniof(1, 1); repon(2, 165); maivid(); - startSpeech(6, -9, 1); + g_vm->_speechManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); @@ -694,9 +694,9 @@ void MortevielleEngine::fctPlace() { bool enterPassageFl = KnowledgeCheck::show(); hideMouse(); hirs(); - dessine_rouleau(); + drawRightFrame(); clearScreenType2(); - clsf3(); + clearScreenType3(); showMouse(); tinke(); drawClock(); @@ -784,7 +784,7 @@ void MortevielleEngine::fctTurn() { g_crep = 997; if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { repon(2, 167); - startSpeech(7, 9, 1); + g_vm->_speechManager.startSpeech(7, 9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) g_vm->_endGame = true; @@ -793,8 +793,8 @@ void MortevielleEngine::fctTurn() { } if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { repon(2, 175); - clsf3(); - startSpeech(6, -9, 1); + clearScreenType3(); + g_vm->_speechManager.startSpeech(6, -9, 1); int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer == 1) { g_s._currPlace = CRYPT; @@ -920,7 +920,7 @@ void MortevielleEngine::fctKnock() { if (g_s._currPlace == 26) { int rand = (getRandomNumber(0, 8)) - 4; - startSpeech(11, rand, 1); + g_vm->_speechManager.startSpeech(11, rand, 1); int p; ecfren(p, rand, g_s._faithScore, g_ment); int l = g_ment; @@ -1138,7 +1138,7 @@ void MortevielleEngine::fctEnter() { g_crep = 179; else { g_x = (getRandomNumber(0, 10)) - 5; - startSpeech(7, g_x, 1); + g_vm->_speechManager.startSpeech(7, g_x, 1); aniof(1, 1); g_x = convertBitIndexToCharacterIndex(z); @@ -1159,7 +1159,7 @@ void MortevielleEngine::fctEnter() { } } else { g_x = (getRandomNumber(0, 10)) - 5; - startSpeech(7, g_x, 1); + _speechManager.startSpeech(7, g_x, 1); aniof(1, 1); g_s._currPlace = g_ment; @@ -1192,7 +1192,7 @@ void MortevielleEngine::fctSleep() { debloc(g_s._currPlace); g_vm->_menu.setDestinationMenuText(g_s._currPlace); } - clsf3(); + clearScreenType3(); clearScreenType2(); ecrf2(); ecr2(g_vm->getEngineString(S_WANT_TO_WAKE_UP)); @@ -1282,7 +1282,7 @@ void MortevielleEngine::fctLeave() { */ void MortevielleEngine::fctWait() { g_mpers = 0; - clsf3(); + clearScreenType3(); int answer; do { @@ -1511,7 +1511,7 @@ void MortevielleEngine::fctDiscuss() { g_ctrm = 0; hideMouse(); hirs(); - dessine_rouleau(); + drawRightFrame(); showMouse(); showPeoplePresent(g_ipers); tinke(); @@ -1519,7 +1519,7 @@ void MortevielleEngine::fctDiscuss() { affrep(); /* chech;*/ g_vm->_menu.setDestinationMenuText(g_s._currPlace); - clsf3(); + clearScreenType3(); } /** @@ -1562,9 +1562,9 @@ void MortevielleEngine::endGame() { _quitGame = true; tlu(13, 152); maivid(); - clsf1(); + clearScreenType1(); clearScreenType2(); - clsf3(); + clearScreenType3(); repon(9, 1509); tkey1(false); hideMouse(); @@ -1574,7 +1574,7 @@ void MortevielleEngine::endGame() { premtet(); sparl(0, 141); showMouse(); - clsf1(); + clearScreenType1(); repon(9, 1509); repon(2, 142); tkey1(false); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b5cf83162c..eabeae2b79 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -424,7 +424,7 @@ void f3f8::draw() { void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { - startSpeech(SpeechNum, 0, 0); + g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); waitForF3F8(g_key); CHECK_QUIT; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4e56300074..9adf3357ee 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -230,7 +230,11 @@ void dessine(int ad, int x, int y) { showMouse(); } -void dessine_rouleau() { +/** + * Draw right frame + * @remarks Originally called 'dessine_rouleau' + */ +void drawRightFrame() { writepal(89); if (g_vm->_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; @@ -274,10 +278,13 @@ void ecrf1() { g_vm->_screenSurface.drawBox(0, 11, 512, 163, 15); } -void clsf1() { +/** + * Engine function - Clear Screen - Type 1 + * @remarks Originally called 'clsf1' + */ +void clearScreenType1() { hideMouse(); g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - showMouse(); } @@ -298,6 +305,50 @@ void clearScreenType2() { showMouse(); } +/** + * Engine function - Clear Screen - Type 3 + * @remarks Originally called 'clsf3' + */ +void clearScreenType3() { + hideMouse(); + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); + g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); + showMouse(); +} + +/** + * Engine function - Clear Screen - Type 10 + * @remarks Originally called 'clsf10' + */ +void clearScreenType10() { + int co, cod; + Common::String st; + + hideMouse(); + if (g_res == 1) { + co = 634; + cod = 534; + } else { + co = 600; + cod = 544; + } + g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); + if (g_s._faithScore < 33) + st = g_vm->getEngineString(S_COOL); + else if (g_s._faithScore < 66) + st = g_vm->getEngineString(S_LOURDE); + else if (g_s._faithScore > 65) + st = g_vm->getEngineString(S_MALSAINE); + + co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); + g_vm->_screenSurface.putxy(co, 92); + g_vm->_screenSurface.drawString(st, 4); + + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); + /* rempli(69,12,32,5,255);*/ + showMouse(); +} + void ecrf2() { setTextColor(5); } @@ -326,15 +377,8 @@ void ecr2(Common::String str_) { } } -void clsf3() { - hideMouse(); - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); - showMouse(); -} - void ecr3(Common::String text) { - clsf3(); + clearScreenType3(); g_vm->_screenSurface.putxy(8, 192); g_vm->_screenSurface.drawString(text, 5); } @@ -348,35 +392,6 @@ void ecrf7() { setTextColor(4); } -void clsf10() { - int co, cod; - Common::String st; - - hideMouse(); - if (g_res == 1) { - co = 634; - cod = 534; - } else { - co = 600; - cod = 544; - } - g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s._faithScore < 33) - st = g_vm->getEngineString(S_COOL); - else if (g_s._faithScore < 66) - st = g_vm->getEngineString(S_LOURDE); - else if (g_s._faithScore > 65) - st = g_vm->getEngineString(S_MALSAINE); - - co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); - g_vm->_screenSurface.putxy(co, 92); - g_vm->_screenSurface.drawString(st, 4); - - g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - /* rempli(69,12,32,5,255);*/ - showMouse(); -} - void stop() { hirs(); g_vm->_currGraphicalDevice = MODE_AMSTRAD1512; @@ -504,34 +519,34 @@ void repon(int f, int m) { } } -void t5(int cx) { - if (cx == 10) +void t5(int roomId) { + if (roomId == DINING_ROOM) g_vm->_blo = false; - if (cx != 1) { + if (roomId != GREEN_ROOM) { g_vm->_roomPresenceLuc = false; g_vm->_roomPresenceIda = false; } - if (cx != 2) + if (roomId != PURPLE_ROOM) g_vm->_purpleRoomPresenceLeo = false; - if (cx != 4) { + if (roomId != DARKBLUE_ROOM) { g_vm->_roomPresenceGuy = false; g_vm->_roomPresenceEva = false; } - if (cx != 5) + if (roomId != BLUE_ROOM) g_vm->_roomPresenceMax = false; - if (cx != 6) + if (roomId != RED_ROOM) g_vm->_roomPresenceBob = false; - if (cx != 8) + if (roomId != GREEN_ROOM2) g_vm->_roomPresencePat = false; - if (cx != 3) + if (roomId != TOILETS) g_vm->_toiletsPresenceBobMax = false; - if (cx != 7) + if (roomId != BATHROOM) g_vm->_bathRoomPresenceBobMax = false; - if (cx != 9) + if (roomId != ROOM9) g_vm->_room9PresenceLeo = false; } @@ -545,7 +560,7 @@ void showPeoplePresent(int per) { for (cx = 1; cx <= 8; ++cx) g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cx]); - clsf10(); + clearScreenType10(); if ((per & 128) == 128) { g_vm->_screenSurface.putxy(xp, 24); g_vm->_screenSurface.drawString("LEO", 4); @@ -740,7 +755,7 @@ void displayAloneText() { Common::String sAre = g_vm->getEngineString(S_ARE); Common::String sAlone = g_vm->getEngineString(S_ALONE); - clsf10(); + clearScreenType10(); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sYou) / 2), 30); g_vm->_screenSurface.drawString(sYou, 4); g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAre) / 2), 50); @@ -814,12 +829,12 @@ void drawClock() { * NIVEAU 11 * *************/ -void debloc(int l) { +void debloc(int roomId) { g_num = 0; g_x = 0; g_y = 0; - if ((l != 26) && (l != 15)) - t5(l); + if ((roomId != 26) && (roomId != LANDING)) + t5(roomId); g_mpers = g_ipers; } @@ -1145,27 +1160,29 @@ void getKnockAnswer() { } } -int nouvp(int l) { +int nouvp(int roomId) { int bitIndex = 0; - if (l == 1) { + if (roomId == GREEN_ROOM) { if (g_vm->_roomPresenceLuc) bitIndex = 4; // LUC if (g_vm->_roomPresenceIda) bitIndex = 2; // IDA - } else if (((l == 2) && (g_vm->_purpleRoomPresenceLeo)) || ((l == 9) && (g_vm->_room9PresenceLeo))) + } else if ( ((roomId == PURPLE_ROOM) && (g_vm->_purpleRoomPresenceLeo)) + || ((roomId == ROOM9) && (g_vm->_room9PresenceLeo))) bitIndex = 128; // LEO - else if (l == 4) { + else if (roomId == DARKBLUE_ROOM) { if (g_vm->_roomPresenceGuy) bitIndex = 32; // GUY if (g_vm->_roomPresenceEva) bitIndex = 16; // EVA - } else if ((l == 5) && (g_vm->_roomPresenceMax)) + } else if ((roomId == BLUE_ROOM) && (g_vm->_roomPresenceMax)) bitIndex = 1; // MAX - else if ((l == 6) && (g_vm->_roomPresenceBob)) + else if ((roomId == RED_ROOM) && (g_vm->_roomPresenceBob)) bitIndex = 8; // BOB - else if ((l == 8) && (g_vm->_roomPresencePat)) + else if ((roomId == GREEN_ROOM2) && (g_vm->_roomPresencePat)) bitIndex = 64; // PAT - else if (((l == 3) && (g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (g_vm->_bathRoomPresenceBobMax))) + else if ( ((roomId == TOILETS) && (g_vm->_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (g_vm->_bathRoomPresenceBobMax)) ) bitIndex = 9; // BOB + MAX if (bitIndex != 9) @@ -1202,24 +1219,28 @@ int convertBitIndexToCharacterIndex(int bitIndex) { } -void ecfren(int &p, int &rand, int cf, int l) { - if (l == 0) +void ecfren(int &p, int &rand, int cf, int roomId) { + if (roomId == OWN_ROOM) displayAloneText(); p = -500; rand = 0; - if (((l == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((l == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva))) + if ( ((roomId == GREEN_ROOM) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) + || ((roomId == DARKBLUE_ROOM) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva)) ) p = getPresenceStatsGreenRoom(); - if ((l == 2) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo)) + if ((roomId == PURPLE_ROOM) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo)) p = getPresenceStatsPurpleRoom(); - if (((l == 3) && (!g_vm->_toiletsPresenceBobMax)) || ((l == 7) && (!g_vm->_bathRoomPresenceBobMax))) + if ( ((roomId == TOILETS) && (!g_vm->_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (!g_vm->_bathRoomPresenceBobMax)) ) p = getPresenceStatsToilets(); - if ((l == 5) && (!g_vm->_roomPresenceMax)) + if ((roomId == BLUE_ROOM) && (!g_vm->_roomPresenceMax)) p = getPresenceStatsBlueRoom(); - if (((l == 6) && (!g_vm->_roomPresenceBob)) || ((l == 8) && (!g_vm->_roomPresencePat))) + if ( ((roomId == RED_ROOM) && (!g_vm->_roomPresenceBob)) + || ((roomId == GREEN_ROOM2) && (!g_vm->_roomPresencePat))) p = getPresenceStatsRedRoom(); - if ((l == 9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo)) + if ((roomId == ROOM9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo)) p = 10; - if (((l == 2) && (g_vm->_room9PresenceLeo)) || ((l == 9) && (g_vm->_purpleRoomPresenceLeo))) + if ( ((roomId == PURPLE_ROOM) && (g_vm->_room9PresenceLeo)) + || ((roomId == ROOM9) && (g_vm->_purpleRoomPresenceLeo))) p = -400; if (p != -500) { p += cf; @@ -1227,33 +1248,33 @@ void ecfren(int &p, int &rand, int cf, int l) { } } -void becfren(int l) { - if ((l == 1) || (l == 4)) { +void becfren(int roomId) { + if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { int rand = getRandomNumber(1, 2); - if (l == 1) { + if (roomId == GREEN_ROOM) { if (rand == 1) g_vm->_roomPresenceLuc = true; else g_vm->_roomPresenceIda = true; - } else { // l == 4 + } else { // roomId == DARKBLUE_ROOM if (rand == 1) g_vm->_roomPresenceGuy = true; else g_vm->_roomPresenceEva = true; } - } else if (l == 2) + } else if (roomId == PURPLE_ROOM) g_vm->_purpleRoomPresenceLeo = true; - else if (l == 3) + else if (roomId == TOILETS) g_vm->_toiletsPresenceBobMax = true; - else if (l == 5) + else if (roomId == BLUE_ROOM) g_vm->_roomPresenceMax = true; - else if (l == 6) + else if (roomId == RED_ROOM) g_vm->_roomPresenceBob = true; - else if (l == 7) + else if (roomId == BATHROOM) g_vm->_bathRoomPresenceBobMax = true; - else if (l == 8) + else if (roomId == GREEN_ROOM2) g_vm->_roomPresencePat = true; - else if (l == 9) + else if (roomId == ROOM9) g_vm->_room9PresenceLeo = true; } @@ -1289,31 +1310,31 @@ void resetVariables() { g_s._faithScore = getRandomNumber(4, 10); g_s._currPlace = MANOR_FRONT; - for (int cx = 2; cx <= 6; ++cx) - g_s._sjer[cx] = chr(0); + for (int i = 2; i <= 6; ++i) + g_s._sjer[i] = chr(0); g_s._sjer[1] = chr(113); g_s._heure = chr(20); - for (int cx = 1; cx <= 10; ++cx) - g_s._pourc[cx] = ' '; + for (int i = 1; i <= 10; ++i) + g_s._pourc[i] = ' '; - for (int cx = 1; cx <= 6; ++cx) - g_s._teauto[cx] = '*'; + for (int i = 1; i <= 6; ++i) + g_s._teauto[i] = '*'; - for (int cx = 7; cx <= 9; ++cx) - g_s._teauto[cx] = ' '; + for (int i = 7; i <= 9; ++i) + g_s._teauto[i] = ' '; - for (int cx = 10; cx <= 28; ++cx) - g_s._teauto[cx] = '*'; + for (int i = 10; i <= 28; ++i) + g_s._teauto[i] = '*'; - for (int cx = 29; cx <= 42; ++cx) - g_s._teauto[cx] = ' '; + for (int i = 29; i <= 42; ++i) + g_s._teauto[i] = ' '; g_s._teauto[33] = '*'; - for (int cx = 1; cx <= 8; ++cx) - g_nbrep[cx] = 0; + for (int i = 1; i <= 8; ++i) + g_nbrep[i] = 0; init_nbrepm(); } @@ -1460,13 +1481,13 @@ void pl20(int cf) { setPresenceChapel(h); } -int t11(int l11) { +int t11(int roomId) { int retVal = 0; int p, rand; - ecfren(p, rand, g_s._faithScore, l11); - g_li = l11; - if ((l11 > 0) && (l11 < 10)) { + ecfren(p, rand, g_s._faithScore, roomId); + g_li = roomId; + if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { if (rand > p) { displayAloneText(); @@ -1479,22 +1500,22 @@ int t11(int l11) { retVal = nouvp(g_li); } - if (l11 > 9) { - if ((l11 > 15) && (l11 != 20) && (l11 != 26)) + if (roomId > ROOM9) { + if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != 26)) displayAloneText(); else { int h = 0; - if (l11 == 10) + if (roomId == DINING_ROOM) p = getPresenceStatsDiningRoom(h); - else if (l11 == 11) + else if (roomId == BUREAU) p = getPresenceStatsBureau(h); - else if (l11 == 12) + else if (roomId == KITCHEN) p = getPresenceStatsKitchen(); - else if ((l11 == 13) || (l11 == 14)) + else if ((roomId == ATTIC) || (roomId == CELLAR)) p = getPresenceStatsAttic(); - else if ((l11 == 15) || (l11 == 26)) + else if ((roomId == LANDING) || (roomId == 26)) p = getPresenceStatsLanding(); - else if (l11 == 20) + else if (roomId == CHAPEL) p = getPresenceStatsChapel(h); p += g_s._faithScore; rand = getRandomNumber(1, 100); @@ -1502,15 +1523,15 @@ int t11(int l11) { displayAloneText(); retVal = 0; } else { - if (l11 == 10) + if (roomId == DINING_ROOM) p = setPresenceDiningRoom(h); - else if (l11 == 11) + else if (roomId == BUREAU) p = setPresenceBureau(h); - else if ((l11 == 12) || (l11 == 13) || (l11 == 14)) + else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) p = setPresenceKitchen(); - else if ((l11 == 15) || (l11 == 26)) + else if ((roomId == LANDING) || (roomId == 26)) p = setPresenceLanding(); - else if (l11 == 20) + else if (roomId == CHAPEL) p = setPresenceChapel(h); retVal = p; } @@ -1524,16 +1545,16 @@ void cavegre() { g_s._faithScore += 2; if (g_s._faithScore > 69) g_s._faithScore += (g_s._faithScore / 10); - clsf3(); + clearScreenType3(); ecrf2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(2, rand, 1); + g_vm->_speechManager.startSpeech(2, rand, 1); // The original was doing here a useless loop. // It has been removed - clsf3(); + clearScreenType3(); displayAloneText(); } @@ -1572,35 +1593,35 @@ void musique(int so) { /* musik(0) */ ; } else if ((g_prebru == 0) && (!g_s._ipre)) { - startSpeech(10, 1, 1); + g_vm->_speechManager.startSpeech(10, 1, 1); ++g_prebru; } else { bool i = false; if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { if (getRandomNumber(1, 3) == 2) { - startSpeech(9, getRandomNumber(2, 4), 1); + g_vm->_speechManager.startSpeech(9, getRandomNumber(2, 4), 1); i = true; } } else if (g_s._currPlace == CHAPEL) { if (getRandomNumber(1, 2) == 1) { - startSpeech(8, 1, 1); + g_vm->_speechManager.startSpeech(8, 1, 1); i = true; } } else if (g_s._currPlace == WELL) { if (getRandomNumber(1, 2) == 2) { - startSpeech(12, 1, 1); + g_vm->_speechManager.startSpeech(12, 1, 1); i = true; } } else if (g_s._currPlace == 23) { - startSpeech(13, 1, 1); + g_vm->_speechManager.startSpeech(13, 1, 1); i = true; } if (!i) - startSpeech(getRandomNumber(1, 17), 1, 2); + g_vm->_speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1609,7 +1630,7 @@ void dessin(int ad) { if (ad != 0) dessine(g_ades, ((ad % 160) * 2), (ad / 160)); else { - clsf1(); + clearScreenType1(); if (g_caff > 99) { dessine(g_ades, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box @@ -1771,12 +1792,12 @@ void tinke() { g_vm->_brt = true; g_hdb = readclock(); if (getRandomNumber(1, 5) < 5) { - clsf3(); + clearScreenType3(); ecrf2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(1, rand, 1); - clsf3(); + g_vm->_speechManager.startSpeech(1, rand, 1); + clearScreenType3(); } } } @@ -1875,14 +1896,14 @@ void tperd() { g_mchai = 0; g_vm->_menu.unsetSearchMenu(); if (!g_vm->_blo) - t11(21); + t11(MANOR_FRONT); g_vm->_loseGame = true; - clsf1(); + clearScreenType1(); g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); repon(9, g_crep); clearScreenType2(); - clsf3(); + clearScreenType3(); g_vm->_col = false; g_vm->_syn = false; g_vm->_okdes = false; @@ -1983,7 +2004,7 @@ void sparl(float adr, float rep) { key = 0; do { - startSpeech(repint, haut[g_caff - 69], 0); + g_vm->_speechManager.startSpeech(repint, haut[g_caff - 69], 0); f3f8::waitForF3F8(key); CHECK_QUIT; } while (key != 66); @@ -2064,14 +2085,14 @@ void t1sama() { //Entering manor hirs(); premtet(); sparl(0, 140); - dessine_rouleau(); + drawRightFrame(); drawClock(); showMouse(); g_s._currPlace = OWN_ROOM; affrep(); - t5(10); + t5(DINING_ROOM); if (!g_vm->_blo) - minute = t11(0); + minute = t11(OWN_ROOM); g_ipers = 0; g_mpers = 0; g_s._ipre = true; @@ -2130,9 +2151,9 @@ L1: g_crep = 138; repon(2, g_crep); if (g_crep == 138) - startSpeech(5, 2, 1); + g_vm->_speechManager.startSpeech(5, 2, 1); else - startSpeech(4, 4, 1); + g_vm->_speechManager.startSpeech(4, 4, 1); if (g_iouv == 0) g_s._faithScore += 2; @@ -2157,7 +2178,7 @@ L1: } else { repon(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - startSpeech(3, rand, 1); + g_vm->_speechManager.startSpeech(3, rand, 1); clearScreenType2(); displayAloneText(); debloc(21); @@ -2386,7 +2407,7 @@ void changeGraphicalDevice(int newDevice) { hirs(); initMouse(); showMouse(); - dessine_rouleau(); + drawRightFrame(); tinke(); drawClock(); if (g_ipers != 0) @@ -2394,7 +2415,7 @@ void changeGraphicalDevice(int newDevice) { else displayAloneText(); clearScreenType2(); - clsf3(); + clearScreenType3(); g_maff = 68; afdes(0); repon(2, g_crep); @@ -2445,7 +2466,7 @@ void MortevielleEngine::gameLoaded() { drawClock(); afdes(0); repon(2, g_crep); - clsf3(); + clearScreenType3(); _endGame = false; g_vm->_menu.setDestinationMenuText(g_s._currPlace); modinv(); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 269a566b4b..d817a3c501 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -50,21 +50,21 @@ extern int animof(int ouf, int num); extern int readclock(); extern void modif(int &nu); extern void dessine(int ad, int x, int y); -extern void dessine_rouleau(); +extern void drawRightFrame(); extern void setTextColor(int c); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); extern void initouv(); extern void ecrf1(); -extern void clsf1(); +extern void clearScreenType1(); extern void clearScreenType2(); +extern void clearScreenType3(); +extern void clearScreenType10(); extern void ecrf2(); extern void ecr2(Common::String str_); -extern void clsf3(); extern void ecr3(Common::String text); extern void ecrf6(); extern void ecrf7(); -extern void clsf10(); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); extern void updateHour(int &day, int &hour, int &minute); @@ -72,7 +72,7 @@ extern int convertCharacterIndexToBitIndex(int characterIndex); /* NIVEAU 12 */ extern void modobj(int m); extern void repon(int f, int m); -extern void t5(int cx); +extern void t5(int roomId); extern void showPeoplePresent(int per); extern int selectCharacters(int min, int max); extern int getPresenceStatsGreenRoom(); @@ -86,7 +86,7 @@ extern void drawClock(); /************* * NIVEAU 11 * *************/ -extern void debloc(int l); +extern void debloc(int roomId); extern int getPresenceStatsDiningRoom(int &hour); extern int getPresenceStatsBureau(int &hour); extern int getPresenceStatsKitchen(); @@ -103,10 +103,10 @@ extern int setPresenceKitchen(); extern int setPresenceLanding(); extern int setPresenceChapel(int hour); extern void getKnockAnswer(); -extern int nouvp(int l); +extern int nouvp(int roomId); extern int convertBitIndexToCharacterIndex(int bitIndex); -extern void ecfren(int &p, int &rand, int cf, int l); -extern void becfren(int l); +extern void ecfren(int &p, int &rand, int cf, int roomId); +extern void becfren(int roomId); /* NIVEAU 10 */ extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); @@ -123,7 +123,7 @@ extern void pl12(int cf); extern void pl13(int cf); extern void pl15(int cf); extern void pl20(int cf); -extern int t11(int l11); +extern int t11(int roomId); extern void cavegre(); extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index cc3ee98fb8..3842578ba4 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -539,7 +539,7 @@ void MortevielleEngine::mainGame() { theure(); dprog(); hirs(); - dessine_rouleau(); + drawRightFrame(); showMouse(); // Loop to play the game @@ -578,7 +578,7 @@ void MortevielleEngine::handleAction() { char inkey = '\0'; bool oo, funct = 0; - clsf3(); + clearScreenType3(); oo = false; g_ctrm = 0; if (!_keyPressedEsc) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 84a739ea03..6fa354b47b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -36,6 +36,7 @@ #include "mortevielle/menu.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" +#include "mortevielle/speech.h" namespace Mortevielle { @@ -99,7 +100,6 @@ private: Common::StringArray _engineStrings; Common::StringArray _gameStrings; - Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); void readStaticStrings(Common::File &f, int dataSize, DataType dataType); @@ -154,6 +154,7 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; + SpeechManager _speechManager; Menu _menu; bool _quitGame; // Quit game flag. Originally called 'arret' diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index b81c817edf..9605adcff3 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -153,7 +153,7 @@ void music() { g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); g_addfix = (float)((kTempoMusic - g_addv[1])) / 256; - cctable(g_tbi); + g_vm->_speechManager.cctable(g_tbi); bool fin = false; int k = 0; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 2fb933b74f..49d47fb39f 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -35,7 +35,7 @@ namespace Mortevielle { -void spfrac(int wor) { +void SpeechManager::spfrac(int wor) { g_c3._rep = (uint)wor >> 12; if ((g_typlec == 0) && (g_c3._code != 9)) if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || @@ -47,7 +47,7 @@ void spfrac(int wor) { g_c3._acc = ((uint)wor >> 9) & 7; } -void charg_car(int &currWordNumb) { +void SpeechManager::charg_car(int &currWordNumb) { int wor = swap(READ_LE_UINT16(&g_mem[kAdrWord + currWordNumb])); int int_ = wor & 0x3f; // 63 @@ -87,16 +87,16 @@ void charg_car(int &currWordNumb) { } -void entroct(byte o) { +void SpeechManager::entroct(byte o) { g_mem[kAdrTroct * 16 + g_ptr_oct] = o; ++g_ptr_oct; } -void veracf(byte b) { +void SpeechManager::veracf(byte b) { ; } -void cctable(tablint &t) { +void SpeechManager::cctable(tablint &t) { float tb[257]; tb[0] = 0; @@ -106,7 +106,7 @@ void cctable(tablint &t) { } } -void regenbruit() { +void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { @@ -120,7 +120,7 @@ void regenbruit() { * Load sonmus.mor file * @remarks Originally called 'charge_son' */ -void loadMusicSound() { +void SpeechManager::loadMusicSound() { Common::File f; if (!f.open("sonmus.mor")) @@ -136,7 +136,7 @@ void loadMusicSound() { * Load phoneme sound file * @remarks Originally called 'charge_phbruit' */ -void loadPhonemeSounds() { +void SpeechManager::loadPhonemeSounds() { Common::File f; if (!f.open("phbrui.mor")) @@ -152,7 +152,7 @@ void loadPhonemeSounds() { * Speech function - Load Noise file * @remarks Originally called 'charge_bruit' */ -void loadNoise() { +void SpeechManager::loadNoise() { Common::File f; int i; @@ -167,7 +167,7 @@ void loadNoise() { f.close(); } -void trait_car() { +void SpeechManager::trait_car() { byte d3; int d2, i; @@ -468,7 +468,7 @@ void trait_car() { * Make the queue evolve by 1 value * @remarks Originally called 'rot_chariot' */ -void moveQueue() { +void SpeechManager::moveQueue() { g_c1 = g_c2; g_c2 = g_c3; g_c3._val = 32; @@ -479,7 +479,7 @@ void moveQueue() { * initialize the queue * @remarks Originally called 'init_chariot' */ -void initQueue() { +void SpeechManager::initQueue() { g_c3._rep = 0; g_c3._freq = 0; g_c3._acc = 0; @@ -491,7 +491,7 @@ void initQueue() { * Handle a phoneme * @remarks Originally called 'trait_ph' */ -void handlePhoneme() { +void SpeechManager::handlePhoneme() { const int deca[3] = {300, 30, 40}; int startPos = swap(g_t_cph[g_phonemeNumb - 1]) + deca[g_typlec]; @@ -519,7 +519,7 @@ void handlePhoneme() { * Start speech * @remarks Originally called 'parole' */ -void startSpeech(int rep, int ht, int typ) { +void SpeechManager::startSpeech(int rep, int ht, int typ) { int savph[501]; int tempo; diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 03caa83afa..3a27abf66f 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -56,22 +56,24 @@ const int kTempoM = 89; //const int seg_syst = 0x6fed; //const int offsetb2 = 4; +class SpeechManager { +public: + void spfrac(int wor); + void charg_car(int &currWordNumb); + void entroct(byte o); + void veracf(byte b); + void cctable(tablint &t); + void regenbruit(); + void loadMusicSound(); + void loadPhonemeSounds(); + void loadNoise(); + void trait_car(); -extern void spfrac(int wor); -extern void charg_car(int &currWordNumb); -extern void entroct(byte o); -extern void veracf(byte b); -extern void cctable(tablint &t); -extern void regenbruit(); -extern void loadMusicSound(); -extern void loadPhonemeSounds(); -extern void loadNoise(); -extern void trait_car(); - -extern void moveQueue(); -extern void initQueue(); -extern void handlePhoneme(); -extern void startSpeech(int rep, int ht, int typ); + void moveQueue(); + void initQueue(); + void handlePhoneme(); + void startSpeech(int rep, int ht, int typ); +}; } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 26131c7e66..8679c3c4af 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -114,7 +114,7 @@ extern const byte g_rang[16]; enum places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, - BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, + BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, WELL = 24, @@ -161,7 +161,7 @@ struct pattern { struct nhom { - byte _id; /* number betwwen 0 and 32 */ + byte _id; /* number between 0 and 32 */ byte _hom[4]; }; -- cgit v1.2.3 From 0f37695385de9a1b39950a38f956a24da6695ac0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Mar 2012 00:06:15 +0100 Subject: MORTEVIELLE: More renaming and moving --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/mor.cpp | 279 +++++++++++++++++++++--------------- engines/mortevielle/mor.h | 32 ----- engines/mortevielle/mortevielle.cpp | 3 +- engines/mortevielle/mortevielle.h | 34 +++++ engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/speech.cpp | 21 +-- engines/mortevielle/speech.h | 4 + engines/mortevielle/var_mor.cpp | 5 +- engines/mortevielle/var_mor.h | 5 +- 10 files changed, 220 insertions(+), 167 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b007966ae2..ebacfa31d9 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1602,7 +1602,7 @@ void MortevielleEngine::loseGame() { tkey1(false); maivid(); resetVariables(); - dprog(); + initGame(); g_vh = 10; g_vm__ = 0; g_vj = 0; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 9adf3357ee..74d6f7166c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -633,7 +633,7 @@ int selectCharacters(int min, int max) { * Engine function - Get Presence Statistics - Green Room * @remarks Originally called 'cpl1' */ -int getPresenceStatsGreenRoom() { +int MortevielleEngine::getPresenceStatsGreenRoom() { int day, hour, minute; int retVal = 0; @@ -664,7 +664,7 @@ int getPresenceStatsGreenRoom() { * Engine function - Get Presence Statistics - Purple Room * @remarks Originally called 'cpl2' */ -int getPresenceStatsPurpleRoom() { +int MortevielleEngine::getPresenceStatsPurpleRoom() { int day, hour, minute; int retVal = 0; @@ -687,7 +687,7 @@ int getPresenceStatsPurpleRoom() { * Engine function - Get Presence Statistics - Toilets * @remarks Originally called 'cpl3' */ -int getPresenceStatsToilets() { +int MortevielleEngine::getPresenceStatsToilets() { int day, hour, minute; int retVal = 0; @@ -704,7 +704,7 @@ int getPresenceStatsToilets() { * Engine function - Get Presence Statistics - Blue Room * @remarks Originally called 'cpl5' */ -int getPresenceStatsBlueRoom() { +int MortevielleEngine::getPresenceStatsBlueRoom() { int day, hour, minute; int retVal = 0; @@ -725,7 +725,7 @@ int getPresenceStatsBlueRoom() { * Engine function - Get Presence Statistics - Red Room * @remarks Originally called 'cpl6' */ -int getPresenceStatsRedRoom() { +int MortevielleEngine::getPresenceStatsRedRoom() { int day, hour, minute; int retVal = 0; @@ -842,7 +842,7 @@ void debloc(int roomId) { * Engine function - Get Presence Statistics - Room Bureau * @remarks Originally called 'cpl10' */ -int getPresenceStatsDiningRoom(int &hour) { +int MortevielleEngine::getPresenceStatsDiningRoom(int &hour) { int day, minute; int retVal = 0; @@ -865,7 +865,7 @@ int getPresenceStatsDiningRoom(int &hour) { * Engine function - Get Presence Statistics - Room Bureau * @remarks Originally called 'cpl11' */ -int getPresenceStatsBureau(int &hour) { +int MortevielleEngine::getPresenceStatsBureau(int &hour) { int day, minute; int retVal = 0; @@ -888,7 +888,7 @@ int getPresenceStatsBureau(int &hour) { * Engine function - Get Presence Statistics - Room Kitchen * @remarks Originally called 'cpl12' */ -int getPresenceStatsKitchen() { +int MortevielleEngine::getPresenceStatsKitchen() { int day, hour, minute; int retVal = 0; @@ -909,7 +909,7 @@ int getPresenceStatsKitchen() { * Engine function - Get Presence Statistics - Room Attic * @remarks Originally called 'cpl13' */ -int getPresenceStatsAttic() { +int MortevielleEngine::getPresenceStatsAttic() { return 0; } @@ -917,7 +917,7 @@ int getPresenceStatsAttic() { * Engine function - Get Presence Statistics - Room Landing * @remarks Originally called 'cpl15' */ -int getPresenceStatsLanding() { +int MortevielleEngine::getPresenceStatsLanding() { int day, hour, minute; int retVal = 0; @@ -944,7 +944,7 @@ int getPresenceStatsLanding() { * Engine function - Get Presence Statistics - Room Chapel * @remarks Originally called 'cpl20' */ -int getPresenceStatsChapel(int &hour) { +int MortevielleEngine::getPresenceStatsChapel(int &hour) { int day, minute; int retVal = 0; @@ -967,18 +967,18 @@ int getPresenceStatsChapel(int &hour) { * Engine function - Check who is in the Green Room * @remarks Originally called 'quelq1' */ -void setPresenceGreenRoom(int roomId) { +void MortevielleEngine::setPresenceGreenRoom(int roomId) { int rand = getRandomNumber(1, 2); if (roomId == GREEN_ROOM) { if (rand == 1) - g_vm->_roomPresenceLuc = true; + _roomPresenceLuc = true; else - g_vm->_roomPresenceIda = true; + _roomPresenceIda = true; } else if (roomId == DARKBLUE_ROOM) { if (rand == 1) - g_vm->_roomPresenceGuy = true; + _roomPresenceGuy = true; else - g_vm->_roomPresenceEva = true; + _roomPresenceEva = true; } g_ipers = 10; @@ -988,11 +988,11 @@ void setPresenceGreenRoom(int roomId) { * Engine function - Check who is in the Purple Room * @remarks Originally called 'quelq2' */ -void setPresencePurpleRoom() { - if (g_li == 2) - g_vm->_purpleRoomPresenceLeo = true; +void MortevielleEngine::setPresencePurpleRoom() { + if (_place == PURPLE_ROOM) + _purpleRoomPresenceLeo = true; else - g_vm->_room9PresenceLeo = true; + _room9PresenceLeo = true; g_ipers = 10; } @@ -1001,8 +1001,8 @@ void setPresencePurpleRoom() { * Engine function - Check who is in the Blue Room * @remarks Originally called 'quelq5' */ -void setPresenceBlueRoom() { - g_vm->_roomPresenceMax = true; +void MortevielleEngine::setPresenceBlueRoom() { + _roomPresenceMax = true; g_ipers = 10; } @@ -1010,11 +1010,11 @@ void setPresenceBlueRoom() { * Engine function - Check who is in the Red Room * @remarks Originally called 'quelq6' */ -void setPresenceRedRoom(int l) { - if (l == 6) - g_vm->_roomPresenceBob = true; - else if (l == 8) - g_vm->_roomPresencePat = true; +void MortevielleEngine::setPresenceRedRoom(int roomId) { + if (roomId == RED_ROOM) + _roomPresenceBob = true; + else if (roomId == GREEN_ROOM2) + _roomPresencePat = true; g_ipers = 10; } @@ -1023,7 +1023,7 @@ void setPresenceRedRoom(int l) { * Engine function - Check who is in the Dining Room * @remarks Originally called 'quelq10' */ -int setPresenceDiningRoom(int hour) { +int MortevielleEngine::setPresenceDiningRoom(int hour) { int retVal = 0; if ((hour >= 0) && (hour < 8)) @@ -1054,7 +1054,7 @@ int setPresenceDiningRoom(int hour) { * Engine function - Check who is in the Bureau * @remarks Originally called 'quelq11' */ -int setPresenceBureau(int hour) { +int MortevielleEngine::setPresenceBureau(int hour) { int retVal = 0; if ((hour >= 0) && (hour < 8)) @@ -1082,7 +1082,7 @@ int setPresenceBureau(int hour) { * Engine function - Check who is in the Kitchen * @remarks Originally called 'quelq12' */ -int setPresenceKitchen() { +int MortevielleEngine::setPresenceKitchen() { int retVal = chlm(); showPeoplePresent(retVal); @@ -1093,7 +1093,7 @@ int setPresenceKitchen() { * Engine function - Check who is in the Landing * @remarks Originally called 'quelq15' */ -int setPresenceLanding() { +int MortevielleEngine::setPresenceLanding() { bool test = false; int rand = 0; do { @@ -1118,7 +1118,7 @@ int setPresenceLanding() { * Engine function - Check who is in the chapel * @remarks Originally called 'quelq20' */ -int setPresenceChapel(int hour) { +int MortevielleEngine::setPresenceChapel(int hour) { int retVal = 0; if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) @@ -1226,17 +1226,17 @@ void ecfren(int &p, int &rand, int cf, int roomId) { rand = 0; if ( ((roomId == GREEN_ROOM) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((roomId == DARKBLUE_ROOM) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva)) ) - p = getPresenceStatsGreenRoom(); + p = g_vm->getPresenceStatsGreenRoom(); if ((roomId == PURPLE_ROOM) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo)) - p = getPresenceStatsPurpleRoom(); + p = g_vm->getPresenceStatsPurpleRoom(); if ( ((roomId == TOILETS) && (!g_vm->_toiletsPresenceBobMax)) || ((roomId == BATHROOM) && (!g_vm->_bathRoomPresenceBobMax)) ) - p = getPresenceStatsToilets(); + p = g_vm->getPresenceStatsToilets(); if ((roomId == BLUE_ROOM) && (!g_vm->_roomPresenceMax)) - p = getPresenceStatsBlueRoom(); + p = g_vm->getPresenceStatsBlueRoom(); if ( ((roomId == RED_ROOM) && (!g_vm->_roomPresenceBob)) || ((roomId == GREEN_ROOM2) && (!g_vm->_roomPresencePat))) - p = getPresenceStatsRedRoom(); + p = g_vm->getPresenceStatsRedRoom(); if ((roomId == ROOM9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo)) p = 10; if ( ((roomId == PURPLE_ROOM) && (g_vm->_room9PresenceLeo)) @@ -1339,17 +1339,26 @@ void resetVariables() { init_nbrepm(); } -void dprog() { - g_li = 21; +/** + * Engine function - initGame + * @remarks Originally called 'dprog' + */ +void MortevielleEngine::initGame() { + _place = MANOR_FRONT; g_jh = 0; if (!g_s._ipre) - g_vm->_blo = true; + _blo = true; g_t = kTime1; g_mh = readclock(); } -void pl1(int cf) { - if (((g_li == 1) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) || ((g_li == 4) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva))) { +/** + * Engine function - Set Random Presence - Green Room + * @remarks Originally called 'pl1' + */ +void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { + if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) + || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { int p = getPresenceStatsGreenRoom(); int rand; phaz(rand, p, cf); @@ -1357,12 +1366,16 @@ void pl1(int cf) { if (rand > p) displayAloneText(); else - setPresenceGreenRoom(g_li); + setPresenceGreenRoom(_place); } } -void pl2(int cf) { - if (!g_vm->_purpleRoomPresenceLeo) { +/** + * Engine function - Set Random Presence - Purple Room + * @remarks Originally called 'pl2' + */ +void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { + if (!_purpleRoomPresenceLeo) { int p = getPresenceStatsPurpleRoom(); int rand; phaz(rand, p, cf); @@ -1374,7 +1387,11 @@ void pl2(int cf) { } } -void pl5(int cf) { +/** + * Engine function - Set Random Presence - Blue Room + * @remarks Originally called 'pl5' + */ +void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { if (!g_vm->_roomPresenceMax) { int p = getPresenceStatsBlueRoom(); int rand; @@ -1388,8 +1405,13 @@ void pl5(int cf) { } } -void pl6(int cf) { - if (((g_li == 6) && (!g_vm->_roomPresenceBob)) || ((g_li == 8) && (!g_vm->_roomPresencePat))) { +/** + * Engine function - Set Random Presence - Red Room + * @remarks Originally called 'pl6' + */ +void MortevielleEngine::setRandomPresenceRedRoom(int cf) { + if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) + || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { int p = getPresenceStatsRedRoom(); int rand; @@ -1398,12 +1420,16 @@ void pl6(int cf) { if (rand > p) displayAloneText(); else - setPresenceRedRoom(g_li); + setPresenceRedRoom(_place); } } -void pl9(int cf) { - if (!g_vm->_room9PresenceLeo) { +/** + * Engine function - Set Random Presence - Room 9 + * @remarks Originally called 'pl9' + */ +void MortevielleEngine::setRandomPresenceRoom9(int cf) { + if (!_room9PresenceLeo) { cf = -10; int p, rand; phaz(rand, p, cf); @@ -1415,7 +1441,11 @@ void pl9(int cf) { } } -void pl10(int cf) { +/** + * Engine function - Set Random Presence - Dining Room + * @remarks Originally called 'pl10' + */ +void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { int h, rand; int p = getPresenceStatsDiningRoom(h); phaz(rand, p, cf); @@ -1426,7 +1456,11 @@ void pl10(int cf) { setPresenceDiningRoom(h); } -void pl11(int cf) { +/** + * Engine function - Set Random Presence - Bureau + * @remarks Originally called 'pl11' + */ +void MortevielleEngine::setRandomPresenceBureau(int cf) { int h, rand; int p = getPresenceStatsBureau(h); @@ -1437,7 +1471,11 @@ void pl11(int cf) { setPresenceBureau(h); } -void pl12(int cf) { +/** + * Engine function - Set Random Presence - Kitchen + * @remarks Originally called 'pl12' + */ +void MortevielleEngine::setRandomPresenceKitchen(int cf) { int p, rand; p = getPresenceStatsKitchen(); @@ -1448,7 +1486,11 @@ void pl12(int cf) { setPresenceKitchen(); } -void pl13(int cf) { +/** + * Engine function - Set Random Presence - Attic / Cellar + * @remarks Originally called 'pl13' + */ +void MortevielleEngine::setRandomPresenceAttic(int cf) { int p, rand; p = getPresenceStatsAttic(); @@ -1459,7 +1501,11 @@ void pl13(int cf) { setPresenceKitchen(); } -void pl15(int cf) { +/** + * Engine function - Set Random Presence - Landing + * @remarks Originally called 'pl15' + */ +void MortevielleEngine::setRandomPresenceLanding(int cf) { int p, rand; p = getPresenceStatsLanding(); @@ -1470,7 +1516,11 @@ void pl15(int cf) { setPresenceLanding(); } -void pl20(int cf) { +/** + * Engine function - Set Random Presence - Chapel + * @remarks Originally called 'pl20' + */ +void MortevielleEngine::setRandomPresenceChapel(int cf) { int h, rand; int p = getPresenceStatsChapel(h); @@ -1486,18 +1536,18 @@ int t11(int roomId) { int p, rand; ecfren(p, rand, g_s._faithScore, roomId); - g_li = roomId; + g_vm->_place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { if (rand > p) { displayAloneText(); retVal = 0; } else { - becfren(g_li); - retVal = nouvp(g_li); + becfren(g_vm->_place); + retVal = nouvp(g_vm->_place); } } else - retVal = nouvp(g_li); + retVal = nouvp(g_vm->_place); } if (roomId > ROOM9) { @@ -1506,17 +1556,17 @@ int t11(int roomId) { else { int h = 0; if (roomId == DINING_ROOM) - p = getPresenceStatsDiningRoom(h); + p = g_vm->getPresenceStatsDiningRoom(h); else if (roomId == BUREAU) - p = getPresenceStatsBureau(h); + p = g_vm->getPresenceStatsBureau(h); else if (roomId == KITCHEN) - p = getPresenceStatsKitchen(); + p = g_vm->getPresenceStatsKitchen(); else if ((roomId == ATTIC) || (roomId == CELLAR)) - p = getPresenceStatsAttic(); + p = g_vm->getPresenceStatsAttic(); else if ((roomId == LANDING) || (roomId == 26)) - p = getPresenceStatsLanding(); + p = g_vm->getPresenceStatsLanding(); else if (roomId == CHAPEL) - p = getPresenceStatsChapel(h); + p = g_vm->getPresenceStatsChapel(h); p += g_s._faithScore; rand = getRandomNumber(1, 100); if (rand > p) { @@ -1524,15 +1574,15 @@ int t11(int roomId) { retVal = 0; } else { if (roomId == DINING_ROOM) - p = setPresenceDiningRoom(h); + p = g_vm->setPresenceDiningRoom(h); else if (roomId == BUREAU) - p = setPresenceBureau(h); + p = g_vm->setPresenceBureau(h); else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) - p = setPresenceKitchen(); + p = g_vm->setPresenceKitchen(); else if ((roomId == LANDING) || (roomId == 26)) - p = setPresenceLanding(); + p = g_vm->setPresenceLanding(); else if (roomId == CHAPEL) - p = setPresenceChapel(h); + p = g_vm->setPresenceChapel(h); retVal = p; } } @@ -1602,20 +1652,17 @@ void musique(int so) { g_vm->_speechManager.startSpeech(9, getRandomNumber(2, 4), 1); i = true; } - } - else if (g_s._currPlace == CHAPEL) { + } else if (g_s._currPlace == CHAPEL) { if (getRandomNumber(1, 2) == 1) { g_vm->_speechManager.startSpeech(8, 1, 1); i = true; } - } - else if (g_s._currPlace == WELL) { + } else if (g_s._currPlace == WELL) { if (getRandomNumber(1, 2) == 2) { g_vm->_speechManager.startSpeech(12, 1, 1); i = true; } - } - else if (g_s._currPlace == 23) { + } else if (g_s._currPlace == 23) { g_vm->_speechManager.startSpeech(13, 1, 1); i = true; } @@ -1673,28 +1720,28 @@ void tinke() { const char d4 = ']'; const char d5 = '1'; Common::String d6 = g_vm->getEngineString(S_OK); - int cx, cf, day, hour, minute; + int cf, day, hour, minute; Common::String stpo; g_vm->_anyone = false; updateHour(day, hour, minute); if (day != g_day) { g_day = day; - cx = 0; + int i = 0; do { - ++cx; - if (g_nbrepm[cx] != 0) - --g_nbrepm[cx]; - g_nbrep[cx] = 0; - } while (cx != 8); + ++i; + if (g_nbrepm[i] != 0) + --g_nbrepm[i]; + g_nbrep[i] = 0; + } while (i != 8); } if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { g_hour = hour; g_minute = 0; drawClock(); cf = 0; - for (cx = 1; cx <= 10; ++cx) { - if (g_s._pourc[cx] == '*') + for (int i = 1; i <= 10; ++i) { + if (g_s._pourc[i] == '*') ++cf; } @@ -1741,43 +1788,43 @@ void tinke() { g_vm->_menu.eraseMenu(); g_jh += ((nh - g_mh) / g_t); g_mh = nh; - switch (g_li) { - case 1: - case 4 : - pl1(cf); + switch (g_vm->_place) { + case GREEN_ROOM: + case DARKBLUE_ROOM: + g_vm->setRandomPresenceGreenRoom(cf); break; - case 2 : - pl2(cf); + case PURPLE_ROOM: + g_vm->setRandomPresencePurpleRoom(cf); break; - case 5 : - pl5(cf); + case BLUE_ROOM: + g_vm->setRandomPresenceBlueRoom(cf); break; - case 6: - case 8 : - pl6(cf); + case RED_ROOM: + case GREEN_ROOM2: + g_vm->setRandomPresenceRedRoom(cf); break; - case 9 : - pl9(cf); + case ROOM9: + g_vm->setRandomPresenceRoom9(cf); break; - case 10 : - pl10(cf); + case DINING_ROOM: + g_vm->setRandomPresenceDiningRoom(cf); break; - case 11 : - pl11(cf); + case BUREAU: + g_vm->setRandomPresenceBureau(cf); break; - case 12 : - pl12(cf); + case KITCHEN: + g_vm->setRandomPresenceKitchen(cf); break; - case 13: - case 14 : - pl13(cf); + case ATTIC: + case CELLAR: + g_vm->setRandomPresenceAttic(cf); break; - case 15: - case 26 : - pl15(cf); + case LANDING: + case 26: + g_vm->setRandomPresenceLanding(cf); break; - case 20 : - pl20(cf); + case CHAPEL: + g_vm->setRandomPresenceChapel(cf); break; } if ((g_mpers != 0) && (g_ipers != 10)) @@ -1809,7 +1856,7 @@ void tinke() { } g_hfb = readclock(); if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - cx = nouvp(g_li); + nouvp(g_vm->_place); g_vm->_brt = false; g_hdb = 0; if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) @@ -2436,7 +2483,7 @@ void MortevielleEngine::gameLoaded() { _hiddenHero = false; _brt = false; g_maff = 68; - g_mnumo = 0; + g_mnumo = OPCODE_NONE; g_prebru = 0; g_x = 0; g_y = 0; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index d817a3c501..e067534b67 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -75,11 +75,6 @@ extern void repon(int f, int m); extern void t5(int roomId); extern void showPeoplePresent(int per); extern int selectCharacters(int min, int max); -extern int getPresenceStatsGreenRoom(); -extern int getPresenceStatsPurpleRoom(); -extern int getPresenceStatsToilets(); -extern int getPresenceStatsBlueRoom(); -extern int getPresenceStatsRedRoom(); extern void displayAloneText(); extern int chlm(); extern void drawClock(); @@ -87,21 +82,6 @@ extern void drawClock(); * NIVEAU 11 * *************/ extern void debloc(int roomId); -extern int getPresenceStatsDiningRoom(int &hour); -extern int getPresenceStatsBureau(int &hour); -extern int getPresenceStatsKitchen(); -extern int getPresenceStatsAttic(); -extern int getPresenceStatsLanding(); -extern int getPresenceStatsChapel(int &hour); -extern void setPresenceGreenRoom(int roomId); -extern void setPresencePurpleRoom(); -extern void setPresenceBlueRoom(); -extern void setPresenceRedRoom(int l); -extern int setPresenceDiningRoom(int hour); -extern int setPresenceBureau(int hour); -extern int setPresenceKitchen(); -extern int setPresenceLanding(); -extern int setPresenceChapel(int hour); extern void getKnockAnswer(); extern int nouvp(int roomId); extern int convertBitIndexToCharacterIndex(int bitIndex); @@ -111,18 +91,6 @@ extern void becfren(int roomId); extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); extern void resetVariables(); -extern void dprog(); -extern void pl1(int cf); -extern void pl2(int cf); -extern void pl5(int cf); -extern void pl6(int cf); -extern void pl9(int cf); -extern void pl10(int cf); -extern void pl11(int cf); -extern void pl12(int cf); -extern void pl13(int cf); -extern void pl15(int cf); -extern void pl20(int cf); extern int t11(int roomId); extern void cavegre(); extern void writetp(Common::String s, int t); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3842578ba4..508e90fff7 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -84,6 +84,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _textColor = 0; _currGraphicalDevice = -1; _newGraphicalDevice = -1; + _place = -1; _c_zzz = -1; @@ -537,7 +538,7 @@ void MortevielleEngine::mainGame() { _menu.initMenu(); theure(); - dprog(); + initGame(); hirs(); drawRightFrame(); showMouse(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6fa354b47b..c62af9901a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -142,6 +142,7 @@ public: int _textColor; int _currGraphicalDevice; int _newGraphicalDevice; + int _place; int _c_zzz; int ptr_word; @@ -219,7 +220,40 @@ public: void fctSmell(); void fctScratch(); + int getPresenceStatsGreenRoom(); + int getPresenceStatsPurpleRoom(); + int getPresenceStatsToilets(); + int getPresenceStatsBlueRoom(); + int getPresenceStatsRedRoom(); + int getPresenceStatsDiningRoom(int &hour); + int getPresenceStatsBureau(int &hour); + int getPresenceStatsKitchen(); + int getPresenceStatsAttic(); + int getPresenceStatsLanding(); + int getPresenceStatsChapel(int &hour); + void setPresenceGreenRoom(int roomId); + void setPresencePurpleRoom(); + void setPresenceBlueRoom(); + void setPresenceRedRoom(int roomId); + int setPresenceDiningRoom(int hour); + int setPresenceBureau(int hour); + int setPresenceKitchen(); + int setPresenceLanding(); + int setPresenceChapel(int hour); + void setRandomPresenceGreenRoom(int cf); + void setRandomPresencePurpleRoom(int cf); + void setRandomPresenceBlueRoom(int cf); + void setRandomPresenceRedRoom(int cf); + void setRandomPresenceRoom9(int cf); + void setRandomPresenceDiningRoom(int cf); + void setRandomPresenceBureau(int cf); + void setRandomPresenceKitchen(int cf); + void setRandomPresenceAttic(int cf); + void setRandomPresenceLanding(int cf); + void setRandomPresenceChapel(int cf); + void loadPlaces(); + void initGame(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index a86432253c..37b33766ff 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -123,7 +123,7 @@ Common::Error SavegameManager::loadGame(int n) { /* Initialization */ theure(); - dprog(); + g_vm->initGame(); g_vm->gameLoaded(); showMouse(); return Common::kNoError; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 49d47fb39f..bd589057c3 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -35,9 +35,14 @@ namespace Mortevielle { +SpeechManager::SpeechManager() { + _typlec = 0; + _phonemeNumb = 0; +} + void SpeechManager::spfrac(int wor) { g_c3._rep = (uint)wor >> 12; - if ((g_typlec == 0) && (g_c3._code != 9)) + if ((_typlec == 0) && (g_c3._code != 9)) if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { ++g_c3._rep; @@ -494,8 +499,8 @@ void SpeechManager::initQueue() { void SpeechManager::handlePhoneme() { const int deca[3] = {300, 30, 40}; - int startPos = swap(g_t_cph[g_phonemeNumb - 1]) + deca[g_typlec]; - int endPos = swap(g_t_cph[g_phonemeNumb]) + deca[g_typlec]; + int startPos = swap(g_t_cph[_phonemeNumb - 1]) + deca[_typlec]; + int endPos = swap(g_t_cph[_phonemeNumb]) + deca[_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], g_t_cph[i]); @@ -526,10 +531,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { if (g_vm->_soundOff) return; - g_phonemeNumb = rep; + _phonemeNumb = rep; g_haut = ht; - g_typlec = typ; - if (g_typlec != 0) { + _typlec = typ; + if (_typlec != 0) { for (int i = 0; i <= 500; ++i) savph[i] = g_t_cph[i]; tempo = kTempoNoise; @@ -554,10 +559,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { } handlePhoneme(); g_vm->_soundManager.litph(g_tbi, typ, tempo); - if (g_typlec != 0) + if (_typlec != 0) for (int i = 0; i <= 500; ++i) { g_t_cph[i] = savph[i]; - g_mlec = g_typlec; + g_mlec = _typlec; } writepal(g_numpal); } diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 3a27abf66f..a0bdf8a4dd 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -57,7 +57,11 @@ const int kTempoM = 89; //const int offsetb2 = 4; class SpeechManager { +private: + int _typlec; + int _phonemeNumb; public: + SpeechManager(); void spfrac(int wor); void charg_car(int &currWordNumb); void entroct(byte o); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 78ff6ef0bd..f548ed69aa 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -82,7 +82,6 @@ int g_x, g_y, g_t, g_vj, - g_li, g_vh, g_vm__, g_jh, @@ -104,7 +103,7 @@ int g_x, g_ades, g_iouv, g_inei, - g_ctrm, + g_ctrm, g_dobj, g_msg3, g_msg4, @@ -118,8 +117,6 @@ int g_x, g_yprec, g_perdep, g_prebru, - g_typlec, - g_phonemeNumb, g_numpal, g_ptr_oct, g_k_tempo; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 8679c3c4af..059e9b019e 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -188,7 +188,6 @@ extern int g_x, g_y, g_t, g_vj, - g_li, g_vh, g_vm__, g_jh, @@ -210,7 +209,7 @@ extern int g_x, g_ades, g_iouv, g_inei, - g_ctrm, + g_ctrm, g_dobj, g_msg3, g_msg4, @@ -224,8 +223,6 @@ extern int g_x, g_yprec, g_perdep, g_prebru, - g_typlec, // Speech - g_phonemeNumb, // Speech g_numpal, g_ptr_oct, g_k_tempo; -- cgit v1.2.3 From 672e54efacbe23f6ebd60cc91cb16fa2e11ce7b1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Mar 2012 08:14:19 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 46 ++++----- engines/mortevielle/mor.cpp | 198 ++++++++++++++++++++------------------ engines/mortevielle/mor.h | 5 - engines/mortevielle/mortevielle.h | 5 + engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/var_mor.h | 6 +- 6 files changed, 137 insertions(+), 125 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index ebacfa31d9..390f7dadd2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,7 +42,7 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((g_s._currPlace == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s._currPlace == ROOM26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; afdes(0); @@ -66,7 +66,7 @@ void MortevielleEngine::fctMove() { g_s._currPlace = ATTIC; g_vm->_menu.setDestinationMenuText(ATTIC); } else if (g_num != 6) - g_s._currPlace = 26; + g_s._currPlace = ROOM26; if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; if (g_num > 7) @@ -92,7 +92,7 @@ void MortevielleEngine::fctMove() { return; } - if (g_s._currPlace == 23) { + if (g_s._currPlace == ROOM23) { if (cx == 1) t1deau(); if (cx == 2) @@ -113,9 +113,9 @@ void MortevielleEngine::fctMove() { if ((g_s._currPlace == CELLAR) && (cx == 3)) cx = 6; - if (((g_s._currPlace == LANDING) || (g_s._currPlace == 26)) && (cx == 4)) + if (((g_s._currPlace == LANDING) || (g_s._currPlace == ROOM26)) && (cx == 4)) cx = 6; - if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != 26)) + if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != ROOM26)) cx += 10; if ((g_s._currPlace == CHAPEL) && (cx == 13)) cx = 16; @@ -163,7 +163,7 @@ void MortevielleEngine::fctMove() { g_crep = 1505; tperd(); } else { - g_s._currPlace = 23; + g_s._currPlace = ROOM23; affrep(); } } @@ -277,9 +277,9 @@ void MortevielleEngine::fctTake() { || ((g_s._currPlace == BATHROOM) && (g_num == 6)) || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) || ((g_s._currPlace == 9) && (g_num == 4)) || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) || ((g_s._currPlace == BUREAU) && (g_num == 7)) || ((g_s._currPlace == KITCHEN) && (g_num == 6)) - || ((g_s._currPlace == ATTIC) && (g_num > 4)) || ((g_s._currPlace > ATTIC) && (g_s._currPlace != 23)) ) + || ((g_s._currPlace == ATTIC) && (g_num > 4)) || ((g_s._currPlace > ATTIC) && (g_s._currPlace != ROOM23)) ) g_crep = 997; - else if (g_s._currPlace == 23) { + else if (g_s._currPlace == ROOM23) { g_crep = 1504; tperd(); } else @@ -433,7 +433,7 @@ void MortevielleEngine::fctLook() { cx = 17; if ((g_s._currPlace > MANOR_FRONT) && (g_s._currPlace < DOOR)) cx -= 4; - if (g_s._currPlace == 26) + if (g_s._currPlace == ROOM26) cx = 21; g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; if ((g_s._currPlace == ATTIC) && (g_num == 8)) @@ -484,7 +484,7 @@ void MortevielleEngine::fctSearch() { if (g_vm->_anyone || g_vm->_keyPressedEsc) return; - if (g_s._currPlace == 23) { + if (g_s._currPlace == ROOM23) { g_crep = 1504; tperd(); return; @@ -577,7 +577,7 @@ void MortevielleEngine::fctOpen() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_OPEN)); - if (g_caff == 26) { + if (g_caff == ROOM26) { if (g_ment != 0) { g_msg[4] = OPCODE_ENTER; g_vm->_syn = true; @@ -859,7 +859,7 @@ void MortevielleEngine::fctClose() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_CLOSE)); - if (g_caff < 26) { + if (g_caff < ROOM26) { tfleche(); if (g_vm->_keyPressedEsc) g_crep = 998; @@ -887,7 +887,7 @@ void MortevielleEngine::fctClose() { } } } - if (g_caff == 26) + if (g_caff == ROOM26) g_crep = 999; } @@ -918,7 +918,7 @@ void MortevielleEngine::fctKnock() { return; } - if (g_s._currPlace == 26) { + if (g_s._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; g_vm->_speechManager.startSpeech(11, rand, 1); int p; @@ -1024,7 +1024,7 @@ void MortevielleEngine::fctSelfPut() { } } } - if (g_caff == 23) + if (g_caff == ROOM23) g_crep = 185; if ((g_crep == 999) || (g_crep == 185) || (g_crep == 998)) { if (g_crep == 999) @@ -1040,7 +1040,7 @@ void MortevielleEngine::fctSelfPut() { * @remarks Originally called 'tecouter' */ void MortevielleEngine::fctListen() { - if (g_s._currPlace != 26) + if (g_s._currPlace != ROOM26) g_crep = 101; else { if (g_ipers != 0) @@ -1078,7 +1078,7 @@ void MortevielleEngine::fctListen() { * @remarks Originally called 'tmanger' */ void MortevielleEngine::fctEat() { - if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { + if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { g_crep = 148; } else { tsort(); @@ -1180,7 +1180,7 @@ void MortevielleEngine::fctEnter() { void MortevielleEngine::fctSleep() { int z, j, h, m; - if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { + if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { g_crep = 148; return; } @@ -1231,7 +1231,7 @@ void MortevielleEngine::fctForce() { tfleche(); if ((!g_vm->_anyone) && (!g_vm->_keyPressedEsc)) { - if (g_s._currPlace != 26) + if (g_s._currPlace != ROOM26) g_crep = 997; else { g_crep = 143; @@ -1252,7 +1252,7 @@ void MortevielleEngine::fctLeave() { else { int lx = 0; - if ((g_s._currPlace < CRYPT) || (g_s._currPlace == 26)) + if ((g_s._currPlace < CRYPT) || (g_s._currPlace == ROOM26)) lx = 10; if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) lx = 21; @@ -1264,7 +1264,7 @@ void MortevielleEngine::fctLeave() { } if (g_s._currPlace == SECRET_PASSAGE) t23coul(lx); - if (g_s._currPlace == 23) + if (g_s._currPlace == ROOM23) lx = 24; if (g_crep != 997) g_s._currPlace = lx; @@ -1418,7 +1418,7 @@ void MortevielleEngine::fctDiscuss() { } else { int ix = cy; if (cx == 41) - ix = ix + 23; + ix += 23; if (ix != choi) { if (choi != 0) { lig = ((choi - 1) % 23) << 3; @@ -1528,7 +1528,7 @@ void MortevielleEngine::fctDiscuss() { */ void MortevielleEngine::fctSmell() { g_crep = 119; - if (g_caff < 26) { + if (g_caff < ROOM26) { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMELL)); tfleche(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 74d6f7166c..4b6a7b317d 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -519,92 +519,100 @@ void repon(int f, int m) { } } -void t5(int roomId) { +/** + * Engine function - Reset presence in other rooms + * @remarks Originally called 't5' + */ +void MortevielleEngine::resetPresenceInRooms(int roomId) { if (roomId == DINING_ROOM) - g_vm->_blo = false; + _blo = false; if (roomId != GREEN_ROOM) { - g_vm->_roomPresenceLuc = false; - g_vm->_roomPresenceIda = false; + _roomPresenceLuc = false; + _roomPresenceIda = false; } if (roomId != PURPLE_ROOM) - g_vm->_purpleRoomPresenceLeo = false; + _purpleRoomPresenceLeo = false; if (roomId != DARKBLUE_ROOM) { - g_vm->_roomPresenceGuy = false; - g_vm->_roomPresenceEva = false; + _roomPresenceGuy = false; + _roomPresenceEva = false; } if (roomId != BLUE_ROOM) - g_vm->_roomPresenceMax = false; + _roomPresenceMax = false; if (roomId != RED_ROOM) - g_vm->_roomPresenceBob = false; + _roomPresenceBob = false; if (roomId != GREEN_ROOM2) - g_vm->_roomPresencePat = false; + _roomPresencePat = false; if (roomId != TOILETS) - g_vm->_toiletsPresenceBobMax = false; + _toiletsPresenceBobMax = false; if (roomId != BATHROOM) - g_vm->_bathRoomPresenceBobMax = false; + _bathRoomPresenceBobMax = false; if (roomId != ROOM9) - g_vm->_room9PresenceLeo = false; + _room9PresenceLeo = false; } /** * Engine function - Show the people present in the given room * @remarks Originally called 'affper' */ -void showPeoplePresent(int per) { - int cx; - int xp = 580 - (g_vm->_screenSurface.getStringWidth("LEO") / 2); +void MortevielleEngine::showPeoplePresent(int per) { + int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + + for (int i = 1; i <= 8; ++i) + _menu.disableMenuItem(_menu._discussMenu[i]); - for (cx = 1; cx <= 8; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cx]); clearScreenType10(); if ((per & 128) == 128) { - g_vm->_screenSurface.putxy(xp, 24); - g_vm->_screenSurface.drawString("LEO", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[1]); + _screenSurface.putxy(xp, 24); + _screenSurface.drawString("LEO", 4); + _menu.enableMenuItem(_menu._discussMenu[1]); } if ((per & 64) == 64) { - g_vm->_screenSurface.putxy(xp, 32); - g_vm->_screenSurface.drawString("PAT", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[2]); + _screenSurface.putxy(xp, 32); + _screenSurface.drawString("PAT", 4); + _menu.enableMenuItem(_menu._discussMenu[2]); } if ((per & 32) == 32) { - g_vm->_screenSurface.putxy(xp, 40); - g_vm->_screenSurface.drawString("GUY", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[3]); + _screenSurface.putxy(xp, 40); + _screenSurface.drawString("GUY", 4); + _menu.enableMenuItem(_menu._discussMenu[3]); } if ((per & 16) == 16) { - g_vm->_screenSurface.putxy(xp, 48); - g_vm->_screenSurface.drawString("EVA", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[4]); + _screenSurface.putxy(xp, 48); + _screenSurface.drawString("EVA", 4); + _menu.enableMenuItem(_menu._discussMenu[4]); } if ((per & 8) == 8) { - g_vm->_screenSurface.putxy(xp, 56); - g_vm->_screenSurface.drawString("BOB", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[5]); + _screenSurface.putxy(xp, 56); + _screenSurface.drawString("BOB", 4); + _menu.enableMenuItem(_menu._discussMenu[5]); } if ((per & 4) == 4) { - g_vm->_screenSurface.putxy(xp, 64); - g_vm->_screenSurface.drawString("LUC", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[6]); + _screenSurface.putxy(xp, 64); + _screenSurface.drawString("LUC", 4); + _menu.enableMenuItem(_menu._discussMenu[6]); } if ((per & 2) == 2) { - g_vm->_screenSurface.putxy(xp, 72); - g_vm->_screenSurface.drawString("IDA", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[7]); + _screenSurface.putxy(xp, 72); + _screenSurface.drawString("IDA", 4); + _menu.enableMenuItem(_menu._discussMenu[7]); } if ((per & 1) == 1) { - g_vm->_screenSurface.putxy(xp, 80); - g_vm->_screenSurface.drawString("MAX", 4); - g_vm->_menu.enableMenuItem(g_vm->_menu._discussMenu[8]); + _screenSurface.putxy(xp, 80); + _screenSurface.drawString("MAX", 4); + _menu.enableMenuItem(_menu._discussMenu[8]); } g_ipers = per; } -int selectCharacters(int min, int max) { +/** + * Engine function - Select random characters + * @remarks Originally called 'choix' + */ +int MortevielleEngine::selectCharacters(int min, int max) { bool invertSelection = false; int rand = getRandomNumber(min, max); @@ -613,13 +621,13 @@ int selectCharacters(int min, int max) { invertSelection = true; } - int cx = 0; + int i = 0; int retVal = 0; - while (cx < rand) { + while (i < rand) { int charIndex = getRandomNumber(1, 8); int charBitIndex = convertCharacterIndexToBitIndex(charIndex); if ((retVal & charBitIndex) != charBitIndex) { - ++cx; + ++i; retVal |= charBitIndex; } } @@ -656,7 +664,7 @@ int MortevielleEngine::getPresenceStatsGreenRoom() { else if ((hour >= 0) && (hour < 8)) retVal = 70; - g_vm->_menu.mdn(); + _menu.mdn(); return retVal; } @@ -747,21 +755,21 @@ int MortevielleEngine::getPresenceStatsRedRoom() { * on the right hand side of the screen * @remarks Originally called 'person' */ -void displayAloneText() { +void MortevielleEngine::displayAloneText() { for (int cf = 1; cf <= 8; ++cf) - g_vm->_menu.disableMenuItem(g_vm->_menu._discussMenu[cf]); + _menu.disableMenuItem(_menu._discussMenu[cf]); - Common::String sYou = g_vm->getEngineString(S_YOU); - Common::String sAre = g_vm->getEngineString(S_ARE); - Common::String sAlone = g_vm->getEngineString(S_ALONE); + Common::String sYou = getEngineString(S_YOU); + Common::String sAre = getEngineString(S_ARE); + Common::String sAlone = getEngineString(S_ALONE); clearScreenType10(); - g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sYou) / 2), 30); - g_vm->_screenSurface.drawString(sYou, 4); - g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAre) / 2), 50); - g_vm->_screenSurface.drawString(sAre, 4); - g_vm->_screenSurface.putxy(580 - (g_vm->_screenSurface.getStringWidth(sAlone) / 2), 70); - g_vm->_screenSurface.drawString(sAlone, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); + _screenSurface.drawString(sYou, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); + _screenSurface.drawString(sAre, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); + _screenSurface.drawString(sAlone, 4); g_ipers = 0; } @@ -833,8 +841,8 @@ void debloc(int roomId) { g_num = 0; g_x = 0; g_y = 0; - if ((roomId != 26) && (roomId != LANDING)) - t5(roomId); + if ((roomId != ROOM26) && (roomId != LANDING)) + g_vm->resetPresenceInRooms(roomId); g_mpers = g_ipers; } @@ -1160,29 +1168,33 @@ void getKnockAnswer() { } } -int nouvp(int roomId) { +/** + * Engine function - Get Room Presence Bit Index + * @remarks Originally called 'nouvp' + */ +int MortevielleEngine::getPresenceBitIndex(int roomId) { int bitIndex = 0; if (roomId == GREEN_ROOM) { - if (g_vm->_roomPresenceLuc) + if (_roomPresenceLuc) bitIndex = 4; // LUC - if (g_vm->_roomPresenceIda) + if (_roomPresenceIda) bitIndex = 2; // IDA - } else if ( ((roomId == PURPLE_ROOM) && (g_vm->_purpleRoomPresenceLeo)) - || ((roomId == ROOM9) && (g_vm->_room9PresenceLeo))) + } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) + || ((roomId == ROOM9) && (_room9PresenceLeo))) bitIndex = 128; // LEO else if (roomId == DARKBLUE_ROOM) { - if (g_vm->_roomPresenceGuy) + if (_roomPresenceGuy) bitIndex = 32; // GUY - if (g_vm->_roomPresenceEva) + if (_roomPresenceEva) bitIndex = 16; // EVA - } else if ((roomId == BLUE_ROOM) && (g_vm->_roomPresenceMax)) + } else if ((roomId == BLUE_ROOM) && (_roomPresenceMax)) bitIndex = 1; // MAX - else if ((roomId == RED_ROOM) && (g_vm->_roomPresenceBob)) + else if ((roomId == RED_ROOM) && (_roomPresenceBob)) bitIndex = 8; // BOB - else if ((roomId == GREEN_ROOM2) && (g_vm->_roomPresencePat)) + else if ((roomId == GREEN_ROOM2) && (_roomPresencePat)) bitIndex = 64; // PAT - else if ( ((roomId == TOILETS) && (g_vm->_toiletsPresenceBobMax)) - || ((roomId == BATHROOM) && (g_vm->_bathRoomPresenceBobMax)) ) + else if ( ((roomId == TOILETS) && (_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (_bathRoomPresenceBobMax)) ) bitIndex = 9; // BOB + MAX if (bitIndex != 9) @@ -1221,7 +1233,7 @@ int convertBitIndexToCharacterIndex(int bitIndex) { void ecfren(int &p, int &rand, int cf, int roomId) { if (roomId == OWN_ROOM) - displayAloneText(); + g_vm->displayAloneText(); p = -500; rand = 0; if ( ((roomId == GREEN_ROOM) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) @@ -1540,19 +1552,19 @@ int t11(int roomId) { if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { if (rand > p) { - displayAloneText(); + g_vm->displayAloneText(); retVal = 0; } else { becfren(g_vm->_place); - retVal = nouvp(g_vm->_place); + retVal = g_vm->getPresenceBitIndex(g_vm->_place); } } else - retVal = nouvp(g_vm->_place); + retVal = g_vm->getPresenceBitIndex(g_vm->_place); } if (roomId > ROOM9) { - if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != 26)) - displayAloneText(); + if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) + g_vm->displayAloneText(); else { int h = 0; if (roomId == DINING_ROOM) @@ -1563,14 +1575,14 @@ int t11(int roomId) { p = g_vm->getPresenceStatsKitchen(); else if ((roomId == ATTIC) || (roomId == CELLAR)) p = g_vm->getPresenceStatsAttic(); - else if ((roomId == LANDING) || (roomId == 26)) + else if ((roomId == LANDING) || (roomId == ROOM26)) p = g_vm->getPresenceStatsLanding(); else if (roomId == CHAPEL) p = g_vm->getPresenceStatsChapel(h); p += g_s._faithScore; rand = getRandomNumber(1, 100); if (rand > p) { - displayAloneText(); + g_vm->displayAloneText(); retVal = 0; } else { if (roomId == DINING_ROOM) @@ -1579,7 +1591,7 @@ int t11(int roomId) { p = g_vm->setPresenceBureau(h); else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) p = g_vm->setPresenceKitchen(); - else if ((roomId == LANDING) || (roomId == 26)) + else if ((roomId == LANDING) || (roomId == ROOM26)) p = g_vm->setPresenceLanding(); else if (roomId == CHAPEL) p = g_vm->setPresenceChapel(h); @@ -1605,7 +1617,7 @@ void cavegre() { // It has been removed clearScreenType3(); - displayAloneText(); + g_vm->displayAloneText(); } void writetp(Common::String s, int t) { @@ -1662,7 +1674,7 @@ void musique(int so) { g_vm->_speechManager.startSpeech(12, 1, 1); i = true; } - } else if (g_s._currPlace == 23) { + } else if (g_s._currPlace == ROOM23) { g_vm->_speechManager.startSpeech(13, 1, 1); i = true; } @@ -1707,7 +1719,7 @@ void dessin(int ad) { aniof(1, 1); } - if (g_caff < 26) + if (g_caff < ROOM26) musique(1); } } @@ -1820,7 +1832,7 @@ void tinke() { g_vm->setRandomPresenceAttic(cf); break; case LANDING: - case 26: + case ROOM26: g_vm->setRandomPresenceLanding(cf); break; case CHAPEL: @@ -1856,7 +1868,7 @@ void tinke() { } g_hfb = readclock(); if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - nouvp(g_vm->_place); + g_vm->getPresenceBitIndex(g_vm->_place); g_vm->_brt = false; g_hdb = 0; if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) @@ -2111,7 +2123,7 @@ void t1sama() { //Entering manor int day, hour, minute; updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > 18)) { + if ((hour < 5) && (g_s._currPlace > ROOM18)) { bool d; cherjer(137, d); if (!d) { //You don't have the keys, and it's late @@ -2121,7 +2133,7 @@ void t1sama() { //Entering manor st1sama(); } else if (!g_s._ipre) { //Is it your first time? g_ipers = 255; - showPeoplePresent(g_ipers); + g_vm->showPeoplePresent(g_ipers); g_caff = 77; afdes(0); g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); @@ -2137,7 +2149,7 @@ void t1sama() { //Entering manor showMouse(); g_s._currPlace = OWN_ROOM; affrep(); - t5(DINING_ROOM); + g_vm->resetPresenceInRooms(DINING_ROOM); if (!g_vm->_blo) minute = t11(OWN_ROOM); g_ipers = 0; @@ -2227,7 +2239,7 @@ L1: int rand = (getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(3, rand, 1); clearScreenType2(); - displayAloneText(); + g_vm->displayAloneText(); debloc(21); affrep(); } @@ -2458,9 +2470,9 @@ void changeGraphicalDevice(int newDevice) { tinke(); drawClock(); if (g_ipers != 0) - showPeoplePresent(g_ipers); + g_vm->showPeoplePresent(g_ipers); else - displayAloneText(); + g_vm->displayAloneText(); clearScreenType2(); clearScreenType3(); g_maff = 68; @@ -2626,7 +2638,7 @@ void MortevielleEngine::handleOpcode() { if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) + if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != ROOM23) && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!_loseGame)) { if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index e067534b67..bc416e0615 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -72,10 +72,6 @@ extern int convertCharacterIndexToBitIndex(int characterIndex); /* NIVEAU 12 */ extern void modobj(int m); extern void repon(int f, int m); -extern void t5(int roomId); -extern void showPeoplePresent(int per); -extern int selectCharacters(int min, int max); -extern void displayAloneText(); extern int chlm(); extern void drawClock(); /************* @@ -83,7 +79,6 @@ extern void drawClock(); *************/ extern void debloc(int roomId); extern void getKnockAnswer(); -extern int nouvp(int roomId); extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int roomId); extern void becfren(int roomId); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c62af9901a..e3a8986a75 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -231,6 +231,7 @@ public: int getPresenceStatsAttic(); int getPresenceStatsLanding(); int getPresenceStatsChapel(int &hour); + int getPresenceBitIndex(int roomId); void setPresenceGreenRoom(int roomId); void setPresencePurpleRoom(); void setPresenceBlueRoom(); @@ -254,6 +255,10 @@ public: void loadPlaces(); void initGame(); + void resetPresenceInRooms(int roomId); + void showPeoplePresent(int per); + int selectCharacters(int min, int max); + void displayAloneText(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 0d3216d370..3e770b8655 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -454,7 +454,7 @@ void taffich() { showMouse(); if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) - displayAloneText(); + g_vm->displayAloneText(); else if (!g_vm->_blo) cx = t11(g_s._currPlace); g_mpers = 0; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 059e9b019e..150710ef6c 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -116,9 +116,9 @@ enum places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, - LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, MOUNTAIN = 19, - CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, WELL = 24, - DOOR = 25 + LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, + CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, ROOM23 = 23, WELL = 24, + DOOR = 25, ROOM26 = 26 }; struct sav_chaine { -- cgit v1.2.3 From 836b9513e6b8e520b562b0018c7f0afa4064d1e1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Mar 2012 18:25:17 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 332 ++++++++++++++++++------------------ engines/mortevielle/mor.cpp | 121 +++++++------ engines/mortevielle/mor.h | 8 +- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 16 +- engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 3 +- 7 files changed, 255 insertions(+), 228 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 390f7dadd2..8b4e5a751a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,35 +42,40 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((g_s._currPlace == ROOM26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { + if ((g_s._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; afdes(0); repon(2, g_s._currPlace); } - if ((g_s._currPlace == LANDING) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_GO_TO)); + if ((g_s._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { + if (!_syn) + ecr3(getEngineString(S_GO_TO)); tfleche(); - if (g_vm->_keyPressedEsc) - g_vm->_okdes = false; - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + + if (_keyPressedEsc) + _okdes = false; + + if ((_anyone) || (_keyPressedEsc)) return; tcoord(1); + if (g_num == 0) return; + if (g_num == 1) { g_s._currPlace = OWN_ROOM; - g_vm->_menu.setDestinationMenuText(OWN_ROOM); + _menu.setDestinationMenuText(OWN_ROOM); } else if (g_num == 7) { g_s._currPlace = ATTIC; - g_vm->_menu.setDestinationMenuText(ATTIC); + _menu.setDestinationMenuText(ATTIC); } else if (g_num != 6) g_s._currPlace = ROOM26; - if ((g_num > 1) && (g_num < 6)) + else if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; - if (g_num > 7) + else if (g_num > 7) g_ment = g_num - 3; + if (g_num != 6) affrep(); else @@ -78,17 +83,17 @@ void MortevielleEngine::fctMove() { return; } tsort(); - int cx = 0; - do { + int cx = 1; + + while (_menu._moveMenu[cx] != g_msg[4]) ++cx; - } while (g_vm->_menu._moveMenu[cx] != g_msg[4]); if (g_s._currPlace == MOUNTAIN) { if (cx == 1) - t1deva(); + gotoManorFront(); if (cx == 2) - t1neig(); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + checkManorDistance(); + _menu.setDestinationMenuText(g_s._currPlace); return; } @@ -96,18 +101,17 @@ void MortevielleEngine::fctMove() { if (cx == 1) t1deau(); if (cx == 2) - t1derr(); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + gotoManorBack(); + _menu.setDestinationMenuText(g_s._currPlace); return; } if ((g_s._currPlace == BUREAU) && (cx == 1)) cx = 6; - - if (g_s._currPlace == KITCHEN) { + else if (g_s._currPlace == KITCHEN) { if (cx == 2) cx = 6; - if (cx == 5) + else if (cx == 5) cx = 16; } @@ -127,9 +131,9 @@ void MortevielleEngine::fctMove() { } if ((g_s._currPlace == MANOR_BACK) && (cx > 14)) cx = 15; - if ((g_s._currPlace == WELL) && (cx != 17)) - if (cx > 13) - cx = 15; + else if ((g_s._currPlace == WELL) && (cx > 13) && (cx != 17)) + cx = 15; + if (cx == 1) g_s._currPlace = BUREAU; else if (cx == 2) @@ -140,20 +144,21 @@ void MortevielleEngine::fctMove() { g_s._currPlace = LANDING; else if (cx == 5) cx = 12; - if (cx == 6) + else if (cx == 6) cx = 11; + if (cx == 11) - t1sama(); + gotoDiningRoom(); else if (cx == 12) - t1deva(); + gotoManorFront(); else if (cx == 13) g_s._currPlace = CHAPEL; else if (cx == 14) g_s._currPlace = WELL; else if (cx == 15) - t1neig(); + checkManorDistance(); else if (cx == 16) - t1derr(); + gotoManorBack(); else if (cx == 17) { if ((g_s._wellObjectId != 120) && (g_s._wellObjectId != 140)) g_crep = 997; @@ -161,7 +166,7 @@ void MortevielleEngine::fctMove() { g_crep = 181; else if (g_s._faithScore > 80) { g_crep = 1505; - tperd(); + loseGame(); } else { g_s._currPlace = ROOM23; affrep(); @@ -170,7 +175,7 @@ void MortevielleEngine::fctMove() { if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); debloc(g_s._currPlace); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); } /** @@ -184,7 +189,7 @@ void MortevielleEngine::fctTake() { if (g_crep != 139) { if (g_ipers > 0) g_s._faithScore += 3; - if (g_vm->_obpart) { + if (_obpart) { if (g_s._currPlace == PURPLE_ROOM) g_s._purpleRoomObjectId = 0; if (g_s._currPlace == ATTIC) { @@ -201,8 +206,8 @@ void MortevielleEngine::fctTake() { g_s._secretPassageObjectId = 0; if (g_s._currPlace == WELL) g_s._wellObjectId = 0; - g_vm->_menu.unsetSearchMenu(); - g_vm->_obpart = false; + _menu.unsetSearchMenu(); + _obpart = false; affrep(); } else { g_tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; @@ -216,10 +221,10 @@ void MortevielleEngine::fctTake() { } return; } - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_TAKE)); + if (!_syn) + ecr3(getEngineString(S_TAKE)); tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; if (g_caff == 3) { tcoord(2); @@ -281,7 +286,7 @@ void MortevielleEngine::fctTake() { g_crep = 997; else if (g_s._currPlace == ROOM23) { g_crep = 1504; - tperd(); + loseGame(); } else g_crep = 120; } @@ -296,7 +301,7 @@ void MortevielleEngine::fctInventoryTake() { cx = 0; do { ++cx; - } while (g_vm->_menu._inventoryMenu[cx] != g_msg[4]); + } while (_menu._inventoryMenu[cx] != g_msg[4]); cz = 0; cy = 0; do { @@ -317,10 +322,10 @@ void MortevielleEngine::fctInventoryTake() { * @remarks Originally called 'tsoulever' */ void MortevielleEngine::fctLift() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_LIFT)); + if (!_syn) + ecr3(getEngineString(S_LIFT)); tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(3); if (g_num == 0) { @@ -354,10 +359,10 @@ void MortevielleEngine::fctRead() { if (g_caff > 99) st4(g_caff); else { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_READ)); + if (!_syn) + ecr3(getEngineString(S_READ)); tfleche(); - if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(_anyone) && !(_keyPressedEsc)) { tcoord(4); if (g_num != 0) g_crep = 107; @@ -387,10 +392,10 @@ void MortevielleEngine::fctLook() { g_crep = 103; return; } - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_LOOK)); + if (!_syn) + ecr3(getEngineString(S_LOOK)); tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(5); if (g_num == 0) { @@ -477,16 +482,16 @@ void MortevielleEngine::fctSearch() { return; } - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_SEARCH)); + if (!_syn) + ecr3(getEngineString(S_SEARCH)); tfleche(); - if (g_vm->_anyone || g_vm->_keyPressedEsc) + if (_anyone || _keyPressedEsc) return; if (g_s._currPlace == ROOM23) { g_crep = 1504; - tperd(); + loseGame(); return; } @@ -508,8 +513,8 @@ void MortevielleEngine::fctSearch() { if (g_mchai != 0) { g_cs = 0; g_is = 0; - g_vm->_heroSearching = true; - g_vm->_menu.setSearchMenu(); + _heroSearching = true; + _menu.setSearchMenu(); tsuiv(); } else g_crep = 997; @@ -574,13 +579,13 @@ void MortevielleEngine::fctSelfSearch() { * @remarks Originally called 'touvrir' */ void MortevielleEngine::fctOpen() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_OPEN)); + if (!_syn) + ecr3(getEngineString(S_OPEN)); if (g_caff == ROOM26) { if (g_ment != 0) { g_msg[4] = OPCODE_ENTER; - g_vm->_syn = true; + _syn = true; } else g_crep = 997; return; @@ -592,7 +597,7 @@ void MortevielleEngine::fctOpen() { } tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(7); @@ -615,7 +620,7 @@ void MortevielleEngine::fctOpen() { || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - g_vm->_speechManager.startSpeech(7, 9, 1); + _speechManager.startSpeech(7, 9, 1); } g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); @@ -641,14 +646,14 @@ void MortevielleEngine::fctPlace() { return; } - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_PUT)); + if (!_syn) + ecr3(getEngineString(S_PUT)); tfleche(); - if (g_vm->_keyPressedEsc) + if (_keyPressedEsc) g_crep = 998; - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(8); @@ -683,10 +688,10 @@ void MortevielleEngine::fctPlace() { aniof(1, 1); repon(2, 165); maivid(); - g_vm->_speechManager.startSpeech(6, -9, 1); + _speechManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { Common::String alertTxt = deline(582); Alert::show(alertTxt, 1); @@ -705,12 +710,12 @@ void MortevielleEngine::fctPlace() { else displayAloneText(); - g_vm->_menu.displayMenu(); + _menu.displayMenu(); if (enterPassageFl) { g_s._currPlace = SECRET_PASSAGE; - g_vm->_menu.setDestinationMenuText(SECRET_PASSAGE); + _menu.setDestinationMenuText(SECRET_PASSAGE); } else { - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); writepal(14); dessin(0); aniof(1, 2); @@ -745,7 +750,7 @@ void MortevielleEngine::fctPlace() { aniof(1, 1); } else { g_crep = 1512; - tperd(); + loseGame(); } } @@ -774,28 +779,28 @@ void MortevielleEngine::fctTurn() { g_crep = 149; return; } - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_TURN)); + if (!_syn) + ecr3(getEngineString(S_TURN)); tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(9); if (g_num != 0) { g_crep = 997; if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { repon(2, 167); - g_vm->_speechManager.startSpeech(7, 9, 1); - int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + _speechManager.startSpeech(7, 9, 1); + int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) - g_vm->_endGame = true; + _endGame = true; else g_crep = 168; } if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { repon(2, 175); clearScreenType3(); - g_vm->_speechManager.startSpeech(6, -9, 1); - int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + _speechManager.startSpeech(6, -9, 1); + int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { g_s._currPlace = CRYPT; affrep(); @@ -810,15 +815,15 @@ void MortevielleEngine::fctTurn() { * @remarks Originally called 'tcacher' */ void MortevielleEngine::fctSelfHide() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_HIDE_SELF)); + if (!_syn) + ecr3(getEngineString(S_HIDE_SELF)); tfleche(); - if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(_anyone) && !(_keyPressedEsc)) { tcoord(10); if (g_num == 0) - g_vm->_hiddenHero = false; + _hiddenHero = false; else { - g_vm->_hiddenHero = true; + _hiddenHero = true; g_crep = 999; } } @@ -832,10 +837,10 @@ void MortevielleEngine::fctAttach() { if (g_s._selectedObjectId == 0) g_crep = 186; else { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_TIE)); + if (!_syn) + ecr3(getEngineString(S_TIE)); tfleche(); - if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(_anyone) && !(_keyPressedEsc)) { tcoord(8); g_crep = 997; if ((g_num != 0) && (g_s._currPlace == WELL)) { @@ -856,14 +861,14 @@ void MortevielleEngine::fctAttach() { * @remarks Originally called 'tfermer' */ void MortevielleEngine::fctClose() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_CLOSE)); + if (!_syn) + ecr3(getEngineString(S_CLOSE)); if (g_caff < ROOM26) { tfleche(); - if (g_vm->_keyPressedEsc) + if (_keyPressedEsc) g_crep = 998; - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(7); if (g_num != 0) { @@ -896,19 +901,17 @@ void MortevielleEngine::fctClose() { * @remarks Originally called 'tfrapper' */ void MortevielleEngine::fctKnock() { - warning("Knock - _currPlace %d", g_s._currPlace); - - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_HIT)); + if (!_syn) + ecr3(getEngineString(S_HIT)); if (g_s._currPlace == LANDING) { - Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); + Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } if (g_s._currPlace < DOOR) { tfleche(); - if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) { + if (!(_anyone) && !(_keyPressedEsc)) { if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) g_crep = 133; else @@ -920,7 +923,7 @@ void MortevielleEngine::fctKnock() { if (g_s._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - g_vm->_speechManager.startSpeech(11, rand, 1); + _speechManager.startSpeech(11, rand, 1); int p; ecfren(p, rand, g_s._faithScore, g_ment); int l = g_ment; @@ -946,8 +949,8 @@ void MortevielleEngine::fctKnock() { * @remarks Originally called 'tposer' */ void MortevielleEngine::fctSelfPut() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_POSE)); + if (!_syn) + ecr3(getEngineString(S_POSE)); if (g_s._selectedObjectId == 0) g_crep = 186; else { @@ -959,7 +962,7 @@ void MortevielleEngine::fctSelfPut() { return; } tfleche(); - if ((g_vm->_anyone) || (g_vm->_keyPressedEsc)) + if ((_anyone) || (_keyPressedEsc)) return; tcoord(7); g_crep = 124; @@ -1085,7 +1088,7 @@ void MortevielleEngine::fctEat() { g_s._currPlace = DINING_ROOM; g_caff = 10; debloc(g_s._currPlace); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); int j, h, m; updateHour(j, h, m); @@ -1120,8 +1123,8 @@ void MortevielleEngine::fctEat() { */ void MortevielleEngine::fctEnter() { if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { - t1sama(); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + gotoDiningRoom(); + _menu.setDestinationMenuText(g_s._currPlace); } else if (g_s._currPlace == LANDING) aldepl(); else if (g_ment == 0) @@ -1131,29 +1134,29 @@ void MortevielleEngine::fctEnter() { g_s._teauto[8] = '*'; } else { int z = 0; - if (!g_vm->_blo) + if (!_blo) z = t11(g_ment); if (z != 0) { if ((g_ment == 3) || (g_ment == 7)) g_crep = 179; else { g_x = (getRandomNumber(0, 10)) - 5; - g_vm->_speechManager.startSpeech(7, g_x, 1); + _speechManager.startSpeech(7, g_x, 1); aniof(1, 1); g_x = convertBitIndexToCharacterIndex(z); ++g_s._faithScore; g_s._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; - g_msg[4] = g_vm->_menu._discussMenu[g_x]; - g_vm->_syn = true; + g_msg[4] = _menu._discussMenu[g_x]; + _syn = true; if (g_ment == 9) { - g_vm->_col = true; + _col = true; g_caff = 70; afdes(0); repon(2, g_caff); } else - g_vm->_col = false; + _col = false; debloc(g_ment); g_ment = 0; } @@ -1165,7 +1168,7 @@ void MortevielleEngine::fctEnter() { g_s._currPlace = g_ment; affrep(); debloc(g_s._currPlace); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); g_ment = 0; g_mpers = 0; g_ipers = 0; @@ -1190,12 +1193,12 @@ void MortevielleEngine::fctSleep() { affrep(); afdes(0); debloc(g_s._currPlace); - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); } clearScreenType3(); clearScreenType2(); ecrf2(); - ecr2(g_vm->getEngineString(S_WANT_TO_WAKE_UP)); + ecr2(getEngineString(S_WANT_TO_WAKE_UP)); updateHour(j, h, m); int answer; @@ -1213,8 +1216,8 @@ void MortevielleEngine::fctSleep() { if (h > 23) h = 0; tinke(); - answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); - g_vm->_anyone = false; + answer = Alert::show(getEngineString(S_YES_NO), 1); + _anyone = false; } while (answer != 1); g_crep = 998; g_num = 0; @@ -1225,12 +1228,12 @@ void MortevielleEngine::fctSleep() { * @remarks Originally called 'tdefoncer' */ void MortevielleEngine::fctForce() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_SMASH)); + if (!_syn) + ecr3(getEngineString(S_SMASH)); if (g_caff < 25) tfleche(); - if ((!g_vm->_anyone) && (!g_vm->_keyPressedEsc)) { + if ((!_anyone) && (!_keyPressedEsc)) { if (g_s._currPlace != ROOM26) g_crep = 997; else { @@ -1250,29 +1253,30 @@ void MortevielleEngine::fctLeave() { if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) g_crep = 997; else { - int lx = 0; + int nextPlace = OWN_ROOM; if ((g_s._currPlace < CRYPT) || (g_s._currPlace == ROOM26)) - lx = 10; - if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) - lx = 21; - if ((g_s._currPlace < DINING_ROOM) || (g_s._currPlace == ATTIC)) - lx = 15; - if (g_s._currPlace == CRYPT) { - lx = 17; + nextPlace = DINING_ROOM; + else if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) + nextPlace = MANOR_FRONT; + else if ((g_s._currPlace < DINING_ROOM) || (g_s._currPlace == ATTIC)) + nextPlace = LANDING; + else if (g_s._currPlace == CRYPT) { + nextPlace = SECRET_PASSAGE; g_crep = 176; - } - if (g_s._currPlace == SECRET_PASSAGE) - t23coul(lx); - if (g_s._currPlace == ROOM23) - lx = 24; + } else if (g_s._currPlace == SECRET_PASSAGE) + nextPlace = t23coul(); + else if (g_s._currPlace == ROOM23) + nextPlace = WELL; + if (g_crep != 997) - g_s._currPlace = lx; - g_caff = lx; + g_s._currPlace = nextPlace; + + g_caff = nextPlace; if (g_crep == 0) - g_crep = lx; - debloc(lx); - g_vm->_menu.setDestinationMenuText(lx); + g_crep = nextPlace; + debloc(nextPlace); + _menu.setDestinationMenuText(nextPlace); } } @@ -1288,24 +1292,24 @@ void MortevielleEngine::fctWait() { do { ++g_jh; tinke(); - if (!g_vm->_blo) + if (!_blo) t11(g_s._currPlace); if ((g_ipers != 0) && (g_mpers == 0)) { g_crep = 998; if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) cavegre(); if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) - g_vm->_anyone = true; + _anyone = true; g_mpers = g_ipers; - if (!g_vm->_anyone) + if (!_anyone) tinke(); return; } repon(2, 102); - answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + answer = Alert::show(getEngineString(S_YES_NO), 1); } while (answer != 2); g_crep = 998; - if (!g_vm->_anyone) + if (!_anyone) tinke(); } @@ -1314,11 +1318,11 @@ void MortevielleEngine::fctWait() { * @remarks Originally called 'tsonder' */ void MortevielleEngine::fctSound() { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_PROBE2)); + if (!_syn) + ecr3(getEngineString(S_PROBE2)); if (g_caff < 27) { tfleche(); - if (!(g_vm->_anyone) && (!g_vm->_keyPressedEsc)) + if (!(_anyone) && (!_keyPressedEsc)) g_crep = 145; g_num = 0; } @@ -1336,13 +1340,13 @@ void MortevielleEngine::fctDiscuss() { bool f; endSearch(); - if (g_vm->_col) + if (_col) suj = 128; else { cx = 0; do { ++cx; - } while (g_vm->_menu._discussMenu[cx] != g_msg[4]); + } while (_menu._discussMenu[cx] != g_msg[4]); g_caff = 69 + cx; afdes(0); repon(2, g_caff); @@ -1372,7 +1376,7 @@ void MortevielleEngine::fctDiscuss() { lig = 0; do { ++icm; - g_vm->_screenSurface.putxy(co, lig); + _screenSurface.putxy(co, lig); if (g_s._teauto[icm] == '*') { if (te[icm]) writetp(lib[icm], 1); @@ -1386,7 +1390,7 @@ void MortevielleEngine::fctDiscuss() { } else lig = lig + 8; } while (icm != 42); - g_vm->_screenSurface.putxy(320, 176); + _screenSurface.putxy(320, 176); writetp(lib[46], 0); tou = '\0'; do { @@ -1407,7 +1411,7 @@ void MortevielleEngine::fctDiscuss() { co = 320; else co = 0; - g_vm->_screenSurface.putxy(co, lig); + _screenSurface.putxy(co, lig); if (te[choi]) writetp(lib[choi], 0); else @@ -1426,7 +1430,7 @@ void MortevielleEngine::fctDiscuss() { co = 320; else co = 0; - g_vm->_screenSurface.putxy(co, lig); + _screenSurface.putxy(co, lig); if (te[choi]) writetp(lib[choi], 0); else @@ -1439,7 +1443,7 @@ void MortevielleEngine::fctDiscuss() { co = 320; else co = 0; - g_vm->_screenSurface.putxy(co, lig); + _screenSurface.putxy(co, lig); if (te[ix]) writetp(lib[ix], 0); else @@ -1450,12 +1454,12 @@ void MortevielleEngine::fctDiscuss() { choi = 0; } } - } while (!((tou == '\15') || (((c != 0) || g_vm->getMouseClick()) && (choi != 0)))); - g_vm->setMouseClick(false); + } while (!((tou == '\15') || (((c != 0) || getMouseClick()) && (choi != 0)))); + setMouseClick(false); if (choi != 46) { int ix = choi - 1; - if (g_vm->_col) { - g_vm->_col = false; + if (_col) { + _col = false; g_s._currPlace = 15; if (g_iouv > 0) max = 8; @@ -1498,14 +1502,14 @@ void MortevielleEngine::fctDiscuss() { showMouse(); } } while ((choi != 46) && (suj != 138)); - if (g_vm->_col) { + if (_col) { g_s._faithScore += (3 * (g_s._faithScore / 10)); hideMouse(); hirs(); premtet(); sparl(0, 138); showMouse(); - g_vm->_col = false; + _col = false; g_s._currPlace = LANDING; } g_ctrm = 0; @@ -1518,7 +1522,7 @@ void MortevielleEngine::fctDiscuss() { drawClock(); affrep(); /* chech;*/ - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); clearScreenType3(); } @@ -1529,10 +1533,10 @@ void MortevielleEngine::fctDiscuss() { void MortevielleEngine::fctSmell() { g_crep = 119; if (g_caff < ROOM26) { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_SMELL)); + if (!_syn) + ecr3(getEngineString(S_SMELL)); tfleche(); - if (!(g_vm->_anyone) && !(g_vm->_keyPressedEsc)) + if (!(_anyone) && !(_keyPressedEsc)) if (g_caff == 16) g_crep = 153; } else if (g_caff == 123) @@ -1547,8 +1551,8 @@ void MortevielleEngine::fctSmell() { void MortevielleEngine::fctScratch() { g_crep = 155; if (g_caff < 27) { - if (!g_vm->_syn) - ecr3(g_vm->getEngineString(S_SCRATCH)); + if (!_syn) + ecr3(getEngineString(S_SCRATCH)); tfleche(); } g_num = 0; @@ -1596,7 +1600,7 @@ void MortevielleEngine::endGame() { * You lost! * @remarks Originally called 'tencore' */ -void MortevielleEngine::loseGame() { +void MortevielleEngine::askRestart() { clearScreenType2(); musique(0); tkey1(false); @@ -1611,7 +1615,7 @@ void MortevielleEngine::loseGame() { g_day = 0; repon(2, 180); - int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); + int answer = Alert::show(getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4b6a7b317d..9510360abb 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1946,26 +1946,28 @@ void affrep() { g_crep = g_s._currPlace; } -/* NIVEAU 6 */ - -void tperd() { +/** + * Engine function - You lose! + * @remarks Originally called 'tperd' + */ +void MortevielleEngine::loseGame() { initouv(); g_ment = 0; g_iouv = 0; g_mchai = 0; - g_vm->_menu.unsetSearchMenu(); - if (!g_vm->_blo) + _menu.unsetSearchMenu(); + if (!_blo) t11(MANOR_FRONT); - g_vm->_loseGame = true; + _loseGame = true; clearScreenType1(); - g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15); + _screenSurface.drawBox(60, 35, 400, 50, 15); repon(9, g_crep); clearScreenType2(); clearScreenType3(); - g_vm->_col = false; - g_vm->_syn = false; - g_vm->_okdes = false; + _col = false; + _syn = false; + _okdes = false; } void tsort() { @@ -2015,15 +2017,19 @@ void st4(int ob) { } } -void cherjer(int ob, bool &d) { - int cx; +/** + * Engine function - Check inventory for a given object + * @remarks Originally called 'cherjer' + */ +bool MortevielleEngine::checkInventory(int objectId) { + bool retVal = false; + for (int i = 1; i <= 6; ++i) + retVal = (retVal || (ord(g_s._sjer[i]) == objectId)); - d = false; - for (cx = 1; cx <= 6; ++cx) - d = (d || (ord(g_s._sjer[cx]) == ob)); + if (g_s._selectedObjectId == objectId) + retVal = true; - if (g_s._selectedObjectId == ob) - d = true; + return retVal; } void st1sama() { @@ -2036,19 +2042,22 @@ void modinv() { Common::String nomp; int cy = 0; - for (int cx = 1; cx <= 6; ++cx) - if (g_s._sjer[cx] != chr(0)) { + for (int i = 1; i <= 6; ++i) { + if (g_s._sjer[i] != chr(0)) { ++cy; - r = (ord(g_s._sjer[cx]) + 400); + r = (ord(g_s._sjer[i]) + 400); nomp = deline(r - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); - g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[cx]); + g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); } - if (cy < 6) - for (int cx = cy + 1; cx <= 6; ++cx) { - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cx], " "); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[cx]); + } + + if (cy < 6) { + for (int i = cy + 1; i <= 6; ++i) { + g_vm->_menu.setText(g_vm->_menu._inventoryMenu[i], " "); + g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[i]); } + } } void sparl(float adr, float rep) { @@ -2119,16 +2128,18 @@ void ajjer(int ob) { g_crep = 139; } -void t1sama() { //Entering manor +/** + * Engine function - Go to Dining room + * @remarks Originally called 't1sama' + */ +void MortevielleEngine::gotoDiningRoom() { int day, hour, minute; updateHour(day, hour, minute); if ((hour < 5) && (g_s._currPlace > ROOM18)) { - bool d; - cherjer(137, d); - if (!d) { //You don't have the keys, and it's late + if (!checkInventory(137)) { //You don't have the keys, and it's late g_crep = 1511; - tperd(); + loseGame(); } else st1sama(); } else if (!g_s._ipre) { //Is it your first time? @@ -2164,32 +2175,44 @@ void t1vier() { affrep(); } -void t1neig() { - ++g_inei; - if (g_inei > 2) { +/** + * Engine function - Check Manor distance (in the mountains) + * @remarks Originally called 't1neig' + */ +void MortevielleEngine::checkManorDistance() { + ++_manorDistance; + if (_manorDistance > 2) { g_crep = 1506; - tperd(); + loseGame(); } else { - g_vm->_okdes = true; + _okdes = true; g_s._currPlace = MOUNTAIN; affrep(); } } -void t1deva() { - g_inei = 0; +/** + * Engine function - Go to Manor front + * @remarks Originally called 't1deva' + */ +void MortevielleEngine::gotoManorFront() { + _manorDistance = 0; g_s._currPlace = MANOR_FRONT; affrep(); } -void t1derr() { +/** + * Engine function - Go to Manor back + * @remarks Originally called 't1derr' + */ +void MortevielleEngine::gotoManorBack() { g_s._currPlace = MANOR_BACK; affrep(); } void t1deau() { g_crep = 1503; - tperd(); + g_vm->loseGame(); } void tctrm() { @@ -2425,15 +2448,13 @@ void rechai(int &ch) { ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } -void t23coul(int &l) { - bool d; - - cherjer(143, d); - l = 14; - if (!d) { +int t23coul() { + if (!g_vm->checkInventory(143)) { g_crep = 1512; - tperd(); + g_vm->loseGame(); } + + return CELLAR; } void maivid() { @@ -2508,7 +2529,7 @@ void MortevielleEngine::gameLoaded() { _syn = true; _heroSearching = true; g_mchai = 0; - g_inei = 0; + _manorDistance = 0; initouv(); g_iouv = 0; g_dobj = 0; @@ -2642,15 +2663,15 @@ void MortevielleEngine::handleOpcode() { && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!_loseGame)) { if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; - tperd(); + loseGame(); } if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { g_crep = 1508; - tperd(); + loseGame(); } if ((day > 1) && (hour > 8) && (!_loseGame)) { g_crep = 1502; - tperd(); + loseGame(); } } mennor(); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index bc416e0615..5e76042cf0 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -109,10 +109,8 @@ extern void tkey1(bool d); extern void tlu(int af, int ob); extern void affrep(); /* NIVEAU 6 */ -extern void tperd(); extern void tsort(); extern void st4(int ob); -extern void cherjer(int ob, bool &d); extern void st1sama(); extern void modinv(); extern void sparl(float adr, float rep); @@ -122,11 +120,7 @@ extern void premtet(); /* NIVEAU 5 */ extern void ajchai(); extern void ajjer(int ob); -extern void t1sama(); extern void t1vier(); -extern void t1neig(); -extern void t1deva(); -extern void t1derr(); extern void t1deau(); extern void tctrm(); extern void quelquun(); @@ -137,7 +131,7 @@ extern void st7(int ob); extern void treg(int ob); extern void avpoing(int &ob); extern void rechai(int &ch); -extern void t23coul(int &l); +extern int t23coul(); extern void maivid(); extern void st13(int ob); extern void aldepl(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 508e90fff7..6e7726bb35 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -566,7 +566,7 @@ void MortevielleEngine::playGame() { if (_endGame) endGame(); else if (_loseGame) - loseGame(); + askRestart(); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e3a8986a75..f868f01fbf 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -143,6 +143,8 @@ public: int _currGraphicalDevice; int _newGraphicalDevice; int _place; + int _manorDistance; + int _c_zzz; int ptr_word; @@ -162,7 +164,8 @@ public: bool _endGame; // End game flag. Originally called 'solu' bool _loseGame; // Lose game flag. Originally called 'perdu' bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file -public: + + MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; @@ -186,10 +189,9 @@ public: void handleOpcode(); void endGame(); - void loseGame(); + void askRestart(); void gameLoaded(); -/* NIVEAU 4 */ void fctMove(); void fctTake(); void fctInventoryTake(); @@ -259,6 +261,14 @@ public: void showPeoplePresent(int per); int selectCharacters(int min, int max); void displayAloneText(); + + void checkManorDistance(); + void gotoManorFront(); + void gotoManorBack(); + void gotoDiningRoom(); + bool checkInventory(int objectId); + void loseGame(); + }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index f548ed69aa..6ed5ef8a9c 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -102,7 +102,6 @@ int g_x, g_crep, g_ades, g_iouv, - g_inei, g_ctrm, g_dobj, g_msg3, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 150710ef6c..ae114efcdd 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -118,7 +118,7 @@ enum places { DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, ROOM23 = 23, WELL = 24, - DOOR = 25, ROOM26 = 26 + DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; struct sav_chaine { @@ -208,7 +208,6 @@ extern int g_x, g_crep, g_ades, g_iouv, - g_inei, g_ctrm, g_dobj, g_msg3, -- cgit v1.2.3 From 09195469171fe713964af8478c1cc4e5e28dc7cb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Mar 2012 23:06:23 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 167 +++++++++++++++++++------------------- engines/mortevielle/mor.cpp | 80 +++++++++--------- engines/mortevielle/mor.h | 1 - engines/mortevielle/mortevielle.h | 5 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 14 ++-- 8 files changed, 138 insertions(+), 134 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 8b4e5a751a..4f16218e9e 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -58,6 +58,7 @@ void MortevielleEngine::fctMove() { if ((_anyone) || (_keyPressedEsc)) return; + tcoord(1); if (g_num == 0) @@ -83,83 +84,78 @@ void MortevielleEngine::fctMove() { return; } tsort(); - int cx = 1; + int menuChoice = 1; - while (_menu._moveMenu[cx] != g_msg[4]) - ++cx; + while (_menu._moveMenu[menuChoice] != g_msg[4]) + ++menuChoice; if (g_s._currPlace == MOUNTAIN) { - if (cx == 1) + if (menuChoice == 1) gotoManorFront(); - if (cx == 2) + else if (menuChoice == 2) checkManorDistance(); _menu.setDestinationMenuText(g_s._currPlace); return; - } - - if (g_s._currPlace == ROOM23) { - if (cx == 1) - t1deau(); - if (cx == 2) + } else if (g_s._currPlace == INSIDE_WELL) { + if (menuChoice == 1) + floodedInWell(); + else if (menuChoice == 2) gotoManorBack(); _menu.setDestinationMenuText(g_s._currPlace); return; - } - - if ((g_s._currPlace == BUREAU) && (cx == 1)) - cx = 6; + } else if ((g_s._currPlace == BUREAU) && (menuChoice == 1)) + menuChoice = 6; else if (g_s._currPlace == KITCHEN) { - if (cx == 2) - cx = 6; - else if (cx == 5) - cx = 16; - } - - if ((g_s._currPlace == CELLAR) && (cx == 3)) - cx = 6; - if (((g_s._currPlace == LANDING) || (g_s._currPlace == ROOM26)) && (cx == 4)) - cx = 6; + if (menuChoice == 2) + menuChoice = 6; + else if (menuChoice == 5) + menuChoice = 16; + } else if ((g_s._currPlace == CELLAR) && (menuChoice == 3)) + menuChoice = 6; + else if (((g_s._currPlace == LANDING) || (g_s._currPlace == ROOM26)) && (menuChoice == 4)) + menuChoice = 6; + if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != ROOM26)) - cx += 10; - if ((g_s._currPlace == CHAPEL) && (cx == 13)) - cx = 16; - if (g_s._currPlace == MANOR_FRONT) { - if (cx == 12) - cx = 16; - else if (cx > 13) - cx = 15; - } - if ((g_s._currPlace == MANOR_BACK) && (cx > 14)) - cx = 15; - else if ((g_s._currPlace == WELL) && (cx > 13) && (cx != 17)) - cx = 15; - - if (cx == 1) + menuChoice += 10; + + if ((g_s._currPlace == CHAPEL) && (menuChoice == 13)) + menuChoice = 16; + else if (g_s._currPlace == MANOR_FRONT) { + if (menuChoice == 12) + menuChoice = 16; + else if (menuChoice > 13) + menuChoice = 15; + } else if ((g_s._currPlace == MANOR_BACK) && (menuChoice > 14)) + menuChoice = 15; + else if ((g_s._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17)) + menuChoice = 15; + + if (menuChoice == 1) g_s._currPlace = BUREAU; - else if (cx == 2) + else if (menuChoice == 2) g_s._currPlace = KITCHEN; - else if (cx == 3) + else if (menuChoice == 3) g_s._currPlace = CELLAR; - else if (cx == 4) + else if (menuChoice == 4) g_s._currPlace = LANDING; - else if (cx == 5) - cx = 12; - else if (cx == 6) - cx = 11; + else if (menuChoice == 5) + menuChoice = 12; + else if (menuChoice == 6) + menuChoice = 11; - if (cx == 11) + if (menuChoice == 11) gotoDiningRoom(); - else if (cx == 12) + else if (menuChoice == 12) gotoManorFront(); - else if (cx == 13) + else if (menuChoice == 13) g_s._currPlace = CHAPEL; - else if (cx == 14) + else if (menuChoice == 14) g_s._currPlace = WELL; - else if (cx == 15) + else if (menuChoice == 15) checkManorDistance(); - else if (cx == 16) + else if (menuChoice == 16) gotoManorBack(); - else if (cx == 17) { + else if (menuChoice == 17) { if ((g_s._wellObjectId != 120) && (g_s._wellObjectId != 140)) g_crep = 997; else if (g_s._wellObjectId == 120) @@ -168,11 +164,11 @@ void MortevielleEngine::fctMove() { g_crep = 1505; loseGame(); } else { - g_s._currPlace = ROOM23; + g_s._currPlace = INSIDE_WELL; affrep(); } } - if ((cx < 5) || (cx == 13) || (cx == 14)) + if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) affrep(); debloc(g_s._currPlace); _menu.setDestinationMenuText(g_s._currPlace); @@ -187,7 +183,7 @@ void MortevielleEngine::fctTake() { int cx = g_caff; avpoing(cx); if (g_crep != 139) { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 3; if (_obpart) { if (g_s._currPlace == PURPLE_ROOM) @@ -237,7 +233,7 @@ void MortevielleEngine::fctTake() { if ((g_num == 0) || ((g_num == 1) && (g_s._currPlace == CRYPT))) { tcoord(8); if (g_num != 0) { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 3; g_crep = 997; if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) @@ -276,15 +272,22 @@ void MortevielleEngine::fctTake() { g_crep = 999; } } else { - if ( ((g_s._currPlace == OWN_ROOM) && (g_num == 3)) || ((g_s._currPlace == GREEN_ROOM) && (g_num == 4)) - || ((g_s._currPlace == PURPLE_ROOM) && (g_num == 1)) || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 3)) - || ((g_s._currPlace == BLUE_ROOM) && (g_num == 6)) || ((g_s._currPlace == RED_ROOM) && (g_num == 2)) - || ((g_s._currPlace == BATHROOM) && (g_num == 6)) || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) - || ((g_s._currPlace == 9) && (g_num == 4)) || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) - || ((g_s._currPlace == BUREAU) && (g_num == 7)) || ((g_s._currPlace == KITCHEN) && (g_num == 6)) - || ((g_s._currPlace == ATTIC) && (g_num > 4)) || ((g_s._currPlace > ATTIC) && (g_s._currPlace != ROOM23)) ) + if ( ((g_s._currPlace == OWN_ROOM) && (g_num == 3)) + || ((g_s._currPlace == GREEN_ROOM) && (g_num == 4)) + || ((g_s._currPlace == PURPLE_ROOM) && (g_num == 1)) + || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 3)) + || ((g_s._currPlace == BLUE_ROOM) && (g_num == 6)) + || ((g_s._currPlace == RED_ROOM) && (g_num == 2)) + || ((g_s._currPlace == BATHROOM) && (g_num == 6)) + || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) + || ((g_s._currPlace == ROOM9) && (g_num == 4)) + || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) + || ((g_s._currPlace == BUREAU) && (g_num == 7)) + || ((g_s._currPlace == KITCHEN) && (g_num == 6)) + || ((g_s._currPlace == ATTIC) && (g_num > 4)) + || ((g_s._currPlace > ATTIC) && (g_s._currPlace != INSIDE_WELL)) ) g_crep = 997; - else if (g_s._currPlace == ROOM23) { + else if (g_s._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); } else @@ -331,7 +334,7 @@ void MortevielleEngine::fctLift() { if (g_num == 0) { tcoord(8); if (g_num != 0) { - if (g_ipers > 0) + if (_currBitIndex > 0) ++g_s._faithScore; g_crep = 997; if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) @@ -339,7 +342,7 @@ void MortevielleEngine::fctLift() { } return; } - if (g_ipers > 0) + if (_currBitIndex > 0) ++g_s._faithScore; int tmpPlace = g_s._currPlace; if (g_s._currPlace == CRYPT) @@ -489,7 +492,7 @@ void MortevielleEngine::fctSearch() { if (_anyone || _keyPressedEsc) return; - if (g_s._currPlace == ROOM23) { + if (g_s._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); return; @@ -506,7 +509,7 @@ void MortevielleEngine::fctSearch() { if (g_num != ord(g_touv[cx])) g_crep = 187; else { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 3; rechai(g_mchai); @@ -523,7 +526,7 @@ void MortevielleEngine::fctSearch() { tcoord(8); g_crep = 997; if (g_num != 0) { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 3; if ((g_s._currPlace != WELL) && (g_s._currPlace != SECRET_PASSAGE) && (g_s._currPlace != ATTIC)) { if (g_s._currPlace == PURPLE_ROOM) { @@ -540,7 +543,7 @@ void MortevielleEngine::fctSearch() { } } } else { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 3; g_crep = 997; if (g_s._currPlace < CELLAR) @@ -602,7 +605,7 @@ void MortevielleEngine::fctOpen() { tcoord(7); if (g_num != 0) { - if (g_ipers > 0) + if (_currBitIndex > 0) g_s._faithScore += 2; ++g_iouv; int tmpPlace = 0; @@ -705,8 +708,8 @@ void MortevielleEngine::fctPlace() { showMouse(); tinke(); drawClock(); - if (g_ipers != 0) - showPeoplePresent(g_ipers); + if (_currBitIndex != 0) + showPeoplePresent(_currBitIndex); else displayAloneText(); @@ -1027,7 +1030,7 @@ void MortevielleEngine::fctSelfPut() { } } } - if (g_caff == ROOM23) + if (g_caff == INSIDE_WELL) g_crep = 185; if ((g_crep == 999) || (g_crep == 185) || (g_crep == 998)) { if (g_crep == 999) @@ -1046,7 +1049,7 @@ void MortevielleEngine::fctListen() { if (g_s._currPlace != ROOM26) g_crep = 101; else { - if (g_ipers != 0) + if (_currBitIndex != 0) ++g_s._faithScore; int p, rand; ecfren(p, rand, g_s._faithScore, g_ment); @@ -1171,7 +1174,7 @@ void MortevielleEngine::fctEnter() { _menu.setDestinationMenuText(g_s._currPlace); g_ment = 0; g_mpers = 0; - g_ipers = 0; + _currBitIndex = 0; } } } @@ -1266,7 +1269,7 @@ void MortevielleEngine::fctLeave() { g_crep = 176; } else if (g_s._currPlace == SECRET_PASSAGE) nextPlace = t23coul(); - else if (g_s._currPlace == ROOM23) + else if (g_s._currPlace == INSIDE_WELL) nextPlace = WELL; if (g_crep != 997) @@ -1294,13 +1297,13 @@ void MortevielleEngine::fctWait() { tinke(); if (!_blo) t11(g_s._currPlace); - if ((g_ipers != 0) && (g_mpers == 0)) { + if ((_currBitIndex != 0) && (g_mpers == 0)) { g_crep = 998; if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) cavegre(); if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) _anyone = true; - g_mpers = g_ipers; + g_mpers = _currBitIndex; if (!_anyone) tinke(); return; @@ -1517,7 +1520,7 @@ void MortevielleEngine::fctDiscuss() { hirs(); drawRightFrame(); showMouse(); - showPeoplePresent(g_ipers); + showPeoplePresent(_currBitIndex); tinke(); drawClock(); affrep(); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 9510360abb..a3a0ef7e96 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -558,54 +558,54 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { * Engine function - Show the people present in the given room * @remarks Originally called 'affper' */ -void MortevielleEngine::showPeoplePresent(int per) { +void MortevielleEngine::showPeoplePresent(int bitIndex) { int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) _menu.disableMenuItem(_menu._discussMenu[i]); clearScreenType10(); - if ((per & 128) == 128) { + if ((bitIndex & 128) == 128) { _screenSurface.putxy(xp, 24); _screenSurface.drawString("LEO", 4); _menu.enableMenuItem(_menu._discussMenu[1]); } - if ((per & 64) == 64) { + if ((bitIndex & 64) == 64) { _screenSurface.putxy(xp, 32); _screenSurface.drawString("PAT", 4); _menu.enableMenuItem(_menu._discussMenu[2]); } - if ((per & 32) == 32) { + if ((bitIndex & 32) == 32) { _screenSurface.putxy(xp, 40); _screenSurface.drawString("GUY", 4); _menu.enableMenuItem(_menu._discussMenu[3]); } - if ((per & 16) == 16) { + if ((bitIndex & 16) == 16) { _screenSurface.putxy(xp, 48); _screenSurface.drawString("EVA", 4); _menu.enableMenuItem(_menu._discussMenu[4]); } - if ((per & 8) == 8) { + if ((bitIndex & 8) == 8) { _screenSurface.putxy(xp, 56); _screenSurface.drawString("BOB", 4); _menu.enableMenuItem(_menu._discussMenu[5]); } - if ((per & 4) == 4) { + if ((bitIndex & 4) == 4) { _screenSurface.putxy(xp, 64); _screenSurface.drawString("LUC", 4); _menu.enableMenuItem(_menu._discussMenu[6]); } - if ((per & 2) == 2) { + if ((bitIndex & 2) == 2) { _screenSurface.putxy(xp, 72); _screenSurface.drawString("IDA", 4); _menu.enableMenuItem(_menu._discussMenu[7]); } - if ((per & 1) == 1) { + if ((bitIndex & 1) == 1) { _screenSurface.putxy(xp, 80); _screenSurface.drawString("MAX", 4); _menu.enableMenuItem(_menu._discussMenu[8]); } - g_ipers = per; + _currBitIndex = bitIndex; } /** @@ -771,7 +771,7 @@ void MortevielleEngine::displayAloneText() { _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); _screenSurface.drawString(sAlone, 4); - g_ipers = 0; + _currBitIndex = 0; } int chlm() { @@ -843,7 +843,7 @@ void debloc(int roomId) { g_y = 0; if ((roomId != ROOM26) && (roomId != LANDING)) g_vm->resetPresenceInRooms(roomId); - g_mpers = g_ipers; + g_mpers = g_vm->_currBitIndex; } /** @@ -989,7 +989,7 @@ void MortevielleEngine::setPresenceGreenRoom(int roomId) { _roomPresenceEva = true; } - g_ipers = 10; + _currBitIndex = 10; } /** @@ -1002,7 +1002,7 @@ void MortevielleEngine::setPresencePurpleRoom() { else _room9PresenceLeo = true; - g_ipers = 10; + _currBitIndex = 10; } /** @@ -1011,7 +1011,7 @@ void MortevielleEngine::setPresencePurpleRoom() { */ void MortevielleEngine::setPresenceBlueRoom() { _roomPresenceMax = true; - g_ipers = 10; + _currBitIndex = 10; } /** @@ -1024,7 +1024,7 @@ void MortevielleEngine::setPresenceRedRoom(int roomId) { else if (roomId == GREEN_ROOM2) _roomPresencePat = true; - g_ipers = 10; + _currBitIndex = 10; } /** @@ -1310,7 +1310,7 @@ void phaz(int &rand, int &p, int cf) { void resetVariables() { copcha(); - g_s._ipre = false; + g_s._alreadyEnteredManor = false; g_s._selectedObjectId = 0; g_s._cellarObjectId = 0; g_s._atticBallHoleObjectId = 0; @@ -1358,7 +1358,7 @@ void resetVariables() { void MortevielleEngine::initGame() { _place = MANOR_FRONT; g_jh = 0; - if (!g_s._ipre) + if (!g_s._alreadyEnteredManor) _blo = true; g_t = kTime1; g_mh = readclock(); @@ -1654,7 +1654,7 @@ void musique(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((g_prebru == 0) && (!g_s._ipre)) { + } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { g_vm->_speechManager.startSpeech(10, 1, 1); ++g_prebru; } else { @@ -1674,7 +1674,7 @@ void musique(int so) { g_vm->_speechManager.startSpeech(12, 1, 1); i = true; } - } else if (g_s._currPlace == ROOM23) { + } else if (g_s._currPlace == INSIDE_WELL) { g_vm->_speechManager.startSpeech(13, 1, 1); i = true; } @@ -1839,14 +1839,14 @@ void tinke() { g_vm->setRandomPresenceChapel(cf); break; } - if ((g_mpers != 0) && (g_ipers != 10)) - g_mpers = g_ipers; + if ((g_mpers != 0) && (g_vm->_currBitIndex != 10)) + g_mpers = g_vm->_currBitIndex; - if ((g_mpers == 0) && (g_ipers > 0)) { + if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) { if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { cavegre(); - } else if (g_ipers == 10) { - g_ipers = 0; + } else if (g_vm->_currBitIndex == 10) { + g_vm->_currBitIndex = 0; if (!g_vm->_brt) { g_vm->_brt = true; g_hdb = readclock(); @@ -1901,7 +1901,7 @@ void afdes(int ad) { } void tkey1(bool d) { - bool quest; + bool quest = false; int x, y, c; hideMouse(); @@ -2142,9 +2142,9 @@ void MortevielleEngine::gotoDiningRoom() { loseGame(); } else st1sama(); - } else if (!g_s._ipre) { //Is it your first time? - g_ipers = 255; - g_vm->showPeoplePresent(g_ipers); + } else if (!g_s._alreadyEnteredManor) { //Is it your first time? + _currBitIndex = 255; // Everybody is present + g_vm->showPeoplePresent(_currBitIndex); g_caff = 77; afdes(0); g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); @@ -2163,9 +2163,9 @@ void MortevielleEngine::gotoDiningRoom() { g_vm->resetPresenceInRooms(DINING_ROOM); if (!g_vm->_blo) minute = t11(OWN_ROOM); - g_ipers = 0; + _currBitIndex = 0; g_mpers = 0; - g_s._ipre = true; + g_s._alreadyEnteredManor = true; } else st1sama(); } @@ -2210,7 +2210,11 @@ void MortevielleEngine::gotoManorBack() { affrep(); } -void t1deau() { +/** + * Engine function - Dead : Flooded in Well + * @remarks Originally called 't1deau' + */ +void MortevielleEngine::floodedInWell() { g_crep = 1503; g_vm->loseGame(); } @@ -2245,7 +2249,7 @@ L1: g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); g_vm->_menu.setDestinationMenuText(LANDING); - int cx = convertBitIndexToCharacterIndex(g_ipers); + int cx = convertBitIndexToCharacterIndex(g_vm->_currBitIndex); g_caff = 69 + cx; g_crep = g_caff; g_msg[3] = MENU_DISCUSS; @@ -2288,7 +2292,7 @@ void tsuiv() { ++g_is; g_caff = tbcl; g_crep = g_caff + 400; - if (g_ipers != 0) + if (g_vm->_currBitIndex != 0) g_s._faithScore += 2; } else { affrep(); @@ -2490,8 +2494,8 @@ void changeGraphicalDevice(int newDevice) { drawRightFrame(); tinke(); drawClock(); - if (g_ipers != 0) - g_vm->showPeoplePresent(g_ipers); + if (g_vm->_currBitIndex != 0) + g_vm->showPeoplePresent(g_vm->_currBitIndex); else g_vm->displayAloneText(); clearScreenType2(); @@ -2659,8 +2663,8 @@ void MortevielleEngine::handleOpcode() { if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != ROOM23) - && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!_loseGame)) { + if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL) + && (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) { if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; loseGame(); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 5e76042cf0..43413b3a89 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -121,7 +121,6 @@ extern void premtet(); extern void ajchai(); extern void ajjer(int ob); extern void t1vier(); -extern void t1deau(); extern void tctrm(); extern void quelquun(); extern void tsuiv(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index f868f01fbf..52c68fa44d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -144,6 +144,7 @@ public: int _newGraphicalDevice; int _place; int _manorDistance; + int _currBitIndex; int _c_zzz; @@ -165,7 +166,6 @@ public: bool _loseGame; // Lose game flag. Originally called 'perdu' bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file - MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; @@ -258,7 +258,7 @@ public: void loadPlaces(); void initGame(); void resetPresenceInRooms(int roomId); - void showPeoplePresent(int per); + void showPeoplePresent(int bitIndex); int selectCharacters(int min, int max); void displayAloneText(); @@ -268,6 +268,7 @@ public: void gotoDiningRoom(); bool checkInventory(int objectId); void loseGame(); + void floodedInWell(); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 3e770b8655..45cbb1b420 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -377,7 +377,7 @@ void taffich() { if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) m = 2030; - if (((a < 27) && (((g_maff > 69) && (!g_s._ipre)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + if (((a < 27) && (((g_maff > 69) && (!g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; g_maff = a; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 37b33766ff..9e17252734 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -60,7 +60,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_s1._selectedObjectId); sz.syncAsSint16LE(g_s1._purpleRoomObjectId); sz.syncAsSint16LE(g_s1._cryptObjectId); - sz.syncAsByte(g_s1._ipre); + sz.syncAsByte(g_s1._alreadyEnteredManor); sz.syncAsByte(g_s1._heure); sz.syncBytes(g_bufcha, 391); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 6ed5ef8a9c..9b48ed3fd6 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -109,7 +109,6 @@ int g_x, g_mlec, g_mchai, g_menup, - g_ipers, g_mpers, g_mnumo, g_xprec, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index ae114efcdd..22ec5ccbee 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -107,17 +107,16 @@ extern const byte g_rang[16]; /* 9 "A glance at the forbidden$", 18 "It's already open$", -23 "Strange horoscope$", 26 "A photograph$", 27 "The coat of arms$", */ enum places { - OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, - BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, - DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, - LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, - CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, ROOM23 = 23, WELL = 24, + OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, + BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, + DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, + LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, + CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; @@ -128,7 +127,7 @@ struct sav_chaine { byte _sjer[31]; int _currPlace, _atticBallHoleObjectId, _atticRodHoleObjectId, _cellarObjectId, _secretPassageObjectId, _wellObjectId; int _selectedObjectId, _purpleRoomObjectId, _cryptObjectId; - bool _ipre; + bool _alreadyEnteredManor; byte _heure; }; @@ -215,7 +214,6 @@ extern int g_x, g_mlec, g_mchai, g_menup, - g_ipers, g_mpers, g_mnumo, g_xprec, -- cgit v1.2.3 From 01e899b965721a21704746948ed2541a950f31df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Mar 2012 23:29:42 +0100 Subject: MORTEVIELLE: Remove some useless g_vm uses, some more renaming --- engines/mortevielle/mor.cpp | 45 +++++++++++++++++++-------------------- engines/mortevielle/mor.h | 3 +-- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/saveload.cpp | 10 ++++++--- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index a3a0ef7e96..8b27833211 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1106,14 +1106,14 @@ int MortevielleEngine::setPresenceLanding() { int rand = 0; do { rand = getRandomNumber(1, 8); - test = (((rand == 1) && (g_vm->_purpleRoomPresenceLeo || g_vm->_room9PresenceLeo)) || - ((rand == 2) && g_vm->_roomPresencePat) || - ((rand == 3) && g_vm->_roomPresenceGuy) || - ((rand == 4) && g_vm->_roomPresenceEva) || - ((rand == 5) && g_vm->_roomPresenceBob) || - ((rand == 6) && g_vm->_roomPresenceLuc) || - ((rand == 7) && g_vm->_roomPresenceIda) || - ((rand == 8) && g_vm->_roomPresenceMax)); + test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || + ((rand == 2) && _roomPresencePat) || + ((rand == 3) && _roomPresenceGuy) || + ((rand == 4) && _roomPresenceEva) || + ((rand == 5) && _roomPresenceBob) || + ((rand == 6) && _roomPresenceLuc) || + ((rand == 7) && _roomPresenceIda) || + ((rand == 8) && _roomPresenceMax)); } while (test); int retVal = convertCharacterIndexToBitIndex(rand); @@ -1404,7 +1404,7 @@ void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { * @remarks Originally called 'pl5' */ void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { - if (!g_vm->_roomPresenceMax) { + if (!_roomPresenceMax) { int p = getPresenceStatsBlueRoom(); int rand; @@ -2032,7 +2032,11 @@ bool MortevielleEngine::checkInventory(int objectId) { return retVal; } -void st1sama() { +/** + * Engine function - Display Dining Room + * @remarks Originally called 'st1sama' + */ +void MortevielleEngine::displayDiningRoom() { g_s._currPlace = DINING_ROOM; affrep(); } @@ -2141,13 +2145,13 @@ void MortevielleEngine::gotoDiningRoom() { g_crep = 1511; loseGame(); } else - st1sama(); + displayDiningRoom(); } else if (!g_s._alreadyEnteredManor) { //Is it your first time? _currBitIndex = 255; // Everybody is present - g_vm->showPeoplePresent(_currBitIndex); + showPeoplePresent(_currBitIndex); g_caff = 77; afdes(0); - g_vm->_screenSurface.drawBox(223, 47, 155, 91, 15); + _screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); tkey1(false); mennor(); @@ -2160,19 +2164,14 @@ void MortevielleEngine::gotoDiningRoom() { showMouse(); g_s._currPlace = OWN_ROOM; affrep(); - g_vm->resetPresenceInRooms(DINING_ROOM); - if (!g_vm->_blo) + resetPresenceInRooms(DINING_ROOM); + if (!_blo) minute = t11(OWN_ROOM); _currBitIndex = 0; g_mpers = 0; g_s._alreadyEnteredManor = true; } else - st1sama(); -} - -void t1vier() { - g_s._currPlace = SECRET_PASSAGE; - affrep(); + displayDiningRoom(); } /** @@ -2216,7 +2215,7 @@ void MortevielleEngine::gotoManorBack() { */ void MortevielleEngine::floodedInWell() { g_crep = 1503; - g_vm->loseGame(); + loseGame(); } void tctrm() { @@ -2552,7 +2551,7 @@ void MortevielleEngine::gameLoaded() { repon(2, g_crep); clearScreenType3(); _endGame = false; - g_vm->_menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(g_s._currPlace); modinv(); if (g_s._selectedObjectId != 0) modobj(g_s._selectedObjectId + 400); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 43413b3a89..da1f447bb9 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -111,7 +111,7 @@ extern void affrep(); /* NIVEAU 6 */ extern void tsort(); extern void st4(int ob); -extern void st1sama(); +extern void displayDiningRoom(); extern void modinv(); extern void sparl(float adr, float rep); extern void endSearch(); @@ -120,7 +120,6 @@ extern void premtet(); /* NIVEAU 5 */ extern void ajchai(); extern void ajjer(int ob); -extern void t1vier(); extern void tctrm(); extern void quelquun(); extern void tsuiv(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 52c68fa44d..57de236f8d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -269,7 +269,7 @@ public: bool checkInventory(int objectId); void loseGame(); void floodedInWell(); - + void displayDiningRoom(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 9e17252734..4113ff0e01 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -48,9 +48,13 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { */ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_s1._faithScore); - sz.syncBytes((byte *)&g_s1._pourc[0], 11); - sz.syncBytes((byte *)&g_s1._teauto[0], 43); - sz.syncBytes((byte *)&g_s1._sjer[0], 31); + for (int i = 0; i < 11; ++i) + sz.syncAsByte(g_s1._pourc[i]); + for (int i = 0; i < 43; ++i) + sz.syncAsByte(g_s1._teauto[i]); + for (int i = 0; i < 31; ++i) + sz.syncAsByte(g_s1._sjer[i]); + sz.syncAsSint16LE(g_s1._currPlace); sz.syncAsSint16LE(g_s1._atticBallHoleObjectId); sz.syncAsSint16LE(g_s1._atticRodHoleObjectId); -- cgit v1.2.3 From fb096b135bc2ed5cc56137a8c6e58de730758d13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Mar 2012 07:32:43 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 18 ++--- engines/mortevielle/mor.cpp | 164 +++++++++++++++++++------------------- engines/mortevielle/mor.h | 18 ++--- engines/mortevielle/mortevielle.h | 12 +++ engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.cpp | 6 -- engines/mortevielle/var_mor.h | 8 +- 7 files changed, 110 insertions(+), 118 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 4f16218e9e..c78c3a6304 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1200,7 +1200,7 @@ void MortevielleEngine::fctSleep() { } clearScreenType3(); clearScreenType2(); - ecrf2(); + prepareScreenType2(); ecr2(getEngineString(S_WANT_TO_WAKE_UP)); updateHour(j, h, m); @@ -1589,7 +1589,7 @@ void MortevielleEngine::endGame() { afdes(0); repon(6, 34); repon(2, 35); - musique(0); + startMusicOrSpeech(0); tkey1(false); // A wait message was displayed. // tkey1 was called before and after. @@ -1605,17 +1605,17 @@ void MortevielleEngine::endGame() { */ void MortevielleEngine::askRestart() { clearScreenType2(); - musique(0); + startMusicOrSpeech(0); tkey1(false); maivid(); resetVariables(); initGame(); - g_vh = 10; - g_vm__ = 0; - g_vj = 0; - g_minute = 0; - g_hour = 10; - g_day = 0; + _currHour = 10; + _currHalfHour = 0; + _currDay = 0; + _minute = 0; + _hour = 10; + _day = 0; repon(2, 180); int answer = Alert::show(getEngineString(S_YES_NO), 1); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 8b27833211..8a8ef565be 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -248,8 +248,8 @@ void drawRightFrame() { * Set Text Color * @remarks Originally called 'text_color' */ -void setTextColor(int c) { - g_vm->_textColor = c; +void MortevielleEngine::setTextColor(int col) { + _textColor = col; } /* NIVEAU 13 */ @@ -273,11 +273,6 @@ void initouv() { g_touv[cx] = chr(0); } -void ecrf1() { - // Large drawing - g_vm->_screenSurface.drawBox(0, 11, 512, 163, 15); -} - /** * Engine function - Clear Screen - Type 1 * @remarks Originally called 'clsf1' @@ -349,10 +344,6 @@ void clearScreenType10() { showMouse(); } -void ecrf2() { - setTextColor(5); -} - void ecr2(Common::String str_) { // Some dead code was present in the original: removed g_vm->_screenSurface.putxy(8, 177); @@ -383,12 +374,28 @@ void ecr3(Common::String text) { g_vm->_screenSurface.drawString(text, 5); } -void ecrf6() { +/** + * Prepare screen - Type 1! + * @remarks Originally called 'ecrf1' + */ +void MortevielleEngine::prepareScreenType1() { + // Large drawing + _screenSurface.drawBox(0, 11, 512, 163, 15); +} + +/** + * Prepare room - Type 2! + * @remarks Originally called 'ecrf2' + */ +void MortevielleEngine::prepareScreenType2() { setTextColor(5); - g_vm->_screenSurface.drawBox(62, 33, 363, 80, 15); } -void ecrf7() { +/** + * Prepare room - Type 3! + * @remarks Originally called 'ecrf7' + */ +void MortevielleEngine::prepareScreenType3() { setTextColor(4); } @@ -416,14 +423,14 @@ void paint_rect(int x, int y, int dx, int dy) { void updateHour(int &day, int &hour, int &minute) { int newHour = readclock(); int th = g_jh + ((newHour - g_mh) / g_t); - minute = ((th % 2) + g_vm__) * 30; - hour = ((uint)th >> 1) + g_vh; + minute = ((th % 2) + g_vm->_currHalfHour) * 30; + hour = ((uint)th >> 1) + g_vm->_currHour; if (minute == 60) { minute = 0; ++hour; } - day = (hour / 24) + g_vj; - hour = hour - ((day - g_vj) * 24); + day = (hour / 24) + g_vm->_currDay; + hour = hour - ((day - g_vm->_currDay) * 24); } /** @@ -462,13 +469,9 @@ void repon(int f, int m) { displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); - if (f == 8) - f = 2; - if (f == 1) - f = 6; - if (f == 2) { + if ((f == 2) || (f == 8)) { clearScreenType2(); - ecrf2(); + g_vm->prepareScreenType2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) g_s._teauto[40] = '*'; @@ -479,10 +482,9 @@ void repon(int f, int m) { g_s._teauto[38] = '*'; } } - } - if ((f == 6) || (f == 9)) { + } else if ((f == 1) || (f == 6) || (f == 9)) { int i; - if (f == 6) + if ((f == 1) || (f == 6)) i = 4; else i = 5; @@ -495,9 +497,8 @@ void repon(int f, int m) { if (m == 179) g_s._pourc[10] = '*'; - } - if (f == 7) { /* messint */ - ecrf7(); + } else if (f == 7) { /* messint */ + g_vm->prepareScreenType3(); tmpStr = deline(m); int xSmallStr, xLargeStr, dx; @@ -805,12 +806,12 @@ void drawClock() { else co = 1; - if (g_minute == 0) + if (g_vm->_minute == 0) g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); else g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); - h = g_hour; + h = g_vm->_hour; if (h > 12) h -= 12; if (h == 0) @@ -820,15 +821,15 @@ void drawClock() { showMouse(); g_vm->_screenSurface.putxy(568, 154); - if (g_hour > 11) + if (g_vm->_hour > 11) g_vm->_screenSurface.drawString("PM ", 1); else g_vm->_screenSurface.drawString("AM ", 1); g_vm->_screenSurface.putxy(550, 160); - if ((g_day >= 0) && (g_day <= 8)) { + if ((g_vm->_day >= 0) && (g_vm->_day <= 8)) { Common::String tmp = g_vm->getEngineString(S_DAY); - tmp.insertChar((char)(g_day + 49), 0); + tmp.insertChar((char)(g_vm->_day + 49), 0); g_vm->_screenSurface.drawString(tmp, 1); } } @@ -1326,7 +1327,7 @@ void resetVariables() { g_s._sjer[i] = chr(0); g_s._sjer[1] = chr(113); - g_s._heure = chr(20); + g_s._fullHour = chr(20); for (int i = 1; i <= 10; ++i) g_s._pourc[i] = ' '; @@ -1608,7 +1609,7 @@ void cavegre() { if (g_s._faithScore > 69) g_s._faithScore += (g_s._faithScore / 10); clearScreenType3(); - ecrf2(); + g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(2, rand, 1); @@ -1647,40 +1648,37 @@ void aniof(int ouf, int num) { surface.decode(&g_mem[ad * 16 + offset]); g_vm->_screenSurface.drawPicture(surface, 0, 12); - ecrf1(); + g_vm->prepareScreenType1(); } -void musique(int so) { +/** + * Start music or speech + * @remarks Originally called 'musique' + */ +void MortevielleEngine::startMusicOrSpeech(int so) { if (so == 0) { /* musik(0) */ ; } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { - g_vm->_speechManager.startSpeech(10, 1, 1); + // Type 1: Speech + _speechManager.startSpeech(10, 1, 1); ++g_prebru; } else { - bool i = false; - if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { - if (getRandomNumber(1, 3) == 2) { - g_vm->_speechManager.startSpeech(9, getRandomNumber(2, 4), 1); - i = true; - } - } else if (g_s._currPlace == CHAPEL) { - if (getRandomNumber(1, 2) == 1) { - g_vm->_speechManager.startSpeech(8, 1, 1); - i = true; - } - } else if (g_s._currPlace == WELL) { - if (getRandomNumber(1, 2) == 2) { - g_vm->_speechManager.startSpeech(12, 1, 1); - i = true; - } - } else if (g_s._currPlace == INSIDE_WELL) { - g_vm->_speechManager.startSpeech(13, 1, 1); - i = true; - } - - if (!i) - g_vm->_speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) + // Type 1: Speech + _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) + // Type 1: Speech + _speechManager.startSpeech(8, 1, 1); + else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) + // Type 1: Speech + _speechManager.startSpeech(12, 1, 1); + else if (g_s._currPlace == INSIDE_WELL) + // Type 1: Speech + _speechManager.startSpeech(13, 1, 1); + else + // Type 2 : music + _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1698,7 +1696,7 @@ void dessin(int ad) { g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { dessine(g_ades, 0, 12); - ecrf1(); + g_vm->prepareScreenType1(); if ((g_caff < 30) || (g_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { if (ord(g_touv[cx]) != 0) @@ -1720,7 +1718,7 @@ void dessin(int ad) { } if (g_caff < ROOM26) - musique(1); + g_vm->startMusicOrSpeech(1); } } } @@ -1737,8 +1735,8 @@ void tinke() { g_vm->_anyone = false; updateHour(day, hour, minute); - if (day != g_day) { - g_day = day; + if (day != g_vm->_day) { + g_vm->_day = day; int i = 0; do { ++i; @@ -1747,9 +1745,9 @@ void tinke() { g_nbrep[i] = 0; } while (i != 8); } - if ((hour > g_hour) || ((hour == 0) && (g_hour == 23))) { - g_hour = hour; - g_minute = 0; + if ((hour > g_vm->_hour) || ((hour == 0) && (g_vm->_hour == 23))) { + g_vm->_hour = hour; + g_vm->_minute = 0; drawClock(); cf = 0; for (int i = 1; i <= 10; ++i) { @@ -1775,8 +1773,8 @@ void tinke() { g_hintPctMessage += d6; g_hintPctMessage += d4; } - if (minute > g_minute) { - g_minute = 30; + if (minute > g_vm->_minute) { + g_vm->_minute = 30; drawClock(); } if (y_s < 12) @@ -1852,7 +1850,7 @@ void tinke() { g_hdb = readclock(); if (getRandomNumber(1, 5) < 5) { clearScreenType3(); - ecrf2(); + g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(1, rand, 1); @@ -2569,7 +2567,7 @@ void tmaj3() { minute = 1; hour += day * 24; minute += hour * 2; - g_s._heure = chr(minute); + g_s._fullHour = chr(minute); } /** @@ -2683,15 +2681,15 @@ void MortevielleEngine::handleOpcode() { /* NIVEAU 1 */ void theure() { - g_vj = ord(g_s._heure); - g_vh = g_vj % 48; - g_vj /= 48; - g_vm__ = g_vh % 2; - g_vh /= 2; - g_hour = g_vh; - if (g_vm__ == 1) - g_minute = 30; + int fullHour = ord(g_s._fullHour); + int tmpHour = fullHour % 48; + g_vm->_currDay = fullHour / 48; + g_vm->_currHalfHour = tmpHour % 2; + g_vm->_currHour = tmpHour / 2; + g_vm->_hour = g_vm->_currHour; + if (g_vm->_currHalfHour == 1) + g_vm->_minute = 30; else - g_minute = 0; + g_vm->_minute = 0; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index da1f447bb9..4b3dd9d4db 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -36,6 +36,12 @@ namespace Mortevielle { const int kTime1 = 410; const int kTime2 = 250; +static const int _actionMenu[12] = { OPCODE_NONE, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + /* NIVEAU 15 */ extern void copcha(); extern bool isMouseIn(rectangle r); @@ -51,20 +57,15 @@ extern int readclock(); extern void modif(int &nu); extern void dessine(int ad, int x, int y); extern void drawRightFrame(); -extern void setTextColor(int c); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); extern void initouv(); -extern void ecrf1(); extern void clearScreenType1(); extern void clearScreenType2(); extern void clearScreenType3(); extern void clearScreenType10(); -extern void ecrf2(); extern void ecr2(Common::String str_); extern void ecr3(Common::String text); -extern void ecrf6(); -extern void ecrf7(); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); extern void updateHour(int &day, int &hour, int &minute); @@ -90,16 +91,9 @@ extern int t11(int roomId); extern void cavegre(); extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); -extern void musique(int so); /* NIVEAU 9 */ extern void dessin(int ad); -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - extern void tinke(); extern void fenat(char ans); /* NIVEAU 8 */ diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 57de236f8d..3422767e6c 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -145,6 +145,12 @@ public: int _place; int _manorDistance; int _currBitIndex; + int _currDay; + int _currHour; + int _currHalfHour; + int _day; + int _hour; + int _minute; int _c_zzz; @@ -270,6 +276,12 @@ public: void loseGame(); void floodedInWell(); void displayDiningRoom(); + void startMusicOrSpeech(int so); + void setTextColor(int col); + void prepareScreenType1(); + void prepareScreenType2(); + void prepareScreenType3(); + }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 4113ff0e01..f6a3defab3 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -65,7 +65,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_s1._purpleRoomObjectId); sz.syncAsSint16LE(g_s1._cryptObjectId); sz.syncAsByte(g_s1._alreadyEnteredManor); - sz.syncAsByte(g_s1._heure); + sz.syncAsByte(g_s1._fullHour); sz.syncBytes(g_bufcha, 391); } diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 9b48ed3fd6..58f49561f7 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -81,18 +81,12 @@ const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; int g_x, g_y, g_t, - g_vj, - g_vh, - g_vm__, g_jh, g_mh, g_cs, g_hdb, g_hfb, - g_hour, - g_day, g_key, - g_minute, g_num, g_res, g_ment, diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 22ec5ccbee..c9f6ed7b64 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -128,7 +128,7 @@ struct sav_chaine { int _currPlace, _atticBallHoleObjectId, _atticRodHoleObjectId, _cellarObjectId, _secretPassageObjectId, _wellObjectId; int _selectedObjectId, _purpleRoomObjectId, _cryptObjectId; bool _alreadyEnteredManor; - byte _heure; + byte _fullHour; }; struct registres { @@ -186,18 +186,12 @@ enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCU extern int g_x, g_y, g_t, - g_vj, - g_vh, - g_vm__, g_jh, g_mh, g_cs, g_hdb, g_hfb, - g_hour, - g_day, g_key, - g_minute, g_num, g_res, g_ment, -- cgit v1.2.3 From 6e7118a8efe45be2ff220341b5e3ce6bb2ab0003 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Mar 2012 07:38:52 +0100 Subject: MORTEVIELLE: Remove dead code related to messint (display of loading message between rooms) --- engines/mortevielle/mor.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 8a8ef565be..526ac4b5b2 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -453,12 +453,8 @@ void modobj(int m) { } void repon(int f, int m) { - Common::String str_; - Common::String str1; - Common::String tmpStr; - if ((m > 499) && (m < 563)) { - tmpStr = deline(m - 501 + kInventoryStringIndex); + Common::String tmpStr = deline(m - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) g_vm->_largestClearScreen = true; @@ -489,7 +485,7 @@ void repon(int f, int m) { else i = 5; - tmpStr = deline(m); + Common::String tmpStr = deline(m); displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) @@ -497,25 +493,6 @@ void repon(int f, int m) { if (m == 179) g_s._pourc[10] = '*'; - } else if (f == 7) { /* messint */ - g_vm->prepareScreenType3(); - tmpStr = deline(m); - - int xSmallStr, xLargeStr, dx; - if (g_res == 1) { - xSmallStr = 252 - tmpStr.size() * 5; - xLargeStr = 100; - dx = 80; - } else { - xSmallStr = 252 - tmpStr.size() * 3; - xLargeStr = 144; - dx = 50; - } - - if (tmpStr.size() < 40) - displayStr(tmpStr, xSmallStr, 86, dx, 3, 5); - else - displayStr(tmpStr, xLargeStr, 86, dx, 3, 5); } } } -- cgit v1.2.3 From fc14ffbcb53aedfb23ac7ecc862d2bf9a454fb73 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 Mar 2012 09:44:05 +0100 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 10 +-- engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/keyboard.cpp | 10 +-- engines/mortevielle/mor.cpp | 125 ++++++++++++++++++++---------------- engines/mortevielle/mor.h | 12 +--- engines/mortevielle/mortevielle.cpp | 21 ++++-- engines/mortevielle/mortevielle.h | 8 +++ engines/mortevielle/mouse.cpp | 10 +-- engines/mortevielle/outtext.cpp | 3 +- engines/mortevielle/ovd1.cpp | 8 +-- engines/mortevielle/saveload.cpp | 14 ++-- engines/mortevielle/saveload.h | 2 +- engines/mortevielle/var_mor.cpp | 9 --- engines/mortevielle/var_mor.h | 7 -- 14 files changed, 121 insertions(+), 122 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index c78c3a6304..944ac9fc2f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -45,7 +45,7 @@ void MortevielleEngine::fctMove() { if ((g_s._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; - afdes(0); + afdes(); repon(2, g_s._currPlace); } if ((g_s._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { @@ -1156,7 +1156,7 @@ void MortevielleEngine::fctEnter() { if (g_ment == 9) { _col = true; g_caff = 70; - afdes(0); + afdes(); repon(2, g_caff); } else _col = false; @@ -1194,7 +1194,7 @@ void MortevielleEngine::fctSleep() { tsort(); g_s._currPlace = OWN_ROOM; affrep(); - afdes(0); + afdes(); debloc(g_s._currPlace); _menu.setDestinationMenuText(g_s._currPlace); } @@ -1351,7 +1351,7 @@ void MortevielleEngine::fctDiscuss() { ++cx; } while (_menu._discussMenu[cx] != g_msg[4]); g_caff = 69 + cx; - afdes(0); + afdes(); repon(2, g_caff); suj = g_caff + 60; } @@ -1586,7 +1586,7 @@ void MortevielleEngine::endGame() { repon(2, 142); tkey1(false); g_caff = 32; - afdes(0); + afdes(); repon(6, 34); repon(2, 35); startMusicOrSpeech(0); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index eabeae2b79..dbbd8c5896 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -56,8 +56,8 @@ int Alert::show(const Common::String &msg, int n) { memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; hideMouse(); - while (keypressed()) - dumi = get_ch(); // input >> kbd >> dumi; + while (g_vm->keyPressed()) + dumi = g_vm->getChar(); g_vm->setMouseClick(false); decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index faf47192a7..71ab0c1e99 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -33,13 +33,13 @@ namespace Mortevielle { char readkey1() { - char c = get_ch(); + char c = g_vm->getChar(); return c; } int testou() { - char ch = get_ch(); + char ch = g_vm->getChar(); switch (ch) { case '\23' : @@ -54,8 +54,8 @@ int testou() { } break; case '\33' : - if (keypressed()) - ch = get_ch(); + if (g_vm->keyPressed()) + ch = g_vm->getChar(); break; default: break; @@ -65,7 +65,7 @@ int testou() { } void teskbd() { - if (keypressed()) + if (g_vm->keyPressed()) testou(); } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 526ac4b5b2..5bba9c5aed 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -420,17 +420,17 @@ void paint_rect(int x, int y, int dx, int dy) { * Engine function - Update hour * @remarks Originally called 'calch' */ -void updateHour(int &day, int &hour, int &minute) { +void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { int newHour = readclock(); int th = g_jh + ((newHour - g_mh) / g_t); - minute = ((th % 2) + g_vm->_currHalfHour) * 30; - hour = ((uint)th >> 1) + g_vm->_currHour; + minute = ((th % 2) + _currHalfHour) * 30; + hour = ((uint)th >> 1) + _currHour; if (minute == 60) { minute = 0; ++hour; } - day = (hour / 24) + g_vm->_currDay; - hour = hour - ((day - g_vm->_currDay) * 24); + day = (hour / 24) + _currDay; + hour = hour - ((day - _currDay) * 24); } /** @@ -465,7 +465,9 @@ void repon(int f, int m) { displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); - if ((f == 2) || (f == 8)) { + switch (f) { + case 2: + case 8: clearScreenType2(); g_vm->prepareScreenType2(); text1(8, 182, 103, m); @@ -478,7 +480,10 @@ void repon(int f, int m) { g_s._teauto[38] = '*'; } } - } else if ((f == 1) || (f == 6) || (f == 9)) { + break; + case 1: + case 6: + case 9: { int i; if ((f == 1) || (f == 6)) i = 4; @@ -490,9 +495,12 @@ void repon(int f, int m) { if (m == 180) g_s._pourc[6] = '*'; - - if (m == 179) + else if (m == 179) g_s._pourc[10] = '*'; + } + break; + default: + break; } } } @@ -1132,7 +1140,7 @@ int MortevielleEngine::setPresenceChapel(int hour) { * Engine function - Get the answer after you known a door * @remarks Originally called 'frap' */ -void getKnockAnswer() { +void MortevielleEngine::getKnockAnswer() { int day, hour, minute; updateHour(day, hour, minute); @@ -1711,7 +1719,7 @@ void tinke() { Common::String stpo; g_vm->_anyone = false; - updateHour(day, hour, minute); + g_vm->updateHour(day, hour, minute); if (day != g_vm->_day) { g_vm->_day = day; int i = 0; @@ -1737,18 +1745,18 @@ void tinke() { else stpo = chr(cf + 48); - g_hintPctMessage = Common::String(d3); - g_hintPctMessage += d5; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d1; - g_hintPctMessage += stpo; - g_hintPctMessage += '0'; - g_hintPctMessage += d2; - g_hintPctMessage += d4; - g_hintPctMessage += d3; - g_hintPctMessage += d6; - g_hintPctMessage += d4; + g_vm->_hintPctMessage = Common::String(d3); + g_vm->_hintPctMessage += d5; + g_vm->_hintPctMessage += d4; + g_vm->_hintPctMessage += d3; + g_vm->_hintPctMessage += d1; + g_vm->_hintPctMessage += stpo; + g_vm->_hintPctMessage += '0'; + g_vm->_hintPctMessage += d2; + g_vm->_hintPctMessage += d4; + g_vm->_hintPctMessage += d3; + g_vm->_hintPctMessage += d6; + g_vm->_hintPctMessage += d4; } if (minute > g_vm->_minute) { g_vm->_minute = 30; @@ -1869,9 +1877,9 @@ void fenat(char ans) { /* NIVEAU 8 */ -void afdes(int ad) { +void afdes() { taffich(); - dessin(ad); + dessin(0); g_vm->_okdes = false; } @@ -1883,18 +1891,18 @@ void tkey1(bool d) { fenat('K'); // Wait for release from any key or mouse button - while (keypressed()) + while (g_vm->keyPressed()) g_key = testou(); do { getMousePos_(x, y, c); - keypressed(); + g_vm->keyPressed(); } while (c != 0); // Event loop do { if (d) tinke(); - quest = keypressed(); + quest = g_vm->keyPressed(); getMousePos_(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && g_vm->_anyone))); @@ -1907,7 +1915,7 @@ void tkey1(bool d) { /* NIVEAU 7 */ void tlu(int af, int ob) { g_caff = 32; - afdes(0); + afdes(); repon(6, ob + 4000); repon(2, 999); tkey1(true); @@ -2125,7 +2133,7 @@ void MortevielleEngine::gotoDiningRoom() { _currBitIndex = 255; // Everybody is present showPeoplePresent(_currBitIndex); g_caff = 77; - afdes(0); + afdes(); _screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); tkey1(false); @@ -2298,7 +2306,7 @@ void tfleche() { } while (!(qust || inRect || g_vm->_anyone)); if (qust && (touch == '\103')) - Alert::show(g_hintPctMessage, 1); + Alert::show(g_vm->_hintPctMessage, 1); } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); if (touch == '\73') @@ -2390,7 +2398,7 @@ void treg(int ob) { g_caff = ob; if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { - afdes(0); + afdes(); if ((g_caff > 29) && (g_caff < 33)) repon(2, g_caff); else @@ -2459,25 +2467,25 @@ void aldepl() { * Engine function - Change Graphical Device * @remarks Originally called 'change_gd' */ -void changeGraphicalDevice(int newDevice) { +void MortevielleEngine::changeGraphicalDevice(int newDevice) { hideMouse(); - g_vm->_currGraphicalDevice = newDevice; + _currGraphicalDevice = newDevice; hirs(); initMouse(); showMouse(); drawRightFrame(); tinke(); drawClock(); - if (g_vm->_currBitIndex != 0) - g_vm->showPeoplePresent(g_vm->_currBitIndex); + if (_currBitIndex != 0) + showPeoplePresent(_currBitIndex); else - g_vm->displayAloneText(); + displayAloneText(); clearScreenType2(); clearScreenType3(); g_maff = 68; - afdes(0); + afdes(); repon(2, g_crep); - g_vm->_menu.displayMenu(); + _menu.displayMenu(); } /** @@ -2512,7 +2520,7 @@ void MortevielleEngine::gameLoaded() { g_iouv = 0; g_dobj = 0; affrep(); - g_hintPctMessage = deline(580); + _hintPctMessage = deline(580); _okdes = false; _endGame = true; @@ -2522,7 +2530,7 @@ void MortevielleEngine::gameLoaded() { displayAloneText(); tinke(); drawClock(); - afdes(0); + afdes(); repon(2, g_crep); clearScreenType3(); _endGame = false; @@ -2533,20 +2541,6 @@ void MortevielleEngine::gameLoaded() { showMouse(); } - -/* NIVEAU 3 */ -/* procedure PROGRAMME */ -void tmaj3() { - int day, hour, minute; - - updateHour(day, hour, minute); - if (minute == 30) - minute = 1; - hour += day * 24; - minute += hour * 2; - g_s._fullHour = chr(minute); -} - /** * Engine function - Handle OpCodes * @remarks Originally called 'tsitu' @@ -2655,9 +2649,26 @@ void MortevielleEngine::handleOpcode() { mennor(); } -/* NIVEAU 1 */ +/** + * Engine function - Transform time into a char + * @remarks Originally called 'tmaj3' + */ +void MortevielleEngine::hourToChar() { + int day, hour, minute; + + g_vm->updateHour(day, hour, minute); + if (minute == 30) + minute = 1; + hour += day * 24; + minute += hour * 2; + g_s._fullHour = chr(minute); +} -void theure() { +/** + * Engine function - extract time from a char + * @remarks Originally called 'theure' + */ +void MortevielleEngine::charToHour() { int fullHour = ord(g_s._fullHour); int tmpHour = fullHour % 48; g_vm->_currDay = fullHour / 48; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 4b3dd9d4db..528039c6ba 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -68,7 +68,6 @@ extern void ecr2(Common::String str_); extern void ecr3(Common::String text); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); -extern void updateHour(int &day, int &hour, int &minute); extern int convertCharacterIndexToBitIndex(int characterIndex); /* NIVEAU 12 */ extern void modobj(int m); @@ -79,7 +78,6 @@ extern void drawClock(); * NIVEAU 11 * *************/ extern void debloc(int roomId); -extern void getKnockAnswer(); extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int roomId); extern void becfren(int roomId); @@ -97,7 +95,7 @@ extern void dessin(int ad); extern void tinke(); extern void fenat(char ans); /* NIVEAU 8 */ -extern void afdes(int ad); +extern void afdes(); extern void tkey1(bool d); /* NIVEAU 7 */ extern void tlu(int af, int ob); @@ -128,13 +126,5 @@ extern void maivid(); extern void st13(int ob); extern void aldepl(); -extern void changeGraphicalDevice(int newDevice); - -/* NIVEAU 3 */ -/* procedure PROGRAMME */ -extern void tmaj3(); - -/* NIVEAU 1 */ -extern void theure(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6e7726bb35..3667a135c1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -164,7 +164,7 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - g_hintPctMessage = deline(580); // You should have noticed %d hints + _hintPctMessage = deline(580); // You should have noticed %d hints // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -287,6 +287,11 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp assert(dataSize == 0); } +/** + * Check is a key was pressed + * It also delays the engine and check if the screen has to be updated + * @remarks Originally called 'keypressed' + */ bool MortevielleEngine::keyPressed() { // Check for any pending key presses handleEvents(); @@ -305,10 +310,14 @@ bool MortevielleEngine::keyPressed() { return !_keypresses.empty(); } +/** + * Wait for a keypress + * @remarks Originally called 'get_ch' + */ int MortevielleEngine::getChar() { // If there isn't any pending keypress, wait until there is while (!shouldQuit() && _keypresses.empty()) { - keypressed(); + keyPressed(); } // Return the top keypress @@ -496,7 +505,7 @@ Common::Error MortevielleEngine::run() { // Either load the initial game state savegame, or the specified savegame number adzon(); - _savegameManager.takesav(loadSlot); + _savegameManager.loadSavegame(loadSlot); // Run the main game loop mainGame(); @@ -537,7 +546,7 @@ void MortevielleEngine::mainGame() { loadBRUIT5(); _menu.initMenu(); - theure(); + charToHour(); initGame(); hirs(); drawRightFrame(); @@ -613,7 +622,7 @@ void MortevielleEngine::handleAction() { if (_menu._menuSelected && (g_msg[3] == MENU_LOAD)) _savegameManager.loadGame((g_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ - temps = Alert::show(g_hintPctMessage, 1); + temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { @@ -629,7 +638,7 @@ void MortevielleEngine::handleAction() { } if (inkey == '\73') { _quitGame = true; - tmaj3(); + hourToChar(); } else { if ((funct) && (inkey != '\77')) return; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 3422767e6c..aeaf5e27d1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -112,6 +112,8 @@ private: void playGame(); void handleAction(); public: + Common::String _hintPctMessage; + bool _roomPresenceLuc; bool _roomPresenceIda; bool _purpleRoomPresenceLeo; @@ -281,6 +283,12 @@ public: void prepareScreenType1(); void prepareScreenType2(); void prepareScreenType3(); + void updateHour(int &day, int &hour, int &minute); + void getKnockAnswer(); + void charToHour(); + void hourToChar(); + + void changeGraphicalDevice(int newDevice); }; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 2eec6ab2b5..401a2b3f7b 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -296,7 +296,7 @@ void moveMouse(bool &funct, char &key) { // Set defaults and check pending events funct = false; key = '\377'; - p_key = keypressed(); + p_key = g_vm->keyPressed(); // If mouse button clicked, return it if (g_vm->getMouseClick()) @@ -306,7 +306,7 @@ void moveMouse(bool &funct, char &key) { while (p_key) { CHECK_QUIT; - in1 = get_ch(); + in1 = g_vm->getChar(); getMousePos_(cx, cy, cd); switch (toupper(in1)) { case '4': @@ -347,10 +347,10 @@ void moveMouse(bool &funct, char &key) { return; break; case '\33': - p_key = keypressed(); + p_key = g_vm->keyPressed(); if (p_key) { - in2 = get_ch(); + in2 = g_vm->getChar(); if ((in2 >= ';') && (in2 <= 'D')) { funct = true; @@ -439,7 +439,7 @@ void moveMouse(bool &funct, char &key) { } setMousePos(cx, cy); - p_key = keypressed(); + p_key = g_vm->keyPressed(); } } diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 45cbb1b420..c93107cc13 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -211,7 +211,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) xc = x; yc += 6; if (yc > yf) { - while (!keypressed()) + while (!g_vm->keyPressed()) ; i = y; do { @@ -303,7 +303,6 @@ void taffich() { int32 lgt; int alllum[16]; - int a = g_caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 9605adcff3..9b0f72c8e0 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -158,13 +158,13 @@ void music() { bool fin = false; int k = 0; do { - fin = keypressed(); + fin = g_vm->keyPressed(); g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic); ++k; - fin = fin | keypressed() | (k >= 5); + fin = fin | g_vm->keyPressed() | (k >= 5); } while (!fin); - while (keypressed()) - get_ch(); // input >> kbd >> ch; + while (g_vm->keyPressed()) + g_vm->getChar(); } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index f6a3defab3..d054308cf3 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -72,11 +72,9 @@ void SavegameManager::sync_save(Common::Serializer &sz) { /** * Inner code for loading a saved game + * @remarks Originally called 'takesav' */ -void SavegameManager::takesav(int n) { - int i; - Common::String st; - +void SavegameManager::loadSavegame(int n) { // -- Load the file Common::String filename = generateSaveName(n); @@ -110,7 +108,7 @@ void SavegameManager::takesav(int n) { sync_save(sz); g_s = g_s1; - for (i = 0; i <= 389; ++i) + for (int i = 0; i <= 389; ++i) g_tabdon[i + acha] = g_bufcha[i]; // Close the stream @@ -123,10 +121,10 @@ void SavegameManager::takesav(int n) { Common::Error SavegameManager::loadGame(int n) { hideMouse(); maivid(); - takesav(n); + loadSavegame(n); /* Initialization */ - theure(); + g_vm->charToHour(); g_vm->initGame(); g_vm->gameLoaded(); showMouse(); @@ -141,7 +139,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { int i; hideMouse(); - tmaj3(); + g_vm->hourToChar(); for (i = 0; i <= 389; ++i) g_bufcha[i] = g_tabdon[i + acha]; diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 7f2edd8b53..c1c3c80c09 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -51,7 +51,7 @@ class SavegameManager { private: void sync_save(Common::Serializer &sz); public: - void takesav(int n); + void loadSavegame(int n); Common::Error loadGame(int n); Common::Error saveGame(int n, const Common::String &saveName); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 58f49561f7..495487c33e 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -115,8 +115,6 @@ int g_x, int g_t_cph[6401]; byte g_tabdon[4001]; - -Common::String g_hintPctMessage; // Provides the % of hints byte g_is; int g_nbrep[9]; @@ -190,13 +188,6 @@ int getRandomNumber(int minval, int maxval) { return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval; } -bool keypressed() { - return g_vm->keyPressed(); -} -char get_ch() { - return g_vm->getChar(); -} - /** * Restore a screen sectio */ diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index c9f6ed7b64..19bde4088e 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -221,7 +221,6 @@ extern int g_x, extern int g_t_cph[6401]; // Speech extern byte g_tabdon[4001]; -extern Common::String g_hintPctMessage; // gives the pct of hints found extern byte g_is; extern int g_nbrep[9]; @@ -264,17 +263,11 @@ extern byte g_mem[65536 * 16]; #define hires {} -// Stubs for input functions -extern bool keypressed(); -extern char get_ch(); - extern void palette(int v1); extern void intr(int intNum, registres ®s); extern int getRandomNumber(int minval, int maxval); -// (* external 'c:\mc\charecr.com'; *) extern void s_char(int Gd, int y, int dy); -// (* external 'c:\mc\sauvecr.com'; *) extern void s_sauv(int Gd, int y, int dy); } // End of namespace Mortevielle -- cgit v1.2.3 From 1c283507ee0dab8f960bdbe249f837a95c4b6e2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 Mar 2012 07:44:56 +0100 Subject: MORTEVIELLE: Some more renaming, introduce MouseHandler --- engines/mortevielle/actions.cpp | 40 +- engines/mortevielle/dialogs.cpp | 46 +- engines/mortevielle/dialogs.h | 2 +- engines/mortevielle/graphics.cpp | 4 +- engines/mortevielle/menu.cpp | 12 +- engines/mortevielle/mor.cpp | 1457 +---------------------------------- engines/mortevielle/mor.h | 10 - engines/mortevielle/mortevielle.cpp | 1390 ++++++++++++++++++++++++++++++++- engines/mortevielle/mortevielle.h | 10 + engines/mortevielle/mouse.cpp | 36 +- engines/mortevielle/mouse.h | 38 +- engines/mortevielle/outtext.cpp | 4 +- engines/mortevielle/ovd1.cpp | 2 +- engines/mortevielle/saveload.cpp | 8 +- 14 files changed, 1532 insertions(+), 1527 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 944ac9fc2f..7949d93b38 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -700,12 +700,12 @@ void MortevielleEngine::fctPlace() { Alert::show(alertTxt, 1); bool enterPassageFl = KnowledgeCheck::show(); - hideMouse(); + _mouse.hideMouse(); hirs(); drawRightFrame(); clearScreenType2(); clearScreenType3(); - showMouse(); + _mouse.showMouse(); tinke(); drawClock(); if (_currBitIndex != 0) @@ -1357,10 +1357,10 @@ void MortevielleEngine::fctDiscuss() { } tkey1(false); mennor(); - hideMouse(); + _mouse.hideMouse(); hirs(); premtet(); - sparl(0, suj); + startDialog(suj); hirs(); for (int ix = 1; ix <= 46; ++ix) te[ix] = false; @@ -1371,7 +1371,7 @@ void MortevielleEngine::fctDiscuss() { } lib[46] = lib[45]; lib[45] = ' '; - showMouse(); + _mouse.showMouse(); do { choi = 0; icm = 0; @@ -1397,10 +1397,10 @@ void MortevielleEngine::fctDiscuss() { writetp(lib[46], 0); tou = '\0'; do { - moveMouse(f, tou); + _mouse.moveMouse(f, tou); CHECK_QUIT; - getMousePos_(x, y, c); + _mouse.getMousePos_(x, y, c); x *= (3 - g_res); if (x > 319) cx = 41; @@ -1482,11 +1482,11 @@ void MortevielleEngine::fctDiscuss() { g_s._faithScore += 3; suj = 139; } - hideMouse(); + _mouse.hideMouse(); hirs(); premtet(); - sparl(0, suj); - showMouse(); + startDialog(suj); + _mouse.showMouse(); if ((suj == 84) || (suj == 86)) { g_s._pourc[5] = '*'; g_s._teauto[7] = '*'; @@ -1500,26 +1500,26 @@ void MortevielleEngine::fctDiscuss() { g_s._pourc[8] = '*'; g_s._teauto[32] = '*'; } - hideMouse(); + _mouse.hideMouse(); hirs(); - showMouse(); + _mouse.showMouse(); } } while ((choi != 46) && (suj != 138)); if (_col) { g_s._faithScore += (3 * (g_s._faithScore / 10)); - hideMouse(); + _mouse.hideMouse(); hirs(); premtet(); - sparl(0, 138); - showMouse(); + startDialog(138); + _mouse.showMouse(); _col = false; g_s._currPlace = LANDING; } g_ctrm = 0; - hideMouse(); + _mouse.hideMouse(); hirs(); drawRightFrame(); - showMouse(); + _mouse.showMouse(); showPeoplePresent(_currBitIndex); tinke(); drawClock(); @@ -1574,13 +1574,13 @@ void MortevielleEngine::endGame() { clearScreenType3(); repon(9, 1509); tkey1(false); - hideMouse(); + _mouse.hideMouse(); g_caff = 70; taffich(); hirs(); premtet(); - sparl(0, 141); - showMouse(); + startDialog(141); + _mouse.showMouse(); clearScreenType1(); repon(9, 1509); repon(2, 142); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index dbbd8c5896..f1faee0daa 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -44,7 +44,6 @@ int Alert::show(const Common::String &msg, int n) { int coldep, esp, i, caseNumb, quoi, ix; Common::String st, chaine; int limit[3][3]; - char dumi; Common::String s[3]; int cx, cy, nbcol, lignNumb; bool newaff, test, test1, test2, test3, dum; @@ -55,9 +54,9 @@ int Alert::show(const Common::String &msg, int n) { memset(&limit[0][0], 0, sizeof(int) * 3 * 3); int do_alert_result; - hideMouse(); + g_vm->_mouse.hideMouse(); while (g_vm->keyPressed()) - dumi = g_vm->getChar(); + g_vm->getChar(); g_vm->setMouseClick(false); decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); @@ -101,16 +100,16 @@ int Alert::show(const Common::String &msg, int n) { limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * g_res; limit[2][2] = (limit[2][1]) + 40; } - showMouse(); + g_vm->_mouse.showMouse(); quoi = 0; dum = false; do { - dumi = '\377'; - moveMouse(dum, dumi); + char dummyKey = '\377'; + g_vm->_mouse.moveMouse(dum, dummyKey); CHECK_QUIT0; - cx = x_s; - cy = y_s; + cx = g_vm->_mouse.x_s; + cy = g_vm->_mouse.y_s; test = (cy > 95) && (cy < 105); newaff = false; if (test) { @@ -125,7 +124,7 @@ int Alert::show(const Common::String &msg, int n) { else ix = 2; if (ix != quoi) { - hideMouse(); + g_vm->_mouse.hideMouse(); if (quoi != 0) { setPosition(quoi, coldep, esp); @@ -142,12 +141,12 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.drawString(tmp2, 1); quoi = ix; - showMouse(); + g_vm->_mouse.showMouse(); } } } if ((quoi != 0) && ! newaff) { - hideMouse(); + g_vm->_mouse.hideMouse(); setPosition(quoi, coldep, esp); Common::String tmp3(" "); @@ -156,13 +155,13 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.drawString(tmp3, 0); quoi = 0; - showMouse(); + g_vm->_mouse.showMouse(); } test3 = (cy > 95) && (cy < 105) && (((cx > limit[1][1]) && (cx < limit[1][2])) || ((cx > limit[2][1]) && (cx < limit[2][2]))); } while (!g_vm->getMouseClick()); g_vm->setMouseClick(false); - hideMouse(); + g_vm->_mouse.hideMouse(); if (!test3) { quoi = n; setPosition(n, coldep, esp); @@ -172,7 +171,7 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_screenSurface.drawString(tmp4, 1); } charecr(50, (NUM_LINES + 1) << 4); - showMouse(); + g_vm->_mouse.showMouse(); /* Restore the background area */ g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); @@ -299,9 +298,9 @@ bool KnowledgeCheck::show() { int correctCount = 0; for (int indx = 0; indx < 10; ++indx) { - hideMouse(); + g_vm->_mouse.hideMouse(); hirs(); - showMouse(); + g_vm->_mouse.showMouse(); int dialogHeight; if (g_res == 1) dialogHeight = 29; @@ -355,11 +354,11 @@ bool KnowledgeCheck::show() { do { g_vm->setMouseClick(false); bool flag; - moveMouse(flag, key); + g_vm->_mouse.moveMouse(flag, key); CHECK_QUIT0; currChoice = 1; - while (coor[currChoice]._enabled && !isMouseIn(coor[currChoice])) + while (coor[currChoice]._enabled && !g_vm->_mouse.isMouseIn(coor[currChoice])) ++currChoice; if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { @@ -425,7 +424,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); - waitForF3F8(g_key); + g_key = waitForF3F8(); CHECK_QUIT; if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { @@ -440,11 +439,16 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { * Alert function - Loop until F3 or F8 is pressed * @remarks Originally called 'atf3f8' */ -void f3f8::waitForF3F8(int &key) { +int f3f8::waitForF3F8() { + int key; + do { key = testou(); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return key; } while ((key != 61) && (key != 66)); + + return key; } void f3f8::aff50(bool drawAni50Fl) { diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index eaab56d7e2..40109c894b 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -54,7 +54,7 @@ class f3f8 { public: static void draw(); static void checkForF8(int SpeechNum, bool drawAni50Fl); - static void waitForF3F8(int &key); + static int waitForF3F8(); static void aff50(bool drawAni50Fl); static void ani50(); }; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 1c26a5cea1..dc63e05c22 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1056,7 +1056,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { if (l == "") return; - hideMouse(); + g_vm->_mouse.hideMouse(); pt = _textPos; if (g_res == 2) @@ -1094,7 +1094,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); pt.x += i; } - showMouse(); + g_vm->_mouse.showMouse(); } /** diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a28df25634..3f5db6de9a 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -169,7 +169,7 @@ void Menu::displayMenu() { int pt, x, y, color, msk, num_letr; - hideMouse(); + g_vm->_mouse.hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * g_res; @@ -203,7 +203,7 @@ void Menu::displayMenu() { } while (y != 9); col += 48 * g_res; } while (num_letr != 6); - showMouse(); + g_vm->_mouse.showMouse(); } /** @@ -310,7 +310,7 @@ void Menu::menuDown(int ii) { // Draw the menu xco = g_menuConstants[ii - 1][0]; nb_lig = g_menuConstants[ii - 1][3]; - hideMouse(); + g_vm->_mouse.hideMouse(); sauvecr(10, (g_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (g_res == 1) @@ -376,7 +376,7 @@ void Menu::menuDown(int ii) { g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); } while (cx != nb_lig); _multiTitle = true; - showMouse(); + g_vm->_mouse.showMouse(); } /** @@ -417,8 +417,8 @@ void Menu::mdn() { if (!_menuActive) return; - int x = x_s; - int y = y_s; + int x = g_vm->_mouse.x_s; + int y = g_vm->_mouse.y_s; if (!g_vm->getMouseClick()) { if ((x == g_xprec) && (y == g_yprec)) return; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 5bba9c5aed..439d9255e2 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -53,20 +53,6 @@ void copcha() { } while (i != acha + 390); } -/** - * Engine function : Is mouse in a given rect? - * @remarks Originally called 'dans_rect' - */ -bool isMouseIn(rectangle r) { - int x, y, c; - - getMousePos_(x, y, c); - if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) - return true; - - return false; -} - void outbloc(int n, pattern p, nhom *pal) { int ad = n * 404 + 0xd700; @@ -124,15 +110,15 @@ void pictout(int seg, int dep, int x, int y) { } void sauvecr(int y, int dy) { - hideMouse(); + g_vm->_mouse.hideMouse(); s_sauv(g_vm->_currGraphicalDevice, y, dy); - showMouse(); + g_vm->_mouse.showMouse(); } void charecr(int y, int dy) { - hideMouse(); + g_vm->_mouse.hideMouse(); s_char(g_vm->_currGraphicalDevice, y, dy); - showMouse(); + g_vm->_mouse.showMouse(); } void adzon() { @@ -224,10 +210,10 @@ void modif(int &nu) { void dessine(int ad, int x, int y) { - hideMouse(); + g_vm->_mouse.hideMouse(); writepal(g_numpal); pictout(ad, 0, x, y); - showMouse(); + g_vm->_mouse.showMouse(); } /** @@ -239,17 +225,9 @@ void drawRightFrame() { if (g_vm->_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; } - hideMouse(); + g_vm->_mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); - showMouse(); -} - -/** - * Set Text Color - * @remarks Originally called 'text_color' - */ -void MortevielleEngine::setTextColor(int col) { - _textColor = col; + g_vm->_mouse.showMouse(); } /* NIVEAU 13 */ @@ -273,77 +251,6 @@ void initouv() { g_touv[cx] = chr(0); } -/** - * Engine function - Clear Screen - Type 1 - * @remarks Originally called 'clsf1' - */ -void clearScreenType1() { - hideMouse(); - g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - showMouse(); -} - -/** - * Engine function - Clear Screen - Type 2 - * @remarks Originally called 'clsf2' - */ -void clearScreenType2() { - hideMouse(); - if (g_vm->_largestClearScreen) { - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); - g_vm->_largestClearScreen = false; - } else { - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); - } - showMouse(); -} - -/** - * Engine function - Clear Screen - Type 3 - * @remarks Originally called 'clsf3' - */ -void clearScreenType3() { - hideMouse(); - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); - showMouse(); -} - -/** - * Engine function - Clear Screen - Type 10 - * @remarks Originally called 'clsf10' - */ -void clearScreenType10() { - int co, cod; - Common::String st; - - hideMouse(); - if (g_res == 1) { - co = 634; - cod = 534; - } else { - co = 600; - cod = 544; - } - g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s._faithScore < 33) - st = g_vm->getEngineString(S_COOL); - else if (g_s._faithScore < 66) - st = g_vm->getEngineString(S_LOURDE); - else if (g_s._faithScore > 65) - st = g_vm->getEngineString(S_MALSAINE); - - co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); - g_vm->_screenSurface.putxy(co, 92); - g_vm->_screenSurface.drawString(st, 4); - - g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - /* rempli(69,12,32,5,255);*/ - showMouse(); -} - void ecr2(Common::String str_) { // Some dead code was present in the original: removed g_vm->_screenSurface.putxy(8, 177); @@ -358,7 +265,7 @@ void ecr2(Common::String str_) { g_vm->_screenSurface.drawString(copy(str_, tlig, tlig << 1), 5); } else { g_vm->_largestClearScreen = true; - clearScreenType2(); + g_vm->clearScreenType2(); g_vm->_screenSurface.putxy(8, 176); g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); @@ -369,36 +276,11 @@ void ecr2(Common::String str_) { } void ecr3(Common::String text) { - clearScreenType3(); + g_vm->clearScreenType3(); g_vm->_screenSurface.putxy(8, 192); g_vm->_screenSurface.drawString(text, 5); } -/** - * Prepare screen - Type 1! - * @remarks Originally called 'ecrf1' - */ -void MortevielleEngine::prepareScreenType1() { - // Large drawing - _screenSurface.drawBox(0, 11, 512, 163, 15); -} - -/** - * Prepare room - Type 2! - * @remarks Originally called 'ecrf2' - */ -void MortevielleEngine::prepareScreenType2() { - setTextColor(5); -} - -/** - * Prepare room - Type 3! - * @remarks Originally called 'ecrf7' - */ -void MortevielleEngine::prepareScreenType3() { - setTextColor(4); -} - void stop() { hirs(); g_vm->_currGraphicalDevice = MODE_AMSTRAD1512; @@ -416,31 +298,6 @@ void paint_rect(int x, int y, int dx, int dy) { g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); } -/** - * Engine function - Update hour - * @remarks Originally called 'calch' - */ -void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { - int newHour = readclock(); - int th = g_jh + ((newHour - g_mh) / g_t); - minute = ((th % 2) + _currHalfHour) * 30; - hour = ((uint)th >> 1) + _currHour; - if (minute == 60) { - minute = 0; - ++hour; - } - day = (hour / 24) + _currDay; - hour = hour - ((day - _currDay) * 24); -} - -/** - * Engine function - Convert character index to bit index - * @remarks Originally called 'conv' - */ -int convertCharacterIndexToBitIndex(int characterIndex) { - return 128 >> (characterIndex - 1); -} - /* NIVEAU 12 */ void modobj(int m) { Common::String strp = Common::String(' '); @@ -461,14 +318,14 @@ void repon(int f, int m) { else g_vm->_largestClearScreen = false; - clearScreenType2(); + g_vm->clearScreenType2(); displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); switch (f) { case 2: case 8: - clearScreenType2(); + g_vm->clearScreenType2(); g_vm->prepareScreenType2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) @@ -505,261 +362,6 @@ void repon(int f, int m) { } } -/** - * Engine function - Reset presence in other rooms - * @remarks Originally called 't5' - */ -void MortevielleEngine::resetPresenceInRooms(int roomId) { - if (roomId == DINING_ROOM) - _blo = false; - - if (roomId != GREEN_ROOM) { - _roomPresenceLuc = false; - _roomPresenceIda = false; - } - - if (roomId != PURPLE_ROOM) - _purpleRoomPresenceLeo = false; - - if (roomId != DARKBLUE_ROOM) { - _roomPresenceGuy = false; - _roomPresenceEva = false; - } - - if (roomId != BLUE_ROOM) - _roomPresenceMax = false; - if (roomId != RED_ROOM) - _roomPresenceBob = false; - if (roomId != GREEN_ROOM2) - _roomPresencePat = false; - if (roomId != TOILETS) - _toiletsPresenceBobMax = false; - if (roomId != BATHROOM) - _bathRoomPresenceBobMax = false; - if (roomId != ROOM9) - _room9PresenceLeo = false; -} - -/** - * Engine function - Show the people present in the given room - * @remarks Originally called 'affper' - */ -void MortevielleEngine::showPeoplePresent(int bitIndex) { - int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); - - for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); - - clearScreenType10(); - if ((bitIndex & 128) == 128) { - _screenSurface.putxy(xp, 24); - _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]); - } - if ((bitIndex & 64) == 64) { - _screenSurface.putxy(xp, 32); - _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]); - } - if ((bitIndex & 32) == 32) { - _screenSurface.putxy(xp, 40); - _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]); - } - if ((bitIndex & 16) == 16) { - _screenSurface.putxy(xp, 48); - _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]); - } - if ((bitIndex & 8) == 8) { - _screenSurface.putxy(xp, 56); - _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]); - } - if ((bitIndex & 4) == 4) { - _screenSurface.putxy(xp, 64); - _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]); - } - if ((bitIndex & 2) == 2) { - _screenSurface.putxy(xp, 72); - _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]); - } - if ((bitIndex & 1) == 1) { - _screenSurface.putxy(xp, 80); - _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]); - } - _currBitIndex = bitIndex; -} - -/** - * Engine function - Select random characters - * @remarks Originally called 'choix' - */ -int MortevielleEngine::selectCharacters(int min, int max) { - bool invertSelection = false; - int rand = getRandomNumber(min, max); - - if (rand > 4) { - rand = 8 - rand; - invertSelection = true; - } - - int i = 0; - int retVal = 0; - while (i < rand) { - int charIndex = getRandomNumber(1, 8); - int charBitIndex = convertCharacterIndexToBitIndex(charIndex); - if ((retVal & charBitIndex) != charBitIndex) { - ++i; - retVal |= charBitIndex; - } - } - if (invertSelection) - retVal = 255 - retVal; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Green Room - * @remarks Originally called 'cpl1' - */ -int MortevielleEngine::getPresenceStatsGreenRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - // The original uses an || instead of an &&, resulting - // in an always true condition. Based on the other tests, - // and on other scenes, we use an && instead. - if ((hour > 7) && (hour < 11)) - retVal = 25; - else if ((hour > 10) && (hour < 14)) - retVal = 35; - else if ((hour > 13) && (hour < 16)) - retVal = 50; - else if ((hour > 15) && (hour < 18)) - retVal = 5; - else if ((hour > 17) && (hour < 22)) - retVal = 35; - else if ((hour > 21) && (hour < 24)) - retVal = 50; - else if ((hour >= 0) && (hour < 8)) - retVal = 70; - - _menu.mdn(); - - return retVal; -} -/** - * Engine function - Get Presence Statistics - Purple Room - * @remarks Originally called 'cpl2' - */ -int MortevielleEngine::getPresenceStatsPurpleRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 7) && (hour < 11)) - retVal = -2; - else if (hour == 11) - retVal = 100; - else if ((hour > 11) && (hour < 23)) - retVal = 10; - else if (hour == 23) - retVal = 20; - else if ((hour >= 0) && (hour < 8)) - retVal = 50; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Toilets - * @remarks Originally called 'cpl3' - */ -int MortevielleEngine::getPresenceStatsToilets() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 10)) || ((hour > 19) && (hour < 24))) - retVal = 34; - else if (((hour > 9) && (hour < 20)) || ((hour >= 0) && (hour < 9))) - retVal = 0; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Blue Room - * @remarks Originally called 'cpl5' - */ -int MortevielleEngine::getPresenceStatsBlueRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 6) && (hour < 10)) - retVal = 0; - else if (hour == 10) - retVal = 100; - else if ((hour > 10) && (hour < 24)) - retVal = 15; - else if ((hour >= 0) && (hour < 7)) - retVal = 50; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Red Room - * @remarks Originally called 'cpl6' - */ -int MortevielleEngine::getPresenceStatsRedRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 7) && (hour < 13)) || ((hour > 17) && (hour < 20))) - retVal = -2; - else if (((hour > 12) && (hour < 17)) || ((hour > 19) && (hour < 24))) - retVal = 35; - else if (hour == 17) - retVal = 100; - else if ((hour >= 0) && (hour < 8)) - retVal = 60; - - return retVal; -} - -/** - * Shows the "you are alone" message in the status area - * on the right hand side of the screen - * @remarks Originally called 'person' - */ -void MortevielleEngine::displayAloneText() { - for (int cf = 1; cf <= 8; ++cf) - _menu.disableMenuItem(_menu._discussMenu[cf]); - - Common::String sYou = getEngineString(S_YOU); - Common::String sAre = getEngineString(S_ARE); - Common::String sAlone = getEngineString(S_ALONE); - - clearScreenType10(); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); - _screenSurface.drawString(sYou, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); - _screenSurface.drawString(sAre, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); - _screenSurface.drawString(sAlone, 4); - - _currBitIndex = 0; -} - int chlm() { int retval = getRandomNumber(1, 2); if (retval == 2) @@ -782,7 +384,7 @@ void drawClock() { const int rg = 9; int h, co; - hideMouse(); + g_vm->_mouse.hideMouse(); paint_rect(570, 118, 20, 10); paint_rect(578, 114, 6, 18); @@ -803,7 +405,7 @@ void drawClock() { h = 12; g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); - showMouse(); + g_vm->_mouse.showMouse(); g_vm->_screenSurface.putxy(568, 154); if (g_vm->_hour > 11) @@ -832,391 +434,6 @@ void debloc(int roomId) { g_mpers = g_vm->_currBitIndex; } -/** - * Engine function - Get Presence Statistics - Room Bureau - * @remarks Originally called 'cpl10' - */ -int MortevielleEngine::getPresenceStatsDiningRoom(int &hour) { - int day, minute; - - int retVal = 0; - updateHour(day, hour, minute); - if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - retVal = 100; - else if ((hour == 11) || ((hour > 20) && (hour < 24))) - retVal = 45; - else if (((hour > 13) && (hour < 17)) || (hour == 18)) - retVal = 35; - else if (hour == 17) - retVal = 60; - else if ((hour >= 0) && (hour < 8)) - retVal = 5; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Bureau - * @remarks Originally called 'cpl11' - */ -int MortevielleEngine::getPresenceStatsBureau(int &hour) { - int day, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) - retVal = 25; - else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - retVal = 5; - else if ((hour > 13) && (hour < 17)) - retVal = 55; - else if ((hour > 16) && (hour < 19)) - retVal = 45; - else if ((hour >= 0) && (hour < 9)) - retVal = 0; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Kitchen - * @remarks Originally called 'cpl12' - */ -int MortevielleEngine::getPresenceStatsKitchen() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 15)) || ((hour > 16) && (hour < 22))) - retVal = 55; - else if (((hour > 14) && (hour < 17)) || ((hour > 21) && (hour < 24))) - retVal = 25; - else if ((hour >= 0) && (hour < 5)) - retVal = 0; - else if ((hour > 4) && (hour < 9)) - retVal = 15; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Attic - * @remarks Originally called 'cpl13' - */ -int MortevielleEngine::getPresenceStatsAttic() { - return 0; -} - -/** - * Engine function - Get Presence Statistics - Room Landing - * @remarks Originally called 'cpl15' - */ -int MortevielleEngine::getPresenceStatsLanding() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 7) && (hour < 12)) - retVal = 25; - else if ((hour > 11) && (hour < 14)) - retVal = 0; - else if ((hour > 13) && (hour < 18)) - retVal = 10; - else if ((hour > 17) && (hour < 20)) - retVal = 55; - else if ((hour > 19) && (hour < 22)) - retVal = 5; - else if ((hour > 21) && (hour < 24)) - retVal = 15; - else if ((hour >= 0) && (hour < 8)) - retVal = -15; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Chapel - * @remarks Originally called 'cpl20' - */ -int MortevielleEngine::getPresenceStatsChapel(int &hour) { - int day, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (hour == 10) - retVal = 65; - else if ((hour > 10) && (hour < 21)) - retVal = 5; - else if ((hour > 20) && (hour < 24)) - retVal = -15; - else if ((hour >= 0) && (hour < 5)) - retVal = -300; - else if ((hour > 4) && (hour < 10)) - retVal = -5; - - return retVal; -} - -/** - * Engine function - Check who is in the Green Room - * @remarks Originally called 'quelq1' - */ -void MortevielleEngine::setPresenceGreenRoom(int roomId) { - int rand = getRandomNumber(1, 2); - if (roomId == GREEN_ROOM) { - if (rand == 1) - _roomPresenceLuc = true; - else - _roomPresenceIda = true; - } else if (roomId == DARKBLUE_ROOM) { - if (rand == 1) - _roomPresenceGuy = true; - else - _roomPresenceEva = true; - } - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Purple Room - * @remarks Originally called 'quelq2' - */ -void MortevielleEngine::setPresencePurpleRoom() { - if (_place == PURPLE_ROOM) - _purpleRoomPresenceLeo = true; - else - _room9PresenceLeo = true; - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Blue Room - * @remarks Originally called 'quelq5' - */ -void MortevielleEngine::setPresenceBlueRoom() { - _roomPresenceMax = true; - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Red Room - * @remarks Originally called 'quelq6' - */ -void MortevielleEngine::setPresenceRedRoom(int roomId) { - if (roomId == RED_ROOM) - _roomPresenceBob = true; - else if (roomId == GREEN_ROOM2) - _roomPresencePat = true; - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Dining Room - * @remarks Originally called 'quelq10' - */ -int MortevielleEngine::setPresenceDiningRoom(int hour) { - int retVal = 0; - - if ((hour >= 0) && (hour < 8)) - retVal = chlm(); - else { - int min = 0, max = 0; - if ((hour > 7) && (hour < 10)) { - min = 5; - max = 7; - } else if ((hour > 9) && (hour < 12)) { - min = 1; - max = 4; - } else if (((hour > 11) && (hour < 15)) || ((hour > 18) && (hour < 21))) { - min = 6; - max = 8; - } else if (((hour > 14) && (hour < 19)) || ((hour > 20) && (hour < 24))) { - min = 1; - max = 5; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Bureau - * @remarks Originally called 'quelq11' - */ -int MortevielleEngine::setPresenceBureau(int hour) { - int retVal = 0; - - if ((hour >= 0) && (hour < 8)) - retVal = chlm(); - else { - int min = 0, max = 0; - if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { - min = 1; - max = 3; - } else if (((hour > 9) && (hour < 12)) || ((hour > 13) && (hour < 19))) { - min = 1; - max = 4; - } else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) { - min = 1; - max = 2; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Kitchen - * @remarks Originally called 'quelq12' - */ -int MortevielleEngine::setPresenceKitchen() { - int retVal = chlm(); - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Landing - * @remarks Originally called 'quelq15' - */ -int MortevielleEngine::setPresenceLanding() { - bool test = false; - int rand = 0; - do { - rand = getRandomNumber(1, 8); - test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || - ((rand == 2) && _roomPresencePat) || - ((rand == 3) && _roomPresenceGuy) || - ((rand == 4) && _roomPresenceEva) || - ((rand == 5) && _roomPresenceBob) || - ((rand == 6) && _roomPresenceLuc) || - ((rand == 7) && _roomPresenceIda) || - ((rand == 8) && _roomPresenceMax)); - } while (test); - - int retVal = convertCharacterIndexToBitIndex(rand); - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the chapel - * @remarks Originally called 'quelq20' - */ -int MortevielleEngine::setPresenceChapel(int hour) { - int retVal = 0; - - if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) - retVal = chlm(); - else { - int min = 0, max = 0; - if ((hour > 9) && (hour < 12)) { - min = 3; - max = 7; - } else if ((hour > 11) && (hour < 18)) { - min = 1; - max = 2; - } else if (hour == 18) { - min = 2; - max = 4; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Get the answer after you known a door - * @remarks Originally called 'frap' - */ -void MortevielleEngine::getKnockAnswer() { - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour >= 0) && (hour < 8)) - g_crep = 190; - else { - if (getRandomNumber(1, 100) > 70) - g_crep = 190; - else - g_crep = 147; - } -} - -/** - * Engine function - Get Room Presence Bit Index - * @remarks Originally called 'nouvp' - */ -int MortevielleEngine::getPresenceBitIndex(int roomId) { - int bitIndex = 0; - if (roomId == GREEN_ROOM) { - if (_roomPresenceLuc) - bitIndex = 4; // LUC - if (_roomPresenceIda) - bitIndex = 2; // IDA - } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) - || ((roomId == ROOM9) && (_room9PresenceLeo))) - bitIndex = 128; // LEO - else if (roomId == DARKBLUE_ROOM) { - if (_roomPresenceGuy) - bitIndex = 32; // GUY - if (_roomPresenceEva) - bitIndex = 16; // EVA - } else if ((roomId == BLUE_ROOM) && (_roomPresenceMax)) - bitIndex = 1; // MAX - else if ((roomId == RED_ROOM) && (_roomPresenceBob)) - bitIndex = 8; // BOB - else if ((roomId == GREEN_ROOM2) && (_roomPresencePat)) - bitIndex = 64; // PAT - else if ( ((roomId == TOILETS) && (_toiletsPresenceBobMax)) - || ((roomId == BATHROOM) && (_bathRoomPresenceBobMax)) ) - bitIndex = 9; // BOB + MAX - - if (bitIndex != 9) - showPeoplePresent(bitIndex); - - return bitIndex; -} - -/** - * Engine function - Convert bit index to character index - * @remarks Originally called 'tip' - */ -int convertBitIndexToCharacterIndex(int bitIndex) { - int retVal = 0; - - if (bitIndex == 128) - retVal = 1; - else if (bitIndex == 64) - retVal = 2; - else if (bitIndex == 32) - retVal = 3; - else if (bitIndex == 16) - retVal = 4; - else if (bitIndex == 8) - retVal = 5; - else if (bitIndex == 4) - retVal = 6; - else if (bitIndex == 2) - retVal = 7; - else if (bitIndex == 1) - retVal = 8; - - return retVal; -} - - void ecfren(int &p, int &rand, int cf, int roomId) { if (roomId == OWN_ROOM) g_vm->displayAloneText(); @@ -1337,198 +554,6 @@ void resetVariables() { init_nbrepm(); } -/** - * Engine function - initGame - * @remarks Originally called 'dprog' - */ -void MortevielleEngine::initGame() { - _place = MANOR_FRONT; - g_jh = 0; - if (!g_s._alreadyEnteredManor) - _blo = true; - g_t = kTime1; - g_mh = readclock(); -} - -/** - * Engine function - Set Random Presence - Green Room - * @remarks Originally called 'pl1' - */ -void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { - if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) - || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { - int p = getPresenceStatsGreenRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceGreenRoom(_place); - } -} - -/** - * Engine function - Set Random Presence - Purple Room - * @remarks Originally called 'pl2' - */ -void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { - if (!_purpleRoomPresenceLeo) { - int p = getPresenceStatsPurpleRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresencePurpleRoom(); - } -} - -/** - * Engine function - Set Random Presence - Blue Room - * @remarks Originally called 'pl5' - */ -void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { - if (!_roomPresenceMax) { - int p = getPresenceStatsBlueRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceBlueRoom(); - } -} - -/** - * Engine function - Set Random Presence - Red Room - * @remarks Originally called 'pl6' - */ -void MortevielleEngine::setRandomPresenceRedRoom(int cf) { - if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) - || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { - int p = getPresenceStatsRedRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceRedRoom(_place); - } -} - -/** - * Engine function - Set Random Presence - Room 9 - * @remarks Originally called 'pl9' - */ -void MortevielleEngine::setRandomPresenceRoom9(int cf) { - if (!_room9PresenceLeo) { - cf = -10; - int p, rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresencePurpleRoom(); - } -} - -/** - * Engine function - Set Random Presence - Dining Room - * @remarks Originally called 'pl10' - */ -void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { - int h, rand; - int p = getPresenceStatsDiningRoom(h); - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceDiningRoom(h); -} - -/** - * Engine function - Set Random Presence - Bureau - * @remarks Originally called 'pl11' - */ -void MortevielleEngine::setRandomPresenceBureau(int cf) { - int h, rand; - - int p = getPresenceStatsBureau(h); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceBureau(h); -} - -/** - * Engine function - Set Random Presence - Kitchen - * @remarks Originally called 'pl12' - */ -void MortevielleEngine::setRandomPresenceKitchen(int cf) { - int p, rand; - - p = getPresenceStatsKitchen(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceKitchen(); -} - -/** - * Engine function - Set Random Presence - Attic / Cellar - * @remarks Originally called 'pl13' - */ -void MortevielleEngine::setRandomPresenceAttic(int cf) { - int p, rand; - - p = getPresenceStatsAttic(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceKitchen(); -} - -/** - * Engine function - Set Random Presence - Landing - * @remarks Originally called 'pl15' - */ -void MortevielleEngine::setRandomPresenceLanding(int cf) { - int p, rand; - - p = getPresenceStatsLanding(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceLanding(); -} - -/** - * Engine function - Set Random Presence - Chapel - * @remarks Originally called 'pl20' - */ -void MortevielleEngine::setRandomPresenceChapel(int cf) { - int h, rand; - - int p = getPresenceStatsChapel(h); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceChapel(h); -} - int t11(int roomId) { int retVal = 0; int p, rand; @@ -1593,7 +618,7 @@ void cavegre() { g_s._faithScore += 2; if (g_s._faithScore > 69) g_s._faithScore += (g_s._faithScore / 10); - clearScreenType3(); + g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; @@ -1602,7 +627,7 @@ void cavegre() { // The original was doing here a useless loop. // It has been removed - clearScreenType3(); + g_vm->clearScreenType3(); g_vm->displayAloneText(); } @@ -1636,43 +661,12 @@ void aniof(int ouf, int num) { g_vm->prepareScreenType1(); } -/** - * Start music or speech - * @remarks Originally called 'musique' - */ -void MortevielleEngine::startMusicOrSpeech(int so) { - if (so == 0) { - /* musik(0) */ - ; - } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { - // Type 1: Speech - _speechManager.startSpeech(10, 1, 1); - ++g_prebru; - } else { - if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) - // Type 1: Speech - _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); - else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) - // Type 1: Speech - _speechManager.startSpeech(8, 1, 1); - else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) - // Type 1: Speech - _speechManager.startSpeech(12, 1, 1); - else if (g_s._currPlace == INSIDE_WELL) - // Type 1: Speech - _speechManager.startSpeech(13, 1, 1); - else - // Type 2 : music - _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); - } -} - /* NIVEAU 9 */ void dessin(int ad) { if (ad != 0) dessine(g_ades, ((ad % 160) * 2), (ad / 160)); else { - clearScreenType1(); + g_vm->clearScreenType1(); if (g_caff > 99) { dessine(g_ades, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box @@ -1762,7 +756,7 @@ void tinke() { g_vm->_minute = 30; drawClock(); } - if (y_s < 12) + if (g_vm->_mouse.y_s < 12) return; if (!g_vm->_blo) { @@ -1834,12 +828,12 @@ void tinke() { g_vm->_brt = true; g_hdb = readclock(); if (getRandomNumber(1, 5) < 5) { - clearScreenType3(); + g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(1, rand, 1); - clearScreenType3(); + g_vm->clearScreenType3(); } } } @@ -1862,7 +856,7 @@ void tinke() { void fenat(char ans) { int coul; - hideMouse(); + g_vm->_mouse.hideMouse(); if (g_vm->_currGraphicalDevice == MODE_CGA) coul = 2; else if (g_vm->_currGraphicalDevice == MODE_HERCULES) @@ -1872,7 +866,7 @@ void fenat(char ans) { g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - showMouse(); + g_vm->_mouse.showMouse(); } @@ -1887,14 +881,14 @@ void tkey1(bool d) { bool quest = false; int x, y, c; - hideMouse(); + g_vm->_mouse.hideMouse(); fenat('K'); // Wait for release from any key or mouse button while (g_vm->keyPressed()) g_key = testou(); do { - getMousePos_(x, y, c); + g_vm->_mouse.getMousePos_(x, y, c); g_vm->keyPressed(); } while (c != 0); @@ -1903,13 +897,13 @@ void tkey1(bool d) { if (d) tinke(); quest = g_vm->keyPressed(); - getMousePos_(x, y, c); + g_vm->_mouse.getMousePos_(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && g_vm->_anyone))); if (quest) testou(); g_vm->setMouseClick(false); - showMouse(); + g_vm->_mouse.showMouse(); } /* NIVEAU 7 */ @@ -1929,30 +923,6 @@ void affrep() { g_crep = g_s._currPlace; } -/** - * Engine function - You lose! - * @remarks Originally called 'tperd' - */ -void MortevielleEngine::loseGame() { - initouv(); - g_ment = 0; - g_iouv = 0; - g_mchai = 0; - _menu.unsetSearchMenu(); - if (!_blo) - t11(MANOR_FRONT); - - _loseGame = true; - clearScreenType1(); - _screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, g_crep); - clearScreenType2(); - clearScreenType3(); - _col = false; - _syn = false; - _okdes = false; -} - void tsort() { if ((g_iouv > 0) && (g_s._currPlace != 0)) { @@ -2000,30 +970,6 @@ void st4(int ob) { } } -/** - * Engine function - Check inventory for a given object - * @remarks Originally called 'cherjer' - */ -bool MortevielleEngine::checkInventory(int objectId) { - bool retVal = false; - for (int i = 1; i <= 6; ++i) - retVal = (retVal || (ord(g_s._sjer[i]) == objectId)); - - if (g_s._selectedObjectId == objectId) - retVal = true; - - return retVal; -} - -/** - * Engine function - Display Dining Room - * @remarks Originally called 'st1sama' - */ -void MortevielleEngine::displayDiningRoom() { - g_s._currPlace = DINING_ROOM; - affrep(); -} - void modinv() { int r; Common::String nomp; @@ -2047,38 +993,6 @@ void modinv() { } } -void sparl(float adr, float rep) { - const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key, repint; - - repint = abs((int)rep); - hideMouse(); - Common::String tmpStr = deline(repint + kDialogStringIndex); - displayStr(tmpStr, 230, 4, 65, 24, 5); - f3f8::draw(); - - key = 0; - do { - g_vm->_speechManager.startSpeech(repint, haut[g_caff - 69], 0); - f3f8::waitForF3F8(key); - CHECK_QUIT; - } while (key != 66); - hirs(); - showMouse(); -} - -/** - * Engine function - End of Search: reset globals - * @remarks Originally called 'finfouill' - */ -void endSearch() { - g_vm->_heroSearching = false; - g_vm->_obpart = false; - g_cs = 0; - g_is = 0; - g_vm->_menu.unsetSearchMenu(); -} - void mennor() { g_vm->_menu.menuUp(g_msg[3]); } @@ -2115,92 +1029,6 @@ void ajjer(int ob) { g_crep = 139; } -/** - * Engine function - Go to Dining room - * @remarks Originally called 't1sama' - */ -void MortevielleEngine::gotoDiningRoom() { - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > ROOM18)) { - if (!checkInventory(137)) { //You don't have the keys, and it's late - g_crep = 1511; - loseGame(); - } else - displayDiningRoom(); - } else if (!g_s._alreadyEnteredManor) { //Is it your first time? - _currBitIndex = 255; // Everybody is present - showPeoplePresent(_currBitIndex); - g_caff = 77; - afdes(); - _screenSurface.drawBox(223, 47, 155, 91, 15); - repon(2, 33); - tkey1(false); - mennor(); - hideMouse(); - hirs(); - premtet(); - sparl(0, 140); - drawRightFrame(); - drawClock(); - showMouse(); - g_s._currPlace = OWN_ROOM; - affrep(); - resetPresenceInRooms(DINING_ROOM); - if (!_blo) - minute = t11(OWN_ROOM); - _currBitIndex = 0; - g_mpers = 0; - g_s._alreadyEnteredManor = true; - } else - displayDiningRoom(); -} - -/** - * Engine function - Check Manor distance (in the mountains) - * @remarks Originally called 't1neig' - */ -void MortevielleEngine::checkManorDistance() { - ++_manorDistance; - if (_manorDistance > 2) { - g_crep = 1506; - loseGame(); - } else { - _okdes = true; - g_s._currPlace = MOUNTAIN; - affrep(); - } -} - -/** - * Engine function - Go to Manor front - * @remarks Originally called 't1deva' - */ -void MortevielleEngine::gotoManorFront() { - _manorDistance = 0; - g_s._currPlace = MANOR_FRONT; - affrep(); -} - -/** - * Engine function - Go to Manor back - * @remarks Originally called 't1derr' - */ -void MortevielleEngine::gotoManorBack() { - g_s._currPlace = MANOR_BACK; - affrep(); -} - -/** - * Engine function - Dead : Flooded in Well - * @remarks Originally called 't1deau' - */ -void MortevielleEngine::floodedInWell() { - g_crep = 1503; - loseGame(); -} - void tctrm() { repon(2, (3000 + g_ctrm)); g_ctrm = 0; @@ -2211,7 +1039,7 @@ void quelquun() { if (g_vm->_menu._menuDisplayed) g_vm->_menu.eraseMenu(); - endSearch(); + g_vm->endSearch(); g_crep = 997; L1: if (!g_vm->_hiddenHero) { @@ -2231,7 +1059,7 @@ L1: g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); g_vm->_menu.setDestinationMenuText(LANDING); - int cx = convertBitIndexToCharacterIndex(g_vm->_currBitIndex); + int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); g_caff = 69 + cx; g_crep = g_caff; g_msg[3] = MENU_DISCUSS; @@ -2247,7 +1075,7 @@ L1: repon(2, 136); int rand = (getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(3, rand, 1); - clearScreenType2(); + g_vm->clearScreenType2(); g_vm->displayAloneText(); debloc(21); affrep(); @@ -2278,7 +1106,7 @@ void tsuiv() { g_s._faithScore += 2; } else { affrep(); - endSearch(); + g_vm->endSearch(); if (cx > 9) g_crep = 131; } @@ -2297,11 +1125,11 @@ void tfleche() { touch = '\0'; do { - moveMouse(qust, touch); + g_vm->_mouse.moveMouse(qust, touch); CHECK_QUIT; if (g_vm->getMouseClick()) - inRect = (x_s < 256 * g_res) && (y_s < 176) && (y_s > 12); + inRect = (g_vm->_mouse.x_s < 256 * g_res) && (g_vm->_mouse.y_s < 176) && (g_vm->_mouse.y_s > 12); tinke(); } while (!(qust || inRect || g_vm->_anyone)); @@ -2313,8 +1141,8 @@ void tfleche() { g_vm->_keyPressedEsc = true; if (inRect) { - g_x = x_s; - g_y = y_s; + g_x = g_vm->_mouse.x_s; + g_y = g_vm->_mouse.y_s; } } @@ -2463,221 +1291,4 @@ void aldepl() { Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); } -/** - * Engine function - Change Graphical Device - * @remarks Originally called 'change_gd' - */ -void MortevielleEngine::changeGraphicalDevice(int newDevice) { - hideMouse(); - _currGraphicalDevice = newDevice; - hirs(); - initMouse(); - showMouse(); - drawRightFrame(); - tinke(); - drawClock(); - if (_currBitIndex != 0) - showPeoplePresent(_currBitIndex); - else - displayAloneText(); - clearScreenType2(); - clearScreenType3(); - g_maff = 68; - afdes(); - repon(2, g_crep); - _menu.displayMenu(); -} - -/** - * Called when a savegame has been loaded. - * @remarks Originally called 'antegame' - */ -void MortevielleEngine::gameLoaded() { - hideMouse(); - _menu._menuDisplayed = false; - _loseGame = true; - _anyone = false; - _okdes = true; - _col = false; - _hiddenHero = false; - _brt = false; - g_maff = 68; - g_mnumo = OPCODE_NONE; - g_prebru = 0; - g_x = 0; - g_y = 0; - g_num = 0; - g_hdb = 0; - g_hfb = 0; - g_cs = 0; - g_is = 0; - g_ment = 0; - _syn = true; - _heroSearching = true; - g_mchai = 0; - _manorDistance = 0; - initouv(); - g_iouv = 0; - g_dobj = 0; - affrep(); - _hintPctMessage = deline(580); - - _okdes = false; - _endGame = true; - _loseGame = false; - _heroSearching = false; - - displayAloneText(); - tinke(); - drawClock(); - afdes(); - repon(2, g_crep); - clearScreenType3(); - _endGame = false; - _menu.setDestinationMenuText(g_s._currPlace); - modinv(); - if (g_s._selectedObjectId != 0) - modobj(g_s._selectedObjectId + 400); - showMouse(); -} - -/** - * Engine function - Handle OpCodes - * @remarks Originally called 'tsitu' - */ -void MortevielleEngine::handleOpcode() { - if (!_col) - clearScreenType2(); - _syn = false; - _keyPressedEsc = false; - if (!_anyone) { - if (_brt) { - if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { - g_ctrm = 4; - mennor(); - return; - } - } - if (g_msg[3] == MENU_MOVE) - fctMove(); - if (g_msg[3] == MENU_DISCUSS) - fctDiscuss(); - if (g_msg[3] == MENU_INVENTORY) - fctInventoryTake(); - if (g_msg[4] == OPCODE_ATTACH) - fctAttach(); - if (g_msg[4] == OPCODE_WAIT) - fctWait(); - if (g_msg[4] == OPCODE_FORCE) - fctForce(); - if (g_msg[4] == OPCODE_SLEEP) - fctSleep(); - if (g_msg[4] == OPCODE_LISTEN) - fctListen(); - if (g_msg[4] == OPCODE_ENTER) - fctEnter(); - if (g_msg[4] == OPCODE_CLOSE) - fctClose(); - if (g_msg[4] == OPCODE_SEARCH) - fctSearch(); - if (g_msg[4] == OPCODE_KNOCK) - fctKnock(); - if (g_msg[4] == OPCODE_SCRATCH) - fctScratch(); - if (g_msg[4] == OPCODE_READ) - fctRead(); - if (g_msg[4] == OPCODE_EAT) - fctEat(); - if (g_msg[4] == OPCODE_PLACE) - fctPlace(); - if (g_msg[4] == OPCODE_OPEN) - fctOpen(); - if (g_msg[4] == OPCODE_TAKE) - fctTake(); - if (g_msg[4] == OPCODE_LOOK) - fctLook(); - if (g_msg[4] == OPCODE_SMELL) - fctSmell(); - if (g_msg[4] == OPCODE_SOUND) - fctSound(); - if (g_msg[4] == OPCODE_LEAVE) - fctLeave(); - if (g_msg[4] == OPCODE_LIFT) - fctLift(); - if (g_msg[4] == OPCODE_TURN) - fctTurn(); - if (g_msg[4] == OPCODE_SSEARCH) - fctSelfSearch(); - if (g_msg[4] == OPCODE_SREAD) - fctSelfRead(); - if (g_msg[4] == OPCODE_SPUT) - fctSelfPut(); - if (g_msg[4] == OPCODE_SLOOK) - fctSelftLook(); - _hiddenHero = false; - - if (g_msg[4] == OPCODE_SHIDE) - fctSelfHide(); - } else { - if (_anyone) { - quelquun(); - _anyone = false; - mennor(); - return; - } - } - int hour, day, minute; - updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) - ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL) - && (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) { - if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { - g_crep = 1501; - loseGame(); - } - if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { - g_crep = 1508; - loseGame(); - } - if ((day > 1) && (hour > 8) && (!_loseGame)) { - g_crep = 1502; - loseGame(); - } - } - mennor(); -} - -/** - * Engine function - Transform time into a char - * @remarks Originally called 'tmaj3' - */ -void MortevielleEngine::hourToChar() { - int day, hour, minute; - - g_vm->updateHour(day, hour, minute); - if (minute == 30) - minute = 1; - hour += day * 24; - minute += hour * 2; - g_s._fullHour = chr(minute); -} - -/** - * Engine function - extract time from a char - * @remarks Originally called 'theure' - */ -void MortevielleEngine::charToHour() { - int fullHour = ord(g_s._fullHour); - int tmpHour = fullHour % 48; - g_vm->_currDay = fullHour / 48; - g_vm->_currHalfHour = tmpHour % 2; - g_vm->_currHour = tmpHour / 2; - g_vm->_hour = g_vm->_currHour; - if (g_vm->_currHalfHour == 1) - g_vm->_minute = 30; - else - g_vm->_minute = 0; -} } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 528039c6ba..0cd467c177 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -42,9 +42,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; -/* NIVEAU 15 */ extern void copcha(); -extern bool isMouseIn(rectangle r); extern void outbloc(int n, pattern p, nhom *pal); extern void writepal(int n); extern void pictout(int seg, int dep, int x, int y); @@ -60,15 +58,10 @@ extern void drawRightFrame(); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); extern void initouv(); -extern void clearScreenType1(); -extern void clearScreenType2(); -extern void clearScreenType3(); -extern void clearScreenType10(); extern void ecr2(Common::String str_); extern void ecr3(Common::String text); extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); -extern int convertCharacterIndexToBitIndex(int characterIndex); /* NIVEAU 12 */ extern void modobj(int m); extern void repon(int f, int m); @@ -78,7 +71,6 @@ extern void drawClock(); * NIVEAU 11 * *************/ extern void debloc(int roomId); -extern int convertBitIndexToCharacterIndex(int bitIndex); extern void ecfren(int &p, int &rand, int cf, int roomId); extern void becfren(int roomId); /* NIVEAU 10 */ @@ -105,8 +97,6 @@ extern void tsort(); extern void st4(int ob); extern void displayDiningRoom(); extern void modinv(); -extern void sparl(float adr, float rep); -extern void endSearch(); extern void mennor(); extern void premtet(); /* NIVEAU 5 */ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3667a135c1..f376e57d8d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -339,8 +339,8 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - x_s = event.mouse.x; - y_s = event.mouse.y / 2; + g_vm->_mouse.x_s = event.mouse.x; + g_vm->_mouse.y_s = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseClick = true; @@ -550,7 +550,7 @@ void MortevielleEngine::mainGame() { initGame(); hirs(); drawRightFrame(); - showMouse(); + g_vm->_mouse.showMouse(); // Loop to play the game do { @@ -603,7 +603,7 @@ void MortevielleEngine::handleAction() { do { _menu.mdn(); tinke(); - moveMouse(funct, inkey); + g_vm->_mouse.moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); @@ -652,7 +652,7 @@ void MortevielleEngine::handleAction() { g_mnumo = g_msg[4]; if (!_anyone) { if ((_heroSearching) || (_obpart)) { - if (y_s < 12) + if (g_vm->_mouse.y_s < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { @@ -705,4 +705,1384 @@ void MortevielleEngine::loadPlaces() { f.close(); } +/** + * Set Text Color + * @remarks Originally called 'text_color' + */ +void MortevielleEngine::setTextColor(int col) { + _textColor = col; +} + +/** + * Prepare screen - Type 1! + * @remarks Originally called 'ecrf1' + */ +void MortevielleEngine::prepareScreenType1() { + // Large drawing + _screenSurface.drawBox(0, 11, 512, 163, 15); +} + +/** + * Prepare room - Type 2! + * @remarks Originally called 'ecrf2' + */ +void MortevielleEngine::prepareScreenType2() { + setTextColor(5); +} + +/** + * Prepare room - Type 3! + * @remarks Originally called 'ecrf7' + */ +void MortevielleEngine::prepareScreenType3() { + setTextColor(4); +} + +/** + * Engine function - Update hour + * @remarks Originally called 'calch' + */ +void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { + int newHour = readclock(); + int th = g_jh + ((newHour - g_mh) / g_t); + minute = ((th % 2) + _currHalfHour) * 30; + hour = ((uint)th >> 1) + _currHour; + if (minute == 60) { + minute = 0; + ++hour; + } + day = (hour / 24) + _currDay; + hour = hour - ((day - _currDay) * 24); +} + +/** + * Engine function - Convert character index to bit index + * @remarks Originally called 'conv' + */ +int MortevielleEngine::convertCharacterIndexToBitIndex(int characterIndex) { + return 128 >> (characterIndex - 1); +} + +/** + * Engine function - Convert bit index to character index + * @remarks Originally called 'tip' + */ +int MortevielleEngine::convertBitIndexToCharacterIndex(int bitIndex) { + int retVal = 0; + + if (bitIndex == 128) + retVal = 1; + else if (bitIndex == 64) + retVal = 2; + else if (bitIndex == 32) + retVal = 3; + else if (bitIndex == 16) + retVal = 4; + else if (bitIndex == 8) + retVal = 5; + else if (bitIndex == 4) + retVal = 6; + else if (bitIndex == 2) + retVal = 7; + else if (bitIndex == 1) + retVal = 8; + + return retVal; +} + +/** + * Engine function - Reset presence in other rooms + * @remarks Originally called 't5' + */ +void MortevielleEngine::resetPresenceInRooms(int roomId) { + if (roomId == DINING_ROOM) + _blo = false; + + if (roomId != GREEN_ROOM) { + _roomPresenceLuc = false; + _roomPresenceIda = false; + } + + if (roomId != PURPLE_ROOM) + _purpleRoomPresenceLeo = false; + + if (roomId != DARKBLUE_ROOM) { + _roomPresenceGuy = false; + _roomPresenceEva = false; + } + + if (roomId != BLUE_ROOM) + _roomPresenceMax = false; + if (roomId != RED_ROOM) + _roomPresenceBob = false; + if (roomId != GREEN_ROOM2) + _roomPresencePat = false; + if (roomId != TOILETS) + _toiletsPresenceBobMax = false; + if (roomId != BATHROOM) + _bathRoomPresenceBobMax = false; + if (roomId != ROOM9) + _room9PresenceLeo = false; +} + +/** + * Engine function - Show the people present in the given room + * @remarks Originally called 'affper' + */ +void MortevielleEngine::showPeoplePresent(int bitIndex) { + int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + + for (int i = 1; i <= 8; ++i) + _menu.disableMenuItem(_menu._discussMenu[i]); + + clearScreenType10(); + if ((bitIndex & 128) == 128) { + _screenSurface.putxy(xp, 24); + _screenSurface.drawString("LEO", 4); + _menu.enableMenuItem(_menu._discussMenu[1]); + } + if ((bitIndex & 64) == 64) { + _screenSurface.putxy(xp, 32); + _screenSurface.drawString("PAT", 4); + _menu.enableMenuItem(_menu._discussMenu[2]); + } + if ((bitIndex & 32) == 32) { + _screenSurface.putxy(xp, 40); + _screenSurface.drawString("GUY", 4); + _menu.enableMenuItem(_menu._discussMenu[3]); + } + if ((bitIndex & 16) == 16) { + _screenSurface.putxy(xp, 48); + _screenSurface.drawString("EVA", 4); + _menu.enableMenuItem(_menu._discussMenu[4]); + } + if ((bitIndex & 8) == 8) { + _screenSurface.putxy(xp, 56); + _screenSurface.drawString("BOB", 4); + _menu.enableMenuItem(_menu._discussMenu[5]); + } + if ((bitIndex & 4) == 4) { + _screenSurface.putxy(xp, 64); + _screenSurface.drawString("LUC", 4); + _menu.enableMenuItem(_menu._discussMenu[6]); + } + if ((bitIndex & 2) == 2) { + _screenSurface.putxy(xp, 72); + _screenSurface.drawString("IDA", 4); + _menu.enableMenuItem(_menu._discussMenu[7]); + } + if ((bitIndex & 1) == 1) { + _screenSurface.putxy(xp, 80); + _screenSurface.drawString("MAX", 4); + _menu.enableMenuItem(_menu._discussMenu[8]); + } + _currBitIndex = bitIndex; +} + +/** + * Engine function - Select random characters + * @remarks Originally called 'choix' + */ +int MortevielleEngine::selectCharacters(int min, int max) { + bool invertSelection = false; + int rand = getRandomNumber(min, max); + + if (rand > 4) { + rand = 8 - rand; + invertSelection = true; + } + + int i = 0; + int retVal = 0; + while (i < rand) { + int charIndex = getRandomNumber(1, 8); + int charBitIndex = convertCharacterIndexToBitIndex(charIndex); + if ((retVal & charBitIndex) != charBitIndex) { + ++i; + retVal |= charBitIndex; + } + } + if (invertSelection) + retVal = 255 - retVal; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Green Room + * @remarks Originally called 'cpl1' + */ +int MortevielleEngine::getPresenceStatsGreenRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + // The original uses an || instead of an &&, resulting + // in an always true condition. Based on the other tests, + // and on other scenes, we use an && instead. + if ((hour > 7) && (hour < 11)) + retVal = 25; + else if ((hour > 10) && (hour < 14)) + retVal = 35; + else if ((hour > 13) && (hour < 16)) + retVal = 50; + else if ((hour > 15) && (hour < 18)) + retVal = 5; + else if ((hour > 17) && (hour < 22)) + retVal = 35; + else if ((hour > 21) && (hour < 24)) + retVal = 50; + else if ((hour >= 0) && (hour < 8)) + retVal = 70; + + _menu.mdn(); + + return retVal; +} +/** + * Engine function - Get Presence Statistics - Purple Room + * @remarks Originally called 'cpl2' + */ +int MortevielleEngine::getPresenceStatsPurpleRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 11)) + retVal = -2; + else if (hour == 11) + retVal = 100; + else if ((hour > 11) && (hour < 23)) + retVal = 10; + else if (hour == 23) + retVal = 20; + else if ((hour >= 0) && (hour < 8)) + retVal = 50; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Toilets + * @remarks Originally called 'cpl3' + */ +int MortevielleEngine::getPresenceStatsToilets() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 10)) || ((hour > 19) && (hour < 24))) + retVal = 34; + else if (((hour > 9) && (hour < 20)) || ((hour >= 0) && (hour < 9))) + retVal = 0; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Blue Room + * @remarks Originally called 'cpl5' + */ +int MortevielleEngine::getPresenceStatsBlueRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 6) && (hour < 10)) + retVal = 0; + else if (hour == 10) + retVal = 100; + else if ((hour > 10) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 7)) + retVal = 50; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Red Room + * @remarks Originally called 'cpl6' + */ +int MortevielleEngine::getPresenceStatsRedRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 13)) || ((hour > 17) && (hour < 20))) + retVal = -2; + else if (((hour > 12) && (hour < 17)) || ((hour > 19) && (hour < 24))) + retVal = 35; + else if (hour == 17) + retVal = 100; + else if ((hour >= 0) && (hour < 8)) + retVal = 60; + + return retVal; +} + +/** + * Shows the "you are alone" message in the status area + * on the right hand side of the screen + * @remarks Originally called 'person' + */ +void MortevielleEngine::displayAloneText() { + for (int cf = 1; cf <= 8; ++cf) + _menu.disableMenuItem(_menu._discussMenu[cf]); + + Common::String sYou = getEngineString(S_YOU); + Common::String sAre = getEngineString(S_ARE); + Common::String sAlone = getEngineString(S_ALONE); + + clearScreenType10(); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); + _screenSurface.drawString(sYou, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); + _screenSurface.drawString(sAre, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); + _screenSurface.drawString(sAlone, 4); + + _currBitIndex = 0; +} + +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl10' + */ +int MortevielleEngine::getPresenceStatsDiningRoom(int &hour) { + int day, minute; + + int retVal = 0; + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) + retVal = 100; + else if ((hour == 11) || ((hour > 20) && (hour < 24))) + retVal = 45; + else if (((hour > 13) && (hour < 17)) || (hour == 18)) + retVal = 35; + else if (hour == 17) + retVal = 60; + else if ((hour >= 0) && (hour < 8)) + retVal = 5; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl11' + */ +int MortevielleEngine::getPresenceStatsBureau(int &hour) { + int day, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) + retVal = 25; + else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) + retVal = 5; + else if ((hour > 13) && (hour < 17)) + retVal = 55; + else if ((hour > 16) && (hour < 19)) + retVal = 45; + else if ((hour >= 0) && (hour < 9)) + retVal = 0; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Kitchen + * @remarks Originally called 'cpl12' + */ +int MortevielleEngine::getPresenceStatsKitchen() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 15)) || ((hour > 16) && (hour < 22))) + retVal = 55; + else if (((hour > 14) && (hour < 17)) || ((hour > 21) && (hour < 24))) + retVal = 25; + else if ((hour >= 0) && (hour < 5)) + retVal = 0; + else if ((hour > 4) && (hour < 9)) + retVal = 15; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Attic + * @remarks Originally called 'cpl13' + */ +int MortevielleEngine::getPresenceStatsAttic() { + return 0; +} + +/** + * Engine function - Get Presence Statistics - Room Landing + * @remarks Originally called 'cpl15' + */ +int MortevielleEngine::getPresenceStatsLanding() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 12)) + retVal = 25; + else if ((hour > 11) && (hour < 14)) + retVal = 0; + else if ((hour > 13) && (hour < 18)) + retVal = 10; + else if ((hour > 17) && (hour < 20)) + retVal = 55; + else if ((hour > 19) && (hour < 22)) + retVal = 5; + else if ((hour > 21) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 8)) + retVal = -15; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Chapel + * @remarks Originally called 'cpl20' + */ +int MortevielleEngine::getPresenceStatsChapel(int &hour) { + int day, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (hour == 10) + retVal = 65; + else if ((hour > 10) && (hour < 21)) + retVal = 5; + else if ((hour > 20) && (hour < 24)) + retVal = -15; + else if ((hour >= 0) && (hour < 5)) + retVal = -300; + else if ((hour > 4) && (hour < 10)) + retVal = -5; + + return retVal; +} + +/** + * Engine function - Check who is in the Green Room + * @remarks Originally called 'quelq1' + */ +void MortevielleEngine::setPresenceGreenRoom(int roomId) { + int rand = getRandomNumber(1, 2); + if (roomId == GREEN_ROOM) { + if (rand == 1) + _roomPresenceLuc = true; + else + _roomPresenceIda = true; + } else if (roomId == DARKBLUE_ROOM) { + if (rand == 1) + _roomPresenceGuy = true; + else + _roomPresenceEva = true; + } + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Purple Room + * @remarks Originally called 'quelq2' + */ +void MortevielleEngine::setPresencePurpleRoom() { + if (_place == PURPLE_ROOM) + _purpleRoomPresenceLeo = true; + else + _room9PresenceLeo = true; + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Blue Room + * @remarks Originally called 'quelq5' + */ +void MortevielleEngine::setPresenceBlueRoom() { + _roomPresenceMax = true; + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Red Room + * @remarks Originally called 'quelq6' + */ +void MortevielleEngine::setPresenceRedRoom(int roomId) { + if (roomId == RED_ROOM) + _roomPresenceBob = true; + else if (roomId == GREEN_ROOM2) + _roomPresencePat = true; + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Dining Room + * @remarks Originally called 'quelq10' + */ +int MortevielleEngine::setPresenceDiningRoom(int hour) { + int retVal = 0; + + if ((hour >= 0) && (hour < 8)) + retVal = chlm(); + else { + int min = 0, max = 0; + if ((hour > 7) && (hour < 10)) { + min = 5; + max = 7; + } else if ((hour > 9) && (hour < 12)) { + min = 1; + max = 4; + } else if (((hour > 11) && (hour < 15)) || ((hour > 18) && (hour < 21))) { + min = 6; + max = 8; + } else if (((hour > 14) && (hour < 19)) || ((hour > 20) && (hour < 24))) { + min = 1; + max = 5; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Bureau + * @remarks Originally called 'quelq11' + */ +int MortevielleEngine::setPresenceBureau(int hour) { + int retVal = 0; + + if ((hour >= 0) && (hour < 8)) + retVal = chlm(); + else { + int min = 0, max = 0; + if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { + min = 1; + max = 3; + } else if (((hour > 9) && (hour < 12)) || ((hour > 13) && (hour < 19))) { + min = 1; + max = 4; + } else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) { + min = 1; + max = 2; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Kitchen + * @remarks Originally called 'quelq12' + */ +int MortevielleEngine::setPresenceKitchen() { + int retVal = chlm(); + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Landing + * @remarks Originally called 'quelq15' + */ +int MortevielleEngine::setPresenceLanding() { + bool test = false; + int rand = 0; + do { + rand = getRandomNumber(1, 8); + test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || + ((rand == 2) && _roomPresencePat) || + ((rand == 3) && _roomPresenceGuy) || + ((rand == 4) && _roomPresenceEva) || + ((rand == 5) && _roomPresenceBob) || + ((rand == 6) && _roomPresenceLuc) || + ((rand == 7) && _roomPresenceIda) || + ((rand == 8) && _roomPresenceMax)); + } while (test); + + int retVal = convertCharacterIndexToBitIndex(rand); + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the chapel + * @remarks Originally called 'quelq20' + */ +int MortevielleEngine::setPresenceChapel(int hour) { + int retVal = 0; + + if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) + retVal = chlm(); + else { + int min = 0, max = 0; + if ((hour > 9) && (hour < 12)) { + min = 3; + max = 7; + } else if ((hour > 11) && (hour < 18)) { + min = 1; + max = 2; + } else if (hour == 18) { + min = 2; + max = 4; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Get the answer after you known a door + * @remarks Originally called 'frap' + */ +void MortevielleEngine::getKnockAnswer() { + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour >= 0) && (hour < 8)) + g_crep = 190; + else { + if (getRandomNumber(1, 100) > 70) + g_crep = 190; + else + g_crep = 147; + } +} + +/** + * Engine function - Get Room Presence Bit Index + * @remarks Originally called 'nouvp' + */ +int MortevielleEngine::getPresenceBitIndex(int roomId) { + int bitIndex = 0; + if (roomId == GREEN_ROOM) { + if (_roomPresenceLuc) + bitIndex = 4; // LUC + if (_roomPresenceIda) + bitIndex = 2; // IDA + } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) + || ((roomId == ROOM9) && (_room9PresenceLeo))) + bitIndex = 128; // LEO + else if (roomId == DARKBLUE_ROOM) { + if (_roomPresenceGuy) + bitIndex = 32; // GUY + if (_roomPresenceEva) + bitIndex = 16; // EVA + } else if ((roomId == BLUE_ROOM) && (_roomPresenceMax)) + bitIndex = 1; // MAX + else if ((roomId == RED_ROOM) && (_roomPresenceBob)) + bitIndex = 8; // BOB + else if ((roomId == GREEN_ROOM2) && (_roomPresencePat)) + bitIndex = 64; // PAT + else if ( ((roomId == TOILETS) && (_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (_bathRoomPresenceBobMax)) ) + bitIndex = 9; // BOB + MAX + + if (bitIndex != 9) + showPeoplePresent(bitIndex); + + return bitIndex; +} + +/** + * Engine function - initGame + * @remarks Originally called 'dprog' + */ +void MortevielleEngine::initGame() { + _place = MANOR_FRONT; + g_jh = 0; + if (!g_s._alreadyEnteredManor) + _blo = true; + g_t = kTime1; + g_mh = readclock(); +} + +/** + * Engine function - Set Random Presence - Green Room + * @remarks Originally called 'pl1' + */ +void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { + if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) + || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { + int p = getPresenceStatsGreenRoom(); + int rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceGreenRoom(_place); + } +} + +/** + * Engine function - Set Random Presence - Purple Room + * @remarks Originally called 'pl2' + */ +void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { + if (!_purpleRoomPresenceLeo) { + int p = getPresenceStatsPurpleRoom(); + int rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresencePurpleRoom(); + } +} + +/** + * Engine function - Set Random Presence - Blue Room + * @remarks Originally called 'pl5' + */ +void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { + if (!_roomPresenceMax) { + int p = getPresenceStatsBlueRoom(); + int rand; + + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceBlueRoom(); + } +} + +/** + * Engine function - Set Random Presence - Red Room + * @remarks Originally called 'pl6' + */ +void MortevielleEngine::setRandomPresenceRedRoom(int cf) { + if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) + || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { + int p = getPresenceStatsRedRoom(); + int rand; + + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceRedRoom(_place); + } +} + +/** + * Engine function - Set Random Presence - Room 9 + * @remarks Originally called 'pl9' + */ +void MortevielleEngine::setRandomPresenceRoom9(int cf) { + if (!_room9PresenceLeo) { + cf = -10; + int p, rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresencePurpleRoom(); + } +} + +/** + * Engine function - Set Random Presence - Dining Room + * @remarks Originally called 'pl10' + */ +void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { + int h, rand; + int p = getPresenceStatsDiningRoom(h); + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceDiningRoom(h); +} + +/** + * Engine function - Set Random Presence - Bureau + * @remarks Originally called 'pl11' + */ +void MortevielleEngine::setRandomPresenceBureau(int cf) { + int h, rand; + + int p = getPresenceStatsBureau(h); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceBureau(h); +} + +/** + * Engine function - Set Random Presence - Kitchen + * @remarks Originally called 'pl12' + */ +void MortevielleEngine::setRandomPresenceKitchen(int cf) { + int p, rand; + + p = getPresenceStatsKitchen(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceKitchen(); +} + +/** + * Engine function - Set Random Presence - Attic / Cellar + * @remarks Originally called 'pl13' + */ +void MortevielleEngine::setRandomPresenceAttic(int cf) { + int p, rand; + + p = getPresenceStatsAttic(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceKitchen(); +} + +/** + * Engine function - Set Random Presence - Landing + * @remarks Originally called 'pl15' + */ +void MortevielleEngine::setRandomPresenceLanding(int cf) { + int p, rand; + + p = getPresenceStatsLanding(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceLanding(); +} + +/** + * Engine function - Set Random Presence - Chapel + * @remarks Originally called 'pl20' + */ +void MortevielleEngine::setRandomPresenceChapel(int cf) { + int h, rand; + + int p = getPresenceStatsChapel(h); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceChapel(h); +} + +/** + * Start music or speech + * @remarks Originally called 'musique' + */ +void MortevielleEngine::startMusicOrSpeech(int so) { + if (so == 0) { + /* musik(0) */ + ; + } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { + // Type 1: Speech + _speechManager.startSpeech(10, 1, 1); + ++g_prebru; + } else { + if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) + // Type 1: Speech + _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) + // Type 1: Speech + _speechManager.startSpeech(8, 1, 1); + else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) + // Type 1: Speech + _speechManager.startSpeech(12, 1, 1); + else if (g_s._currPlace == INSIDE_WELL) + // Type 1: Speech + _speechManager.startSpeech(13, 1, 1); + else + // Type 2 : music + _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + } +} + +/** + * Engine function - You lose! + * @remarks Originally called 'tperd' + */ +void MortevielleEngine::loseGame() { + initouv(); + g_ment = 0; + g_iouv = 0; + g_mchai = 0; + _menu.unsetSearchMenu(); + if (!_blo) + t11(MANOR_FRONT); + + _loseGame = true; + clearScreenType1(); + _screenSurface.drawBox(60, 35, 400, 50, 15); + repon(9, g_crep); + clearScreenType2(); + clearScreenType3(); + _col = false; + _syn = false; + _okdes = false; +} + +/** + * Engine function - Check inventory for a given object + * @remarks Originally called 'cherjer' + */ +bool MortevielleEngine::checkInventory(int objectId) { + bool retVal = false; + for (int i = 1; i <= 6; ++i) + retVal = (retVal || (ord(g_s._sjer[i]) == objectId)); + + if (g_s._selectedObjectId == objectId) + retVal = true; + + return retVal; +} + +/** + * Engine function - Display Dining Room + * @remarks Originally called 'st1sama' + */ +void MortevielleEngine::displayDiningRoom() { + g_s._currPlace = DINING_ROOM; + affrep(); +} + +/** + * Engine function - Start non interactive Dialog + * @remarks Originally called 'sparl' + */ +void MortevielleEngine::startDialog(int16 rep) { + const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; + int key; + + assert(rep >= 0); + + _mouse.hideMouse(); + Common::String dialogStr = deline(rep + kDialogStringIndex); + displayStr(dialogStr, 230, 4, 65, 24, 5); + f3f8::draw(); + + key = 0; + do { + _speechManager.startSpeech(rep, haut[g_caff - 69], 0); + key = f3f8::waitForF3F8(); + CHECK_QUIT; + } while (key != 66); + hirs(); + _mouse.showMouse(); +} + +/** + * Engine function - End of Search: reset globals + * @remarks Originally called 'finfouill' + */ +void MortevielleEngine::endSearch() { + _heroSearching = false; + _obpart = false; + g_cs = 0; + g_is = 0; + _menu.unsetSearchMenu(); +} + +/** + * Engine function - Go to Dining room + * @remarks Originally called 't1sama' + */ +void MortevielleEngine::gotoDiningRoom() { + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour < 5) && (g_s._currPlace > ROOM18)) { + if (!checkInventory(137)) { //You don't have the keys, and it's late + g_crep = 1511; + loseGame(); + } else + displayDiningRoom(); + } else if (!g_s._alreadyEnteredManor) { //Is it your first time? + _currBitIndex = 255; // Everybody is present + showPeoplePresent(_currBitIndex); + g_caff = 77; + afdes(); + _screenSurface.drawBox(223, 47, 155, 91, 15); + repon(2, 33); + tkey1(false); + mennor(); + _mouse.hideMouse(); + hirs(); + premtet(); + startDialog(140); + drawRightFrame(); + drawClock(); + _mouse.showMouse(); + g_s._currPlace = OWN_ROOM; + affrep(); + resetPresenceInRooms(DINING_ROOM); + if (!_blo) + minute = t11(OWN_ROOM); + _currBitIndex = 0; + g_mpers = 0; + g_s._alreadyEnteredManor = true; + } else + displayDiningRoom(); +} + +/** + * Engine function - Check Manor distance (in the mountains) + * @remarks Originally called 't1neig' + */ +void MortevielleEngine::checkManorDistance() { + ++_manorDistance; + if (_manorDistance > 2) { + g_crep = 1506; + loseGame(); + } else { + _okdes = true; + g_s._currPlace = MOUNTAIN; + affrep(); + } +} + +/** + * Engine function - Go to Manor front + * @remarks Originally called 't1deva' + */ +void MortevielleEngine::gotoManorFront() { + _manorDistance = 0; + g_s._currPlace = MANOR_FRONT; + affrep(); +} + +/** + * Engine function - Go to Manor back + * @remarks Originally called 't1derr' + */ +void MortevielleEngine::gotoManorBack() { + g_s._currPlace = MANOR_BACK; + affrep(); +} + +/** + * Engine function - Dead : Flooded in Well + * @remarks Originally called 't1deau' + */ +void MortevielleEngine::floodedInWell() { + g_crep = 1503; + loseGame(); +} + +/** + * Engine function - Change Graphical Device + * @remarks Originally called 'change_gd' + */ +void MortevielleEngine::changeGraphicalDevice(int newDevice) { + _mouse.hideMouse(); + _currGraphicalDevice = newDevice; + hirs(); + _mouse.initMouse(); + _mouse.showMouse(); + drawRightFrame(); + tinke(); + drawClock(); + if (_currBitIndex != 0) + showPeoplePresent(_currBitIndex); + else + displayAloneText(); + clearScreenType2(); + clearScreenType3(); + g_maff = 68; + afdes(); + repon(2, g_crep); + _menu.displayMenu(); +} + +/** + * Called when a savegame has been loaded. + * @remarks Originally called 'antegame' + */ +void MortevielleEngine::gameLoaded() { + _mouse.hideMouse(); + _menu._menuDisplayed = false; + _loseGame = true; + _anyone = false; + _okdes = true; + _col = false; + _hiddenHero = false; + _brt = false; + g_maff = 68; + g_mnumo = OPCODE_NONE; + g_prebru = 0; + g_x = 0; + g_y = 0; + g_num = 0; + g_hdb = 0; + g_hfb = 0; + g_cs = 0; + g_is = 0; + g_ment = 0; + _syn = true; + _heroSearching = true; + g_mchai = 0; + _manorDistance = 0; + initouv(); + g_iouv = 0; + g_dobj = 0; + affrep(); + _hintPctMessage = deline(580); + + _okdes = false; + _endGame = true; + _loseGame = false; + _heroSearching = false; + + displayAloneText(); + tinke(); + drawClock(); + afdes(); + repon(2, g_crep); + clearScreenType3(); + _endGame = false; + _menu.setDestinationMenuText(g_s._currPlace); + modinv(); + if (g_s._selectedObjectId != 0) + modobj(g_s._selectedObjectId + 400); + _mouse.showMouse(); +} + +/** + * Engine function - Handle OpCodes + * @remarks Originally called 'tsitu' + */ +void MortevielleEngine::handleOpcode() { + if (!_col) + clearScreenType2(); + _syn = false; + _keyPressedEsc = false; + if (!_anyone) { + if (_brt) { + if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { + g_ctrm = 4; + mennor(); + return; + } + } + if (g_msg[3] == MENU_MOVE) + fctMove(); + if (g_msg[3] == MENU_DISCUSS) + fctDiscuss(); + if (g_msg[3] == MENU_INVENTORY) + fctInventoryTake(); + if (g_msg[4] == OPCODE_ATTACH) + fctAttach(); + if (g_msg[4] == OPCODE_WAIT) + fctWait(); + if (g_msg[4] == OPCODE_FORCE) + fctForce(); + if (g_msg[4] == OPCODE_SLEEP) + fctSleep(); + if (g_msg[4] == OPCODE_LISTEN) + fctListen(); + if (g_msg[4] == OPCODE_ENTER) + fctEnter(); + if (g_msg[4] == OPCODE_CLOSE) + fctClose(); + if (g_msg[4] == OPCODE_SEARCH) + fctSearch(); + if (g_msg[4] == OPCODE_KNOCK) + fctKnock(); + if (g_msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (g_msg[4] == OPCODE_READ) + fctRead(); + if (g_msg[4] == OPCODE_EAT) + fctEat(); + if (g_msg[4] == OPCODE_PLACE) + fctPlace(); + if (g_msg[4] == OPCODE_OPEN) + fctOpen(); + if (g_msg[4] == OPCODE_TAKE) + fctTake(); + if (g_msg[4] == OPCODE_LOOK) + fctLook(); + if (g_msg[4] == OPCODE_SMELL) + fctSmell(); + if (g_msg[4] == OPCODE_SOUND) + fctSound(); + if (g_msg[4] == OPCODE_LEAVE) + fctLeave(); + if (g_msg[4] == OPCODE_LIFT) + fctLift(); + if (g_msg[4] == OPCODE_TURN) + fctTurn(); + if (g_msg[4] == OPCODE_SSEARCH) + fctSelfSearch(); + if (g_msg[4] == OPCODE_SREAD) + fctSelfRead(); + if (g_msg[4] == OPCODE_SPUT) + fctSelfPut(); + if (g_msg[4] == OPCODE_SLOOK) + fctSelftLook(); + _hiddenHero = false; + + if (g_msg[4] == OPCODE_SHIDE) + fctSelfHide(); + } else { + if (_anyone) { + quelquun(); + _anyone = false; + mennor(); + return; + } + } + int hour, day, minute; + updateHour(day, hour, minute); + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || + ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) + ++g_s._faithScore; + if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL) + && (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) { + if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { + g_crep = 1501; + loseGame(); + } + if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { + g_crep = 1508; + loseGame(); + } + if ((day > 1) && (hour > 8) && (!_loseGame)) { + g_crep = 1502; + loseGame(); + } + } + mennor(); +} + +/** + * Engine function - Transform time into a char + * @remarks Originally called 'tmaj3' + */ +void MortevielleEngine::hourToChar() { + int day, hour, minute; + + g_vm->updateHour(day, hour, minute); + if (minute == 30) + minute = 1; + hour += day * 24; + minute += hour * 2; + g_s._fullHour = chr(minute); +} + +/** + * Engine function - extract time from a char + * @remarks Originally called 'theure' + */ +void MortevielleEngine::charToHour() { + int fullHour = ord(g_s._fullHour); + int tmpHour = fullHour % 48; + g_vm->_currDay = fullHour / 48; + g_vm->_currHalfHour = tmpHour % 2; + g_vm->_currHour = tmpHour / 2; + g_vm->_hour = g_vm->_currHour; + if (g_vm->_currHalfHour == 1) + g_vm->_minute = 30; + else + g_vm->_minute = 0; +} + +/** + * Engine function - Clear Screen - Type 1 + * @remarks Originally called 'clsf1' + */ +void MortevielleEngine::clearScreenType1() { + g_vm->_mouse.hideMouse(); + g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); + g_vm->_mouse.showMouse(); +} + +/** + * Engine function - Clear Screen - Type 2 + * @remarks Originally called 'clsf2' + */ +void MortevielleEngine::clearScreenType2() { + g_vm->_mouse.hideMouse(); + if (g_vm->_largestClearScreen) { + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); + g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); + g_vm->_largestClearScreen = false; + } else { + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); + g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); + } + g_vm->_mouse.showMouse(); +} + +/** + * Engine function - Clear Screen - Type 3 + * @remarks Originally called 'clsf3' + */ +void MortevielleEngine::clearScreenType3() { + g_vm->_mouse.hideMouse(); + g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); + g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); + g_vm->_mouse.showMouse(); +} + +/** + * Engine function - Clear Screen - Type 10 + * @remarks Originally called 'clsf10' + */ +void MortevielleEngine::clearScreenType10() { + int co, cod; + Common::String st; + + g_vm->_mouse.hideMouse(); + if (g_res == 1) { + co = 634; + cod = 534; + } else { + co = 600; + cod = 544; + } + g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); + if (g_s._faithScore < 33) + st = g_vm->getEngineString(S_COOL); + else if (g_s._faithScore < 66) + st = g_vm->getEngineString(S_LOURDE); + else if (g_s._faithScore > 65) + st = g_vm->getEngineString(S_MALSAINE); + + co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); + g_vm->_screenSurface.putxy(co, 92); + g_vm->_screenSurface.drawString(st, 4); + + g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); + /* rempli(69,12,32,5,255);*/ + g_vm->_mouse.showMouse(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index aeaf5e27d1..477415b317 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -34,6 +34,7 @@ #include "graphics/surface.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" +#include "mortevielle/mouse.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" #include "mortevielle/speech.h" @@ -168,6 +169,7 @@ public: SavegameManager _savegameManager; SpeechManager _speechManager; Menu _menu; + MouseHandler _mouse; bool _quitGame; // Quit game flag. Originally called 'arret' bool _endGame; // End game flag. Originally called 'solu' @@ -289,6 +291,14 @@ public: void hourToChar(); void changeGraphicalDevice(int newDevice); + void startDialog(int16 rep); + void endSearch(); + int convertCharacterIndexToBitIndex(int characterIndex); + int convertBitIndexToCharacterIndex(int bitIndex); + void clearScreenType1(); + void clearScreenType2(); + void clearScreenType3(); + void clearScreenType10(); }; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 401a2b3f7b..c5f0e21802 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -36,21 +36,11 @@ namespace Mortevielle { const int m_arrow = 0; const int m_point_hand = 1; -bool int_m, clic; - -int m_show, - x_s, - y_s, - p_o_s, - mouse_shwn; - -int s_s[12][6]; - /** * Initialize the mouse * @remarks Originally called 'init_mouse' */ -void initMouse() { +void MouseHandler::initMouse() { registres reg; mouse_shwn = 0; @@ -81,7 +71,7 @@ void initMouse() { * Hide the mouse * @remarks Originally called 'hide_mouse' */ -void hideMouse() { +void MouseHandler::hideMouse() { --mouse_shwn; if (mouse_shwn == 0) { bool imp = odd(y_s); @@ -173,7 +163,7 @@ void hideMouse() { * Show mouse * @remarks Originally called 'show_mouse' */ -void showMouse() { +void MouseHandler::showMouse() { int k, l; mouse_shwn = mouse_shwn + 1; @@ -258,7 +248,7 @@ void showMouse() { * Set mouse position * @remarks Originally called 'pos_mouse' */ -void setMousePos(int x, int y) { +void MouseHandler::setMousePos(int x, int y) { if (x > 314 * g_res) x = 314 * g_res; else if (x < 0) @@ -278,7 +268,7 @@ void setMousePos(int x, int y) { * Get mouse poisition * @remarks Originally called 'read_pos_mouse' */ -void getMousePos_(int &x, int &y, int &c) { +void MouseHandler::getMousePos_(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; c = g_vm->getMouseClick() ? 1 : 0; @@ -288,7 +278,7 @@ void getMousePos_(int &x, int &y, int &c) { * Move mouse * @remarks Originally called 'mov_mouse' */ -void moveMouse(bool &funct, char &key) { +void MouseHandler::moveMouse(bool &funct, char &key) { bool p_key; char in1, in2; int cx, cy, cd; @@ -443,4 +433,18 @@ void moveMouse(bool &funct, char &key) { } } +/** + * Engine function : Is mouse in a given rect? + * @remarks Originally called 'dans_rect' + */ +bool MouseHandler::isMouseIn(rectangle r) { + int x, y, c; + + getMousePos_(x, y, c); + if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) + return true; + + return false; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 532644a255..e9cc8af7c0 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -28,24 +28,30 @@ #ifndef MORTEVIELLE_MOUSE_H #define MORTEVIELLE_MOUSE_H +#include "mortevielle/var_mor.h" + namespace Mortevielle { -extern bool int_m; - -extern int m_show, - x_s, - y_s, - p_o_s, - mouse_shwn; - -void initMouse(); -//extern void change_mouse(int t); -//extern void dessine_souris(int xf, int yf); -extern void hideMouse(); -extern void showMouse(); -extern void setMousePos(int x, int y); -extern void getMousePos_(int &x, int &y, int &c); -extern void moveMouse(bool &funct, char &key); +class MouseHandler { +protected: + int s_s[12][6]; +public: + bool int_m; + + int m_show; + int x_s; + int y_s; + int p_o_s; + int mouse_shwn; + + void initMouse(); + void hideMouse(); + void showMouse(); + void setMousePos(int x, int y); + void getMousePos_(int &x, int &y, int &c); + void moveMouse(bool &funct, char &key); + bool isMouseIn(rectangle r); +}; } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index c93107cc13..1947e3d860 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -351,7 +351,7 @@ void taffich() { } g_vm->_okdes = true; - hideMouse(); + g_vm->_mouse.hideMouse(); lgt = 0; Common::String filename; @@ -450,7 +450,7 @@ void taffich() { } charani(filename, lgt, handle); } - showMouse(); + g_vm->_mouse.showMouse(); if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 9b0f72c8e0..1ac883f53e 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -134,7 +134,7 @@ void chartex() { void dialpre() { /* debug('o3 dialpre'); */ g_crep = 998; - int_m = true; + g_vm->_mouse.int_m = true; } void music() { diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index d054308cf3..9458da38bc 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -119,7 +119,7 @@ void SavegameManager::loadSavegame(int n) { * Load a saved game */ Common::Error SavegameManager::loadGame(int n) { - hideMouse(); + g_vm->_mouse.hideMouse(); maivid(); loadSavegame(n); @@ -127,7 +127,7 @@ Common::Error SavegameManager::loadGame(int n) { g_vm->charToHour(); g_vm->initGame(); g_vm->gameLoaded(); - showMouse(); + g_vm->_mouse.showMouse(); return Common::kNoError; } @@ -138,7 +138,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { Common::OutSaveFile *f; int i; - hideMouse(); + g_vm->_mouse.hideMouse(); g_vm->hourToChar(); for (i = 0; i <= 389; ++i) @@ -167,7 +167,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { // Skipped: dialog asking to swap floppy - showMouse(); + g_vm->_mouse.showMouse(); return Common::kNoError; } -- cgit v1.2.3 From 2df7ebf1609d033628423870fba2217c855e75f3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 Mar 2012 07:05:25 +0100 Subject: MORTEVIELLE: Refactor mouse class --- engines/mortevielle/dialogs.cpp | 24 ++++----- engines/mortevielle/menu.cpp | 45 ++++++++-------- engines/mortevielle/menu.h | 3 +- engines/mortevielle/mor.cpp | 8 +-- engines/mortevielle/mortevielle.cpp | 6 +-- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/mouse.cpp | 105 +++++++++++++++--------------------- engines/mortevielle/mouse.h | 14 ++--- engines/mortevielle/ovd1.cpp | 1 - engines/mortevielle/var_mor.cpp | 6 --- engines/mortevielle/var_mor.h | 7 --- 11 files changed, 90 insertions(+), 131 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f1faee0daa..68d2852100 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -45,7 +45,8 @@ int Alert::show(const Common::String &msg, int n) { Common::String st, chaine; int limit[3][3]; Common::String s[3]; - int cx, cy, nbcol, lignNumb; + Common::Point curPos; + int nbcol, lignNumb; bool newaff, test, test1, test2, test3, dum; Common::String cas; @@ -70,17 +71,17 @@ int Alert::show(const Common::String &msg, int n) { i = 0; g_vm->_screenSurface._textPos.y = 70; do { - cx = 320; + curPos.x = 320; st = ""; while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { ++i; st = st + chaine[i]; if (g_res == 2) - cx -= 3; + curPos.x -= 3; else - cx -= 5; + curPos.x -= 5; } - g_vm->_screenSurface.putxy(cx, g_vm->_screenSurface._textPos.y); + g_vm->_screenSurface.putxy(curPos.x, g_vm->_screenSurface._textPos.y); g_vm->_screenSurface._textPos.y += 6; g_vm->_screenSurface.drawString(st, 4); ++i; @@ -108,15 +109,14 @@ int Alert::show(const Common::String &msg, int n) { g_vm->_mouse.moveMouse(dum, dummyKey); CHECK_QUIT0; - cx = g_vm->_mouse.x_s; - cy = g_vm->_mouse.y_s; - test = (cy > 95) && (cy < 105); + curPos = g_vm->_mouse._pos; + test = (curPos.y > 95) && (curPos.y < 105); newaff = false; if (test) { - test1 = (cx > limit[1][1]) && (cx < limit[1][2]); + test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); test2 = test1; if (caseNumb > 1) - test2 = test1 || ((cx > limit[2][1]) && (cx < limit[2][2])); + test2 = test1 || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2])); if (test2) { newaff = true; if (test1) @@ -157,8 +157,8 @@ int Alert::show(const Common::String &msg, int n) { quoi = 0; g_vm->_mouse.showMouse(); } - test3 = (cy > 95) && (cy < 105) && (((cx > limit[1][1]) && (cx < limit[1][2])) - || ((cx > limit[2][1]) && (cx < limit[2][2]))); + test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2])) + || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2]))); } while (!g_vm->getMouseClick()); g_vm->setMouseClick(false); g_vm->_mouse.hideMouse(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 3f5db6de9a..e4f3702a7b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -270,7 +270,7 @@ void Menu::invers(int ix) { g_msg4 = OPCODE_NONE; } -void Menu::util(int x, int y) { +void Menu::util(Common::Point pos) { int ymx = (g_menuConstants[g_msg3 - 1][3] << 3) + 16; int dxcar = g_menuConstants[g_msg3 - 1][2]; @@ -282,8 +282,8 @@ void Menu::util(int x, int y) { else ix = 3; int xmx = dxcar * ix * g_res + xmn + 2; - if ((x > xmn) && (x < xmx) && (y < ymx) && (y > 15)) { - ix = (((uint)y >> 3) - 1) + (g_msg3 << 8); + if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { + ix = (((uint)pos.y >> 3) - 1) + (g_msg3 << 8); if (ix != g_msg4) { invers(1); g_msg4 = ix; @@ -417,35 +417,32 @@ void Menu::mdn() { if (!_menuActive) return; - int x = g_vm->_mouse.x_s; - int y = g_vm->_mouse.y_s; + Common::Point curPos = g_vm->_mouse._pos; if (!g_vm->getMouseClick()) { - if ((x == g_xprec) && (y == g_yprec)) + if (curPos == g_vm->_prevPos) return; - else { - g_xprec = x; - g_yprec = y; - } + else + g_vm->_prevPos = curPos; - bool tes = (y < 11) - && ((x >= (28 * g_res) && x <= (28 * g_res + 24)) - || (x >= (76 * g_res) && x <= (76 * g_res + 24)) - || ((x > 124 * g_res) && (x < 124 * g_res + 24)) - || ((x > 172 * g_res) && (x < 172 * g_res + 24)) - || ((x > 220 * g_res) && (x < 220 * g_res + 24)) - || ((x > 268 * g_res) && (x < 268 * g_res + 24))); + bool tes = (curPos.y < 11) + && ((curPos.x >= (28 * g_res) && curPos.x <= (28 * g_res + 24)) + || (curPos.x >= (76 * g_res) && curPos.x <= (76 * g_res + 24)) + || ((curPos.x > 124 * g_res) && (curPos.x < 124 * g_res + 24)) + || ((curPos.x > 172 * g_res) && (curPos.x < 172 * g_res + 24)) + || ((curPos.x > 220 * g_res) && (curPos.x < 220 * g_res + 24)) + || ((curPos.x > 268 * g_res) && (curPos.x < 268 * g_res + 24))); if (tes) { int ix; - if (x < 76 * g_res) + if (curPos.x < 76 * g_res) ix = MENU_INVENTORY; - else if (x < 124 * g_res) + else if (curPos.x < 124 * g_res) ix = MENU_MOVE; - else if (x < 172 * g_res) + else if (curPos.x < 172 * g_res) ix = MENU_ACTION; - else if (x < 220 * g_res) + else if (curPos.x < 220 * g_res) ix = MENU_SELF; - else if (x < 268 * g_res) + else if (curPos.x < 268 * g_res) ix = MENU_DISCUSS; else ix = MENU_FILE; @@ -458,8 +455,8 @@ void Menu::mdn() { g_msg4 = OPCODE_NONE; } } else { // Not in the MenuTitle line - if ((y > 11) && (_multiTitle)) - util(x, y); + if ((curPos.y > 11) && (_multiTitle)) + util(curPos); } } else { // There was a click if ((g_msg3 == MENU_FILE) && (g_msg4 != OPCODE_NONE)) { diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index adfe35981e..ccf5bd8954 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -28,13 +28,14 @@ #ifndef MORTEVIELLE_MENU_H #define MORTEVIELLE_MENU_H +#include "common/rect.h" #include "common/str.h" namespace Mortevielle { class Menu { private: - void util(int x, int y); + void util(Common::Point pos); void invers(int ix); void menuDown(int ii); public: diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 439d9255e2..041841fcca 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -756,7 +756,7 @@ void tinke() { g_vm->_minute = 30; drawClock(); } - if (g_vm->_mouse.y_s < 12) + if (g_vm->_mouse._pos.y < 12) return; if (!g_vm->_blo) { @@ -1129,7 +1129,7 @@ void tfleche() { CHECK_QUIT; if (g_vm->getMouseClick()) - inRect = (g_vm->_mouse.x_s < 256 * g_res) && (g_vm->_mouse.y_s < 176) && (g_vm->_mouse.y_s > 12); + inRect = (g_vm->_mouse._pos.x < 256 * g_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); tinke(); } while (!(qust || inRect || g_vm->_anyone)); @@ -1141,8 +1141,8 @@ void tfleche() { g_vm->_keyPressedEsc = true; if (inRect) { - g_x = g_vm->_mouse.x_s; - g_y = g_vm->_mouse.y_s; + g_x = g_vm->_mouse._pos.x; + g_y = g_vm->_mouse._pos.y; } } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index f376e57d8d..4a8961f536 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -339,8 +339,8 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - g_vm->_mouse.x_s = event.mouse.x; - g_vm->_mouse.y_s = event.mouse.y / 2; + g_vm->_mouse._pos.x = event.mouse.x; + g_vm->_mouse._pos.y = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseClick = true; @@ -652,7 +652,7 @@ void MortevielleEngine::handleAction() { g_mnumo = g_msg[4]; if (!_anyone) { if ((_heroSearching) || (_obpart)) { - if (g_vm->_mouse.y_s < 12) + if (g_vm->_mouse._pos.y < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 477415b317..e6df67024e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -114,6 +114,7 @@ private: void handleAction(); public: Common::String _hintPctMessage; + Common::Point _prevPos; bool _roomPresenceLuc; bool _roomPresenceIda; @@ -126,7 +127,6 @@ public: bool _toiletsPresenceBobMax; bool _bathRoomPresenceBobMax; bool _room9PresenceLeo; - bool _soundOff; bool _largestClearScreen; bool _hiddenHero; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index c5f0e21802..a898f22bbe 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -33,38 +33,15 @@ namespace Mortevielle { -const int m_arrow = 0; -const int m_point_hand = 1; - /** * Initialize the mouse * @remarks Originally called 'init_mouse' */ void MouseHandler::initMouse() { - registres reg; - - mouse_shwn = 0; - x_s = 0; - y_s = 0; - p_o_s = 0; + _counter = 0; + _pos = Common::Point(0, 0); g_vm->setMouseClick(false); - m_show = m_arrow; - if ((READ_LE_UINT16(&g_mem[0xcc]) == 0) && (READ_LE_UINT16(&g_mem[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); - } - } } /** @@ -72,14 +49,13 @@ void MouseHandler::initMouse() { * @remarks Originally called 'hide_mouse' */ void MouseHandler::hideMouse() { - --mouse_shwn; - if (mouse_shwn == 0) { - bool imp = odd(y_s); - int j = p_o_s; + --_counter; + if (_counter == 0) { + int j = 0; switch (g_vm->_currGraphicalDevice) { case MODE_CGA: { int k = 0; - j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); + j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { WRITE_LE_UINT16(&g_mem[0xb000 * 16 + j], s_s[0][k]); WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j + 2], s_s[1][k]); @@ -90,11 +66,12 @@ void MouseHandler::hideMouse() { } while (k < 5); } break; - case MODE_AMSTRAD1512: + case MODE_AMSTRAD1512: { + bool imp = odd(_pos.y); for (int i = 0; i <= 3; ++i) { g_port[0x3dd] = 1 << i; int k = 0; - j = p_o_s; + j = 0; do { if (imp) { WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j], s_s[i][k]); @@ -108,6 +85,7 @@ void MouseHandler::hideMouse() { } while (k < 8); } break; + } case MODE_EGA: { g_port[0x3c4] = 2; g_port[0x3ce] = 8; @@ -116,7 +94,7 @@ void MouseHandler::hideMouse() { do { g_port[0x3c5] = 1 << i; int k = 0; - j = p_o_s; + j = 0; do { // Useless ? // ps = mem[0xa000 * 16 + j]; @@ -133,7 +111,7 @@ void MouseHandler::hideMouse() { } break; case MODE_HERCULES: - j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); + j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (int i = 0; i <= 5; ++i) { for (int k = 0; k <= 3; ++k) WRITE_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); @@ -141,7 +119,7 @@ void MouseHandler::hideMouse() { } break; case MODE_TANDY: { - j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); + j = ((uint)_pos.y >> 2) * 160 + ((uint)_pos.x >> 1); int k = 0; do { for (int i = 0; i <= 3; ++i) { @@ -166,16 +144,15 @@ void MouseHandler::hideMouse() { void MouseHandler::showMouse() { int k, l; - mouse_shwn = mouse_shwn + 1; - if (mouse_shwn != 1) + ++_counter; + if (_counter != 1) return; - int j = p_o_s; - bool imp = odd(y_s); - int i = x_s & 7; + int j = 0; + int i = _pos.x & 7; switch (g_vm->_currGraphicalDevice) { case MODE_CGA: k = 0; - j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2); + j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { s_s[0][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); s_s[1][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j + 2]); @@ -185,10 +162,11 @@ void MouseHandler::showMouse() { ++k; } while (k < 5); break; - case MODE_AMSTRAD1512: + case MODE_AMSTRAD1512: { + bool imp = odd(_pos.y); for (i = 0; i <= 3; ++i) { - j = p_o_s; - imp = odd(y_s); + j = 0; + imp = odd(_pos.y); g_port[0x3de] = i; k = 0; do { @@ -204,13 +182,14 @@ void MouseHandler::showMouse() { } while (k < 8); } break; + } case MODE_EGA: g_port[0x3ce] = 4; l = 0; do { g_port[0x3cf] = l; k = 0; - j = p_o_s; + j = 0; do { s_s[l][k] = g_mem[0xa000 * 16 + j] + (g_mem[(0xa000 * 16) + j + 1] << 8); j += 80; @@ -220,7 +199,7 @@ void MouseHandler::showMouse() { } while (l != 4); break; case MODE_HERCULES: - j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3); + j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) s_s[i][k] = READ_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j]); @@ -228,7 +207,7 @@ void MouseHandler::showMouse() { } break; case MODE_TANDY: - j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1); + j = ((uint)_pos.y >> 2) * 160 + ((uint)_pos.x >> 1); k = 0; do { for (i = 0; i <= 3; ++i) { @@ -248,20 +227,20 @@ void MouseHandler::showMouse() { * Set mouse position * @remarks Originally called 'pos_mouse' */ -void MouseHandler::setMousePos(int x, int y) { - if (x > 314 * g_res) - x = 314 * g_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)) +void MouseHandler::setMousePos(Common::Point newPos) { + if (newPos.x > 314 * g_res) + newPos.x = 314 * g_res; + else if (newPos.x < 0) + newPos.x = 0; + if (newPos.y > 199) + newPos.y = 199; + else if (newPos.y < 0) + newPos.y = 0; + if (newPos == _pos) return; // Set the new position - g_vm->setMousePos(Common::Point(x, y)); + g_vm->setMousePos(newPos); } /** @@ -300,16 +279,16 @@ void MouseHandler::moveMouse(bool &funct, char &key) { getMousePos_(cx, cy, cd); switch (toupper(in1)) { case '4': - cx = cx - 8; + cx -= 8; break; case '2': - cy = cy + 8; + cy += 8; break; case '6': - cx = cx + 8; + cx += 8; break; case '8': - cy = cy - 8; + cy -= 8; break; case '7': cy = 1; @@ -428,7 +407,7 @@ void MouseHandler::moveMouse(bool &funct, char &key) { break; } - setMousePos(cx, cy); + setMousePos(Common::Point(cx, cy)); p_key = g_vm->keyPressed(); } } diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index e9cc8af7c0..76a9991f44 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -33,21 +33,17 @@ namespace Mortevielle { class MouseHandler { -protected: +private: int s_s[12][6]; -public: - bool int_m; + int _counter; - int m_show; - int x_s; - int y_s; - int p_o_s; - int mouse_shwn; +public: + Common::Point _pos; void initMouse(); void hideMouse(); void showMouse(); - void setMousePos(int x, int y); + void setMousePos(Common::Point newPos); void getMousePos_(int &x, int &y, int &c); void moveMouse(bool &funct, char &key); bool isMouseIn(rectangle r); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 1ac883f53e..2f86437b3f 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -134,7 +134,6 @@ void chartex() { void dialpre() { /* debug('o3 dialpre'); */ g_crep = 998; - g_vm->_mouse.int_m = true; } void music() { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 495487c33e..f4a5d12955 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -105,8 +105,6 @@ int g_x, g_menup, g_mpers, g_mnumo, - g_xprec, - g_yprec, g_perdep, g_prebru, g_numpal, @@ -176,10 +174,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) { int g_port[0xfff]; byte g_mem[65536 * 16]; -void intr(int intNum, registres ®s) { - warning("STUBBED: Call to DOS interrupt #%d", intNum); -} - /** * Engine function - Get a random number between two values * @remarks Originally called 'get_random_number' and 'hazard' diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 19bde4088e..d71c0d7668 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -131,10 +131,6 @@ struct sav_chaine { byte _fullHour; }; -struct registres { - int _ax, _bx, _cx, _dx, _bp, _si, _di, _ds, _es, _flags; -}; - struct ind { int _indis; byte _point; @@ -210,8 +206,6 @@ extern int g_x, g_menup, g_mpers, g_mnumo, - g_xprec, - g_yprec, g_perdep, g_prebru, g_numpal, @@ -264,7 +258,6 @@ extern byte g_mem[65536 * 16]; #define hires {} extern void palette(int v1); -extern void intr(int intNum, registres ®s); extern int getRandomNumber(int minval, int maxval); extern void s_char(int Gd, int y, int dy); -- cgit v1.2.3 From 471b085febc04c4afae1a2667def82ce588fafc0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 Mar 2012 07:50:23 +0100 Subject: MORTEVIELLE: Fix regression --- engines/mortevielle/actions.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 7949d93b38..86c03b41d1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -70,9 +70,12 @@ void MortevielleEngine::fctMove() { } else if (g_num == 7) { g_s._currPlace = ATTIC; _menu.setDestinationMenuText(ATTIC); - } else if (g_num != 6) + } + + if (g_num != 6) g_s._currPlace = ROOM26; - else if ((g_num > 1) && (g_num < 6)) + + if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; else if (g_num > 7) g_ment = g_num - 3; -- cgit v1.2.3 From d09561e0c48486a6fcf68febd514e6c2dd63ce92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 Mar 2012 22:52:59 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 6 +- engines/mortevielle/menu.cpp | 87 ++++++++------ engines/mortevielle/menu.h | 12 +- engines/mortevielle/mor.cpp | 44 +++---- engines/mortevielle/mor.h | 1 - engines/mortevielle/mortevielle.cpp | 92 +++++++++------ engines/mortevielle/mortevielle.h | 3 + engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/ovd1.cpp | 4 +- engines/mortevielle/speech.cpp | 222 ++++++++++++++++++------------------ engines/mortevielle/speech.h | 2 + engines/mortevielle/var_mor.cpp | 44 +------ engines/mortevielle/var_mor.h | 74 ++++++------ 13 files changed, 285 insertions(+), 308 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 86c03b41d1..a4255fd598 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -83,7 +83,7 @@ void MortevielleEngine::fctMove() { if (g_num != 6) affrep(); else - aldepl(); + showMoveMenuAlert(); return; } tsort(); @@ -598,7 +598,7 @@ void MortevielleEngine::fctOpen() { } if (g_caff == 15) { - aldepl(); + showMoveMenuAlert(); return; } @@ -1132,7 +1132,7 @@ void MortevielleEngine::fctEnter() { gotoDiningRoom(); _menu.setDestinationMenuText(g_s._currPlace); } else if (g_s._currPlace == LANDING) - aldepl(); + showMoveMenuAlert(); else if (g_ment == 0) g_crep = 997; else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index e4f3702a7b..6cf09be3c8 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -38,7 +38,16 @@ namespace Mortevielle { -/* NIVEAU 14*/ +const byte _menuConstants[8][4] = { + { 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} +}; /** * Setup a menu's contents @@ -219,62 +228,66 @@ void Menu::drawMenu() { _multiTitle = false; } -void Menu::invers(int ix) { - Common::String s; - +/** + * Menu function - Invert a menu entry + * @remarks Originally called 'invers' + */ +void Menu::invert(int indx) { if (g_msg4 == OPCODE_NONE) return; int menuIndex = lo(g_msg4); - g_vm->_screenSurface.putxy(g_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + g_vm->_screenSurface.putxy(_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + + Common::String str; switch (g_msg3) { case 1: - s = _inventoryStringArray[menuIndex]; + str = _inventoryStringArray[menuIndex]; break; case 2: - s = _moveStringArray[menuIndex]; + str = _moveStringArray[menuIndex]; break; case 3: - s = _actionStringArray[menuIndex]; + str = _actionStringArray[menuIndex]; break; case 4: - s = _selfStringArray[menuIndex]; + str = _selfStringArray[menuIndex]; break; case 5: - s = _discussStringArray[menuIndex]; + str = _discussStringArray[menuIndex]; break; case 6: - s = g_vm->getEngineString(S_SAVE_LOAD + menuIndex); + str = g_vm->getEngineString(S_SAVE_LOAD + menuIndex); break; case 7: - s = g_vm->getEngineString(S_SAVE_LOAD + 1); - s += ' '; - s += (char)(48 + menuIndex); + str = g_vm->getEngineString(S_SAVE_LOAD + 1); + str += ' '; + str += (char)(48 + menuIndex); break; case 8: if (menuIndex == 1) { - s = g_vm->getEngineString(S_RESTART); + str = g_vm->getEngineString(S_RESTART); } else { - s = g_vm->getEngineString(S_SAVE_LOAD + 2); - s += ' '; - s += (char)(47 + menuIndex); + str = g_vm->getEngineString(S_SAVE_LOAD + 2); + str += ' '; + str += (char)(47 + menuIndex); } break; default: break; } - if ((s[0] != '*') && (s[0] != '<')) - g_vm->_screenSurface.drawString(s, ix); + if ((str[0] != '*') && (str[0] != '<')) + g_vm->_screenSurface.drawString(str, indx); else g_msg4 = OPCODE_NONE; } void Menu::util(Common::Point pos) { - int ymx = (g_menuConstants[g_msg3 - 1][3] << 3) + 16; - int dxcar = g_menuConstants[g_msg3 - 1][2]; - int xmn = (g_menuConstants[g_msg3 - 1][0] << 2) * g_res; + int ymx = (_menuConstants[g_msg3 - 1][3] << 3) + 16; + int dxcar = _menuConstants[g_msg3 - 1][2]; + int xmn = (_menuConstants[g_msg3 - 1][0] << 2) * g_res; int ix; if (g_res == 1) @@ -285,12 +298,12 @@ void Menu::util(Common::Point pos) { if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { ix = (((uint)pos.y >> 3) - 1) + (g_msg3 << 8); if (ix != g_msg4) { - invers(1); + invert(1); g_msg4 = ix; - invers(0); + invert(0); } } else if (g_msg4 != OPCODE_NONE) { - invers(1); + invert(1); g_msg4 = OPCODE_NONE; } } @@ -299,8 +312,8 @@ void Menu::util(Common::Point pos) { * Draw a menu */ void Menu::menuDown(int ii) { - int cx, xcc; - int xco, nb_lig; + int cx, xcc, xco; + int lignNumb; /* debug('menuDown'); */ @@ -308,23 +321,23 @@ void Menu::menuDown(int ii) { g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); // Draw the menu - xco = g_menuConstants[ii - 1][0]; - nb_lig = g_menuConstants[ii - 1][3]; + xco = _menuConstants[ii - 1][0]; + lignNumb = _menuConstants[ii - 1][3]; g_vm->_mouse.hideMouse(); - sauvecr(10, (g_menuConstants[ii - 1][1] + 1) << 1); + sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (g_res == 1) cx = 10; else cx = 6; - xcc = xco + (g_menuConstants[ii - 1][2] * cx) + 6; + xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6; if ((ii == 4) && (g_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version xcc = 435; - g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (g_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (g_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (g_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (g_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); + g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); g_vm->_screenSurface.putxy(xco, 16); cx = 0; do { @@ -374,7 +387,7 @@ void Menu::menuDown(int ii) { break; } g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); - } while (cx != nb_lig); + } while (cx != lignNumb); _multiTitle = true; g_vm->_mouse.showMouse(); } @@ -384,7 +397,7 @@ void Menu::menuDown(int ii) { */ void Menu::menuUp(int xx) { if (_multiTitle) { - charecr(10, (g_menuConstants[xx - 1][1] + 1) << 1); + charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index ccf5bd8954..7f224a3ee5 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -33,10 +33,15 @@ namespace Mortevielle { +enum { + MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4, + MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8 +}; + class Menu { private: void util(Common::Point pos); - void invers(int ix); + void invert(int indx); void menuDown(int ii); public: bool _menuActive; @@ -67,10 +72,5 @@ public: void unsetSearchMenu(); }; -enum { - MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4, - MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8 -}; - } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 041841fcca..4ba68c3778 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -109,18 +109,6 @@ void pictout(int seg, int dep, int x, int y) { g_vm->_screenSurface.drawPicture(surface, x, y); } -void sauvecr(int y, int dy) { - g_vm->_mouse.hideMouse(); - s_sauv(g_vm->_currGraphicalDevice, y, dy); - g_vm->_mouse.showMouse(); -} - -void charecr(int y, int dy) { - g_vm->_mouse.hideMouse(); - s_char(g_vm->_currGraphicalDevice, y, dy); - g_vm->_mouse.showMouse(); -} - void adzon() { Common::File f; @@ -363,7 +351,7 @@ void repon(int f, int m) { } int chlm() { - int retval = getRandomNumber(1, 2); + int retval = g_vm->getRandomNumber(1, 2); if (retval == 2) retval = 128; @@ -459,13 +447,13 @@ void ecfren(int &p, int &rand, int cf, int roomId) { p = -400; if (p != -500) { p += cf; - rand = getRandomNumber(1, 100); + rand = g_vm->getRandomNumber(1, 100); } } void becfren(int roomId) { if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { - int rand = getRandomNumber(1, 2); + int rand = g_vm->getRandomNumber(1, 2); if (roomId == GREEN_ROOM) { if (rand == 1) g_vm->_roomPresenceLuc = true; @@ -503,7 +491,7 @@ void init_nbrepm() { void phaz(int &rand, int &p, int cf) { p += cf; - rand = getRandomNumber(1, 100); + rand = g_vm->getRandomNumber(1, 100); } /** @@ -522,7 +510,7 @@ void resetVariables() { g_s._secretPassageObjectId = 0; g_s._purpleRoomObjectId = 136; g_s._cryptObjectId = 141; - g_s._faithScore = getRandomNumber(4, 10); + g_s._faithScore = g_vm->getRandomNumber(4, 10); g_s._currPlace = MANOR_FRONT; for (int i = 2; i <= 6; ++i) @@ -591,7 +579,7 @@ int t11(int roomId) { else if (roomId == CHAPEL) p = g_vm->getPresenceStatsChapel(h); p += g_s._faithScore; - rand = getRandomNumber(1, 100); + rand = g_vm->getRandomNumber(1, 100); if (rand > p) { g_vm->displayAloneText(); retVal = 0; @@ -621,7 +609,7 @@ void cavegre() { g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); - int rand = (getRandomNumber(0, 4)) - 2; + int rand = (g_vm->getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(2, rand, 1); // The original was doing here a useless loop. @@ -827,11 +815,11 @@ void tinke() { if (!g_vm->_brt) { g_vm->_brt = true; g_hdb = readclock(); - if (getRandomNumber(1, 5) < 5) { + if (g_vm->getRandomNumber(1, 5) < 5) { g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - int rand = (getRandomNumber(0, 4)) - 2; + int rand = (g_vm->getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(1, rand, 1); g_vm->clearScreenType3(); } @@ -1067,13 +1055,13 @@ L1: g_vm->_syn = true; g_vm->_col = true; } else { - if (getRandomNumber(1, 3) == 2) { + if (g_vm->getRandomNumber(1, 3) == 2) { g_vm->_hiddenHero = false; g_crep = 137; goto L1; } else { repon(2, 136); - int rand = (getRandomNumber(0, 4)) - 2; + int rand = (g_vm->getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(3, rand, 1); g_vm->clearScreenType2(); g_vm->displayAloneText(); @@ -1287,8 +1275,14 @@ void st13(int ob) { g_crep = 105; } -void aldepl() { - Alert::show(g_vm->getEngineString(S_USE_DEP_MENU), 1); +void sauvecr(int y, int dy) { +// g_vm->_mouse.hideMouse(); +// g_vm->_mouse.showMouse(); +} + +void charecr(int y, int dy) { +// g_vm->_mouse.hideMouse(); +// g_vm->_mouse.showMouse(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 0cd467c177..d3defc1b04 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -114,7 +114,6 @@ extern void rechai(int &ch); extern int t23coul(); extern void maivid(); extern void st13(int ob); -extern void aldepl(); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4a8961f536..9b7ade1967 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -339,8 +339,8 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - g_vm->_mouse._pos.x = event.mouse.x; - g_vm->_mouse._pos.y = event.mouse.y / 2; + _mouse._pos.x = event.mouse.x; + _mouse._pos.y = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseClick = true; @@ -550,7 +550,7 @@ void MortevielleEngine::mainGame() { initGame(); hirs(); drawRightFrame(); - g_vm->_mouse.showMouse(); + _mouse.showMouse(); // Loop to play the game do { @@ -603,7 +603,7 @@ void MortevielleEngine::handleAction() { do { _menu.mdn(); tinke(); - g_vm->_mouse.moveMouse(funct, inkey); + _mouse.moveMouse(funct, inkey); CHECK_QUIT; temps = temps + 1; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); @@ -652,7 +652,7 @@ void MortevielleEngine::handleAction() { g_mnumo = g_msg[4]; if (!_anyone) { if ((_heroSearching) || (_obpart)) { - if (g_vm->_mouse._pos.y < 12) + if (_mouse._pos.y < 12) return; if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { @@ -1989,7 +1989,7 @@ void MortevielleEngine::handleOpcode() { void MortevielleEngine::hourToChar() { int day, hour, minute; - g_vm->updateHour(day, hour, minute); + updateHour(day, hour, minute); if (minute == 30) minute = 1; hour += day * 24; @@ -2004,14 +2004,14 @@ void MortevielleEngine::hourToChar() { void MortevielleEngine::charToHour() { int fullHour = ord(g_s._fullHour); int tmpHour = fullHour % 48; - g_vm->_currDay = fullHour / 48; - g_vm->_currHalfHour = tmpHour % 2; - g_vm->_currHour = tmpHour / 2; - g_vm->_hour = g_vm->_currHour; - if (g_vm->_currHalfHour == 1) - g_vm->_minute = 30; + _currDay = fullHour / 48; + _currHalfHour = tmpHour % 2; + _currHour = tmpHour / 2; + _hour = _currHour; + if (_currHalfHour == 1) + _minute = 30; else - g_vm->_minute = 0; + _minute = 0; } /** @@ -2019,9 +2019,9 @@ void MortevielleEngine::charToHour() { * @remarks Originally called 'clsf1' */ void MortevielleEngine::clearScreenType1() { - g_vm->_mouse.hideMouse(); - g_vm->_screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - g_vm->_mouse.showMouse(); + _mouse.hideMouse(); + _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); + _mouse.showMouse(); } /** @@ -2029,16 +2029,16 @@ void MortevielleEngine::clearScreenType1() { * @remarks Originally called 'clsf2' */ void MortevielleEngine::clearScreenType2() { - g_vm->_mouse.hideMouse(); - if (g_vm->_largestClearScreen) { - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - g_vm->_screenSurface.drawBox(0, 175, 634, 24, 15); - g_vm->_largestClearScreen = false; + _mouse.hideMouse(); + if (_largestClearScreen) { + _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); + _screenSurface.drawBox(0, 175, 634, 24, 15); + _largestClearScreen = false; } else { - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - g_vm->_screenSurface.drawBox(0, 175, 634, 15, 15); + _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); + _screenSurface.drawBox(0, 175, 634, 15, 15); } - g_vm->_mouse.showMouse(); + _mouse.showMouse(); } /** @@ -2046,10 +2046,10 @@ void MortevielleEngine::clearScreenType2() { * @remarks Originally called 'clsf3' */ void MortevielleEngine::clearScreenType3() { - g_vm->_mouse.hideMouse(); - g_vm->_screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - g_vm->_screenSurface.drawBox(0, 191, 634, 8, 15); - g_vm->_mouse.showMouse(); + _mouse.hideMouse(); + _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); + _screenSurface.drawBox(0, 191, 634, 8, 15); + _mouse.showMouse(); } /** @@ -2060,7 +2060,7 @@ void MortevielleEngine::clearScreenType10() { int co, cod; Common::String st; - g_vm->_mouse.hideMouse(); + _mouse.hideMouse(); if (g_res == 1) { co = 634; cod = 534; @@ -2068,21 +2068,37 @@ void MortevielleEngine::clearScreenType10() { co = 600; cod = 544; } - g_vm->_screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); + _screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); if (g_s._faithScore < 33) - st = g_vm->getEngineString(S_COOL); + st = getEngineString(S_COOL); else if (g_s._faithScore < 66) - st = g_vm->getEngineString(S_LOURDE); + st = getEngineString(S_LOURDE); else if (g_s._faithScore > 65) - st = g_vm->getEngineString(S_MALSAINE); + st = getEngineString(S_MALSAINE); - co = 580 - (g_vm->_screenSurface.getStringWidth(st) / 2); - g_vm->_screenSurface.putxy(co, 92); - g_vm->_screenSurface.drawString(st, 4); + co = 580 - (_screenSurface.getStringWidth(st) / 2); + _screenSurface.putxy(co, 92); + _screenSurface.drawString(st, 4); - g_vm->_screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); + _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); /* rempli(69,12,32,5,255);*/ - g_vm->_mouse.showMouse(); + _mouse.showMouse(); +} + +/** + * Engine function - Get a random number between two values + * @remarks Originally called 'get_random_number' and 'hazard' + */ +int MortevielleEngine::getRandomNumber(int minval, int maxval) { + return _randomSource.getRandomNumber(maxval - minval) + minval; +} + +/** + * Engine function - Show alert "use move menu" + * @remarks Originally called 'aldepl' + */ +void MortevielleEngine::showMoveMenuAlert() { + Alert::show(getEngineString(S_USE_DEP_MENU), 1); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e6df67024e..c2fd857536 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -154,6 +154,7 @@ public: int _day; int _hour; int _minute; + float _addfix; int _c_zzz; @@ -299,6 +300,8 @@ public: void clearScreenType2(); void clearScreenType3(); void clearScreenType10(); + int getRandomNumber(int minval, int maxval); + void showMoveMenuAlert(); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 1947e3d860..a941f79aa1 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -136,7 +136,7 @@ Common::String deline(int num) { } else if (!g_vm->_txxFileFl) { wrkStr = g_vm->getGameString(num); } else { - int i = g_t_rec[num]._indis; + int i = g_t_rec[num]._hintId; byte k = g_t_rec[num]._point; int length = 0; bool endFl = false; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 2f86437b3f..0a93a84516 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -119,7 +119,7 @@ void chartex() { g_vm->_txxFileFl = true; for (int i = 0; i < (ntpFile.size() / 3); ++i) { - g_t_rec[i]._indis = ntpFile.readSint16LE(); + g_t_rec[i]._hintId = ntpFile.readSint16LE(); g_t_rec[i]._point = ntpFile.readByte(); } @@ -151,7 +151,7 @@ void music() { fic.close(); g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); - g_addfix = (float)((kTempoMusic - g_addv[1])) / 256; + g_vm->_addfix = (float)((kTempoMusic - g_addv[1])) / 256; g_vm->_speechManager.cctable(g_tbi); bool fin = false; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index bd589057c3..ba7ef62195 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -41,15 +41,15 @@ SpeechManager::SpeechManager() { } void SpeechManager::spfrac(int wor) { - g_c3._rep = (uint)wor >> 12; - if ((_typlec == 0) && (g_c3._code != 9)) - if (((g_c3._code > 4) && (g_c3._val != 20) && (g_c3._rep != 3) && (g_c3._rep != 6) && (g_c3._rep != 9)) || - ((g_c3._code < 5) && ((g_c3._val != 19) && (g_c3._val != 22) && (g_c3._rep != 4) && (g_c3._rep != 9)))) { - ++g_c3._rep; + _queue[2]._rep = (uint)wor >> 12; + if ((_typlec == 0) && (_queue[2]._code != 9)) + if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || + ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { + ++_queue[2]._rep; } - g_c3._freq = ((uint)wor >> 6) & 7; - g_c3._acc = ((uint)wor >> 9) & 7; + _queue[2]._freq = ((uint)wor >> 6) & 7; + _queue[2]._acc = ((uint)wor >> 9) & 7; } void SpeechManager::charg_car(int &currWordNumb) { @@ -57,31 +57,31 @@ void SpeechManager::charg_car(int &currWordNumb) { int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { - g_c3._val = int_; - g_c3._code = 5; + _queue[2]._val = int_; + _queue[2]._code = 5; } else if ((int_ >= 14) && (int_ <= 21)) { - g_c3._val = int_; - g_c3._code = 6; + _queue[2]._val = int_; + _queue[2]._code = 6; } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; - g_c3._val = int_; - g_c3._code = g_typcon[int_]; + _queue[2]._val = int_; + _queue[2]._code = g_typcon[int_]; } else if ((int_ >= 48) && (int_ <= 56)) { - g_c3._val = int_ - 22; - g_c3._code = 4; + _queue[2]._val = int_ - 22; + _queue[2]._code = 4; } else { switch (int_) { case 60: - g_c3._val = 32; /* " " */ - g_c3._code = 9; + _queue[2]._val = 32; /* " " */ + _queue[2]._code = 9; break; case 61: - g_c3._val = 46; /* "." */ - g_c3._code = 9; + _queue[2]._val = 46; /* "." */ + _queue[2]._code = 9; break; case 62: - g_c3._val = 35; /* "#" */ - g_c3._code = 9; + _queue[2]._val = 35; /* "#" */ + _queue[2]._code = 9; default: break; } @@ -106,7 +106,7 @@ void SpeechManager::cctable(tablint &t) { tb[0] = 0; for (int k = 0; k <= 255; ++k) { - tb[k + 1] = g_addfix + tb[k]; + tb[k + 1] = g_vm->_addfix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } @@ -176,40 +176,40 @@ void SpeechManager::trait_car() { byte d3; int d2, i; - switch (g_c2._code) { + switch (_queue[1]._code) { case 9: - if (g_c2._val != ord('#')) - for (i = 0; i <= g_c2._rep; ++i) - entroct(g_c2._val); + if (_queue[1]._val != ord('#')) + for (i = 0; i <= _queue[1]._rep; ++i) + entroct(_queue[1]._val); break; case 5: case 6: - if (g_c2._code == 6) - d3 = g_tabdph[(g_c2._val - 14) << 1]; + if (_queue[1]._code == 6) + d3 = g_tabdph[(_queue[1]._val - 14) << 1]; else d3 = kNullValue; - if (g_c1._code >= 5) { - veracf(g_c2._acc); - if (g_c1._code == 9) { + if (_queue[0]._code >= 5) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { entroct(4); if (d3 == kNullValue) - entroct(g_c2._val); + entroct(_queue[1]._val); else entroct(d3); entroct(22); } } - switch (g_c2._rep) { + switch (_queue[1]._rep) { case 0: entroct(0); - entroct(g_c2._val); + entroct(_queue[1]._val); if (d3 == kNullValue) - if (g_c3._code == 9) + if (_queue[2]._code == 9) entroct(2); else entroct(4); - else if (g_c3._code == 9) + else if (_queue[2]._code == 9) entroct(0); else entroct(1); @@ -217,13 +217,13 @@ void SpeechManager::trait_car() { case 4: case 5: case 6: - if (g_c2._rep != 4) { - i = g_c2._rep - 5; + if (_queue[1]._rep != 4) { + i = _queue[1]._rep - 5; do { --i; entroct(0); if (d3 == kNullValue) - entroct(g_c2._val); + entroct(_queue[1]._val); else entroct(d3); entroct(3); @@ -231,24 +231,24 @@ void SpeechManager::trait_car() { } if (d3 == kNullValue) { entroct(4); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(0); } else { entroct(0); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(3); } break; case 7: case 8: case 9: - if (g_c2._rep != 7) { - i = g_c2._rep - 8; + if (_queue[1]._rep != 7) { + i = _queue[1]._rep - 8; do { --i; entroct(0); if (d3 == kNullValue) - entroct(g_c2._val); + entroct(_queue[1]._val); else entroct(d3); entroct(3); @@ -256,32 +256,32 @@ void SpeechManager::trait_car() { } if (d3 == kNullValue) { entroct(0); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(2); } else { entroct(0); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(0); } break; case 1: case 2: case 3: - if (g_c2._rep != 1) { - i = g_c2._rep - 2; + if (_queue[1]._rep != 1) { + i = _queue[1]._rep - 2; do { --i; entroct(0); if (d3 == kNullValue) - entroct(g_c2._val); + entroct(_queue[1]._val); else entroct(d3); entroct(3); } while (i >= 0); } entroct(0); - entroct(g_c2._val); - if (g_c3._code == 9) + entroct(_queue[1]._val); + if (_queue[2]._code == 9) entroct(0); else entroct(1); @@ -293,16 +293,16 @@ void SpeechManager::trait_car() { case 2: case 3: - d3 = g_c2._code + 5; // 7 ou 8 => Corresponding vowel - if (g_c1._code > 4) { - veracf(g_c2._acc); - if (g_c1._code == 9) { + d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel + if (_queue[0]._code > 4) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { entroct(4); entroct(d3); entroct(22); } } - i = g_c2._rep; + i = _queue[1]._rep; assert(i >= 0); if (i != 0) { do { @@ -312,24 +312,24 @@ void SpeechManager::trait_car() { entroct(3); } while (i > 0); } - veracf(g_c3._acc); - if (g_c3._code == 6) { + veracf(_queue[2]._acc); + if (_queue[2]._code == 6) { entroct(4); - entroct(g_tabdph[(g_c3._val - 14) << 1]); - entroct(g_c2._val); + entroct(g_tabdph[(_queue[2]._val - 14) << 1]); + entroct(_queue[1]._val); } else { entroct(4); - if (g_c3._val == 4) + if (_queue[2]._val == 4) entroct(3); else - entroct(g_c3._val); - entroct(g_c2._val); + entroct(_queue[2]._val); + entroct(_queue[1]._val); } break; case 0: case 1: - veracf(g_c2._acc); - switch (g_c3._code) { + veracf(_queue[1]._acc); + switch (_queue[2]._code) { case 2: d2 = 7; break; @@ -337,66 +337,66 @@ void SpeechManager::trait_car() { d2 = 8; break; case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; + d2 = g_tabdph[(_queue[2]._val - 14) << 1]; break; case 5: - d2 = g_c3._val; + d2 = _queue[2]._val; break; default: d2 = 10; break; } // switch c3._code - d2 = (d2 * 26) + g_c2._val; + d2 = (d2 * 26) + _queue[1]._val; if (g_tnocon[d2] == 0) d3 = 2; else d3 = 6; - if (g_c2._rep >= 5) { - g_c2._rep = g_c2._rep - 5; + if (_queue[1]._rep >= 5) { + _queue[1]._rep -= 5; d3 = 8 - d3; // Swap 2 and 6 } - if (g_c2._code == 0) { - i = g_c2._rep; + if (_queue[1]._code == 0) { + i = _queue[1]._rep; if (i != 0) { do { --i; entroct(d3); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(3); } while (i > 0); } entroct(d3); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(4); } else { entroct(d3); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(3); - i = g_c2._rep; + i = _queue[1]._rep; if (i != 0) { do { --i; entroct(d3); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(4); } while (i > 0); } } - if (g_c3._code == 9) { + if (_queue[2]._code == 9) { entroct(d3); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { case 3: d2 = 8; break; case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; + d2 = g_tabdph[(_queue[2]._val - 14) << 1]; break; case 5: - d2 = g_c3._val; + d2 = _queue[2]._val; break; default: d2 = 7; @@ -405,47 +405,47 @@ void SpeechManager::trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; + if (g_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; - if ((g_c2._val == 17) || (g_c2._val == 18)) - g_c2._val = 16; + if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) + _queue[1]._val = 16; entroct(4); entroct(d2); - entroct(g_c2._val); + entroct(_queue[1]._val); } break; case 4: - veracf(g_c2._acc); - i = g_c2._rep; + veracf(_queue[1]._acc); + i = _queue[1]._rep; if (i != 0) { do { --i; entroct(2); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(3); } while (i > 0); } entroct(2); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(4); - if (g_c3._code == 9) { + if (_queue[2]._code == 9) { entroct(2); - entroct(g_c2._val); + entroct(_queue[1]._val); entroct(5); - } else if ((g_c3._code != 0) && (g_c3._code != 1) && (g_c3._code != 4)) { - veracf(g_c3._acc); - switch (g_c3._code) { + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { case 3: d2 = 8; break; case 6: - d2 = g_tabdph[(g_c3._val - 14) << 1]; + d2 = g_tabdph[(_queue[2]._val - 14) << 1]; break; case 5: - d2 = g_c3._val; + d2 = _queue[2]._val; break; default: d2 = 7; @@ -455,12 +455,12 @@ void SpeechManager::trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[g_c2._val] != 0) - ++g_c2._val; + if (g_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; entroct(4); entroct(d2); - entroct(g_tabdbc[((g_c2._val - 26) << 1) + 1]); + entroct(g_tabdbc[((_queue[1]._val - 26) << 1) + 1]); } break; @@ -474,10 +474,10 @@ void SpeechManager::trait_car() { * @remarks Originally called 'rot_chariot' */ void SpeechManager::moveQueue() { - g_c1 = g_c2; - g_c2 = g_c3; - g_c3._val = 32; - g_c3._code = 9; + _queue[0] = _queue[1]; + _queue[1] = _queue[2]; + _queue[2]._val = 32; + _queue[2]._code = 9; } /** @@ -485,9 +485,9 @@ void SpeechManager::moveQueue() { * @remarks Originally called 'init_chariot' */ void SpeechManager::initQueue() { - g_c3._rep = 0; - g_c3._freq = 0; - g_c3._acc = 0; + _queue[2]._rep = 0; + _queue[2]._freq = 0; + _queue[2]._acc = 0; moveQueue(); moveQueue(); } @@ -542,7 +542,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { tempo = kTempoF; else tempo = kTempoM; - g_addfix = (float)((tempo - g_addv[0])) / 256; + g_vm->_addfix = (float)((tempo - g_addv[0])) / 256; cctable(g_tbi); switch (typ) { case 1: diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index a0bdf8a4dd..eabffb9bba 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -60,6 +60,8 @@ class SpeechManager { private: int _typlec; int _phonemeNumb; + SpeechQueue _queue[3]; + public: SpeechManager(); void spfrac(int wor); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index f4a5d12955..392e8a21c4 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -58,18 +58,6 @@ const byte g_tnocon[364] = { 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 byte g_menuConstants[8][4] = { - { 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 byte g_addv[2] = {8, 8}; const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; @@ -119,18 +107,16 @@ int g_nbrep[9]; int g_nbrepm[9]; int g_msg[5]; byte g_touv[8]; -sav_chaine g_s, g_s1; +SaveStruct g_s, g_s1; byte g_bufcha[391]; byte g_lettres[7][24]; uint16 g_t_mot[maxti + 1]; int g_tay_tchar; -ind g_t_rec[maxtd + 1]; +Hint g_t_rec[maxtd + 1]; int g_l[108]; int g_tbi[256]; -chariot g_c1, g_c2, g_c3; -float g_addfix; Common::Point g_tabpal[91][17]; t_pcga g_palcga[91]; pattern g_tpt[15]; @@ -174,36 +160,10 @@ Common::String copy(const Common::String &s, int idx, size_t size) { int g_port[0xfff]; byte g_mem[65536 * 16]; -/** - * Engine function - Get a random number between two values - * @remarks Originally called 'get_random_number' and 'hazard' - */ -int getRandomNumber(int minval, int maxval) { - return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval; -} - -/** - * Restore a screen sectio - */ -void s_sauv(int Gd, int y, int dy) { - // Note: May no longer be necessary, since the backgorund restore code - // is being handled slightly differently now in the menuUp() method -} - void palette(int v1) { warning("TODO: palette"); } -/** - * Restore a screen area - * @remarks Currently implemented differently in ScummVM, so this method is redundant. - * Original assembly was present in 'charecr.asm' - */ -void s_char(int Gd, int y, int dy) { - debugC(1, kMortevielleCore, "s_char called"); -} - -// (* external 'c:\mc\reusint.com'; *) void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index d71c0d7668..a91e6d921b 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -76,7 +76,7 @@ const int kMenuActionStringIndex = 476; const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; const int kSecretPassageQuestionStringIndex = 510; // Unusued? - +const int kMaxPatt = 20; const int OPCODE_NONE = 0; enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, @@ -86,31 +86,12 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, OPCODE_SLOOK = 0x405}; -const int kMaxPatt = 20; - -extern const byte g_tabdbc[18]; -extern const byte g_tabdph[16]; -extern const byte g_typcon[26]; -extern const byte g_intcon[26]; -extern const byte g_tnocon[364]; - -extern const byte g_menuConstants[8][4]; - -extern const byte g_addv[2]; - -extern const byte g_rang[16]; - -/*---------------------------------------------------------------------------*/ -/*-------------------------------- TYPES --------------------------------*/ -/*---------------------------------------------------------------------------*/ - /* 9 "A glance at the forbidden$", 18 "It's already open$", 26 "A photograph$", 27 "The coat of arms$", */ - enum places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, @@ -120,28 +101,43 @@ enum places { DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; -struct sav_chaine { +extern const byte g_tabdbc[18]; +extern const byte g_tabdph[16]; +extern const byte g_typcon[26]; +extern const byte g_intcon[26]; +extern const byte g_tnocon[364]; +extern const byte g_addv[2]; +extern const byte g_rang[16]; + +struct Hint { + int _hintId; + byte _point; +}; + +struct SaveStruct { int _faithScore; byte _pourc[11]; byte _teauto[43]; byte _sjer[31]; - int _currPlace, _atticBallHoleObjectId, _atticRodHoleObjectId, _cellarObjectId, _secretPassageObjectId, _wellObjectId; - int _selectedObjectId, _purpleRoomObjectId, _cryptObjectId; + int _currPlace; + int _atticBallHoleObjectId; + int _atticRodHoleObjectId; + int _cellarObjectId; + int _secretPassageObjectId; + int _wellObjectId; + int _selectedObjectId; + int _purpleRoomObjectId; + int _cryptObjectId; bool _alreadyEnteredManor; byte _fullHour; }; -struct ind { - int _indis; - byte _point; -}; - -struct chariot { - int _val, - _code, - _acc, - _freq, - _rep; +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; }; struct rectangle { @@ -221,18 +217,16 @@ extern int g_nbrep[9]; extern int g_nbrepm[9]; extern int g_msg[5]; extern byte g_touv[8]; -extern sav_chaine g_s, g_s1; +extern SaveStruct g_s, g_s1; extern byte g_bufcha[391]; extern byte g_lettres[7][24]; extern uint16 g_t_mot[maxti + 1]; extern int g_tay_tchar; -extern ind g_t_rec[maxtd + 1]; +extern Hint g_t_rec[maxtd + 1]; extern int g_l[108]; extern int g_tbi[256]; -extern chariot g_c1, g_c2, g_c3; -extern float g_addfix; extern Common::Point g_tabpal[91][17]; extern t_pcga g_palcga[91]; extern pattern g_tpt[15]; @@ -258,10 +252,6 @@ extern byte g_mem[65536 * 16]; #define hires {} extern void palette(int v1); -extern int getRandomNumber(int minval, int maxval); - -extern void s_char(int Gd, int y, int dy); -extern void s_sauv(int Gd, int y, int dy); } // End of namespace Mortevielle -- cgit v1.2.3 From 76f7858096a607b2de97572c89e8fc84c1a05efb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Mar 2012 08:32:36 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 12 +- engines/mortevielle/asm.cpp | 52 -------- engines/mortevielle/asm.h | 36 ------ engines/mortevielle/dialogs.cpp | 6 +- engines/mortevielle/keyboard.cpp | 3 +- engines/mortevielle/menu.cpp | 8 +- engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 109 ++--------------- engines/mortevielle/mor.h | 5 +- engines/mortevielle/mortevielle.cpp | 228 +++++++++++++++++++++++++++++++++++- engines/mortevielle/mortevielle.h | 13 +- engines/mortevielle/mouse.cpp | 14 +-- engines/mortevielle/mouse.h | 6 +- engines/mortevielle/outtext.cpp | 120 +------------------ engines/mortevielle/outtext.h | 1 - engines/mortevielle/ovd1.cpp | 16 +-- engines/mortevielle/saveload.cpp | 4 +- engines/mortevielle/speech.cpp | 2 +- engines/mortevielle/var_mor.cpp | 3 +- engines/mortevielle/var_mor.h | 9 +- 20 files changed, 285 insertions(+), 363 deletions(-) delete mode 100644 engines/mortevielle/asm.cpp delete mode 100644 engines/mortevielle/asm.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index a4255fd598..9479ad5445 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -209,7 +209,7 @@ void MortevielleEngine::fctTake() { _obpart = false; affrep(); } else { - g_tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; + g_tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; tsuiv(); ++g_dobj; if (g_dobj > 6) { @@ -699,7 +699,7 @@ void MortevielleEngine::fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { - Common::String alertTxt = deline(582); + Common::String alertTxt = g_vm->getString(582); Alert::show(alertTxt, 1); bool enterPassageFl = KnowledgeCheck::show(); @@ -722,11 +722,11 @@ void MortevielleEngine::fctPlace() { _menu.setDestinationMenuText(SECRET_PASSAGE); } else { _menu.setDestinationMenuText(g_s._currPlace); - writepal(14); + setPal(14); dessin(0); aniof(1, 2); aniof(1, 1); - alertTxt = deline(577); + alertTxt = g_vm->getString(577); Alert::show(alertTxt, 1); aniof(2, 1); g_crep = 166; @@ -1368,7 +1368,7 @@ void MortevielleEngine::fctDiscuss() { for (int ix = 1; ix <= 46; ++ix) te[ix] = false; for (int ix = 1; ix <= 45; ++ix) { - lib[ix] = deline(ix + kQuestionStringIndex); + lib[ix] = g_vm->getString(ix + kQuestionStringIndex); for (i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } @@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() { _mouse.moveMouse(f, tou); CHECK_QUIT; - _mouse.getMousePos_(x, y, c); + _mouse.getMousePosition(x, y, c); x *= (3 - g_res); if (x > 319) cx = 41; diff --git a/engines/mortevielle/asm.cpp b/engines/mortevielle/asm.cpp deleted file mode 100644 index 2d057a38f9..0000000000 --- a/engines/mortevielle/asm.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/scummsys.h" - -namespace Mortevielle { - -/** - * Decodes a number of 64 byte blocks - * @param pStart Start of data - * @param count Number of 64 byte blocks - */ -void zzuul(byte *pStart, int count) { - while (count-- > 0) { - for (int idx = 0; idx < 64; ++pStart, ++idx) { - uint16 v = ((*pStart - 0x80) << 1) + 0x80; - - if (v & 0x8000) - *pStart = 0; - else if (v & 0xff00) - *pStart = 0xff; - else - *pStart = (byte)v; - } - } -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/asm.h b/engines/mortevielle/asm.h deleted file mode 100644 index 11793b3d46..0000000000 --- a/engines/mortevielle/asm.h +++ /dev/null @@ -1,36 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_ASM_H -#define MORTEVIELLE_ASM_H - -namespace Mortevielle { - -extern void zzuul(byte *pStart, int count); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 68d2852100..c20b99e12e 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -291,7 +291,7 @@ bool KnowledgeCheck::show() { int rep; int firstOption, lastOption; char key; - rectangle coor[kMaxRect]; + Rect coor[kMaxRect]; Common::String choiceArray[15]; int currChoice, prevChoice; @@ -307,7 +307,7 @@ bool KnowledgeCheck::show() { else dialogHeight = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); - Common::String tmpStr = deline(textIndexArr[indx]); + Common::String tmpStr = g_vm->getString(textIndexArr[indx]); displayStr(tmpStr, 20, 15, 100, 2, 0); if (indx != 9) { @@ -322,7 +322,7 @@ bool KnowledgeCheck::show() { prevChoice = 1; for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) { - tmpStr = deline(j); + tmpStr = g_vm->getString(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); displayStr(tmpStr, 100, optionPosY, 100, 1, 0); diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 71ab0c1e99..2ce96bcede 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -28,7 +28,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/keyboard.h" #include "mortevielle/var_mor.h" -#include "mortevielle/asm.h" namespace Mortevielle { @@ -47,7 +46,7 @@ int testou() { break; case '\26' : if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) { - zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + g_vm->decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); ++g_vm->_c_zzz; return 61; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6cf09be3c8..0ba0cb5e51 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -97,7 +97,7 @@ void Menu::setDestinationMenuText(int roomId) { int destinationId = 0; for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) { - nomp = deline(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); + nomp = g_vm->getString(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; setText(_moveMenu[destinationId + 1], nomp); @@ -518,18 +518,18 @@ void Menu::initMenu() { _moveStringArray[i] = "* "; i = 1; do { - _actionStringArray[i] = deline(i + kMenuActionStringIndex); + _actionStringArray[i] = g_vm->getString(i + kMenuActionStringIndex); while (_actionStringArray[i].size() < 10) _actionStringArray[i] += ' '; if (i < 9) { if (i < 6) { - _selfStringArray[i] = deline(i + kMenuSelfStringIndex); + _selfStringArray[i] = g_vm->getString(i + kMenuSelfStringIndex); while (_selfStringArray[i].size() < 10) _selfStringArray[i] += ' '; } - _discussStringArray[i] = deline(i + kMenuSayStringIndex) + ' '; + _discussStringArray[i] = g_vm->getString(i + kMenuSayStringIndex) + ' '; } ++i; } while (i != 22); diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 07631ea264..563da9f535 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -2,7 +2,6 @@ MODULE := engines/mortevielle MODULE_OBJS := \ actions.o \ - asm.o \ detection.o \ dialogs.o \ graphics.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4ba68c3778..77a23d31fe 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -44,16 +44,7 @@ namespace Mortevielle { -/* NIVEAU 15 */ -void copcha() { - int i = acha; - do { - g_tabdon[i] = g_tabdon[i + 390]; - ++i; - } while (i != acha + 390); -} - -void outbloc(int n, pattern p, nhom *pal) { +void outbloc(int n, Pattern p, nhom *pal) { int ad = n * 404 + 0xd700; WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); @@ -65,34 +56,6 @@ void outbloc(int n, pattern p, nhom *pal) { } } -void writepal(int n) { - switch (g_vm->_currGraphicalDevice) { - case MODE_TANDY: - case MODE_EGA: - case MODE_AMSTRAD1512: - for (int i = 1; i <= 16; ++i) { - g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x; - g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y; - } - break; - case MODE_CGA: { - nhom pal[16]; - for (int i = 0; i < 16; ++i) { - pal[i] = g_palcga[n]._a[i]; - } - - if (n < 89) - palette(g_palcga[n]._p); - - for (int i = 0; i <= 15; ++i) - outbloc(i, g_tpt[pal[i]._id], pal); - } - break; - default: - break; - } -} - void pictout(int seg, int dep, int x, int y) { GfxSurface surface; @@ -199,7 +162,7 @@ void modif(int &nu) { void dessine(int ad, int x, int y) { g_vm->_mouse.hideMouse(); - writepal(g_numpal); + g_vm->setPal(g_numpal); pictout(ad, 0, x, y); g_vm->_mouse.showMouse(); } @@ -209,7 +172,7 @@ void dessine(int ad, int x, int y) { * @remarks Originally called 'dessine_rouleau' */ void drawRightFrame() { - writepal(89); + g_vm->setPal(89); if (g_vm->_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; } @@ -228,7 +191,7 @@ void text1(int x, int y, int nb, int m) { co = 10; else co = 6; - Common::String tmpStr = deline(m); + Common::String tmpStr = g_vm->getString(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; displayStr(tmpStr, x, y, nb, 20, g_vm->_textColor); @@ -291,7 +254,7 @@ void modobj(int m) { Common::String strp = Common::String(' '); if (m != 500) - strp = deline(m - 501 + kInventoryStringIndex); + strp = g_vm->getString(m - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[8], strp); g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); @@ -299,7 +262,7 @@ void modobj(int m) { void repon(int f, int m) { if ((m > 499) && (m < 563)) { - Common::String tmpStr = deline(m - 501 + kInventoryStringIndex); + Common::String tmpStr = g_vm->getString(m - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) g_vm->_largestClearScreen = true; @@ -335,7 +298,7 @@ void repon(int f, int m) { else i = 5; - Common::String tmpStr = deline(m); + Common::String tmpStr = g_vm->getString(m); displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) @@ -494,54 +457,6 @@ void phaz(int &rand, int &p, int cf) { rand = g_vm->getRandomNumber(1, 100); } -/** - * Engine function - When restarting the game, reset the main variables used by the engine - * @remarks Originally called 'inzon' - */ -void resetVariables() { - copcha(); - - g_s._alreadyEnteredManor = false; - g_s._selectedObjectId = 0; - g_s._cellarObjectId = 0; - g_s._atticBallHoleObjectId = 0; - g_s._atticRodHoleObjectId = 0; - g_s._wellObjectId = 0; - g_s._secretPassageObjectId = 0; - g_s._purpleRoomObjectId = 136; - g_s._cryptObjectId = 141; - g_s._faithScore = g_vm->getRandomNumber(4, 10); - g_s._currPlace = MANOR_FRONT; - - for (int i = 2; i <= 6; ++i) - g_s._sjer[i] = chr(0); - - g_s._sjer[1] = chr(113); - g_s._fullHour = chr(20); - - for (int i = 1; i <= 10; ++i) - g_s._pourc[i] = ' '; - - for (int i = 1; i <= 6; ++i) - g_s._teauto[i] = '*'; - - for (int i = 7; i <= 9; ++i) - g_s._teauto[i] = ' '; - - for (int i = 10; i <= 28; ++i) - g_s._teauto[i] = '*'; - - for (int i = 29; i <= 42; ++i) - g_s._teauto[i] = ' '; - - g_s._teauto[33] = '*'; - - for (int i = 1; i <= 8; ++i) - g_nbrep[i] = 0; - - init_nbrepm(); -} - int t11(int roomId) { int retVal = 0; int p, rand; @@ -876,7 +791,7 @@ void tkey1(bool d) { while (g_vm->keyPressed()) g_key = testou(); do { - g_vm->_mouse.getMousePos_(x, y, c); + g_vm->_mouse.getMousePosition(x, y, c); g_vm->keyPressed(); } while (c != 0); @@ -885,7 +800,7 @@ void tkey1(bool d) { if (d) tinke(); quest = g_vm->keyPressed(); - g_vm->_mouse.getMousePos_(x, y, c); + g_vm->_mouse.getMousePosition(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && g_vm->_anyone))); if (quest) @@ -967,7 +882,7 @@ void modinv() { if (g_s._sjer[i] != chr(0)) { ++cy; r = (ord(g_s._sjer[i]) + 400); - nomp = deline(r - 501 + kInventoryStringIndex); + nomp = g_vm->getString(r - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); } @@ -992,7 +907,7 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - int cy = acha + ((g_mchai - 1) * 10) - 1; + int cy = kAcha + ((g_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; @@ -1077,7 +992,7 @@ void tsuiv() { int tbcl; int cl; - int cy = acha + ((g_mchai - 1) * 10) - 1; + int cy = kAcha + ((g_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index d3defc1b04..ebf9537992 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -42,9 +42,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; -extern void copcha(); -extern void outbloc(int n, pattern p, nhom *pal); -extern void writepal(int n); +extern void outbloc(int n, Pattern p, nhom *pal); extern void pictout(int seg, int dep, int x, int y); extern void sauvecr(int y, int dy); extern void charecr(int y, int dy); @@ -76,7 +74,6 @@ extern void becfren(int roomId); /* NIVEAU 10 */ extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); -extern void resetVariables(); extern int t11(int roomId); extern void cavegre(); extern void writetp(Common::String s, int t); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 9b7ade1967..cd375970b7 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -30,7 +30,6 @@ #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" #include "mortevielle/dialogs.h" -#include "mortevielle/asm.h" #include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -43,6 +42,31 @@ namespace Mortevielle { +const byte tabdr[32] = { + 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 byte tab30[32] = { + 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 byte tab31[32]= { + 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 +}; + MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): @@ -164,7 +188,7 @@ Common::ErrorCode MortevielleEngine::initialise() { return result; // Load some error messages (was previously in chartex()) - _hintPctMessage = deline(580); // You should have noticed %d hints + _hintPctMessage = getString(580); // You should have noticed %d hints // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -177,7 +201,7 @@ Common::ErrorCode MortevielleEngine::initialise() { charpal(); loadCFIPH(); loadCFIEC(); - zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); _c_zzz = 1; init_nbrepm(); initMouse(); @@ -541,7 +565,7 @@ void MortevielleEngine::mainGame() { loadCFIEC(); for (g_crep = 1; g_crep <= _c_zzz; ++g_crep) - zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); _menu.initMenu(); @@ -1684,7 +1708,7 @@ void MortevielleEngine::startDialog(int16 rep) { assert(rep >= 0); _mouse.hideMouse(); - Common::String dialogStr = deline(rep + kDialogStringIndex); + Common::String dialogStr = getString(rep + kDialogStringIndex); displayStr(dialogStr, 230, 4, 65, 24, 5); f3f8::draw(); @@ -1853,7 +1877,7 @@ void MortevielleEngine::gameLoaded() { g_iouv = 0; g_dobj = 0; affrep(); - _hintPctMessage = deline(580); + _hintPctMessage = getString(580); _okdes = false; _endGame = true; @@ -2101,4 +2125,196 @@ void MortevielleEngine::showMoveMenuAlert() { Alert::show(getEngineString(S_USE_DEP_MENU), 1); } +/** + * Decodes a number of 64 byte blocks + * @param pStart Start of data + * @param count Number of 64 byte blocks + * @remarks Originally called 'zzuul' + */ +void MortevielleEngine::decodeNumber(byte *pStart, int count) { + while (count-- > 0) { + for (int idx = 0; idx < 64; ++pStart, ++idx) { + uint16 v = ((*pStart - 0x80) << 1) + 0x80; + + if (v & 0x8000) + *pStart = 0; + else if (v & 0xff00) + *pStart = 0xff; + else + *pStart = (byte)v; + } + } +} + +void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { + uint16 oct, ocd; + + /* 5-8 */ + oct = g_t_mot[idx]; + oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); + if (pt < 6) { + ++idx; + oct = oct << (5 - pt); + pt += 11; + oct = oct | ((uint)g_t_mot[idx] >> pt); + } else { + pt -= 5; + oct = (uint)oct >> pt; + } + + switch (oct) { + case 11: + c = '$'; + the_end = true; + break; + case 30: + case 31: + ocd = g_t_mot[idx]; + ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); + if (pt < 6) { + ++idx; + ocd = ocd << (5 - pt); + pt += 11; + ocd = ocd | ((uint)g_t_mot[idx] >> pt); + } else { + pt -= 5; + ocd = (uint)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]); + break; + } +} + +/** + * Decode and extract the line with the given Id + * @remarks Originally called 'deline' + */ +Common::String MortevielleEngine::getString(int num) { + Common::String wrkStr = ""; + + if (num < 0) { + warning("deline: num < 0! Skipping"); + } else if (!g_vm->_txxFileFl) { + wrkStr = g_vm->getGameString(num); + } else { + int i = g_t_rec[num]._hintId; + byte k = g_t_rec[num]._point; + int length = 0; + bool endFl = false; + char let; + do { + cinq_huit(let, i, k, endFl); + if (length < 254) + wrkStr += let; + ++length; + } while (!endFl); + } + + if (wrkStr.lastChar() == '$') + // Remove trailing '$' + wrkStr.deleteLastChar(); + + return wrkStr; +} + +void MortevielleEngine::copcha() { + int i = kAcha; + do { + g_tabdon[i] = g_tabdon[i + 390]; + ++i; + } while (i != kAcha + 390); +} + +/** + * Engine function - When restarting the game, reset the main variables used by the engine + * @remarks Originally called 'inzon' + */ +void MortevielleEngine::resetVariables() { + copcha(); + + g_s._alreadyEnteredManor = false; + g_s._selectedObjectId = 0; + g_s._cellarObjectId = 0; + g_s._atticBallHoleObjectId = 0; + g_s._atticRodHoleObjectId = 0; + g_s._wellObjectId = 0; + g_s._secretPassageObjectId = 0; + g_s._purpleRoomObjectId = 136; + g_s._cryptObjectId = 141; + g_s._faithScore = g_vm->getRandomNumber(4, 10); + g_s._currPlace = MANOR_FRONT; + + for (int i = 2; i <= 6; ++i) + g_s._sjer[i] = chr(0); + + g_s._sjer[1] = chr(113); + g_s._fullHour = chr(20); + + for (int i = 1; i <= 10; ++i) + g_s._pourc[i] = ' '; + + for (int i = 1; i <= 6; ++i) + g_s._teauto[i] = '*'; + + for (int i = 7; i <= 9; ++i) + g_s._teauto[i] = ' '; + + for (int i = 10; i <= 28; ++i) + g_s._teauto[i] = '*'; + + for (int i = 29; i <= 42; ++i) + g_s._teauto[i] = ' '; + + g_s._teauto[33] = '*'; + + for (int i = 1; i <= 8; ++i) + g_nbrep[i] = 0; + + init_nbrepm(); +} + +/** + * Engine function - Set the palette + * @remarks Originally called 'writepal' + */ +void MortevielleEngine::setPal(int n) { + switch (g_vm->_currGraphicalDevice) { + case MODE_TANDY: + case MODE_EGA: + case MODE_AMSTRAD1512: + for (int i = 1; i <= 16; ++i) { + g_mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; + g_mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; + } + break; + case MODE_CGA: { + nhom pal[16]; + for (int i = 0; i < 16; ++i) { + pal[i] = g_vm->_cgaPal[n]._a[i]; + } + + if (n < 89) + palette(g_vm->_cgaPal[n]._p); + + for (int i = 0; i <= 15; ++i) + outbloc(i, _patternArr[pal[i]._id], pal); + } + break; + default: + break; + } +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c2fd857536..0bc6b09a87 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -80,10 +80,10 @@ enum DataType { #define MORT_DAT "mort.dat" #define GAME_FRAME_DELAY (1000 / 50) +const int kAcha = 492; const int asoul = 154; const int aouvr = 282; const int achai = 387; -const int acha = 492; const int arcf = 1272; const int arep = 1314; const int amzon = 1650; @@ -112,6 +112,8 @@ private: void mainGame(); void playGame(); void handleAction(); + void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); + void copcha(); public: Common::String _hintPctMessage; Common::Point _prevPos; @@ -156,10 +158,10 @@ public: int _minute; float _addfix; - + Common::Point _stdPal[91][17]; + t_pcga _cgaPal[91]; int _c_zzz; int ptr_word; - byte _v_lieu[7][25]; ScreenSurface _screenSurface; @@ -302,6 +304,11 @@ public: void clearScreenType10(); int getRandomNumber(int minval, int maxval); void showMoveMenuAlert(); + void decodeNumber(byte *pStart, int count); + Common::String getString(int num); + void resetVariables(); + + void setPal(int n); }; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index a898f22bbe..301072391e 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -227,7 +227,7 @@ void MouseHandler::showMouse() { * Set mouse position * @remarks Originally called 'pos_mouse' */ -void MouseHandler::setMousePos(Common::Point newPos) { +void MouseHandler::setMousePosition(Common::Point newPos) { if (newPos.x > 314 * g_res) newPos.x = 314 * g_res; else if (newPos.x < 0) @@ -247,7 +247,7 @@ void MouseHandler::setMousePos(Common::Point newPos) { * Get mouse poisition * @remarks Originally called 'read_pos_mouse' */ -void MouseHandler::getMousePos_(int &x, int &y, int &c) { +void MouseHandler::getMousePosition(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; c = g_vm->getMouseClick() ? 1 : 0; @@ -276,7 +276,7 @@ void MouseHandler::moveMouse(bool &funct, char &key) { CHECK_QUIT; in1 = g_vm->getChar(); - getMousePos_(cx, cy, cd); + getMousePosition(cx, cy, cd); switch (toupper(in1)) { case '4': cx -= 8; @@ -407,19 +407,19 @@ void MouseHandler::moveMouse(bool &funct, char &key) { break; } - setMousePos(Common::Point(cx, cy)); + setMousePosition(Common::Point(cx, cy)); p_key = g_vm->keyPressed(); } } /** - * Engine function : Is mouse in a given rect? + * Mouse function : Is mouse in a given rect? * @remarks Originally called 'dans_rect' */ -bool MouseHandler::isMouseIn(rectangle r) { +bool MouseHandler::isMouseIn(Rect r) { int x, y, c; - getMousePos_(x, y, c); + getMousePosition(x, y, c); if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) return true; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 76a9991f44..0bf46d926d 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -43,10 +43,10 @@ public: void initMouse(); void hideMouse(); void showMouse(); - void setMousePos(Common::Point newPos); - void getMousePos_(int &x, int &y, int &c); + void setMousePosition(Common::Point newPos); + void getMousePosition(int &x, int &y, int &c); void moveMouse(bool &funct, char &key); - bool isMouseIn(rectangle r); + bool isMouseIn(Rect r); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index a941f79aa1..12c16f91b1 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -36,126 +36,8 @@ namespace Mortevielle { -Common::String delig; -const byte tabdr[32] = { - 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 byte tab30[32] = { - 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 byte tab31[32]= { - 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 -}; - -Common::String deline(int num); typedef unsigned char uchar; -static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { -/* - const uchar rap[32] = { - (uchar)',', (uchar)':', (uchar)'@', (uchar)'!', (uchar)'?', (uchar)'-', (uchar)'\207', - (uchar)'\240', (uchar)'\205', (uchar)'\203', (uchar)'\202', (uchar)'\212', (uchar)'\210', (uchar)'/', - (uchar)'\213', (uchar)'\214', (uchar)'\242', (uchar)'\047', (uchar)'\223', (uchar)'"', (uchar)'\227', - (uchar)'\226', (uchar)'0', (uchar)'1', (uchar)'2', (uchar)'3', (uchar)'4', (uchar)'5', - (uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9' - }; -*/ - uint16 oct, ocd; - - /* 5-8 */ - oct = g_t_mot[idx]; - oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); - if (pt < 6) { - ++idx; - oct = oct << (5 - pt); - pt += 11; - oct = oct | ((uint)g_t_mot[idx] >> pt); - } else { - pt -= 5; - oct = (uint)oct >> pt; - } - - switch (oct) { - case 11: - c = '$'; - the_end = true; - break; - case 30: - case 31: - ocd = g_t_mot[idx]; - ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); - if (pt < 6) { - ++idx; - ocd = ocd << (5 - pt); - pt += 11; - ocd = ocd | ((uint)g_t_mot[idx] >> pt); - } else { - pt -= 5; - ocd = (uint)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]); - break; - } -} /* 5-8 */ - -/** - * Decode and extract the line with the given Id - */ -Common::String deline(int num) { - Common::String wrkStr = ""; - - if (num < 0) { - warning("deline: num < 0! Skipping"); - } else if (!g_vm->_txxFileFl) { - wrkStr = g_vm->getGameString(num); - } else { - int i = g_t_rec[num]._hintId; - byte k = g_t_rec[num]._point; - int length = 0; - bool endFl = false; - char let; - do { - cinq_huit(let, i, k, endFl); - if (length < 254) - wrkStr += let; - ++length; - } while (!endFl); - } - - if (wrkStr.lastChar() == '$') - // Remove trailing '$' - wrkStr.deleteLastChar(); - - return wrkStr; -} - static int l_motsuiv(int p, const char *ch, int &tab) { int c = p; @@ -429,7 +311,7 @@ void taffich() { } } g_numpal = npal; - writepal(npal); + g_vm->setPal(npal); if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { lgt = 0; diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index cd109ffea5..d27ca3edc9 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -35,7 +35,6 @@ namespace Mortevielle { const int kAdrAni = 0x7314; -extern Common::String deline(int num); extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); extern void chardes(Common::String filename, int32 passe, int long_); extern void charani(Common::String filename, int32 skipSize, int length); diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 0a93a84516..178ef434ae 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -54,8 +54,8 @@ void charpal() { error("Missing file - plxx.mor"); for (int i = 0; i <= 90; ++i) { for (int j = 1; j <= 16; ++j) { - g_tabpal[i][j].x = f.readByte(); - g_tabpal[i][j].y = f.readByte(); + g_vm->_stdPal[i][j].x = f.readByte(); + g_vm->_stdPal[i][j].y = f.readByte(); } } f.close(); @@ -64,9 +64,9 @@ void charpal() { error("Missing file - cxx.mor"); for (int j = 0; j <= 90; ++j) { - g_palcga[j]._p = f.readByte(); + g_vm->_cgaPal[j]._p = f.readByte(); for (int i = 0; i <= 15; ++i) { - nhom &with = g_palcga[j]._a[i]; + nhom &with = g_vm->_cgaPal[j]._a[i]; b = f.readByte(); with._id = (uint)b >> 4; @@ -75,13 +75,13 @@ void charpal() { } } - g_palcga[10]._a[9] = g_palcga[10]._a[5]; + g_vm->_cgaPal[10]._a[9] = g_vm->_cgaPal[10]._a[5]; for (int j = 0; j <= 14; ++j) { - g_tpt[j]._tax = f.readByte(); - g_tpt[j]._tay = f.readByte(); + _patternArr[j]._tax = f.readByte(); + _patternArr[j]._tay = f.readByte(); for (int i = 1; i <= 20; ++i) for (int k = 1; k <= 20; ++k) - g_tpt[j]._des[i][k] = f.readByte(); + _patternArr[j]._des[i][k] = f.readByte(); } f.close(); } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 9458da38bc..7ddd8b707c 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -109,7 +109,7 @@ void SavegameManager::loadSavegame(int n) { g_s = g_s1; for (int i = 0; i <= 389; ++i) - g_tabdon[i + acha] = g_bufcha[i]; + g_tabdon[i + kAcha] = g_bufcha[i]; // Close the stream delete stream; @@ -142,7 +142,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { g_vm->hourToChar(); for (i = 0; i <= 389; ++i) - g_bufcha[i] = g_tabdon[i + acha]; + g_bufcha[i] = g_tabdon[i + kAcha]; g_s1 = g_s; if (g_s1._currPlace == 26) g_s1._currPlace = 15; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index ba7ef62195..69a0c331da 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -564,7 +564,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { g_t_cph[i] = savph[i]; g_mlec = _typlec; } - writepal(g_numpal); + g_vm->setPal(g_numpal); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 392e8a21c4..b3999b7c6f 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -117,9 +117,8 @@ int g_tay_tchar; Hint g_t_rec[maxtd + 1]; int g_l[108]; int g_tbi[256]; -Common::Point g_tabpal[91][17]; t_pcga g_palcga[91]; -pattern g_tpt[15]; +Pattern _patternArr[15]; byte g_adcfiec[(4088 * 16) + (311 * 0x80)]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a91e6d921b..b6897522b9 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -140,17 +140,16 @@ struct SpeechQueue { int _rep; }; -struct rectangle { +struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; }; -struct pattern { +struct Pattern { byte _tay, _tax; byte _des[kMaxPatt + 1][kMaxPatt + 1]; }; - struct nhom { byte _id; /* number between 0 and 32 */ byte _hom[4]; @@ -227,9 +226,7 @@ extern int g_tay_tchar; extern Hint g_t_rec[maxtd + 1]; extern int g_l[108]; extern int g_tbi[256]; -extern Common::Point g_tabpal[91][17]; -extern t_pcga g_palcga[91]; -extern pattern g_tpt[15]; +extern Pattern _patternArr[15]; extern byte g_adcfiec[822 * 128]; -- cgit v1.2.3 From c1e8ff3adabac16d6c37041ac22ff1e41eaf36ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Mar 2012 00:13:11 +0100 Subject: MORTEVIELLE: Rename more globals and move functions to MortevielleEngine. Remove ovd1 files. --- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/menu.cpp | 3 +- engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 137 +++++++------------ engines/mortevielle/mor.h | 3 - engines/mortevielle/mortevielle.cpp | 258 ++++++++++++++++++++++++++++++++++-- engines/mortevielle/mortevielle.h | 27 +++- engines/mortevielle/outtext.cpp | 36 ++--- engines/mortevielle/ovd1.cpp | 221 ------------------------------ engines/mortevielle/ovd1.h | 43 ------ engines/mortevielle/saveload.cpp | 41 +++--- engines/mortevielle/var_mor.cpp | 7 +- engines/mortevielle/var_mor.h | 25 +--- 13 files changed, 369 insertions(+), 435 deletions(-) delete mode 100644 engines/mortevielle/ovd1.cpp delete mode 100644 engines/mortevielle/ovd1.h diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index c20b99e12e..5191b1ed43 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -455,7 +455,7 @@ void f3f8::aff50(bool drawAni50Fl) { g_caff = 50; g_maff = 0; taffich(); - dessine(g_ades, 63, 12); + g_vm->draw(g_ades, 63, 12); if (drawAni50Fl) ani50(); else diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 0ba0cb5e51..137ff468a2 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -33,7 +33,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/ovd1.h" #include "mortevielle/var_mor.h" namespace Mortevielle { @@ -568,7 +567,7 @@ void Menu::setSearchMenu() { * @remarks Originally called 'mfouen' */ void Menu::unsetSearchMenu() { - setDestinationMenuText(g_s._currPlace); + setDestinationMenuText(g_vm->g_s._currPlace); for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]); diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 563da9f535..58978c9d25 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -11,7 +11,6 @@ MODULE_OBJS := \ mortevielle.o \ mouse.o \ outtext.o \ - ovd1.o \ saveload.o \ sound.o \ speech.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 77a23d31fe..e1206be2c2 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -44,19 +44,6 @@ namespace Mortevielle { -void outbloc(int n, Pattern p, nhom *pal) { - int ad = n * 404 + 0xd700; - - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax); - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay); - ad += 4; - for (int i = 1; i <= p._tax; ++i) { - for (int j = 1; j <= p._tay; ++j) - g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]]; - } -} - - void pictout(int seg, int dep, int x, int y) { GfxSurface surface; surface.decode(&g_mem[seg * 16 + dep]); @@ -159,28 +146,6 @@ void modif(int &nu) { nu -= 3976; } - -void dessine(int ad, int x, int y) { - g_vm->_mouse.hideMouse(); - g_vm->setPal(g_numpal); - pictout(ad, 0, x, y); - g_vm->_mouse.showMouse(); -} - -/** - * Draw right frame - * @remarks Originally called 'dessine_rouleau' - */ -void drawRightFrame() { - g_vm->setPal(89); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - g_mem[0x7000 * 16 + 14] = 15; - } - g_vm->_mouse.hideMouse(); - pictout(0x73a2, 0, 0, 0); - g_vm->_mouse.showMouse(); -} - /* NIVEAU 13 */ @@ -280,12 +245,12 @@ void repon(int f, int m) { g_vm->prepareScreenType2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) - g_s._teauto[40] = '*'; + g_vm->g_s._teauto[40] = '*'; if ((m == 104) && (g_caff == 14)) { - g_s._teauto[36] = '*'; - if (g_s._teauto[39] == '*') { - g_s._pourc[3] = '*'; - g_s._teauto[38] = '*'; + g_vm->g_s._teauto[36] = '*'; + if (g_vm->g_s._teauto[39] == '*') { + g_vm->g_s._pourc[3] = '*'; + g_vm->g_s._teauto[38] = '*'; } } break; @@ -302,9 +267,9 @@ void repon(int f, int m) { displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) - g_s._pourc[6] = '*'; + g_vm->g_s._pourc[6] = '*'; else if (m == 179) - g_s._pourc[10] = '*'; + g_vm->g_s._pourc[10] = '*'; } break; default: @@ -461,7 +426,7 @@ int t11(int roomId) { int retVal = 0; int p, rand; - ecfren(p, rand, g_s._faithScore, roomId); + ecfren(p, rand, g_vm->g_s._faithScore, roomId); g_vm->_place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { @@ -493,7 +458,7 @@ int t11(int roomId) { p = g_vm->getPresenceStatsLanding(); else if (roomId == CHAPEL) p = g_vm->getPresenceStatsChapel(h); - p += g_s._faithScore; + p += g_vm->g_s._faithScore; rand = g_vm->getRandomNumber(1, 100); if (rand > p) { g_vm->displayAloneText(); @@ -518,9 +483,9 @@ int t11(int roomId) { } void cavegre() { - g_s._faithScore += 2; - if (g_s._faithScore > 69) - g_s._faithScore += (g_s._faithScore / 10); + g_vm->g_s._faithScore += 2; + if (g_vm->g_s._faithScore > 69) + g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); @@ -567,17 +532,17 @@ void aniof(int ouf, int num) { /* NIVEAU 9 */ void dessin(int ad) { if (ad != 0) - dessine(g_ades, ((ad % 160) * 2), (ad / 160)); + g_vm->draw(g_ades, ((ad % 160) * 2), (ad / 160)); else { g_vm->clearScreenType1(); if (g_caff > 99) { - dessine(g_ades, 60, 33); + g_vm->draw(g_ades, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (g_caff > 69) { - dessine(g_ades, 112, 48); // Heads + g_vm->draw(g_ades, 112, 48); // Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { - dessine(g_ades, 0, 12); + g_vm->draw(g_ades, 0, 12); g_vm->prepareScreenType1(); if ((g_caff < 30) || (g_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { @@ -586,16 +551,16 @@ void dessin(int ad) { } if (g_caff == 13) { - if (g_s._atticBallHoleObjectId == 141) + if (g_vm->g_s._atticBallHoleObjectId == 141) aniof(1, 7); - if (g_s._atticRodHoleObjectId == 159) + if (g_vm->g_s._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((g_caff == 14) && (g_s._cellarObjectId == 151)) + } else if ((g_caff == 14) && (g_vm->g_s._cellarObjectId == 151)) aniof(1, 2); - else if ((g_caff == 17) && (g_s._secretPassageObjectId == 143)) + else if ((g_caff == 17) && (g_vm->g_s._secretPassageObjectId == 143)) aniof(1, 1); - else if ((g_caff == 24) && (g_s._wellObjectId != 0)) + else if ((g_caff == 24) && (g_vm->g_s._wellObjectId != 0)) aniof(1, 1); } @@ -633,7 +598,7 @@ void tinke() { drawClock(); cf = 0; for (int i = 1; i <= 10; ++i) { - if (g_s._pourc[i] == '*') + if (g_vm->g_s._pourc[i] == '*') ++cf; } @@ -667,7 +632,7 @@ void tinke() { g_t = kTime2; else g_t = kTime1; - cf = g_s._faithScore; + cf = g_vm->g_s._faithScore; if ((cf > 33) && (cf < 66)) g_t -= (g_t / 3); @@ -723,7 +688,7 @@ void tinke() { g_mpers = g_vm->_currBitIndex; if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) { - if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) { + if ((g_vm->g_s._currPlace == ATTIC) || (g_vm->g_s._currPlace == CELLAR)) { cavegre(); } else if (g_vm->_currBitIndex == 10) { g_vm->_currBitIndex = 0; @@ -751,7 +716,7 @@ void tinke() { g_vm->getPresenceBitIndex(g_vm->_place); g_vm->_brt = false; g_hdb = 0; - if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) + if ((g_vm->g_s._currPlace > OWN_ROOM) && (g_vm->g_s._currPlace < DINING_ROOM)) g_vm->_anyone = true; } } @@ -822,17 +787,17 @@ void tlu(int af, int ob) { } void affrep() { - g_caff = g_s._currPlace; - g_crep = g_s._currPlace; + g_caff = g_vm->g_s._currPlace; + g_crep = g_vm->g_s._currPlace; } void tsort() { - if ((g_iouv > 0) && (g_s._currPlace != 0)) { - if (g_s._faithScore < 50) - g_s._faithScore += 2; + if ((g_iouv > 0) && (g_vm->g_s._currPlace != 0)) { + if (g_vm->g_s._faithScore < 50) + g_vm->g_s._faithScore += 2; else - g_s._faithScore += (g_s._faithScore / 10); + g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); } for (int cx = 1; cx <= 7; ++cx) @@ -840,7 +805,7 @@ void tsort() { g_ment = 0; g_iouv = 0; g_mchai = 0; - debloc(g_s._currPlace); + debloc(g_vm->g_s._currPlace); } void st4(int ob) { @@ -879,9 +844,9 @@ void modinv() { int cy = 0; for (int i = 1; i <= 6; ++i) { - if (g_s._sjer[i] != chr(0)) { + if (g_vm->g_s._sjer[i] != chr(0)) { ++cy; - r = (ord(g_s._sjer[i]) + 400); + r = (ord(g_vm->g_s._sjer[i]) + 400); nomp = g_vm->getString(r - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); @@ -901,7 +866,7 @@ void mennor() { } void premtet() { - dessine(g_ades, 10, 80); + g_vm->draw(g_ades, 10, 80); g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); } @@ -914,7 +879,7 @@ void ajchai() { } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_s._selectedObjectId; + g_tabdon[cy + cx] = g_vm->g_s._selectedObjectId; else g_crep = 192; } @@ -923,10 +888,10 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(g_vm->g_s._sjer[cx]) != 0)); - if (ord(g_s._sjer[cx]) == 0) { - g_s._sjer[(cx)] = chr(ob); + if (ord(g_vm->g_s._sjer[cx]) == 0) { + g_vm->g_s._sjer[(cx)] = chr(ob); modinv(); } else g_crep = 139; @@ -955,11 +920,11 @@ L1: g_vm->_speechManager.startSpeech(4, 4, 1); if (g_iouv == 0) - g_s._faithScore += 2; - else if (g_s._faithScore < 50) - g_s._faithScore += 4; + g_vm->g_s._faithScore += 2; + else if (g_vm->g_s._faithScore < 50) + g_vm->g_s._faithScore += 4; else - g_s._faithScore += 3 * (g_s._faithScore / 10); + g_vm->g_s._faithScore += 3 * (g_vm->g_s._faithScore / 10); tsort(); g_vm->_menu.setDestinationMenuText(LANDING); int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); @@ -1002,11 +967,11 @@ void tsuiv() { } while ((tbcl == 0) && (g_cs <= 9)); if ((tbcl != 0) && (g_cs < 11)) { - ++g_is; + ++g_vm->g_is; g_caff = tbcl; g_crep = g_caff + 400; if (g_vm->_currBitIndex != 0) - g_s._faithScore += 2; + g_vm->g_s._faithScore += 2; } else { affrep(); g_vm->endSearch(); @@ -1147,20 +1112,20 @@ void treg(int ob) { void avpoing(int &ob) { g_crep = 999; - if (g_s._selectedObjectId != 0) - ajjer(g_s._selectedObjectId); + if (g_vm->g_s._selectedObjectId != 0) + ajjer(g_vm->g_s._selectedObjectId); if (g_crep != 139) { modobj(ob + 400); - g_s._selectedObjectId = ob; + g_vm->g_s._selectedObjectId = ob; ob = 0; } } void rechai(int &ch) { - int tmpPlace = g_s._currPlace; + int tmpPlace = g_vm->g_s._currPlace; - if (g_s._currPlace == CRYPT) + if (g_vm->g_s._currPlace == CRYPT) tmpPlace = CELLAR; ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } @@ -1175,7 +1140,7 @@ int t23coul() { } void maivid() { - g_s._selectedObjectId = 0; + g_vm->g_s._selectedObjectId = 0; modobj(500); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index ebf9537992..de1b0b4a7d 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -42,7 +42,6 @@ static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; -extern void outbloc(int n, Pattern p, nhom *pal); extern void pictout(int seg, int dep, int x, int y); extern void sauvecr(int y, int dy); extern void charecr(int y, int dy); @@ -51,8 +50,6 @@ extern int animof(int ouf, int num); /* Niveau 14 suite */ extern int readclock(); extern void modif(int &nu); -extern void dessine(int ad, int x, int y); -extern void drawRightFrame(); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); extern void initouv(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index cd375970b7..866c8e42c9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -35,7 +35,6 @@ #include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/ovd1.h" #include "mortevielle/saveload.h" #include "mortevielle/outtext.h" #include "mortevielle/var_mor.h" @@ -180,7 +179,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _txxFileFl = false; // Load texts from TXX files - chartex(); + loadTexts(); // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); @@ -198,7 +197,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _currGraphicalDevice = MODE_EGA; _newGraphicalDevice = _currGraphicalDevice; - charpal(); + loadPalette(); loadCFIPH(); loadCFIEC(); decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); @@ -211,7 +210,7 @@ Common::ErrorCode MortevielleEngine::initialise() { _largestClearScreen = false; teskbd(); - dialpre(); + showConfigScreen(); _newGraphicalDevice = _currGraphicalDevice; teskbd(); if (_newGraphicalDevice != _currGraphicalDevice) @@ -551,7 +550,7 @@ void MortevielleEngine::showIntroduction() { CHECK_QUIT; // TODO: Once music is implemented, only use the below delay if music is turned off - suite(); + showTitleScreen(); delay(3000); music(); } @@ -2125,6 +2124,15 @@ void MortevielleEngine::showMoveMenuAlert() { Alert::show(getEngineString(S_USE_DEP_MENU), 1); } +/** + * The original engine used this method to display a starting text screen letting the player + * select the graphics mode to use + * @remarks Originally called 'dialpre' + */ +void MortevielleEngine::showConfigScreen() { + g_crep = 998; +} + /** * Decodes a number of 64 byte blocks * @param pStart Start of data @@ -2206,8 +2214,8 @@ Common::String MortevielleEngine::getString(int num) { if (num < 0) { warning("deline: num < 0! Skipping"); - } else if (!g_vm->_txxFileFl) { - wrkStr = g_vm->getGameString(num); + } else if (!_txxFileFl) { + wrkStr = getGameString(num); } else { int i = g_t_rec[num]._hintId; byte k = g_t_rec[num]._point; @@ -2253,7 +2261,7 @@ void MortevielleEngine::resetVariables() { g_s._secretPassageObjectId = 0; g_s._purpleRoomObjectId = 136; g_s._cryptObjectId = 141; - g_s._faithScore = g_vm->getRandomNumber(4, 10); + g_s._faithScore = getRandomNumber(4, 10); g_s._currPlace = MANOR_FRONT; for (int i = 2; i <= 6; ++i) @@ -2290,7 +2298,7 @@ void MortevielleEngine::resetVariables() { * @remarks Originally called 'writepal' */ void MortevielleEngine::setPal(int n) { - switch (g_vm->_currGraphicalDevice) { + switch (_currGraphicalDevice) { case MODE_TANDY: case MODE_EGA: case MODE_AMSTRAD1512: @@ -2302,14 +2310,14 @@ void MortevielleEngine::setPal(int n) { case MODE_CGA: { nhom pal[16]; for (int i = 0; i < 16; ++i) { - pal[i] = g_vm->_cgaPal[n]._a[i]; + pal[i] = _cgaPal[n]._a[i]; } if (n < 89) - palette(g_vm->_cgaPal[n]._p); + palette(_cgaPal[n]._p); for (int i = 0; i <= 15; ++i) - outbloc(i, _patternArr[pal[i]._id], pal); + displayCGAPattern(i, _patternArr[pal[i]._id], pal); } break; default: @@ -2317,4 +2325,230 @@ void MortevielleEngine::setPal(int n) { } } +/** + * Engine function - Display a CGA pattern, using a specified palette + * @remarks Originally called 'outbloc' + */ +void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { + int addr = n * 404 + 0xd700; + + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr], p._tax); + WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr + 2], p._tay); + addr += 4; + for (int i = 0; i < p._tax; ++i) { + for (int j = 0; j < p._tay; ++j) + g_mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + } +} + +/** + * Engine function - Load Palette from File + * @remarks Originally called 'charpal' + */ +void MortevielleEngine::loadPalette() { + Common::File f; + byte b; + + if (!f.open("fxx.mor")) + error("Missing file - fxx.mor"); + for (int i = 0; i < 108; ++i) + g_l[i] = f.readSint16LE(); + f.close(); + + if (!f.open("plxx.mor")) + error("Missing file - plxx.mor"); + for (int i = 0; i <= 90; ++i) { + for (int j = 1; j <= 16; ++j) { + _stdPal[i][j].x = f.readByte(); + _stdPal[i][j].y = f.readByte(); + } + } + f.close(); + + if (!f.open("cxx.mor")) + error("Missing file - cxx.mor"); + + for (int j = 0; j <= 90; ++j) { + _cgaPal[j]._p = f.readByte(); + for (int i = 0; i <= 15; ++i) { + nhom &with = _cgaPal[j]._a[i]; + + b = f.readByte(); + with._id = (uint)b >> 4; + with._hom[0] = ((uint)b >> 2) & 3; + with._hom[1] = b & 3; + } + } + + _cgaPal[10]._a[9] = _cgaPal[10]._a[5]; + for (int j = 0; j <= 14; ++j) { + _patternArr[j]._tax = f.readByte(); + _patternArr[j]._tay = f.readByte(); + for (int i = 1; i <= 20; ++i) { + for (int k = 1; k <= 20; ++k) + _patternArr[j]._des[i][k] = f.readByte(); + } + } + f.close(); +} + +/** + * Engine function - Load Texts from File + * @remarks Originally called 'chartex' + */ +void MortevielleEngine::loadTexts() { + Common::File inpFile; + Common::File ntpFile; + + _txxFileFl = false; + if (getLanguage() == Common::EN_ANY) { + warning("English version expected - Switching to DAT file"); + return; + } + + if (!inpFile.open("TXX.INP")) { + if (!inpFile.open("TXX.MOR")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + } + if (!ntpFile.open("TXX.NTP")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + + if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { + warning("TXX file - Unexpected format - Switching to DAT file"); + return; + } + + for (int i = 0; i < inpFile.size() / 2; ++i) + g_t_mot[i] = inpFile.readUint16LE(); + + inpFile.close(); + _txxFileFl = true; + + for (int i = 0; i < (ntpFile.size() / 3); ++i) { + g_t_rec[i]._hintId = ntpFile.readSint16LE(); + g_t_rec[i]._point = ntpFile.readByte(); + } + + ntpFile.close(); + +} + +void MortevielleEngine::loadBRUIT5() { + Common::File f; + + if (!f.open("bruit5")) + error("Missing file - bruit5"); + + f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128); + f.close(); +} + +void MortevielleEngine::loadCFIEC() { + Common::File f; + + if (!f.open("cfiec.mor")) + error("Missing file - cfiec.mor"); + + f.read(&g_adcfiec[0], 822 * 128); + f.close(); + + _reloadCFIEC = false; +} + + +void MortevielleEngine::loadCFIPH() { + Common::File f; + + if (!f.open("cfiph.mor")) + error("Missing file - cfiph.mor"); + + for (int i = 0; i < (f.size() / 2); ++i) + g_t_cph[i] = f.readSint16LE(); + + f.close(); +} + +/** + * Engine function - Play Music + * @remarks Originally called 'music' + */ +void MortevielleEngine::music() { + if (_soundOff) + return; + + _reloadCFIEC = true; + + Common::File fic; + if (!fic.open("mort.img")) + error("Missing file - mort.img"); + + fic.read(&g_mem[0x3800 * 16 + 0], 500); + fic.read(&g_mem[0x47a0 * 16 + 0], 123); + fic.close(); + + _soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); + _addfix = (float)((kTempoMusic - g_addv[1])) / 256; + _speechManager.cctable(g_tbi); + + bool fin = false; + int k = 0; + do { + fin = keyPressed(); + _soundManager.musyc(g_tbi, 9958, kTempoMusic); + ++k; + fin = fin | keyPressed() | (k >= 5); + } while (!fin); + while (keyPressed()) + getChar(); +} + +/** + * Engine function - Show title screen + * @remarks Originally called 'suite' + */ +void MortevielleEngine::showTitleScreen() { + hirs(); + repon(7, 2035); + g_caff = 51; + taffich(); + teskbd(); + if (_newGraphicalDevice != _currGraphicalDevice) + _currGraphicalDevice = _newGraphicalDevice; + hirs(); + g_vm->draw(g_ades, 0, 0); + + Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; + _screenSurface.putxy(104 + 72 * g_res, 185); + _screenSurface.drawString(cpr, 0); +} + +/** + * Draw picture + * @remarks Originally called 'dessine' + */ +void MortevielleEngine::draw(int ad, int x, int y) { + g_vm->_mouse.hideMouse(); + g_vm->setPal(g_numpal); + pictout(ad, 0, x, y); + g_vm->_mouse.showMouse(); +} + +/** + * Draw right frame + * @remarks Originally called 'dessine_rouleau' + */ +void MortevielleEngine::drawRightFrame() { + g_vm->setPal(89); + if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + g_mem[0x7000 * 16 + 14] = 15; + } + g_vm->_mouse.hideMouse(); + pictout(0x73a2, 0, 0, 0); + g_vm->_mouse.showMouse(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0bc6b09a87..b17d729296 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -90,6 +90,16 @@ const int amzon = 1650; const int fleche = 1758; const int arega = 0; +struct nhom { + byte _id; /* number between 0 and 32 */ + byte _hom[4]; +}; + +struct t_pcga { + byte _p; + nhom _a[16]; +}; + class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; @@ -101,6 +111,8 @@ private: Common::StringArray _engineStrings; Common::StringArray _gameStrings; + Pattern _patternArr[15]; + Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); void readStaticStrings(Common::File &f, int dataSize, DataType dataType); @@ -114,6 +126,14 @@ private: void handleAction(); void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); void copcha(); + void displayCGAPattern(int n, Pattern p, nhom *pal); + void loadPalette(); + void loadTexts(); + void loadBRUIT5(); + void loadCFIEC(); + void loadCFIPH(); + void showTitleScreen(); + public: Common::String _hintPctMessage; Common::Point _prevPos; @@ -163,6 +183,8 @@ public: int _c_zzz; int ptr_word; byte _v_lieu[7][25]; + SaveStruct g_s, g_s1; + byte g_is; ScreenSurface _screenSurface; PaletteManager _paletteManager; @@ -304,11 +326,14 @@ public: void clearScreenType10(); int getRandomNumber(int minval, int maxval); void showMoveMenuAlert(); + void showConfigScreen(); void decodeNumber(byte *pStart, int count); Common::String getString(int num); void resetVariables(); - void setPal(int n); + void music(); + void draw(int ad, int x, int y); + void drawRightFrame(); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 12c16f91b1..6a8aaff048 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -196,37 +196,37 @@ void taffich() { switch (a) { case 16: - g_s._pourc[9] = '*'; - g_s._teauto[42] = '*'; + g_vm->g_s._pourc[9] = '*'; + g_vm->g_s._teauto[42] = '*'; break; case 20: - g_s._teauto[39] = '*'; - if (g_s._teauto[36] == '*') { - g_s._pourc[3] = '*'; - g_s._teauto[38] = '*'; + g_vm->g_s._teauto[39] = '*'; + if (g_vm->g_s._teauto[36] == '*') { + g_vm->g_s._pourc[3] = '*'; + g_vm->g_s._teauto[38] = '*'; } break; case 24: - g_s._teauto[37] = '*'; + g_vm->g_s._teauto[37] = '*'; break; case 30: - g_s._teauto[9] = '*'; + g_vm->g_s._teauto[9] = '*'; break; case 31: - g_s._pourc[4] = '*'; - g_s._teauto[35] = '*'; + g_vm->g_s._pourc[4] = '*'; + g_vm->g_s._teauto[35] = '*'; break; case 118: - g_s._teauto[41] = '*'; + g_vm->g_s._teauto[41] = '*'; break; case 143: - g_s._pourc[1] = '*'; + g_vm->g_s._pourc[1] = '*'; break; case 150: - g_s._teauto[34] = '*'; + g_vm->g_s._teauto[34] = '*'; break; case 151: - g_s._pourc[2] = '*'; + g_vm->g_s._pourc[2] = '*'; break; default: break; @@ -249,7 +249,7 @@ void taffich() { m = 2018; if (a > 99) { - if ((g_is == 1) || (g_is == 0)) + if ((g_vm->g_is == 1) || (g_vm->g_is == 0)) m = 2031; else m = 2032; @@ -258,7 +258,7 @@ void taffich() { if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) m = 2030; - if (((a < 27) && (((g_maff > 69) && (!g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + if (((a < 27) && (((g_maff > 69) && (!g_vm->g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; g_maff = a; @@ -333,11 +333,11 @@ void taffich() { charani(filename, lgt, handle); } g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_vm->g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) - cx = t11(g_s._currPlace); + cx = t11(g_vm->g_s._currPlace); g_mpers = 0; } } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp deleted file mode 100644 index 178ef434ae..0000000000 --- a/engines/mortevielle/ovd1.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/file.h" -#include "mortevielle/dialogs.h" -#include "mortevielle/keyboard.h" -#include "mortevielle/menu.h" -#include "mortevielle/mor.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" -#include "mortevielle/ovd1.h" -#include "mortevielle/speech.h" -#include "mortevielle/sound.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -void charpal() { - Common::File f; - byte b; - - if (!f.open("fxx.mor")) - error("Missing file - fxx.mor"); - for (int i = 0; i < 108; ++i) - g_l[i] = f.readSint16LE(); - f.close(); - - if (!f.open("plxx.mor")) - error("Missing file - plxx.mor"); - for (int i = 0; i <= 90; ++i) { - for (int j = 1; j <= 16; ++j) { - g_vm->_stdPal[i][j].x = f.readByte(); - g_vm->_stdPal[i][j].y = f.readByte(); - } - } - f.close(); - - if (!f.open("cxx.mor")) - error("Missing file - cxx.mor"); - - for (int j = 0; j <= 90; ++j) { - g_vm->_cgaPal[j]._p = f.readByte(); - for (int i = 0; i <= 15; ++i) { - nhom &with = g_vm->_cgaPal[j]._a[i]; - - b = f.readByte(); - with._id = (uint)b >> 4; - with._hom[0] = ((uint)b >> 2) & 3; - with._hom[1] = b & 3; - } - } - - g_vm->_cgaPal[10]._a[9] = g_vm->_cgaPal[10]._a[5]; - for (int j = 0; j <= 14; ++j) { - _patternArr[j]._tax = f.readByte(); - _patternArr[j]._tay = f.readByte(); - for (int i = 1; i <= 20; ++i) - for (int k = 1; k <= 20; ++k) - _patternArr[j]._des[i][k] = f.readByte(); - } - f.close(); -} - -void chartex() { - Common::File inpFile; - Common::File ntpFile; - - g_vm->_txxFileFl = false; - if (g_vm->getLanguage() == Common::EN_ANY) { - warning("English version expected - Switching to DAT file"); - return; - } - - if (!inpFile.open("TXX.INP")) { - if (!inpFile.open("TXX.MOR")) { - warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; - } - } - if (!ntpFile.open("TXX.NTP")) { - warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; - } - - if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { - warning("TXX file - Unexpected format - Switching to DAT file"); - return; - } - - for (int i = 0; i < inpFile.size() / 2; ++i) - g_t_mot[i] = inpFile.readUint16LE(); - - inpFile.close(); - g_vm->_txxFileFl = true; - - for (int i = 0; i < (ntpFile.size() / 3); ++i) { - g_t_rec[i]._hintId = ntpFile.readSint16LE(); - g_t_rec[i]._point = ntpFile.readByte(); - } - - ntpFile.close(); - -} - -/** - * The original engine used this method to display a starting text screen letting the player - * select the graphics mode to use - */ -void dialpre() { - /* debug('o3 dialpre'); */ - g_crep = 998; -} - -void music() { - if (g_vm->_soundOff) - return; - - g_vm->_reloadCFIEC = true; - - Common::File fic; - if (!fic.open("mort.img")) - error("Missing file - mort.img"); - - fic.read(&g_mem[0x3800 * 16 + 0], 500); - fic.read(&g_mem[0x47a0 * 16 + 0], 123); - fic.close(); - - g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); - g_vm->_addfix = (float)((kTempoMusic - g_addv[1])) / 256; - g_vm->_speechManager.cctable(g_tbi); - - bool fin = false; - int k = 0; - do { - fin = g_vm->keyPressed(); - g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic); - ++k; - fin = fin | g_vm->keyPressed() | (k >= 5); - } while (!fin); - while (g_vm->keyPressed()) - g_vm->getChar(); -} - - -void loadBRUIT5() { - Common::File f; - - if (!f.open("bruit5")) - error("Missing file - bruit5"); - - f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128); - f.close(); -} - -void loadCFIEC() { - Common::File f; - - if (!f.open("cfiec.mor")) - error("Missing file - cfiec.mor"); - - f.read(&g_adcfiec[0], 822 * 128); - f.close(); - - g_vm->_reloadCFIEC = false; -} - - -void loadCFIPH() { - Common::File f; - - if (!f.open("cfiph.mor")) - error("Missing file - cfiph.mor"); - - for (int i = 0; i < (f.size() / 2); ++i) - g_t_cph[i] = f.readSint16LE(); - - f.close(); -} - -void suite() { - hirs(); - repon(7, 2035); - g_caff = 51; - taffich(); - teskbd(); - if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) - g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; - hirs(); - dessine(g_ades, 0, 0); - - Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - g_vm->_screenSurface.putxy(104 + 72 * g_res, 185); - g_vm->_screenSurface.drawString(cpr, 0); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h deleted file mode 100644 index 90f9c0d235..0000000000 --- a/engines/mortevielle/ovd1.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_OVD1_H -#define MORTEVIELLE_OVD1_H - -namespace Mortevielle { - -extern void charpal(); -extern void chartex(); -extern void dialpre(); -extern void music(); -extern void loadBRUIT5(); -extern void loadCFIEC(); -extern void loadCFIPH(); -extern void suite(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 7ddd8b707c..c99804f34c 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -31,7 +31,6 @@ #include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" -#include "mortevielle/ovd1.h" #include "mortevielle/saveload.h" #include "mortevielle/var_mor.h" @@ -47,25 +46,25 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { * Handle saving or loading savegame data */ void SavegameManager::sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(g_s1._faithScore); + sz.syncAsSint16LE(g_vm->g_s1._faithScore); for (int i = 0; i < 11; ++i) - sz.syncAsByte(g_s1._pourc[i]); + sz.syncAsByte(g_vm->g_s1._pourc[i]); for (int i = 0; i < 43; ++i) - sz.syncAsByte(g_s1._teauto[i]); + sz.syncAsByte(g_vm->g_s1._teauto[i]); for (int i = 0; i < 31; ++i) - sz.syncAsByte(g_s1._sjer[i]); - - sz.syncAsSint16LE(g_s1._currPlace); - sz.syncAsSint16LE(g_s1._atticBallHoleObjectId); - sz.syncAsSint16LE(g_s1._atticRodHoleObjectId); - sz.syncAsSint16LE(g_s1._cellarObjectId); - sz.syncAsSint16LE(g_s1._secretPassageObjectId); - sz.syncAsSint16LE(g_s1._wellObjectId); - sz.syncAsSint16LE(g_s1._selectedObjectId); - sz.syncAsSint16LE(g_s1._purpleRoomObjectId); - sz.syncAsSint16LE(g_s1._cryptObjectId); - sz.syncAsByte(g_s1._alreadyEnteredManor); - sz.syncAsByte(g_s1._fullHour); + sz.syncAsByte(g_vm->g_s1._sjer[i]); + + sz.syncAsSint16LE(g_vm->g_s1._currPlace); + sz.syncAsSint16LE(g_vm->g_s1._atticBallHoleObjectId); + sz.syncAsSint16LE(g_vm->g_s1._atticRodHoleObjectId); + sz.syncAsSint16LE(g_vm->g_s1._cellarObjectId); + sz.syncAsSint16LE(g_vm->g_s1._secretPassageObjectId); + sz.syncAsSint16LE(g_vm->g_s1._wellObjectId); + sz.syncAsSint16LE(g_vm->g_s1._selectedObjectId); + sz.syncAsSint16LE(g_vm->g_s1._purpleRoomObjectId); + sz.syncAsSint16LE(g_vm->g_s1._cryptObjectId); + sz.syncAsByte(g_vm->g_s1._alreadyEnteredManor); + sz.syncAsByte(g_vm->g_s1._fullHour); sz.syncBytes(g_bufcha, 391); } @@ -107,7 +106,7 @@ void SavegameManager::loadSavegame(int n) { Common::Serializer sz(stream, NULL); sync_save(sz); - g_s = g_s1; + g_vm->g_s = g_vm->g_s1; for (int i = 0; i <= 389; ++i) g_tabdon[i + kAcha] = g_bufcha[i]; @@ -143,9 +142,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { for (i = 0; i <= 389; ++i) g_bufcha[i] = g_tabdon[i + kAcha]; - g_s1 = g_s; - if (g_s1._currPlace == 26) - g_s1._currPlace = 15; + g_vm->g_s1 = g_vm->g_s; + if (g_vm->g_s1._currPlace == 26) + g_vm->g_s1._currPlace = 15; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index b3999b7c6f..a601c45a94 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -101,7 +101,6 @@ int g_x, int g_t_cph[6401]; byte g_tabdon[4001]; -byte g_is; int g_nbrep[9]; int g_nbrepm[9]; @@ -112,13 +111,11 @@ byte g_bufcha[391]; byte g_lettres[7][24]; -uint16 g_t_mot[maxti + 1]; +uint16 g_t_mot[kMaxTi + 1]; int g_tay_tchar; -Hint g_t_rec[maxtd + 1]; +Hint g_t_rec[kMaxTd + 1]; int g_l[108]; int g_tbi[256]; -t_pcga g_palcga[91]; -Pattern _patternArr[15]; byte g_adcfiec[(4088 * 16) + (311 * 0x80)]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index b6897522b9..178ca2d989 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -64,8 +64,8 @@ namespace Mortevielle { /*------------------------- CONSTANTS ----------------------------------*/ /*---------------------------------------------------------------------------*/ -const int maxti = 7975; -const int maxtd = 600; +const int kMaxTi = 7975; +const int kMaxTd = 600; const int kDescriptionStringIndex = 0; // Unused const int kInventoryStringIndex = 186; @@ -150,16 +150,6 @@ struct Pattern { byte _des[kMaxPatt + 1][kMaxPatt + 1]; }; -struct nhom { - byte _id; /* number between 0 and 32 */ - byte _hom[4]; -}; - -struct t_pcga { - byte _p; - nhom _a[16]; -}; - typedef int tablint[256]; //typedef Common::Point tabdb[17]; typedef int tfxx[108]; @@ -210,23 +200,19 @@ extern int g_x, extern int g_t_cph[6401]; // Speech extern byte g_tabdon[4001]; -extern byte g_is; - extern int g_nbrep[9]; extern int g_nbrepm[9]; extern int g_msg[5]; extern byte g_touv[8]; -extern SaveStruct g_s, g_s1; extern byte g_bufcha[391]; extern byte g_lettres[7][24]; -extern uint16 g_t_mot[maxti + 1]; +extern uint16 g_t_mot[kMaxTi + 1]; extern int g_tay_tchar; -extern Hint g_t_rec[maxtd + 1]; +extern Hint g_t_rec[kMaxTd + 1]; extern int g_l[108]; extern int g_tbi[256]; -extern Pattern _patternArr[15]; extern byte g_adcfiec[822 * 128]; @@ -245,9 +231,6 @@ void Val(const Common::String &s, int &V, int Code); extern int g_port[0xfff]; extern byte g_mem[65536 * 16]; - -#define hires {} - extern void palette(int v1); } // End of namespace Mortevielle -- cgit v1.2.3 From 1a9183e0ba06e13ed1385e893ea7287412645fba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Mar 2012 08:36:59 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 506 ++++++++++++++++++------------------ engines/mortevielle/menu.cpp | 6 +- engines/mortevielle/menu.h | 2 + engines/mortevielle/mor.cpp | 300 +++------------------ engines/mortevielle/mor.h | 4 - engines/mortevielle/mortevielle.cpp | 346 +++++++++++++++++++----- engines/mortevielle/mortevielle.h | 28 +- engines/mortevielle/outtext.cpp | 34 +-- engines/mortevielle/saveload.cpp | 40 +-- engines/mortevielle/speech.h | 8 + engines/mortevielle/var_mor.cpp | 1 - engines/mortevielle/var_mor.h | 34 --- 12 files changed, 655 insertions(+), 654 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9479ad5445..3d92db84be 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,13 +42,13 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((g_s._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { - g_s._currPlace = LANDING; - g_caff = g_s._currPlace; + if ((_coreVar._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { + _coreVar._currPlace = LANDING; + g_caff = _coreVar._currPlace; afdes(); - repon(2, g_s._currPlace); + repon(2, _coreVar._currPlace); } - if ((g_s._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { if (!_syn) ecr3(getEngineString(S_GO_TO)); tfleche(); @@ -65,15 +65,15 @@ void MortevielleEngine::fctMove() { return; if (g_num == 1) { - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; _menu.setDestinationMenuText(OWN_ROOM); } else if (g_num == 7) { - g_s._currPlace = ATTIC; + _coreVar._currPlace = ATTIC; _menu.setDestinationMenuText(ATTIC); } if (g_num != 6) - g_s._currPlace = ROOM26; + _coreVar._currPlace = ROOM26; if ((g_num > 1) && (g_num < 6)) g_ment = g_num - 1; @@ -92,55 +92,55 @@ void MortevielleEngine::fctMove() { while (_menu._moveMenu[menuChoice] != g_msg[4]) ++menuChoice; - if (g_s._currPlace == MOUNTAIN) { + if (_coreVar._currPlace == MOUNTAIN) { if (menuChoice == 1) gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); return; - } else if (g_s._currPlace == INSIDE_WELL) { + } else if (_coreVar._currPlace == INSIDE_WELL) { if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); return; - } else if ((g_s._currPlace == BUREAU) && (menuChoice == 1)) + } else if ((_coreVar._currPlace == BUREAU) && (menuChoice == 1)) menuChoice = 6; - else if (g_s._currPlace == KITCHEN) { + else if (_coreVar._currPlace == KITCHEN) { if (menuChoice == 2) menuChoice = 6; else if (menuChoice == 5) menuChoice = 16; - } else if ((g_s._currPlace == CELLAR) && (menuChoice == 3)) + } else if ((_coreVar._currPlace == CELLAR) && (menuChoice == 3)) menuChoice = 6; - else if (((g_s._currPlace == LANDING) || (g_s._currPlace == ROOM26)) && (menuChoice == 4)) + else if (((_coreVar._currPlace == LANDING) || (_coreVar._currPlace == ROOM26)) && (menuChoice == 4)) menuChoice = 6; - if ((g_s._currPlace > MOUNTAIN) && (g_s._currPlace != ROOM26)) + if ((_coreVar._currPlace > MOUNTAIN) && (_coreVar._currPlace != ROOM26)) menuChoice += 10; - if ((g_s._currPlace == CHAPEL) && (menuChoice == 13)) + if ((_coreVar._currPlace == CHAPEL) && (menuChoice == 13)) menuChoice = 16; - else if (g_s._currPlace == MANOR_FRONT) { + else if (_coreVar._currPlace == MANOR_FRONT) { if (menuChoice == 12) menuChoice = 16; else if (menuChoice > 13) menuChoice = 15; - } else if ((g_s._currPlace == MANOR_BACK) && (menuChoice > 14)) + } else if ((_coreVar._currPlace == MANOR_BACK) && (menuChoice > 14)) menuChoice = 15; - else if ((g_s._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17)) + else if ((_coreVar._currPlace == WELL) && (menuChoice > 13) && (menuChoice != 17)) menuChoice = 15; if (menuChoice == 1) - g_s._currPlace = BUREAU; + _coreVar._currPlace = BUREAU; else if (menuChoice == 2) - g_s._currPlace = KITCHEN; + _coreVar._currPlace = KITCHEN; else if (menuChoice == 3) - g_s._currPlace = CELLAR; + _coreVar._currPlace = CELLAR; else if (menuChoice == 4) - g_s._currPlace = LANDING; + _coreVar._currPlace = LANDING; else if (menuChoice == 5) menuChoice = 12; else if (menuChoice == 6) @@ -151,30 +151,30 @@ void MortevielleEngine::fctMove() { else if (menuChoice == 12) gotoManorFront(); else if (menuChoice == 13) - g_s._currPlace = CHAPEL; + _coreVar._currPlace = CHAPEL; else if (menuChoice == 14) - g_s._currPlace = WELL; + _coreVar._currPlace = WELL; else if (menuChoice == 15) checkManorDistance(); else if (menuChoice == 16) gotoManorBack(); else if (menuChoice == 17) { - if ((g_s._wellObjectId != 120) && (g_s._wellObjectId != 140)) + if ((_coreVar._wellObjectId != 120) && (_coreVar._wellObjectId != 140)) g_crep = 997; - else if (g_s._wellObjectId == 120) + else if (_coreVar._wellObjectId == 120) g_crep = 181; - else if (g_s._faithScore > 80) { + else if (_coreVar._faithScore > 80) { g_crep = 1505; loseGame(); } else { - g_s._currPlace = INSIDE_WELL; + _coreVar._currPlace = INSIDE_WELL; affrep(); } } if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) affrep(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); } /** @@ -187,24 +187,24 @@ void MortevielleEngine::fctTake() { avpoing(cx); if (g_crep != 139) { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; if (_obpart) { - if (g_s._currPlace == PURPLE_ROOM) - g_s._purpleRoomObjectId = 0; - if (g_s._currPlace == ATTIC) { - if (g_s._atticBallHoleObjectId == g_caff) - g_s._atticBallHoleObjectId = 0; - if (g_s._atticRodHoleObjectId == g_caff) - g_s._atticRodHoleObjectId = 0; + if (_coreVar._currPlace == PURPLE_ROOM) + _coreVar._purpleRoomObjectId = 0; + if (_coreVar._currPlace == ATTIC) { + if (_coreVar._atticBallHoleObjectId == g_caff) + _coreVar._atticBallHoleObjectId = 0; + if (_coreVar._atticRodHoleObjectId == g_caff) + _coreVar._atticRodHoleObjectId = 0; } - if (g_s._currPlace == CELLAR) - g_s._cellarObjectId = 0; - if (g_s._currPlace == CRYPT) - g_s._cryptObjectId = 0; - if (g_s._currPlace == SECRET_PASSAGE) - g_s._secretPassageObjectId = 0; - if (g_s._currPlace == WELL) - g_s._wellObjectId = 0; + if (_coreVar._currPlace == CELLAR) + _coreVar._cellarObjectId = 0; + if (_coreVar._currPlace == CRYPT) + _coreVar._cryptObjectId = 0; + if (_coreVar._currPlace == SECRET_PASSAGE) + _coreVar._secretPassageObjectId = 0; + if (_coreVar._currPlace == WELL) + _coreVar._wellObjectId = 0; _menu.unsetSearchMenu(); _obpart = false; affrep(); @@ -213,7 +213,7 @@ void MortevielleEngine::fctTake() { tsuiv(); ++g_dobj; if (g_dobj > 6) { - g_s._faithScore += 2; + _coreVar._faithScore += 2; g_dobj = 0; } } @@ -233,41 +233,41 @@ void MortevielleEngine::fctTake() { } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (g_s._currPlace == CRYPT))) { + if ((g_num == 0) || ((g_num == 1) && (_coreVar._currPlace == CRYPT))) { tcoord(8); if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; g_crep = 997; - if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) - avpoing(g_s._purpleRoomObjectId); - if ((g_s._currPlace == ATTIC) && (g_num == 1) && (g_s._atticBallHoleObjectId != 0)) { - avpoing(g_s._atticBallHoleObjectId); + if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) + avpoing(_coreVar._purpleRoomObjectId); + if ((_coreVar._currPlace == ATTIC) && (g_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { + avpoing(_coreVar._atticBallHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 7); } - if ((g_s._currPlace == ATTIC) && (g_num == 2) && (g_s._atticRodHoleObjectId != 0)) { - avpoing(g_s._atticRodHoleObjectId); + if ((_coreVar._currPlace == ATTIC) && (g_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { + avpoing(_coreVar._atticRodHoleObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 6); } - if ((g_s._currPlace == CELLAR) && (g_s._cellarObjectId != 0)) { - avpoing(g_s._cellarObjectId); + if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { + avpoing(_coreVar._cellarObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 2); } - if ((g_s._currPlace == CRYPT) && (g_s._cryptObjectId != 0)) - avpoing(g_s._cryptObjectId); + if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) + avpoing(_coreVar._cryptObjectId); - if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId != 0)) { - avpoing(g_s._secretPassageObjectId); + if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) { + avpoing(_coreVar._secretPassageObjectId); if ((g_crep != 997) && (g_crep != 139)) { g_crep = 182; aniof(2, 1); } } - if ((g_s._currPlace == WELL) && (g_s._wellObjectId != 0)) { - avpoing(g_s._wellObjectId); + if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { + avpoing(_coreVar._wellObjectId); if ((g_crep != 997) && (g_crep != 139)) aniof(2, 1); } @@ -275,22 +275,22 @@ void MortevielleEngine::fctTake() { g_crep = 999; } } else { - if ( ((g_s._currPlace == OWN_ROOM) && (g_num == 3)) - || ((g_s._currPlace == GREEN_ROOM) && (g_num == 4)) - || ((g_s._currPlace == PURPLE_ROOM) && (g_num == 1)) - || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 3)) - || ((g_s._currPlace == BLUE_ROOM) && (g_num == 6)) - || ((g_s._currPlace == RED_ROOM) && (g_num == 2)) - || ((g_s._currPlace == BATHROOM) && (g_num == 6)) - || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 4)) - || ((g_s._currPlace == ROOM9) && (g_num == 4)) - || ((g_s._currPlace == DINING_ROOM) && (g_num > 2)) - || ((g_s._currPlace == BUREAU) && (g_num == 7)) - || ((g_s._currPlace == KITCHEN) && (g_num == 6)) - || ((g_s._currPlace == ATTIC) && (g_num > 4)) - || ((g_s._currPlace > ATTIC) && (g_s._currPlace != INSIDE_WELL)) ) + if ( ((_coreVar._currPlace == OWN_ROOM) && (g_num == 3)) + || ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 4)) + || ((_coreVar._currPlace == PURPLE_ROOM) && (g_num == 1)) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 3)) + || ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 6)) + || ((_coreVar._currPlace == RED_ROOM) && (g_num == 2)) + || ((_coreVar._currPlace == BATHROOM) && (g_num == 6)) + || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 4)) + || ((_coreVar._currPlace == ROOM9) && (g_num == 4)) + || ((_coreVar._currPlace == DINING_ROOM) && (g_num > 2)) + || ((_coreVar._currPlace == BUREAU) && (g_num == 7)) + || ((_coreVar._currPlace == KITCHEN) && (g_num == 6)) + || ((_coreVar._currPlace == ATTIC) && (g_num > 4)) + || ((_coreVar._currPlace > ATTIC) && (_coreVar._currPlace != INSIDE_WELL)) ) g_crep = 997; - else if (g_s._currPlace == INSIDE_WELL) { + else if (_coreVar._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); } else @@ -312,11 +312,11 @@ void MortevielleEngine::fctInventoryTake() { cy = 0; do { ++cy; - if (ord(g_s._sjer[cy]) != 0) + if (ord(_coreVar._sjer[cy]) != 0) ++cz; } while (cz != cx); - cz = ord(g_s._sjer[cy]); - g_s._sjer[cy] = chr(0); + cz = ord(_coreVar._sjer[cy]); + _coreVar._sjer[cy] = chr(0); modinv(); avpoing(cz); g_crep = 998; @@ -338,19 +338,19 @@ void MortevielleEngine::fctLift() { tcoord(8); if (g_num != 0) { if (_currBitIndex > 0) - ++g_s._faithScore; + ++_coreVar._faithScore; g_crep = 997; - if ((g_s._currPlace == PURPLE_ROOM) && (g_s._purpleRoomObjectId != 0)) - treg(g_s._purpleRoomObjectId); + if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) + treg(_coreVar._purpleRoomObjectId); } return; } if (_currBitIndex > 0) - ++g_s._faithScore; - int tmpPlace = g_s._currPlace; - if (g_s._currPlace == CRYPT) + ++_coreVar._faithScore; + int tmpPlace = _coreVar._currPlace; + if (_coreVar._currPlace == CRYPT) tmpPlace = 14; - else if (g_s._currPlace == MOUNTAIN) + else if (_coreVar._currPlace == MOUNTAIN) tmpPlace = 15; g_crep = g_tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; if (g_crep == 255) @@ -381,10 +381,10 @@ void MortevielleEngine::fctRead() { * @remarks Originally called 'tslire' */ void MortevielleEngine::fctSelfRead() { - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else - st4(g_s._selectedObjectId); + st4(_coreVar._selectedObjectId); } /** @@ -408,60 +408,60 @@ void MortevielleEngine::fctLook() { tcoord(8); g_crep = 131; if (g_num != 0) { - if (g_s._currPlace == ATTIC) { + if (_coreVar._currPlace == ATTIC) { if (g_num == 1) { g_crep = 164; - if (g_s._atticRodHoleObjectId != 0) - treg(g_s._atticRodHoleObjectId); - else if (g_s._atticBallHoleObjectId != 0) - treg(g_s._atticBallHoleObjectId); + if (_coreVar._atticRodHoleObjectId != 0) + treg(_coreVar._atticRodHoleObjectId); + else if (_coreVar._atticBallHoleObjectId != 0) + treg(_coreVar._atticBallHoleObjectId); } else { g_crep = 193; - if (g_s._atticRodHoleObjectId != 0) - treg(g_s._atticRodHoleObjectId); + if (_coreVar._atticRodHoleObjectId != 0) + treg(_coreVar._atticRodHoleObjectId); } } - if (g_s._currPlace == CELLAR) { + if (_coreVar._currPlace == CELLAR) { g_crep = 164; - if (g_s._cellarObjectId != 0) - treg(g_s._cellarObjectId); + if (_coreVar._cellarObjectId != 0) + treg(_coreVar._cellarObjectId); } - if (g_s._currPlace == SECRET_PASSAGE) { + if (_coreVar._currPlace == SECRET_PASSAGE) { g_crep = 174; - if (g_s._secretPassageObjectId != 0) - treg(g_s._secretPassageObjectId); + if (_coreVar._secretPassageObjectId != 0) + treg(_coreVar._secretPassageObjectId); } - if (g_s._currPlace == WELL) { + if (_coreVar._currPlace == WELL) { g_crep = 131; - if (g_s._wellObjectId != 0) - treg(g_s._wellObjectId); + if (_coreVar._wellObjectId != 0) + treg(_coreVar._wellObjectId); } } return; } - cx = g_s._currPlace; - if (g_s._currPlace == CHAPEL) + cx = _coreVar._currPlace; + if (_coreVar._currPlace == CHAPEL) cx = 17; - if ((g_s._currPlace > MANOR_FRONT) && (g_s._currPlace < DOOR)) + if ((_coreVar._currPlace > MANOR_FRONT) && (_coreVar._currPlace < DOOR)) cx -= 4; - if (g_s._currPlace == ROOM26) + if (_coreVar._currPlace == ROOM26) cx = 21; g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; - if ((g_s._currPlace == ATTIC) && (g_num == 8)) + if ((_coreVar._currPlace == ATTIC) && (g_num == 8)) g_crep = 126; - if (g_s._currPlace == MOUNTAIN) + if (_coreVar._currPlace == MOUNTAIN) g_crep = 103; if (g_crep == 255) g_crep = 131; - if ((g_s._currPlace == GREEN_ROOM) && (g_num == 1)) + if ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 1)) treg(144); - if ((g_s._currPlace == BLUE_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 3)) treg(147); - if ((g_s._currPlace == GREEN_ROOM2) && (g_num == 3)) + if ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 3)) treg(149); - if ((g_s._currPlace == 9) && (g_num == 2)) + if ((_coreVar._currPlace == 9) && (g_num == 2)) treg(30); - if ((g_s._currPlace == DINING_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == DINING_ROOM) && (g_num == 3)) treg(31); } @@ -470,8 +470,8 @@ void MortevielleEngine::fctLook() { * @remarks Originally called 'tsregarder' */ void MortevielleEngine::fctSelftLook() { - if (g_s._selectedObjectId != 0) - treg(g_s._selectedObjectId); + if (_coreVar._selectedObjectId != 0) + treg(_coreVar._selectedObjectId); else g_crep = 186; } @@ -495,7 +495,7 @@ void MortevielleEngine::fctSearch() { if (_anyone || _keyPressedEsc) return; - if (g_s._currPlace == INSIDE_WELL) { + if (_coreVar._currPlace == INSIDE_WELL) { g_crep = 1504; loseGame(); return; @@ -513,7 +513,7 @@ void MortevielleEngine::fctSearch() { g_crep = 187; else { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; rechai(g_mchai); if (g_mchai != 0) { @@ -530,41 +530,41 @@ void MortevielleEngine::fctSearch() { g_crep = 997; if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 3; - if ((g_s._currPlace != WELL) && (g_s._currPlace != SECRET_PASSAGE) && (g_s._currPlace != ATTIC)) { - if (g_s._currPlace == PURPLE_ROOM) { + _coreVar._faithScore += 3; + if ((_coreVar._currPlace != WELL) && (_coreVar._currPlace != SECRET_PASSAGE) && (_coreVar._currPlace != ATTIC)) { + if (_coreVar._currPlace == PURPLE_ROOM) { g_crep = 123; - if (g_s._purpleRoomObjectId != 0) - treg(g_s._purpleRoomObjectId); + if (_coreVar._purpleRoomObjectId != 0) + treg(_coreVar._purpleRoomObjectId); } - if (g_s._currPlace == CRYPT) { + if (_coreVar._currPlace == CRYPT) { g_crep = 123; - if (g_s._cryptObjectId != 0) - treg(g_s._cryptObjectId); + if (_coreVar._cryptObjectId != 0) + treg(_coreVar._cryptObjectId); } } } } } else { if (_currBitIndex > 0) - g_s._faithScore += 3; + _coreVar._faithScore += 3; g_crep = 997; - if (g_s._currPlace < CELLAR) - g_crep = r[g_s._currPlace]; + if (_coreVar._currPlace < CELLAR) + g_crep = r[_coreVar._currPlace]; - if ((g_s._currPlace == TOILETS) && (g_num == 2)) + if ((_coreVar._currPlace == TOILETS) && (g_num == 2)) g_crep = 162; - if (g_s._currPlace == KITCHEN) { + if (_coreVar._currPlace == KITCHEN) { if ((g_num == 3) || (g_num == 4)) g_crep = 162; else if (g_num == 5) g_crep = 159; } - if (g_s._currPlace == MOUNTAIN) + if (_coreVar._currPlace == MOUNTAIN) g_crep = 104; - else if (g_s._currPlace == CRYPT) + else if (_coreVar._currPlace == CRYPT) g_crep = 155; } } @@ -574,8 +574,8 @@ void MortevielleEngine::fctSearch() { * @remarks Originally called 'tsfouiller' */ void MortevielleEngine::fctSelfSearch() { - if (g_s._selectedObjectId != 0) - st7(g_s._selectedObjectId); + if (_coreVar._selectedObjectId != 0) + st7(_coreVar._selectedObjectId); else g_crep = 186; } @@ -609,30 +609,30 @@ void MortevielleEngine::fctOpen() { tcoord(7); if (g_num != 0) { if (_currBitIndex > 0) - g_s._faithScore += 2; + _coreVar._faithScore += 2; ++g_iouv; int tmpPlace = 0; do { ++tmpPlace; } while (!((tmpPlace > 6) || (ord(g_touv[tmpPlace]) == 0) || (ord(g_touv[tmpPlace]) == g_num))); if (ord(g_touv[tmpPlace]) != g_num) { - if (!( ((g_num == 3) && ((g_s._currPlace == OWN_ROOM) || (g_s._currPlace == 9) || (g_s._currPlace == BLUE_ROOM) || (g_s._currPlace == BATHROOM))) - || ((g_num == 4) && ((g_s._currPlace == GREEN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == RED_ROOM))) - || ((g_s._currPlace == DARKBLUE_ROOM) && (g_num == 5)) - || ((g_num == 6) && ((g_s._currPlace == BATHROOM) || (g_s._currPlace == DINING_ROOM) || (g_s._currPlace == GREEN_ROOM2) || (g_s._currPlace == ATTIC))) - || ((g_s._currPlace == GREEN_ROOM2) && (g_num == 2)) - || ((g_s._currPlace == KITCHEN) && (g_num == 7))) ) { - if ( ((g_s._currPlace > DINING_ROOM) && (g_s._currPlace < CELLAR)) - || ((g_s._currPlace > RED_ROOM) && (g_s._currPlace < DINING_ROOM)) - || (g_s._currPlace == OWN_ROOM) || (g_s._currPlace == PURPLE_ROOM) || (g_s._currPlace == BLUE_ROOM)) { + if (!( ((g_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) + || ((g_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 5)) + || ((g_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) + || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 2)) + || ((_coreVar._currPlace == KITCHEN) && (g_num == 7))) ) { + if ( ((_coreVar._currPlace > DINING_ROOM) && (_coreVar._currPlace < CELLAR)) + || ((_coreVar._currPlace > RED_ROOM) && (_coreVar._currPlace < DINING_ROOM)) + || (_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } g_touv[tmpPlace] = chr(g_num); aniof(1, g_num); } - tmpPlace = g_s._currPlace; - if (g_s._currPlace == CRYPT) + tmpPlace = _coreVar._currPlace; + if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; g_crep = g_tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; if (g_crep == 254) @@ -647,7 +647,7 @@ void MortevielleEngine::fctOpen() { * @remarks Originally called 'tmettre' */ void MortevielleEngine::fctPlace() { - if (g_s._selectedObjectId == 0) { + if (_coreVar._selectedObjectId == 0) { g_crep = 186; return; } @@ -667,28 +667,28 @@ void MortevielleEngine::fctPlace() { g_crep = 999; if (g_caff == 13) { if (g_num == 1) { - if (g_s._atticBallHoleObjectId != 0) { + if (_coreVar._atticBallHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticBallHoleObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 141) + _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 141) aniof(1, 7); } - } else if (g_s._atticRodHoleObjectId != 0) { + } else if (_coreVar._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticRodHoleObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 159) + _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 159) aniof(1, 6); } } if (g_caff == 14) { - if (g_s._cellarObjectId != 0) { + if (_coreVar._cellarObjectId != 0) { g_crep = 188; } else { - g_s._cellarObjectId = g_s._selectedObjectId; - if (g_s._selectedObjectId == 151) { + _coreVar._cellarObjectId = _coreVar._selectedObjectId; + if (_coreVar._selectedObjectId == 151) { // Open hidden passage aniof(1, 2); aniof(1, 1); @@ -709,7 +709,7 @@ void MortevielleEngine::fctPlace() { clearScreenType2(); clearScreenType3(); _mouse.showMouse(); - tinke(); + prepareRoom(); drawClock(); if (_currBitIndex != 0) showPeoplePresent(_currBitIndex); @@ -718,10 +718,10 @@ void MortevielleEngine::fctPlace() { _menu.displayMenu(); if (enterPassageFl) { - g_s._currPlace = SECRET_PASSAGE; + _coreVar._currPlace = SECRET_PASSAGE; _menu.setDestinationMenuText(SECRET_PASSAGE); } else { - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); setPal(14); dessin(0); aniof(1, 2); @@ -742,17 +742,17 @@ void MortevielleEngine::fctPlace() { } if (g_caff == 16) { - if (g_s._cryptObjectId == 0) - g_s._cryptObjectId = g_s._selectedObjectId; + if (_coreVar._cryptObjectId == 0) + _coreVar._cryptObjectId = _coreVar._selectedObjectId; else g_crep = 188; } if (g_caff == 17) { - if (g_s._secretPassageObjectId != 0) { + if (_coreVar._secretPassageObjectId != 0) { g_crep = 188; - } else if (g_s._selectedObjectId == 143) { - g_s._secretPassageObjectId = 143; + } else if (_coreVar._selectedObjectId == 143) { + _coreVar._secretPassageObjectId = 143; aniof(1, 1); } else { g_crep = 1512; @@ -761,10 +761,10 @@ void MortevielleEngine::fctPlace() { } if (g_caff == 24) { - if (g_s._wellObjectId != 0) { + if (_coreVar._wellObjectId != 0) { g_crep = 188; - } else if ((g_s._selectedObjectId == 140) || (g_s._selectedObjectId == 120)) { - g_s._wellObjectId = g_s._selectedObjectId; + } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { + _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else { g_crep = 185; @@ -793,7 +793,7 @@ void MortevielleEngine::fctTurn() { tcoord(9); if (g_num != 0) { g_crep = 997; - if ((g_s._currPlace == ATTIC) && (g_s._atticRodHoleObjectId == 159) && (g_s._atticBallHoleObjectId == 141)) { + if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { repon(2, 167); _speechManager.startSpeech(7, 9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); @@ -802,13 +802,13 @@ void MortevielleEngine::fctTurn() { else g_crep = 168; } - if ((g_s._currPlace == SECRET_PASSAGE) && (g_s._secretPassageObjectId == 143)) { + if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { repon(2, 175); clearScreenType3(); _speechManager.startSpeech(6, -9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { - g_s._currPlace = CRYPT; + _coreVar._currPlace = CRYPT; affrep(); } else g_crep = 176; @@ -840,7 +840,7 @@ void MortevielleEngine::fctSelfHide() { * @remarks Originally called 'tattacher' */ void MortevielleEngine::fctAttach() { - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else { if (!_syn) @@ -849,10 +849,10 @@ void MortevielleEngine::fctAttach() { if (!(_anyone) && !(_keyPressedEsc)) { tcoord(8); g_crep = 997; - if ((g_num != 0) && (g_s._currPlace == WELL)) { + if ((g_num != 0) && (_coreVar._currPlace == WELL)) { g_crep = 999; - if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) { - g_s._wellObjectId = g_s._selectedObjectId; + if ((_coreVar._selectedObjectId == 120) || (_coreVar._selectedObjectId == 140)) { + _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else g_crep = 185; @@ -910,15 +910,15 @@ void MortevielleEngine::fctKnock() { if (!_syn) ecr3(getEngineString(S_HIT)); - if (g_s._currPlace == LANDING) { + if (_coreVar._currPlace == LANDING) { Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } - if (g_s._currPlace < DOOR) { + if (_coreVar._currPlace < DOOR) { tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { - if ((g_s._currPlace < MOUNTAIN) && (g_s._currPlace != LANDING)) + if ((_coreVar._currPlace < MOUNTAIN) && (_coreVar._currPlace != LANDING)) g_crep = 133; else g_crep = 997; @@ -927,11 +927,11 @@ void MortevielleEngine::fctKnock() { return; } - if (g_s._currPlace == ROOM26) { + if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; _speechManager.startSpeech(11, rand, 1); int p; - ecfren(p, rand, g_s._faithScore, g_ment); + ecfren(p, rand, _coreVar._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -957,7 +957,7 @@ void MortevielleEngine::fctKnock() { void MortevielleEngine::fctSelfPut() { if (!_syn) ecr3(getEngineString(S_POSE)); - if (g_s._selectedObjectId == 0) + if (_coreVar._selectedObjectId == 0) g_crep = 186; else { if (g_caff > 99) { @@ -994,30 +994,30 @@ void MortevielleEngine::fctSelfPut() { if (g_num != 0) { g_crep = 998; if (g_caff == PURPLE_ROOM) { - if (g_s._purpleRoomObjectId != 0) + if (_coreVar._purpleRoomObjectId != 0) g_crep = 188; else - g_s._purpleRoomObjectId = g_s._selectedObjectId; + _coreVar._purpleRoomObjectId = _coreVar._selectedObjectId; } if (g_caff == ATTIC) { if (g_num == 1) { - if (g_s._atticBallHoleObjectId != 0) + if (_coreVar._atticBallHoleObjectId != 0) g_crep = 188; else - g_s._atticBallHoleObjectId = g_s._selectedObjectId; - } else if (g_s._atticRodHoleObjectId != 0) { + _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; + } else if (_coreVar._atticRodHoleObjectId != 0) { g_crep = 188; } else { - g_s._atticRodHoleObjectId = g_s._selectedObjectId; + _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; } } if (g_caff == CRYPT) { - if (g_s._cryptObjectId != 0) + if (_coreVar._cryptObjectId != 0) g_crep = 188; else - g_s._cryptObjectId = g_s._selectedObjectId; + _coreVar._cryptObjectId = _coreVar._selectedObjectId; } if (g_caff == WELL) @@ -1049,13 +1049,13 @@ void MortevielleEngine::fctSelfPut() { * @remarks Originally called 'tecouter' */ void MortevielleEngine::fctListen() { - if (g_s._currPlace != ROOM26) + if (_coreVar._currPlace != ROOM26) g_crep = 101; else { if (_currBitIndex != 0) - ++g_s._faithScore; + ++_coreVar._faithScore; int p, rand; - ecfren(p, rand, g_s._faithScore, g_ment); + ecfren(p, rand, _coreVar._faithScore, g_ment); int l = g_ment; if (l != 0) { if (p != -500) { @@ -1087,19 +1087,19 @@ void MortevielleEngine::fctListen() { * @remarks Originally called 'tmanger' */ void MortevielleEngine::fctEat() { - if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { + if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { g_crep = 148; } else { tsort(); - g_s._currPlace = DINING_ROOM; + _coreVar._currPlace = DINING_ROOM; g_caff = 10; - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); int j, h, m; updateHour(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { - g_s._faithScore -= (g_s._faithScore / 7); + _coreVar._faithScore -= (_coreVar._faithScore / 7); if (h == 12) { if (m == 0) h = 4; @@ -1116,7 +1116,7 @@ void MortevielleEngine::fctEat() { g_jh += h; g_crep = 135; - tinke(); + prepareRoom(); } else { g_crep = 134; } @@ -1128,16 +1128,16 @@ void MortevielleEngine::fctEat() { * @remarks Originally called 'tentrer' */ void MortevielleEngine::fctEnter() { - if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { + if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationMenuText(g_s._currPlace); - } else if (g_s._currPlace == LANDING) + _menu.setDestinationMenuText(_coreVar._currPlace); + } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (g_ment == 0) g_crep = 997; - else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) { + else if ((g_ment == 9) && (_coreVar._selectedObjectId != 136)) { g_crep = 189; - g_s._teauto[8] = '*'; + _coreVar._teauto[8] = '*'; } else { int z = 0; if (!_blo) @@ -1151,8 +1151,8 @@ void MortevielleEngine::fctEnter() { aniof(1, 1); g_x = convertBitIndexToCharacterIndex(z); - ++g_s._faithScore; - g_s._currPlace = LANDING; + ++_coreVar._faithScore; + _coreVar._currPlace = LANDING; g_msg[3] = MENU_DISCUSS; g_msg[4] = _menu._discussMenu[g_x]; _syn = true; @@ -1171,10 +1171,10 @@ void MortevielleEngine::fctEnter() { _speechManager.startSpeech(7, g_x, 1); aniof(1, 1); - g_s._currPlace = g_ment; + _coreVar._currPlace = g_ment; affrep(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); g_ment = 0; g_mpers = 0; _currBitIndex = 0; @@ -1189,17 +1189,17 @@ void MortevielleEngine::fctEnter() { void MortevielleEngine::fctSleep() { int z, j, h, m; - if ((g_s._currPlace > LANDING) && (g_s._currPlace < ROOM26)) { + if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { g_crep = 148; return; } - if (g_s._currPlace != OWN_ROOM) { + if (_coreVar._currPlace != OWN_ROOM) { tsort(); - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; affrep(); afdes(); - debloc(g_s._currPlace); - _menu.setDestinationMenuText(g_s._currPlace); + debloc(_coreVar._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); } clearScreenType3(); clearScreenType2(); @@ -1210,7 +1210,7 @@ void MortevielleEngine::fctSleep() { int answer; do { if (h < 8) { - g_s._faithScore -= (g_s._faithScore / 20); + _coreVar._faithScore -= (_coreVar._faithScore / 20); z = (7 - h) * 2; if (m == 30) --z; @@ -1221,7 +1221,7 @@ void MortevielleEngine::fctSleep() { ++h; if (h > 23) h = 0; - tinke(); + prepareRoom(); answer = Alert::show(getEngineString(S_YES_NO), 1); _anyone = false; } while (answer != 1); @@ -1240,11 +1240,11 @@ void MortevielleEngine::fctForce() { tfleche(); if ((!_anyone) && (!_keyPressedEsc)) { - if (g_s._currPlace != ROOM26) + if (_coreVar._currPlace != ROOM26) g_crep = 997; else { g_crep = 143; - g_s._faithScore += 2; + _coreVar._faithScore += 2; } } } @@ -1256,27 +1256,27 @@ void MortevielleEngine::fctForce() { void MortevielleEngine::fctLeave() { tsort(); g_crep = 0; - if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) + if ((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK) || (_coreVar._currPlace == WELL)) g_crep = 997; else { int nextPlace = OWN_ROOM; - if ((g_s._currPlace < CRYPT) || (g_s._currPlace == ROOM26)) + if ((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace == ROOM26)) nextPlace = DINING_ROOM; - else if ((g_s._currPlace == DINING_ROOM) || (g_s._currPlace == CHAPEL)) + else if ((_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == CHAPEL)) nextPlace = MANOR_FRONT; - else if ((g_s._currPlace < DINING_ROOM) || (g_s._currPlace == ATTIC)) + else if ((_coreVar._currPlace < DINING_ROOM) || (_coreVar._currPlace == ATTIC)) nextPlace = LANDING; - else if (g_s._currPlace == CRYPT) { + else if (_coreVar._currPlace == CRYPT) { nextPlace = SECRET_PASSAGE; g_crep = 176; - } else if (g_s._currPlace == SECRET_PASSAGE) + } else if (_coreVar._currPlace == SECRET_PASSAGE) nextPlace = t23coul(); - else if (g_s._currPlace == INSIDE_WELL) + else if (_coreVar._currPlace == INSIDE_WELL) nextPlace = WELL; if (g_crep != 997) - g_s._currPlace = nextPlace; + _coreVar._currPlace = nextPlace; g_caff = nextPlace; if (g_crep == 0) @@ -1297,18 +1297,18 @@ void MortevielleEngine::fctWait() { int answer; do { ++g_jh; - tinke(); + prepareRoom(); if (!_blo) - t11(g_s._currPlace); + t11(_coreVar._currPlace); if ((_currBitIndex != 0) && (g_mpers == 0)) { g_crep = 998; - if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) + if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) cavegre(); - if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM)) + if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; g_mpers = _currBitIndex; if (!_anyone) - tinke(); + prepareRoom(); return; } repon(2, 102); @@ -1316,7 +1316,7 @@ void MortevielleEngine::fctWait() { } while (answer != 2); g_crep = 998; if (!_anyone) - tinke(); + prepareRoom(); } /** @@ -1383,7 +1383,7 @@ void MortevielleEngine::fctDiscuss() { do { ++icm; _screenSurface.putxy(co, lig); - if (g_s._teauto[icm] == '*') { + if (_coreVar._teauto[icm] == '*') { if (te[icm]) writetp(lib[icm], 1); else @@ -1443,7 +1443,7 @@ void MortevielleEngine::fctDiscuss() { writetp(lib[choi], 1); te[choi] = ! te[choi]; } - if ((g_s._teauto[ix] == '*') || (ix == 46)) { + if ((_coreVar._teauto[ix] == '*') || (ix == 46)) { lig = ((ix - 1) % 23) << 3; if (ix > 23) co = 320; @@ -1466,7 +1466,7 @@ void MortevielleEngine::fctDiscuss() { int ix = choi - 1; if (_col) { _col = false; - g_s._currPlace = 15; + _coreVar._currPlace = 15; if (g_iouv > 0) max = 8; else @@ -1475,14 +1475,14 @@ void MortevielleEngine::fctDiscuss() { suj = 129; else { suj = 138; - g_s._faithScore += (3 * (g_s._faithScore / 10)); + _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } } else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) { suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)]; - g_s._faithScore += g_tabdon[arcf + ix]; + _coreVar._faithScore += g_tabdon[arcf + ix]; ++g_nbrep[g_caff - 69]; } else { - g_s._faithScore += 3; + _coreVar._faithScore += 3; suj = 139; } _mouse.hideMouse(); @@ -1491,17 +1491,17 @@ void MortevielleEngine::fctDiscuss() { startDialog(suj); _mouse.showMouse(); if ((suj == 84) || (suj == 86)) { - g_s._pourc[5] = '*'; - g_s._teauto[7] = '*'; + _coreVar._pourc[5] = '*'; + _coreVar._teauto[7] = '*'; } if ((suj == 106) || (suj == 108) || (suj == 94)) { for (int indx = 29; indx <= 31; ++indx) - g_s._teauto[indx] = '*'; - g_s._pourc[7] = '*'; + _coreVar._teauto[indx] = '*'; + _coreVar._pourc[7] = '*'; } if (suj == 70) { - g_s._pourc[8] = '*'; - g_s._teauto[32] = '*'; + _coreVar._pourc[8] = '*'; + _coreVar._teauto[32] = '*'; } _mouse.hideMouse(); hirs(); @@ -1509,14 +1509,14 @@ void MortevielleEngine::fctDiscuss() { } } while ((choi != 46) && (suj != 138)); if (_col) { - g_s._faithScore += (3 * (g_s._faithScore / 10)); + _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); _mouse.hideMouse(); hirs(); premtet(); startDialog(138); _mouse.showMouse(); _col = false; - g_s._currPlace = LANDING; + _coreVar._currPlace = LANDING; } g_ctrm = 0; _mouse.hideMouse(); @@ -1524,11 +1524,11 @@ void MortevielleEngine::fctDiscuss() { drawRightFrame(); _mouse.showMouse(); showPeoplePresent(_currBitIndex); - tinke(); + prepareRoom(); drawClock(); affrep(); /* chech;*/ - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); clearScreenType3(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 137ff468a2..1d8a10526b 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -196,7 +196,7 @@ void Menu::displayMenu() { do { // One line after the other msk = 0x80; for (pt = 0; pt <= 7; ++pt) { - if ((g_lettres[num_letr - 1][ind_tabl] & msk) != 0) { + if ((_charArr[num_letr - 1][ind_tabl] & msk) != 0) { g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); g_vm->_screenSurface.setPixel(Common::Point(x, y), color); @@ -505,7 +505,7 @@ void Menu::initMenu() { if (!f.open("menu.mor")) error("Missing file - menufr.mor or menual.mor or menu.mor"); - f.read(g_lettres, 7 * 24); + f.read(_charArr, 7 * 24); f.close(); // Skipped: dialog asking to swap floppy @@ -567,7 +567,7 @@ void Menu::setSearchMenu() { * @remarks Originally called 'mfouen' */ void Menu::unsetSearchMenu() { - setDestinationMenuText(g_vm->g_s._currPlace); + setDestinationMenuText(g_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 7f224a3ee5..b600d4e3af 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -40,6 +40,8 @@ enum { class Menu { private: + byte _charArr[7][24]; + void util(Common::Point pos); void invert(int indx); void menuDown(int ii); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index e1206be2c2..ca01e01fcf 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -95,18 +95,6 @@ int animof(int ouf, int num) { return animof_result; } -/** - * Read the current system time - */ -int readclock() { - TimeDate dateTime; - g_system->getTimeAndDate(dateTime); - - int m = dateTime.tm_min * 60; - int h = dateTime.tm_hour * 3600; - return h + m + dateTime.tm_sec; -} - void modif(int &nu) { if (nu == 26) nu = 25; @@ -245,12 +233,12 @@ void repon(int f, int m) { g_vm->prepareScreenType2(); text1(8, 182, 103, m); if ((m == 68) || (m == 69)) - g_vm->g_s._teauto[40] = '*'; + g_vm->_coreVar._teauto[40] = '*'; if ((m == 104) && (g_caff == 14)) { - g_vm->g_s._teauto[36] = '*'; - if (g_vm->g_s._teauto[39] == '*') { - g_vm->g_s._pourc[3] = '*'; - g_vm->g_s._teauto[38] = '*'; + g_vm->_coreVar._teauto[36] = '*'; + if (g_vm->_coreVar._teauto[39] == '*') { + g_vm->_coreVar._pourc[3] = '*'; + g_vm->_coreVar._teauto[38] = '*'; } } break; @@ -267,9 +255,9 @@ void repon(int f, int m) { displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) - g_vm->g_s._pourc[6] = '*'; + g_vm->_coreVar._pourc[6] = '*'; else if (m == 179) - g_vm->g_s._pourc[10] = '*'; + g_vm->_coreVar._pourc[10] = '*'; } break; default: @@ -286,57 +274,6 @@ int chlm() { return retval; } -/** - * Engine function - Draw Clock - * @remarks Originally called 'pendule' - */ -void drawClock() { - const int cv[2][12] = { - { 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 int x = 580; - const int y = 123; - const int rg = 9; - int h, co; - - g_vm->_mouse.hideMouse(); - - paint_rect(570, 118, 20, 10); - paint_rect(578, 114, 6, 18); - if ((g_vm->_currGraphicalDevice == MODE_CGA) || (g_vm->_currGraphicalDevice == MODE_HERCULES)) - co = 0; - else - co = 1; - - if (g_vm->_minute == 0) - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); - else - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); - - h = g_vm->_hour; - if (h > 12) - h -= 12; - if (h == 0) - h = 12; - - g_vm->_screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); - g_vm->_mouse.showMouse(); - g_vm->_screenSurface.putxy(568, 154); - - if (g_vm->_hour > 11) - g_vm->_screenSurface.drawString("PM ", 1); - else - g_vm->_screenSurface.drawString("AM ", 1); - - g_vm->_screenSurface.putxy(550, 160); - if ((g_vm->_day >= 0) && (g_vm->_day <= 8)) { - Common::String tmp = g_vm->getEngineString(S_DAY); - tmp.insertChar((char)(g_vm->_day + 49), 0); - g_vm->_screenSurface.drawString(tmp, 1); - } -} - /************* * NIVEAU 11 * *************/ @@ -426,7 +363,7 @@ int t11(int roomId) { int retVal = 0; int p, rand; - ecfren(p, rand, g_vm->g_s._faithScore, roomId); + ecfren(p, rand, g_vm->_coreVar._faithScore, roomId); g_vm->_place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { @@ -458,7 +395,7 @@ int t11(int roomId) { p = g_vm->getPresenceStatsLanding(); else if (roomId == CHAPEL) p = g_vm->getPresenceStatsChapel(h); - p += g_vm->g_s._faithScore; + p += g_vm->_coreVar._faithScore; rand = g_vm->getRandomNumber(1, 100); if (rand > p) { g_vm->displayAloneText(); @@ -483,9 +420,9 @@ int t11(int roomId) { } void cavegre() { - g_vm->g_s._faithScore += 2; - if (g_vm->g_s._faithScore > 69) - g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += 2; + if (g_vm->_coreVar._faithScore > 69) + g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); g_vm->clearScreenType3(); g_vm->prepareScreenType2(); ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); @@ -551,16 +488,16 @@ void dessin(int ad) { } if (g_caff == 13) { - if (g_vm->g_s._atticBallHoleObjectId == 141) + if (g_vm->_coreVar._atticBallHoleObjectId == 141) aniof(1, 7); - if (g_vm->g_s._atticRodHoleObjectId == 159) + if (g_vm->_coreVar._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((g_caff == 14) && (g_vm->g_s._cellarObjectId == 151)) + } else if ((g_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151)) aniof(1, 2); - else if ((g_caff == 17) && (g_vm->g_s._secretPassageObjectId == 143)) + else if ((g_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143)) aniof(1, 1); - else if ((g_caff == 24) && (g_vm->g_s._wellObjectId != 0)) + else if ((g_caff == 24) && (g_vm->_coreVar._wellObjectId != 0)) aniof(1, 1); } @@ -570,157 +507,6 @@ void dessin(int ad) { } } -void tinke() { - Common::String d1 = g_vm->getEngineString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = g_vm->getEngineString(S_NUMBER_OF_HINTS); - const char d3 = '['; - const char d4 = ']'; - const char d5 = '1'; - Common::String d6 = g_vm->getEngineString(S_OK); - int cf, day, hour, minute; - Common::String stpo; - - g_vm->_anyone = false; - g_vm->updateHour(day, hour, minute); - if (day != g_vm->_day) { - g_vm->_day = day; - int i = 0; - do { - ++i; - if (g_nbrepm[i] != 0) - --g_nbrepm[i]; - g_nbrep[i] = 0; - } while (i != 8); - } - if ((hour > g_vm->_hour) || ((hour == 0) && (g_vm->_hour == 23))) { - g_vm->_hour = hour; - g_vm->_minute = 0; - drawClock(); - cf = 0; - for (int i = 1; i <= 10; ++i) { - if (g_vm->g_s._pourc[i] == '*') - ++cf; - } - - if (cf == 10) - stpo = "10"; - else - stpo = chr(cf + 48); - - g_vm->_hintPctMessage = Common::String(d3); - g_vm->_hintPctMessage += d5; - g_vm->_hintPctMessage += d4; - g_vm->_hintPctMessage += d3; - g_vm->_hintPctMessage += d1; - g_vm->_hintPctMessage += stpo; - g_vm->_hintPctMessage += '0'; - g_vm->_hintPctMessage += d2; - g_vm->_hintPctMessage += d4; - g_vm->_hintPctMessage += d3; - g_vm->_hintPctMessage += d6; - g_vm->_hintPctMessage += d4; - } - if (minute > g_vm->_minute) { - g_vm->_minute = 30; - drawClock(); - } - if (g_vm->_mouse._pos.y < 12) - return; - - if (!g_vm->_blo) { - if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = kTime2; - else - g_t = kTime1; - cf = g_vm->g_s._faithScore; - if ((cf > 33) && (cf < 66)) - g_t -= (g_t / 3); - - if (cf > 65) - g_t -= ((g_t / 3) * 2); - - int nh = readclock(); - if ((nh - g_mh) > g_t) { - bool activeMenu = g_vm->_menu._menuActive; - g_vm->_menu.eraseMenu(); - g_jh += ((nh - g_mh) / g_t); - g_mh = nh; - switch (g_vm->_place) { - case GREEN_ROOM: - case DARKBLUE_ROOM: - g_vm->setRandomPresenceGreenRoom(cf); - break; - case PURPLE_ROOM: - g_vm->setRandomPresencePurpleRoom(cf); - break; - case BLUE_ROOM: - g_vm->setRandomPresenceBlueRoom(cf); - break; - case RED_ROOM: - case GREEN_ROOM2: - g_vm->setRandomPresenceRedRoom(cf); - break; - case ROOM9: - g_vm->setRandomPresenceRoom9(cf); - break; - case DINING_ROOM: - g_vm->setRandomPresenceDiningRoom(cf); - break; - case BUREAU: - g_vm->setRandomPresenceBureau(cf); - break; - case KITCHEN: - g_vm->setRandomPresenceKitchen(cf); - break; - case ATTIC: - case CELLAR: - g_vm->setRandomPresenceAttic(cf); - break; - case LANDING: - case ROOM26: - g_vm->setRandomPresenceLanding(cf); - break; - case CHAPEL: - g_vm->setRandomPresenceChapel(cf); - break; - } - if ((g_mpers != 0) && (g_vm->_currBitIndex != 10)) - g_mpers = g_vm->_currBitIndex; - - if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) { - if ((g_vm->g_s._currPlace == ATTIC) || (g_vm->g_s._currPlace == CELLAR)) { - cavegre(); - } else if (g_vm->_currBitIndex == 10) { - g_vm->_currBitIndex = 0; - if (!g_vm->_brt) { - g_vm->_brt = true; - g_hdb = readclock(); - if (g_vm->getRandomNumber(1, 5) < 5) { - g_vm->clearScreenType3(); - g_vm->prepareScreenType2(); - ecr3(g_vm->getEngineString(S_HEAR_NOISE)); - int rand = (g_vm->getRandomNumber(0, 4)) - 2; - g_vm->_speechManager.startSpeech(1, rand, 1); - g_vm->clearScreenType3(); - } - } - } - } - - if (activeMenu) - g_vm->_menu.drawMenu(); - } - } - g_hfb = readclock(); - if ((g_vm->_brt) && ((g_hfb - g_hdb) > 17)) { - g_vm->getPresenceBitIndex(g_vm->_place); - g_vm->_brt = false; - g_hdb = 0; - if ((g_vm->g_s._currPlace > OWN_ROOM) && (g_vm->g_s._currPlace < DINING_ROOM)) - g_vm->_anyone = true; - } -} - void fenat(char ans) { int coul; @@ -763,7 +549,7 @@ void tkey1(bool d) { // Event loop do { if (d) - tinke(); + g_vm->prepareRoom(); quest = g_vm->keyPressed(); g_vm->_mouse.getMousePosition(x, y, c); CHECK_QUIT; @@ -787,17 +573,17 @@ void tlu(int af, int ob) { } void affrep() { - g_caff = g_vm->g_s._currPlace; - g_crep = g_vm->g_s._currPlace; + g_caff = g_vm->_coreVar._currPlace; + g_crep = g_vm->_coreVar._currPlace; } void tsort() { - if ((g_iouv > 0) && (g_vm->g_s._currPlace != 0)) { - if (g_vm->g_s._faithScore < 50) - g_vm->g_s._faithScore += 2; + if ((g_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) { + if (g_vm->_coreVar._faithScore < 50) + g_vm->_coreVar._faithScore += 2; else - g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); } for (int cx = 1; cx <= 7; ++cx) @@ -805,7 +591,7 @@ void tsort() { g_ment = 0; g_iouv = 0; g_mchai = 0; - debloc(g_vm->g_s._currPlace); + debloc(g_vm->_coreVar._currPlace); } void st4(int ob) { @@ -844,9 +630,9 @@ void modinv() { int cy = 0; for (int i = 1; i <= 6; ++i) { - if (g_vm->g_s._sjer[i] != chr(0)) { + if (g_vm->_coreVar._sjer[i] != chr(0)) { ++cy; - r = (ord(g_vm->g_s._sjer[i]) + 400); + r = (ord(g_vm->_coreVar._sjer[i]) + 400); nomp = g_vm->getString(r - 501 + kInventoryStringIndex); g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); @@ -879,7 +665,7 @@ void ajchai() { } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_vm->g_s._selectedObjectId; + g_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; else g_crep = 192; } @@ -888,10 +674,10 @@ void ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(g_vm->g_s._sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0)); - if (ord(g_vm->g_s._sjer[cx]) == 0) { - g_vm->g_s._sjer[(cx)] = chr(ob); + if (ord(g_vm->_coreVar._sjer[cx]) == 0) { + g_vm->_coreVar._sjer[(cx)] = chr(ob); modinv(); } else g_crep = 139; @@ -920,11 +706,11 @@ L1: g_vm->_speechManager.startSpeech(4, 4, 1); if (g_iouv == 0) - g_vm->g_s._faithScore += 2; - else if (g_vm->g_s._faithScore < 50) - g_vm->g_s._faithScore += 4; + g_vm->_coreVar._faithScore += 2; + else if (g_vm->_coreVar._faithScore < 50) + g_vm->_coreVar._faithScore += 4; else - g_vm->g_s._faithScore += 3 * (g_vm->g_s._faithScore / 10); + g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10); tsort(); g_vm->_menu.setDestinationMenuText(LANDING); int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); @@ -971,7 +757,7 @@ void tsuiv() { g_caff = tbcl; g_crep = g_caff + 400; if (g_vm->_currBitIndex != 0) - g_vm->g_s._faithScore += 2; + g_vm->_coreVar._faithScore += 2; } else { affrep(); g_vm->endSearch(); @@ -998,7 +784,7 @@ void tfleche() { if (g_vm->getMouseClick()) inRect = (g_vm->_mouse._pos.x < 256 * g_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); - tinke(); + g_vm->prepareRoom(); } while (!(qust || inRect || g_vm->_anyone)); if (qust && (touch == '\103')) @@ -1112,20 +898,20 @@ void treg(int ob) { void avpoing(int &ob) { g_crep = 999; - if (g_vm->g_s._selectedObjectId != 0) - ajjer(g_vm->g_s._selectedObjectId); + if (g_vm->_coreVar._selectedObjectId != 0) + ajjer(g_vm->_coreVar._selectedObjectId); if (g_crep != 139) { modobj(ob + 400); - g_vm->g_s._selectedObjectId = ob; + g_vm->_coreVar._selectedObjectId = ob; ob = 0; } } void rechai(int &ch) { - int tmpPlace = g_vm->g_s._currPlace; + int tmpPlace = g_vm->_coreVar._currPlace; - if (g_vm->g_s._currPlace == CRYPT) + if (g_vm->_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } @@ -1140,7 +926,7 @@ int t23coul() { } void maivid() { - g_vm->g_s._selectedObjectId = 0; + g_vm->_coreVar._selectedObjectId = 0; modobj(500); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index de1b0b4a7d..03a4c0f757 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -48,7 +48,6 @@ extern void charecr(int y, int dy); extern void adzon(); extern int animof(int ouf, int num); /* Niveau 14 suite */ -extern int readclock(); extern void modif(int &nu); /* NIVEAU 13 */ extern void text1(int x, int y, int nb, int m); @@ -77,8 +76,6 @@ extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); /* NIVEAU 9 */ extern void dessin(int ad); - -extern void tinke(); extern void fenat(char ans); /* NIVEAU 8 */ extern void afdes(); @@ -89,7 +86,6 @@ extern void affrep(); /* NIVEAU 6 */ extern void tsort(); extern void st4(int ob); -extern void displayDiningRoom(); extern void modinv(); extern void mennor(); extern void premtet(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 866c8e42c9..907e305be8 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -625,10 +625,10 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { _menu.mdn(); - tinke(); + prepareRoom(); _mouse.moveMouse(funct, inkey); CHECK_QUIT; - temps = temps + 1; + ++temps; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; @@ -682,7 +682,7 @@ void MortevielleEngine::handleAction() { oo = true; if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) { endSearch(); - g_caff = g_s._currPlace; + g_caff = _coreVar._currPlace; g_crep = 998; } else tsuiv(); @@ -1432,7 +1432,7 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) { void MortevielleEngine::initGame() { _place = MANOR_FRONT; g_jh = 0; - if (!g_s._alreadyEnteredManor) + if (!_coreVar._alreadyEnteredManor) _blo = true; g_t = kTime1; g_mh = readclock(); @@ -1625,21 +1625,21 @@ void MortevielleEngine::startMusicOrSpeech(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((g_prebru == 0) && (!g_s._alreadyEnteredManor)) { + } else if ((g_prebru == 0) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech _speechManager.startSpeech(10, 1, 1); ++g_prebru; } else { - if (((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) + if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); - else if ((g_s._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) + else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech _speechManager.startSpeech(8, 1, 1); - else if ((g_s._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) + else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech _speechManager.startSpeech(12, 1, 1); - else if (g_s._currPlace == INSIDE_WELL) + else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech _speechManager.startSpeech(13, 1, 1); else @@ -1679,9 +1679,9 @@ void MortevielleEngine::loseGame() { bool MortevielleEngine::checkInventory(int objectId) { bool retVal = false; for (int i = 1; i <= 6; ++i) - retVal = (retVal || (ord(g_s._sjer[i]) == objectId)); + retVal = (retVal || (ord(_coreVar._sjer[i]) == objectId)); - if (g_s._selectedObjectId == objectId) + if (_coreVar._selectedObjectId == objectId) retVal = true; return retVal; @@ -1692,7 +1692,7 @@ bool MortevielleEngine::checkInventory(int objectId) { * @remarks Originally called 'st1sama' */ void MortevielleEngine::displayDiningRoom() { - g_s._currPlace = DINING_ROOM; + _coreVar._currPlace = DINING_ROOM; affrep(); } @@ -1741,13 +1741,13 @@ void MortevielleEngine::gotoDiningRoom() { int day, hour, minute; updateHour(day, hour, minute); - if ((hour < 5) && (g_s._currPlace > ROOM18)) { + if ((hour < 5) && (_coreVar._currPlace > ROOM18)) { if (!checkInventory(137)) { //You don't have the keys, and it's late g_crep = 1511; loseGame(); } else displayDiningRoom(); - } else if (!g_s._alreadyEnteredManor) { //Is it your first time? + } else if (!_coreVar._alreadyEnteredManor) { //Is it your first time? _currBitIndex = 255; // Everybody is present showPeoplePresent(_currBitIndex); g_caff = 77; @@ -1763,14 +1763,14 @@ void MortevielleEngine::gotoDiningRoom() { drawRightFrame(); drawClock(); _mouse.showMouse(); - g_s._currPlace = OWN_ROOM; + _coreVar._currPlace = OWN_ROOM; affrep(); resetPresenceInRooms(DINING_ROOM); if (!_blo) minute = t11(OWN_ROOM); _currBitIndex = 0; g_mpers = 0; - g_s._alreadyEnteredManor = true; + _coreVar._alreadyEnteredManor = true; } else displayDiningRoom(); } @@ -1786,7 +1786,7 @@ void MortevielleEngine::checkManorDistance() { loseGame(); } else { _okdes = true; - g_s._currPlace = MOUNTAIN; + _coreVar._currPlace = MOUNTAIN; affrep(); } } @@ -1797,7 +1797,7 @@ void MortevielleEngine::checkManorDistance() { */ void MortevielleEngine::gotoManorFront() { _manorDistance = 0; - g_s._currPlace = MANOR_FRONT; + _coreVar._currPlace = MANOR_FRONT; affrep(); } @@ -1806,7 +1806,7 @@ void MortevielleEngine::gotoManorFront() { * @remarks Originally called 't1derr' */ void MortevielleEngine::gotoManorBack() { - g_s._currPlace = MANOR_BACK; + _coreVar._currPlace = MANOR_BACK; affrep(); } @@ -1830,7 +1830,7 @@ void MortevielleEngine::changeGraphicalDevice(int newDevice) { _mouse.initMouse(); _mouse.showMouse(); drawRightFrame(); - tinke(); + prepareRoom(); drawClock(); if (_currBitIndex != 0) showPeoplePresent(_currBitIndex); @@ -1884,16 +1884,16 @@ void MortevielleEngine::gameLoaded() { _heroSearching = false; displayAloneText(); - tinke(); + prepareRoom(); drawClock(); afdes(); repon(2, g_crep); clearScreenType3(); _endGame = false; - _menu.setDestinationMenuText(g_s._currPlace); + _menu.setDestinationMenuText(_coreVar._currPlace); modinv(); - if (g_s._selectedObjectId != 0) - modobj(g_s._selectedObjectId + 400); + if (_coreVar._selectedObjectId != 0) + modobj(_coreVar._selectedObjectId + 400); _mouse.showMouse(); } @@ -1984,16 +1984,16 @@ void MortevielleEngine::handleOpcode() { } int hour, day, minute; updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (g_s._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) - ++g_s._faithScore; - if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != INSIDE_WELL) - && (g_s._currPlace != OWN_ROOM) && (g_s._selectedObjectId != 152) && (!_loseGame)) { - if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != 10)) || + ((hour > 0) && (hour < 6) && (_coreVar._currPlace != 0))) + ++_coreVar._faithScore; + if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) + && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { + if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; loseGame(); } - if ((g_s._faithScore > 99) && (hour > 0) && (hour < 9)) { + if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { g_crep = 1508; loseGame(); } @@ -2017,7 +2017,7 @@ void MortevielleEngine::hourToChar() { minute = 1; hour += day * 24; minute += hour * 2; - g_s._fullHour = chr(minute); + _coreVar._fullHour = chr(minute); } /** @@ -2025,7 +2025,7 @@ void MortevielleEngine::hourToChar() { * @remarks Originally called 'theure' */ void MortevielleEngine::charToHour() { - int fullHour = ord(g_s._fullHour); + int fullHour = ord(_coreVar._fullHour); int tmpHour = fullHour % 48; _currDay = fullHour / 48; _currHalfHour = tmpHour % 2; @@ -2092,11 +2092,11 @@ void MortevielleEngine::clearScreenType10() { cod = 544; } _screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); - if (g_s._faithScore < 33) + if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); - else if (g_s._faithScore < 66) + else if (_coreVar._faithScore < 66) st = getEngineString(S_LOURDE); - else if (g_s._faithScore > 65) + else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); co = 580 - (_screenSurface.getStringWidth(st) / 2); @@ -2252,40 +2252,40 @@ void MortevielleEngine::copcha() { void MortevielleEngine::resetVariables() { copcha(); - g_s._alreadyEnteredManor = false; - g_s._selectedObjectId = 0; - g_s._cellarObjectId = 0; - g_s._atticBallHoleObjectId = 0; - g_s._atticRodHoleObjectId = 0; - g_s._wellObjectId = 0; - g_s._secretPassageObjectId = 0; - g_s._purpleRoomObjectId = 136; - g_s._cryptObjectId = 141; - g_s._faithScore = getRandomNumber(4, 10); - g_s._currPlace = MANOR_FRONT; + _coreVar._alreadyEnteredManor = false; + _coreVar._selectedObjectId = 0; + _coreVar._cellarObjectId = 0; + _coreVar._atticBallHoleObjectId = 0; + _coreVar._atticRodHoleObjectId = 0; + _coreVar._wellObjectId = 0; + _coreVar._secretPassageObjectId = 0; + _coreVar._purpleRoomObjectId = 136; + _coreVar._cryptObjectId = 141; + _coreVar._faithScore = getRandomNumber(4, 10); + _coreVar._currPlace = MANOR_FRONT; for (int i = 2; i <= 6; ++i) - g_s._sjer[i] = chr(0); + _coreVar._sjer[i] = chr(0); - g_s._sjer[1] = chr(113); - g_s._fullHour = chr(20); + _coreVar._sjer[1] = chr(113); + _coreVar._fullHour = chr(20); for (int i = 1; i <= 10; ++i) - g_s._pourc[i] = ' '; + _coreVar._pourc[i] = ' '; for (int i = 1; i <= 6; ++i) - g_s._teauto[i] = '*'; + _coreVar._teauto[i] = '*'; for (int i = 7; i <= 9; ++i) - g_s._teauto[i] = ' '; + _coreVar._teauto[i] = ' '; for (int i = 10; i <= 28; ++i) - g_s._teauto[i] = '*'; + _coreVar._teauto[i] = '*'; for (int i = 29; i <= 42; ++i) - g_s._teauto[i] = ' '; + _coreVar._teauto[i] = ' '; - g_s._teauto[33] = '*'; + _coreVar._teauto[33] = '*'; for (int i = 1; i <= 8; ++i) g_nbrep[i] = 0; @@ -2519,7 +2519,7 @@ void MortevielleEngine::showTitleScreen() { if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - g_vm->draw(g_ades, 0, 0); + draw(g_ades, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; _screenSurface.putxy(104 + 72 * g_res, 185); @@ -2531,10 +2531,10 @@ void MortevielleEngine::showTitleScreen() { * @remarks Originally called 'dessine' */ void MortevielleEngine::draw(int ad, int x, int y) { - g_vm->_mouse.hideMouse(); - g_vm->setPal(g_numpal); + _mouse.hideMouse(); + setPal(g_numpal); pictout(ad, 0, x, y); - g_vm->_mouse.showMouse(); + _mouse.showMouse(); } /** @@ -2542,13 +2542,231 @@ void MortevielleEngine::draw(int ad, int x, int y) { * @remarks Originally called 'dessine_rouleau' */ void MortevielleEngine::drawRightFrame() { - g_vm->setPal(89); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + setPal(89); + if (_currGraphicalDevice == MODE_HERCULES) { g_mem[0x7000 * 16 + 14] = 15; } - g_vm->_mouse.hideMouse(); + _mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); - g_vm->_mouse.showMouse(); + _mouse.showMouse(); +} + +/** + * Read the current system time + */ +int MortevielleEngine::readclock() { + TimeDate dateTime; + g_system->getTimeAndDate(dateTime); + + int m = dateTime.tm_min * 60; + int h = dateTime.tm_hour * 3600; + return h + m + dateTime.tm_sec; +} + +/** + * Engine function - Prepare room and hint string + * @remarks Originally called 'tinke' + */ +void MortevielleEngine::prepareRoom() { + Common::String d1 = getEngineString(S_SHOULD_HAVE_NOTICED); + Common::String d2 = getEngineString(S_NUMBER_OF_HINTS); + const char d3 = '['; + const char d4 = ']'; + const char d5 = '1'; + Common::String d6 = getEngineString(S_OK); + int cf, day, hour, minute; + Common::String stpo; + + _anyone = false; + updateHour(day, hour, minute); + if (day != _day) { + _day = day; + int i = 0; + do { + ++i; + if (g_nbrepm[i] != 0) + --g_nbrepm[i]; + g_nbrep[i] = 0; + } while (i != 8); + } + if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { + _hour = hour; + _minute = 0; + drawClock(); + cf = 0; + for (int i = 1; i <= 10; ++i) { + if (_coreVar._pourc[i] == '*') + ++cf; + } + + if (cf == 10) + stpo = "10"; + else + stpo = chr(cf + 48); + + _hintPctMessage = Common::String(d3); + _hintPctMessage += d5; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d1; + _hintPctMessage += stpo; + _hintPctMessage += '0'; + _hintPctMessage += d2; + _hintPctMessage += d4; + _hintPctMessage += d3; + _hintPctMessage += d6; + _hintPctMessage += d4; + } + if (minute > _minute) { + _minute = 30; + drawClock(); + } + if (_mouse._pos.y < 12) + return; + + if (!_blo) { + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) + g_t = kTime2; + else + g_t = kTime1; + cf = _coreVar._faithScore; + if ((cf > 33) && (cf < 66)) + g_t -= (g_t / 3); + + if (cf > 65) + g_t -= ((g_t / 3) * 2); + + int nh = readclock(); + if ((nh - g_mh) > g_t) { + bool activeMenu = _menu._menuActive; + _menu.eraseMenu(); + g_jh += ((nh - g_mh) / g_t); + g_mh = nh; + switch (_place) { + case GREEN_ROOM: + case DARKBLUE_ROOM: + setRandomPresenceGreenRoom(cf); + break; + case PURPLE_ROOM: + setRandomPresencePurpleRoom(cf); + break; + case BLUE_ROOM: + setRandomPresenceBlueRoom(cf); + break; + case RED_ROOM: + case GREEN_ROOM2: + setRandomPresenceRedRoom(cf); + break; + case ROOM9: + setRandomPresenceRoom9(cf); + break; + case DINING_ROOM: + setRandomPresenceDiningRoom(cf); + break; + case BUREAU: + setRandomPresenceBureau(cf); + break; + case KITCHEN: + setRandomPresenceKitchen(cf); + break; + case ATTIC: + case CELLAR: + setRandomPresenceAttic(cf); + break; + case LANDING: + case ROOM26: + setRandomPresenceLanding(cf); + break; + case CHAPEL: + setRandomPresenceChapel(cf); + break; + } + if ((g_mpers != 0) && (_currBitIndex != 10)) + g_mpers = _currBitIndex; + + if ((g_mpers == 0) && (_currBitIndex > 0)) { + if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) { + cavegre(); + } else if (_currBitIndex == 10) { + _currBitIndex = 0; + if (!_brt) { + _brt = true; + g_hdb = readclock(); + if (getRandomNumber(1, 5) < 5) { + clearScreenType3(); + prepareScreenType2(); + ecr3(getEngineString(S_HEAR_NOISE)); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(1, rand, 1); + clearScreenType3(); + } + } + } + } + + if (activeMenu) + _menu.drawMenu(); + } + } + g_hfb = readclock(); + if ((_brt) && ((g_hfb - g_hdb) > 17)) { + getPresenceBitIndex(_place); + _brt = false; + g_hdb = 0; + if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) + _anyone = true; + } +} + +/** + * Engine function - Draw Clock + * @remarks Originally called 'pendule' + */ +void MortevielleEngine::drawClock() { + const int cv[2][12] = { + { 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 int x = 580; + const int y = 123; + const int rg = 9; + int h, co; + + _mouse.hideMouse(); + + paint_rect(570, 118, 20, 10); + paint_rect(578, 114, 6, 18); + if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) + co = 0; + else + co = 1; + + if (_minute == 0) + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); + else + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); + + h = _hour; + if (h > 12) + h -= 12; + if (h == 0) + h = 12; + + _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); + _mouse.showMouse(); + _screenSurface.putxy(568, 154); + + if (_hour > 11) + _screenSurface.drawString("PM ", 1); + else + _screenSurface.drawString("AM ", 1); + + _screenSurface.putxy(550, 160); + if ((_day >= 0) && (_day <= 8)) { + Common::String tmp = getEngineString(S_DAY); + tmp.insertChar((char)(_day + 49), 0); + _screenSurface.drawString(tmp, 1); + } } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b17d729296..c0230cf5cc 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -100,6 +100,29 @@ struct t_pcga { nhom _a[16]; }; +struct Pattern { + byte _tay, _tax; + byte _des[kMaxPatt + 1][kMaxPatt + 1]; +}; + +struct SaveStruct { + int _faithScore; + byte _pourc[11]; + byte _teauto[43]; + byte _sjer[31]; + int _currPlace; + int _atticBallHoleObjectId; + int _atticRodHoleObjectId; + int _cellarObjectId; + int _secretPassageObjectId; + int _wellObjectId; + int _selectedObjectId; + int _purpleRoomObjectId; + int _cryptObjectId; + bool _alreadyEnteredManor; + byte _fullHour; +}; + class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; @@ -133,6 +156,7 @@ private: void loadCFIEC(); void loadCFIPH(); void showTitleScreen(); + int readclock(); public: Common::String _hintPctMessage; @@ -183,7 +207,7 @@ public: int _c_zzz; int ptr_word; byte _v_lieu[7][25]; - SaveStruct g_s, g_s1; + SaveStruct _coreVar, _saveStruct; byte g_is; ScreenSurface _screenSurface; @@ -334,6 +358,8 @@ public: void music(); void draw(int ad, int x, int y); void drawRightFrame(); + void prepareRoom(); + void drawClock(); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6a8aaff048..22385ed0fe 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -196,37 +196,37 @@ void taffich() { switch (a) { case 16: - g_vm->g_s._pourc[9] = '*'; - g_vm->g_s._teauto[42] = '*'; + g_vm->_coreVar._pourc[9] = '*'; + g_vm->_coreVar._teauto[42] = '*'; break; case 20: - g_vm->g_s._teauto[39] = '*'; - if (g_vm->g_s._teauto[36] == '*') { - g_vm->g_s._pourc[3] = '*'; - g_vm->g_s._teauto[38] = '*'; + g_vm->_coreVar._teauto[39] = '*'; + if (g_vm->_coreVar._teauto[36] == '*') { + g_vm->_coreVar._pourc[3] = '*'; + g_vm->_coreVar._teauto[38] = '*'; } break; case 24: - g_vm->g_s._teauto[37] = '*'; + g_vm->_coreVar._teauto[37] = '*'; break; case 30: - g_vm->g_s._teauto[9] = '*'; + g_vm->_coreVar._teauto[9] = '*'; break; case 31: - g_vm->g_s._pourc[4] = '*'; - g_vm->g_s._teauto[35] = '*'; + g_vm->_coreVar._pourc[4] = '*'; + g_vm->_coreVar._teauto[35] = '*'; break; case 118: - g_vm->g_s._teauto[41] = '*'; + g_vm->_coreVar._teauto[41] = '*'; break; case 143: - g_vm->g_s._pourc[1] = '*'; + g_vm->_coreVar._pourc[1] = '*'; break; case 150: - g_vm->g_s._teauto[34] = '*'; + g_vm->_coreVar._teauto[34] = '*'; break; case 151: - g_vm->g_s._pourc[2] = '*'; + g_vm->_coreVar._pourc[2] = '*'; break; default: break; @@ -258,7 +258,7 @@ void taffich() { if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) m = 2030; - if (((a < 27) && (((g_maff > 69) && (!g_vm->g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + if (((a < 27) && (((g_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) m = 2033; g_maff = a; @@ -333,11 +333,11 @@ void taffich() { charani(filename, lgt, handle); } g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_vm->g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) - cx = t11(g_vm->g_s._currPlace); + cx = t11(g_vm->_coreVar._currPlace); g_mpers = 0; } } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c99804f34c..fa26132e9b 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -46,25 +46,25 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { * Handle saving or loading savegame data */ void SavegameManager::sync_save(Common::Serializer &sz) { - sz.syncAsSint16LE(g_vm->g_s1._faithScore); + sz.syncAsSint16LE(g_vm->_saveStruct._faithScore); for (int i = 0; i < 11; ++i) - sz.syncAsByte(g_vm->g_s1._pourc[i]); + sz.syncAsByte(g_vm->_saveStruct._pourc[i]); for (int i = 0; i < 43; ++i) - sz.syncAsByte(g_vm->g_s1._teauto[i]); + sz.syncAsByte(g_vm->_saveStruct._teauto[i]); for (int i = 0; i < 31; ++i) - sz.syncAsByte(g_vm->g_s1._sjer[i]); - - sz.syncAsSint16LE(g_vm->g_s1._currPlace); - sz.syncAsSint16LE(g_vm->g_s1._atticBallHoleObjectId); - sz.syncAsSint16LE(g_vm->g_s1._atticRodHoleObjectId); - sz.syncAsSint16LE(g_vm->g_s1._cellarObjectId); - sz.syncAsSint16LE(g_vm->g_s1._secretPassageObjectId); - sz.syncAsSint16LE(g_vm->g_s1._wellObjectId); - sz.syncAsSint16LE(g_vm->g_s1._selectedObjectId); - sz.syncAsSint16LE(g_vm->g_s1._purpleRoomObjectId); - sz.syncAsSint16LE(g_vm->g_s1._cryptObjectId); - sz.syncAsByte(g_vm->g_s1._alreadyEnteredManor); - sz.syncAsByte(g_vm->g_s1._fullHour); + sz.syncAsByte(g_vm->_saveStruct._sjer[i]); + + sz.syncAsSint16LE(g_vm->_saveStruct._currPlace); + sz.syncAsSint16LE(g_vm->_saveStruct._atticBallHoleObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._atticRodHoleObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._cellarObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._secretPassageObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._wellObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._selectedObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._purpleRoomObjectId); + sz.syncAsSint16LE(g_vm->_saveStruct._cryptObjectId); + sz.syncAsByte(g_vm->_saveStruct._alreadyEnteredManor); + sz.syncAsByte(g_vm->_saveStruct._fullHour); sz.syncBytes(g_bufcha, 391); } @@ -106,7 +106,7 @@ void SavegameManager::loadSavegame(int n) { Common::Serializer sz(stream, NULL); sync_save(sz); - g_vm->g_s = g_vm->g_s1; + g_vm->_coreVar = g_vm->_saveStruct; for (int i = 0; i <= 389; ++i) g_tabdon[i + kAcha] = g_bufcha[i]; @@ -142,9 +142,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { for (i = 0; i <= 389; ++i) g_bufcha[i] = g_tabdon[i + kAcha]; - g_vm->g_s1 = g_vm->g_s; - if (g_vm->g_s1._currPlace == 26) - g_vm->g_s1._currPlace = 15; + g_vm->_saveStruct = g_vm->_coreVar; + if (g_vm->_saveStruct._currPlace == 26) + g_vm->_saveStruct._currPlace = 15; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index eabffb9bba..0c12a43acb 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -56,6 +56,14 @@ const int kTempoM = 89; //const int seg_syst = 0x6fed; //const int offsetb2 = 4; +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; +}; + class SpeechManager { private: int _typlec; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index a601c45a94..8b82aaccdf 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -106,7 +106,6 @@ int g_nbrep[9]; int g_nbrepm[9]; int g_msg[5]; byte g_touv[8]; -SaveStruct g_s, g_s1; byte g_bufcha[391]; byte g_lettres[7][24]; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 178ca2d989..a6fccb6010 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -114,44 +114,12 @@ struct Hint { byte _point; }; -struct SaveStruct { - int _faithScore; - byte _pourc[11]; - byte _teauto[43]; - byte _sjer[31]; - int _currPlace; - int _atticBallHoleObjectId; - int _atticRodHoleObjectId; - int _cellarObjectId; - int _secretPassageObjectId; - int _wellObjectId; - int _selectedObjectId; - int _purpleRoomObjectId; - int _cryptObjectId; - bool _alreadyEnteredManor; - byte _fullHour; -}; - -struct SpeechQueue { - int _val; - int _code; - int _acc; - int _freq; - int _rep; -}; - struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; }; -struct Pattern { - byte _tay, _tax; - byte _des[kMaxPatt + 1][kMaxPatt + 1]; -}; - typedef int tablint[256]; -//typedef Common::Point tabdb[17]; typedef int tfxx[108]; /*---------------------------------------------------------------------------*/ @@ -206,8 +174,6 @@ extern int g_msg[5]; extern byte g_touv[8]; extern byte g_bufcha[391]; -extern byte g_lettres[7][24]; - extern uint16 g_t_mot[kMaxTi + 1]; extern int g_tay_tchar; extern Hint g_t_rec[kMaxTd + 1]; -- cgit v1.2.3 From 09e8c82e8fc29472ec18d0a7ff2c69cc9b31975d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Mar 2012 00:35:19 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 58 ++++++------- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/keyboard.cpp | 2 +- engines/mortevielle/menu.cpp | 8 +- engines/mortevielle/mor.cpp | 64 +++++++-------- engines/mortevielle/mortevielle.cpp | 158 ++++++++++++++++++++---------------- engines/mortevielle/mortevielle.h | 18 +++- engines/mortevielle/outtext.cpp | 16 ++-- engines/mortevielle/saveload.cpp | 10 +-- engines/mortevielle/saveload.h | 2 + engines/mortevielle/speech.cpp | 26 +++--- engines/mortevielle/speech.h | 5 ++ engines/mortevielle/var_mor.cpp | 46 +---------- engines/mortevielle/var_mor.h | 25 +----- 14 files changed, 208 insertions(+), 232 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 3d92db84be..bcf291b0f1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,13 +42,13 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((_coreVar._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == ROOM26) && (_msg[4] == _menu._moveMenu[6])) { _coreVar._currPlace = LANDING; g_caff = _coreVar._currPlace; afdes(); repon(2, _coreVar._currPlace); } - if ((_coreVar._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { if (!_syn) ecr3(getEngineString(S_GO_TO)); tfleche(); @@ -89,7 +89,7 @@ void MortevielleEngine::fctMove() { tsort(); int menuChoice = 1; - while (_menu._moveMenu[menuChoice] != g_msg[4]) + while (_menu._moveMenu[menuChoice] != _msg[4]) ++menuChoice; if (_coreVar._currPlace == MOUNTAIN) { @@ -209,7 +209,7 @@ void MortevielleEngine::fctTake() { _obpart = false; affrep(); } else { - g_tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; + _tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; tsuiv(); ++g_dobj; if (g_dobj > 6) { @@ -307,7 +307,7 @@ void MortevielleEngine::fctInventoryTake() { cx = 0; do { ++cx; - } while (_menu._inventoryMenu[cx] != g_msg[4]); + } while (_menu._inventoryMenu[cx] != _msg[4]); cz = 0; cy = 0; do { @@ -352,7 +352,7 @@ void MortevielleEngine::fctLift() { tmpPlace = 14; else if (_coreVar._currPlace == MOUNTAIN) tmpPlace = 15; - g_crep = g_tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; + g_crep = _tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; if (g_crep == 255) g_crep = 997; } @@ -446,7 +446,7 @@ void MortevielleEngine::fctLook() { cx -= 4; if (_coreVar._currPlace == ROOM26) cx = 21; - g_crep = g_tabdon[arega + (cx * 7) + g_num - 1]; + g_crep = _tabdon[arega + (cx * 7) + g_num - 1]; if ((_coreVar._currPlace == ATTIC) && (g_num == 8)) g_crep = 126; if (_coreVar._currPlace == MOUNTAIN) @@ -508,8 +508,8 @@ void MortevielleEngine::fctSearch() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); - if (g_num != ord(g_touv[cx])) + } while ((cx <= 6) && (g_num != ord(_touv[cx]))); + if (g_num != ord(_touv[cx])) g_crep = 187; else { if (_currBitIndex > 0) @@ -590,7 +590,7 @@ void MortevielleEngine::fctOpen() { if (g_caff == ROOM26) { if (g_ment != 0) { - g_msg[4] = OPCODE_ENTER; + _msg[4] = OPCODE_ENTER; _syn = true; } else g_crep = 997; @@ -614,8 +614,8 @@ void MortevielleEngine::fctOpen() { int tmpPlace = 0; do { ++tmpPlace; - } while (!((tmpPlace > 6) || (ord(g_touv[tmpPlace]) == 0) || (ord(g_touv[tmpPlace]) == g_num))); - if (ord(g_touv[tmpPlace]) != g_num) { + } while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == g_num))); + if (ord(_touv[tmpPlace]) != g_num) { if (!( ((g_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) || ((g_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 5)) @@ -628,13 +628,13 @@ void MortevielleEngine::fctOpen() { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } - g_touv[tmpPlace] = chr(g_num); + _touv[tmpPlace] = chr(g_num); aniof(1, g_num); } tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - g_crep = g_tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; + g_crep = _tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; if (g_crep == 254) g_crep = 999; } else @@ -699,7 +699,7 @@ void MortevielleEngine::fctPlace() { // Do you want to enter the hidden passage? int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { - Common::String alertTxt = g_vm->getString(582); + Common::String alertTxt = getString(582); Alert::show(alertTxt, 1); bool enterPassageFl = KnowledgeCheck::show(); @@ -726,7 +726,7 @@ void MortevielleEngine::fctPlace() { dessin(0); aniof(1, 2); aniof(1, 1); - alertTxt = g_vm->getString(577); + alertTxt = getString(577); Alert::show(alertTxt, 1); aniof(2, 1); g_crep = 166; @@ -881,11 +881,11 @@ void MortevielleEngine::fctClose() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); - if (g_num == ord(g_touv[cx])) { + } while ((cx <= 6) && (g_num != ord(_touv[cx]))); + if (g_num == ord(_touv[cx])) { aniof(2, g_num); g_crep = 998; - g_touv[cx] = chr(0); + _touv[cx] = chr(0); --g_iouv; if (g_iouv < 0) g_iouv = 0; @@ -981,8 +981,8 @@ void MortevielleEngine::fctSelfPut() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(g_touv[cx]))); - if (g_num != ord(g_touv[cx])) + } while ((cx <= 6) && (g_num != ord(_touv[cx]))); + if (g_num != ord(_touv[cx])) g_crep = 187; else { g_mchai = chai; @@ -1153,8 +1153,8 @@ void MortevielleEngine::fctEnter() { g_x = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; - g_msg[3] = MENU_DISCUSS; - g_msg[4] = _menu._discussMenu[g_x]; + _msg[3] = MENU_DISCUSS; + _msg[4] = _menu._discussMenu[g_x]; _syn = true; if (g_ment == 9) { _col = true; @@ -1352,7 +1352,7 @@ void MortevielleEngine::fctDiscuss() { cx = 0; do { ++cx; - } while (_menu._discussMenu[cx] != g_msg[4]); + } while (_menu._discussMenu[cx] != _msg[4]); g_caff = 69 + cx; afdes(); repon(2, g_caff); @@ -1368,7 +1368,7 @@ void MortevielleEngine::fctDiscuss() { for (int ix = 1; ix <= 46; ++ix) te[ix] = false; for (int ix = 1; ix <= 45; ++ix) { - lib[ix] = g_vm->getString(ix + kQuestionStringIndex); + lib[ix] = getString(ix + kQuestionStringIndex); for (i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } @@ -1477,10 +1477,10 @@ void MortevielleEngine::fctDiscuss() { suj = 138; _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } - } else if (g_nbrep[g_caff - 69] < g_nbrepm[g_caff - 69]) { - suj = g_tabdon[arep + (ix << 3) + (g_caff - 70)]; - _coreVar._faithScore += g_tabdon[arcf + ix]; - ++g_nbrep[g_caff - 69]; + } else if (_nbrep[g_caff - 69] < _nbrepm[g_caff - 69]) { + suj = _tabdon[arep + (ix << 3) + (g_caff - 70)]; + _coreVar._faithScore += _tabdon[arcf + ix]; + ++_nbrep[g_caff - 69]; } else { _coreVar._faithScore += 3; suj = 139; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 5191b1ed43..318a4ba4a9 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -217,7 +217,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li col += 6; } ++i; - choiceListStr = copy(inputStr, i, 30); + choiceListStr = g_vm->copy(inputStr, i, 30); if (g_res == 2) col *= 6; else diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp index 2ce96bcede..699bd5a7bd 100644 --- a/engines/mortevielle/keyboard.cpp +++ b/engines/mortevielle/keyboard.cpp @@ -46,7 +46,7 @@ int testou() { break; case '\26' : if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) { - g_vm->decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + g_vm->decodeNumber(&g_vm->_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); ++g_vm->_c_zzz; return 61; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 1d8a10526b..ec41a7eb95 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -486,8 +486,8 @@ void Menu::mdn() { // A menu was clicked on _menuSelected = (_multiTitle) && (g_msg4 != OPCODE_NONE); menuUp(g_msg3); - g_msg[4] = g_msg4; - g_msg[3] = g_msg3; + g_vm->_msg[4] = g_msg4; + g_vm->_msg[3] = g_msg3; g_msg3 = OPCODE_NONE; g_msg4 = OPCODE_NONE; @@ -542,8 +542,8 @@ void Menu::initMenu() { } g_msg3 = OPCODE_NONE; g_msg4 = OPCODE_NONE; - g_msg[3] = OPCODE_NONE; - g_msg[4] = OPCODE_NONE; + g_vm->_msg[3] = OPCODE_NONE; + g_vm->_msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); } diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ca01e01fcf..9bd3236024 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -65,13 +65,13 @@ void adzon() { if (!f.open("don.mor")) error("Missing file - don.mor"); - f.read(g_tabdon, 7 * 256); + f.read(g_vm->_tabdon, 7 * 256); f.close(); if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); - f.read(&g_tabdon[fleche], 1 * 1916); + f.read(&g_vm->_tabdon[fleche], 1 * 1916); f.close(); if (!f.open("dec.mor")) @@ -152,7 +152,7 @@ void text1(int x, int y, int nb, int m) { void initouv() { for (int cx = 1; cx <= 7; ++cx) - g_touv[cx] = chr(0); + g_vm->_touv[cx] = chr(0); } void ecr2(Common::String str_) { @@ -164,18 +164,18 @@ void ecr2(Common::String str_) { g_vm->_screenSurface.drawString(str_, 5); else if ((int)str_.size() < (tlig << 1)) { g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); + g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.drawString(copy(str_, tlig, tlig << 1), 5); + g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, tlig << 1), 5); } else { g_vm->_largestClearScreen = true; g_vm->clearScreenType2(); g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.drawString(copy(str_, 1, (tlig - 1)), 5); + g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5); g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.drawString(copy(str_, tlig, ((tlig << 1) - 1)), 5); + g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, ((tlig << 1) - 1)), 5); g_vm->_screenSurface.putxy(8, 190); - g_vm->_screenSurface.drawString(copy(str_, tlig << 1, tlig * 3), 5); + g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig << 1, tlig * 3), 5); } } @@ -351,7 +351,7 @@ void init_nbrepm() { const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; for (int idx = 0; idx < 9; ++idx) - g_nbrepm[idx] = ipm[idx]; + g_vm->_nbrepm[idx] = ipm[idx]; } void phaz(int &rand, int &p, int cf) { @@ -440,7 +440,7 @@ void writetp(Common::String s, int t) { if (g_res == 2) g_vm->_screenSurface.drawString(s, t); else - g_vm->_screenSurface.drawString(copy(s, 1, 25), t); + g_vm->_screenSurface.drawString(g_vm->copy(s, 1, 25), t); } void aniof(int ouf, int num) { @@ -483,8 +483,8 @@ void dessin(int ad) { g_vm->prepareScreenType1(); if ((g_caff < 30) || (g_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { - if (ord(g_touv[cx]) != 0) - aniof(1, ord(g_touv[cx])); + if (ord(g_vm->_touv[cx]) != 0) + aniof(1, ord(g_vm->_touv[cx])); } if (g_caff == 13) { @@ -568,7 +568,7 @@ void tlu(int af, int ob) { repon(2, 999); tkey1(true); g_caff = af; - g_msg[3] = OPCODE_NONE; + g_vm->_msg[3] = OPCODE_NONE; g_crep = 998; } @@ -587,7 +587,7 @@ void tsort() { } for (int cx = 1; cx <= 7; ++cx) - g_touv[cx] = chr(0); + g_vm->_touv[cx] = chr(0); g_ment = 0; g_iouv = 0; g_mchai = 0; @@ -648,7 +648,7 @@ void modinv() { } void mennor() { - g_vm->_menu.menuUp(g_msg[3]); + g_vm->_menu.menuUp(g_vm->_msg[3]); } void premtet() { @@ -662,10 +662,10 @@ void ajchai() { int cx = 0; do { ++cx; - } while ((cx <= 9) && (g_tabdon[cy + cx] != 0)); + } while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0)); - if (g_tabdon[cy + cx] == 0) - g_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; + if (g_vm->_tabdon[cy + cx] == 0) + g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; else g_crep = 192; } @@ -716,8 +716,8 @@ L1: int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); g_caff = 69 + cx; g_crep = g_caff; - g_msg[3] = MENU_DISCUSS; - g_msg[4] = g_vm->_menu._discussMenu[cx]; + g_vm->_msg[3] = MENU_DISCUSS; + g_vm->_msg[4] = g_vm->_menu._discussMenu[cx]; g_vm->_syn = true; g_vm->_col = true; } else { @@ -749,7 +749,7 @@ void tsuiv() { ++cx; ++g_cs; cl = cy + g_cs; - tbcl = g_tabdon[cl]; + tbcl = g_vm->_tabdon[cl]; } while ((tbcl == 0) && (g_cs <= 9)); if ((tbcl != 0) && (g_cs < 11)) { @@ -811,12 +811,12 @@ void tcoord(int sx) { int atdon = amzon + 3; int cy = 0; while (cy < g_caff) { - a += g_tabdon[atdon]; + a += g_vm->_tabdon[atdon]; atdon += 4; ++cy; } - if (g_tabdon[atdon] == 0) { + if (g_vm->_tabdon[atdon] == 0) { g_crep = 997; return; } @@ -824,10 +824,10 @@ void tcoord(int sx) { a += fleche; int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } - ib = (g_tabdon[a + cb] << 8) + g_tabdon[(a + cb + 1)]; + ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; if (ib == 0) { g_crep = 997; return; @@ -836,11 +836,11 @@ void tcoord(int sx) { cy = 1; do { cb += 2; - sx = g_tabdon[a + cb] * g_res; - sy = g_tabdon[(a + cb + 1)]; + sx = g_vm->_tabdon[a + cb] * g_res; + sy = g_vm->_tabdon[(a + cb + 1)]; cb += 2; - ix = g_tabdon[a + cb] * g_res; - iy = g_tabdon[(a + cb + 1)]; + ix = g_vm->_tabdon[a + cb] * g_res; + iy = g_vm->_tabdon[(a + cb + 1)]; ++cy; } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); @@ -879,7 +879,7 @@ void treg(int ob) { int mdes = g_caff; g_caff = ob; - if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) { + if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { afdes(); if ((g_caff > 29) && (g_caff < 33)) repon(2, g_caff); @@ -887,7 +887,7 @@ void treg(int ob) { repon(2, g_caff + 400); tkey1(true); g_caff = mdes; - g_msg[3] = 0; + g_vm->_msg[3] = 0; g_crep = 998; } else { g_vm->_obpart = true; @@ -913,7 +913,7 @@ void rechai(int &ch) { if (g_vm->_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1]; + ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_num - 1]; } int t23coul() { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 907e305be8..ffad259f9d 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -200,7 +200,7 @@ Common::ErrorCode MortevielleEngine::initialise() { loadPalette(); loadCFIPH(); loadCFIEC(); - decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); _c_zzz = 1; init_nbrepm(); initMouse(); @@ -564,7 +564,7 @@ void MortevielleEngine::mainGame() { loadCFIEC(); for (g_crep = 1; g_crep <= _c_zzz; ++g_crep) - decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); _menu.initMenu(); @@ -638,18 +638,18 @@ void MortevielleEngine::handleAction() { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (_menu._menuSelected && (g_msg[3] == MENU_SAVE)) { - Common::String saveName = Common::String::format("Savegame #%d", g_msg[4] & 7); - _savegameManager.saveGame(g_msg[4] & 7, saveName); + if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) { + Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 7); + _savegameManager.saveGame(_msg[4] & 7, saveName); } - if (_menu._menuSelected && (g_msg[3] == MENU_LOAD)) - _savegameManager.loadGame((g_msg[4] & 7) - 1); + if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) + _savegameManager.loadGame((_msg[4] & 7) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(_hintPctMessage, 1); return; } else if (inkey == '\77') { - if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) { - g_msg[4] = g_mnumo; + if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { + _msg[4] = _menuOpcode; ecr3(getEngineString(S_IDEM)); } else return; @@ -670,17 +670,17 @@ void MortevielleEngine::handleAction() { if (g_num == 9999) g_num = 0; } else { - g_mnumo = g_msg[3]; - if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF)) - g_mnumo = g_msg[4]; + _menuOpcode = _msg[3]; + if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF)) + _menuOpcode = _msg[4]; if (!_anyone) { if ((_heroSearching) || (_obpart)) { if (_mouse._pos.y < 12) return; - if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) { + if ((_msg[4] == OPCODE_SOUND) || (_msg[4] == OPCODE_LIFT)) { oo = true; - if ((g_msg[4] == OPCODE_LIFT) || (_obpart)) { + if ((_msg[4] == OPCODE_LIFT) || (_obpart)) { endSearch(); g_caff = _coreVar._currPlace; g_crep = 998; @@ -1858,7 +1858,7 @@ void MortevielleEngine::gameLoaded() { _hiddenHero = false; _brt = false; g_maff = 68; - g_mnumo = OPCODE_NONE; + _menuOpcode = OPCODE_NONE; g_prebru = 0; g_x = 0; g_y = 0; @@ -1908,71 +1908,71 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_brt) { - if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { + if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { g_ctrm = 4; mennor(); return; } } - if (g_msg[3] == MENU_MOVE) + if (_msg[3] == MENU_MOVE) fctMove(); - if (g_msg[3] == MENU_DISCUSS) + if (_msg[3] == MENU_DISCUSS) fctDiscuss(); - if (g_msg[3] == MENU_INVENTORY) + if (_msg[3] == MENU_INVENTORY) fctInventoryTake(); - if (g_msg[4] == OPCODE_ATTACH) + if (_msg[4] == OPCODE_ATTACH) fctAttach(); - if (g_msg[4] == OPCODE_WAIT) + if (_msg[4] == OPCODE_WAIT) fctWait(); - if (g_msg[4] == OPCODE_FORCE) + if (_msg[4] == OPCODE_FORCE) fctForce(); - if (g_msg[4] == OPCODE_SLEEP) + if (_msg[4] == OPCODE_SLEEP) fctSleep(); - if (g_msg[4] == OPCODE_LISTEN) + if (_msg[4] == OPCODE_LISTEN) fctListen(); - if (g_msg[4] == OPCODE_ENTER) + if (_msg[4] == OPCODE_ENTER) fctEnter(); - if (g_msg[4] == OPCODE_CLOSE) + if (_msg[4] == OPCODE_CLOSE) fctClose(); - if (g_msg[4] == OPCODE_SEARCH) + if (_msg[4] == OPCODE_SEARCH) fctSearch(); - if (g_msg[4] == OPCODE_KNOCK) + if (_msg[4] == OPCODE_KNOCK) fctKnock(); - if (g_msg[4] == OPCODE_SCRATCH) + if (_msg[4] == OPCODE_SCRATCH) fctScratch(); - if (g_msg[4] == OPCODE_READ) + if (_msg[4] == OPCODE_READ) fctRead(); - if (g_msg[4] == OPCODE_EAT) + if (_msg[4] == OPCODE_EAT) fctEat(); - if (g_msg[4] == OPCODE_PLACE) + if (_msg[4] == OPCODE_PLACE) fctPlace(); - if (g_msg[4] == OPCODE_OPEN) + if (_msg[4] == OPCODE_OPEN) fctOpen(); - if (g_msg[4] == OPCODE_TAKE) + if (_msg[4] == OPCODE_TAKE) fctTake(); - if (g_msg[4] == OPCODE_LOOK) + if (_msg[4] == OPCODE_LOOK) fctLook(); - if (g_msg[4] == OPCODE_SMELL) + if (_msg[4] == OPCODE_SMELL) fctSmell(); - if (g_msg[4] == OPCODE_SOUND) + if (_msg[4] == OPCODE_SOUND) fctSound(); - if (g_msg[4] == OPCODE_LEAVE) + if (_msg[4] == OPCODE_LEAVE) fctLeave(); - if (g_msg[4] == OPCODE_LIFT) + if (_msg[4] == OPCODE_LIFT) fctLift(); - if (g_msg[4] == OPCODE_TURN) + if (_msg[4] == OPCODE_TURN) fctTurn(); - if (g_msg[4] == OPCODE_SSEARCH) + if (_msg[4] == OPCODE_SSEARCH) fctSelfSearch(); - if (g_msg[4] == OPCODE_SREAD) + if (_msg[4] == OPCODE_SREAD) fctSelfRead(); - if (g_msg[4] == OPCODE_SPUT) + if (_msg[4] == OPCODE_SPUT) fctSelfPut(); - if (g_msg[4] == OPCODE_SLOOK) + if (_msg[4] == OPCODE_SLOOK) fctSelftLook(); _hiddenHero = false; - if (g_msg[4] == OPCODE_SHIDE) + if (_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { if (_anyone) { @@ -2158,13 +2158,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { uint16 oct, ocd; /* 5-8 */ - oct = g_t_mot[idx]; + oct = _inpBuffer[idx]; oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { ++idx; oct = oct << (5 - pt); pt += 11; - oct = oct | ((uint)g_t_mot[idx] >> pt); + oct = oct | ((uint)_inpBuffer[idx] >> pt); } else { pt -= 5; oct = (uint)oct >> pt; @@ -2177,13 +2177,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { break; case 30: case 31: - ocd = g_t_mot[idx]; + ocd = _inpBuffer[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { ++idx; ocd = ocd << (5 - pt); pt += 11; - ocd = ocd | ((uint)g_t_mot[idx] >> pt); + ocd = ocd | ((uint)_inpBuffer[idx] >> pt); } else { pt -= 5; ocd = (uint)ocd >> pt; @@ -2217,21 +2217,21 @@ Common::String MortevielleEngine::getString(int num) { } else if (!_txxFileFl) { wrkStr = getGameString(num); } else { - int i = g_t_rec[num]._hintId; - byte k = g_t_rec[num]._point; + int hint = _ntpBuffer[num]._hintId; + byte point = _ntpBuffer[num]._point; int length = 0; bool endFl = false; char let; do { - cinq_huit(let, i, k, endFl); + cinq_huit(let, hint, point, endFl); if (length < 254) wrkStr += let; ++length; } while (!endFl); } - if (wrkStr.lastChar() == '$') - // Remove trailing '$' + while (wrkStr.lastChar() == '$') + // Remove trailing '$'s wrkStr.deleteLastChar(); return wrkStr; @@ -2240,7 +2240,7 @@ Common::String MortevielleEngine::getString(int num) { void MortevielleEngine::copcha() { int i = kAcha; do { - g_tabdon[i] = g_tabdon[i + 390]; + _tabdon[i] = _tabdon[i + 390]; ++i; } while (i != kAcha + 390); } @@ -2288,7 +2288,7 @@ void MortevielleEngine::resetVariables() { _coreVar._teauto[33] = '*'; for (int i = 1; i <= 8; ++i) - g_nbrep[i] = 0; + _nbrep[i] = 0; init_nbrepm(); } @@ -2352,7 +2352,7 @@ void MortevielleEngine::loadPalette() { if (!f.open("fxx.mor")) error("Missing file - fxx.mor"); for (int i = 0; i < 108; ++i) - g_l[i] = f.readSint16LE(); + _fxxBuffer[i] = f.readSint16LE(); f.close(); if (!f.open("plxx.mor")) @@ -2423,14 +2423,14 @@ void MortevielleEngine::loadTexts() { } for (int i = 0; i < inpFile.size() / 2; ++i) - g_t_mot[i] = inpFile.readUint16LE(); + _inpBuffer[i] = inpFile.readUint16LE(); inpFile.close(); _txxFileFl = true; for (int i = 0; i < (ntpFile.size() / 3); ++i) { - g_t_rec[i]._hintId = ntpFile.readSint16LE(); - g_t_rec[i]._point = ntpFile.readByte(); + _ntpBuffer[i]._hintId = ntpFile.readSint16LE(); + _ntpBuffer[i]._point = ntpFile.readByte(); } ntpFile.close(); @@ -2453,7 +2453,7 @@ void MortevielleEngine::loadCFIEC() { if (!f.open("cfiec.mor")) error("Missing file - cfiec.mor"); - f.read(&g_adcfiec[0], 822 * 128); + f.read(&_cfiecBuffer[0], 822 * 128); f.close(); _reloadCFIEC = false; @@ -2467,7 +2467,7 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - cfiph.mor"); for (int i = 0; i < (f.size() / 2); ++i) - g_t_cph[i] = f.readSint16LE(); + _speechManager._cfiphBuffer[i] = f.readSint16LE(); f.close(); } @@ -2492,13 +2492,13 @@ void MortevielleEngine::music() { _soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); _addfix = (float)((kTempoMusic - g_addv[1])) / 256; - _speechManager.cctable(g_tbi); + _speechManager.cctable(_speechManager._tbi); bool fin = false; int k = 0; do { fin = keyPressed(); - _soundManager.musyc(g_tbi, 9958, kTempoMusic); + _soundManager.musyc(_speechManager._tbi, 9958, kTempoMusic); ++k; fin = fin | keyPressed() | (k >= 5); } while (!fin); @@ -2532,7 +2532,7 @@ void MortevielleEngine::showTitleScreen() { */ void MortevielleEngine::draw(int ad, int x, int y) { _mouse.hideMouse(); - setPal(g_numpal); + setPal(_numpal); pictout(ad, 0, x, y); _mouse.showMouse(); } @@ -2584,9 +2584,9 @@ void MortevielleEngine::prepareRoom() { int i = 0; do { ++i; - if (g_nbrepm[i] != 0) - --g_nbrepm[i]; - g_nbrep[i] = 0; + if (_nbrepm[i] != 0) + --_nbrepm[i]; + _nbrep[i] = 0; } while (i != 8); } if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { @@ -2769,4 +2769,26 @@ void MortevielleEngine::drawClock() { } } +void MortevielleEngine::palette(int v1) { + warning("TODO: palette"); +} + +/** + * Returns a substring of the given string + * @param s Source string + * @param idx Starting index (1 based) + * @param size Number of characters to return + */ + +Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) { + // Copy the substring into a temporary buffer + char *tmp = new char[size + 1]; + strncpy(tmp, s.c_str() + idx - 1, size); + tmp[size] = '\0'; + + Common::String result(tmp); + delete[] tmp; + return result; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c0230cf5cc..46795e682a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -135,6 +135,7 @@ private: Common::StringArray _gameStrings; Pattern _patternArr[15]; + int _menuOpcode; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); @@ -156,12 +157,22 @@ private: void loadCFIEC(); void loadCFIPH(); void showTitleScreen(); - int readclock(); - + int readclock(); + void palette(int v1); public: Common::String _hintPctMessage; Common::Point _prevPos; + byte _tabdon[4001]; + byte _cfiecBuffer[822 * 128]; + int _fxxBuffer[108]; + byte _touv[8]; + int _msg[5]; + int _nbrep[9]; + int _nbrepm[9]; + uint16 _inpBuffer[kMaxTi + 1]; + Hint _ntpBuffer[kMaxTd + 1]; + bool _roomPresenceLuc; bool _roomPresenceIda; bool _purpleRoomPresenceLeo; @@ -202,6 +213,8 @@ public: int _minute; float _addfix; + int _numpal; + Common::Point _stdPal[91][17]; t_pcga _cgaPal[91]; int _c_zzz; @@ -360,6 +373,7 @@ public: void drawRightFrame(); void prepareRoom(); void drawClock(); + Common::String copy(const Common::String &s, int idx, size_t size); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 22385ed0fe..bb57ac07e6 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -281,16 +281,16 @@ void taffich() { npal = a; for (cx = 0; cx <= (a - 1); ++cx) - lgt = lgt + g_l[cx]; - handle = g_l[a]; + lgt += g_vm->_fxxBuffer[cx]; + handle = g_vm->_fxxBuffer[a]; filename = "DXX.mor"; } else { filename = "DZZ.mor"; - handle = g_l[87]; + handle = g_vm->_fxxBuffer[87]; if (a == 51) { lgt = handle; - handle = g_l[88]; + handle = g_vm->_fxxBuffer[88]; } g_maff = a; npal = a + 37; @@ -310,7 +310,7 @@ void taffich() { alllum[k] = -1; } } - g_numpal = npal; + g_vm->_numpal = npal; g_vm->setPal(npal); if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { @@ -323,8 +323,8 @@ void taffich() { else if (b > 15) --b; for (cx = 0; cx <= (b - 1); ++cx) - lgt += g_l[cx + 89]; - handle = g_l[b + 89]; + lgt += g_vm->_fxxBuffer[cx + 89]; + handle = g_vm->_fxxBuffer[b + 89]; filename = "AXX.mor"; } else if (b == 50) { filename = "AZZ.mor"; @@ -333,7 +333,7 @@ void taffich() { charani(filename, lgt, handle); } g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index fa26132e9b..d71e2fd8b7 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -66,7 +66,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsByte(g_vm->_saveStruct._alreadyEnteredManor); sz.syncAsByte(g_vm->_saveStruct._fullHour); - sz.syncBytes(g_bufcha, 391); + sz.syncBytes(_tabdonSaveBuffer, 391); } /** @@ -108,7 +108,7 @@ void SavegameManager::loadSavegame(int n) { g_vm->_coreVar = g_vm->_saveStruct; for (int i = 0; i <= 389; ++i) - g_tabdon[i + kAcha] = g_bufcha[i]; + g_vm->_tabdon[i + kAcha] = _tabdonSaveBuffer[i]; // Close the stream delete stream; @@ -141,10 +141,10 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { g_vm->hourToChar(); for (i = 0; i <= 389; ++i) - g_bufcha[i] = g_tabdon[i + kAcha]; + _tabdonSaveBuffer[i] = g_vm->_tabdon[i + kAcha]; g_vm->_saveStruct = g_vm->_coreVar; - if (g_vm->_saveStruct._currPlace == 26) - g_vm->_saveStruct._currPlace = 15; + if (g_vm->_saveStruct._currPlace == ROOM26) + g_vm->_saveStruct._currPlace = LANDING; Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index c1c3c80c09..a89fc9db89 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -49,6 +49,8 @@ struct SavegameHeader { class SavegameManager { private: + byte _tabdonSaveBuffer[391]; + void sync_save(Common::Serializer &sz); public: void loadSavegame(int n); diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 69a0c331da..7d235cd6e5 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -93,8 +93,8 @@ void SpeechManager::charg_car(int &currWordNumb) { void SpeechManager::entroct(byte o) { - g_mem[kAdrTroct * 16 + g_ptr_oct] = o; - ++g_ptr_oct; + g_mem[kAdrTroct * 16 + _ptr_oct] = o; + ++_ptr_oct; } void SpeechManager::veracf(byte b) { @@ -115,7 +115,7 @@ void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { - g_t_cph[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]); + _cfiphBuffer[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]); i += 2; ++j; } while (i < kOffsetB3 + 8790); @@ -148,7 +148,7 @@ void SpeechManager::loadPhonemeSounds() { error("Missing file - phbrui.mor"); for (int i = 1; i <= 3; ++i) - g_t_cph[i] = f.readSint16LE(); + _cfiphBuffer[i] = f.readSint16LE(); f.close(); } @@ -499,13 +499,13 @@ void SpeechManager::initQueue() { void SpeechManager::handlePhoneme() { const int deca[3] = {300, 30, 40}; - int startPos = swap(g_t_cph[_phonemeNumb - 1]) + deca[_typlec]; - int endPos = swap(g_t_cph[_phonemeNumb]) + deca[_typlec]; + int startPos = swap(_cfiphBuffer[_phonemeNumb - 1]) + deca[_typlec]; + int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], g_t_cph[i]); + WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], _cfiphBuffer[i]); - g_ptr_oct = 0; + _ptr_oct = 0; int currWord = 0; initQueue(); @@ -536,14 +536,14 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { _typlec = typ; if (_typlec != 0) { for (int i = 0; i <= 500; ++i) - savph[i] = g_t_cph[i]; + savph[i] = _cfiphBuffer[i]; tempo = kTempoNoise; } else if (g_haut > 5) tempo = kTempoF; else tempo = kTempoM; g_vm->_addfix = (float)((tempo - g_addv[0])) / 256; - cctable(g_tbi); + cctable(_tbi); switch (typ) { case 1: loadNoise(); @@ -558,13 +558,13 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { break; } handlePhoneme(); - g_vm->_soundManager.litph(g_tbi, typ, tempo); + g_vm->_soundManager.litph(_tbi, typ, tempo); if (_typlec != 0) for (int i = 0; i <= 500; ++i) { - g_t_cph[i] = savph[i]; + _cfiphBuffer[i] = savph[i]; g_mlec = _typlec; } - g_vm->setPal(g_numpal); + g_vm->setPal(g_vm->_numpal); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 0c12a43acb..9eccd04d5f 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -68,9 +68,14 @@ class SpeechManager { private: int _typlec; int _phonemeNumb; + SpeechQueue _queue[3]; + int _ptr_oct; public: + int _cfiphBuffer[6401]; + int _tbi[256]; + SpeechManager(); void spfrac(int wor); void charg_car(int &currWordNumb); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 8b82aaccdf..b6cc46c93e 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -92,31 +92,8 @@ int g_x, g_mchai, g_menup, g_mpers, - g_mnumo, g_perdep, - g_prebru, - g_numpal, - g_ptr_oct, - g_k_tempo; - -int g_t_cph[6401]; -byte g_tabdon[4001]; - -int g_nbrep[9]; -int g_nbrepm[9]; -int g_msg[5]; -byte g_touv[8]; -byte g_bufcha[391]; - -byte g_lettres[7][24]; - -uint16 g_t_mot[kMaxTi + 1]; -int g_tay_tchar; -Hint g_t_rec[kMaxTd + 1]; -int g_l[108]; -int g_tbi[256]; - -byte g_adcfiec[(4088 * 16) + (311 * 0x80)]; + g_prebru; /*---------------------------------------------------------------------------*/ /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ @@ -131,23 +108,6 @@ void hirs() { g_vm->_screenSurface.clearScreen(); } -/** - * Returns a substring of the given string - * @param s Source string - * @param idx Starting index (1 based) - * @param size Number of characters to return - */ -Common::String copy(const Common::String &s, int idx, size_t size) { - // Copy the substring into a temporary buffer - char *tmp = new char[size + 1]; - strncpy(tmp, s.c_str() + idx - 1, size); - tmp[size] = '\0'; - - Common::String result(tmp); - delete[] tmp; - return result; -} - /*---------------------------------------------------------------------------*/ /*------------------------------ STUBS ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -155,10 +115,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) { int g_port[0xfff]; byte g_mem[65536 * 16]; -void palette(int v1) { - warning("TODO: palette"); -} - void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index a6fccb6010..26e4edde27 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -158,36 +158,14 @@ extern int g_x, g_mchai, g_menup, g_mpers, - g_mnumo, g_perdep, - g_prebru, - g_numpal, - g_ptr_oct, - g_k_tempo; - -extern int g_t_cph[6401]; // Speech -extern byte g_tabdon[4001]; - -extern int g_nbrep[9]; -extern int g_nbrepm[9]; -extern int g_msg[5]; -extern byte g_touv[8]; -extern byte g_bufcha[391]; - -extern uint16 g_t_mot[kMaxTi + 1]; -extern int g_tay_tchar; -extern Hint g_t_rec[kMaxTd + 1]; -extern int g_l[108]; -extern int g_tbi[256]; - -extern byte g_adcfiec[822 * 128]; + g_prebru; /*---------------------------------------------------------------------------*/ /*------------------- PROCEDURES AND FONCTIONS ------------------------*/ /*---------------------------------------------------------------------------*/ void hirs(); -Common::String copy(const Common::String &s, int idx, size_t size); void Val(const Common::String &s, int &V, int Code); /*---------------------------------------------------------------------------*/ @@ -197,7 +175,6 @@ void Val(const Common::String &s, int &V, int Code); extern int g_port[0xfff]; extern byte g_mem[65536 * 16]; -extern void palette(int v1); } // End of namespace Mortevielle -- cgit v1.2.3 From 0111cea7d7b9164125cb6163050d1ddfcc1335f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Mar 2012 07:44:04 +0100 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 12 +++---- engines/mortevielle/dialogs.cpp | 4 +-- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/menu.cpp | 70 ++++++++++++++++++------------------- engines/mortevielle/menu.h | 2 ++ engines/mortevielle/mor.cpp | 31 +++++++--------- engines/mortevielle/mor.h | 1 - engines/mortevielle/mortevielle.cpp | 37 ++++++++++++-------- engines/mortevielle/mortevielle.h | 18 +++++++--- engines/mortevielle/mouse.cpp | 58 +++++++++++++++--------------- engines/mortevielle/mouse.h | 3 +- engines/mortevielle/outtext.cpp | 13 +++---- engines/mortevielle/speech.cpp | 64 ++++++++++++++++++++++----------- engines/mortevielle/speech.h | 1 + engines/mortevielle/var_mor.cpp | 48 ------------------------- engines/mortevielle/var_mor.h | 33 ----------------- 16 files changed, 176 insertions(+), 221 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index bcf291b0f1..1c3314fe90 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -209,7 +209,7 @@ void MortevielleEngine::fctTake() { _obpart = false; affrep(); } else { - _tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0; + _tabdon[kAcha + ((_mchai - 1) * 10) + g_cs - 1] = 0; tsuiv(); ++g_dobj; if (g_dobj > 6) { @@ -515,8 +515,8 @@ void MortevielleEngine::fctSearch() { if (_currBitIndex > 0) _coreVar._faithScore += 3; - rechai(g_mchai); - if (g_mchai != 0) { + rechai(_mchai); + if (_mchai != 0) { g_cs = 0; g_is = 0; _heroSearching = true; @@ -891,8 +891,8 @@ void MortevielleEngine::fctClose() { g_iouv = 0; int chai = 9999; rechai(chai); - if (g_mchai == chai) - g_mchai = 0; + if (_mchai == chai) + _mchai = 0; } else { g_crep = 187; } @@ -985,7 +985,7 @@ void MortevielleEngine::fctSelfPut() { if (g_num != ord(_touv[cx])) g_crep = 187; else { - g_mchai = chai; + _mchai = chai; g_crep = 999; } } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 318a4ba4a9..b14af53b00 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -299,7 +299,7 @@ bool KnowledgeCheck::show() { for (int indx = 0; indx < 10; ++indx) { g_vm->_mouse.hideMouse(); - hirs(); + g_vm->hirs(); g_vm->_mouse.showMouse(); int dialogHeight; if (g_res == 1) @@ -429,7 +429,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; - hirs(); + g_vm->hirs(); aff50(drawAni50Fl); } } while (g_key != 66); // keycode for F8 diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index dc63e05c22..2e9e0195a6 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -913,7 +913,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &g_mem[0x7000 * 16 + 2]; + const byte *paletteMap = &g_vm->_mem[0x7000 * 16 + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index ec41a7eb95..1b030935cb 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -220,8 +220,8 @@ void Menu::displayMenu() { void Menu::drawMenu() { displayMenu(); _menuActive = true; - g_msg4 = OPCODE_NONE; - g_msg3 = OPCODE_NONE; + _msg4 = OPCODE_NONE; + _msg3 = OPCODE_NONE; _menuSelected = false; g_vm->setMouseClick(false); _multiTitle = false; @@ -232,15 +232,15 @@ void Menu::drawMenu() { * @remarks Originally called 'invers' */ void Menu::invert(int indx) { - if (g_msg4 == OPCODE_NONE) + if (_msg4 == OPCODE_NONE) return; - int menuIndex = lo(g_msg4); + int menuIndex = lo(_msg4); - g_vm->_screenSurface.putxy(_menuConstants[g_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + g_vm->_screenSurface.putxy(_menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; - switch (g_msg3) { + switch (_msg3) { case 1: str = _inventoryStringArray[menuIndex]; break; @@ -279,14 +279,14 @@ void Menu::invert(int indx) { if ((str[0] != '*') && (str[0] != '<')) g_vm->_screenSurface.drawString(str, indx); else - g_msg4 = OPCODE_NONE; + _msg4 = OPCODE_NONE; } void Menu::util(Common::Point pos) { - int ymx = (_menuConstants[g_msg3 - 1][3] << 3) + 16; - int dxcar = _menuConstants[g_msg3 - 1][2]; - int xmn = (_menuConstants[g_msg3 - 1][0] << 2) * g_res; + int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; + int dxcar = _menuConstants[_msg3 - 1][2]; + int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_res; int ix; if (g_res == 1) @@ -295,15 +295,15 @@ void Menu::util(Common::Point pos) { ix = 3; int xmx = dxcar * ix * g_res + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { - ix = (((uint)pos.y >> 3) - 1) + (g_msg3 << 8); - if (ix != g_msg4) { + ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); + if (ix != _msg4) { invert(1); - g_msg4 = ix; + _msg4 = ix; invert(0); } - } else if (g_msg4 != OPCODE_NONE) { + } else if (_msg4 != OPCODE_NONE) { invert(1); - g_msg4 = OPCODE_NONE; + _msg4 = OPCODE_NONE; } } @@ -419,7 +419,7 @@ void Menu::menuUp(int xx) { void Menu::eraseMenu() { _menuActive = false; g_vm->setMouseClick(false); - menuUp(g_msg3); + menuUp(_msg3); } /** @@ -459,37 +459,37 @@ void Menu::mdn() { else ix = MENU_FILE; - if ((ix != g_msg3) || (!_multiTitle)) - if (!((ix == MENU_FILE) && ((g_msg3 == MENU_SAVE) || (g_msg3 == MENU_LOAD)))) { - menuUp(g_msg3); + if ((ix != _msg3) || (!_multiTitle)) + if (!((ix == MENU_FILE) && ((_msg3 == MENU_SAVE) || (_msg3 == MENU_LOAD)))) { + menuUp(_msg3); menuDown(ix); - g_msg3 = ix; - g_msg4 = OPCODE_NONE; + _msg3 = ix; + _msg4 = OPCODE_NONE; } } else { // Not in the MenuTitle line if ((curPos.y > 11) && (_multiTitle)) util(curPos); } } else { // There was a click - if ((g_msg3 == MENU_FILE) && (g_msg4 != OPCODE_NONE)) { + if ((_msg3 == MENU_FILE) && (_msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); - menuUp(g_msg3); - if (lo(g_msg4) == 1) - g_msg3 = 7; + menuUp(_msg3); + if (lo(_msg4) == 1) + _msg3 = 7; else - g_msg3 = 8; - menuDown(g_msg3); + _msg3 = 8; + menuDown(_msg3); g_vm->setMouseClick(false); } else { // A menu was clicked on - _menuSelected = (_multiTitle) && (g_msg4 != OPCODE_NONE); - menuUp(g_msg3); - g_vm->_msg[4] = g_msg4; - g_vm->_msg[3] = g_msg3; - g_msg3 = OPCODE_NONE; - g_msg4 = OPCODE_NONE; + _menuSelected = (_multiTitle) && (_msg4 != OPCODE_NONE); + menuUp(_msg3); + g_vm->_msg[4] = _msg4; + g_vm->_msg[3] = _msg3; + _msg3 = OPCODE_NONE; + _msg4 = OPCODE_NONE; g_vm->setMouseClick(false); } @@ -540,8 +540,8 @@ void Menu::initMenu() { if (i > 6) g_vm->_menu.disableMenuItem(_inventoryMenu[i]); } - g_msg3 = OPCODE_NONE; - g_msg4 = OPCODE_NONE; + _msg3 = OPCODE_NONE; + _msg4 = OPCODE_NONE; g_vm->_msg[3] = OPCODE_NONE; g_vm->_msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index b600d4e3af..f4d12bc676 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -41,6 +41,8 @@ enum { class Menu { private: byte _charArr[7][24]; + int _msg3; + int _msg4; void util(Common::Point pos); void invert(int indx); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 9bd3236024..4c1d4dedf9 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -46,15 +46,15 @@ namespace Mortevielle { void pictout(int seg, int dep, int x, int y) { GfxSurface surface; - surface.decode(&g_mem[seg * 16 + dep]); + surface.decode(&g_vm->_mem[seg * 16 + dep]); if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - g_mem[0x7000 * 16 + 2] = 0; - g_mem[0x7000 * 16 + 32] = 15; + g_vm->_mem[0x7000 * 16 + 2] = 0; + g_vm->_mem[0x7000 * 16 + 32] = 15; } - if ((g_caff != 51) && (READ_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&g_mem[0x7000 * 16 + 0x4138], 0x100); + if ((g_caff != 51) && (READ_LE_UINT16(&g_vm->_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&g_vm->_mem[0x7000 * 16 + 0x4138], 0x100); g_vm->_screenSurface.drawPicture(surface, x, y); } @@ -77,7 +77,7 @@ void adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&g_mem[0x73a2 * 16 + 0], 1 * 1664); + f.read(&g_vm->_mem[0x73a2 * 16 + 0], 1 * 1664); f.close(); } @@ -85,12 +85,12 @@ void adzon() { * Returns the offset within the compressed image data resource of the desired image */ int animof(int ouf, int num) { - int nani = g_mem[kAdrAni * 16 + 1]; + int nani = g_vm->_mem[kAdrAni * 16 + 1]; int aux = num; if (ouf != 1) aux += nani; - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_mem[kAdrAni * 16 + (aux << 1)]); + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_vm->_mem[kAdrAni * 16 + (aux << 1)]); return animof_result; } @@ -185,13 +185,6 @@ void ecr3(Common::String text) { g_vm->_screenSurface.drawString(text, 5); } -void stop() { - hirs(); - g_vm->_currGraphicalDevice = MODE_AMSTRAD1512; - hirs(); - g_vm->quitGame(); -} - void paint_rect(int x, int y, int dx, int dy) { int co; @@ -460,7 +453,7 @@ void aniof(int ouf, int num) { int offset = animof(ouf, num); GfxSurface surface; - surface.decode(&g_mem[ad * 16 + offset]); + surface.decode(&g_vm->_mem[ad * 16 + offset]); g_vm->_screenSurface.drawPicture(surface, 0, 12); g_vm->prepareScreenType1(); @@ -590,7 +583,7 @@ void tsort() { g_vm->_touv[cx] = chr(0); g_ment = 0; g_iouv = 0; - g_mchai = 0; + g_vm->_mchai = 0; debloc(g_vm->_coreVar._currPlace); } @@ -658,7 +651,7 @@ void premtet() { /* NIVEAU 5 */ void ajchai() { - int cy = kAcha + ((g_mchai - 1) * 10) - 1; + int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; @@ -743,7 +736,7 @@ void tsuiv() { int tbcl; int cl; - int cy = kAcha + ((g_mchai - 1) * 10) - 1; + int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 03a4c0f757..30b0cafb47 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -54,7 +54,6 @@ extern void text1(int x, int y, int nb, int m); extern void initouv(); extern void ecr2(Common::String str_); extern void ecr3(Common::String text); -extern void stop(); extern void paint_rect(int x, int y, int dx, int dy); /* NIVEAU 12 */ extern void modobj(int m); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index ffad259f9d..05d6e05a56 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -541,7 +541,7 @@ Common::Error MortevielleEngine::run() { */ void MortevielleEngine::showIntroduction() { f3f8::aff50(false); - g_mlec = 0; + _speechManager._mlec = 0; f3f8::checkForF8(142, false); CHECK_QUIT; @@ -1656,7 +1656,7 @@ void MortevielleEngine::loseGame() { initouv(); g_ment = 0; g_iouv = 0; - g_mchai = 0; + _mchai = 0; _menu.unsetSearchMenu(); if (!_blo) t11(MANOR_FRONT); @@ -1870,7 +1870,7 @@ void MortevielleEngine::gameLoaded() { g_ment = 0; _syn = true; _heroSearching = true; - g_mchai = 0; + _mchai = 0; _manorDistance = 0; initouv(); g_iouv = 0; @@ -2303,8 +2303,8 @@ void MortevielleEngine::setPal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - g_mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; - g_mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; + g_vm->_mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; + g_vm->_mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; } break; case MODE_CGA: { @@ -2332,12 +2332,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr], p._tax); - WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr + 2], p._tay); + WRITE_LE_UINT16(&g_vm->_mem[0x6000 * 16 + addr], p._tax); + WRITE_LE_UINT16(&g_vm->_mem[0x6000 * 16 + addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - g_mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + g_vm->_mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } @@ -2443,7 +2443,7 @@ void MortevielleEngine::loadBRUIT5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128); + f.read(&g_vm->_mem[kAdrNoise5 * 16 + 0], 149 * 128); f.close(); } @@ -2486,12 +2486,12 @@ void MortevielleEngine::music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&g_mem[0x3800 * 16 + 0], 500); - fic.read(&g_mem[0x47a0 * 16 + 0], 123); + fic.read(&g_vm->_mem[0x3800 * 16 + 0], 500); + fic.read(&g_vm->_mem[0x47a0 * 16 + 0], 123); fic.close(); - _soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623); - _addfix = (float)((kTempoMusic - g_addv[1])) / 256; + _soundManager.decodeMusic(&g_vm->_mem[0x3800 * 16], &g_vm->_mem[0x5000 * 16], 623); + _addfix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); bool fin = false; @@ -2544,7 +2544,7 @@ void MortevielleEngine::draw(int ad, int x, int y) { void MortevielleEngine::drawRightFrame() { setPal(89); if (_currGraphicalDevice == MODE_HERCULES) { - g_mem[0x7000 * 16 + 14] = 15; + g_vm->_mem[0x7000 * 16 + 14] = 15; } _mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); @@ -2791,4 +2791,13 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t return result; } +void MortevielleEngine::hirs() { + // Note: The original used this to set the graphics mode and clear the screen, both at + // the start of the game, and whenever the screen need to be cleared. As such, this + // method is deprecated in favour of clearing the screen + debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); + + g_vm->_screenSurface.clearScreen(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 46795e682a..69cb12ab67 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -123,6 +123,11 @@ struct SaveStruct { byte _fullHour; }; +struct Hint { + int _hintId; + byte _point; +}; + class MortevielleEngine : public Engine { private: const ADGameDescription *_gameDescription; @@ -211,17 +216,20 @@ public: int _day; int _hour; int _minute; + int _mchai; float _addfix; - - int _numpal; - + SaveStruct _coreVar, _saveStruct; Common::Point _stdPal[91][17]; t_pcga _cgaPal[91]; + int _c_zzz; int ptr_word; byte _v_lieu[7][25]; - SaveStruct _coreVar, _saveStruct; byte g_is; + int _numpal; + + // TODO: Replace the following with proper implementations, or refactor out the code using them + byte _mem[65536 * 16]; ScreenSurface _screenSurface; PaletteManager _paletteManager; @@ -374,7 +382,7 @@ public: void prepareRoom(); void drawClock(); Common::String copy(const Common::String &s, int idx, size_t size); - + void hirs(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 301072391e..bd7e489aa9 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -57,10 +57,10 @@ void MouseHandler::hideMouse() { int k = 0; j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { - WRITE_LE_UINT16(&g_mem[0xb000 * 16 + j], s_s[0][k]); - WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j + 2], s_s[1][k]); - WRITE_LE_UINT16(&g_mem[0xba00 * 16 + j], s_s[2][k]); - WRITE_LE_UINT16(&g_mem[0xba00 * 16 + j + 2], s_s[3][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xb000 * 16 + j], s_s[0][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j + 2], s_s[1][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j], s_s[2][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j + 2], s_s[3][k]); j += 80; ++k; } while (k < 5); @@ -69,15 +69,15 @@ void MouseHandler::hideMouse() { case MODE_AMSTRAD1512: { bool imp = odd(_pos.y); for (int i = 0; i <= 3; ++i) { - g_port[0x3dd] = 1 << i; + _port[0x3dd] = 1 << i; int k = 0; j = 0; do { if (imp) { - WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j], s_s[i][k]); j += 80 - 0x2000; } else { - WRITE_LE_UINT16(&g_mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j], s_s[i][k]); j += 0x2000; } imp = !imp; @@ -87,22 +87,22 @@ void MouseHandler::hideMouse() { break; } case MODE_EGA: { - g_port[0x3c4] = 2; - g_port[0x3ce] = 8; - g_port[0x3cf] = 255; + _port[0x3c4] = 2; + _port[0x3ce] = 8; + _port[0x3cf] = 255; int i = 0; do { - g_port[0x3c5] = 1 << i; + _port[0x3c5] = 1 << i; int k = 0; j = 0; do { // Useless ? // ps = mem[0xa000 * 16 + j]; - g_mem[0xa000 * 16 + j] = lo(s_s[i][k]); + g_vm->_mem[0xa000 * 16 + j] = lo(s_s[i][k]); // Useless ?? // ps = mem[0xa000 * 16 + j + 1]; - g_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); + g_vm->_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; } while (k < 8); @@ -114,7 +114,7 @@ void MouseHandler::hideMouse() { j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (int i = 0; i <= 5; ++i) { for (int k = 0; k <= 3; ++k) - WRITE_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); + WRITE_LE_UINT16(&g_vm->_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } break; @@ -123,8 +123,8 @@ void MouseHandler::hideMouse() { int k = 0; do { for (int i = 0; i <= 3; ++i) { - WRITE_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); - WRITE_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); + WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); + WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; ++k; @@ -154,10 +154,10 @@ void MouseHandler::showMouse() { k = 0; j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { - s_s[0][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); - s_s[1][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j + 2]); - s_s[2][k] = READ_LE_UINT16(&g_mem[0xba00 * 16 + j]); - s_s[3][k] = READ_LE_UINT16(&g_mem[0xba00 * 16 + j + 2]); + s_s[0][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); + s_s[1][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j + 2]); + s_s[2][k] = READ_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j]); + s_s[3][k] = READ_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j + 2]); j += 80; ++k; } while (k < 5); @@ -167,14 +167,14 @@ void MouseHandler::showMouse() { for (i = 0; i <= 3; ++i) { j = 0; imp = odd(_pos.y); - g_port[0x3de] = i; + _port[0x3de] = i; k = 0; do { if (imp) { - s_s[i][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); j += 80 - 0x2000; } else { - s_s[i][k] = READ_LE_UINT16(&g_mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); j += 0x2000; } imp = !imp; @@ -184,14 +184,14 @@ void MouseHandler::showMouse() { break; } case MODE_EGA: - g_port[0x3ce] = 4; + _port[0x3ce] = 4; l = 0; do { - g_port[0x3cf] = l; + _port[0x3cf] = l; k = 0; j = 0; do { - s_s[l][k] = g_mem[0xa000 * 16 + j] + (g_mem[(0xa000 * 16) + j + 1] << 8); + s_s[l][k] = g_vm->_mem[0xa000 * 16 + j] + (g_vm->_mem[(0xa000 * 16) + j + 1] << 8); j += 80; ++k; } while (k < 8); @@ -202,7 +202,7 @@ void MouseHandler::showMouse() { j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) - s_s[i][k] = READ_LE_UINT16(&g_mem[0xb000 * 16 + k * 0x200 + j]); + s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb000 * 16 + k * 0x200 + j]); j += 80; } break; @@ -211,8 +211,8 @@ void MouseHandler::showMouse() { k = 0; do { for (i = 0; i <= 3; ++i) { - s_s[k][i + (k << 2)] = READ_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j]); - s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&g_mem[0xb800 * 16 + 0x200 * i + j + 2]); + s_s[k][i + (k << 2)] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j]); + s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2]); } j += 160; ++k; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 0bf46d926d..b570f8913c 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -36,7 +36,8 @@ class MouseHandler { private: int s_s[12][6]; int _counter; - + // TODO: Replace the following with proper implementations, or refactor out the code using them + int _port[0xfff]; public: Common::Point _pos; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index bb57ac07e6..8a3ecb8041 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -37,6 +37,7 @@ namespace Mortevielle { typedef unsigned char uchar; +const byte _rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; static int l_motsuiv(int p, const char *ch, int &tab) { int c = p; @@ -140,14 +141,14 @@ void chardes(Common::String filename, int32 skipSize, int length) { int totalLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (totalLength > 0) { - f.read(&g_mem[memIndx], 128); + f.read(&g_vm->_mem[memIndx], 128); totalLength -= 128; memIndx += 128; } f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[0x7000 * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; + g_vm->_mem[0x7000 * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; } void charani(Common::String filename, int32 skipSize, int length) { @@ -167,14 +168,14 @@ void charani(Common::String filename, int32 skipSize, int length) { int fullLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (fullLength > 0) { - f.read(&g_mem[memIndx], 128); + f.read(&g_vm->_mem[memIndx], 128); fullLength -= 128; memIndx += 128; } f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_mem[kAdrAni * 16 + i - remainingSkipSize] = g_mem[0x6000 * 16 + i]; + g_vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; } void taffich() { @@ -298,7 +299,7 @@ void taffich() { chardes(filename, lgt, handle); if (g_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&g_mem[(0x7000 * 16) + ((i + 1) << 1)]); + int palh = READ_LE_UINT16(&g_vm->_mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -306,7 +307,7 @@ void taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - g_mem[(0x7000 * 16) + 2 + (k << 1)] = g_rang[i]; + g_vm->_mem[(0x7000 * 16) + 2 + (k << 1)] = _rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 7d235cd6e5..d8731f96ac 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -35,6 +35,28 @@ namespace Mortevielle { +const byte _tnocon[364] = { + 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 byte _intcon[26] = {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 byte _typcon[26] = {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 byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; +const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; + SpeechManager::SpeechManager() { _typlec = 0; _phonemeNumb = 0; @@ -53,7 +75,7 @@ void SpeechManager::spfrac(int wor) { } void SpeechManager::charg_car(int &currWordNumb) { - int wor = swap(READ_LE_UINT16(&g_mem[kAdrWord + currWordNumb])); + int wor = swap(READ_LE_UINT16(&g_vm->_mem[kAdrWord + currWordNumb])); int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { @@ -65,7 +87,7 @@ void SpeechManager::charg_car(int &currWordNumb) { } else if ((int_ >= 22) && (int_ <= 47)) { int_ = int_ - 22; _queue[2]._val = int_; - _queue[2]._code = g_typcon[int_]; + _queue[2]._code = _typcon[int_]; } else if ((int_ >= 48) && (int_ <= 56)) { _queue[2]._val = int_ - 22; _queue[2]._code = 4; @@ -93,7 +115,7 @@ void SpeechManager::charg_car(int &currWordNumb) { void SpeechManager::entroct(byte o) { - g_mem[kAdrTroct * 16 + _ptr_oct] = o; + g_vm->_mem[kAdrTroct * 16 + _ptr_oct] = o; ++_ptr_oct; } @@ -115,7 +137,7 @@ void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { - _cfiphBuffer[j] = READ_LE_UINT16(&g_mem[kAdrNoise3 + i]); + _cfiphBuffer[j] = READ_LE_UINT16(&g_vm->_mem[kAdrNoise3 + i]); i += 2; ++j; } while (i < kOffsetB3 + 8790); @@ -131,9 +153,9 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&g_mem[0x7414 * 16 + 0], 273); + f.read(&g_vm->_mem[0x7414 * 16 + 0], 273); - g_vm->_soundManager.decodeMusic(&g_mem[0x7414 * 16], &g_mem[kAdrNoise * 16], 273); + g_vm->_soundManager.decodeMusic(&g_vm->_mem[0x7414 * 16], &g_vm->_mem[kAdrNoise * 16], 273); f.close(); } @@ -164,10 +186,10 @@ void SpeechManager::loadNoise() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&g_mem[kAdrNoise * 16 + 0], 250); + f.read(&g_vm->_mem[kAdrNoise * 16 + 0], 250); for (i = 0; i <= 19013; ++i) - g_mem[kAdrNoise * 16 + 32000 + i] = g_mem[kAdrNoise5 + i]; - f.read(&g_mem[kAdrNoise1 * 16 + kOffsetB1], 149); + g_vm->_mem[kAdrNoise * 16 + 32000 + i] = g_vm->_mem[kAdrNoise5 + i]; + f.read(&g_vm->_mem[kAdrNoise1 * 16 + kOffsetB1], 149); f.close(); } @@ -185,7 +207,7 @@ void SpeechManager::trait_car() { case 5: case 6: if (_queue[1]._code == 6) - d3 = g_tabdph[(_queue[1]._val - 14) << 1]; + d3 = _tabdph[(_queue[1]._val - 14) << 1]; else d3 = kNullValue; if (_queue[0]._code >= 5) { @@ -315,7 +337,7 @@ void SpeechManager::trait_car() { veracf(_queue[2]._acc); if (_queue[2]._code == 6) { entroct(4); - entroct(g_tabdph[(_queue[2]._val - 14) << 1]); + entroct(_tabdph[(_queue[2]._val - 14) << 1]); entroct(_queue[1]._val); } else { entroct(4); @@ -337,7 +359,7 @@ void SpeechManager::trait_car() { d2 = 8; break; case 6: - d2 = g_tabdph[(_queue[2]._val - 14) << 1]; + d2 = _tabdph[(_queue[2]._val - 14) << 1]; break; case 5: d2 = _queue[2]._val; @@ -347,7 +369,7 @@ void SpeechManager::trait_car() { break; } // switch c3._code d2 = (d2 * 26) + _queue[1]._val; - if (g_tnocon[d2] == 0) + if (_tnocon[d2] == 0) d3 = 2; else d3 = 6; @@ -393,7 +415,7 @@ void SpeechManager::trait_car() { d2 = 8; break; case 6: - d2 = g_tabdph[(_queue[2]._val - 14) << 1]; + d2 = _tabdph[(_queue[2]._val - 14) << 1]; break; case 5: d2 = _queue[2]._val; @@ -405,7 +427,7 @@ void SpeechManager::trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[_queue[1]._val] != 0) + if (_intcon[_queue[1]._val] != 0) ++_queue[1]._val; if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) @@ -442,7 +464,7 @@ void SpeechManager::trait_car() { d2 = 8; break; case 6: - d2 = g_tabdph[(_queue[2]._val - 14) << 1]; + d2 = _tabdph[(_queue[2]._val - 14) << 1]; break; case 5: d2 = _queue[2]._val; @@ -455,12 +477,12 @@ void SpeechManager::trait_car() { if (d2 == 4) d2 = 3; - if (g_intcon[_queue[1]._val] != 0) + if (_intcon[_queue[1]._val] != 0) ++_queue[1]._val; entroct(4); entroct(d2); - entroct(g_tabdbc[((_queue[1]._val - 26) << 1) + 1]); + entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); } break; @@ -503,7 +525,7 @@ void SpeechManager::handlePhoneme() { int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], _cfiphBuffer[i]); + WRITE_LE_UINT16(&g_vm->_mem[kAdrWord + currWord], _cfiphBuffer[i]); _ptr_oct = 0; int currWord = 0; @@ -542,7 +564,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { tempo = kTempoF; else tempo = kTempoM; - g_vm->_addfix = (float)((tempo - g_addv[0])) / 256; + g_vm->_addfix = (float)((tempo - 8)) / 256; cctable(_tbi); switch (typ) { case 1: @@ -562,7 +584,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { if (_typlec != 0) for (int i = 0; i <= 500; ++i) { _cfiphBuffer[i] = savph[i]; - g_mlec = _typlec; + _mlec = _typlec; } g_vm->setPal(g_vm->_numpal); } diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 9eccd04d5f..6521fd9927 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -75,6 +75,7 @@ private: public: int _cfiphBuffer[6401]; int _tbi[256]; + int _mlec; SpeechManager(); void spfrac(int wor); diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index b6cc46c93e..6fc0593d65 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -33,35 +33,6 @@ namespace Mortevielle { -/*---------------------------------------------------------------------------*/ -/*------------------------------ CONSTANTS ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -const byte g_tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -const byte g_tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte g_typcon[26] = {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 byte g_intcon[26] = {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 byte g_tnocon[364] = { - 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 byte g_addv[2] = {8, 8}; - -const byte g_rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; - /*---------------------------------------------------------------------------*/ /*------------------------------ VARIABLES ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -86,11 +57,8 @@ int g_x, g_iouv, g_ctrm, g_dobj, - g_msg3, - g_msg4, g_mlec, g_mchai, - g_menup, g_mpers, g_perdep, g_prebru; @@ -99,22 +67,6 @@ int g_x, /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ /*---------------------------------------------------------------------------*/ -void hirs() { - // Note: The original used this to set the graphics mode and clear the screen, both at - // the start of the game, and whenever the screen need to be cleared. As such, this - // method is deprecated in favour of clearing the screen - debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); - - g_vm->_screenSurface.clearScreen(); -} - -/*---------------------------------------------------------------------------*/ -/*------------------------------ STUBS ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -int g_port[0xfff]; -byte g_mem[65536 * 16]; - void musyc(tablint &tb, int nbseg, int att) { warning("TODO: musyc"); } diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 26e4edde27..9ac807aa95 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -101,19 +101,6 @@ enum places { DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; -extern const byte g_tabdbc[18]; -extern const byte g_tabdph[16]; -extern const byte g_typcon[26]; -extern const byte g_intcon[26]; -extern const byte g_tnocon[364]; -extern const byte g_addv[2]; -extern const byte g_rang[16]; - -struct Hint { - int _hintId; - byte _point; -}; - struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; @@ -152,30 +139,10 @@ extern int g_x, g_iouv, g_ctrm, g_dobj, - g_msg3, - g_msg4, - g_mlec, - g_mchai, - g_menup, g_mpers, g_perdep, g_prebru; -/*---------------------------------------------------------------------------*/ -/*------------------- PROCEDURES AND FONCTIONS ------------------------*/ -/*---------------------------------------------------------------------------*/ - -void hirs(); -void Val(const Common::String &s, int &V, int Code); - -/*---------------------------------------------------------------------------*/ -/*------------------------------ STUBS ------------------------------*/ -/*---------------------------------------------------------------------------*/ -// TODO: Replace the following with proper implementations, or refactor out the code using them - -extern int g_port[0xfff]; -extern byte g_mem[65536 * 16]; - } // End of namespace Mortevielle #endif -- cgit v1.2.3 From cdcb8d3645e86cac1f42ee5015b67521129efaf7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Mar 2012 23:26:27 +0100 Subject: MORTEVIELLE: More renaming, add a piece of code to improve CGA/EGA switching --- engines/mortevielle/actions.cpp | 608 ++++++++++++++++++------------------ engines/mortevielle/dialogs.cpp | 41 ++- engines/mortevielle/graphics.cpp | 6 +- engines/mortevielle/menu.cpp | 34 +- engines/mortevielle/mor.cpp | 408 ++++++------------------ engines/mortevielle/mor.h | 17 +- engines/mortevielle/mortevielle.cpp | 403 ++++++++++++++++++------ engines/mortevielle/mortevielle.h | 44 ++- engines/mortevielle/mouse.cpp | 22 +- engines/mortevielle/outtext.cpp | 32 +- engines/mortevielle/speech.cpp | 8 +- engines/mortevielle/var_mor.cpp | 30 -- engines/mortevielle/var_mor.h | 28 -- 13 files changed, 828 insertions(+), 853 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1c3314fe90..174af9fd1a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -44,7 +44,7 @@ namespace Mortevielle { void MortevielleEngine::fctMove() { if ((_coreVar._currPlace == ROOM26) && (_msg[4] == _menu._moveMenu[6])) { _coreVar._currPlace = LANDING; - g_caff = _coreVar._currPlace; + _caff = _coreVar._currPlace; afdes(); repon(2, _coreVar._currPlace); } @@ -61,26 +61,26 @@ void MortevielleEngine::fctMove() { tcoord(1); - if (g_num == 0) + if (_num == 0) return; - if (g_num == 1) { + if (_num == 1) { _coreVar._currPlace = OWN_ROOM; _menu.setDestinationMenuText(OWN_ROOM); - } else if (g_num == 7) { + } else if (_num == 7) { _coreVar._currPlace = ATTIC; _menu.setDestinationMenuText(ATTIC); } - if (g_num != 6) + if (_num != 6) _coreVar._currPlace = ROOM26; - if ((g_num > 1) && (g_num < 6)) - g_ment = g_num - 1; - else if (g_num > 7) - g_ment = g_num - 3; + if ((_num > 1) && (_num < 6)) + _ment = _num - 1; + else if (_num > 7) + _ment = _num - 3; - if (g_num != 6) + if (_num != 6) affrep(); else showMoveMenuAlert(); @@ -160,11 +160,11 @@ void MortevielleEngine::fctMove() { gotoManorBack(); else if (menuChoice == 17) { if ((_coreVar._wellObjectId != 120) && (_coreVar._wellObjectId != 140)) - g_crep = 997; + _crep = 997; else if (_coreVar._wellObjectId == 120) - g_crep = 181; + _crep = 181; else if (_coreVar._faithScore > 80) { - g_crep = 1505; + _crep = 1505; loseGame(); } else { _coreVar._currPlace = INSIDE_WELL; @@ -182,19 +182,19 @@ void MortevielleEngine::fctMove() { * @remarks Originally called 'tprendre' */ void MortevielleEngine::fctTake() { - if (g_caff > 99) { - int cx = g_caff; + if (_caff > 99) { + int cx = _caff; avpoing(cx); - if (g_crep != 139) { + if (_crep != 139) { if (_currBitIndex > 0) _coreVar._faithScore += 3; if (_obpart) { if (_coreVar._currPlace == PURPLE_ROOM) _coreVar._purpleRoomObjectId = 0; if (_coreVar._currPlace == ATTIC) { - if (_coreVar._atticBallHoleObjectId == g_caff) + if (_coreVar._atticBallHoleObjectId == _caff) _coreVar._atticBallHoleObjectId = 0; - if (_coreVar._atticRodHoleObjectId == g_caff) + if (_coreVar._atticRodHoleObjectId == _caff) _coreVar._atticRodHoleObjectId = 0; } if (_coreVar._currPlace == CELLAR) @@ -209,12 +209,12 @@ void MortevielleEngine::fctTake() { _obpart = false; affrep(); } else { - _tabdon[kAcha + ((_mchai - 1) * 10) + g_cs - 1] = 0; + _tabdon[kAcha + ((_mchai - 1) * 10) + _cs - 1] = 0; tsuiv(); - ++g_dobj; - if (g_dobj > 6) { + ++_dobj; + if (_dobj > 6) { _coreVar._faithScore += 2; - g_dobj = 0; + _dobj = 0; } } } @@ -225,35 +225,35 @@ void MortevielleEngine::fctTake() { tfleche(); if ((_anyone) || (_keyPressedEsc)) return; - if (g_caff == 3) { + if (_caff == 3) { tcoord(2); - if (g_num == 1) { - g_crep = 152; + if (_num == 1) { + _crep = 152; return; } } tcoord(5); - if ((g_num == 0) || ((g_num == 1) && (_coreVar._currPlace == CRYPT))) { + if ((_num == 0) || ((_num == 1) && (_coreVar._currPlace == CRYPT))) { tcoord(8); - if (g_num != 0) { + if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 3; - g_crep = 997; + _crep = 997; if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) avpoing(_coreVar._purpleRoomObjectId); - if ((_coreVar._currPlace == ATTIC) && (g_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { + if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { avpoing(_coreVar._atticBallHoleObjectId); - if ((g_crep != 997) && (g_crep != 139)) + if ((_crep != 997) && (_crep != 139)) aniof(2, 7); } - if ((_coreVar._currPlace == ATTIC) && (g_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { + if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { avpoing(_coreVar._atticRodHoleObjectId); - if ((g_crep != 997) && (g_crep != 139)) + if ((_crep != 997) && (_crep != 139)) aniof(2, 6); } if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { avpoing(_coreVar._cellarObjectId); - if ((g_crep != 997) && (g_crep != 139)) + if ((_crep != 997) && (_crep != 139)) aniof(2, 2); } if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) @@ -261,40 +261,40 @@ void MortevielleEngine::fctTake() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) { avpoing(_coreVar._secretPassageObjectId); - if ((g_crep != 997) && (g_crep != 139)) { - g_crep = 182; + if ((_crep != 997) && (_crep != 139)) { + _crep = 182; aniof(2, 1); } } if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { avpoing(_coreVar._wellObjectId); - if ((g_crep != 997) && (g_crep != 139)) + if ((_crep != 997) && (_crep != 139)) aniof(2, 1); } - if ((g_crep != 997) && (g_crep != 182) && (g_crep != 139)) - g_crep = 999; + if ((_crep != 997) && (_crep != 182) && (_crep != 139)) + _crep = 999; } } else { - if ( ((_coreVar._currPlace == OWN_ROOM) && (g_num == 3)) - || ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 4)) - || ((_coreVar._currPlace == PURPLE_ROOM) && (g_num == 1)) - || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 3)) - || ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 6)) - || ((_coreVar._currPlace == RED_ROOM) && (g_num == 2)) - || ((_coreVar._currPlace == BATHROOM) && (g_num == 6)) - || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 4)) - || ((_coreVar._currPlace == ROOM9) && (g_num == 4)) - || ((_coreVar._currPlace == DINING_ROOM) && (g_num > 2)) - || ((_coreVar._currPlace == BUREAU) && (g_num == 7)) - || ((_coreVar._currPlace == KITCHEN) && (g_num == 6)) - || ((_coreVar._currPlace == ATTIC) && (g_num > 4)) + if ( ((_coreVar._currPlace == OWN_ROOM) && (_num == 3)) + || ((_coreVar._currPlace == GREEN_ROOM) && (_num == 4)) + || ((_coreVar._currPlace == PURPLE_ROOM) && (_num == 1)) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 3)) + || ((_coreVar._currPlace == BLUE_ROOM) && (_num == 6)) + || ((_coreVar._currPlace == RED_ROOM) && (_num == 2)) + || ((_coreVar._currPlace == BATHROOM) && (_num == 6)) + || ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 4)) + || ((_coreVar._currPlace == ROOM9) && (_num == 4)) + || ((_coreVar._currPlace == DINING_ROOM) && (_num > 2)) + || ((_coreVar._currPlace == BUREAU) && (_num == 7)) + || ((_coreVar._currPlace == KITCHEN) && (_num == 6)) + || ((_coreVar._currPlace == ATTIC) && (_num > 4)) || ((_coreVar._currPlace > ATTIC) && (_coreVar._currPlace != INSIDE_WELL)) ) - g_crep = 997; + _crep = 997; else if (_coreVar._currPlace == INSIDE_WELL) { - g_crep = 1504; + _crep = 1504; loseGame(); } else - g_crep = 120; + _crep = 120; } } /** @@ -319,7 +319,7 @@ void MortevielleEngine::fctInventoryTake() { _coreVar._sjer[cy] = chr(0); modinv(); avpoing(cz); - g_crep = 998; + _crep = 998; clearScreenType2(); } @@ -334,12 +334,12 @@ void MortevielleEngine::fctLift() { if ((_anyone) || (_keyPressedEsc)) return; tcoord(3); - if (g_num == 0) { + if (_num == 0) { tcoord(8); - if (g_num != 0) { + if (_num != 0) { if (_currBitIndex > 0) ++_coreVar._faithScore; - g_crep = 997; + _crep = 997; if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) treg(_coreVar._purpleRoomObjectId); } @@ -352,9 +352,9 @@ void MortevielleEngine::fctLift() { tmpPlace = 14; else if (_coreVar._currPlace == MOUNTAIN) tmpPlace = 15; - g_crep = _tabdon[asoul + (tmpPlace << 3) + (g_num - 1)]; - if (g_crep == 255) - g_crep = 997; + _crep = _tabdon[asoul + (tmpPlace << 3) + (_num - 1)]; + if (_crep == 255) + _crep = 997; } /** @@ -362,16 +362,16 @@ void MortevielleEngine::fctLift() { * @remarks Originally called 'tlire' */ void MortevielleEngine::fctRead() { - if (g_caff > 99) - st4(g_caff); + if (_caff > 99) + st4(_caff); else { if (!_syn) ecr3(getEngineString(S_READ)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { tcoord(4); - if (g_num != 0) - g_crep = 107; + if (_num != 0) + _crep = 107; } } } @@ -382,7 +382,7 @@ void MortevielleEngine::fctRead() { */ void MortevielleEngine::fctSelfRead() { if (_coreVar._selectedObjectId == 0) - g_crep = 186; + _crep = 186; else st4(_coreVar._selectedObjectId); } @@ -394,8 +394,8 @@ void MortevielleEngine::fctSelfRead() { void MortevielleEngine::fctLook() { int cx; - if (g_caff > 99) { - g_crep = 103; + if (_caff > 99) { + _crep = 103; return; } if (!_syn) @@ -404,35 +404,35 @@ void MortevielleEngine::fctLook() { if ((_anyone) || (_keyPressedEsc)) return; tcoord(5); - if (g_num == 0) { + if (_num == 0) { tcoord(8); - g_crep = 131; - if (g_num != 0) { + _crep = 131; + if (_num != 0) { if (_coreVar._currPlace == ATTIC) { - if (g_num == 1) { - g_crep = 164; + if (_num == 1) { + _crep = 164; if (_coreVar._atticRodHoleObjectId != 0) treg(_coreVar._atticRodHoleObjectId); else if (_coreVar._atticBallHoleObjectId != 0) treg(_coreVar._atticBallHoleObjectId); } else { - g_crep = 193; + _crep = 193; if (_coreVar._atticRodHoleObjectId != 0) treg(_coreVar._atticRodHoleObjectId); } } if (_coreVar._currPlace == CELLAR) { - g_crep = 164; + _crep = 164; if (_coreVar._cellarObjectId != 0) treg(_coreVar._cellarObjectId); } if (_coreVar._currPlace == SECRET_PASSAGE) { - g_crep = 174; + _crep = 174; if (_coreVar._secretPassageObjectId != 0) treg(_coreVar._secretPassageObjectId); } if (_coreVar._currPlace == WELL) { - g_crep = 131; + _crep = 131; if (_coreVar._wellObjectId != 0) treg(_coreVar._wellObjectId); } @@ -446,22 +446,22 @@ void MortevielleEngine::fctLook() { cx -= 4; if (_coreVar._currPlace == ROOM26) cx = 21; - g_crep = _tabdon[arega + (cx * 7) + g_num - 1]; - if ((_coreVar._currPlace == ATTIC) && (g_num == 8)) - g_crep = 126; + _crep = _tabdon[arega + (cx * 7) + _num - 1]; + if ((_coreVar._currPlace == ATTIC) && (_num == 8)) + _crep = 126; if (_coreVar._currPlace == MOUNTAIN) - g_crep = 103; - if (g_crep == 255) - g_crep = 131; - if ((_coreVar._currPlace == GREEN_ROOM) && (g_num == 1)) + _crep = 103; + if (_crep == 255) + _crep = 131; + if ((_coreVar._currPlace == GREEN_ROOM) && (_num == 1)) treg(144); - if ((_coreVar._currPlace == BLUE_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == BLUE_ROOM) && (_num == 3)) treg(147); - if ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 3)) + if ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 3)) treg(149); - if ((_coreVar._currPlace == 9) && (g_num == 2)) + if ((_coreVar._currPlace == 9) && (_num == 2)) treg(30); - if ((_coreVar._currPlace == DINING_ROOM) && (g_num == 3)) + if ((_coreVar._currPlace == DINING_ROOM) && (_num == 3)) treg(31); } @@ -473,7 +473,7 @@ void MortevielleEngine::fctSelftLook() { if (_coreVar._selectedObjectId != 0) treg(_coreVar._selectedObjectId); else - g_crep = 186; + _crep = 186; } /** @@ -483,8 +483,8 @@ void MortevielleEngine::fctSelftLook() { void MortevielleEngine::fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; - if (g_caff > 99) { - st7(g_caff); + if (_caff > 99) { + st7(_caff); return; } @@ -496,49 +496,49 @@ void MortevielleEngine::fctSearch() { return; if (_coreVar._currPlace == INSIDE_WELL) { - g_crep = 1504; + _crep = 1504; loseGame(); return; } tcoord(6); - if (g_num == 0) { + if (_num == 0) { tcoord(7); - if (g_num != 0) { + if (_num != 0) { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(_touv[cx]))); - if (g_num != ord(_touv[cx])) - g_crep = 187; + } while ((cx <= 6) && (_num != ord(_touv[cx]))); + if (_num != ord(_touv[cx])) + _crep = 187; else { if (_currBitIndex > 0) _coreVar._faithScore += 3; rechai(_mchai); if (_mchai != 0) { - g_cs = 0; - g_is = 0; + _cs = 0; + _is = 0; _heroSearching = true; _menu.setSearchMenu(); tsuiv(); } else - g_crep = 997; + _crep = 997; } } else { tcoord(8); - g_crep = 997; - if (g_num != 0) { + _crep = 997; + if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 3; if ((_coreVar._currPlace != WELL) && (_coreVar._currPlace != SECRET_PASSAGE) && (_coreVar._currPlace != ATTIC)) { if (_coreVar._currPlace == PURPLE_ROOM) { - g_crep = 123; + _crep = 123; if (_coreVar._purpleRoomObjectId != 0) treg(_coreVar._purpleRoomObjectId); } if (_coreVar._currPlace == CRYPT) { - g_crep = 123; + _crep = 123; if (_coreVar._cryptObjectId != 0) treg(_coreVar._cryptObjectId); } @@ -548,24 +548,24 @@ void MortevielleEngine::fctSearch() { } else { if (_currBitIndex > 0) _coreVar._faithScore += 3; - g_crep = 997; + _crep = 997; if (_coreVar._currPlace < CELLAR) - g_crep = r[_coreVar._currPlace]; + _crep = r[_coreVar._currPlace]; - if ((_coreVar._currPlace == TOILETS) && (g_num == 2)) - g_crep = 162; + if ((_coreVar._currPlace == TOILETS) && (_num == 2)) + _crep = 162; if (_coreVar._currPlace == KITCHEN) { - if ((g_num == 3) || (g_num == 4)) - g_crep = 162; - else if (g_num == 5) - g_crep = 159; + if ((_num == 3) || (_num == 4)) + _crep = 162; + else if (_num == 5) + _crep = 159; } if (_coreVar._currPlace == MOUNTAIN) - g_crep = 104; + _crep = 104; else if (_coreVar._currPlace == CRYPT) - g_crep = 155; + _crep = 155; } } @@ -577,7 +577,7 @@ void MortevielleEngine::fctSelfSearch() { if (_coreVar._selectedObjectId != 0) st7(_coreVar._selectedObjectId); else - g_crep = 186; + _crep = 186; } /** @@ -588,16 +588,16 @@ void MortevielleEngine::fctOpen() { if (!_syn) ecr3(getEngineString(S_OPEN)); - if (g_caff == ROOM26) { - if (g_ment != 0) { + if (_caff == ROOM26) { + if (_ment != 0) { _msg[4] = OPCODE_ENTER; _syn = true; } else - g_crep = 997; + _crep = 997; return; } - if (g_caff == 15) { + if (_caff == 15) { showMoveMenuAlert(); return; } @@ -607,38 +607,38 @@ void MortevielleEngine::fctOpen() { return; tcoord(7); - if (g_num != 0) { + if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 2; - ++g_iouv; + ++_iouv; int tmpPlace = 0; do { ++tmpPlace; - } while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == g_num))); - if (ord(_touv[tmpPlace]) != g_num) { - if (!( ((g_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) - || ((g_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) - || ((_coreVar._currPlace == DARKBLUE_ROOM) && (g_num == 5)) - || ((g_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) - || ((_coreVar._currPlace == GREEN_ROOM2) && (g_num == 2)) - || ((_coreVar._currPlace == KITCHEN) && (g_num == 7))) ) { + } while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == _num))); + if (ord(_touv[tmpPlace]) != _num) { + if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) + || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) + || ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 5)) + || ((_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) + || ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 2)) + || ((_coreVar._currPlace == KITCHEN) && (_num == 7))) ) { if ( ((_coreVar._currPlace > DINING_ROOM) && (_coreVar._currPlace < CELLAR)) || ((_coreVar._currPlace > RED_ROOM) && (_coreVar._currPlace < DINING_ROOM)) || (_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } - _touv[tmpPlace] = chr(g_num); - aniof(1, g_num); + _touv[tmpPlace] = chr(_num); + aniof(1, _num); } tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - g_crep = _tabdon[aouvr + (tmpPlace * 7) + g_num - 1]; - if (g_crep == 254) - g_crep = 999; + _crep = _tabdon[aouvr + (tmpPlace * 7) + _num - 1]; + if (_crep == 254) + _crep = 999; } else - g_crep = 18; + _crep = 18; } } @@ -648,7 +648,7 @@ void MortevielleEngine::fctOpen() { */ void MortevielleEngine::fctPlace() { if (_coreVar._selectedObjectId == 0) { - g_crep = 186; + _crep = 186; return; } @@ -657,25 +657,25 @@ void MortevielleEngine::fctPlace() { tfleche(); if (_keyPressedEsc) - g_crep = 998; + _crep = 998; if ((_anyone) || (_keyPressedEsc)) return; tcoord(8); - if (g_num != 0) { - g_crep = 999; - if (g_caff == 13) { - if (g_num == 1) { + if (_num != 0) { + _crep = 999; + if (_caff == 13) { + if (_num == 1) { if (_coreVar._atticBallHoleObjectId != 0) { - g_crep = 188; + _crep = 188; } else { _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 141) aniof(1, 7); } } else if (_coreVar._atticRodHoleObjectId != 0) { - g_crep = 188; + _crep = 188; } else { _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 159) @@ -683,9 +683,9 @@ void MortevielleEngine::fctPlace() { } } - if (g_caff == 14) { + if (_caff == 14) { if (_coreVar._cellarObjectId != 0) { - g_crep = 188; + _crep = 188; } else { _coreVar._cellarObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 151) { @@ -729,49 +729,49 @@ void MortevielleEngine::fctPlace() { alertTxt = getString(577); Alert::show(alertTxt, 1); aniof(2, 1); - g_crep = 166; + _crep = 166; } affrep(); } else { aniof(2, 1); - g_crep = 166; + _crep = 166; } return; } } } - if (g_caff == 16) { + if (_caff == 16) { if (_coreVar._cryptObjectId == 0) _coreVar._cryptObjectId = _coreVar._selectedObjectId; else - g_crep = 188; + _crep = 188; } - if (g_caff == 17) { + if (_caff == 17) { if (_coreVar._secretPassageObjectId != 0) { - g_crep = 188; + _crep = 188; } else if (_coreVar._selectedObjectId == 143) { _coreVar._secretPassageObjectId = 143; aniof(1, 1); } else { - g_crep = 1512; + _crep = 1512; loseGame(); } } - if (g_caff == 24) { + if (_caff == 24) { if (_coreVar._wellObjectId != 0) { - g_crep = 188; + _crep = 188; } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else { - g_crep = 185; + _crep = 185; } } - if (g_crep != 188) + if (_crep != 188) maivid(); } } @@ -781,8 +781,8 @@ void MortevielleEngine::fctPlace() { * @remarks Originally called 'ttourner' */ void MortevielleEngine::fctTurn() { - if (g_caff > 99) { - g_crep = 149; + if (_caff > 99) { + _crep = 149; return; } if (!_syn) @@ -791,8 +791,8 @@ void MortevielleEngine::fctTurn() { if ((_anyone) || (_keyPressedEsc)) return; tcoord(9); - if (g_num != 0) { - g_crep = 997; + if (_num != 0) { + _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { repon(2, 167); _speechManager.startSpeech(7, 9, 1); @@ -800,7 +800,7 @@ void MortevielleEngine::fctTurn() { if (answer == 1) _endGame = true; else - g_crep = 168; + _crep = 168; } if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { repon(2, 175); @@ -811,7 +811,7 @@ void MortevielleEngine::fctTurn() { _coreVar._currPlace = CRYPT; affrep(); } else - g_crep = 176; + _crep = 176; } } } @@ -826,11 +826,11 @@ void MortevielleEngine::fctSelfHide() { tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { tcoord(10); - if (g_num == 0) + if (_num == 0) _hiddenHero = false; else { _hiddenHero = true; - g_crep = 999; + _crep = 999; } } } @@ -841,21 +841,21 @@ void MortevielleEngine::fctSelfHide() { */ void MortevielleEngine::fctAttach() { if (_coreVar._selectedObjectId == 0) - g_crep = 186; + _crep = 186; else { if (!_syn) ecr3(getEngineString(S_TIE)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { tcoord(8); - g_crep = 997; - if ((g_num != 0) && (_coreVar._currPlace == WELL)) { - g_crep = 999; + _crep = 997; + if ((_num != 0) && (_coreVar._currPlace == WELL)) { + _crep = 999; if ((_coreVar._selectedObjectId == 120) || (_coreVar._selectedObjectId == 140)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; aniof(1, 1); } else - g_crep = 185; + _crep = 185; maivid(); } } @@ -870,36 +870,36 @@ void MortevielleEngine::fctClose() { if (!_syn) ecr3(getEngineString(S_CLOSE)); - if (g_caff < ROOM26) { + if (_caff < ROOM26) { tfleche(); if (_keyPressedEsc) - g_crep = 998; + _crep = 998; if ((_anyone) || (_keyPressedEsc)) return; tcoord(7); - if (g_num != 0) { + if (_num != 0) { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(_touv[cx]))); - if (g_num == ord(_touv[cx])) { - aniof(2, g_num); - g_crep = 998; + } while ((cx <= 6) && (_num != ord(_touv[cx]))); + if (_num == ord(_touv[cx])) { + aniof(2, _num); + _crep = 998; _touv[cx] = chr(0); - --g_iouv; - if (g_iouv < 0) - g_iouv = 0; + --_iouv; + if (_iouv < 0) + _iouv = 0; int chai = 9999; rechai(chai); if (_mchai == chai) _mchai = 0; } else { - g_crep = 187; + _crep = 187; } } } - if (g_caff == ROOM26) - g_crep = 999; + if (_caff == ROOM26) + _crep = 999; } /** @@ -919,9 +919,9 @@ void MortevielleEngine::fctKnock() { tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { if ((_coreVar._currPlace < MOUNTAIN) && (_coreVar._currPlace != LANDING)) - g_crep = 133; + _crep = 133; else - g_crep = 997; + _crep = 997; } return; @@ -931,12 +931,12 @@ void MortevielleEngine::fctKnock() { int rand = (getRandomNumber(0, 8)) - 4; _speechManager.startSpeech(11, rand, 1); int p; - ecfren(p, rand, _coreVar._faithScore, g_ment); - int l = g_ment; + ecfren(p, rand, _coreVar._faithScore, _ment); + int l = _ment; if (l != 0) { if (p != -500) { if (rand > p) - g_crep = 190; + _crep = 190; else { becfren(l); getKnockAnswer(); @@ -945,8 +945,8 @@ void MortevielleEngine::fctKnock() { getKnockAnswer(); } - if (g_ment == 8) - g_crep = 190; + if (_ment == 8) + _crep = 190; } } @@ -958,12 +958,12 @@ void MortevielleEngine::fctSelfPut() { if (!_syn) ecr3(getEngineString(S_POSE)); if (_coreVar._selectedObjectId == 0) - g_crep = 186; + _crep = 186; else { - if (g_caff > 99) { - g_crep = 999; + if (_caff > 99) { + _crep = 999; ajchai(); - if (g_crep != 192) + if (_crep != 192) maivid(); return; } @@ -971,74 +971,74 @@ void MortevielleEngine::fctSelfPut() { if ((_anyone) || (_keyPressedEsc)) return; tcoord(7); - g_crep = 124; - if (g_num != 0) { + _crep = 124; + if (_num != 0) { int chai; rechai(chai); if (chai == 0) - g_crep = 997; + _crep = 997; else { int cx = 0; do { ++cx; - } while ((cx <= 6) && (g_num != ord(_touv[cx]))); - if (g_num != ord(_touv[cx])) - g_crep = 187; + } while ((cx <= 6) && (_num != ord(_touv[cx]))); + if (_num != ord(_touv[cx])) + _crep = 187; else { _mchai = chai; - g_crep = 999; + _crep = 999; } } } else { tcoord(8); - if (g_num != 0) { - g_crep = 998; - if (g_caff == PURPLE_ROOM) { + if (_num != 0) { + _crep = 998; + if (_caff == PURPLE_ROOM) { if (_coreVar._purpleRoomObjectId != 0) - g_crep = 188; + _crep = 188; else _coreVar._purpleRoomObjectId = _coreVar._selectedObjectId; } - if (g_caff == ATTIC) { - if (g_num == 1) { + if (_caff == ATTIC) { + if (_num == 1) { if (_coreVar._atticBallHoleObjectId != 0) - g_crep = 188; + _crep = 188; else _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; } else if (_coreVar._atticRodHoleObjectId != 0) { - g_crep = 188; + _crep = 188; } else { _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; } } - if (g_caff == CRYPT) { + if (_caff == CRYPT) { if (_coreVar._cryptObjectId != 0) - g_crep = 188; + _crep = 188; else _coreVar._cryptObjectId = _coreVar._selectedObjectId; } - if (g_caff == WELL) - g_crep = 185; - if ((g_caff == CELLAR) || (g_caff == SECRET_PASSAGE)) - g_crep = 124; + if (_caff == WELL) + _crep = 185; + if ((_caff == CELLAR) || (_caff == SECRET_PASSAGE)) + _crep = 124; } else { - g_crep = 124; - if (g_caff == WELL) { + _crep = 124; + if (_caff == WELL) { tcoord(5); - if (g_num != 0) - g_crep = 185; + if (_num != 0) + _crep = 185; } } } - if (g_caff == INSIDE_WELL) - g_crep = 185; - if ((g_crep == 999) || (g_crep == 185) || (g_crep == 998)) { - if (g_crep == 999) + if (_caff == INSIDE_WELL) + _crep = 185; + if ((_crep == 999) || (_crep == 185) || (_crep == 998)) { + if (_crep == 999) ajchai(); - if (g_crep != 192) + if (_crep != 192) maivid(); } } @@ -1050,17 +1050,17 @@ void MortevielleEngine::fctSelfPut() { */ void MortevielleEngine::fctListen() { if (_coreVar._currPlace != ROOM26) - g_crep = 101; + _crep = 101; else { if (_currBitIndex != 0) ++_coreVar._faithScore; int p, rand; - ecfren(p, rand, _coreVar._faithScore, g_ment); - int l = g_ment; + ecfren(p, rand, _coreVar._faithScore, _ment); + int l = _ment; if (l != 0) { if (p != -500) { if (rand > p) - g_crep = 101; + _crep = 101; else { becfren(l); int j, h, m; @@ -1068,16 +1068,16 @@ void MortevielleEngine::fctListen() { rand = getRandomNumber(1, 100); if ((h >= 0) && (h < 8)) { if (rand > 30) - g_crep = 101; + _crep = 101; else - g_crep = 178; + _crep = 178; } else if (rand > 70) - g_crep = 101; + _crep = 101; else - g_crep = 178; + _crep = 178; } } else - g_crep = 178; + _crep = 178; } } } @@ -1088,11 +1088,11 @@ void MortevielleEngine::fctListen() { */ void MortevielleEngine::fctEat() { if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { - g_crep = 148; + _crep = 148; } else { tsort(); _coreVar._currPlace = DINING_ROOM; - g_caff = 10; + _caff = 10; debloc(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); @@ -1114,11 +1114,11 @@ void MortevielleEngine::fctEat() { h = 1; } - g_jh += h; - g_crep = 135; + _jh += h; + _crep = 135; prepareRoom(); } else { - g_crep = 134; + _crep = 134; } } } @@ -1133,50 +1133,50 @@ void MortevielleEngine::fctEnter() { _menu.setDestinationMenuText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); - else if (g_ment == 0) - g_crep = 997; - else if ((g_ment == 9) && (_coreVar._selectedObjectId != 136)) { - g_crep = 189; + else if (_ment == 0) + _crep = 997; + else if ((_ment == 9) && (_coreVar._selectedObjectId != 136)) { + _crep = 189; _coreVar._teauto[8] = '*'; } else { int z = 0; if (!_blo) - z = t11(g_ment); + z = t11(_ment); if (z != 0) { - if ((g_ment == 3) || (g_ment == 7)) - g_crep = 179; + if ((_ment == 3) || (_ment == 7)) + _crep = 179; else { - g_x = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, g_x, 1); + _x = (getRandomNumber(0, 10)) - 5; + _speechManager.startSpeech(7, _x, 1); aniof(1, 1); - g_x = convertBitIndexToCharacterIndex(z); + _x = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _msg[3] = MENU_DISCUSS; - _msg[4] = _menu._discussMenu[g_x]; + _msg[4] = _menu._discussMenu[_x]; _syn = true; - if (g_ment == 9) { + if (_ment == 9) { _col = true; - g_caff = 70; + _caff = 70; afdes(); - repon(2, g_caff); + repon(2, _caff); } else _col = false; - debloc(g_ment); - g_ment = 0; + debloc(_ment); + _ment = 0; } } else { - g_x = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, g_x, 1); + _x = (getRandomNumber(0, 10)) - 5; + _speechManager.startSpeech(7, _x, 1); aniof(1, 1); - _coreVar._currPlace = g_ment; + _coreVar._currPlace = _ment; affrep(); debloc(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); - g_ment = 0; - g_mpers = 0; + _ment = 0; + _savedBitIndex = 0; _currBitIndex = 0; } } @@ -1190,7 +1190,7 @@ void MortevielleEngine::fctSleep() { int z, j, h, m; if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { - g_crep = 148; + _crep = 148; return; } if (_coreVar._currPlace != OWN_ROOM) { @@ -1214,10 +1214,10 @@ void MortevielleEngine::fctSleep() { z = (7 - h) * 2; if (m == 30) --z; - g_jh += z; + _jh += z; h = 7; } - g_jh += 2; + _jh += 2; ++h; if (h > 23) h = 0; @@ -1225,8 +1225,8 @@ void MortevielleEngine::fctSleep() { answer = Alert::show(getEngineString(S_YES_NO), 1); _anyone = false; } while (answer != 1); - g_crep = 998; - g_num = 0; + _crep = 998; + _num = 0; } /** @@ -1236,14 +1236,14 @@ void MortevielleEngine::fctSleep() { void MortevielleEngine::fctForce() { if (!_syn) ecr3(getEngineString(S_SMASH)); - if (g_caff < 25) + if (_caff < 25) tfleche(); if ((!_anyone) && (!_keyPressedEsc)) { if (_coreVar._currPlace != ROOM26) - g_crep = 997; + _crep = 997; else { - g_crep = 143; + _crep = 143; _coreVar._faithScore += 2; } } @@ -1255,9 +1255,9 @@ void MortevielleEngine::fctForce() { */ void MortevielleEngine::fctLeave() { tsort(); - g_crep = 0; + _crep = 0; if ((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK) || (_coreVar._currPlace == WELL)) - g_crep = 997; + _crep = 997; else { int nextPlace = OWN_ROOM; @@ -1269,18 +1269,18 @@ void MortevielleEngine::fctLeave() { nextPlace = LANDING; else if (_coreVar._currPlace == CRYPT) { nextPlace = SECRET_PASSAGE; - g_crep = 176; + _crep = 176; } else if (_coreVar._currPlace == SECRET_PASSAGE) nextPlace = t23coul(); else if (_coreVar._currPlace == INSIDE_WELL) nextPlace = WELL; - if (g_crep != 997) + if (_crep != 997) _coreVar._currPlace = nextPlace; - g_caff = nextPlace; - if (g_crep == 0) - g_crep = nextPlace; + _caff = nextPlace; + if (_crep == 0) + _crep = nextPlace; debloc(nextPlace); _menu.setDestinationMenuText(nextPlace); } @@ -1291,22 +1291,22 @@ void MortevielleEngine::fctLeave() { * @remarks Originally called 'tattendre' */ void MortevielleEngine::fctWait() { - g_mpers = 0; + _savedBitIndex = 0; clearScreenType3(); int answer; do { - ++g_jh; + ++_jh; prepareRoom(); if (!_blo) t11(_coreVar._currPlace); - if ((_currBitIndex != 0) && (g_mpers == 0)) { - g_crep = 998; + if ((_currBitIndex != 0) && (_savedBitIndex == 0)) { + _crep = 998; if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) - cavegre(); + initCaveOrCellar(); if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; - g_mpers = _currBitIndex; + _savedBitIndex = _currBitIndex; if (!_anyone) prepareRoom(); return; @@ -1314,7 +1314,7 @@ void MortevielleEngine::fctWait() { repon(2, 102); answer = Alert::show(getEngineString(S_YES_NO), 1); } while (answer != 2); - g_crep = 998; + _crep = 998; if (!_anyone) prepareRoom(); } @@ -1326,11 +1326,11 @@ void MortevielleEngine::fctWait() { void MortevielleEngine::fctSound() { if (!_syn) ecr3(getEngineString(S_PROBE2)); - if (g_caff < 27) { + if (_caff < 27) { tfleche(); if (!(_anyone) && (!_keyPressedEsc)) - g_crep = 145; - g_num = 0; + _crep = 145; + _num = 0; } } @@ -1353,10 +1353,10 @@ void MortevielleEngine::fctDiscuss() { do { ++cx; } while (_menu._discussMenu[cx] != _msg[4]); - g_caff = 69 + cx; + _caff = 69 + cx; afdes(); - repon(2, g_caff); - suj = g_caff + 60; + repon(2, _caff); + suj = _caff + 60; } tkey1(false); mennor(); @@ -1404,7 +1404,7 @@ void MortevielleEngine::fctDiscuss() { CHECK_QUIT; _mouse.getMousePosition(x, y, c); - x *= (3 - g_res); + x *= (3 - _res); if (x > 319) cx = 41; else @@ -1467,7 +1467,7 @@ void MortevielleEngine::fctDiscuss() { if (_col) { _col = false; _coreVar._currPlace = 15; - if (g_iouv > 0) + if (_iouv > 0) max = 8; else max = 4; @@ -1477,10 +1477,10 @@ void MortevielleEngine::fctDiscuss() { suj = 138; _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } - } else if (_nbrep[g_caff - 69] < _nbrepm[g_caff - 69]) { - suj = _tabdon[arep + (ix << 3) + (g_caff - 70)]; + } else if (_nbrep[_caff - 69] < _nbrepm[_caff - 69]) { + suj = _tabdon[arep + (ix << 3) + (_caff - 70)]; _coreVar._faithScore += _tabdon[arcf + ix]; - ++_nbrep[g_caff - 69]; + ++_nbrep[_caff - 69]; } else { _coreVar._faithScore += 3; suj = 139; @@ -1518,7 +1518,7 @@ void MortevielleEngine::fctDiscuss() { _col = false; _coreVar._currPlace = LANDING; } - g_ctrm = 0; + _controlMenu = 0; _mouse.hideMouse(); hirs(); drawRightFrame(); @@ -1537,17 +1537,17 @@ void MortevielleEngine::fctDiscuss() { * @remarks Originally called 'tsentir' */ void MortevielleEngine::fctSmell() { - g_crep = 119; - if (g_caff < ROOM26) { + _crep = 119; + if (_caff < ROOM26) { if (!_syn) ecr3(getEngineString(S_SMELL)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) - if (g_caff == 16) - g_crep = 153; - } else if (g_caff == 123) - g_crep = 110; - g_num = 0; + if (_caff == 16) + _crep = 153; + } else if (_caff == 123) + _crep = 110; + _num = 0; } /** @@ -1555,13 +1555,13 @@ void MortevielleEngine::fctSmell() { * @remarks Originally called 'tgratter' */ void MortevielleEngine::fctScratch() { - g_crep = 155; - if (g_caff < 27) { + _crep = 155; + if (_caff < 27) { if (!_syn) ecr3(getEngineString(S_SCRATCH)); tfleche(); } - g_num = 0; + _num = 0; } /** @@ -1578,7 +1578,7 @@ void MortevielleEngine::endGame() { repon(9, 1509); tkey1(false); _mouse.hideMouse(); - g_caff = 70; + _caff = 70; taffich(); hirs(); premtet(); @@ -1588,7 +1588,7 @@ void MortevielleEngine::endGame() { repon(9, 1509); repon(2, 142); tkey1(false); - g_caff = 32; + _caff = 32; afdes(); repon(6, 34); repon(2, 35); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b14af53b00..1f97ee0fe6 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -76,7 +76,7 @@ int Alert::show(const Common::String &msg, int n) { while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { ++i; st = st + chaine[i]; - if (g_res == 2) + if (g_vm->_res == 2) curPos.x -= 3; else curPos.x -= 5; @@ -93,12 +93,12 @@ int Alert::show(const Common::String &msg, int n) { esp = (uint)(nbcol - caseNumb * 40) >> 1; coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); setButtonText(cas, coldep, caseNumb, &s[0], esp); - limit[1][1] = ((uint)(coldep) >> 1) * g_res; + limit[1][1] = ((uint)(coldep) >> 1) * g_vm->_res; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * g_res; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * g_vm->_res; limit[2][2] = (limit[2][1]) + 40; } g_vm->_mouse.showMouse(); @@ -218,7 +218,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li } ++i; choiceListStr = g_vm->copy(inputStr, i, 30); - if (g_res == 2) + if (g_vm->_res == 2) col *= 6; else col *= 10; @@ -302,7 +302,7 @@ bool KnowledgeCheck::show() { g_vm->hirs(); g_vm->_mouse.showMouse(); int dialogHeight; - if (g_res == 1) + if (g_vm->_res == 1) dialogHeight = 29; else dialogHeight = 23; @@ -331,8 +331,8 @@ bool KnowledgeCheck::show() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._x1 = 45 * g_res; - coor[j]._x2 = (maxLength * 3 + 55) * g_res; + coor[j]._x1 = 45 * g_vm->_res; + coor[j]._x2 = (maxLength * 3 + 55) * g_vm->_res; coor[j]._y1 = 27 + j * 8; coor[j]._y2 = 34 + j * 8; coor[j]._enabled = true; @@ -342,7 +342,7 @@ bool KnowledgeCheck::show() { } } coor[lastOption - firstOption + 2]._enabled = false; - if (g_res == 1) + if (g_vm->_res == 1) rep = 10; else rep = 6; @@ -424,7 +424,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { teskbd(); do { g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); - g_key = waitForF3F8(); + g_vm->_key = waitForF3F8(); CHECK_QUIT; if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { @@ -432,7 +432,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { g_vm->hirs(); aff50(drawAni50Fl); } - } while (g_key != 66); // keycode for F8 + } while (g_vm->_key != 66); // keycode for F8 } /** @@ -452,27 +452,26 @@ int f3f8::waitForF3F8() { } void f3f8::aff50(bool drawAni50Fl) { - g_caff = 50; - g_maff = 0; + g_vm->_caff = 50; + g_vm->_maff = 0; taffich(); - g_vm->draw(g_ades, 63, 12); + g_vm->draw(kAdrDes, 63, 12); if (drawAni50Fl) ani50(); else - repon(2, kDialogStringIndex + 142); + g_vm->repon(2, kDialogStringIndex + 142); // Draw the f3/f8 dialog draw(); } void f3f8::ani50() { - g_crep = animof(1, 1); - pictout(kAdrAni, g_crep, 63, 12); - g_crep = animof(2, 1); - pictout(kAdrAni, g_crep, 63, 12); - g_vm->_largestClearScreen = (g_res == 1); - repon(2, kDialogStringIndex + 143); + g_vm->_crep = g_vm->animof(1, 1); + g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); + g_vm->_crep = g_vm->animof(2, 1); + g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); + g_vm->_largestClearScreen = (g_vm->_res == 1); + g_vm->repon(2, kDialogStringIndex + 143); } - } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 2e9e0195a6..42dd3c7cc7 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -992,7 +992,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (g_res == 1) { + if (g_vm->_res == 1) { x = (uint)x >> 1; dx = (uint)dx >> 1; } @@ -1059,7 +1059,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { g_vm->_mouse.hideMouse(); pt = _textPos; - if (g_res == 2) + if (g_vm->_res == 2) i = 6; else i = 10; @@ -1101,7 +1101,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (g_res == 2) ? 6 : 10; + int charWidth = (g_vm->_res == 2) ? 6 : 10; return s.size() * charWidth; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 1b030935cb..5bc0940f6c 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -180,7 +180,7 @@ void Menu::displayMenu() { g_vm->_mouse.hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * g_res; + col = 28 * g_vm->_res; if (g_vm->_currGraphicalDevice == MODE_CGA) color = 1; else @@ -209,7 +209,7 @@ void Menu::displayMenu() { } while (k != 3); ++y; } while (y != 9); - col += 48 * g_res; + col += 48 * g_vm->_res; } while (num_letr != 6); g_vm->_mouse.showMouse(); } @@ -286,14 +286,14 @@ void Menu::util(Common::Point pos) { int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; int dxcar = _menuConstants[_msg3 - 1][2]; - int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_res; + int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_res; int ix; - if (g_res == 1) + if (g_vm->_res == 1) ix = 5; else ix = 3; - int xmx = dxcar * ix * g_res + xmn + 2; + int xmx = dxcar * ix * g_vm->_res + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); if (ix != _msg4) { @@ -325,7 +325,7 @@ void Menu::menuDown(int ii) { g_vm->_mouse.hideMouse(); sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; - if (g_res == 1) + if (g_vm->_res == 1) cx = 10; else cx = 6; @@ -437,24 +437,24 @@ void Menu::mdn() { g_vm->_prevPos = curPos; bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * g_res) && curPos.x <= (28 * g_res + 24)) - || (curPos.x >= (76 * g_res) && curPos.x <= (76 * g_res + 24)) - || ((curPos.x > 124 * g_res) && (curPos.x < 124 * g_res + 24)) - || ((curPos.x > 172 * g_res) && (curPos.x < 172 * g_res + 24)) - || ((curPos.x > 220 * g_res) && (curPos.x < 220 * g_res + 24)) - || ((curPos.x > 268 * g_res) && (curPos.x < 268 * g_res + 24))); + && ((curPos.x >= (28 * g_vm->_res) && curPos.x <= (28 * g_vm->_res + 24)) + || (curPos.x >= (76 * g_vm->_res) && curPos.x <= (76 * g_vm->_res + 24)) + || ((curPos.x > 124 * g_vm->_res) && (curPos.x < 124 * g_vm->_res + 24)) + || ((curPos.x > 172 * g_vm->_res) && (curPos.x < 172 * g_vm->_res + 24)) + || ((curPos.x > 220 * g_vm->_res) && (curPos.x < 220 * g_vm->_res + 24)) + || ((curPos.x > 268 * g_vm->_res) && (curPos.x < 268 * g_vm->_res + 24))); if (tes) { int ix; - if (curPos.x < 76 * g_res) + if (curPos.x < 76 * g_vm->_res) ix = MENU_INVENTORY; - else if (curPos.x < 124 * g_res) + else if (curPos.x < 124 * g_vm->_res) ix = MENU_MOVE; - else if (curPos.x < 172 * g_res) + else if (curPos.x < 172 * g_vm->_res) ix = MENU_ACTION; - else if (curPos.x < 220 * g_res) + else if (curPos.x < 220 * g_vm->_res) ix = MENU_SELF; - else if (curPos.x < 268 * g_res) + else if (curPos.x < 268 * g_vm->_res) ix = MENU_DISCUSS; else ix = MENU_FILE; diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 4c1d4dedf9..85e34b6680 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -44,147 +44,6 @@ namespace Mortevielle { -void pictout(int seg, int dep, int x, int y) { - GfxSurface surface; - surface.decode(&g_vm->_mem[seg * 16 + dep]); - - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { - g_vm->_mem[0x7000 * 16 + 2] = 0; - g_vm->_mem[0x7000 * 16 + 32] = 15; - } - - if ((g_caff != 51) && (READ_LE_UINT16(&g_vm->_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&g_vm->_mem[0x7000 * 16 + 0x4138], 0x100); - - g_vm->_screenSurface.drawPicture(surface, x, y); -} - -void adzon() { - Common::File f; - - if (!f.open("don.mor")) - error("Missing file - don.mor"); - - f.read(g_vm->_tabdon, 7 * 256); - f.close(); - - if (!f.open("bmor.mor")) - error("Missing file - bmor.mor"); - - f.read(&g_vm->_tabdon[fleche], 1 * 1916); - f.close(); - - if (!f.open("dec.mor")) - error("Missing file - dec.mor"); - - f.read(&g_vm->_mem[0x73a2 * 16 + 0], 1 * 1664); - f.close(); -} - -/** - * Returns the offset within the compressed image data resource of the desired image - */ -int animof(int ouf, int num) { - int nani = g_vm->_mem[kAdrAni * 16 + 1]; - int aux = num; - if (ouf != 1) - aux += nani; - - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&g_vm->_mem[kAdrAni * 16 + (aux << 1)]); - - return animof_result; -} - -void modif(int &nu) { - if (nu == 26) - nu = 25; - else if ((nu > 29) && (nu < 36)) - nu -= 4; - else if ((nu > 69) && (nu < 78)) - nu -= 37; - else if ((nu > 99) && (nu < 194)) - nu -= 59; - else if ((nu > 996) && (nu < 1000)) - nu -= 862; - else if ((nu > 1500) && (nu < 1507)) - nu -= 1363; - else if ((nu > 1507) && (nu < 1513)) - nu -= 1364; - else if ((nu > 1999) && (nu < 2002)) - nu -= 1851; - else if (nu == 2010) - nu = 151; - else if ((nu > 2011) && (nu < 2025)) - nu -= 1860; - else if (nu == 2026) - nu = 165; - else if ((nu > 2029) && (nu < 2037)) - nu -= 1864; - else if ((nu > 3000) && (nu < 3005)) - nu -= 2828; - else if (nu == 4100) - nu = 177; - else if (nu == 4150) - nu = 178; - else if ((nu > 4151) && (nu < 4156)) - nu -= 3973; - else if (nu == 4157) - nu = 183; - else if ((nu == 4160) || (nu == 4161)) - nu -= 3976; -} - -/* NIVEAU 13 */ - - -void text1(int x, int y, int nb, int m) { - int co; - - if (g_res == 1) - co = 10; - else - co = 6; - Common::String tmpStr = g_vm->getString(m); - if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) - y = 176; - displayStr(tmpStr, x, y, nb, 20, g_vm->_textColor); -} - -void initouv() { - for (int cx = 1; cx <= 7; ++cx) - g_vm->_touv[cx] = chr(0); -} - -void ecr2(Common::String str_) { - // Some dead code was present in the original: removed - g_vm->_screenSurface.putxy(8, 177); - int tlig = 59 + (g_res - 1) * 36; - - if ((int)str_.size() < tlig) - g_vm->_screenSurface.drawString(str_, 5); - else if ((int)str_.size() < (tlig << 1)) { - g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5); - g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, tlig << 1), 5); - } else { - g_vm->_largestClearScreen = true; - g_vm->clearScreenType2(); - g_vm->_screenSurface.putxy(8, 176); - g_vm->_screenSurface.drawString(g_vm->copy(str_, 1, (tlig - 1)), 5); - g_vm->_screenSurface.putxy(8, 182); - g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig, ((tlig << 1) - 1)), 5); - g_vm->_screenSurface.putxy(8, 190); - g_vm->_screenSurface.drawString(g_vm->copy(str_, tlig << 1, tlig * 3), 5); - } -} - -void ecr3(Common::String text) { - g_vm->clearScreenType3(); - g_vm->_screenSurface.putxy(8, 192); - g_vm->_screenSurface.drawString(text, 5); -} - void paint_rect(int x, int y, int dx, int dy) { int co; @@ -206,59 +65,6 @@ void modobj(int m) { g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); } -void repon(int f, int m) { - if ((m > 499) && (m < 563)) { - Common::String tmpStr = g_vm->getString(m - 501 + kInventoryStringIndex); - - if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1)) - g_vm->_largestClearScreen = true; - else - g_vm->_largestClearScreen = false; - - g_vm->clearScreenType2(); - displayStr(tmpStr, 8, 176, 85, 3, 5); - } else { - modif(m); - switch (f) { - case 2: - case 8: - g_vm->clearScreenType2(); - g_vm->prepareScreenType2(); - text1(8, 182, 103, m); - if ((m == 68) || (m == 69)) - g_vm->_coreVar._teauto[40] = '*'; - if ((m == 104) && (g_caff == 14)) { - g_vm->_coreVar._teauto[36] = '*'; - if (g_vm->_coreVar._teauto[39] == '*') { - g_vm->_coreVar._pourc[3] = '*'; - g_vm->_coreVar._teauto[38] = '*'; - } - } - break; - case 1: - case 6: - case 9: { - int i; - if ((f == 1) || (f == 6)) - i = 4; - else - i = 5; - - Common::String tmpStr = g_vm->getString(m); - displayStr(tmpStr, 80, 40, 60, 25, i); - - if (m == 180) - g_vm->_coreVar._pourc[6] = '*'; - else if (m == 179) - g_vm->_coreVar._pourc[10] = '*'; - } - break; - default: - break; - } - } -} - int chlm() { int retval = g_vm->getRandomNumber(1, 2); if (retval == 2) @@ -272,12 +78,12 @@ int chlm() { *************/ void debloc(int roomId) { - g_num = 0; - g_x = 0; - g_y = 0; + g_vm->_num = 0; + g_vm->_x = 0; + g_vm->_y = 0; if ((roomId != ROOM26) && (roomId != LANDING)) g_vm->resetPresenceInRooms(roomId); - g_mpers = g_vm->_currBitIndex; + g_vm->_savedBitIndex = g_vm->_currBitIndex; } void ecfren(int &p, int &rand, int cf, int roomId) { @@ -412,37 +218,20 @@ int t11(int roomId) { return retVal; } -void cavegre() { - g_vm->_coreVar._faithScore += 2; - if (g_vm->_coreVar._faithScore > 69) - g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); - g_vm->clearScreenType3(); - g_vm->prepareScreenType2(); - ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS)); - int rand = (g_vm->getRandomNumber(0, 4)) - 2; - g_vm->_speechManager.startSpeech(2, rand, 1); - - // The original was doing here a useless loop. - // It has been removed - - g_vm->clearScreenType3(); - g_vm->displayAloneText(); -} - void writetp(Common::String s, int t) { - if (g_res == 2) + if (g_vm->_res == 2) g_vm->_screenSurface.drawString(s, t); else g_vm->_screenSurface.drawString(g_vm->copy(s, 1, 25), t); } void aniof(int ouf, int num) { - if ((g_caff == 7) && ((num == 4) || (num == 5))) + if ((g_vm->_caff == 7) && ((num == 4) || (num == 5))) return; - if ((g_caff == 10) && (num == 7)) + if ((g_vm->_caff == 10) && (num == 7)) num = 6; - else if (g_caff == 12) { + else if (g_vm->_caff == 12) { if (num == 3) num = 4; else if (num == 4) @@ -450,7 +239,7 @@ void aniof(int ouf, int num) { } int ad = kAdrAni; - int offset = animof(ouf, num); + int offset = g_vm->animof(ouf, num); GfxSurface surface; surface.decode(&g_vm->_mem[ad * 16 + offset]); @@ -462,39 +251,39 @@ void aniof(int ouf, int num) { /* NIVEAU 9 */ void dessin(int ad) { if (ad != 0) - g_vm->draw(g_ades, ((ad % 160) * 2), (ad / 160)); + g_vm->draw(kAdrDes, ((ad % 160) * 2), (ad / 160)); else { g_vm->clearScreenType1(); - if (g_caff > 99) { - g_vm->draw(g_ades, 60, 33); + if (g_vm->_caff > 99) { + g_vm->draw(kAdrDes, 60, 33); g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box - } else if (g_caff > 69) { - g_vm->draw(g_ades, 112, 48); // Heads + } else if (g_vm->_caff > 69) { + g_vm->draw(kAdrDes, 112, 48); // Heads g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); } else { - g_vm->draw(g_ades, 0, 12); + g_vm->draw(kAdrDes, 0, 12); g_vm->prepareScreenType1(); - if ((g_caff < 30) || (g_caff > 32)) { + if ((g_vm->_caff < 30) || (g_vm->_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { if (ord(g_vm->_touv[cx]) != 0) aniof(1, ord(g_vm->_touv[cx])); } - if (g_caff == 13) { + if (g_vm->_caff == 13) { if (g_vm->_coreVar._atticBallHoleObjectId == 141) aniof(1, 7); if (g_vm->_coreVar._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((g_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151)) + } else if ((g_vm->_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151)) aniof(1, 2); - else if ((g_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143)) + else if ((g_vm->_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143)) aniof(1, 1); - else if ((g_caff == 24) && (g_vm->_coreVar._wellObjectId != 0)) + else if ((g_vm->_caff == 24) && (g_vm->_coreVar._wellObjectId != 0)) aniof(1, 1); } - if (g_caff < ROOM26) + if (g_vm->_caff < ROOM26) g_vm->startMusicOrSpeech(1); } } @@ -533,7 +322,8 @@ void tkey1(bool d) { // Wait for release from any key or mouse button while (g_vm->keyPressed()) - g_key = testou(); + g_vm->_key = testou(); + do { g_vm->_mouse.getMousePosition(x, y, c); g_vm->keyPressed(); @@ -555,24 +345,24 @@ void tkey1(bool d) { /* NIVEAU 7 */ void tlu(int af, int ob) { - g_caff = 32; + g_vm->_caff = 32; afdes(); - repon(6, ob + 4000); - repon(2, 999); + g_vm->repon(6, ob + 4000); + g_vm->repon(2, 999); tkey1(true); - g_caff = af; + g_vm->_caff = af; g_vm->_msg[3] = OPCODE_NONE; - g_crep = 998; + g_vm->_crep = 998; } void affrep() { - g_caff = g_vm->_coreVar._currPlace; - g_crep = g_vm->_coreVar._currPlace; + g_vm->_caff = g_vm->_coreVar._currPlace; + g_vm->_crep = g_vm->_coreVar._currPlace; } void tsort() { - if ((g_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) { + if ((g_vm->_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) { if (g_vm->_coreVar._faithScore < 50) g_vm->_coreVar._faithScore += 2; else @@ -581,24 +371,24 @@ void tsort() { for (int cx = 1; cx <= 7; ++cx) g_vm->_touv[cx] = chr(0); - g_ment = 0; - g_iouv = 0; + g_vm->_ment = 0; + g_vm->_iouv = 0; g_vm->_mchai = 0; debloc(g_vm->_coreVar._currPlace); } void st4(int ob) { - g_crep = 997; + g_vm->_crep = 997; switch (ob) { case 114 : - g_crep = 109; + g_vm->_crep = 109; break; case 110 : - g_crep = 107; + g_vm->_crep = 107; break; case 158 : - g_crep = 113; + g_vm->_crep = 113; break; case 152: case 153: @@ -610,7 +400,7 @@ void st4(int ob) { case 157: case 160: case 161 : - tlu(g_caff, ob); + tlu(g_vm->_caff, ob); break; default: break; @@ -645,7 +435,7 @@ void mennor() { } void premtet() { - g_vm->draw(g_ades, 10, 80); + g_vm->draw(kAdrDes, 10, 80); g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); } @@ -660,7 +450,7 @@ void ajchai() { if (g_vm->_tabdon[cy + cx] == 0) g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; else - g_crep = 192; + g_vm->_crep = 192; } void ajjer(int ob) { @@ -673,32 +463,26 @@ void ajjer(int ob) { g_vm->_coreVar._sjer[(cx)] = chr(ob); modinv(); } else - g_crep = 139; + g_vm->_crep = 139; } -void tctrm() { - repon(2, (3000 + g_ctrm)); - g_ctrm = 0; -} - - void quelquun() { if (g_vm->_menu._menuDisplayed) g_vm->_menu.eraseMenu(); g_vm->endSearch(); - g_crep = 997; + g_vm->_crep = 997; L1: if (!g_vm->_hiddenHero) { - if (g_crep == 997) - g_crep = 138; - repon(2, g_crep); - if (g_crep == 138) + if (g_vm->_crep == 997) + g_vm->_crep = 138; + g_vm->repon(2, g_vm->_crep); + if (g_vm->_crep == 138) g_vm->_speechManager.startSpeech(5, 2, 1); else g_vm->_speechManager.startSpeech(4, 4, 1); - if (g_iouv == 0) + if (g_vm->_iouv == 0) g_vm->_coreVar._faithScore += 2; else if (g_vm->_coreVar._faithScore < 50) g_vm->_coreVar._faithScore += 4; @@ -707,8 +491,8 @@ L1: tsort(); g_vm->_menu.setDestinationMenuText(LANDING); int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); - g_caff = 69 + cx; - g_crep = g_caff; + g_vm->_caff = 69 + cx; + g_vm->_crep = g_vm->_caff; g_vm->_msg[3] = MENU_DISCUSS; g_vm->_msg[4] = g_vm->_menu._discussMenu[cx]; g_vm->_syn = true; @@ -716,10 +500,10 @@ L1: } else { if (g_vm->getRandomNumber(1, 3) == 2) { g_vm->_hiddenHero = false; - g_crep = 137; + g_vm->_crep = 137; goto L1; } else { - repon(2, 136); + g_vm->repon(2, 136); int rand = (g_vm->getRandomNumber(0, 4)) - 2; g_vm->_speechManager.startSpeech(3, rand, 1); g_vm->clearScreenType2(); @@ -740,22 +524,22 @@ void tsuiv() { int cx = 0; do { ++cx; - ++g_cs; - cl = cy + g_cs; + ++g_vm->_cs; + cl = cy + g_vm->_cs; tbcl = g_vm->_tabdon[cl]; - } while ((tbcl == 0) && (g_cs <= 9)); + } while ((tbcl == 0) && (g_vm->_cs <= 9)); - if ((tbcl != 0) && (g_cs < 11)) { - ++g_vm->g_is; - g_caff = tbcl; - g_crep = g_caff + 400; + if ((tbcl != 0) && (g_vm->_cs < 11)) { + ++g_vm->_is; + g_vm->_caff = tbcl; + g_vm->_crep = g_vm->_caff + 400; if (g_vm->_currBitIndex != 0) g_vm->_coreVar._faithScore += 2; } else { affrep(); g_vm->endSearch(); if (cx > 9) - g_crep = 131; + g_vm->_crep = 131; } } @@ -763,7 +547,7 @@ void tfleche() { bool qust; char touch; - if (g_num == 9999) + if (g_vm->_num == 9999) return; fenat(chr(152)); @@ -776,20 +560,20 @@ void tfleche() { CHECK_QUIT; if (g_vm->getMouseClick()) - inRect = (g_vm->_mouse._pos.x < 256 * g_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); + inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); g_vm->prepareRoom(); } while (!(qust || inRect || g_vm->_anyone)); if (qust && (touch == '\103')) Alert::show(g_vm->_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect))); if (touch == '\73') g_vm->_keyPressedEsc = true; if (inRect) { - g_x = g_vm->_mouse._pos.x; - g_y = g_vm->_mouse._pos.y; + g_vm->_x = g_vm->_mouse._pos.x; + g_vm->_y = g_vm->_mouse._pos.y; } } @@ -798,23 +582,23 @@ void tcoord(int sx) { int ib; - g_num = 0; - g_crep = 999; + g_vm->_num = 0; + g_vm->_crep = 999; int a = 0; int atdon = amzon + 3; int cy = 0; - while (cy < g_caff) { + while (cy < g_vm->_caff) { a += g_vm->_tabdon[atdon]; atdon += 4; ++cy; } if (g_vm->_tabdon[atdon] == 0) { - g_crep = 997; + g_vm->_crep = 997; return; } - a += fleche; + a += kFleche; int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; @@ -822,27 +606,27 @@ void tcoord(int sx) { } ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; if (ib == 0) { - g_crep = 997; + g_vm->_crep = 997; return; } cy = 1; do { cb += 2; - sx = g_vm->_tabdon[a + cb] * g_res; + sx = g_vm->_tabdon[a + cb] * g_vm->_res; sy = g_vm->_tabdon[(a + cb + 1)]; cb += 2; - ix = g_vm->_tabdon[a + cb] * g_res; + ix = g_vm->_tabdon[a + cb] * g_vm->_res; iy = g_vm->_tabdon[(a + cb + 1)]; ++cy; - } while (!(((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) || (cy > ib))); + } while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib))); - if ((g_x >= sx) && (g_x <= ix) && (g_y >= sy) && (g_y <= iy)) { - g_num = cy - 1; + if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) { + g_vm->_num = cy - 1; return; } - g_crep = 997; + g_vm->_crep = 997; } @@ -850,51 +634,51 @@ void st7(int ob) { switch (ob) { case 116: case 144: - g_crep = 104; + g_vm->_crep = 104; break; case 126: case 111: - g_crep = 108; + g_vm->_crep = 108; break; case 132: - g_crep = 111; + g_vm->_crep = 111; break; case 142: - g_crep = 112; + g_vm->_crep = 112; break; default: - g_crep = 183; + g_vm->_crep = 183; st4(ob); } } void treg(int ob) { - int mdes = g_caff; - g_caff = ob; + int mdes = g_vm->_caff; + g_vm->_caff = ob; - if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { + if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { afdes(); - if ((g_caff > 29) && (g_caff < 33)) - repon(2, g_caff); + if ((g_vm->_caff > 29) && (g_vm->_caff < 33)) + g_vm->repon(2, g_vm->_caff); else - repon(2, g_caff + 400); + g_vm->repon(2, g_vm->_caff + 400); tkey1(true); - g_caff = mdes; + g_vm->_caff = mdes; g_vm->_msg[3] = 0; - g_crep = 998; + g_vm->_crep = 998; } else { g_vm->_obpart = true; - g_crep = g_caff + 400; + g_vm->_crep = g_vm->_caff + 400; g_vm->_menu.setSearchMenu(); } } void avpoing(int &ob) { - g_crep = 999; + g_vm->_crep = 999; if (g_vm->_coreVar._selectedObjectId != 0) ajjer(g_vm->_coreVar._selectedObjectId); - if (g_crep != 139) { + if (g_vm->_crep != 139) { modobj(ob + 400); g_vm->_coreVar._selectedObjectId = ob; ob = 0; @@ -906,12 +690,12 @@ void rechai(int &ch) { if (g_vm->_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_num - 1]; + ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1]; } int t23coul() { if (!g_vm->checkInventory(143)) { - g_crep = 1512; + g_vm->_crep = 1512; g_vm->loseGame(); } @@ -929,9 +713,9 @@ void st13(int ob) { (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || (ob == 150) || (ob == 152)) - g_crep = 999; + g_vm->_crep = 999; else - g_crep = 105; + g_vm->_crep = 105; } void sauvecr(int y, int dy) { diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 30b0cafb47..667883ccf4 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -42,24 +42,11 @@ static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; -extern void pictout(int seg, int dep, int x, int y); -extern void sauvecr(int y, int dy); -extern void charecr(int y, int dy); -extern void adzon(); -extern int animof(int ouf, int num); -/* Niveau 14 suite */ -extern void modif(int &nu); /* NIVEAU 13 */ -extern void text1(int x, int y, int nb, int m); -extern void initouv(); -extern void ecr2(Common::String str_); -extern void ecr3(Common::String text); extern void paint_rect(int x, int y, int dx, int dy); /* NIVEAU 12 */ extern void modobj(int m); -extern void repon(int f, int m); extern int chlm(); -extern void drawClock(); /************* * NIVEAU 11 * *************/ @@ -70,7 +57,6 @@ extern void becfren(int roomId); extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); extern int t11(int roomId); -extern void cavegre(); extern void writetp(Common::String s, int t); extern void aniof(int ouf, int num); /* NIVEAU 9 */ @@ -91,7 +77,6 @@ extern void premtet(); /* NIVEAU 5 */ extern void ajchai(); extern void ajjer(int ob); -extern void tctrm(); extern void quelquun(); extern void tsuiv(); extern void tfleche(); @@ -104,5 +89,7 @@ extern int t23coul(); extern void maivid(); extern void st13(int ob); +extern void sauvecr(int y, int dy); +extern void charecr(int y, int dy); } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 05d6e05a56..536fe09114 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -175,7 +175,7 @@ Common::ErrorCode MortevielleEngine::initialise() { // Set the screen mode _currGraphicalDevice = MODE_EGA; - g_res = 2; + _res = 2; _txxFileFl = false; // Load texts from TXX files @@ -216,7 +216,6 @@ Common::ErrorCode MortevielleEngine::initialise() { if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - g_ades = 0x7000; return Common::kNoError; } @@ -563,7 +562,7 @@ void MortevielleEngine::mainGame() { if (_reloadCFIEC) loadCFIEC(); - for (g_crep = 1; g_crep <= _c_zzz; ++g_crep) + for (_crep = 1; _crep <= _c_zzz; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); @@ -613,12 +612,12 @@ void MortevielleEngine::handleAction() { clearScreenType3(); oo = false; - g_ctrm = 0; + _controlMenu = 0; if (!_keyPressedEsc) { _menu.drawMenu(); _menu._menuDisplayed = true; temps = 0; - g_key = 0; + _key = 0; funct = false; inkey = '.'; @@ -654,8 +653,8 @@ void MortevielleEngine::handleAction() { } else return; } else if (inkey == '\104') { - if ((g_x != 0) && (g_y != 0)) - g_num = 9999; + if ((_x != 0) && (_y != 0)) + _num = 9999; return; } } @@ -667,8 +666,8 @@ void MortevielleEngine::handleAction() { return; if (temps > lim) { repon(2, 141); - if (g_num == 9999) - g_num = 0; + if (_num == 9999) + _num = 0; } else { _menuOpcode = _msg[3]; if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF)) @@ -682,8 +681,8 @@ void MortevielleEngine::handleAction() { oo = true; if ((_msg[4] == OPCODE_LIFT) || (_obpart)) { endSearch(); - g_caff = _coreVar._currPlace; - g_crep = 998; + _caff = _coreVar._currPlace; + _crep = 998; } else tsuiv(); mennor(); @@ -694,18 +693,18 @@ void MortevielleEngine::handleAction() { if (! oo) handleOpcode(); - if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { + if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { taffich(); if (_okdes) { _okdes = false; dessin(0); } if ((!_syn) || (_col)) - repon(2, g_crep); + repon(2, _crep); } } while (_syn); - if (g_ctrm != 0) - tctrm(); + if (_controlMenu != 0) + displayControlMenu(); } } } @@ -767,7 +766,7 @@ void MortevielleEngine::prepareScreenType3() { */ void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { int newHour = readclock(); - int th = g_jh + ((newHour - g_mh) / g_t); + int th = _jh + ((newHour - _mh) / _t); minute = ((th % 2) + _currHalfHour) * 30; hour = ((uint)th >> 1) + _currHour; if (minute == 60) { @@ -1381,12 +1380,12 @@ void MortevielleEngine::getKnockAnswer() { updateHour(day, hour, minute); if ((hour >= 0) && (hour < 8)) - g_crep = 190; + _crep = 190; else { if (getRandomNumber(1, 100) > 70) - g_crep = 190; + _crep = 190; else - g_crep = 147; + _crep = 147; } } @@ -1431,11 +1430,11 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) { */ void MortevielleEngine::initGame() { _place = MANOR_FRONT; - g_jh = 0; + _jh = 0; if (!_coreVar._alreadyEnteredManor) _blo = true; - g_t = kTime1; - g_mh = readclock(); + _t = kTime1; + _mh = readclock(); } /** @@ -1625,10 +1624,10 @@ void MortevielleEngine::startMusicOrSpeech(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((g_prebru == 0) && (!_coreVar._alreadyEnteredManor)) { + } else if ((_prebru == 0) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech _speechManager.startSpeech(10, 1, 1); - ++g_prebru; + ++_prebru; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech @@ -1654,8 +1653,8 @@ void MortevielleEngine::startMusicOrSpeech(int so) { */ void MortevielleEngine::loseGame() { initouv(); - g_ment = 0; - g_iouv = 0; + _ment = 0; + _iouv = 0; _mchai = 0; _menu.unsetSearchMenu(); if (!_blo) @@ -1664,7 +1663,7 @@ void MortevielleEngine::loseGame() { _loseGame = true; clearScreenType1(); _screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, g_crep); + repon(9, _crep); clearScreenType2(); clearScreenType3(); _col = false; @@ -1713,7 +1712,7 @@ void MortevielleEngine::startDialog(int16 rep) { key = 0; do { - _speechManager.startSpeech(rep, haut[g_caff - 69], 0); + _speechManager.startSpeech(rep, haut[_caff - 69], 0); key = f3f8::waitForF3F8(); CHECK_QUIT; } while (key != 66); @@ -1728,8 +1727,8 @@ void MortevielleEngine::startDialog(int16 rep) { void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; - g_cs = 0; - g_is = 0; + _cs = 0; + _is = 0; _menu.unsetSearchMenu(); } @@ -1743,14 +1742,14 @@ void MortevielleEngine::gotoDiningRoom() { updateHour(day, hour, minute); if ((hour < 5) && (_coreVar._currPlace > ROOM18)) { if (!checkInventory(137)) { //You don't have the keys, and it's late - g_crep = 1511; + _crep = 1511; loseGame(); } else displayDiningRoom(); } else if (!_coreVar._alreadyEnteredManor) { //Is it your first time? _currBitIndex = 255; // Everybody is present showPeoplePresent(_currBitIndex); - g_caff = 77; + _caff = 77; afdes(); _screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); @@ -1769,7 +1768,7 @@ void MortevielleEngine::gotoDiningRoom() { if (!_blo) minute = t11(OWN_ROOM); _currBitIndex = 0; - g_mpers = 0; + _savedBitIndex = 0; _coreVar._alreadyEnteredManor = true; } else displayDiningRoom(); @@ -1782,7 +1781,7 @@ void MortevielleEngine::gotoDiningRoom() { void MortevielleEngine::checkManorDistance() { ++_manorDistance; if (_manorDistance > 2) { - g_crep = 1506; + _crep = 1506; loseGame(); } else { _okdes = true; @@ -1815,7 +1814,7 @@ void MortevielleEngine::gotoManorBack() { * @remarks Originally called 't1deau' */ void MortevielleEngine::floodedInWell() { - g_crep = 1503; + _crep = 1503; loseGame(); } @@ -1838,9 +1837,9 @@ void MortevielleEngine::changeGraphicalDevice(int newDevice) { displayAloneText(); clearScreenType2(); clearScreenType3(); - g_maff = 68; + _maff = 68; afdes(); - repon(2, g_crep); + repon(2, _crep); _menu.displayMenu(); } @@ -1857,24 +1856,24 @@ void MortevielleEngine::gameLoaded() { _col = false; _hiddenHero = false; _brt = false; - g_maff = 68; + _maff = 68; _menuOpcode = OPCODE_NONE; - g_prebru = 0; - g_x = 0; - g_y = 0; - g_num = 0; - g_hdb = 0; - g_hfb = 0; - g_cs = 0; - g_is = 0; - g_ment = 0; + _prebru = 0; + _x = 0; + _y = 0; + _num = 0; + _startHour = 0; + _endHour = 0; + _cs = 0; + _is = 0; + _ment = 0; _syn = true; _heroSearching = true; _mchai = 0; _manorDistance = 0; initouv(); - g_iouv = 0; - g_dobj = 0; + _iouv = 0; + _dobj = 0; affrep(); _hintPctMessage = getString(580); @@ -1887,7 +1886,7 @@ void MortevielleEngine::gameLoaded() { prepareRoom(); drawClock(); afdes(); - repon(2, g_crep); + repon(2, _crep); clearScreenType3(); _endGame = false; _menu.setDestinationMenuText(_coreVar._currPlace); @@ -1909,7 +1908,7 @@ void MortevielleEngine::handleOpcode() { if (!_anyone) { if (_brt) { if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { - g_ctrm = 4; + _controlMenu = 4; mennor(); return; } @@ -1990,15 +1989,15 @@ void MortevielleEngine::handleOpcode() { if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { - g_crep = 1501; + _crep = 1501; loseGame(); } if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { - g_crep = 1508; + _crep = 1508; loseGame(); } if ((day > 1) && (hour > 8) && (!_loseGame)) { - g_crep = 1502; + _crep = 1502; loseGame(); } } @@ -2084,7 +2083,7 @@ void MortevielleEngine::clearScreenType10() { Common::String st; _mouse.hideMouse(); - if (g_res == 1) { + if (_res == 1) { co = 634; cod = 534; } else { @@ -2130,7 +2129,7 @@ void MortevielleEngine::showMoveMenuAlert() { * @remarks Originally called 'dialpre' */ void MortevielleEngine::showConfigScreen() { - g_crep = 998; + _crep = 998; } /** @@ -2303,8 +2302,8 @@ void MortevielleEngine::setPal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - g_vm->_mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; - g_vm->_mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; + _mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; + _mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; } break; case MODE_CGA: { @@ -2332,12 +2331,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&g_vm->_mem[0x6000 * 16 + addr], p._tax); - WRITE_LE_UINT16(&g_vm->_mem[0x6000 * 16 + addr + 2], p._tay); + WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr], p._tax); + WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - g_vm->_mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + _mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } @@ -2443,7 +2442,7 @@ void MortevielleEngine::loadBRUIT5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&g_vm->_mem[kAdrNoise5 * 16 + 0], 149 * 128); + f.read(&_mem[kAdrNoise5 * 16 + 0], 149 * 128); f.close(); } @@ -2486,12 +2485,12 @@ void MortevielleEngine::music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&g_vm->_mem[0x3800 * 16 + 0], 500); - fic.read(&g_vm->_mem[0x47a0 * 16 + 0], 123); + fic.read(&_mem[0x3800 * 16 + 0], 500); + fic.read(&_mem[0x47a0 * 16 + 0], 123); fic.close(); - _soundManager.decodeMusic(&g_vm->_mem[0x3800 * 16], &g_vm->_mem[0x5000 * 16], 623); - _addfix = (float)((kTempoMusic - 8)) / 256; + _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[0x5000 * 16], 623); + _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); bool fin = false; @@ -2513,16 +2512,16 @@ void MortevielleEngine::music() { void MortevielleEngine::showTitleScreen() { hirs(); repon(7, 2035); - g_caff = 51; + _caff = 51; taffich(); teskbd(); if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - draw(g_ades, 0, 0); + draw(kAdrDes, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * g_res, 185); + _screenSurface.putxy(104 + 72 * _res, 185); _screenSurface.drawString(cpr, 0); } @@ -2544,7 +2543,7 @@ void MortevielleEngine::draw(int ad, int x, int y) { void MortevielleEngine::drawRightFrame() { setPal(89); if (_currGraphicalDevice == MODE_HERCULES) { - g_vm->_mem[0x7000 * 16 + 14] = 15; + _mem[0x7000 * 16 + 14] = 15; } _mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); @@ -2626,22 +2625,22 @@ void MortevielleEngine::prepareRoom() { if (!_blo) { if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - g_t = kTime2; + _t = kTime2; else - g_t = kTime1; + _t = kTime1; cf = _coreVar._faithScore; if ((cf > 33) && (cf < 66)) - g_t -= (g_t / 3); + _t -= (_t / 3); if (cf > 65) - g_t -= ((g_t / 3) * 2); + _t -= ((_t / 3) * 2); int nh = readclock(); - if ((nh - g_mh) > g_t) { + if ((nh - _mh) > _t) { bool activeMenu = _menu._menuActive; _menu.eraseMenu(); - g_jh += ((nh - g_mh) / g_t); - g_mh = nh; + _jh += ((nh - _mh) / _t); + _mh = nh; switch (_place) { case GREEN_ROOM: case DARKBLUE_ROOM: @@ -2681,17 +2680,17 @@ void MortevielleEngine::prepareRoom() { setRandomPresenceChapel(cf); break; } - if ((g_mpers != 0) && (_currBitIndex != 10)) - g_mpers = _currBitIndex; + if ((_savedBitIndex != 0) && (_currBitIndex != 10)) + _savedBitIndex = _currBitIndex; - if ((g_mpers == 0) && (_currBitIndex > 0)) { + if ((_savedBitIndex == 0) && (_currBitIndex > 0)) { if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) { - cavegre(); + initCaveOrCellar(); } else if (_currBitIndex == 10) { _currBitIndex = 0; if (!_brt) { _brt = true; - g_hdb = readclock(); + _startHour = readclock(); if (getRandomNumber(1, 5) < 5) { clearScreenType3(); prepareScreenType2(); @@ -2708,11 +2707,11 @@ void MortevielleEngine::prepareRoom() { _menu.drawMenu(); } } - g_hfb = readclock(); - if ((_brt) && ((g_hfb - g_hdb) > 17)) { + _endHour = readclock(); + if ((_brt) && ((_endHour - _startHour) > 17)) { getPresenceBitIndex(_place); _brt = false; - g_hdb = 0; + _startHour = 0; if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; } @@ -2742,9 +2741,9 @@ void MortevielleEngine::drawClock() { co = 1; if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y - rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y - rg), co); else - _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)x >> 1) * g_res, (y + rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y + rg), co); h = _hour; if (h > 12) @@ -2752,7 +2751,7 @@ void MortevielleEngine::drawClock() { if (h == 0) h = 12; - _screenSurface.drawLine(((uint)x >> 1) * g_res, y, ((uint)(x + cv[0][h - 1]) >> 1) * g_res, y + cv[1][h - 1], co); + _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)(x + cv[0][h - 1]) >> 1) * _res, y + cv[1][h - 1], co); _mouse.showMouse(); _screenSurface.putxy(568, 154); @@ -2797,7 +2796,233 @@ void MortevielleEngine::hirs() { // method is deprecated in favour of clearing the screen debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); - g_vm->_screenSurface.clearScreen(); + if (_currGraphicalDevice == MODE_CGA) + _res = 1; + else + _res = 2; + + _screenSurface.clearScreen(); +} + +/** + * Init room : Cave or Cellar + * @remarks Originally called 'cavegre' + */ +void MortevielleEngine::initCaveOrCellar() { + _coreVar._faithScore += 2; + if (_coreVar._faithScore > 69) + _coreVar._faithScore += (_coreVar._faithScore / 10); + clearScreenType3(); + prepareScreenType2(); + ecr3(getEngineString(S_SOMEONE_ENTERS)); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(2, rand, 1); + + // The original was doing here a useless loop. + // It has been removed + + clearScreenType3(); + displayAloneText(); +} + +/** + * Display control menu string + * @remarks Originally called 'tctrm' + */ +void MortevielleEngine::displayControlMenu() { + repon(2, (3000 + _controlMenu)); + _controlMenu = 0; +} + +void MortevielleEngine::pictout(int seg, int dep, int x, int y) { + GfxSurface surface; + surface.decode(&_mem[seg * 16 + dep]); + + if (_currGraphicalDevice == MODE_HERCULES) { + _mem[0x7000 * 16 + 2] = 0; + _mem[0x7000 * 16 + 32] = 15; + } + + if ((_caff != 51) && (READ_LE_UINT16(&_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&_mem[0x7000 * 16 + 0x4138], 0x100); + + _screenSurface.drawPicture(surface, x, y); +} + +void MortevielleEngine::adzon() { + Common::File f; + + if (!f.open("don.mor")) + error("Missing file - don.mor"); + + f.read(_tabdon, 7 * 256); + f.close(); + + if (!f.open("bmor.mor")) + error("Missing file - bmor.mor"); + + f.read(&_tabdon[kFleche], 1 * 1916); + f.close(); + + if (!f.open("dec.mor")) + error("Missing file - dec.mor"); + + f.read(&_mem[0x73a2 * 16 + 0], 1 * 1664); + f.close(); +} + +/** + * Returns the offset within the compressed image data resource of the desired image + */ +int MortevielleEngine::animof(int ouf, int num) { + int nani = _mem[kAdrAni * 16 + 1]; + int aux = num; + if (ouf != 1) + aux += nani; + + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[kAdrAni * 16 + (aux << 1)]); + + return animof_result; +} + +void MortevielleEngine::text1(int x, int y, int nb, int m) { + int co; + + if (_res == 1) + co = 10; + else + co = 6; + Common::String tmpStr = getString(m); + if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) + y = 176; + displayStr(tmpStr, x, y, nb, 20, _textColor); +} + +void MortevielleEngine::repon(int f, int m) { + if ((m > 499) && (m < 563)) { + Common::String tmpStr = getString(m - 501 + kInventoryStringIndex); + + if ((int) tmpStr.size() > ((58 + (_res - 1) * 37) << 1)) + _largestClearScreen = true; + else + _largestClearScreen = false; + + clearScreenType2(); + displayStr(tmpStr, 8, 176, 85, 3, 5); + } else { + modif(m); + switch (f) { + case 2: + case 8: + clearScreenType2(); + prepareScreenType2(); + text1(8, 182, 103, m); + if ((m == 68) || (m == 69)) + _coreVar._teauto[40] = '*'; + if ((m == 104) && (_caff == 14)) { + _coreVar._teauto[36] = '*'; + if (_coreVar._teauto[39] == '*') { + _coreVar._pourc[3] = '*'; + _coreVar._teauto[38] = '*'; + } + } + break; + case 1: + case 6: + case 9: { + int i; + if ((f == 1) || (f == 6)) + i = 4; + else + i = 5; + + Common::String tmpStr = getString(m); + displayStr(tmpStr, 80, 40, 60, 25, i); + + if (m == 180) + _coreVar._pourc[6] = '*'; + else if (m == 179) + _coreVar._pourc[10] = '*'; + } + break; + default: + break; + } + } +} + +void MortevielleEngine::modif(int &nu) { + if (nu == 26) + nu = 25; + else if ((nu > 29) && (nu < 36)) + nu -= 4; + else if ((nu > 69) && (nu < 78)) + nu -= 37; + else if ((nu > 99) && (nu < 194)) + nu -= 59; + else if ((nu > 996) && (nu < 1000)) + nu -= 862; + else if ((nu > 1500) && (nu < 1507)) + nu -= 1363; + else if ((nu > 1507) && (nu < 1513)) + nu -= 1364; + else if ((nu > 1999) && (nu < 2002)) + nu -= 1851; + else if (nu == 2010) + nu = 151; + else if ((nu > 2011) && (nu < 2025)) + nu -= 1860; + else if (nu == 2026) + nu = 165; + else if ((nu > 2029) && (nu < 2037)) + nu -= 1864; + else if ((nu > 3000) && (nu < 3005)) + nu -= 2828; + else if (nu == 4100) + nu = 177; + else if (nu == 4150) + nu = 178; + else if ((nu > 4151) && (nu < 4156)) + nu -= 3973; + else if (nu == 4157) + nu = 183; + else if ((nu == 4160) || (nu == 4161)) + nu -= 3976; +} + +void MortevielleEngine::initouv() { + for (int cx = 1; cx <= 7; ++cx) + _touv[cx] = chr(0); +} + +void MortevielleEngine::ecr2(Common::String text) { + // Some dead code was present in the original: removed + _screenSurface.putxy(8, 177); + int tlig = 59 + (_res - 1) * 36; + + if ((int)text.size() < tlig) + _screenSurface.drawString(text, 5); + else if ((int)text.size() < (tlig << 1)) { + _screenSurface.putxy(8, 176); + _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface.putxy(8, 182); + _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); + } else { + _largestClearScreen = true; + clearScreenType2(); + _screenSurface.putxy(8, 176); + _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface.putxy(8, 182); + _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); + _screenSurface.putxy(8, 190); + _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); + } +} + +void MortevielleEngine::ecr3(Common::String text) { + clearScreenType3(); + _screenSurface.putxy(8, 192); + _screenSurface.drawString(text, 5); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 69cb12ab67..924e92b3d4 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -81,13 +81,15 @@ enum DataType { #define GAME_FRAME_DELAY (1000 / 50) const int kAcha = 492; +const int kAdrDes = 0x7000; +const int kFleche = 1758; + const int asoul = 154; const int aouvr = 282; const int achai = 387; const int arcf = 1272; const int arep = 1314; const int amzon = 1650; -const int fleche = 1758; const int arega = 0; struct nhom { @@ -164,6 +166,12 @@ private: void showTitleScreen(); int readclock(); void palette(int v1); + + void adzon(); + void text1(int x, int y, int nb, int m); + void modif(int &nu); + void initouv(); + public: Common::String _hintPctMessage; Common::Point _prevPos; @@ -210,6 +218,7 @@ public: int _place; int _manorDistance; int _currBitIndex; + int _savedBitIndex; int _currDay; int _currHour; int _currHalfHour; @@ -217,16 +226,35 @@ public: int _hour; int _minute; int _mchai; - float _addfix; + float _addFix; SaveStruct _coreVar, _saveStruct; Common::Point _stdPal[91][17]; t_pcga _cgaPal[91]; + int _key; + int _controlMenu; + int _startHour; + int _endHour; int _c_zzz; int ptr_word; byte _v_lieu[7][25]; - byte g_is; + byte _is; int _numpal; + int _ment; + int _iouv; + int _caff; + int _maff; + int _dobj; + int _num; + int _crep; + int _cs; + int _res; + int _prebru; + int _t; + int _x; + int _y; + int _jh; + int _mh; // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; @@ -383,6 +411,16 @@ public: void drawClock(); Common::String copy(const Common::String &s, int idx, size_t size); void hirs(); + void initCaveOrCellar(); + void displayControlMenu(); + + + void pictout(int seg, int dep, int x, int y); + int animof(int ouf, int num); + void repon(int f, int m); + void ecr2(Common::String text); + void ecr3(Common::String text); + }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index bd7e489aa9..e18090e1dd 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -228,8 +228,8 @@ void MouseHandler::showMouse() { * @remarks Originally called 'pos_mouse' */ void MouseHandler::setMousePosition(Common::Point newPos) { - if (newPos.x > 314 * g_res) - newPos.x = 314 * g_res; + if (newPos.x > 314 * g_vm->_res) + newPos.x = 314 * g_vm->_res; else if (newPos.x < 0) newPos.x = 0; if (newPos.y > 199) @@ -299,16 +299,16 @@ void MouseHandler::moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * g_res; + cx = 315 * g_vm->_res; cy = 1; break; case '3': cy = 190; - cx = 315 * g_res; + cx = 315 * g_vm->_res; break; case '5': cy = 100; - cx = 155 * g_res; + cx = 155 * g_vm->_res; break; case ' ': case '\15': @@ -362,27 +362,27 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } break; case 'I': - cx = g_res * 32; + cx = g_vm->_res * 32; cy = 8; break; case 'D': - cx = 80 * g_res; + cx = 80 * g_vm->_res; cy = 8; break; case 'A': - cx = 126 * g_res; + cx = 126 * g_vm->_res; cy = 8; break; case 'S': - cx = 174 * g_res; + cx = 174 * g_vm->_res; cy = 8; break; case 'P': - cx = 222 * g_res; + cx = 222 * g_vm->_res; cy = 8; break; case 'F': - cx = g_res * 270; + cx = g_vm->_res * 270; cy = 8; break; case '\23': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 8a3ecb8041..92831ec2f4 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -61,7 +61,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) inputStr += '$'; g_vm->_screenSurface.putxy(x, y); - if (g_res == 1) + if (g_vm->_res == 1) tab = 10; else tab = 6; @@ -186,13 +186,13 @@ void taffich() { int32 lgt; int alllum[16]; - int a = g_caff; + int a = g_vm->_caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; int b = a; - if (g_maff == a) + if (g_vm->_maff == a) return; switch (a) { @@ -246,11 +246,11 @@ void taffich() { m = 2010; if (a == 32) m = 2034; - if ((a == 17) && (g_maff == 14)) + if ((a == 17) && (g_vm->_maff == 14)) m = 2018; if (a > 99) { - if ((g_vm->g_is == 1) || (g_vm->g_is == 0)) + if ((g_vm->_is == 1) || (g_vm->_is == 0)) m = 2031; else m = 2032; @@ -259,26 +259,26 @@ void taffich() { if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149)) m = 2030; - if (((a < 27) && (((g_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33))) + if (((a < 27) && (((g_vm->_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_vm->_maff > 99))) || ((g_vm->_maff > 29) && (g_vm->_maff < 33))) m = 2033; - g_maff = a; + g_vm->_maff = a; if (a == 159) a = 86; else if (a > 140) - a = a - 67; + a -= 67; else if (a > 137) - a = a - 66; + a -= 66; else if (a > 99) - a = a - 64; + a -= 64; else if (a > 69) - a = a - 42; + a -= 42; else if (a > 29) - a = a - 5; + a -= 5; else if (a == 26) a = 24; else if (a > 18) - a = a - 1; + --a; npal = a; for (cx = 0; cx <= (a - 1); ++cx) @@ -293,7 +293,7 @@ void taffich() { lgt = handle; handle = g_vm->_fxxBuffer[88]; } - g_maff = a; + g_vm->_maff = a; npal = a + 37; } chardes(filename, lgt, handle); @@ -334,12 +334,12 @@ void taffich() { charani(filename, lgt, handle); } g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((g_vm->_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) cx = t11(g_vm->_coreVar._currPlace); - g_mpers = 0; + g_vm->_savedBitIndex = 0; } } diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index d8731f96ac..5b9e8415dc 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -128,7 +128,7 @@ void SpeechManager::cctable(tablint &t) { tb[0] = 0; for (int k = 0; k <= 255; ++k) { - tb[k + 1] = g_vm->_addfix + tb[k]; + tb[k + 1] = g_vm->_addFix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } @@ -554,17 +554,17 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { return; _phonemeNumb = rep; - g_haut = ht; + int haut = ht; _typlec = typ; if (_typlec != 0) { for (int i = 0; i <= 500; ++i) savph[i] = _cfiphBuffer[i]; tempo = kTempoNoise; - } else if (g_haut > 5) + } else if (haut > 5) tempo = kTempoF; else tempo = kTempoM; - g_vm->_addfix = (float)((tempo - 8)) / 256; + g_vm->_addFix = (float)((tempo - 8)) / 256; cctable(_tbi); switch (typ) { case 1: diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 6fc0593d65..a451cb651f 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -33,36 +33,6 @@ namespace Mortevielle { -/*---------------------------------------------------------------------------*/ -/*------------------------------ VARIABLES ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -int g_x, - g_y, - g_t, - g_jh, - g_mh, - g_cs, - g_hdb, - g_hfb, - g_key, - g_num, - g_res, - g_ment, - g_haut, - g_caff, - g_maff, - g_crep, - g_ades, - g_iouv, - g_ctrm, - g_dobj, - g_mlec, - g_mchai, - g_mpers, - g_perdep, - g_prebru; - /*---------------------------------------------------------------------------*/ /*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ /*---------------------------------------------------------------------------*/ diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 9ac807aa95..ddde25a464 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -115,34 +115,6 @@ typedef int tfxx[108]; enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; -/*---------------------------------------------------------------------------*/ -/*------------------------------ VARIABLES ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -extern int g_x, - g_y, - g_t, - g_jh, - g_mh, - g_cs, - g_hdb, - g_hfb, - g_key, - g_num, - g_res, - g_ment, - g_haut, - g_caff, - g_maff, - g_crep, - g_ades, - g_iouv, - g_ctrm, - g_dobj, - g_mpers, - g_perdep, - g_prebru; - } // End of namespace Mortevielle #endif -- cgit v1.2.3 From a87b992e8dd144c869db8498925662119f822d20 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Mar 2012 09:47:36 +0100 Subject: MORTEVIELLE: Move functions out of mor.cpp --- engines/mortevielle/actions.cpp | 37 +++++---- engines/mortevielle/graphics.cpp | 15 ++++ engines/mortevielle/graphics.h | 3 +- engines/mortevielle/mor.cpp | 125 ++---------------------------- engines/mortevielle/mor.h | 13 ---- engines/mortevielle/mortevielle.cpp | 146 +++++++++++++++++++++++++++++++++--- engines/mortevielle/mortevielle.h | 7 ++ engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/var_mor.h | 8 +- 9 files changed, 188 insertions(+), 168 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 174af9fd1a..70979becfd 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -173,7 +173,7 @@ void MortevielleEngine::fctMove() { } if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) affrep(); - debloc(_coreVar._currPlace); + resetRoomVariables(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); } @@ -693,7 +693,7 @@ void MortevielleEngine::fctPlace() { aniof(1, 2); aniof(1, 1); repon(2, 165); - maivid(); + displayEmptyHand(); _speechManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? @@ -772,7 +772,7 @@ void MortevielleEngine::fctPlace() { } if (_crep != 188) - maivid(); + displayEmptyHand(); } } @@ -856,7 +856,7 @@ void MortevielleEngine::fctAttach() { aniof(1, 1); } else _crep = 185; - maivid(); + displayEmptyHand(); } } } @@ -930,15 +930,14 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; _speechManager.startSpeech(11, rand, 1); - int p; - ecfren(p, rand, _coreVar._faithScore, _ment); + int p = getPresenceStats(rand, _coreVar._faithScore, _ment); int l = _ment; if (l != 0) { if (p != -500) { if (rand > p) _crep = 190; else { - becfren(l); + setPresenceFlags(l); getKnockAnswer(); } } else @@ -964,7 +963,7 @@ void MortevielleEngine::fctSelfPut() { _crep = 999; ajchai(); if (_crep != 192) - maivid(); + displayEmptyHand(); return; } tfleche(); @@ -1039,7 +1038,7 @@ void MortevielleEngine::fctSelfPut() { if (_crep == 999) ajchai(); if (_crep != 192) - maivid(); + displayEmptyHand(); } } } @@ -1054,15 +1053,15 @@ void MortevielleEngine::fctListen() { else { if (_currBitIndex != 0) ++_coreVar._faithScore; - int p, rand; - ecfren(p, rand, _coreVar._faithScore, _ment); + int rand; + int p = getPresenceStats(rand, _coreVar._faithScore, _ment); int l = _ment; if (l != 0) { if (p != -500) { if (rand > p) _crep = 101; else { - becfren(l); + setPresenceFlags(l); int j, h, m; updateHour(j, h, m); rand = getRandomNumber(1, 100); @@ -1093,7 +1092,7 @@ void MortevielleEngine::fctEat() { tsort(); _coreVar._currPlace = DINING_ROOM; _caff = 10; - debloc(_coreVar._currPlace); + resetRoomVariables(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); int j, h, m; @@ -1163,7 +1162,7 @@ void MortevielleEngine::fctEnter() { repon(2, _caff); } else _col = false; - debloc(_ment); + resetRoomVariables(_ment); _ment = 0; } } else { @@ -1173,7 +1172,7 @@ void MortevielleEngine::fctEnter() { _coreVar._currPlace = _ment; affrep(); - debloc(_coreVar._currPlace); + resetRoomVariables(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); _ment = 0; _savedBitIndex = 0; @@ -1198,7 +1197,7 @@ void MortevielleEngine::fctSleep() { _coreVar._currPlace = OWN_ROOM; affrep(); afdes(); - debloc(_coreVar._currPlace); + resetRoomVariables(_coreVar._currPlace); _menu.setDestinationMenuText(_coreVar._currPlace); } clearScreenType3(); @@ -1281,7 +1280,7 @@ void MortevielleEngine::fctLeave() { _caff = nextPlace; if (_crep == 0) _crep = nextPlace; - debloc(nextPlace); + resetRoomVariables(nextPlace); _menu.setDestinationMenuText(nextPlace); } } @@ -1571,7 +1570,7 @@ void MortevielleEngine::fctScratch() { void MortevielleEngine::endGame() { _quitGame = true; tlu(13, 152); - maivid(); + displayEmptyHand(); clearScreenType1(); clearScreenType2(); clearScreenType3(); @@ -1610,7 +1609,7 @@ void MortevielleEngine::askRestart() { clearScreenType2(); startMusicOrSpeech(0); tkey1(false); - maivid(); + displayEmptyHand(); resetVariables(); initGame(); _currHour = 10; diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 42dd3c7cc7..2b6607513b 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1143,4 +1143,19 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { } } +/** + * Draw plain rectangle + * @remarks Originally called 'paint_rect' + */ +void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { + int co; + + if (g_vm->_currGraphicalDevice == MODE_CGA) + co = 3; + else + co = 11; + g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); +} + + } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 9f4a4799ab..498322680d 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -93,8 +93,9 @@ public: void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void drawString(const Common::String &l, int command); - int getStringWidth(const Common::String &s); + int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); + void drawRectangle(int x, int y, int dx, int dy); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 85e34b6680..09857c8014 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -44,115 +44,7 @@ namespace Mortevielle { -void paint_rect(int x, int y, int dx, int dy) { - int co; - - if (g_vm->_currGraphicalDevice == MODE_CGA) - co = 3; - else - co = 11; - g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); -} - -/* NIVEAU 12 */ -void modobj(int m) { - Common::String strp = Common::String(' '); - - if (m != 500) - strp = g_vm->getString(m - 501 + kInventoryStringIndex); - - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[8], strp); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]); -} - -int chlm() { - int retval = g_vm->getRandomNumber(1, 2); - if (retval == 2) - retval = 128; - - return retval; -} - -/************* - * NIVEAU 11 * - *************/ - -void debloc(int roomId) { - g_vm->_num = 0; - g_vm->_x = 0; - g_vm->_y = 0; - if ((roomId != ROOM26) && (roomId != LANDING)) - g_vm->resetPresenceInRooms(roomId); - g_vm->_savedBitIndex = g_vm->_currBitIndex; -} - -void ecfren(int &p, int &rand, int cf, int roomId) { - if (roomId == OWN_ROOM) - g_vm->displayAloneText(); - p = -500; - rand = 0; - if ( ((roomId == GREEN_ROOM) && (!g_vm->_roomPresenceLuc) && (!g_vm->_roomPresenceIda)) - || ((roomId == DARKBLUE_ROOM) && (!g_vm->_roomPresenceGuy) && (!g_vm->_roomPresenceEva)) ) - p = g_vm->getPresenceStatsGreenRoom(); - if ((roomId == PURPLE_ROOM) && (!g_vm->_purpleRoomPresenceLeo) && (!g_vm->_room9PresenceLeo)) - p = g_vm->getPresenceStatsPurpleRoom(); - if ( ((roomId == TOILETS) && (!g_vm->_toiletsPresenceBobMax)) - || ((roomId == BATHROOM) && (!g_vm->_bathRoomPresenceBobMax)) ) - p = g_vm->getPresenceStatsToilets(); - if ((roomId == BLUE_ROOM) && (!g_vm->_roomPresenceMax)) - p = g_vm->getPresenceStatsBlueRoom(); - if ( ((roomId == RED_ROOM) && (!g_vm->_roomPresenceBob)) - || ((roomId == GREEN_ROOM2) && (!g_vm->_roomPresencePat))) - p = g_vm->getPresenceStatsRedRoom(); - if ((roomId == ROOM9) && (!g_vm->_room9PresenceLeo) && (!g_vm->_purpleRoomPresenceLeo)) - p = 10; - if ( ((roomId == PURPLE_ROOM) && (g_vm->_room9PresenceLeo)) - || ((roomId == ROOM9) && (g_vm->_purpleRoomPresenceLeo))) - p = -400; - if (p != -500) { - p += cf; - rand = g_vm->getRandomNumber(1, 100); - } -} - -void becfren(int roomId) { - if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { - int rand = g_vm->getRandomNumber(1, 2); - if (roomId == GREEN_ROOM) { - if (rand == 1) - g_vm->_roomPresenceLuc = true; - else - g_vm->_roomPresenceIda = true; - } else { // roomId == DARKBLUE_ROOM - if (rand == 1) - g_vm->_roomPresenceGuy = true; - else - g_vm->_roomPresenceEva = true; - } - } else if (roomId == PURPLE_ROOM) - g_vm->_purpleRoomPresenceLeo = true; - else if (roomId == TOILETS) - g_vm->_toiletsPresenceBobMax = true; - else if (roomId == BLUE_ROOM) - g_vm->_roomPresenceMax = true; - else if (roomId == RED_ROOM) - g_vm->_roomPresenceBob = true; - else if (roomId == BATHROOM) - g_vm->_bathRoomPresenceBobMax = true; - else if (roomId == GREEN_ROOM2) - g_vm->_roomPresencePat = true; - else if (roomId == ROOM9) - g_vm->_room9PresenceLeo = true; -} - /* NIVEAU 10 */ -void init_nbrepm() { - const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - - for (int idx = 0; idx < 9; ++idx) - g_vm->_nbrepm[idx] = ipm[idx]; -} - void phaz(int &rand, int &p, int cf) { p += cf; rand = g_vm->getRandomNumber(1, 100); @@ -160,9 +52,9 @@ void phaz(int &rand, int &p, int cf) { int t11(int roomId) { int retVal = 0; - int p, rand; + int rand; - ecfren(p, rand, g_vm->_coreVar._faithScore, roomId); + int p = g_vm->getPresenceStats(rand, g_vm->_coreVar._faithScore, roomId); g_vm->_place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { if (p != -500) { @@ -170,7 +62,7 @@ int t11(int roomId) { g_vm->displayAloneText(); retVal = 0; } else { - becfren(g_vm->_place); + g_vm->setPresenceFlags(g_vm->_place); retVal = g_vm->getPresenceBitIndex(g_vm->_place); } } else @@ -374,7 +266,7 @@ void tsort() { g_vm->_ment = 0; g_vm->_iouv = 0; g_vm->_mchai = 0; - debloc(g_vm->_coreVar._currPlace); + g_vm->resetRoomVariables(g_vm->_coreVar._currPlace); } void st4(int ob) { @@ -508,7 +400,7 @@ L1: g_vm->_speechManager.startSpeech(3, rand, 1); g_vm->clearScreenType2(); g_vm->displayAloneText(); - debloc(21); + g_vm->resetRoomVariables(MANOR_FRONT); affrep(); } } @@ -679,7 +571,7 @@ void avpoing(int &ob) { ajjer(g_vm->_coreVar._selectedObjectId); if (g_vm->_crep != 139) { - modobj(ob + 400); + g_vm->displayItemInHand(ob + 400); g_vm->_coreVar._selectedObjectId = ob; ob = 0; } @@ -702,11 +594,6 @@ int t23coul() { return CELLAR; } -void maivid() { - g_vm->_coreVar._selectedObjectId = 0; - modobj(500); -} - void st13(int ob) { if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 667883ccf4..b55dc46537 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -42,19 +42,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; -/* NIVEAU 13 */ -extern void paint_rect(int x, int y, int dx, int dy); -/* NIVEAU 12 */ -extern void modobj(int m); -extern int chlm(); -/************* - * NIVEAU 11 * - *************/ -extern void debloc(int roomId); -extern void ecfren(int &p, int &rand, int cf, int roomId); -extern void becfren(int roomId); /* NIVEAU 10 */ -extern void init_nbrepm(); extern void phaz(int &rand, int &p, int cf); extern int t11(int roomId); extern void writetp(Common::String s, int t); @@ -86,7 +74,6 @@ extern void treg(int ob); extern void avpoing(int &ob); extern void rechai(int &ch); extern int t23coul(); -extern void maivid(); extern void st13(int ob); extern void sauvecr(int y, int dy); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 536fe09114..cd5c2151b2 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -1256,7 +1256,7 @@ int MortevielleEngine::setPresenceDiningRoom(int hour) { int retVal = 0; if ((hour >= 0) && (hour < 8)) - retVal = chlm(); + retVal = checkLeoMaxRandomPresence(); else { int min = 0, max = 0; if ((hour > 7) && (hour < 10)) { @@ -1287,7 +1287,7 @@ int MortevielleEngine::setPresenceBureau(int hour) { int retVal = 0; if ((hour >= 0) && (hour < 8)) - retVal = chlm(); + retVal = checkLeoMaxRandomPresence(); else { int min = 0, max = 0; if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { @@ -1312,7 +1312,7 @@ int MortevielleEngine::setPresenceBureau(int hour) { * @remarks Originally called 'quelq12' */ int MortevielleEngine::setPresenceKitchen() { - int retVal = chlm(); + int retVal = checkLeoMaxRandomPresence(); showPeoplePresent(retVal); return retVal; @@ -1351,7 +1351,7 @@ int MortevielleEngine::setPresenceChapel(int hour) { int retVal = 0; if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) - retVal = chlm(); + retVal = checkLeoMaxRandomPresence(); else { int min = 0, max = 0; if ((hour > 9) && (hour < 12)) { @@ -1892,7 +1892,7 @@ void MortevielleEngine::gameLoaded() { _menu.setDestinationMenuText(_coreVar._currPlace); modinv(); if (_coreVar._selectedObjectId != 0) - modobj(_coreVar._selectedObjectId + 400); + displayItemInHand(_coreVar._selectedObjectId + 400); _mouse.showMouse(); } @@ -2733,8 +2733,8 @@ void MortevielleEngine::drawClock() { _mouse.hideMouse(); - paint_rect(570, 118, 20, 10); - paint_rect(578, 114, 6, 18); + _screenSurface.drawRectangle(570, 118, 20, 10); + _screenSurface.drawRectangle(578, 114, 6, 18); if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) co = 0; else @@ -2796,9 +2796,13 @@ void MortevielleEngine::hirs() { // method is deprecated in favour of clearing the screen debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); - if (_currGraphicalDevice == MODE_CGA) + if (_currGraphicalDevice == MODE_TANDY) { + _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); _res = 1; - else + } else if (_currGraphicalDevice == MODE_CGA) { + palette(1); + _res = 1; + } else _res = 2; _screenSurface.clearScreen(); @@ -3025,4 +3029,128 @@ void MortevielleEngine::ecr3(Common::String text) { _screenSurface.drawString(text, 5); } +/** + * Display item in hand + * @remarks Originally called 'modobj' + */ +void MortevielleEngine::displayItemInHand(int objId) { + Common::String strp = Common::String(' '); + + if (objId != 500) + strp = getString(objId - 501 + kInventoryStringIndex); + + _menu.setText(_menu._inventoryMenu[8], strp); + _menu.disableMenuItem(_menu._inventoryMenu[8]); +} + +/** + * Display empty hand + * @remarks Originally called 'maivid' + */ +void MortevielleEngine::displayEmptyHand() { + _coreVar._selectedObjectId = 0; + displayItemInHand(500); +} + +/** + * Set a random presence: Leo or Max + * @remarks Originally called 'chlm' + */ +int MortevielleEngine::checkLeoMaxRandomPresence() { + int retval = getRandomNumber(1, 2); + if (retval == 2) + retval = 128; + + return retval; +} + +/** + * Reset room variables + * @remarks Originally called 'debloc' + */ +void MortevielleEngine::resetRoomVariables(int roomId) { + _num = 0; + _x = 0; + _y = 0; + if ((roomId != ROOM26) && (roomId != LANDING)) + resetPresenceInRooms(roomId); + _savedBitIndex = _currBitIndex; +} + +/** + * Compute presence stats + * @remarks Originally called 'ecfren' + */ +int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { + if (roomId == OWN_ROOM) + displayAloneText(); + int retVal = -500; + rand = 0; + if ( ((roomId == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) + || ((roomId == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) + retVal = getPresenceStatsGreenRoom(); + if ((roomId == PURPLE_ROOM) && (!_purpleRoomPresenceLeo) && (!_room9PresenceLeo)) + retVal = getPresenceStatsPurpleRoom(); + if ( ((roomId == TOILETS) && (!_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (!_bathRoomPresenceBobMax)) ) + retVal = getPresenceStatsToilets(); + if ((roomId == BLUE_ROOM) && (!_roomPresenceMax)) + retVal = getPresenceStatsBlueRoom(); + if ( ((roomId == RED_ROOM) && (!_roomPresenceBob)) + || ((roomId == GREEN_ROOM2) && (!_roomPresencePat))) + retVal = getPresenceStatsRedRoom(); + if ((roomId == ROOM9) && (!_room9PresenceLeo) && (!_purpleRoomPresenceLeo)) + retVal = 10; + if ( ((roomId == PURPLE_ROOM) && (_room9PresenceLeo)) + || ((roomId == ROOM9) && (_purpleRoomPresenceLeo))) + retVal = -400; + if (retVal != -500) { + retVal += cf; + rand = getRandomNumber(1, 100); + } + + return retVal; +} + +/** + * Set presence flags + * @remarks Originally called 'becfren' + */ +void MortevielleEngine::setPresenceFlags(int roomId) { + if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { + int rand = g_vm->getRandomNumber(1, 2); + if (roomId == GREEN_ROOM) { + if (rand == 1) + g_vm->_roomPresenceLuc = true; + else + g_vm->_roomPresenceIda = true; + } else { // roomId == DARKBLUE_ROOM + if (rand == 1) + g_vm->_roomPresenceGuy = true; + else + g_vm->_roomPresenceEva = true; + } + } else if (roomId == PURPLE_ROOM) + g_vm->_purpleRoomPresenceLeo = true; + else if (roomId == TOILETS) + g_vm->_toiletsPresenceBobMax = true; + else if (roomId == BLUE_ROOM) + g_vm->_roomPresenceMax = true; + else if (roomId == RED_ROOM) + g_vm->_roomPresenceBob = true; + else if (roomId == BATHROOM) + g_vm->_bathRoomPresenceBobMax = true; + else if (roomId == GREEN_ROOM2) + g_vm->_roomPresencePat = true; + else if (roomId == ROOM9) + g_vm->_room9PresenceLeo = true; +} + +void MortevielleEngine::init_nbrepm() { + static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; + + for (int idx = 0; idx < 9; ++idx) + g_vm->_nbrepm[idx] = ipm[idx]; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 924e92b3d4..bb594d2415 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -166,6 +166,7 @@ private: void showTitleScreen(); int readclock(); void palette(int v1); + int checkLeoMaxRandomPresence(); void adzon(); void text1(int x, int y, int nb, int m); @@ -413,6 +414,11 @@ public: void hirs(); void initCaveOrCellar(); void displayControlMenu(); + void displayItemInHand(int objId); + void displayEmptyHand(); + void resetRoomVariables(int roomId); + int getPresenceStats(int &rand, int cf, int roomId); + void setPresenceFlags(int roomId); void pictout(int seg, int dep, int x, int y); @@ -420,6 +426,7 @@ public: void repon(int f, int m); void ecr2(Common::String text); void ecr3(Common::String text); + void init_nbrepm(); }; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index d71e2fd8b7..daa59b231b 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -119,7 +119,7 @@ void SavegameManager::loadSavegame(int n) { */ Common::Error SavegameManager::loadGame(int n) { g_vm->_mouse.hideMouse(); - maivid(); + g_vm->displayEmptyHand(); loadSavegame(n); /* Initialization */ diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index ddde25a464..3086f9eb20 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -101,6 +101,8 @@ enum places { DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; +enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; + struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; @@ -109,12 +111,6 @@ struct Rect { typedef int tablint[256]; typedef int tfxx[108]; -/*---------------------------------------------------------------------------*/ -/*------------------------------ ENUMS ------------------------------*/ -/*---------------------------------------------------------------------------*/ - -enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; - } // End of namespace Mortevielle #endif -- cgit v1.2.3 From 7b94de6408f6c83287870ceb137471f2055f76f9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Mar 2012 15:19:54 +0100 Subject: MORTEVIELLE: Get rid of mor.cpp --- engines/mortevielle/actions.cpp | 117 ++++--- engines/mortevielle/dialogs.cpp | 5 +- engines/mortevielle/menu.cpp | 37 ++- engines/mortevielle/menu.h | 3 +- engines/mortevielle/module.mk | 1 - engines/mortevielle/mor.cpp | 618 ------------------------------------ engines/mortevielle/mor.h | 82 ----- engines/mortevielle/mortevielle.cpp | 596 ++++++++++++++++++++++++++++++++-- engines/mortevielle/mortevielle.h | 40 ++- engines/mortevielle/outtext.cpp | 3 +- engines/mortevielle/saveload.cpp | 1 - engines/mortevielle/speech.cpp | 1 - 12 files changed, 706 insertions(+), 798 deletions(-) delete mode 100644 engines/mortevielle/mor.cpp delete mode 100644 engines/mortevielle/mor.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 70979becfd..0247eca2e1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -28,7 +28,6 @@ #include "common/scummsys.h" #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" -#include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" @@ -59,17 +58,17 @@ void MortevielleEngine::fctMove() { if ((_anyone) || (_keyPressedEsc)) return; - tcoord(1); + setCoordinates(1); if (_num == 0) return; if (_num == 1) { _coreVar._currPlace = OWN_ROOM; - _menu.setDestinationMenuText(OWN_ROOM); + _menu.setDestinationText(OWN_ROOM); } else if (_num == 7) { _coreVar._currPlace = ATTIC; - _menu.setDestinationMenuText(ATTIC); + _menu.setDestinationText(ATTIC); } if (_num != 6) @@ -86,7 +85,7 @@ void MortevielleEngine::fctMove() { showMoveMenuAlert(); return; } - tsort(); + exitRoom(); int menuChoice = 1; while (_menu._moveMenu[menuChoice] != _msg[4]) @@ -97,14 +96,14 @@ void MortevielleEngine::fctMove() { gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); return; } else if (_coreVar._currPlace == INSIDE_WELL) { if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); return; } else if ((_coreVar._currPlace == BUREAU) && (menuChoice == 1)) menuChoice = 6; @@ -174,7 +173,7 @@ void MortevielleEngine::fctMove() { if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) affrep(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); } /** @@ -226,15 +225,15 @@ void MortevielleEngine::fctTake() { if ((_anyone) || (_keyPressedEsc)) return; if (_caff == 3) { - tcoord(2); + setCoordinates(2); if (_num == 1) { _crep = 152; return; } } - tcoord(5); + setCoordinates(5); if ((_num == 0) || ((_num == 1) && (_coreVar._currPlace == CRYPT))) { - tcoord(8); + setCoordinates(8); if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 3; @@ -302,14 +301,12 @@ void MortevielleEngine::fctTake() { * @remarks Originally called 'tsprendre' */ void MortevielleEngine::fctInventoryTake() { - int cx, cy, cz; - - cx = 0; + int cx = 0; do { ++cx; } while (_menu._inventoryMenu[cx] != _msg[4]); - cz = 0; - cy = 0; + int cz = 0; + int cy = 0; do { ++cy; if (ord(_coreVar._sjer[cy]) != 0) @@ -317,7 +314,7 @@ void MortevielleEngine::fctInventoryTake() { } while (cz != cx); cz = ord(_coreVar._sjer[cy]); _coreVar._sjer[cy] = chr(0); - modinv(); + _menu.setInventoryText(); avpoing(cz); _crep = 998; clearScreenType2(); @@ -333,9 +330,9 @@ void MortevielleEngine::fctLift() { tfleche(); if ((_anyone) || (_keyPressedEsc)) return; - tcoord(3); + setCoordinates(3); if (_num == 0) { - tcoord(8); + setCoordinates(8); if (_num != 0) { if (_currBitIndex > 0) ++_coreVar._faithScore; @@ -363,13 +360,13 @@ void MortevielleEngine::fctLift() { */ void MortevielleEngine::fctRead() { if (_caff > 99) - st4(_caff); + getReadDescription(_caff); else { if (!_syn) ecr3(getEngineString(S_READ)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { - tcoord(4); + setCoordinates(4); if (_num != 0) _crep = 107; } @@ -384,7 +381,7 @@ void MortevielleEngine::fctSelfRead() { if (_coreVar._selectedObjectId == 0) _crep = 186; else - st4(_coreVar._selectedObjectId); + getReadDescription(_coreVar._selectedObjectId); } /** @@ -403,9 +400,9 @@ void MortevielleEngine::fctLook() { tfleche(); if ((_anyone) || (_keyPressedEsc)) return; - tcoord(5); + setCoordinates(5); if (_num == 0) { - tcoord(8); + setCoordinates(8); _crep = 131; if (_num != 0) { if (_coreVar._currPlace == ATTIC) { @@ -484,7 +481,7 @@ void MortevielleEngine::fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; if (_caff > 99) { - st7(_caff); + getSearchDescription(_caff); return; } @@ -501,9 +498,9 @@ void MortevielleEngine::fctSearch() { return; } - tcoord(6); + setCoordinates(6); if (_num == 0) { - tcoord(7); + setCoordinates(7); if (_num != 0) { int cx = 0; do { @@ -526,7 +523,7 @@ void MortevielleEngine::fctSearch() { _crep = 997; } } else { - tcoord(8); + setCoordinates(8); _crep = 997; if (_num != 0) { if (_currBitIndex > 0) @@ -575,7 +572,7 @@ void MortevielleEngine::fctSearch() { */ void MortevielleEngine::fctSelfSearch() { if (_coreVar._selectedObjectId != 0) - st7(_coreVar._selectedObjectId); + getSearchDescription(_coreVar._selectedObjectId); else _crep = 186; } @@ -606,7 +603,7 @@ void MortevielleEngine::fctOpen() { if ((_anyone) || (_keyPressedEsc)) return; - tcoord(7); + setCoordinates(7); if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 2; @@ -662,7 +659,7 @@ void MortevielleEngine::fctPlace() { if ((_anyone) || (_keyPressedEsc)) return; - tcoord(8); + setCoordinates(8); if (_num != 0) { _crep = 999; if (_caff == 13) { @@ -719,11 +716,11 @@ void MortevielleEngine::fctPlace() { _menu.displayMenu(); if (enterPassageFl) { _coreVar._currPlace = SECRET_PASSAGE; - _menu.setDestinationMenuText(SECRET_PASSAGE); + _menu.setDestinationText(SECRET_PASSAGE); } else { - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); setPal(14); - dessin(0); + dessin(); aniof(1, 2); aniof(1, 1); alertTxt = getString(577); @@ -790,7 +787,7 @@ void MortevielleEngine::fctTurn() { tfleche(); if ((_anyone) || (_keyPressedEsc)) return; - tcoord(9); + setCoordinates(9); if (_num != 0) { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { @@ -825,7 +822,7 @@ void MortevielleEngine::fctSelfHide() { ecr3(getEngineString(S_HIDE_SELF)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { - tcoord(10); + setCoordinates(10); if (_num == 0) _hiddenHero = false; else { @@ -847,7 +844,7 @@ void MortevielleEngine::fctAttach() { ecr3(getEngineString(S_TIE)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { - tcoord(8); + setCoordinates(8); _crep = 997; if ((_num != 0) && (_coreVar._currPlace == WELL)) { _crep = 999; @@ -876,7 +873,7 @@ void MortevielleEngine::fctClose() { _crep = 998; if ((_anyone) || (_keyPressedEsc)) return; - tcoord(7); + setCoordinates(7); if (_num != 0) { int cx = 0; do { @@ -969,7 +966,7 @@ void MortevielleEngine::fctSelfPut() { tfleche(); if ((_anyone) || (_keyPressedEsc)) return; - tcoord(7); + setCoordinates(7); _crep = 124; if (_num != 0) { int chai; @@ -989,7 +986,7 @@ void MortevielleEngine::fctSelfPut() { } } } else { - tcoord(8); + setCoordinates(8); if (_num != 0) { _crep = 998; if (_caff == PURPLE_ROOM) { @@ -1026,7 +1023,7 @@ void MortevielleEngine::fctSelfPut() { } else { _crep = 124; if (_caff == WELL) { - tcoord(5); + setCoordinates(5); if (_num != 0) _crep = 185; } @@ -1089,11 +1086,11 @@ void MortevielleEngine::fctEat() { if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { _crep = 148; } else { - tsort(); + exitRoom(); _coreVar._currPlace = DINING_ROOM; _caff = 10; resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); int j, h, m; updateHour(j, h, m); @@ -1129,7 +1126,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (_ment == 0) @@ -1140,7 +1137,7 @@ void MortevielleEngine::fctEnter() { } else { int z = 0; if (!_blo) - z = t11(_ment); + z = getPresence(_ment); if (z != 0) { if ((_ment == 3) || (_ment == 7)) _crep = 179; @@ -1173,7 +1170,7 @@ void MortevielleEngine::fctEnter() { _coreVar._currPlace = _ment; affrep(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); _ment = 0; _savedBitIndex = 0; _currBitIndex = 0; @@ -1193,12 +1190,12 @@ void MortevielleEngine::fctSleep() { return; } if (_coreVar._currPlace != OWN_ROOM) { - tsort(); + exitRoom(); _coreVar._currPlace = OWN_ROOM; affrep(); afdes(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); } clearScreenType3(); clearScreenType2(); @@ -1253,7 +1250,7 @@ void MortevielleEngine::fctForce() { * @remarks Originally called 'tsortir' */ void MortevielleEngine::fctLeave() { - tsort(); + exitRoom(); _crep = 0; if ((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK) || (_coreVar._currPlace == WELL)) _crep = 997; @@ -1270,7 +1267,7 @@ void MortevielleEngine::fctLeave() { nextPlace = SECRET_PASSAGE; _crep = 176; } else if (_coreVar._currPlace == SECRET_PASSAGE) - nextPlace = t23coul(); + nextPlace = checkLeaveSecretPassage(); else if (_coreVar._currPlace == INSIDE_WELL) nextPlace = WELL; @@ -1281,7 +1278,7 @@ void MortevielleEngine::fctLeave() { if (_crep == 0) _crep = nextPlace; resetRoomVariables(nextPlace); - _menu.setDestinationMenuText(nextPlace); + _menu.setDestinationText(nextPlace); } } @@ -1298,7 +1295,7 @@ void MortevielleEngine::fctWait() { ++_jh; prepareRoom(); if (!_blo) - t11(_coreVar._currPlace); + getPresence(_coreVar._currPlace); if ((_currBitIndex != 0) && (_savedBitIndex == 0)) { _crep = 998; if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) @@ -1357,7 +1354,7 @@ void MortevielleEngine::fctDiscuss() { repon(2, _caff); suj = _caff + 60; } - tkey1(false); + testKey(false); mennor(); _mouse.hideMouse(); hirs(); @@ -1527,7 +1524,7 @@ void MortevielleEngine::fctDiscuss() { drawClock(); affrep(); /* chech;*/ - _menu.setDestinationMenuText(_coreVar._currPlace); + _menu.setDestinationText(_coreVar._currPlace); clearScreenType3(); } @@ -1575,7 +1572,7 @@ void MortevielleEngine::endGame() { clearScreenType2(); clearScreenType3(); repon(9, 1509); - tkey1(false); + testKey(false); _mouse.hideMouse(); _caff = 70; taffich(); @@ -1586,18 +1583,18 @@ void MortevielleEngine::endGame() { clearScreenType1(); repon(9, 1509); repon(2, 142); - tkey1(false); + testKey(false); _caff = 32; afdes(); repon(6, 34); repon(2, 35); startMusicOrSpeech(0); - tkey1(false); + testKey(false); // A wait message was displayed. - // tkey1 was called before and after. + // testKey (aka tkey1) was called before and after. // Most likely the double call is useless, thus removed // - // tkey1(false); + // testKey(false); resetVariables(); } @@ -1608,7 +1605,7 @@ void MortevielleEngine::endGame() { void MortevielleEngine::askRestart() { clearScreenType2(); startMusicOrSpeech(0); - tkey1(false); + testKey(false); displayEmptyHand(); resetVariables(); initGame(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 1f97ee0fe6..19ff58071c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -29,7 +29,6 @@ #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/speech.h" @@ -61,7 +60,7 @@ int Alert::show(const Common::String &msg, int n) { g_vm->setMouseClick(false); decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); - sauvecr(50, (NUM_LINES + 1) << 4); + g_vm->sauvecr(50, (NUM_LINES + 1) << 4); i = 0; if (chaine == "") { @@ -170,7 +169,7 @@ int Alert::show(const Common::String &msg, int n) { tmp4 += " "; g_vm->_screenSurface.drawString(tmp4, 1); } - charecr(50, (NUM_LINES + 1) << 4); + g_vm->charecr(50, (NUM_LINES + 1) << 4); g_vm->_mouse.showMouse(); /* Restore the background area */ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 5bc0940f6c..d7ece8a7eb 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -29,7 +29,6 @@ #include "common/str.h" #include "common/textconsole.h" #include "mortevielle/menu.h" -#include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" @@ -88,7 +87,7 @@ void Menu::setText(int menuId, Common::String name) { * Init destination menu * @remarks Originally called 'tmlieu' */ -void Menu::setDestinationMenuText(int roomId) { +void Menu::setDestinationText(int roomId) { Common::String nomp; if (roomId == 26) @@ -323,7 +322,7 @@ void Menu::menuDown(int ii) { xco = _menuConstants[ii - 1][0]; lignNumb = _menuConstants[ii - 1][3]; g_vm->_mouse.hideMouse(); - sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); + g_vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (g_vm->_res == 1) cx = 10; @@ -396,7 +395,7 @@ void Menu::menuDown(int ii) { */ void Menu::menuUp(int xx) { if (_multiTitle) { - charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); + g_vm->charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); @@ -538,7 +537,7 @@ void Menu::initMenu() { _moveMenu[i] = 0x200 + i; _inventoryMenu[i] = 0x100 + i; if (i > 6) - g_vm->_menu.disableMenuItem(_inventoryMenu[i]); + disableMenuItem(_inventoryMenu[i]); } _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; @@ -567,7 +566,7 @@ void Menu::setSearchMenu() { * @remarks Originally called 'mfouen' */ void Menu::unsetSearchMenu() { - setDestinationMenuText(g_vm->_coreVar._currPlace); + setDestinationText(g_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]); @@ -575,4 +574,30 @@ void Menu::unsetSearchMenu() { setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); } +/** + * Set Inventory menu texts + * @remarks Originally called 'modinv' + */ +void Menu::setInventoryText() { + int r; + Common::String nomp; + + int cy = 0; + for (int i = 1; i <= 6; ++i) { + if (g_vm->_coreVar._sjer[i] != chr(0)) { + ++cy; + r = (ord(g_vm->_coreVar._sjer[i]) + 400); + nomp = g_vm->getString(r - 501 + kInventoryStringIndex); + setText(_inventoryMenu[cy], nomp); + enableMenuItem(_inventoryMenu[i]); + } + } + + if (cy < 6) { + for (int i = cy + 1; i <= 6; ++i) { + setText(_inventoryMenu[i], " "); + disableMenuItem(_inventoryMenu[i]); + } + } +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index f4d12bc676..37612edd06 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -62,7 +62,8 @@ public: int _moveMenu[8]; void setText(int menuId, Common::String name); - void setDestinationMenuText(int roomId); + void setDestinationText(int roomId); + void setInventoryText(); void disableMenuItem(int menuId); void enableMenuItem(int menuId); void displayMenu(); diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 58978c9d25..fe02e1114f 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -7,7 +7,6 @@ MODULE_OBJS := \ graphics.o \ keyboard.o \ menu.o \ - mor.o \ mortevielle.o \ mouse.o \ outtext.o \ diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp deleted file mode 100644 index 09857c8014..0000000000 --- a/engines/mortevielle/mor.cpp +++ /dev/null @@ -1,618 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/endian.h" -#include "common/file.h" -#include "common/str.h" -#include "common/system.h" -#include "common/textconsole.h" -#include "mortevielle/dialogs.h" -#include "mortevielle/graphics.h" -#include "mortevielle/menu.h" -#include "mortevielle/mor.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" -#include "mortevielle/outtext.h" -#include "mortevielle/speech.h" -#include "mortevielle/var_mor.h" - -#include "mortevielle/keyboard.h" - -namespace Mortevielle { - -/* NIVEAU 10 */ -void phaz(int &rand, int &p, int cf) { - p += cf; - rand = g_vm->getRandomNumber(1, 100); -} - -int t11(int roomId) { - int retVal = 0; - int rand; - - int p = g_vm->getPresenceStats(rand, g_vm->_coreVar._faithScore, roomId); - g_vm->_place = roomId; - if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { - if (p != -500) { - if (rand > p) { - g_vm->displayAloneText(); - retVal = 0; - } else { - g_vm->setPresenceFlags(g_vm->_place); - retVal = g_vm->getPresenceBitIndex(g_vm->_place); - } - } else - retVal = g_vm->getPresenceBitIndex(g_vm->_place); - } - - if (roomId > ROOM9) { - if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) - g_vm->displayAloneText(); - else { - int h = 0; - if (roomId == DINING_ROOM) - p = g_vm->getPresenceStatsDiningRoom(h); - else if (roomId == BUREAU) - p = g_vm->getPresenceStatsBureau(h); - else if (roomId == KITCHEN) - p = g_vm->getPresenceStatsKitchen(); - else if ((roomId == ATTIC) || (roomId == CELLAR)) - p = g_vm->getPresenceStatsAttic(); - else if ((roomId == LANDING) || (roomId == ROOM26)) - p = g_vm->getPresenceStatsLanding(); - else if (roomId == CHAPEL) - p = g_vm->getPresenceStatsChapel(h); - p += g_vm->_coreVar._faithScore; - rand = g_vm->getRandomNumber(1, 100); - if (rand > p) { - g_vm->displayAloneText(); - retVal = 0; - } else { - if (roomId == DINING_ROOM) - p = g_vm->setPresenceDiningRoom(h); - else if (roomId == BUREAU) - p = g_vm->setPresenceBureau(h); - else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) - p = g_vm->setPresenceKitchen(); - else if ((roomId == LANDING) || (roomId == ROOM26)) - p = g_vm->setPresenceLanding(); - else if (roomId == CHAPEL) - p = g_vm->setPresenceChapel(h); - retVal = p; - } - } - } - - return retVal; -} - -void writetp(Common::String s, int t) { - if (g_vm->_res == 2) - g_vm->_screenSurface.drawString(s, t); - else - g_vm->_screenSurface.drawString(g_vm->copy(s, 1, 25), t); -} - -void aniof(int ouf, int num) { - if ((g_vm->_caff == 7) && ((num == 4) || (num == 5))) - return; - - if ((g_vm->_caff == 10) && (num == 7)) - num = 6; - else if (g_vm->_caff == 12) { - if (num == 3) - num = 4; - else if (num == 4) - num = 3; - } - - int ad = kAdrAni; - int offset = g_vm->animof(ouf, num); - - GfxSurface surface; - surface.decode(&g_vm->_mem[ad * 16 + offset]); - g_vm->_screenSurface.drawPicture(surface, 0, 12); - - g_vm->prepareScreenType1(); -} - -/* NIVEAU 9 */ -void dessin(int ad) { - if (ad != 0) - g_vm->draw(kAdrDes, ((ad % 160) * 2), (ad / 160)); - else { - g_vm->clearScreenType1(); - if (g_vm->_caff > 99) { - g_vm->draw(kAdrDes, 60, 33); - g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box - } else if (g_vm->_caff > 69) { - g_vm->draw(kAdrDes, 112, 48); // Heads - g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15); - } else { - g_vm->draw(kAdrDes, 0, 12); - g_vm->prepareScreenType1(); - if ((g_vm->_caff < 30) || (g_vm->_caff > 32)) { - for (int cx = 1; cx <= 6; ++cx) { - if (ord(g_vm->_touv[cx]) != 0) - aniof(1, ord(g_vm->_touv[cx])); - } - - if (g_vm->_caff == 13) { - if (g_vm->_coreVar._atticBallHoleObjectId == 141) - aniof(1, 7); - - if (g_vm->_coreVar._atticRodHoleObjectId == 159) - aniof(1, 6); - } else if ((g_vm->_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151)) - aniof(1, 2); - else if ((g_vm->_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143)) - aniof(1, 1); - else if ((g_vm->_caff == 24) && (g_vm->_coreVar._wellObjectId != 0)) - aniof(1, 1); - } - - if (g_vm->_caff < ROOM26) - g_vm->startMusicOrSpeech(1); - } - } -} - -void fenat(char ans) { - int coul; - - g_vm->_mouse.hideMouse(); - if (g_vm->_currGraphicalDevice == MODE_CGA) - coul = 2; - else if (g_vm->_currGraphicalDevice == MODE_HERCULES) - coul = 1; - else - coul = 12; - - g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - g_vm->_mouse.showMouse(); -} - - -/* NIVEAU 8 */ -void afdes() { - taffich(); - dessin(0); - g_vm->_okdes = false; -} - -void tkey1(bool d) { - bool quest = false; - int x, y, c; - - g_vm->_mouse.hideMouse(); - fenat('K'); - - // Wait for release from any key or mouse button - while (g_vm->keyPressed()) - g_vm->_key = testou(); - - do { - g_vm->_mouse.getMousePosition(x, y, c); - g_vm->keyPressed(); - } while (c != 0); - - // Event loop - do { - if (d) - g_vm->prepareRoom(); - quest = g_vm->keyPressed(); - g_vm->_mouse.getMousePosition(x, y, c); - CHECK_QUIT; - } while (!(quest || (c != 0) || (d && g_vm->_anyone))); - if (quest) - testou(); - g_vm->setMouseClick(false); - g_vm->_mouse.showMouse(); -} - -/* NIVEAU 7 */ -void tlu(int af, int ob) { - g_vm->_caff = 32; - afdes(); - g_vm->repon(6, ob + 4000); - g_vm->repon(2, 999); - tkey1(true); - g_vm->_caff = af; - g_vm->_msg[3] = OPCODE_NONE; - g_vm->_crep = 998; -} - -void affrep() { - g_vm->_caff = g_vm->_coreVar._currPlace; - g_vm->_crep = g_vm->_coreVar._currPlace; -} - -void tsort() { - - if ((g_vm->_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) { - if (g_vm->_coreVar._faithScore < 50) - g_vm->_coreVar._faithScore += 2; - else - g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10); - } - - for (int cx = 1; cx <= 7; ++cx) - g_vm->_touv[cx] = chr(0); - g_vm->_ment = 0; - g_vm->_iouv = 0; - g_vm->_mchai = 0; - g_vm->resetRoomVariables(g_vm->_coreVar._currPlace); -} - -void st4(int ob) { - g_vm->_crep = 997; - - switch (ob) { - case 114 : - g_vm->_crep = 109; - break; - case 110 : - g_vm->_crep = 107; - break; - case 158 : - g_vm->_crep = 113; - break; - case 152: - case 153: - case 154: - case 155: - case 156: - case 150: - case 100: - case 157: - case 160: - case 161 : - tlu(g_vm->_caff, ob); - break; - default: - break; - } -} - -void modinv() { - int r; - Common::String nomp; - - int cy = 0; - for (int i = 1; i <= 6; ++i) { - if (g_vm->_coreVar._sjer[i] != chr(0)) { - ++cy; - r = (ord(g_vm->_coreVar._sjer[i]) + 400); - nomp = g_vm->getString(r - 501 + kInventoryStringIndex); - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp); - g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]); - } - } - - if (cy < 6) { - for (int i = cy + 1; i <= 6; ++i) { - g_vm->_menu.setText(g_vm->_menu._inventoryMenu[i], " "); - g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[i]); - } - } -} - -void mennor() { - g_vm->_menu.menuUp(g_vm->_msg[3]); -} - -void premtet() { - g_vm->draw(kAdrDes, 10, 80); - g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); -} - -/* NIVEAU 5 */ -void ajchai() { - int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - } while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0)); - - if (g_vm->_tabdon[cy + cx] == 0) - g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; - else - g_vm->_crep = 192; -} - -void ajjer(int ob) { - int cx = 0; - do { - ++cx; - } while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0)); - - if (ord(g_vm->_coreVar._sjer[cx]) == 0) { - g_vm->_coreVar._sjer[(cx)] = chr(ob); - modinv(); - } else - g_vm->_crep = 139; -} - -void quelquun() { - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.eraseMenu(); - - g_vm->endSearch(); - g_vm->_crep = 997; -L1: - if (!g_vm->_hiddenHero) { - if (g_vm->_crep == 997) - g_vm->_crep = 138; - g_vm->repon(2, g_vm->_crep); - if (g_vm->_crep == 138) - g_vm->_speechManager.startSpeech(5, 2, 1); - else - g_vm->_speechManager.startSpeech(4, 4, 1); - - if (g_vm->_iouv == 0) - g_vm->_coreVar._faithScore += 2; - else if (g_vm->_coreVar._faithScore < 50) - g_vm->_coreVar._faithScore += 4; - else - g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10); - tsort(); - g_vm->_menu.setDestinationMenuText(LANDING); - int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); - g_vm->_caff = 69 + cx; - g_vm->_crep = g_vm->_caff; - g_vm->_msg[3] = MENU_DISCUSS; - g_vm->_msg[4] = g_vm->_menu._discussMenu[cx]; - g_vm->_syn = true; - g_vm->_col = true; - } else { - if (g_vm->getRandomNumber(1, 3) == 2) { - g_vm->_hiddenHero = false; - g_vm->_crep = 137; - goto L1; - } else { - g_vm->repon(2, 136); - int rand = (g_vm->getRandomNumber(0, 4)) - 2; - g_vm->_speechManager.startSpeech(3, rand, 1); - g_vm->clearScreenType2(); - g_vm->displayAloneText(); - g_vm->resetRoomVariables(MANOR_FRONT); - affrep(); - } - } - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.drawMenu(); -} - -void tsuiv() { - int tbcl; - int cl; - - int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - ++g_vm->_cs; - cl = cy + g_vm->_cs; - tbcl = g_vm->_tabdon[cl]; - } while ((tbcl == 0) && (g_vm->_cs <= 9)); - - if ((tbcl != 0) && (g_vm->_cs < 11)) { - ++g_vm->_is; - g_vm->_caff = tbcl; - g_vm->_crep = g_vm->_caff + 400; - if (g_vm->_currBitIndex != 0) - g_vm->_coreVar._faithScore += 2; - } else { - affrep(); - g_vm->endSearch(); - if (cx > 9) - g_vm->_crep = 131; - } -} - -void tfleche() { - bool qust; - char touch; - - if (g_vm->_num == 9999) - return; - - fenat(chr(152)); - bool inRect = false; - do { - touch = '\0'; - - do { - g_vm->_mouse.moveMouse(qust, touch); - CHECK_QUIT; - - if (g_vm->getMouseClick()) - inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); - g_vm->prepareRoom(); - } while (!(qust || inRect || g_vm->_anyone)); - - if (qust && (touch == '\103')) - Alert::show(g_vm->_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect))); - - if (touch == '\73') - g_vm->_keyPressedEsc = true; - - if (inRect) { - g_vm->_x = g_vm->_mouse._pos.x; - g_vm->_y = g_vm->_mouse._pos.y; - } -} - -void tcoord(int sx) { - int sy, ix, iy; - int ib; - - - g_vm->_num = 0; - g_vm->_crep = 999; - int a = 0; - int atdon = amzon + 3; - int cy = 0; - while (cy < g_vm->_caff) { - a += g_vm->_tabdon[atdon]; - atdon += 4; - ++cy; - } - - if (g_vm->_tabdon[atdon] == 0) { - g_vm->_crep = 997; - return; - } - - a += kFleche; - int cb = 0; - for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; - cb += (ib * 4) + 2; - } - ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; - if (ib == 0) { - g_vm->_crep = 997; - return; - } - - cy = 1; - do { - cb += 2; - sx = g_vm->_tabdon[a + cb] * g_vm->_res; - sy = g_vm->_tabdon[(a + cb + 1)]; - cb += 2; - ix = g_vm->_tabdon[a + cb] * g_vm->_res; - iy = g_vm->_tabdon[(a + cb + 1)]; - ++cy; - } while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib))); - - if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) { - g_vm->_num = cy - 1; - return; - } - - g_vm->_crep = 997; -} - - -void st7(int ob) { - switch (ob) { - case 116: - case 144: - g_vm->_crep = 104; - break; - case 126: - case 111: - g_vm->_crep = 108; - break; - case 132: - g_vm->_crep = 111; - break; - case 142: - g_vm->_crep = 112; - break; - default: - g_vm->_crep = 183; - st4(ob); - } -} - -void treg(int ob) { - int mdes = g_vm->_caff; - g_vm->_caff = ob; - - if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { - afdes(); - if ((g_vm->_caff > 29) && (g_vm->_caff < 33)) - g_vm->repon(2, g_vm->_caff); - else - g_vm->repon(2, g_vm->_caff + 400); - tkey1(true); - g_vm->_caff = mdes; - g_vm->_msg[3] = 0; - g_vm->_crep = 998; - } else { - g_vm->_obpart = true; - g_vm->_crep = g_vm->_caff + 400; - g_vm->_menu.setSearchMenu(); - } -} - -void avpoing(int &ob) { - g_vm->_crep = 999; - if (g_vm->_coreVar._selectedObjectId != 0) - ajjer(g_vm->_coreVar._selectedObjectId); - - if (g_vm->_crep != 139) { - g_vm->displayItemInHand(ob + 400); - g_vm->_coreVar._selectedObjectId = ob; - ob = 0; - } -} - -void rechai(int &ch) { - int tmpPlace = g_vm->_coreVar._currPlace; - - if (g_vm->_coreVar._currPlace == CRYPT) - tmpPlace = CELLAR; - ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1]; -} - -int t23coul() { - if (!g_vm->checkInventory(143)) { - g_vm->_crep = 1512; - g_vm->loseGame(); - } - - return CELLAR; -} - -void st13(int ob) { - if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) || - (ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) || - (ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) || - (ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) || - (ob == 150) || (ob == 152)) - g_vm->_crep = 999; - else - g_vm->_crep = 105; -} - -void sauvecr(int y, int dy) { -// g_vm->_mouse.hideMouse(); -// g_vm->_mouse.showMouse(); -} - -void charecr(int y, int dy) { -// g_vm->_mouse.hideMouse(); -// g_vm->_mouse.showMouse(); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h deleted file mode 100644 index b55dc46537..0000000000 --- a/engines/mortevielle/mor.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_MOR_H -#define MORTEVIELLE_MOR_H - -#include "common/str.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -const int kTime1 = 410; -const int kTime2 = 250; - -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - -/* NIVEAU 10 */ -extern void phaz(int &rand, int &p, int cf); -extern int t11(int roomId); -extern void writetp(Common::String s, int t); -extern void aniof(int ouf, int num); -/* NIVEAU 9 */ -extern void dessin(int ad); -extern void fenat(char ans); -/* NIVEAU 8 */ -extern void afdes(); -extern void tkey1(bool d); -/* NIVEAU 7 */ -extern void tlu(int af, int ob); -extern void affrep(); -/* NIVEAU 6 */ -extern void tsort(); -extern void st4(int ob); -extern void modinv(); -extern void mennor(); -extern void premtet(); -/* NIVEAU 5 */ -extern void ajchai(); -extern void ajjer(int ob); -extern void quelquun(); -extern void tsuiv(); -extern void tfleche(); -extern void tcoord(int sx); -extern void st7(int ob); -extern void treg(int ob); -extern void avpoing(int &ob); -extern void rechai(int &ch); -extern int t23coul(); -extern void st13(int ob); - -extern void sauvecr(int y, int dy); -extern void charecr(int y, int dy); -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index cd5c2151b2..6d1a949516 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -32,7 +32,6 @@ #include "mortevielle/dialogs.h" #include "mortevielle/keyboard.h" #include "mortevielle/menu.h" -#include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/saveload.h" @@ -697,7 +696,7 @@ void MortevielleEngine::handleAction() { taffich(); if (_okdes) { _okdes = false; - dessin(0); + dessin(); } if ((!_syn) || (_col)) repon(2, _crep); @@ -1658,7 +1657,7 @@ void MortevielleEngine::loseGame() { _mchai = 0; _menu.unsetSearchMenu(); if (!_blo) - t11(MANOR_FRONT); + getPresence(MANOR_FRONT); _loseGame = true; clearScreenType1(); @@ -1753,7 +1752,7 @@ void MortevielleEngine::gotoDiningRoom() { afdes(); _screenSurface.drawBox(223, 47, 155, 91, 15); repon(2, 33); - tkey1(false); + testKey(false); mennor(); _mouse.hideMouse(); hirs(); @@ -1766,7 +1765,7 @@ void MortevielleEngine::gotoDiningRoom() { affrep(); resetPresenceInRooms(DINING_ROOM); if (!_blo) - minute = t11(OWN_ROOM); + getPresence(OWN_ROOM); _currBitIndex = 0; _savedBitIndex = 0; _coreVar._alreadyEnteredManor = true; @@ -1889,8 +1888,8 @@ void MortevielleEngine::gameLoaded() { repon(2, _crep); clearScreenType3(); _endGame = false; - _menu.setDestinationMenuText(_coreVar._currPlace); - modinv(); + _menu.setDestinationText(_coreVar._currPlace); + _menu.setInventoryText(); if (_coreVar._selectedObjectId != 0) displayItemInHand(_coreVar._selectedObjectId + 400); _mouse.showMouse(); @@ -1975,7 +1974,7 @@ void MortevielleEngine::handleOpcode() { fctSelfHide(); } else { if (_anyone) { - quelquun(); + interactNPC(); _anyone = false; mennor(); return; @@ -3118,39 +3117,594 @@ int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { */ void MortevielleEngine::setPresenceFlags(int roomId) { if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { - int rand = g_vm->getRandomNumber(1, 2); + int rand = getRandomNumber(1, 2); if (roomId == GREEN_ROOM) { if (rand == 1) - g_vm->_roomPresenceLuc = true; + _roomPresenceLuc = true; else - g_vm->_roomPresenceIda = true; + _roomPresenceIda = true; } else { // roomId == DARKBLUE_ROOM if (rand == 1) - g_vm->_roomPresenceGuy = true; + _roomPresenceGuy = true; else - g_vm->_roomPresenceEva = true; + _roomPresenceEva = true; } } else if (roomId == PURPLE_ROOM) - g_vm->_purpleRoomPresenceLeo = true; + _purpleRoomPresenceLeo = true; else if (roomId == TOILETS) - g_vm->_toiletsPresenceBobMax = true; + _toiletsPresenceBobMax = true; else if (roomId == BLUE_ROOM) - g_vm->_roomPresenceMax = true; + _roomPresenceMax = true; else if (roomId == RED_ROOM) - g_vm->_roomPresenceBob = true; + _roomPresenceBob = true; else if (roomId == BATHROOM) - g_vm->_bathRoomPresenceBobMax = true; + _bathRoomPresenceBobMax = true; else if (roomId == GREEN_ROOM2) - g_vm->_roomPresencePat = true; + _roomPresencePat = true; else if (roomId == ROOM9) - g_vm->_room9PresenceLeo = true; + _room9PresenceLeo = true; } void MortevielleEngine::init_nbrepm() { static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; for (int idx = 0; idx < 9; ++idx) - g_vm->_nbrepm[idx] = ipm[idx]; + _nbrepm[idx] = ipm[idx]; +} + +void MortevielleEngine::phaz(int &rand, int &p, int cf) { + p += cf; + rand = getRandomNumber(1, 100); +} + +/** + * Get Presence + * @remarks Originally called 't11' + */ +int MortevielleEngine::getPresence(int roomId) { + int retVal = 0; + int rand; + + int p = getPresenceStats(rand, _coreVar._faithScore, roomId); + _place = roomId; + if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { + if (p != -500) { + if (rand > p) { + displayAloneText(); + retVal = 0; + } else { + setPresenceFlags(_place); + retVal = getPresenceBitIndex(_place); + } + } else + retVal = getPresenceBitIndex(_place); + } + + if (roomId > ROOM9) { + if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) + displayAloneText(); + else { + int h = 0; + if (roomId == DINING_ROOM) + p = getPresenceStatsDiningRoom(h); + else if (roomId == BUREAU) + p = getPresenceStatsBureau(h); + else if (roomId == KITCHEN) + p = getPresenceStatsKitchen(); + else if ((roomId == ATTIC) || (roomId == CELLAR)) + p = getPresenceStatsAttic(); + else if ((roomId == LANDING) || (roomId == ROOM26)) + p = getPresenceStatsLanding(); + else if (roomId == CHAPEL) + p = getPresenceStatsChapel(h); + p += _coreVar._faithScore; + rand = getRandomNumber(1, 100); + if (rand > p) { + displayAloneText(); + retVal = 0; + } else { + if (roomId == DINING_ROOM) + p = setPresenceDiningRoom(h); + else if (roomId == BUREAU) + p = setPresenceBureau(h); + else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) + p = setPresenceKitchen(); + else if ((roomId == LANDING) || (roomId == ROOM26)) + p = setPresenceLanding(); + else if (roomId == CHAPEL) + p = setPresenceChapel(h); + retVal = p; + } + } + } + + return retVal; +} + +void MortevielleEngine::writetp(Common::String s, int t) { + if (_res == 2) + _screenSurface.drawString(s, t); + else + _screenSurface.drawString(copy(s, 1, 25), t); +} + +void MortevielleEngine::aniof(int ouf, int num) { + if ((_caff == 7) && ((num == 4) || (num == 5))) + return; + + if ((_caff == 10) && (num == 7)) + num = 6; + else if (_caff == 12) { + if (num == 3) + num = 4; + else if (num == 4) + num = 3; + } + + int ad = kAdrAni; + int offset = animof(ouf, num); + + GfxSurface surface; + surface.decode(&_mem[ad * 16 + offset]); + _screenSurface.drawPicture(surface, 0, 12); + + prepareScreenType1(); +} + +void MortevielleEngine::dessin() { + clearScreenType1(); + if (_caff > 99) { + draw(kAdrDes, 60, 33); + _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box + } else if (_caff > 69) { + draw(kAdrDes, 112, 48); // Heads + _screenSurface.drawBox(222, 47, 155, 91, 15); + } else { + draw(kAdrDes, 0, 12); + prepareScreenType1(); + if ((_caff < 30) || (_caff > 32)) { + for (int cx = 1; cx <= 6; ++cx) { + if (ord(_touv[cx]) != 0) + aniof(1, ord(_touv[cx])); + } + + if (_caff == 13) { + if (_coreVar._atticBallHoleObjectId == 141) + aniof(1, 7); + + if (_coreVar._atticRodHoleObjectId == 159) + aniof(1, 6); + } else if ((_caff == 14) && (_coreVar._cellarObjectId == 151)) + aniof(1, 2); + else if ((_caff == 17) && (_coreVar._secretPassageObjectId == 143)) + aniof(1, 1); + else if ((_caff == 24) && (_coreVar._wellObjectId != 0)) + aniof(1, 1); + } + + if (_caff < ROOM26) + startMusicOrSpeech(1); + } +} + +void MortevielleEngine::afdes() { + taffich(); + dessin(); + _okdes = false; +} + +/** + * Engine function - Place + * @remarks Originally called 'tkey1' + */ +void MortevielleEngine::testKey(bool d) { + bool quest = false; + int x, y, c; + + _mouse.hideMouse(); + fenat('K'); + + // Wait for release from any key or mouse button + while (keyPressed()) + _key = testou(); + + do { + _mouse.getMousePosition(x, y, c); + keyPressed(); + } while (c != 0); + + // Event loop + do { + if (d) + prepareRoom(); + quest = keyPressed(); + _mouse.getMousePosition(x, y, c); + CHECK_QUIT; + } while (!(quest || (c != 0) || (d && _anyone))); + if (quest) + testou(); + setMouseClick(false); + _mouse.showMouse(); +} + +void MortevielleEngine::tlu(int af, int ob) { + _caff = 32; + afdes(); + repon(6, ob + 4000); + repon(2, 999); + testKey(true); + _caff = af; + _msg[3] = OPCODE_NONE; + _crep = 998; +} + +void MortevielleEngine::affrep() { + _caff = _coreVar._currPlace; + _crep = _coreVar._currPlace; +} + +/** + * Exit room + * @remarks Originally called 'tsort' + */ +void MortevielleEngine::exitRoom() { + if ((_iouv > 0) && (_coreVar._currPlace != OWN_ROOM)) { + if (_coreVar._faithScore < 50) + _coreVar._faithScore += 2; + else + _coreVar._faithScore += (_coreVar._faithScore / 10); + } + + for (int cx = 1; cx <= 7; ++cx) + _touv[cx] = chr(0); + _ment = 0; + _iouv = 0; + _mchai = 0; + resetRoomVariables(_coreVar._currPlace); +} + +/** + * get 'read' description + * @remarks Originally called 'st4' + */ +void MortevielleEngine::getReadDescription(int objId) { + _crep = 997; + + switch (objId) { + case 114 : + _crep = 109; + break; + case 110 : + _crep = 107; + break; + case 158 : + _crep = 113; + break; + case 152: + case 153: + case 154: + case 155: + case 156: + case 150: + case 100: + case 157: + case 160: + case 161 : + tlu(_caff, objId); + break; + default: + break; + } +} + +/** + * get 'search' description + * @remarks Originally called 'st7' + */ +void MortevielleEngine::getSearchDescription(int objId) { + switch (objId) { + case 116: + case 144: + _crep = 104; + break; + case 126: + case 111: + _crep = 108; + break; + case 132: + _crep = 111; + break; + case 142: + _crep = 112; + break; + default: + _crep = 183; + getReadDescription(objId); + } +} + +void MortevielleEngine::mennor() { + g_vm->_menu.menuUp(g_vm->_msg[3]); +} + +void MortevielleEngine::premtet() { + g_vm->draw(kAdrDes, 10, 80); + g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); +} + +void MortevielleEngine::ajchai() { + int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + } while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0)); + + if (g_vm->_tabdon[cy + cx] == 0) + g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; + else + g_vm->_crep = 192; +} + +void MortevielleEngine::ajjer(int ob) { + int cx = 0; + do { + ++cx; + } while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0)); + + if (ord(g_vm->_coreVar._sjer[cx]) == 0) { + g_vm->_coreVar._sjer[(cx)] = chr(ob); + g_vm->_menu.setInventoryText(); + } else + g_vm->_crep = 139; +} + +/** + * Interact with NPC + * @remarks Originally called 'quelquun' + */ +void MortevielleEngine::interactNPC() { + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.eraseMenu(); + + g_vm->endSearch(); + g_vm->_crep = 997; +L1: + if (!g_vm->_hiddenHero) { + if (g_vm->_crep == 997) + g_vm->_crep = 138; + g_vm->repon(2, g_vm->_crep); + if (g_vm->_crep == 138) + g_vm->_speechManager.startSpeech(5, 2, 1); + else + g_vm->_speechManager.startSpeech(4, 4, 1); + + if (g_vm->_iouv == 0) + g_vm->_coreVar._faithScore += 2; + else if (g_vm->_coreVar._faithScore < 50) + g_vm->_coreVar._faithScore += 4; + else + g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10); + g_vm->exitRoom(); + g_vm->_menu.setDestinationText(LANDING); + int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); + g_vm->_caff = 69 + cx; + g_vm->_crep = g_vm->_caff; + g_vm->_msg[3] = MENU_DISCUSS; + g_vm->_msg[4] = g_vm->_menu._discussMenu[cx]; + g_vm->_syn = true; + g_vm->_col = true; + } else { + if (g_vm->getRandomNumber(1, 3) == 2) { + g_vm->_hiddenHero = false; + g_vm->_crep = 137; + goto L1; + } else { + g_vm->repon(2, 136); + int rand = (g_vm->getRandomNumber(0, 4)) - 2; + g_vm->_speechManager.startSpeech(3, rand, 1); + g_vm->clearScreenType2(); + g_vm->displayAloneText(); + g_vm->resetRoomVariables(MANOR_FRONT); + g_vm->affrep(); + } + } + if (g_vm->_menu._menuDisplayed) + g_vm->_menu.drawMenu(); +} + +void MortevielleEngine::tsuiv() { + int tbcl; + int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + ++g_vm->_cs; + int cl = cy + g_vm->_cs; + tbcl = g_vm->_tabdon[cl]; + } while ((tbcl == 0) && (g_vm->_cs <= 9)); + + if ((tbcl != 0) && (g_vm->_cs < 11)) { + ++g_vm->_is; + g_vm->_caff = tbcl; + g_vm->_crep = g_vm->_caff + 400; + if (g_vm->_currBitIndex != 0) + g_vm->_coreVar._faithScore += 2; + } else { + g_vm->affrep(); + g_vm->endSearch(); + if (cx > 9) + g_vm->_crep = 131; + } +} + +void MortevielleEngine::tfleche() { + bool qust; + char touch; + + if (g_vm->_num == 9999) + return; + + fenat(chr(152)); + bool inRect = false; + do { + touch = '\0'; + + do { + g_vm->_mouse.moveMouse(qust, touch); + CHECK_QUIT; + + if (g_vm->getMouseClick()) + inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); + g_vm->prepareRoom(); + } while (!(qust || inRect || g_vm->_anyone)); + + if (qust && (touch == '\103')) + Alert::show(g_vm->_hintPctMessage, 1); + } while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect))); + + if (touch == '\73') + g_vm->_keyPressedEsc = true; + + if (inRect) { + g_vm->_x = g_vm->_mouse._pos.x; + g_vm->_y = g_vm->_mouse._pos.y; + } +} + +/** + * Set coordinates + * @remarks Originally called 'tcoord' + */ +void MortevielleEngine::setCoordinates(int sx) { + int sy, ix, iy; + int ib; + + + g_vm->_num = 0; + g_vm->_crep = 999; + int a = 0; + int atdon = amzon + 3; + int cy = 0; + while (cy < g_vm->_caff) { + a += g_vm->_tabdon[atdon]; + atdon += 4; + ++cy; + } + + if (g_vm->_tabdon[atdon] == 0) { + g_vm->_crep = 997; + return; + } + + a += kFleche; + int cb = 0; + for (cy = 0; cy <= (sx - 2); ++cy) { + ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; + cb += (ib * 4) + 2; + } + ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; + if (ib == 0) { + g_vm->_crep = 997; + return; + } + + cy = 1; + do { + cb += 2; + sx = g_vm->_tabdon[a + cb] * g_vm->_res; + sy = g_vm->_tabdon[(a + cb + 1)]; + cb += 2; + ix = g_vm->_tabdon[a + cb] * g_vm->_res; + iy = g_vm->_tabdon[(a + cb + 1)]; + ++cy; + } while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib))); + + if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) { + g_vm->_num = cy - 1; + return; + } + + g_vm->_crep = 997; +} + +void MortevielleEngine::treg(int objId) { + int mdes = g_vm->_caff; + g_vm->_caff = objId; + + if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { + g_vm->afdes(); + if ((g_vm->_caff > 29) && (g_vm->_caff < 33)) + g_vm->repon(2, g_vm->_caff); + else + g_vm->repon(2, g_vm->_caff + 400); + g_vm->testKey(true); + g_vm->_caff = mdes; + g_vm->_msg[3] = 0; + g_vm->_crep = 998; + } else { + g_vm->_obpart = true; + g_vm->_crep = g_vm->_caff + 400; + g_vm->_menu.setSearchMenu(); + } +} + +void MortevielleEngine::avpoing(int &objId) { + g_vm->_crep = 999; + if (g_vm->_coreVar._selectedObjectId != 0) + g_vm->ajjer(g_vm->_coreVar._selectedObjectId); + + if (g_vm->_crep != 139) { + g_vm->displayItemInHand(objId + 400); + g_vm->_coreVar._selectedObjectId = objId; + objId = 0; + } +} + +void MortevielleEngine::rechai(int &ch) { + int tmpPlace = g_vm->_coreVar._currPlace; + + if (g_vm->_coreVar._currPlace == CRYPT) + tmpPlace = CELLAR; + ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1]; +} + +/** + * Check before leaving the secret passage + * @remarks Originally called 't23coul' + */ +int MortevielleEngine::checkLeaveSecretPassage() { + if (!g_vm->checkInventory(143)) { + g_vm->_crep = 1512; + g_vm->loseGame(); + } + + return CELLAR; +} + +void MortevielleEngine::fenat(char ans) { + int coul; + + g_vm->_mouse.hideMouse(); + if (g_vm->_currGraphicalDevice == MODE_CGA) + coul = 2; + else if (g_vm->_currGraphicalDevice == MODE_HERCULES) + coul = 1; + else + coul = 12; + + g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); + g_vm->_mouse.showMouse(); +} + +void MortevielleEngine::sauvecr(int y, int dy) { +// _mouse.hideMouse(); +// _mouse.showMouse(); +} + +void MortevielleEngine::charecr(int y, int dy) { +// _mouse.hideMouse(); +// _mouse.showMouse(); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index bb594d2415..6e55bebd7e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -73,6 +73,12 @@ enum DataType { kGameStrings = 1 }; +static const int _actionMenu[12] = { OPCODE_NONE, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 #define SCREEN_ORIG_HEIGHT 200 @@ -80,6 +86,9 @@ enum DataType { #define MORT_DAT "mort.dat" #define GAME_FRAME_DELAY (1000 / 50) +const int kTime1 = 410; +const int kTime2 = 250; + const int kAcha = 492; const int kAdrDes = 0x7000; const int kFleche = 1758; @@ -167,11 +176,18 @@ private: int readclock(); void palette(int v1); int checkLeoMaxRandomPresence(); + void interactNPC(); void adzon(); void text1(int x, int y, int nb, int m); void modif(int &nu); void initouv(); + void phaz(int &rand, int &p, int cf); + void writetp(Common::String s, int t); + void premtet(); + void ajchai(); + void tfleche(); + void setCoordinates(int sx); public: Common::String _hintPctMessage; @@ -417,9 +433,14 @@ public: void displayItemInHand(int objId); void displayEmptyHand(); void resetRoomVariables(int roomId); - int getPresenceStats(int &rand, int cf, int roomId); + int getPresenceStats(int &rand, int cf, int roomId); void setPresenceFlags(int roomId); - + int getPresence(int roomId); + void testKey(bool d); + void exitRoom(); + void getReadDescription(int objId); + void getSearchDescription(int objId); + int checkLeaveSecretPassage(); void pictout(int seg, int dep, int x, int y); int animof(int ouf, int num); @@ -427,6 +448,21 @@ public: void ecr2(Common::String text); void ecr3(Common::String text); void init_nbrepm(); + void aniof(int ouf, int num); + void dessin(); + void afdes(); + void tlu(int af, int ob); + void affrep(); + void mennor(); + void ajjer(int ob); + void tsuiv(); + void treg(int objId); + void avpoing(int &objId); + void rechai(int &ch); + void fenat(char ans); + + void sauvecr(int y, int dy); + void charecr(int y, int dy); }; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 92831ec2f4..35d42251b1 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -27,7 +27,6 @@ #include "common/file.h" #include "common/str.h" -#include "mortevielle/mor.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/graphics.h" @@ -338,7 +337,7 @@ void taffich() { if ((a == 13) || (a == 14)) g_vm->displayAloneText(); else if (!g_vm->_blo) - cx = t11(g_vm->_coreVar._currPlace); + g_vm->getPresence(g_vm->_coreVar._currPlace); g_vm->_savedBitIndex = 0; } } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index daa59b231b..4c5e6252d5 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -28,7 +28,6 @@ #include "common/file.h" #include "common/system.h" #include "mortevielle/dialogs.h" -#include "mortevielle/mor.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 5b9e8415dc..c374d20a6d 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -30,7 +30,6 @@ #include "mortevielle/speech.h" #include "mortevielle/sound.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/mor.h" #include "mortevielle/var_mor.h" namespace Mortevielle { -- cgit v1.2.3 From 4b9e71952c8384267251c31aae3fb5bcd34f7bff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Mar 2012 22:00:28 +0100 Subject: MORTEVIELLE: More renaming and refactoring --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/dialogs.cpp | 17 +- engines/mortevielle/keyboard.cpp | 71 ----- engines/mortevielle/keyboard.h | 38 --- engines/mortevielle/module.mk | 1 - engines/mortevielle/mortevielle.cpp | 306 +++++++++++---------- engines/mortevielle/mortevielle.h | 512 ++++++++++++++++++++---------------- engines/mortevielle/mouse.cpp | 8 - engines/mortevielle/mouse.h | 2 - engines/mortevielle/outtext.cpp | 33 ++- engines/mortevielle/outtext.h | 13 +- engines/mortevielle/var_mor.h | 70 ----- 12 files changed, 495 insertions(+), 578 deletions(-) delete mode 100644 engines/mortevielle/keyboard.cpp delete mode 100644 engines/mortevielle/keyboard.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 0247eca2e1..1a6614953d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1575,7 +1575,7 @@ void MortevielleEngine::endGame() { testKey(false); _mouse.hideMouse(); _caff = 70; - taffich(); + _text.taffich(); hirs(); premtet(); startDialog(141); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 19ff58071c..f04233d908 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -27,7 +27,6 @@ #include "common/str.h" #include "mortevielle/dialogs.h" -#include "mortevielle/keyboard.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" @@ -307,7 +306,7 @@ bool KnowledgeCheck::show() { dialogHeight = 23; g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = g_vm->getString(textIndexArr[indx]); - displayStr(tmpStr, 20, 15, 100, 2, 0); + g_vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); if (indx != 9) { firstOption = textIndexArr[indx] + 1; @@ -324,7 +323,7 @@ bool KnowledgeCheck::show() { tmpStr = g_vm->getString(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); - displayStr(tmpStr, 100, optionPosY, 100, 1, 0); + g_vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0); choiceArray[prevChoice] = tmpStr; optionPosY += 8; } @@ -362,16 +361,16 @@ bool KnowledgeCheck::show() { if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; - displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + g_vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { tmpStr = choiceArray[currChoice] + '$'; - displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); + g_vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { tmpStr = choiceArray[prevChoice] + '$'; - displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + g_vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } } while (!((prevChoice != 0) && g_vm->getMouseClick())); @@ -420,7 +419,7 @@ void f3f8::draw() { * @remarks Originally called 'diver' */ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { - teskbd(); + g_vm->testKeyboard(); do { g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); g_vm->_key = waitForF3F8(); @@ -442,7 +441,7 @@ int f3f8::waitForF3F8() { int key; do { - key = testou(); + key = g_vm->testou(); if (g_vm->shouldQuit()) return key; } while ((key != 61) && (key != 66)); @@ -453,7 +452,7 @@ int f3f8::waitForF3F8() { void f3f8::aff50(bool drawAni50Fl) { g_vm->_caff = 50; g_vm->_maff = 0; - taffich(); + g_vm->_text.taffich(); g_vm->draw(kAdrDes, 63, 12); if (drawAni50Fl) ani50(); diff --git a/engines/mortevielle/keyboard.cpp b/engines/mortevielle/keyboard.cpp deleted file mode 100644 index 699bd5a7bd..0000000000 --- a/engines/mortevielle/keyboard.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "mortevielle/mortevielle.h" -#include "mortevielle/keyboard.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -char readkey1() { - char c = g_vm->getChar(); - - return c; -} - -int testou() { - char ch = g_vm->getChar(); - - switch (ch) { - case '\23' : - g_vm->_soundOff = !g_vm->_soundOff; - break; - case '\26' : - if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) { - g_vm->decodeNumber(&g_vm->_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); - ++g_vm->_c_zzz; - - return 61; - } - break; - case '\33' : - if (g_vm->keyPressed()) - ch = g_vm->getChar(); - break; - default: - break; - } - - return ord(ch); -} - -void teskbd() { - if (g_vm->keyPressed()) - testou(); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/keyboard.h b/engines/mortevielle/keyboard.h deleted file mode 100644 index 7b2510fe06..0000000000 --- a/engines/mortevielle/keyboard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_KEYBOARD_H -#define MORTEVIELLE_KEYBOARD_H - -namespace Mortevielle { - -extern char readkey1(); -extern int testou(); -extern void teskbd(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index fe02e1114f..8cad2b8ad0 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -5,7 +5,6 @@ MODULE_OBJS := \ detection.o \ dialogs.o \ graphics.o \ - keyboard.o \ menu.o \ mortevielle.o \ mouse.o \ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6d1a949516..fec14739c3 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -30,7 +30,6 @@ #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" #include "mortevielle/dialogs.h" -#include "mortevielle/keyboard.h" #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" @@ -208,10 +207,10 @@ Common::ErrorCode MortevielleEngine::initialise() { _soundOff = false; _largestClearScreen = false; - teskbd(); + testKeyboard(); showConfigScreen(); _newGraphicalDevice = _currGraphicalDevice; - teskbd(); + testKeyboard(); if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); @@ -693,7 +692,7 @@ void MortevielleEngine::handleAction() { handleOpcode(); if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { - taffich(); + g_vm->_text.taffich(); if (_okdes) { _okdes = false; dessin(); @@ -1706,7 +1705,7 @@ void MortevielleEngine::startDialog(int16 rep) { _mouse.hideMouse(); Common::String dialogStr = getString(rep + kDialogStringIndex); - displayStr(dialogStr, 230, 4, 65, 24, 5); + _text.displayStr(dialogStr, 230, 4, 65, 24, 5); f3f8::draw(); key = 0; @@ -2512,8 +2511,8 @@ void MortevielleEngine::showTitleScreen() { hirs(); repon(7, 2035); _caff = 51; - taffich(); - teskbd(); + _text.taffich(); + testKeyboard(); if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); @@ -2898,7 +2897,7 @@ void MortevielleEngine::text1(int x, int y, int nb, int m) { Common::String tmpStr = getString(m); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; - displayStr(tmpStr, x, y, nb, 20, _textColor); + _text.displayStr(tmpStr, x, y, nb, 20, _textColor); } void MortevielleEngine::repon(int f, int m) { @@ -2911,7 +2910,7 @@ void MortevielleEngine::repon(int f, int m) { _largestClearScreen = false; clearScreenType2(); - displayStr(tmpStr, 8, 176, 85, 3, 5); + _text.displayStr(tmpStr, 8, 176, 85, 3, 5); } else { modif(m); switch (f) { @@ -2940,7 +2939,7 @@ void MortevielleEngine::repon(int f, int m) { i = 5; Common::String tmpStr = getString(m); - displayStr(tmpStr, 80, 40, 60, 25, i); + _text.displayStr(tmpStr, 80, 40, 60, 25, i); if (m == 180) _coreVar._pourc[6] = '*'; @@ -3288,7 +3287,7 @@ void MortevielleEngine::dessin() { } void MortevielleEngine::afdes() { - taffich(); + _text.taffich(); dessin(); _okdes = false; } @@ -3424,38 +3423,38 @@ void MortevielleEngine::getSearchDescription(int objId) { } void MortevielleEngine::mennor() { - g_vm->_menu.menuUp(g_vm->_msg[3]); + _menu.menuUp(_msg[3]); } void MortevielleEngine::premtet() { - g_vm->draw(kAdrDes, 10, 80); - g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15); + draw(kAdrDes, 10, 80); + _screenSurface.drawBox(18, 79, 155, 91, 15); } void MortevielleEngine::ajchai() { - int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; + int cy = kAcha + ((_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; - } while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0)); + } while ((cx <= 9) && (_tabdon[cy + cx] != 0)); - if (g_vm->_tabdon[cy + cx] == 0) - g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId; + if (_tabdon[cy + cx] == 0) + _tabdon[cy + cx] = _coreVar._selectedObjectId; else - g_vm->_crep = 192; + _crep = 192; } void MortevielleEngine::ajjer(int ob) { int cx = 0; do { ++cx; - } while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0)); + } while ((cx <= 5) && (ord(_coreVar._sjer[cx]) != 0)); - if (ord(g_vm->_coreVar._sjer[cx]) == 0) { - g_vm->_coreVar._sjer[(cx)] = chr(ob); - g_vm->_menu.setInventoryText(); + if (ord(_coreVar._sjer[cx]) == 0) { + _coreVar._sjer[(cx)] = chr(ob); + _menu.setInventoryText(); } else - g_vm->_crep = 139; + _crep = 139; } /** @@ -3463,77 +3462,77 @@ void MortevielleEngine::ajjer(int ob) { * @remarks Originally called 'quelquun' */ void MortevielleEngine::interactNPC() { - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.eraseMenu(); + if (_menu._menuDisplayed) + _menu.eraseMenu(); - g_vm->endSearch(); - g_vm->_crep = 997; + endSearch(); + _crep = 997; L1: - if (!g_vm->_hiddenHero) { - if (g_vm->_crep == 997) - g_vm->_crep = 138; - g_vm->repon(2, g_vm->_crep); - if (g_vm->_crep == 138) - g_vm->_speechManager.startSpeech(5, 2, 1); + if (!_hiddenHero) { + if (_crep == 997) + _crep = 138; + repon(2, _crep); + if (_crep == 138) + _speechManager.startSpeech(5, 2, 1); else - g_vm->_speechManager.startSpeech(4, 4, 1); + _speechManager.startSpeech(4, 4, 1); - if (g_vm->_iouv == 0) - g_vm->_coreVar._faithScore += 2; - else if (g_vm->_coreVar._faithScore < 50) - g_vm->_coreVar._faithScore += 4; + if (_iouv == 0) + _coreVar._faithScore += 2; + else if (_coreVar._faithScore < 50) + _coreVar._faithScore += 4; else - g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10); - g_vm->exitRoom(); - g_vm->_menu.setDestinationText(LANDING); - int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex); - g_vm->_caff = 69 + cx; - g_vm->_crep = g_vm->_caff; - g_vm->_msg[3] = MENU_DISCUSS; - g_vm->_msg[4] = g_vm->_menu._discussMenu[cx]; - g_vm->_syn = true; - g_vm->_col = true; + _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); + exitRoom(); + _menu.setDestinationText(LANDING); + int cx = convertBitIndexToCharacterIndex(_currBitIndex); + _caff = 69 + cx; + _crep = _caff; + _msg[3] = MENU_DISCUSS; + _msg[4] = _menu._discussMenu[cx]; + _syn = true; + _col = true; } else { - if (g_vm->getRandomNumber(1, 3) == 2) { - g_vm->_hiddenHero = false; - g_vm->_crep = 137; + if (getRandomNumber(1, 3) == 2) { + _hiddenHero = false; + _crep = 137; goto L1; } else { - g_vm->repon(2, 136); - int rand = (g_vm->getRandomNumber(0, 4)) - 2; - g_vm->_speechManager.startSpeech(3, rand, 1); - g_vm->clearScreenType2(); - g_vm->displayAloneText(); - g_vm->resetRoomVariables(MANOR_FRONT); - g_vm->affrep(); + repon(2, 136); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(3, rand, 1); + clearScreenType2(); + displayAloneText(); + resetRoomVariables(MANOR_FRONT); + affrep(); } } - if (g_vm->_menu._menuDisplayed) - g_vm->_menu.drawMenu(); + if (_menu._menuDisplayed) + _menu.drawMenu(); } void MortevielleEngine::tsuiv() { int tbcl; - int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1; + int cy = kAcha + ((_mchai - 1) * 10) - 1; int cx = 0; do { ++cx; - ++g_vm->_cs; - int cl = cy + g_vm->_cs; - tbcl = g_vm->_tabdon[cl]; - } while ((tbcl == 0) && (g_vm->_cs <= 9)); - - if ((tbcl != 0) && (g_vm->_cs < 11)) { - ++g_vm->_is; - g_vm->_caff = tbcl; - g_vm->_crep = g_vm->_caff + 400; - if (g_vm->_currBitIndex != 0) - g_vm->_coreVar._faithScore += 2; + ++_cs; + int cl = cy + _cs; + tbcl = _tabdon[cl]; + } while ((tbcl == 0) && (_cs <= 9)); + + if ((tbcl != 0) && (_cs < 11)) { + ++_is; + _caff = tbcl; + _crep = _caff + 400; + if (_currBitIndex != 0) + _coreVar._faithScore += 2; } else { - g_vm->affrep(); - g_vm->endSearch(); + affrep(); + endSearch(); if (cx > 9) - g_vm->_crep = 131; + _crep = 131; } } @@ -3541,7 +3540,7 @@ void MortevielleEngine::tfleche() { bool qust; char touch; - if (g_vm->_num == 9999) + if (_num == 9999) return; fenat(chr(152)); @@ -3550,24 +3549,24 @@ void MortevielleEngine::tfleche() { touch = '\0'; do { - g_vm->_mouse.moveMouse(qust, touch); + _mouse.moveMouse(qust, touch); CHECK_QUIT; - if (g_vm->getMouseClick()) - inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12); - g_vm->prepareRoom(); - } while (!(qust || inRect || g_vm->_anyone)); + if (getMouseClick()) + inRect = (_mouse._pos.x < 256 * _res) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + prepareRoom(); + } while (!(qust || inRect || _anyone)); if (qust && (touch == '\103')) - Alert::show(g_vm->_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect))); + Alert::show(_hintPctMessage, 1); + } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); if (touch == '\73') - g_vm->_keyPressedEsc = true; + _keyPressedEsc = true; if (inRect) { - g_vm->_x = g_vm->_mouse._pos.x; - g_vm->_y = g_vm->_mouse._pos.y; + _x = _mouse._pos.x; + _y = _mouse._pos.y; } } @@ -3580,92 +3579,92 @@ void MortevielleEngine::setCoordinates(int sx) { int ib; - g_vm->_num = 0; - g_vm->_crep = 999; + _num = 0; + _crep = 999; int a = 0; int atdon = amzon + 3; int cy = 0; - while (cy < g_vm->_caff) { - a += g_vm->_tabdon[atdon]; + while (cy < _caff) { + a += _tabdon[atdon]; atdon += 4; ++cy; } - if (g_vm->_tabdon[atdon] == 0) { - g_vm->_crep = 997; + if (_tabdon[atdon] == 0) { + _crep = 997; return; } a += kFleche; int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; + ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } - ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)]; + ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; if (ib == 0) { - g_vm->_crep = 997; + _crep = 997; return; } cy = 1; do { cb += 2; - sx = g_vm->_tabdon[a + cb] * g_vm->_res; - sy = g_vm->_tabdon[(a + cb + 1)]; + sx = _tabdon[a + cb] * _res; + sy = _tabdon[(a + cb + 1)]; cb += 2; - ix = g_vm->_tabdon[a + cb] * g_vm->_res; - iy = g_vm->_tabdon[(a + cb + 1)]; + ix = _tabdon[a + cb] * _res; + iy = _tabdon[(a + cb + 1)]; ++cy; - } while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib))); + } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); - if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) { - g_vm->_num = cy - 1; + if ((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) { + _num = cy - 1; return; } - g_vm->_crep = 997; + _crep = 997; } void MortevielleEngine::treg(int objId) { - int mdes = g_vm->_caff; - g_vm->_caff = objId; + int mdes = _caff; + _caff = objId; - if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) { - g_vm->afdes(); - if ((g_vm->_caff > 29) && (g_vm->_caff < 33)) - g_vm->repon(2, g_vm->_caff); + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_msg[4] == OPCODE_SLOOK)) { + afdes(); + if ((_caff > 29) && (_caff < 33)) + repon(2, _caff); else - g_vm->repon(2, g_vm->_caff + 400); - g_vm->testKey(true); - g_vm->_caff = mdes; - g_vm->_msg[3] = 0; - g_vm->_crep = 998; + repon(2, _caff + 400); + testKey(true); + _caff = mdes; + _msg[3] = 0; + _crep = 998; } else { - g_vm->_obpart = true; - g_vm->_crep = g_vm->_caff + 400; - g_vm->_menu.setSearchMenu(); + _obpart = true; + _crep = _caff + 400; + _menu.setSearchMenu(); } } void MortevielleEngine::avpoing(int &objId) { - g_vm->_crep = 999; - if (g_vm->_coreVar._selectedObjectId != 0) - g_vm->ajjer(g_vm->_coreVar._selectedObjectId); + _crep = 999; + if (_coreVar._selectedObjectId != 0) + ajjer(_coreVar._selectedObjectId); - if (g_vm->_crep != 139) { - g_vm->displayItemInHand(objId + 400); - g_vm->_coreVar._selectedObjectId = objId; + if (_crep != 139) { + displayItemInHand(objId + 400); + _coreVar._selectedObjectId = objId; objId = 0; } } void MortevielleEngine::rechai(int &ch) { - int tmpPlace = g_vm->_coreVar._currPlace; + int tmpPlace = _coreVar._currPlace; - if (g_vm->_coreVar._currPlace == CRYPT) + if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1]; + ch = _tabdon[achai + (tmpPlace * 7) + _num - 1]; } /** @@ -3673,9 +3672,9 @@ void MortevielleEngine::rechai(int &ch) { * @remarks Originally called 't23coul' */ int MortevielleEngine::checkLeaveSecretPassage() { - if (!g_vm->checkInventory(143)) { - g_vm->_crep = 1512; - g_vm->loseGame(); + if (!checkInventory(143)) { + _crep = 1512; + loseGame(); } return CELLAR; @@ -3684,17 +3683,52 @@ int MortevielleEngine::checkLeaveSecretPassage() { void MortevielleEngine::fenat(char ans) { int coul; - g_vm->_mouse.hideMouse(); - if (g_vm->_currGraphicalDevice == MODE_CGA) + _mouse.hideMouse(); + if (_currGraphicalDevice == MODE_CGA) coul = 2; - else if (g_vm->_currGraphicalDevice == MODE_HERCULES) + else if (_currGraphicalDevice == MODE_HERCULES) coul = 1; else coul = 12; - g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15); - g_vm->_mouse.showMouse(); + _screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + _screenSurface.drawBox(300, 191, 16, 8, 15); + _mouse.showMouse(); +} + +/** + * Test Keyboard + * @remarks Originally called 'teskbd' + */ +void MortevielleEngine::testKeyboard() { + if (keyPressed()) + testou(); +} + +int MortevielleEngine::testou() { + char ch = getChar(); + + switch (ch) { + case '\23' : + _soundOff = !_soundOff; + break; + case '\26' : + if ((_c_zzz == 1) || (_c_zzz == 2)) { + decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); + ++_c_zzz; + + return 61; + } + break; + case '\33' : + if (keyPressed()) + ch = getChar(); + break; + default: + break; + } + + return ord(ch); } void MortevielleEngine::sauvecr(int y, int dy) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6e55bebd7e..514b929a22 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -38,9 +38,32 @@ #include "mortevielle/saveload.h" #include "mortevielle/sound.h" #include "mortevielle/speech.h" +#include "mortevielle/outtext.h" namespace Mortevielle { +/*---------------------------------------------------------------------------*/ +/*------------------- MEMORY MAP ------------------------*/ +/*---------------------------------------------------------------------------*/ +/* The following is a list of physical addresses in memory currently used + * by the game. + * + * Address + * ------- + * 5000:0 - Music data + * 6000:0 - Decompressed current image + * 7000:0+ - Compressed images + * 7000:2 - 16 words representing palette map + * 7000:4138 - width, height, x/y offset of decoded image + */ + +#define ord(v) ((int) v) +#define chr(v) ((unsigned char) v) +#define lo(v) ((v) & 0xff) +#define hi(v) (((v) >> 8) & 0xff) +#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) +#define odd(v) (((v) % 2) == 1) + // Debug channels enum { kMortevielleCore = 1 << 0, @@ -73,12 +96,6 @@ enum DataType { kGameStrings = 1 }; -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 #define SCREEN_ORIG_HEIGHT 200 @@ -101,6 +118,51 @@ const int arep = 1314; const int amzon = 1650; const int arega = 0; +const int kMaxTi = 7975; +const int kMaxTd = 600; + +const int kDescriptionStringIndex = 0; // Unused +const int kInventoryStringIndex = 186; +const int kQuestionStringIndex = 247; +const int kDialogStringIndex = 292; +const int kMenuPlaceStringIndex = 435; +const int kMenuActionStringIndex = 476; +const int kMenuSelfStringIndex = 497; +const int kMenuSayStringIndex = 502; +const int kSecretPassageQuestionStringIndex = 510; // Unusued? +const int kMaxPatt = 20; + +const int OPCODE_NONE = 0; +enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, + OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, + OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, + OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, + OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, + OPCODE_SLOOK = 0x405}; + +static const int _actionMenu[12] = { OPCODE_NONE, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE +}; + +/* +9 "A glance at the forbidden$", +18 "It's already open$", +26 "A photograph$", +27 "The coat of arms$", +*/ +enum places { + OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, + BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, + DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, + LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, + CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, + DOOR = 25, ROOM26 = 26, ROOM27 = 27 +}; + +enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; + struct nhom { byte _id; /* number between 0 and 32 */ byte _hom[4]; @@ -144,15 +206,79 @@ private: const ADGameDescription *_gameDescription; Common::Stack _keypresses; uint32 _lastGameFrame; - bool _mouseClick; Common::Point _mousePos; - bool _inMainGameLoop; // Flag when the main game loop is active Common::StringArray _engineStrings; Common::StringArray _gameStrings; Pattern _patternArr[15]; int _menuOpcode; + bool _mouseClick; + bool _inMainGameLoop; // Flag when the main game loop is active + bool _quitGame; // Quit game flag. Originally called 'arret' + bool _endGame; // End game flag. Originally called 'solu' + bool _loseGame; // Lose game flag. Originally called 'perdu' + bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file + bool _roomPresenceLuc; + bool _roomPresenceIda; + bool _purpleRoomPresenceLeo; + bool _roomPresenceGuy; + bool _roomPresenceEva; + bool _roomPresenceMax; + bool _roomPresenceBob; + bool _roomPresencePat; + bool _toiletsPresenceBobMax; + bool _bathRoomPresenceBobMax; + bool _room9PresenceLeo; + bool _hiddenHero; + bool _heroSearching; + bool _keyPressedEsc; + bool _reloadCFIEC; + bool _col; + bool _syn; + bool _obpart; + bool _anyone; + bool _brt; + + int _textColor; + int _place; + int _manorDistance; + int _currBitIndex; + int _currDay; + int _currHour; + int _currHalfHour; + int _day; + int _hour; + int _minute; + int _mchai; + int _controlMenu; + int _startHour; + int _endHour; + Common::Point _stdPal[91][17]; + t_pcga _cgaPal[91]; + + int _c_zzz; + int _ment; + int _iouv; + int _dobj; + int _num; + int _cs; + int _prebru; + int _t; + int _x; + int _y; + int _jh; + int _mh; + + + Common::String _hintPctMessage; + byte _cfiecBuffer[822 * 128]; + byte _touv[8]; + int _nbrep[9]; + int _nbrepm[9]; + uint16 _inpBuffer[kMaxTi + 1]; + Hint _ntpBuffer[kMaxTd + 1]; + Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); void readStaticStrings(Common::File &f, int dataSize, DataType dataType); @@ -164,8 +290,6 @@ private: void mainGame(); void playGame(); void handleAction(); - void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); - void copcha(); void displayCGAPattern(int n, Pattern p, nhom *pal); void loadPalette(); void loadTexts(); @@ -177,7 +301,122 @@ private: void palette(int v1); int checkLeoMaxRandomPresence(); void interactNPC(); + void initCaveOrCellar(); + void displayControlMenu(); + void displayItemInHand(int objId); + void resetRoomVariables(int roomId); + int getPresenceStats(int &rand, int cf, int roomId); + void setPresenceFlags(int roomId); + void testKey(bool d); + void exitRoom(); + void getReadDescription(int objId); + void getSearchDescription(int objId); + int checkLeaveSecretPassage(); + void changeGraphicalDevice(int newDevice); + void startDialog(int16 rep); + void endSearch(); + int convertCharacterIndexToBitIndex(int characterIndex); + int convertBitIndexToCharacterIndex(int bitIndex); + void clearScreenType1(); + void clearScreenType2(); + void clearScreenType3(); + void clearScreenType10(); + int getRandomNumber(int minval, int maxval); + void showMoveMenuAlert(); + void showConfigScreen(); + void decodeNumber(byte *pStart, int count); + void resetVariables(); + void music(); + void drawRightFrame(); + void prepareRoom(); + void drawClock(); + void checkManorDistance(); + void gotoManorFront(); + void gotoManorBack(); + void gotoDiningRoom(); + bool checkInventory(int objectId); + void loseGame(); + void floodedInWell(); + void displayDiningRoom(); + void startMusicOrSpeech(int so); + void setTextColor(int col); + void prepareScreenType1(); + void prepareScreenType2(); + void prepareScreenType3(); + void updateHour(int &day, int &hour, int &minute); + void getKnockAnswer(); + int getPresenceStatsGreenRoom(); + int getPresenceStatsPurpleRoom(); + int getPresenceStatsToilets(); + int getPresenceStatsBlueRoom(); + int getPresenceStatsRedRoom(); + int getPresenceStatsDiningRoom(int &hour); + int getPresenceStatsBureau(int &hour); + int getPresenceStatsKitchen(); + int getPresenceStatsAttic(); + int getPresenceStatsLanding(); + int getPresenceStatsChapel(int &hour); + int getPresenceBitIndex(int roomId); + void setPresenceGreenRoom(int roomId); + void setPresencePurpleRoom(); + void setPresenceBlueRoom(); + void setPresenceRedRoom(int roomId); + int setPresenceDiningRoom(int hour); + int setPresenceBureau(int hour); + int setPresenceKitchen(); + int setPresenceLanding(); + int setPresenceChapel(int hour); + void setRandomPresenceGreenRoom(int cf); + void setRandomPresencePurpleRoom(int cf); + void setRandomPresenceBlueRoom(int cf); + void setRandomPresenceRedRoom(int cf); + void setRandomPresenceRoom9(int cf); + void setRandomPresenceDiningRoom(int cf); + void setRandomPresenceBureau(int cf); + void setRandomPresenceKitchen(int cf); + void setRandomPresenceAttic(int cf); + void setRandomPresenceLanding(int cf); + void setRandomPresenceChapel(int cf); + void loadPlaces(); + void resetPresenceInRooms(int roomId); + void showPeoplePresent(int bitIndex); + int selectCharacters(int min, int max); + void fctMove(); + void fctTake(); + void fctInventoryTake(); + void fctLift(); + void fctRead(); + void fctSelfRead(); + void fctLook(); + void fctSelftLook(); + void fctSearch(); + void fctSelfSearch(); + void fctOpen(); + void fctPlace(); + void fctTurn(); + void fctSelfHide(); + void fctAttach(); + void fctClose(); + void fctKnock(); + void fctSelfPut(); + void fctListen(); + void fctEat(); + void fctEnter(); + void fctSleep(); + void fctForce(); + void fctLeave(); + void fctWait(); + void fctSound(); + void fctDiscuss(); + void fctSmell(); + void fctScratch(); + void endGame(); + void askRestart(); + void delay(int amount); + void handleOpcode(); + void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); + void copcha(); void adzon(); void text1(int x, int y, int nb, int m); void modif(int &nu); @@ -188,90 +427,45 @@ private: void ajchai(); void tfleche(); void setCoordinates(int sx); + void ecr2(Common::String text); + void ecr3(Common::String text); + void init_nbrepm(); + void aniof(int ouf, int num); + void dessin(); + void afdes(); + void tlu(int af, int ob); + void affrep(); + void mennor(); + void ajjer(int ob); + void tsuiv(); + void treg(int objId); + void avpoing(int &objId); + void rechai(int &ch); + void fenat(char ans); public: - Common::String _hintPctMessage; Common::Point _prevPos; - - byte _tabdon[4001]; - byte _cfiecBuffer[822 * 128]; - int _fxxBuffer[108]; - byte _touv[8]; int _msg[5]; - int _nbrep[9]; - int _nbrepm[9]; - uint16 _inpBuffer[kMaxTi + 1]; - Hint _ntpBuffer[kMaxTd + 1]; - - bool _roomPresenceLuc; - bool _roomPresenceIda; - bool _purpleRoomPresenceLeo; - bool _roomPresenceGuy; - bool _roomPresenceEva; - bool _roomPresenceMax; - bool _roomPresenceBob; - bool _roomPresencePat; - bool _toiletsPresenceBobMax; - bool _bathRoomPresenceBobMax; - bool _room9PresenceLeo; + int _fxxBuffer[108]; + byte _tabdon[4001]; bool _soundOff; - bool _largestClearScreen; - bool _hiddenHero; - bool _heroSearching; - bool _keyPressedEsc; - bool _reloadCFIEC; - bool _blo; - bool _col; - bool _syn; - bool _obpart; bool _okdes; - bool _anyone; - bool _brt; - - int _textColor; - int _currGraphicalDevice; - int _newGraphicalDevice; - int _place; - int _manorDistance; - int _currBitIndex; - int _savedBitIndex; - int _currDay; - int _currHour; - int _currHalfHour; - int _day; - int _hour; - int _minute; - int _mchai; + bool _largestClearScreen; + int _currGraphicalDevice; + int _newGraphicalDevice; float _addFix; + int _savedBitIndex; + int _numpal; + int _key; SaveStruct _coreVar, _saveStruct; - Common::Point _stdPal[91][17]; - t_pcga _cgaPal[91]; - int _key; - int _controlMenu; - int _startHour; - int _endHour; - int _c_zzz; - int ptr_word; - byte _v_lieu[7][25]; - byte _is; - int _numpal; - int _ment; - int _iouv; - int _caff; int _maff; - int _dobj; - int _num; - int _crep; - int _cs; int _res; - int _prebru; - int _t; - int _x; - int _y; - int _jh; - int _mh; + int _caff; + int _crep; + byte _is; + byte _v_lieu[7][25]; // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; @@ -285,11 +479,7 @@ public: SpeechManager _speechManager; Menu _menu; MouseHandler _mouse; - - bool _quitGame; // Quit game flag. Originally called 'arret' - bool _endGame; // End game flag. Originally called 'solu' - bool _loseGame; // Lose game flag. Originally called 'perdu' - bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file + TextHandler _text; MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -302,165 +492,33 @@ public: uint32 getGameFlags() const; Common::Language getLanguage() const; - bool keyPressed(); int getChar(); + bool keyPressed(); Common::Point getMousePos() const { return _mousePos; } void setMousePos(const Common::Point &pt); bool getMouseClick() const { return _mouseClick; } void setMouseClick(bool v) { _mouseClick = v; } - void delay(int amount); Common::String getEngineString(int idx) const { return _engineStrings[idx]; } Common::String getGameString(int idx) const { return _gameStrings[idx]; } - void handleOpcode(); - void endGame(); - void askRestart(); void gameLoaded(); - - void fctMove(); - void fctTake(); - void fctInventoryTake(); - void fctLift(); - void fctRead(); - void fctSelfRead(); - void fctLook(); - void fctSelftLook(); - void fctSearch(); - void fctSelfSearch(); - void fctOpen(); - void fctPlace(); - void fctTurn(); - void fctSelfHide(); - void fctAttach(); - void fctClose(); - void fctKnock(); - void fctSelfPut(); - void fctListen(); - void fctEat(); - void fctEnter(); - void fctSleep(); - void fctForce(); - void fctLeave(); - void fctWait(); - void fctSound(); - void fctDiscuss(); - void fctSmell(); - void fctScratch(); - - int getPresenceStatsGreenRoom(); - int getPresenceStatsPurpleRoom(); - int getPresenceStatsToilets(); - int getPresenceStatsBlueRoom(); - int getPresenceStatsRedRoom(); - int getPresenceStatsDiningRoom(int &hour); - int getPresenceStatsBureau(int &hour); - int getPresenceStatsKitchen(); - int getPresenceStatsAttic(); - int getPresenceStatsLanding(); - int getPresenceStatsChapel(int &hour); - int getPresenceBitIndex(int roomId); - void setPresenceGreenRoom(int roomId); - void setPresencePurpleRoom(); - void setPresenceBlueRoom(); - void setPresenceRedRoom(int roomId); - int setPresenceDiningRoom(int hour); - int setPresenceBureau(int hour); - int setPresenceKitchen(); - int setPresenceLanding(); - int setPresenceChapel(int hour); - void setRandomPresenceGreenRoom(int cf); - void setRandomPresencePurpleRoom(int cf); - void setRandomPresenceBlueRoom(int cf); - void setRandomPresenceRedRoom(int cf); - void setRandomPresenceRoom9(int cf); - void setRandomPresenceDiningRoom(int cf); - void setRandomPresenceBureau(int cf); - void setRandomPresenceKitchen(int cf); - void setRandomPresenceAttic(int cf); - void setRandomPresenceLanding(int cf); - void setRandomPresenceChapel(int cf); - - void loadPlaces(); void initGame(); - void resetPresenceInRooms(int roomId); - void showPeoplePresent(int bitIndex); - int selectCharacters(int min, int max); void displayAloneText(); - - void checkManorDistance(); - void gotoManorFront(); - void gotoManorBack(); - void gotoDiningRoom(); - bool checkInventory(int objectId); - void loseGame(); - void floodedInWell(); - void displayDiningRoom(); - void startMusicOrSpeech(int so); - void setTextColor(int col); - void prepareScreenType1(); - void prepareScreenType2(); - void prepareScreenType3(); - void updateHour(int &day, int &hour, int &minute); - void getKnockAnswer(); + void draw(int ad, int x, int y); void charToHour(); void hourToChar(); - - void changeGraphicalDevice(int newDevice); - void startDialog(int16 rep); - void endSearch(); - int convertCharacterIndexToBitIndex(int characterIndex); - int convertBitIndexToCharacterIndex(int bitIndex); - void clearScreenType1(); - void clearScreenType2(); - void clearScreenType3(); - void clearScreenType10(); - int getRandomNumber(int minval, int maxval); - void showMoveMenuAlert(); - void showConfigScreen(); - void decodeNumber(byte *pStart, int count); Common::String getString(int num); - void resetVariables(); void setPal(int n); - void music(); - void draw(int ad, int x, int y); - void drawRightFrame(); - void prepareRoom(); - void drawClock(); Common::String copy(const Common::String &s, int idx, size_t size); - void hirs(); - void initCaveOrCellar(); - void displayControlMenu(); - void displayItemInHand(int objId); - void displayEmptyHand(); - void resetRoomVariables(int roomId); - int getPresenceStats(int &rand, int cf, int roomId); - void setPresenceFlags(int roomId); + void testKeyboard(); int getPresence(int roomId); - void testKey(bool d); - void exitRoom(); - void getReadDescription(int objId); - void getSearchDescription(int objId); - int checkLeaveSecretPassage(); + void displayEmptyHand(); - void pictout(int seg, int dep, int x, int y); - int animof(int ouf, int num); + void hirs(); + int testou(); void repon(int f, int m); - void ecr2(Common::String text); - void ecr3(Common::String text); - void init_nbrepm(); - void aniof(int ouf, int num); - void dessin(); - void afdes(); - void tlu(int af, int ob); - void affrep(); - void mennor(); - void ajjer(int ob); - void tsuiv(); - void treg(int objId); - void avpoing(int &objId); - void rechai(int &ch); - void fenat(char ans); - + int animof(int ouf, int num); + void pictout(int seg, int dep, int x, int y); void sauvecr(int y, int dy); void charecr(int y, int dy); diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index e18090e1dd..ff50e8b882 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -69,7 +69,6 @@ void MouseHandler::hideMouse() { case MODE_AMSTRAD1512: { bool imp = odd(_pos.y); for (int i = 0; i <= 3; ++i) { - _port[0x3dd] = 1 << i; int k = 0; j = 0; do { @@ -87,12 +86,8 @@ void MouseHandler::hideMouse() { break; } case MODE_EGA: { - _port[0x3c4] = 2; - _port[0x3ce] = 8; - _port[0x3cf] = 255; int i = 0; do { - _port[0x3c5] = 1 << i; int k = 0; j = 0; do { @@ -167,7 +162,6 @@ void MouseHandler::showMouse() { for (i = 0; i <= 3; ++i) { j = 0; imp = odd(_pos.y); - _port[0x3de] = i; k = 0; do { if (imp) { @@ -184,10 +178,8 @@ void MouseHandler::showMouse() { break; } case MODE_EGA: - _port[0x3ce] = 4; l = 0; do { - _port[0x3cf] = l; k = 0; j = 0; do { diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index b570f8913c..efbb52aa49 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -36,8 +36,6 @@ class MouseHandler { private: int s_s[12][6]; int _counter; - // TODO: Replace the following with proper implementations, or refactor out the code using them - int _port[0xfff]; public: Common::Point _pos; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 35d42251b1..f53a7b2804 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -35,10 +35,11 @@ namespace Mortevielle { -typedef unsigned char uchar; -const byte _rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; - -static int l_motsuiv(int p, const char *ch, int &tab) { +/** + * Next word + * @remarks Originally called 'l_motsuiv' + */ +int TextHandler::nextWord(int p, const char *ch, int &tab) { int c = p; while ((ch[p] != ' ') && (ch[p] != '$') && (ch[p] != '@')) @@ -51,7 +52,7 @@ static int l_motsuiv(int p, const char *ch, int &tab) { * Engine function - Display Text * @remarks Originally called 'afftex' */ -void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) { +void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) { int tab; Common::String s; int i, j; @@ -87,7 +88,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) s += ' '; xc += tab; ++p; - if (l_motsuiv(p, inputStr.c_str(), tab) + xc > xf) { + if (nextWord(p, inputStr.c_str(), tab) + xc > xf) { g_vm->_screenSurface.drawString(s, typ); s = ""; xc = x; @@ -123,7 +124,11 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) } } -void chardes(Common::String filename, int32 skipSize, int length) { +/** + * Load DES file + * @remarks Originally called 'chardes' + */ +void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int length) { Common::File f; if (!f.open(filename)) error("Missing file %s", filename.c_str()); @@ -150,7 +155,11 @@ void chardes(Common::String filename, int32 skipSize, int length) { g_vm->_mem[0x7000 * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; } -void charani(Common::String filename, int32 skipSize, int length) { +/** + * Load ANI file + * @remarks Originally called 'charani' + */ +void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int length) { Common::File f; if (!f.open(filename)) error("Missing file - %s", filename.c_str()); @@ -177,7 +186,9 @@ void charani(Common::String filename, int32 skipSize, int length) { g_vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; } -void taffich() { +void TextHandler::taffich() { + static const byte _rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; + byte tran1[] = { 121, 121, 138, 139, 120 }; byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; @@ -295,7 +306,7 @@ void taffich() { g_vm->_maff = a; npal = a + 37; } - chardes(filename, lgt, handle); + loadDesFile(filename, lgt, handle); if (g_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { int palh = READ_LE_UINT16(&g_vm->_mem[(0x7000 * 16) + ((i + 1) << 1)]); @@ -330,7 +341,7 @@ void taffich() { filename = "AZZ.mor"; handle = 1260; } - charani(filename, lgt, handle); + loadAniFile(filename, lgt, handle); } g_vm->_mouse.showMouse(); if ((a < 27) && ((g_vm->_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) { diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index d27ca3edc9..3664fd6fa5 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -35,10 +35,15 @@ namespace Mortevielle { const int kAdrAni = 0x7314; -extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); -extern void chardes(Common::String filename, int32 passe, int long_); -extern void charani(Common::String filename, int32 skipSize, int length); -extern void taffich(); +class TextHandler { +private: + int nextWord(int p, const char *ch, int &tab); +public: + void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); + void loadDesFile(Common::String filename, int32 passe, int long_); + void loadAniFile(Common::String filename, int32 skipSize, int length); + void taffich(); +}; } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 3086f9eb20..0e12c5f953 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -33,76 +33,6 @@ namespace Mortevielle { -/*---------------------------------------------------------------------------*/ -/*------------------- MEMORY MAP ------------------------*/ -/*---------------------------------------------------------------------------*/ -/* The following is a list of physical addresses in memory currently used - * by the game. - * - * Address - * ------- - * 5000:0 - Music data - * 6000:0 - Decompressed current image - * 7000:0+ - Compressed images - * 7000:2 - 16 words representing palette map - * 7000:4138 - width, height, x/y offset of decoded image - */ - - -/*---------------------------------------------------------------------------*/ -/*------------------------- DEFINES ----------------------------------*/ -/*---------------------------------------------------------------------------*/ - -#define ord(v) ((int) v) -#define chr(v) ((unsigned char) v) -#define lo(v) ((v) & 0xff) -#define hi(v) (((v) >> 8) & 0xff) -#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) -#define odd(v) (((v) % 2) == 1) - -/*---------------------------------------------------------------------------*/ -/*------------------------- CONSTANTS ----------------------------------*/ -/*---------------------------------------------------------------------------*/ - -const int kMaxTi = 7975; -const int kMaxTd = 600; - -const int kDescriptionStringIndex = 0; // Unused -const int kInventoryStringIndex = 186; -const int kQuestionStringIndex = 247; -const int kDialogStringIndex = 292; -const int kMenuPlaceStringIndex = 435; -const int kMenuActionStringIndex = 476; -const int kMenuSelfStringIndex = 497; -const int kMenuSayStringIndex = 502; -const int kSecretPassageQuestionStringIndex = 510; // Unusued? -const int kMaxPatt = 20; - -const int OPCODE_NONE = 0; -enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, - OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, - OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, - OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, - OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, - OPCODE_SLOOK = 0x405}; - -/* -9 "A glance at the forbidden$", -18 "It's already open$", -26 "A photograph$", -27 "The coat of arms$", -*/ -enum places { - OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, - BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, - DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, - LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, - CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, - DOOR = 25, ROOM26 = 26, ROOM27 = 27 -}; - -enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; - struct Rect { int _x1, _x2, _y1, _y2; bool _enabled; -- cgit v1.2.3 From 26a38fb1e67a82b59b21b038c08dc3c5169eaa78 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Mar 2012 22:48:47 +0100 Subject: MORTEVIELLE: rename some constants --- engines/mortevielle/actions.cpp | 10 +++++----- engines/mortevielle/mortevielle.cpp | 4 ++-- engines/mortevielle/mortevielle.h | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1a6614953d..011728870c 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -349,7 +349,7 @@ void MortevielleEngine::fctLift() { tmpPlace = 14; else if (_coreVar._currPlace == MOUNTAIN) tmpPlace = 15; - _crep = _tabdon[asoul + (tmpPlace << 3) + (_num - 1)]; + _crep = _tabdon[kAsoul + (tmpPlace << 3) + (_num - 1)]; if (_crep == 255) _crep = 997; } @@ -443,7 +443,7 @@ void MortevielleEngine::fctLook() { cx -= 4; if (_coreVar._currPlace == ROOM26) cx = 21; - _crep = _tabdon[arega + (cx * 7) + _num - 1]; + _crep = _tabdon[kArega + (cx * 7) + _num - 1]; if ((_coreVar._currPlace == ATTIC) && (_num == 8)) _crep = 126; if (_coreVar._currPlace == MOUNTAIN) @@ -631,7 +631,7 @@ void MortevielleEngine::fctOpen() { tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - _crep = _tabdon[aouvr + (tmpPlace * 7) + _num - 1]; + _crep = _tabdon[kAouvr + (tmpPlace * 7) + _num - 1]; if (_crep == 254) _crep = 999; } else @@ -1474,8 +1474,8 @@ void MortevielleEngine::fctDiscuss() { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } } else if (_nbrep[_caff - 69] < _nbrepm[_caff - 69]) { - suj = _tabdon[arep + (ix << 3) + (_caff - 70)]; - _coreVar._faithScore += _tabdon[arcf + ix]; + suj = _tabdon[kArep + (ix << 3) + (_caff - 70)]; + _coreVar._faithScore += _tabdon[kArcf + ix]; ++_nbrep[_caff - 69]; } else { _coreVar._faithScore += 3; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index fec14739c3..2c3313ea45 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -3582,7 +3582,7 @@ void MortevielleEngine::setCoordinates(int sx) { _num = 0; _crep = 999; int a = 0; - int atdon = amzon + 3; + int atdon = kAmzon + 3; int cy = 0; while (cy < _caff) { a += _tabdon[atdon]; @@ -3664,7 +3664,7 @@ void MortevielleEngine::rechai(int &ch) { if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - ch = _tabdon[achai + (tmpPlace * 7) + _num - 1]; + ch = _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 514b929a22..98d4b042bb 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -110,13 +110,13 @@ const int kAcha = 492; const int kAdrDes = 0x7000; const int kFleche = 1758; -const int asoul = 154; -const int aouvr = 282; -const int achai = 387; -const int arcf = 1272; -const int arep = 1314; -const int amzon = 1650; -const int arega = 0; +const int kAsoul = 154; +const int kAouvr = 282; +const int kAchai = 387; +const int kArcf = 1272; +const int kArep = 1314; +const int kAmzon = 1650; +const int kArega = 0; const int kMaxTi = 7975; const int kMaxTd = 600; -- cgit v1.2.3 From 67c95912f69ff24595fe8a07e1ce5e4d9befffe3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Mar 2012 23:55:00 +0200 Subject: MORTEVIELLE: rename Rect --- engines/mortevielle/dialogs.cpp | 12 ++++++------ engines/mortevielle/mouse.cpp | 4 ++-- engines/mortevielle/mouse.h | 2 +- engines/mortevielle/var_mor.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f04233d908..395f6b6c9c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -289,7 +289,7 @@ bool KnowledgeCheck::show() { int rep; int firstOption, lastOption; char key; - Rect coor[kMaxRect]; + Hotspot coor[kMaxRect]; Common::String choiceArray[15]; int currChoice, prevChoice; @@ -329,10 +329,10 @@ bool KnowledgeCheck::show() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._x1 = 45 * g_vm->_res; - coor[j]._x2 = (maxLength * 3 + 55) * g_vm->_res; - coor[j]._y1 = 27 + j * 8; - coor[j]._y2 = 34 + j * 8; + coor[j]._rect.left = 45 * g_vm->_res; + coor[j]._rect.right = (maxLength * 3 + 55) * g_vm->_res; + coor[j]._rect.top = 27 + j * 8; + coor[j]._rect.bottom = 34 + j * 8; coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { @@ -356,7 +356,7 @@ bool KnowledgeCheck::show() { CHECK_QUIT0; currChoice = 1; - while (coor[currChoice]._enabled && !g_vm->_mouse.isMouseIn(coor[currChoice])) + while (coor[currChoice]._enabled && !g_vm->_mouse.isMouseIn(coor[currChoice]._rect)) ++currChoice; if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index ff50e8b882..f914860820 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -408,11 +408,11 @@ void MouseHandler::moveMouse(bool &funct, char &key) { * Mouse function : Is mouse in a given rect? * @remarks Originally called 'dans_rect' */ -bool MouseHandler::isMouseIn(Rect r) { +bool MouseHandler::isMouseIn(Common::Rect r) { int x, y, c; getMousePosition(x, y, c); - if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) + if ((x > r.left) && (x < r.right) && (y > r.top) && (y < r.bottom)) return true; return false; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index efbb52aa49..b93ce6136d 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -45,7 +45,7 @@ public: void setMousePosition(Common::Point newPos); void getMousePosition(int &x, int &y, int &c); void moveMouse(bool &funct, char &key); - bool isMouseIn(Rect r); + bool isMouseIn(Common::Rect r); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 0e12c5f953..bddf85cd90 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -33,8 +33,8 @@ namespace Mortevielle { -struct Rect { - int _x1, _x2, _y1, _y2; +struct Hotspot { + Common::Rect _rect; bool _enabled; }; -- cgit v1.2.3 From a1c268e08296c08e147a537c1bb4bba23794d891 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Mar 2012 22:44:43 +0200 Subject: MORTEVIELLE: Fix regression in previous commit --- engines/mortevielle/dialogs.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 395f6b6c9c..b90f165b6c 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -284,12 +284,19 @@ bool KnowledgeCheck::show() { const int textIndexArr[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; const int correctAnswerArr[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; + char key; int optionPosY; int maxLength; int rep; int firstOption, lastOption; - char key; - Hotspot coor[kMaxRect]; + + Hotspot coor[kMaxRect+1]; + + for (int i = 0; i < kMaxRect; ++i) { + coor[i]._rect = Common::Rect(); + coor[i]._enabled = false; + } + Common::String choiceArray[15]; int currChoice, prevChoice; @@ -329,10 +336,7 @@ bool KnowledgeCheck::show() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._rect.left = 45 * g_vm->_res; - coor[j]._rect.right = (maxLength * 3 + 55) * g_vm->_res; - coor[j]._rect.top = 27 + j * 8; - coor[j]._rect.bottom = 34 + j * 8; + coor[j]._rect = Common::Rect(45 * g_vm->_res, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_res, 34 + j * 8); coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { -- cgit v1.2.3 From cdea613e51db56477ab213a3a0e87c3773348d08 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Mar 2012 22:54:50 +0200 Subject: MORTEVIELLE: Remove trailing spaces --- engines/mortevielle/actions.cpp | 18 ++++++------ engines/mortevielle/detection.cpp | 2 +- engines/mortevielle/dialogs.cpp | 4 +-- engines/mortevielle/dialogs.h | 2 +- engines/mortevielle/graphics.cpp | 50 ++++++++++++++++---------------- engines/mortevielle/menu.cpp | 12 ++++---- engines/mortevielle/mortevielle.cpp | 58 ++++++++++++++++++------------------- engines/mortevielle/mortevielle.h | 18 ++++++------ engines/mortevielle/mouse.cpp | 4 +-- engines/mortevielle/outtext.cpp | 4 +-- engines/mortevielle/saveload.cpp | 20 ++++++------- engines/mortevielle/sound.cpp | 2 +- engines/mortevielle/sound.h | 4 +-- engines/mortevielle/speech.cpp | 8 ++--- 14 files changed, 103 insertions(+), 103 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 011728870c..48d73a20fd 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -70,10 +70,10 @@ void MortevielleEngine::fctMove() { _coreVar._currPlace = ATTIC; _menu.setDestinationText(ATTIC); } - + if (_num != 6) _coreVar._currPlace = ROOM26; - + if ((_num > 1) && (_num < 6)) _ment = _num - 1; else if (_num > 7) @@ -116,10 +116,10 @@ void MortevielleEngine::fctMove() { menuChoice = 6; else if (((_coreVar._currPlace == LANDING) || (_coreVar._currPlace == ROOM26)) && (menuChoice == 4)) menuChoice = 6; - + if ((_coreVar._currPlace > MOUNTAIN) && (_coreVar._currPlace != ROOM26)) menuChoice += 10; - + if ((_coreVar._currPlace == CHAPEL) && (menuChoice == 13)) menuChoice = 16; else if (_coreVar._currPlace == MANOR_FRONT) { @@ -710,7 +710,7 @@ void MortevielleEngine::fctPlace() { drawClock(); if (_currBitIndex != 0) showPeoplePresent(_currBitIndex); - else + else displayAloneText(); _menu.displayMenu(); @@ -1109,7 +1109,7 @@ void MortevielleEngine::fctEat() { else h = 1; } - + _jh += h; _crep = 135; prepareRoom(); @@ -1145,7 +1145,7 @@ void MortevielleEngine::fctEnter() { _x = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, _x, 1); aniof(1, 1); - + _x = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; @@ -1166,7 +1166,7 @@ void MortevielleEngine::fctEnter() { _x = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, _x, 1); aniof(1, 1); - + _coreVar._currPlace = _ment; affrep(); resetRoomVariables(_coreVar._currPlace); @@ -1590,7 +1590,7 @@ void MortevielleEngine::endGame() { repon(2, 35); startMusicOrSpeech(0); testKey(false); - // A wait message was displayed. + // A wait message was displayed. // testKey (aka tkey1) was called before and after. // Most likely the double call is useless, thus removed // diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 5997b4c349..994563d497 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -41,7 +41,7 @@ static const PlainGameDescriptor MortevielleGame[] = { class MortevielleMetaEngine : public AdvancedMetaEngine { public: - MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::MortevielleGameDescriptions, sizeof(ADGameDescription), + MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::MortevielleGameDescriptions, sizeof(ADGameDescription), MortevielleGame) { _md5Bytes = 512; _singleid = "mortevielle"; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b90f165b6c..b53a9d5e80 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -418,7 +418,7 @@ void f3f8::draw() { } /** - * Alert function - Loop until F8 is pressed, update + * Alert function - Loop until F8 is pressed, update * Graphical Device if modified * @remarks Originally called 'diver' */ @@ -462,7 +462,7 @@ void f3f8::aff50(bool drawAni50Fl) { ani50(); else g_vm->repon(2, kDialogStringIndex + 142); - + // Draw the f3/f8 dialog draw(); } diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 40109c894b..db13c09b54 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -58,6 +58,6 @@ public: static void aff50(bool drawAni50Fl); static void ani50(); }; - + } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 2b6607513b..e290f60e69 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -31,8 +31,8 @@ namespace Mortevielle { /*-------------------------------------------------------------------------* - * Palette Manager - * + * Palette Manager + * *-------------------------------------------------------------------------*/ /** @@ -71,7 +71,7 @@ void PaletteManager::setDefaultPalette() { /*-------------------------------------------------------------------------* * Image decoding - * + * * The code in this section is responsible for decoding image resources. * Images are broken down into rectangular sections, which can use one * of 18 different encoding methods. @@ -138,7 +138,7 @@ void GfxSurface::decode(const byte *pSrc) { _xSize = READ_BE_UINT16(pSrc + 2) + 1; _ySize = READ_BE_UINT16(pSrc + 4) + 1; majTtxTty(); - + pSrc += 6; pDest = &outputBuffer[0]; @@ -159,7 +159,7 @@ void GfxSurface::decode(const byte *pSrc) { const byte *pSrcSaved = pSrc; bool savedNibbleFlag = _nibbleFlag; int savedLookupIndex = _lookupIndex; - + do { pSrc = pSrcSaved; _nibbleFlag = savedNibbleFlag; @@ -237,7 +237,7 @@ void GfxSurface::decode(const byte *pSrc) { pDest = &outputBuffer[_yp * DEFAULT_WIDTH + _xp]; pSrcStart = pSrc; INCR_TAIX; - + for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { @@ -490,7 +490,7 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku break; continue; } - + bool continueFlag = false; do { for (int xIndex = 0; xIndex < _xSize; ++xIndex) { @@ -599,7 +599,7 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) pDest += _thickness; drawIndex += _thickness; } - + while (_xSize < (drawIndex + _thickness)) { if (--_thickness == 0) return; @@ -622,7 +622,7 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) for (int xCtr = 0; xCtr < _thickness; ++xCtr) *--pDest = csuiv(pSrc, pLookup); } - } + } if ((_ySize % 2) == 0) { pDest += _thickness; drawIndex += _thickness; @@ -743,7 +743,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { NIH(); increments(pDest); } - + NIH(); NIV(); increments(pDest); @@ -780,7 +780,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { NIH(); increments(pDest); } - + NIH(); NIV(); increments(pDest); @@ -791,13 +791,13 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { break; } else { pDest += _xInc; - + if (--drawIndex == 0) { TF2(pSrc, pDest, pLookup, diagIndex); NIH(); break; } - } + } NIH(); } @@ -885,7 +885,7 @@ void ScreenSurface::updateScreen() { // Iterate through copying dirty areas to the screen for (Common::List::iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) { Common::Rect r = *i; - g_system->copyRectToScreen((const byte *)getBasePtr(r.left, r.top), pitch, + g_system->copyRectToScreen((const byte *)getBasePtr(r.left, r.top), pitch, r.left, r.top, r.width(), r.height()); } _dirtyRects.clear(); @@ -896,7 +896,7 @@ void ScreenSurface::updateScreen() { /** * Draws a decoded picture on the screen - * @remarks - Because the ScummVM surface is using a double height 640x400 surface to + * @remarks - Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled. * - Image resources are stored at 320x200, so when drawn onto the screen a single pixel * from the source image is drawn using the two pixels at the given index in the palette map @@ -909,13 +909,13 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { y += surface._offset.y; // Lock the affected area of the surface to write to - Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2, + Graphics::Surface destSurface = lockArea(Common::Rect(x * 2, y * 2, (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping const byte *paletteMap = &g_vm->_mem[0x7000 * 16 + 2]; - // Loop through writing + // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { if (((y + yp) < 0) || ((y + yp) >= 200)) continue; @@ -948,7 +948,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { void ScreenSurface::copyFrom(Graphics::Surface &src, int x, int y) { Graphics::Surface destSurface = lockArea(Common::Rect(x, y, x + src.w, y + src.h)); - // Loop through writing + // Loop through writing for (int yp = 0; yp < src.h; ++yp) { if (((y + yp) < 0) || ((y + yp) >= SCREEN_HEIGHT)) continue; @@ -961,11 +961,11 @@ void ScreenSurface::copyFrom(Graphics::Surface &src, int x, int y) { /** * Draws a character at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex) { - Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, + Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + FONT_WIDTH, (pt.y + FONT_HEIGHT) * 2)); // Get the start of the character to use @@ -988,7 +988,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in /** * Draws a box at the specified position and size - * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { @@ -1011,13 +1011,13 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { /** * Fills an area with the specified colour - * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::fillRect(int colour, const Common::Rect &bounds) { Graphics::Surface destSurface = lockArea(Common::Rect(bounds.left, bounds.top * 2, bounds.right, bounds.bottom * 2)); - + // Fill the area destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), colour); } @@ -1032,7 +1032,7 @@ void ScreenSurface::clearScreen() { /** * Sets a single pixel at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { @@ -1115,7 +1115,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { yr = y; xro = xx; yro = yy; - + if (abs(y - yy) > abs(x - xx)) { a = (float)((x - xx)) / (y - yy); b = (yr * xro - yro * xr) / (y - yy); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d7ece8a7eb..4dcb034f76 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -177,7 +177,7 @@ void Menu::displayMenu() { int pt, x, y, color, msk, num_letr; g_vm->_mouse.hideMouse(); - + g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); col = 28 * g_vm->_res; if (g_vm->_currGraphicalDevice == MODE_CGA) @@ -434,9 +434,9 @@ void Menu::mdn() { return; else g_vm->_prevPos = curPos; - - bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * g_vm->_res) && curPos.x <= (28 * g_vm->_res + 24)) + + bool tes = (curPos.y < 11) + && ((curPos.x >= (28 * g_vm->_res) && curPos.x <= (28 * g_vm->_res + 24)) || (curPos.x >= (76 * g_vm->_res) && curPos.x <= (76 * g_vm->_res + 24)) || ((curPos.x > 124 * g_vm->_res) && (curPos.x < 124 * g_vm->_res + 24)) || ((curPos.x > 172 * g_vm->_res) && (curPos.x < 172 * g_vm->_res + 24)) @@ -481,7 +481,7 @@ void Menu::mdn() { menuDown(_msg3); g_vm->setMouseClick(false); - } else { + } else { // A menu was clicked on _menuSelected = (_multiTitle) && (_msg4 != OPCODE_NONE); menuUp(_msg3); @@ -551,7 +551,7 @@ void Menu::initMenu() { * @remarks Originally called 'mfoudi' */ void Menu::setSearchMenu() { - for (int i = 1; i <= 7; ++i) + for (int i = 1; i <= 7; ++i) disableMenuItem(_moveMenu[i]); for (int i = 1; i <= 11; ++i) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 2c3313ea45..af4db82bae 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -86,7 +86,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _toiletsPresenceBobMax = false; _bathRoomPresenceBobMax = false; _room9PresenceLeo = false; - + _soundOff = false; _largestClearScreen = false; _hiddenHero = false; @@ -144,7 +144,7 @@ bool MortevielleEngine::canSaveGameStateCurrently() { * Load in a savegame at the specified slot number */ Common::Error MortevielleEngine::loadGameState(int slot) { - return _savegameManager.loadGame(slot); + return _savegameManager.loadGame(slot); } /** @@ -153,7 +153,7 @@ Common::Error MortevielleEngine::loadGameState(int slot) { Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &desc) { if (slot == 0) return Common::kWritingFailed; - + return _savegameManager.saveGame(slot, desc); } @@ -296,7 +296,7 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp char ch; while ((ch = (char)f.readByte()) != '\0') s += ch; - + if (dataType == kStaticStrings) _engineStrings.push_back(s); else if (dataType == kGameStrings) @@ -319,7 +319,7 @@ bool MortevielleEngine::keyPressed() { // Check if it's time to draw the next frame if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - + _screenSurface.updateScreen(); } @@ -327,7 +327,7 @@ bool MortevielleEngine::keyPressed() { g_system->delayMillis(5); // Return if there are any pending key presses - return !_keypresses.empty(); + return !_keypresses.empty(); } /** @@ -387,7 +387,7 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { // Handle alphabetic keys if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { - if (evt.kbd.hasFlags(Common::KBD_CTRL)) + if (evt.kbd.hasFlags(Common::KBD_CTRL)) ch = evt.kbd.keycode - Common::KEYCODE_a + 1; else ch = evt.kbd.keycode - Common::KEYCODE_a + 'A'; @@ -560,7 +560,7 @@ void MortevielleEngine::mainGame() { if (_reloadCFIEC) loadCFIEC(); - for (_crep = 1; _crep <= _c_zzz; ++_crep) + for (_crep = 1; _crep <= _c_zzz; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); @@ -719,7 +719,7 @@ void MortevielleEngine::loadPlaces() { for (int i = 0; i < 7; ++i) { for (int j = 0; j < 25; ++j) - _v_lieu[i][j] = f.readByte(); + _v_lieu[i][j] = f.readByte(); } f.close(); @@ -846,7 +846,7 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { } /** - * Engine function - Show the people present in the given room + * Engine function - Show the people present in the given room * @remarks Originally called 'affper' */ void MortevielleEngine::showPeoplePresent(int bitIndex) { @@ -937,8 +937,8 @@ int MortevielleEngine::getPresenceStatsGreenRoom() { int retVal = 0; updateHour(day, hour, minute); - // The original uses an || instead of an &&, resulting - // in an always true condition. Based on the other tests, + // The original uses an || instead of an &&, resulting + // in an always true condition. Based on the other tests, // and on other scenes, we use an && instead. if ((hour > 7) && (hour < 11)) retVal = 25; @@ -978,7 +978,7 @@ int MortevielleEngine::getPresenceStatsPurpleRoom() { retVal = 20; else if ((hour >= 0) && (hour < 8)) retVal = 50; - + return retVal; } @@ -1707,7 +1707,7 @@ void MortevielleEngine::startDialog(int16 rep) { Common::String dialogStr = getString(rep + kDialogStringIndex); _text.displayStr(dialogStr, 230, 4, 65, 24, 5); f3f8::draw(); - + key = 0; do { _speechManager.startSpeech(rep, haut[_caff - 69], 0); @@ -1808,7 +1808,7 @@ void MortevielleEngine::gotoManorBack() { } /** - * Engine function - Dead : Flooded in Well + * Engine function - Dead : Flooded in Well * @remarks Originally called 't1deau' */ void MortevielleEngine::floodedInWell() { @@ -2095,7 +2095,7 @@ void MortevielleEngine::clearScreenType10() { st = getEngineString(S_LOURDE); else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - + co = 580 - (_screenSurface.getStringWidth(st) / 2); _screenSurface.putxy(co, 92); _screenSurface.drawString(st, 4); @@ -2145,7 +2145,7 @@ void MortevielleEngine::decodeNumber(byte *pStart, int count) { *pStart = 0; else if (v & 0xff00) *pStart = 0xff; - else + else *pStart = (byte)v; } } @@ -2312,7 +2312,7 @@ void MortevielleEngine::setPal(int n) { if (n < 89) palette(_cgaPal[n]._p); - + for (int i = 0; i <= 15; ++i) displayCGAPattern(i, _patternArr[pal[i]._id], pal); } @@ -2361,7 +2361,7 @@ void MortevielleEngine::loadPalette() { } } f.close(); - + if (!f.open("cxx.mor")) error("Missing file - cxx.mor"); @@ -2408,16 +2408,16 @@ void MortevielleEngine::loadTexts() { warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); return; } - } + } if (!ntpFile.open("TXX.NTP")) { warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); return; } - + if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { warning("TXX file - Unexpected format - Switching to DAT file"); return; - } + } for (int i = 0; i < inpFile.size() / 2; ++i) _inpBuffer[i] = inpFile.readUint16LE(); @@ -2478,7 +2478,7 @@ void MortevielleEngine::music() { return; _reloadCFIEC = true; - + Common::File fic; if (!fic.open("mort.img")) error("Missing file - mort.img"); @@ -2730,7 +2730,7 @@ void MortevielleEngine::drawClock() { int h, co; _mouse.hideMouse(); - + _screenSurface.drawRectangle(570, 118, 20, 10); _screenSurface.drawRectangle(578, 114, 6, 18); if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) @@ -2740,7 +2740,7 @@ void MortevielleEngine::drawClock() { if (_minute == 0) _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y - rg), co); - else + else _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y + rg), co); h = _hour; @@ -3058,7 +3058,7 @@ int MortevielleEngine::checkLeoMaxRandomPresence() { int retval = getRandomNumber(1, 2); if (retval == 2) retval = 128; - + return retval; } @@ -3230,7 +3230,7 @@ void MortevielleEngine::writetp(Common::String s, int t) { void MortevielleEngine::aniof(int ouf, int num) { if ((_caff == 7) && ((num == 4) || (num == 5))) return; - + if ((_caff == 10) && (num == 7)) num = 6; else if (_caff == 12) { @@ -3280,7 +3280,7 @@ void MortevielleEngine::dessin() { else if ((_caff == 24) && (_coreVar._wellObjectId != 0)) aniof(1, 1); } - + if (_caff < ROOM26) startMusicOrSpeech(1); } @@ -3311,7 +3311,7 @@ void MortevielleEngine::testKey(bool d) { _mouse.getMousePosition(x, y, c); keyPressed(); } while (c != 0); - + // Event loop do { if (d) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 98d4b042bb..68ea2277e9 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -61,7 +61,7 @@ namespace Mortevielle { #define chr(v) ((unsigned char) v) #define lo(v) ((v) & 0xff) #define hi(v) (((v) >> 8) & 0xff) -#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) +#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) #define odd(v) (((v) % 2) == 1) // Debug channels @@ -79,12 +79,12 @@ enum { // Static string list enum { - S_YES_NO = 0, S_GO_TO = 1, S_SOMEONE_ENTERS = 2, S_COOL = 3, S_LOURDE = 4, + S_YES_NO = 0, S_GO_TO = 1, S_SOMEONE_ENTERS = 2, S_COOL = 3, S_LOURDE = 4, S_MALSAINE = 5, S_IDEM = 6, S_YOU = 7, S_ARE = 8, S_ALONE = 9, S_HEAR_NOISE = 10, S_SHOULD_HAVE_NOTICED = 11, S_NUMBER_OF_HINTS = 12, - S_WANT_TO_WAKE_UP = 13, S_OK = 14, S_SAVE_LOAD = 15, S_RESTART = 18, S_F3 = 19, - S_F8 = 20, S_HIDE_SELF = 21, S_TAKE = 22, S_PROBE = 23, S_RAISE = 24, S_SUITE = 25, - S_STOP = 26, S_USE_DEP_MENU = 27, S_LIFT = 28, S_READ = 29, + S_WANT_TO_WAKE_UP = 13, S_OK = 14, S_SAVE_LOAD = 15, S_RESTART = 18, S_F3 = 19, + S_F8 = 20, S_HIDE_SELF = 21, S_TAKE = 22, S_PROBE = 23, S_RAISE = 24, S_SUITE = 25, + S_STOP = 26, S_USE_DEP_MENU = 27, S_LIFT = 28, S_READ = 29, S_LOOK = 30, S_SEARCH = 31, S_OPEN = 32, S_PUT = 33, S_TURN = 34, S_TIE = 35, S_CLOSE = 36, S_HIT = 37, S_POSE = 38, S_SMASH = 39, @@ -133,7 +133,7 @@ const int kSecretPassageQuestionStringIndex = 510; // Unusued? const int kMaxPatt = 20; const int OPCODE_NONE = 0; -enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, +enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, @@ -141,7 +141,7 @@ enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLOOK = 0x405}; static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; @@ -155,8 +155,8 @@ static const int _actionMenu[12] = { OPCODE_NONE, enum places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, - DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, - LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, + DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, + LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, DOOR = 25, ROOM26 = 26, ROOM27 = 27 }; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index f914860820..8516643835 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -40,7 +40,7 @@ namespace Mortevielle { void MouseHandler::initMouse() { _counter = 0; _pos = Common::Point(0, 0); - + g_vm->setMouseClick(false); } @@ -108,7 +108,7 @@ void MouseHandler::hideMouse() { case MODE_HERCULES: j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (int i = 0; i <= 5; ++i) { - for (int k = 0; k <= 3; ++k) + for (int k = 0; k <= 3; ++k) WRITE_LE_UINT16(&g_vm->_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index f53a7b2804..eb79963191 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -58,7 +58,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int int i, j; // Safeguard: add $ just in case - inputStr += '$'; + inputStr += '$'; g_vm->_screenSurface.putxy(x, y); if (g_vm->_res == 1) @@ -151,7 +151,7 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt } f.close(); - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) + for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) g_vm->_mem[0x7000 * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 4c5e6252d5..8ce97fbac0 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -110,7 +110,7 @@ void SavegameManager::loadSavegame(int n) { g_vm->_tabdon[i + kAcha] = _tabdonSaveBuffer[i]; // Close the stream - delete stream; + delete stream; } /** @@ -120,7 +120,7 @@ Common::Error SavegameManager::loadGame(int n) { g_vm->_mouse.hideMouse(); g_vm->displayEmptyHand(); loadSavegame(n); - + /* Initialization */ g_vm->charToHour(); g_vm->initGame(); @@ -138,13 +138,13 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { g_vm->_mouse.hideMouse(); g_vm->hourToChar(); - + for (i = 0; i <= 389; ++i) _tabdonSaveBuffer[i] = g_vm->_tabdon[i + kAcha]; g_vm->_saveStruct = g_vm->_coreVar; if (g_vm->_saveStruct._currPlace == ROOM26) g_vm->_saveStruct._currPlace = LANDING; - + Common::String filename = generateSaveName(n); f = g_system->getSavefileManager()->openForSaving(filename); @@ -162,7 +162,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { // Close the save file f->finalize(); delete f; - + // Skipped: dialog asking to swap floppy g_vm->_mouse.showMouse(); @@ -252,18 +252,18 @@ SaveStateList SavegameManager::listSaves(const char *target) { // ScummVm savegame. Read in the header to get the savegame name SavegameHeader header; validFlag = readSavegameHeader(in, header); - + if (validFlag) { delete header.thumbnail; saveDescription = header.saveName; } } else if (file->size() == 497) { // Form an appropriate savegame name - saveDescription = (slotNumber == 0) ? "Initial game state" : + saveDescription = (slotNumber == 0) ? "Initial game state" : Common::String::format("Savegame #%d", slotNumber); validFlag = true; } - + if (validFlag) // Got a valid savegame saveList.push_back(SaveStateDescriptor(slotNumber, saveDescription)); @@ -278,7 +278,7 @@ SaveStateList SavegameManager::listSaves(const char *target) { SaveStateDescriptor SavegameManager::querySaveMetaInfos(int slot) { Common::String fileName = Mortevielle::SavegameManager::generateSaveName(slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); - + if (f) { // Check to see if it's a ScummVM savegame or not char buffer[4]; @@ -311,7 +311,7 @@ SaveStateDescriptor SavegameManager::querySaveMetaInfos(int slot) { return desc; } } - + return SaveStateDescriptor(); } diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 5f634c595c..9f0738c6c8 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -178,7 +178,7 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::musyc(tablint &tb, int nbseg, int att) { #ifdef DEBUG const byte *pSrc = &mem[0x5000 * 16]; - + // Convert the countdown amount to a tempo rate, and then to note length in microseconds int tempo = TIMER_FREQUENCY / att; int length = 1000000 / tempo; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 5c70bc8d0f..c469706305 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -48,7 +48,7 @@ struct SpeakerNote { length = noteLength; } }; - + /** * This is a modified PC Speaker class that allows the queueing of an entire song * sequence one note at a time. @@ -103,7 +103,7 @@ public: void decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg); void litph(tablint &t, int typ, int tempo); - void musyc(tablint &tb, int nbseg, int att); + void musyc(tablint &tb, int nbseg, int att); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index c374d20a6d..08f773cca1 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -151,7 +151,7 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - + f.read(&g_vm->_mem[0x7414 * 16 + 0], 273); g_vm->_soundManager.decodeMusic(&g_vm->_mem[0x7414 * 16], &g_vm->_mem[kAdrNoise * 16], 273); @@ -348,7 +348,7 @@ void SpeechManager::trait_car() { } break; case 0: - case 1: + case 1: veracf(_queue[1]._acc); switch (_queue[2]._code) { case 2: @@ -436,7 +436,7 @@ void SpeechManager::trait_car() { entroct(d2); entroct(_queue[1]._val); } - + break; case 4: veracf(_queue[1]._acc); @@ -483,7 +483,7 @@ void SpeechManager::trait_car() { entroct(d2); entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); } - + break; default: break; -- cgit v1.2.3 From 76bf72ce695ebaf465025cdbd2a5f4e37dfce681 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 28 Mar 2012 07:59:22 +0200 Subject: MORTEVIELLE: Fix invert in Dep menu. Still a bit short due to Inventory width too small. Also add some ingame same/load slots --- engines/mortevielle/menu.cpp | 8 +++----- engines/mortevielle/mortevielle.cpp | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 4dcb034f76..4616d1387c 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -43,8 +43,8 @@ const byte _menuConstants[8][4] = { {43, 25, 11, 5}, {55, 37, 5, 8}, {64, 13, 11, 2}, - {62, 22, 13, 4}, - {62, 25, 13, 5} + {62, 42, 13, 9}, + {62, 46, 13, 10} }; /** @@ -56,7 +56,7 @@ void Menu::setText(int menuId, Common::String name) { byte l = lo(menuId); Common::String s = name; - while (s.size() < 30) + while (s.size() < 20) s += ' '; switch (h) { @@ -313,8 +313,6 @@ void Menu::menuDown(int ii) { int cx, xcc, xco; int lignNumb; - /* debug('menuDown'); */ - // Make a copy of the current screen surface for later restore g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index af4db82bae..ed9441c5ab 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -636,11 +636,11 @@ void MortevielleEngine::handleAction() { return; } if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) { - Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 7); - _savegameManager.saveGame(_msg[4] & 7, saveName); + Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 15); + _savegameManager.saveGame(_msg[4] & 15, saveName); } if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) - _savegameManager.loadGame((_msg[4] & 7) - 1); + _savegameManager.loadGame((_msg[4] & 15) - 1); if (inkey == '\103') { /* F9 */ temps = Alert::show(_hintPctMessage, 1); return; -- cgit v1.2.3 From 64ef9378a2bd4e9490843695db0da8a7a4bb869c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 28 Mar 2012 08:05:12 +0200 Subject: MORTEVIELLE: Enlarge Inventory menu display to match Depl menu. --- engines/mortevielle/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 4616d1387c..a9fea17fcb 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -37,7 +37,7 @@ namespace Mortevielle { const byte _menuConstants[8][4] = { - { 7, 37, 22, 8}, + { 7, 37, 23, 8}, {19, 33, 23, 7}, {31, 89, 10, 21}, {43, 25, 11, 5}, @@ -56,7 +56,7 @@ void Menu::setText(int menuId, Common::String name) { byte l = lo(menuId); Common::String s = name; - while (s.size() < 20) + while (s.size() < 22) s += ' '; switch (h) { -- cgit v1.2.3 From 16194412155e82b64736eb46cd37e702463e1416 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 28 Mar 2012 20:39:42 +0200 Subject: MORTEVIELLE: Remove var_mor --- engines/mortevielle/actions.cpp | 1 - engines/mortevielle/dialogs.cpp | 4 ++-- engines/mortevielle/dialogs.h | 8 ++++++- engines/mortevielle/graphics.cpp | 1 - engines/mortevielle/menu.cpp | 1 - engines/mortevielle/module.mk | 3 +-- engines/mortevielle/mortevielle.cpp | 1 - engines/mortevielle/mouse.cpp | 1 - engines/mortevielle/mouse.h | 2 +- engines/mortevielle/outtext.cpp | 1 - engines/mortevielle/outtext.h | 1 - engines/mortevielle/saveload.cpp | 1 - engines/mortevielle/sound.h | 3 ++- engines/mortevielle/speech.cpp | 1 - engines/mortevielle/speech.h | 2 +- engines/mortevielle/var_mor.cpp | 44 ----------------------------------- engines/mortevielle/var_mor.h | 46 ------------------------------------- 17 files changed, 14 insertions(+), 107 deletions(-) delete mode 100644 engines/mortevielle/var_mor.cpp delete mode 100644 engines/mortevielle/var_mor.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 48d73a20fd..2f39b61bad 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -32,7 +32,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/speech.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b53a9d5e80..1947705fe5 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -290,9 +290,9 @@ bool KnowledgeCheck::show() { int rep; int firstOption, lastOption; - Hotspot coor[kMaxRect+1]; + Hotspot coor[kMaxHotspots+1]; - for (int i = 0; i < kMaxRect; ++i) { + for (int i = 0; i <= kMaxHotspots; ++i) { coor[i]._rect = Common::Rect(); coor[i]._enabled = false; } diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index db13c09b54..1ed87456a9 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -28,12 +28,18 @@ #ifndef MORTEVIELLE_ALERT_H #define MORTEVIELLE_ALERT_H +#include "common/rect.h" #include "common/str.h" namespace Mortevielle { static const int NUM_LINES = 7; -const int kMaxRect = 14; +const int kMaxHotspots = 14; + +struct Hotspot { + Common::Rect _rect; + bool _enabled; +}; class Alert { private: diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e290f60e69..a49bda7b73 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -26,7 +26,6 @@ #include "mortevielle/graphics.h" #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a9fea17fcb..1cfafb8ff1 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -32,7 +32,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 8cad2b8ad0..38e6e0508d 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -11,8 +11,7 @@ MODULE_OBJS := \ outtext.o \ saveload.o \ sound.o \ - speech.o \ - var_mor.o + speech.o # This module can be built as a plugin ifeq ($(ENABLE_MORTEVIELLE), DYNAMIC_PLUGIN) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index ed9441c5ab..94821bf7cd 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -35,7 +35,6 @@ #include "mortevielle/outtext.h" #include "mortevielle/saveload.h" #include "mortevielle/outtext.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 8516643835..b46b1d6598 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -29,7 +29,6 @@ #include "common/rect.h" #include "mortevielle/mouse.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index b93ce6136d..0e235ad894 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -28,7 +28,7 @@ #ifndef MORTEVIELLE_MOUSE_H #define MORTEVIELLE_MOUSE_H -#include "mortevielle/var_mor.h" +#include "common/rect.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index eb79963191..75d9bde9ff 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -31,7 +31,6 @@ #include "mortevielle/outtext.h" #include "mortevielle/graphics.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 3664fd6fa5..cc7bb1fb4a 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -29,7 +29,6 @@ #define MORTEVIELLE_OUTTEXT_H #include "common/str.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 8ce97fbac0..af00de265e 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -31,7 +31,6 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index c469706305..9ad46e84d3 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -32,10 +32,11 @@ #include "audio/mixer.h" #include "common/mutex.h" #include "common/queue.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { +typedef int tablint[256]; + /** * Structure used to store pending notes to play */ diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 08f773cca1..09b0af730e 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -30,7 +30,6 @@ #include "mortevielle/speech.h" #include "mortevielle/sound.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" namespace Mortevielle { diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 6521fd9927..f9af192089 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -29,7 +29,7 @@ #define MORTEVIELLE_PAROLE_H #include "common/scummsys.h" -#include "mortevielle/var_mor.h" +#include "mortevielle/sound.h" namespace Mortevielle { diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp deleted file mode 100644 index a451cb651f..0000000000 --- a/engines/mortevielle/var_mor.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#include "common/debug.h" -#include "common/str.h" -#include "common/textconsole.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/var_mor.h" - -namespace Mortevielle { - -/*---------------------------------------------------------------------------*/ -/*-------------------- PROCEDURES AND FONCTIONS -----------------------*/ -/*---------------------------------------------------------------------------*/ - -void musyc(tablint &tb, int nbseg, int att) { - warning("TODO: musyc"); -} - -} // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h deleted file mode 100644 index bddf85cd90..0000000000 --- a/engines/mortevielle/var_mor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_VAR_H -#define MORTEVIELLE_VAR_H - -#include "common/rect.h" -#include "common/str.h" - -namespace Mortevielle { - -struct Hotspot { - Common::Rect _rect; - bool _enabled; -}; - -typedef int tablint[256]; -typedef int tfxx[108]; - -} // End of namespace Mortevielle - -#endif -- cgit v1.2.3 From f91e909afa4e3e839f29d2ba643ecd69da88c817 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 11:39:04 +0200 Subject: MORTEVIELLE: Start adding German DOS version --- engines/mortevielle/mortevielle.cpp | 37 +++++++++++++++++++++++++++++-------- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/outtext.cpp | 6 +++++- engines/mortevielle/speech.h | 2 +- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 94821bf7cd..5be59d5ec5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -214,6 +214,8 @@ Common::ErrorCode MortevielleEngine::initialise() { _currGraphicalDevice = _newGraphicalDevice; hirs(); + free(_cfiecBuffer); + free(_speechManager._cfiphBuffer); return Common::kNoError; } @@ -714,7 +716,8 @@ void MortevielleEngine::loadPlaces() { Common::File f; if (!f.open("MXX.mor")) - error("Missing file - MXX.mor"); + if (!f.open("MFXX.mor")) + error("Missing file - MXX.mor"); for (int i = 0; i < 7; ++i) { for (int j = 0; j < 25; ++j) @@ -2345,8 +2348,13 @@ void MortevielleEngine::loadPalette() { Common::File f; byte b; - if (!f.open("fxx.mor")) - error("Missing file - fxx.mor"); + if (!f.open("fxx.mor")) { + if (f.open("mfxx.mor")) + f.seek(7 * 25); + else + error("Missing file - fxx.mor"); + } + for (int i = 0; i < 108; ++i) _fxxBuffer[i] = f.readSint16LE(); f.close(); @@ -2446,10 +2454,19 @@ void MortevielleEngine::loadBRUIT5() { void MortevielleEngine::loadCFIEC() { Common::File f; - if (!f.open("cfiec.mor")) - error("Missing file - cfiec.mor"); + if (!f.open("cfiec.mor")) { + if (!f.open("alcfiec.mor")) + error("Missing file - *cfiec.mor"); + } + + int size = ((f.size() / 128) + 1) * 128; + + if (!_reloadCFIEC) + _cfiecBuffer = (byte *)malloc(sizeof(byte) * size); + + for (int i = 0; i < size; ++i) + _cfiecBuffer[i] = f.readByte(); - f.read(&_cfiecBuffer[0], 822 * 128); f.close(); _reloadCFIEC = false; @@ -2459,8 +2476,12 @@ void MortevielleEngine::loadCFIEC() { void MortevielleEngine::loadCFIPH() { Common::File f; - if (!f.open("cfiph.mor")) - error("Missing file - cfiph.mor"); + if (!f.open("cfiph.mor")) { + if (!f.open("alcfiph.mor")) + error("Missing file - *cfiph.mor"); + } + + _speechManager._cfiphBuffer = (int16 *)malloc(sizeof(int16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) _speechManager._cfiphBuffer[i] = f.readSint16LE(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 68ea2277e9..e22732600f 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -272,7 +272,7 @@ private: Common::String _hintPctMessage; - byte _cfiecBuffer[822 * 128]; + byte *_cfiecBuffer; byte _touv[8]; int _nbrep[9]; int _nbrepm[9]; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 75d9bde9ff..e44dc989c6 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -296,7 +296,11 @@ void TextHandler::taffich() { filename = "DXX.mor"; } else { - filename = "DZZ.mor"; + if (g_vm->getLanguage() == Common::DE_DEU) + filename = "DZZALL"; + else + filename = "DZZ.mor"; + handle = g_vm->_fxxBuffer[87]; if (a == 51) { lgt = handle; diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index f9af192089..42be466a57 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -73,7 +73,7 @@ private: int _ptr_oct; public: - int _cfiphBuffer[6401]; + int16 *_cfiphBuffer; int _tbi[256]; int _mlec; -- cgit v1.2.3 From d8b8f93c4c51ac0ea8dbc105e3dad17c36866e18 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 12:40:49 +0200 Subject: MORTEVIELLE: Start updating tools to add support to German DOS version --- devtools/create_mortdat/create_mortdat.cpp | 31 +- devtools/create_mortdat/enginetext.h | 53 +++ devtools/create_mortdat/gametext.h | 602 ++++++++++++++++++++++++++++- devtools/extract_mort/extract_mort.cpp | 15 +- dists/engine-data/mort.dat | Bin 51315 -> 79412 bytes engines/mortevielle/mortevielle.cpp | 17 +- 6 files changed, 697 insertions(+), 21 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 4c1dd14fdb..6fe115d5c4 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -57,25 +57,32 @@ void openOutputFile(const char *outFilename) { * Write out the data for the font */ void writeFontBlock() { + const int knownAddr[2] = {0x36b0, 0x36c0}; byte checkBuffer[7]; byte fontBuffer[121 * 6]; // Move to just prior the font data and verify that we're reading the known mort.com - mortCom.seek(0x36b0); - mortCom.read(checkBuffer, 7); - - if ((checkBuffer[0] != 0x59) || (checkBuffer[1] != 0x5B) || (checkBuffer[2] != 0x58) || - (checkBuffer[3] != 0xC3) || (checkBuffer[4] != 0xE8) || (checkBuffer[5] != 0xD6) || - (checkBuffer[6] != 0x02)) { - printf("Invalid mort.com input file"); - exit(0); + for (int i = 0; i <= 2; ++i) { + if ( i == 2) { + printf("Invalid mort.com input file"); + exit(0); + } + + mortCom.seek(knownAddr[i]); + mortCom.read(checkBuffer, 7); + + if ((checkBuffer[0] == 0x59) && (checkBuffer[1] == 0x5B) && (checkBuffer[2] == 0x58) || + (checkBuffer[3] == 0xC3) && (checkBuffer[4] == 0xE8) && (checkBuffer[5] == 0xD6) || + (checkBuffer[6] == 0x02)) { + break; + } } // Read in the data mortCom.read(fontBuffer, 121 * 6); // Write out a section header to the output file and the font data - char fontHeader[4] = { 'F', 'O', 'N', 'T' }; + const char fontHeader[4] = { 'F', 'O', 'N', 'T' }; outputFile.write(fontHeader, 4); // Section Id outputFile.writeWord(121 * 6); // Section size @@ -84,8 +91,8 @@ void writeFontBlock() { void writeStaticStrings(const char **strings, DataType dataType, int languageId) { // Write out a section header - char sStaticStrings[4] = { 'S', 'S', 'T', 'R' }; - char sGameStrings[4] = { 'G', 'S', 'T', 'R' }; + const char sStaticStrings[4] = { 'S', 'S', 'T', 'R' }; + const char sGameStrings[4] = { 'G', 'S', 'T', 'R' }; if (dataType == kStaticStrings) outputFile.write(sStaticStrings, 4); @@ -119,6 +126,7 @@ void writeStaticStrings(const char **strings, DataType dataType, int languageId) void writeEngineStrings() { writeStaticStrings(engineDataEn, kStaticStrings, 1); writeStaticStrings(engineDataFr, kStaticStrings, 0); + writeStaticStrings(engineDataDe, kStaticStrings, 2); } /** @@ -127,6 +135,7 @@ void writeEngineStrings() { void writeGameStrings() { writeStaticStrings(gameDataEn, kGameStrings, 1); writeStaticStrings(gameDataFr, kGameStrings, 0); + writeStaticStrings(gameDataDe, kGameStrings, 2); } void process() { diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index d9b3b05e2b..68db310a6b 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -133,4 +133,57 @@ const char *engineDataFr[] = { NULL }; +const char *engineDataDe[] = { + "[2][ ][JA][NEIN]", + "Go to", + "Someone enters, looks surised, but says nothing", + "Cool", + "Schwer", + "Ungesund", + "Idem", + "You", + "are", + "Alone", + + "Verdammt! Sie hoeren ein Geraeush...", + "Sie haetten ", + "% der Hinweise| bemerken muessen...", + "Do you want to wake up?", + "OK", + "", + " schreiben", + + " lesen", + " Restart ", + "F3 nochmals", + "F8: stop", + "Hide self", + "take", + " probe ", + " raise ", + " -WEITER- ", + " -STOP- ", + "[1][ Benutzen Sie jetzt das Menue DEP...][OK]", + "lift", + "read", + + "look", + "search", + "open", + "put", + "turn", + "tie", + "close", + "hit", + "pose", + "smash", + + "smell", + "scratch", + "probe", + "[1][ Benutzen Sie jetzt das Menue DEP...][OK]", + "& tag", + NULL +}; + #endif diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index b9ef039c74..0e0948e95f 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -609,7 +609,7 @@ const char *gameDataEn[] = { "[1][ | Disk error | All stop... ][ok]$", "[1][ | You should have noticed |00% of the clues ][ok]$", "[3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][|Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", "TBT - MASTER .$", "TBT - rorL$", NULL @@ -1193,14 +1193,602 @@ const char *gameDataFr[] = { "L‚o$", "Max$", "Murielle partageait une occupation avec une autre personne . Qui ?$", - "[1][|Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", - "[1][|Ins‚rez la disquette 1 dans le lecteur A][ok]$", - "[1][|! ERREUR DISQUETTE !|On arrete tout][ok]$", - "[1][|Vous devriez avoir remarqu‚|00% des indices][ok]$", - "[1][|Ins‚rez la disquette 2 dans le lecteur A][ok]$", - "[1][|Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "[1][ |Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", + "[1][ |Ins‚rez la disquette 1 dans le lecteur A][ok]$", + "[1][ |! ERREUR DISQUETTE !|On arrete tout][ok]$", + "[1][ |Vous devriez avoir remarqu‚|00% des indices][ok]$", + "[1][ |Ins‚rez la disquette 2 dans le lecteur A][ok]$", + "[1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", " MASTER .$", " rorL$", }; +const char *gameDataDe[] = { + "TBT - Calm within the storm$", + "TBT - Discussed in colours$", + "TBT - Your mauve!$", + "TBT - Be kind enough to leave the room...$", + "TBT - If you're NOT overdrawn...$", + "TBT - If you're feeling blue...$", + "TBT - Read what's on the walls?$", + "TBT - Water sports$", + "TBT - Room for envy?$", + "TBT - A glance at the forbidden$", + "TBT - Smell of a woodfire and tobacco$", + "TBT - Tobacco and old books$", + "TBT - Onions, cinnamon and spirits$", + "TBT - A place seldom visited$", + "TBT - Humidity and decay$", + "TBT - Sorry, no ""door to door""$", + "TBT - Rotting corpse: deady cryptomania$", + "TBT - And what's more, there are disused traps$", + "TBT - It's already open$", + "TBT - Danger: avalanches$", + "TBT - Proper Charlie's place?$", + "TBT - An imposing building$", + "TBT - The other side of the mystery$", + "TBT - Strange horoscope$", + "TBT - Look out... but she wishes well?$", + "TBT - An oak door$", + "TBT - A photograph$", + "TBT - The coat of arms$", + "TBT - $", + "TBT - Max, the servant, welcomes you and shows you to your room$", + "TBT - Mortville 6/2/51@ My dear Jerome@Regarding my telegram, I must tell you the reason for my wor-@ries. A year ago, Murielle, my lady companion, disappeared. The de@part may have had something to do@with the financial success of themanor, or... A silence hard to un@derstand for my son Guy. Not ha@ving been able to see the light of day over this affair, I count @on you to sort things out. If my state of health doesn't improve, @take the decisions that you feel @are apropriate.@ Kind regards, Julia DEFRANCK$", + "TBT - Later, Guy will inform you of Leo's suicide after a@heavy bet at the races$", + "TBT - F3: AGAIN F8: STOP$", + "TBT - The master of the premises$", + "TBT - The future heir$", + "TBT - JULIA's son$", + "TBT - A pretty picture$", + "TBT - Superman!$", + "TBT - Ida's husband$", + "TBT - Interesting remarks?$", + "TBT - Service included!$", + "TBT - Nothing underneath$", + "TBT - You could hear a pin drop$", + "TBT - Half an hour passes: nothing! Wait any longer?$", + "TBT - Admire! Contemplate!$", + "TBT - No! Nothing!$", + "TBT - Impossible$", + "TBT - That stains!$", + "TBT - A treatise on the history of the area$", + "TBT - A few coins...$", + "TBT - First commandment...$", + "TBT - Pleasing to the nostrils!$", + "TBT - Spades, Hearts...$", + "TBT - Just a spoonful of sugar...$", + "TBT - A romantic novel$", + "TBT - Worth more than a penny, (whistle)$", + "TBT - Just needs a little patience$", + "TBT - Watch the sharp bends$", + "TBT - Deep and dark$", + "TBT - Normal sensations$", + "TBT - Sniff!$", + "TBT - Not discreet! Be content to watch!$", + "TBT - Bless you! Dusty!$", + "TBT - The canvas is signed, the wallpaper is not!$", + "TBT - Nothing, Unlucky!$", + "TBT - Be more discreet!$", + "TBT - The shutters are closed$", + "TBT - Snow! And more snow!$", + "TBT - Brilliant! The work of a master!$", + "TBT - No doubt at all! A genuine fake!$", + "TBT - Hmm! A cheap reproduction!$", + "TBT - A rare and valuable piece$", + "TBT - Nothing special$", + "TBT - Linen, personal belongings...$", + "TBT - Not just anywhere!$", + "TBT - It's not time!$", + "TBT - One doesn't speak with ones mouth full!$", + "TBT - Someone comes in, messes about then goes out again$", + "TBT - Someone's approaching your hiding-place$", + "TBT - Someone surprises you!$", + "TBT - Impossible! You're too loaded!$", + "TBT - Try again!$", + "TBT - Still puzzled!?$", + "TBT - You leave Mortville.In Paris a message awaits you...$", + "TBT - You hurt yourself$", + "TBT - Nothing more here$", + "TBT - The sound seems normal$", + "TBT - It doesn't move$", + "TBT - You are answered$", + "TBT - Not the right moment!$", + "TBT - The same matter, from another angle!$", + "TBT - The reflection is tarnished, but the frame is gold!$", + "TBT - Bric-a-brac$", + "TBT - Face to face with failure!$", + "TBT - Smells like something you'd rather not see!$", + "TBT - Cleaning products$", + "TBT - Got an itch?$", + "TBT - It's stuck, frozen. Brrr!$", + "TBT - All the locks are jammed!$", + "TBT - Papers$", + "TBT - No! Father christmas hasn't got himself stuck!$", + "TBT - It leads onto a corridor$", + "TBT - China, silverware...$", + "TBT - No! It's not Julia's remains!$", + "TBT - An old engraving$", + "TBT - You find a deep diamond-shaped opening$", + "TBT - The wall slides open! A passage! Do you follow it?$", + "TBT - The passageway closes$", + "TBT - A secret drawer: a notebook! Do you read it?$", + "TBT - The drawer shuts$", + "TBT - Nothing! Flesh and blood stuck to the stone$", + "TBT - Certain details lead you to believe death was not immediate!$", + "TBT - A rotten affair!$", + "TBT - Did she cling to dear life with just one finger?$", + "TBT - Has the treasure packed its trunk?$", + "TBT - A slot the size of a coin$", + "TBT - Part of the stone wall pivots.A crypt! Do you enter?$", + "TBT - The ring turns, the wall closes$", + "TBT - A stone column behind the altar$", + "TBT - There is a noise!$", + "TBT - Occupied!$", + "TBT - Take another chance?$", + "TBT - Too deep!$", + "TBT - The cellar wall pivots$", + "TBT - Nothing$", + "TBT - The one and only!$", + "TBT - The object slides to the bottom$", + "TBT - You have nothing in hand$", + "TBT - It is not open$", + "TBT - There is already something$", + "TBT - The door is locked$", + "TBT - No reply$", + "TBT - A solid wooden ball$", + "TBT - There's no more space$", + "TBT - A wooden ball pierced through the side$", + "TBT - ? ?$", + "TBT - Your move$", + "TBT - OK !$", + "TBT - Suddenly Max arrives with your suitcase: \"Thank you for your @visit!\".Mister discreet \"private eye\" (in need of a private optici@an!). Thoroughly demoralised, you@leave the manor. You are useless!$", + "TBT - Leo interrupts: \"The storm has died down,I am going into town in@1 hour. Get ready\". You have lost@time...but not your life$", + "TBT - Congestion, the deadly flu... You@are stuck here! Your whole case@sinks slowly beneath the water$", + "TBT - The water is rising fast,freezing your last illusions. Before you@have time to react...you are dead$", + "TBT - As soon as you reach the bottom of the well, a hand cuts the rope@Farewell sweet life!$", + "TBT - The storm covers your footprints.A wall of silence falls heavily@on your shoulders. Slowly you succumb to frosbite...$", + "TBT - You're not completely alone! A cold blade plunges into your backup@In future, be more care!$", + "TBT - You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case,the family problems thatyou have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", + "TBT - $", + "TBT - You don't have the keys to the manor. Your cries rest unheard@You're going to catch... your death!$", + "TBT - With a circular movement, the sword slices across you. Guts and@intestines spill out all over. A sorry state of affairs!$", + "TBT - Home, Sweet home !$", + "TBT - The mystery behind a closed door$", + "TBT - Bewitching charm of these old rooms$", + "TBT - An empty stomach$", + "TBT - Closer to heaven? Not so sure$", + "TBT - Afraid of the dark?$", + "TBT - Old rugs and a glint of gold$", + "TBT - Anguish!$", + "TBT - Safe? Perhaps not!$", + "TBT - A little ill at ease, eh!?$", + "TBT - Always further$", + "TBT - Your way of the cross!$", + "TBT - On the trail of...$", + "TBT - Watch what's hiding$", + "TBT - The road down to hell$", + "TBT - Feeling well? You look a little pale$", + "TBT - What lurks behind...?$", + "TBT - Close-up on:$", + "TBT - You notice, amongst other things$", + "TBT - And...$", + "TBT - That's all!$", + "TBT - A bit of reading$", + "TBT - The adventure awaits, you set off!$", + "TBT - Don't mess up YOUR next ADVENTURE!$", + "TBT - I don't understand$", + "TBT - There is an easier way$", + "TBT - No, not just now$", + "TBT - Too late$", + "TBT - $", + "TBT - Like a deep stony stare, a solitary eye that points towards the@stars; the artery that links hea-ven and hell. You must fathom@these depths keeping hold of that@which is, and will become. Monday, Tuesday, Wednesday, Sunday, from@Monday 1st to Sunday 1st,plunging from one day to the next your@\"IS\" or \"WILL BECOME\". Carrying your burden with love and light,@the smallest oversight will seal your fate.$", + "TBT - 10/1/51: We think we've solved the mystery of the manuscript and@located the crypt. Is it the idea@of success in what seems like a dream that disturbs me so? I feel@I have committed myself rather too much, as far as Leo is concer@ned... No! I should go on. @I should have put Guy in the pic-ture but for a week now, I've had@no news of him$", + "TBT - Take your prayers as you would to the holy place. From the pillar@of wisdom, bring the sun to his@knees. Thus will it show you the place to offer alms of another@kind and like young Arthur, open the way of darkness.White is your@colour, golden your hearth. So@advance with caution Orpheus and light your way unto the sad@virgin. Offer her the circle of the man with three faces. That he@may regain the world and turn with it to its original@inglory!$", + "TBT - The mountains are the fangs in a monstrous mouth opening on the@finity of a celestial orgy, grin-ding the stars as we grind our@teeth into dust. You will drop your chord of stone at your feet.@The laugh of silence at the@highest pitch, and in your right hand, the measure of genius. Thus@will you pass between the two crescents beyond the abyss of the@wall of silence. The key to the melody is within your grasp. It@suffices to find the note that clashes.$", + "TBT - 9/12 INTER. 518 3/13 EXPENS. 23@ 9/12 SALES 1203 7/12 CHEQUE 1598@ TOTAL 1721 TOTAL 1721$", + "TBT - 5/1/51@@ Luc, my love@ Guy knows about us. After an argument I told him everything! I@think only of you. Max keeps pes-tering me, but it's finished with @him. He should stick to his pots and pans! When can you and I be alone together? For you I would@get a divorce.@I love you.@ Eva$", + "TBT - Mortville, 10/2/51@@ Pat@ I recall you owe me 50000 frs that I lent you for your business@I need that money, can you repay me quickly?@ Guy$", + "TBT - Mortville, 15/2/51@ Dear Sir@ I am writing to you on the sub-ject of our business deal. I have@decided to go all the way in the certainty that my partner, Pat@DEFRANCK, has been forging the accounts. @In spite of$", + "TBT - A pipe$", + "TBT - A pen$", + "TBT - A lighter$", + "TBT - A retort$", + "TBT - A shaving brush$", + "TBT - A tin of paint$", + "TBT - A flute$", + "TBT - An expensive ring$", + "TBT - A reel of thread$", + "TBT - An old book$", + "TBT - A wallet$", + "TBT - A dagger$", + "TBT - A pistol$", + "TBT - A bible$", + "TBT - A candle$", + "TBT - A jewellery box$", + "TBT - An iron$", + "TBT - A photo$", + "TBT - A pocket watch$", + "TBT - A rope$", + "TBT - Keys$", + "TBT - A pearl necklace$", + "TBT - A bottle of perfume$", + "TBT - Binoculars$", + "TBT - Glasses$", + "TBT - A leather purse$", + "TBT - A tennis ball$", + "TBT - Ammunition$", + "TBT - A cut-throat razor$", + "TBT - A hairbrush$", + "TBT - A clothes brush$", + "TBT - A pack of cards$", + "TBT - A shoe horn$", + "TBT - A screwdriver$", + "TBT - A hammer$", + "TBT - Keys$", + "TBT - Keys$", + "TBT - An ashtray$", + "TBT - A paintbrush$", + "TBT - A rope$", + "TBT - A wooden object$", + "TBT - Sleeping pills$", + "TBT - A gold ring$", + "TBT - A jewellery box$", + "TBT - An alarm clock$", + "TBT - A coat of armour$", + "TBT - A candlestick$", + "TBT - A pair of gloves$", + "TBT - A engraved goblet$", + "TBT - A parchment$", + "TBT - A dagger$", + "TBT - A dossier$", + "TBT - A parchment$", + "TBT - A parchment$", + "TBT - A dossier$", + "TBT - A dossier$", + "TBT - A letter$", + "TBT - A novel$", + "TBT - A wooden rod$", + "TBT - An envelope$", + "TBT - A letter$", + "TBT - An envelope$", + "TBT - Julia$", + "TBT - Julia's death$", + "TBT - Julia's relationships$", + "TBT - A message from Julia$", + "TBT - Julia's inheritance$", + "TBT - Julia's final actions$", + "TBT - Julia's gifts$", + "TBT - Julia's bedroom$", + "TBT - The photo at Julia's home$", + "TBT - Julia and yourself...$", + "TBT - L‚o's occupations$", + "TBT - Pat's occupations$", + "TBT - Guy's occupations$", + "TBT - Bob's occupations$", + "TBT - Eva's occupations$", + "TBT - Luc's occupations$", + "TBT - Ida's occupations$", + "TBT - Max's occupations$", + "TBT - Your occupations$", + "TBT - L‚o's relationships$", + "TBT - Pat's relationships$", + "TBT - Guy's relationships$", + "TBT - Bob's relationships$", + "TBT - Eva's relationships$", + "TBT - Luc's relationships$", + "TBT - Ida's relationships$", + "TBT - Max's relationships$", + "TBT - Your relationships$", + "TBT - Murielle$", + "TBT - Murielle's relationships$", + "TBT - Murielle and yourself...$", + "TBT - Murielle's disappearance$", + "TBT - The wall of silence$", + "TBT - The manuscripts$", + "TBT - The coat of arms$", + "TBT - Engravings in the cellar$", + "TBT - The well$", + "TBT - The secret passages$", + "TBT - The chapel$", + "TBT - The paintings$", + "TBT - The photo of the attic$", + "TBT - The body in the crypt$", + "TBT - $", + "TBT - $", + "TBT - END OF THE CONVERSATION$", + "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", + "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "TBT - Je n'en sais rien !$", + "TBT - Elle est morte d'une embolie pulmonaire$", + "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "TBT - Madame DEFRANCK est morte d'un coup de froid$", + "TBT - Elle est morte d'une embolie pulmonaire$", + "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "TBT - Ce sont toujours les meilleurs qui partent les premiers$", + "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", + "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", + "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", + "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", + "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", + "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "TBT - Ce sont ses affaires ...$", + "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", + "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", + "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", + "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", + "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", + "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", + "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", + "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", + "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "TBT - Les bijoux ...$", + "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", + "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", + "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", + "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", + "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", + "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", + "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", + "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", + "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", + "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", + "TBT - Moi je n'ai rien … lui reprocher$", + "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", + "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", + "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", + "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", + "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", + "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", + "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", + "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", + "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "TBT - C'est pour un rendez-vous ?$", + "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", + "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", + "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", + "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", + "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", + "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", + "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", + "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", + "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", + "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", + "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", + "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", + "TBT - Elle aussi, faisait des recherches ...$", + "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", + "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "TBT - Je crois que tout le monde l'aimait bien$", + "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", + "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", + "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "TBT - A part sa famille, pas grand monde$", + "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "TBT - Non rien !$", + "TBT - Non ... Pas que le sache$", + "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", + "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", + "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", + "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", + "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", + "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", + "TBT - Son dernier pr‚sent m'a surpris$", + "TBT - Quel cadeau ?$", + "TBT - Un chandellier ...$", + "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "TBT - Et bien oui ! Comme tout le monde, je crois$", + "TBT - Un poignard$", + "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "TBT - Vous avez un don de double-vue ou un passe-partout$", + "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", + "TBT - Vous savez, je la connaissais assez peu$", + "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", + "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", + "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", + "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", + "TBT - Si la chambre est ferm‚e, demandez … L‚o$", + "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "TBT - Vous savez ce que c'est : Des relations familiales$", + "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", + "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", + "TBT - Je ne me rappelle pas$", + "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", + "TBT - Vous tes bien curieux !... C'est sans valeur$", + "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "TBT - Dommage que la devise soit manquante ...$", + "TBT - C'est trŠs beau ... Et trŠs vieux ...$", + "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", + "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", + "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", + "TBT - Ca reste pour moi le plus grand des mystŠres$", + "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", + "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", + "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "TBT - Quoi ?! Quel corps ? Quel crypte ?$", + "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", + "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", + "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", + "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "TBT - Julia aimait beaucoup la peinture$", + "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", + "TBT - Que faites-vous l… ?$", + "TBT - Je suis s–r que vous cherchez quelque chose ici$", + "TBT - Je vous ‚coute$", + "TBT - Que d‚sirez-vous ?$", + "TBT - Oui ?$", + "TBT - Je suis … vous ...$", + "TBT - C'est pourquoi ?$", + "TBT - Allez-y$", + "TBT - C'est … quel sujet ?$", + "TBT - Max : … votre service, monsieur$", + "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", + "TBT - Vous tes trop curieux !$", + "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", + "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", + "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", + "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "TBT - to the bureau$", + "TBT - to the kitchen$", + "TBT - to the cellar$", + "TBT - to the landing$", + "TBT - outside$", + "TBT - to the dining room$", + "TBT - inside the manor$", + "TBT - front of the manor$", + "TBT - to the chapel$", + "TBT - to the weel$", + "TBT - north$", + "TBT - behind the manor$", + "TBT - south$", + "TBT - east$", + "TBT - west$", + "TBT - towards the manor$", + "TBT - further$", + "TBT - in the water$", + "TBT - out of the weel$", + "TBT - in the weel$", + "TBT - choice on screen$", + "TBT - In the MYSTERY series...$", + "TBT - MORTVILLE MANOR$", + "TBT - $", + "TBT - From an original idea of...$", + "TBT - Bernard GRELAUD and Bruno GOURIER$", + "TBT - $", + "TBT - Directed by: KYILKHOR CREATION and LANGLOIS$", + "TBT - $", + "TBT - With the cooperation of...$", + "TBT - B‚atrice et Jean_Luc LANGLOIS$", + "TBT - for the music and the voices,$", + "TBT - Bernard GRELAUD for the graphic conception,$", + "TBT - MARIA-DOLORES for the graphic direction,$", + "TBT - Bruno GOURIER for the technical direction,$", + "TBT - Mick ANDON for the translation. $", + "TBT - $", + "TBT - Publisher: KYILKHOR and B&JL LANGLOIS $", + "TBT - COPYRIGHT 1987: KYILKHOR and B&JL LANGLOIS$", + "TBT - $", + "TBT - YOUR MOVE$", + "TBT - attach$", + "TBT - wait$", + "TBT - force$", + "TBT - sleep$", + "TBT - listen$", + "TBT - enter$", + "TBT - close$", + "TBT - search$", + "TBT - knock$", + "TBT - scratch$", + "TBT - read$", + "TBT - eat$", + "TBT - place$", + "TBT - open$", + "TBT - take$", + "TBT - look$", + "TBT - smell$", + "TBT - sound$", + "TBT - leave$", + "TBT - lift$", + "TBT - turn$", + "TBT - hide yourself$", + "TBT - search$", + "TBT - read$", + "TBT - put$", + "TBT - look$", + "TBT - Leo$", + "TBT - Pat$", + "TBT - Guy$", + "TBT - Eva$", + "TBT - Bob$", + "TBT - Luc$", + "TBT - Ida$", + "TBT - Max$", + "TBT - JULIA...$", + "TBT - - Did she commit suicide?$", + "TBT - - Was she murdered?$", + "TBT - - Did she die by accident?$", + "TBT - - Did she die of natural causes?$", + "TBT - Where did the money come from@for the restoration of the manor?$", + "TBT - - Blackmail$", + "TBT - - Honest work$", + "TBT - - Inheritance$", + "TBT - - Races$", + "TBT - - Rents$", + "TBT - - Hold-up$", + "TBT - - Other$", + "TBT - What is Leo's hobby?$", + "TBT - - Historical research$", + "TBT - - Politics$", + "TBT - - Painting$", + "TBT - - Drugs$", + "TBT - - Occult sciences$", + "TBT - - Management of a sect$", + "TBT - Julia left several clues that are@represented in one place. Which?$", + "TBT - - Chapel$", + "TBT - - Outside$", + "TBT - - Cellar$", + "TBT - - Attic$", + "TBT - - Kitchen$", + "TBT - - Dining room$", + "TBT - - Julia's room$", + "TBT - - Leo's room$", + "TBT - - Pat's room$", + "TBT - - Bob's room$", + "TBT - - Max's room$", + "TBT - - Luc/Ida's room$", + "TBT - - Guy/Eva's room$", + "TBT - The main clue that leads you@to the underground door is:$", + "TBT - - A dagger$", + "TBT - - A ring$", + "TBT - - A book$", + "TBT - - A parchment$", + "TBT - - A letter$", + "TBT - - A pendulum$", + "TBT - How many parchments were there in the manor?$", + "TBT - - 0$", + "TBT - - 1$", + "TBT - - 2$", + "TBT - - 3$", + "TBT - - 4$", + "TBT - - 5$", + "TBT - How many persons are involved in@this story?@(Julia included, but not yourself)$", + "TBT - - 9$", + "TBT - - 10$", + "TBT - - 11$", + "TBT - What was the first name@of the unknown character?$", + "TBT - - Mireille$", + "TBT - - Fran‡oise$", + "TBT - - Maguy$", + "TBT - - Emilie$", + "TBT - - Murielle$", + "TBT - - Sophie$", + "TBT - Wo did Murielle have an affair with?$", + "TBT - - Bob$", + "TBT - - Luc$", + "TBT - - Guy$", + "TBT - - Leo$", + "TBT - - Max$", + "TBT - Murielle shared an occupation@with one other person. Who?$", + "TBT - [1][You realize that certain elements of|this investigation remain a mystery for you.|Therefore, you decide first to learn|more before undertaking new risks..][ok]$", + "TBT - [3][ | insert disk 1 | in drive A ][ok]$", + "TBT - [1][ | Disk error | All stop... ][ok]$", + "TBT - [1][ | You should have noticed |00% of the clues ][ok]$", + "TBT - [3][ | insert disk 2 | in drive A ][ok]$", + "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "TBT - MASTER .$", + "TBT - rorL$", + NULL +}; #endif diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index 192ea50723..477ca44631 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -272,11 +272,22 @@ static void export_strings(const char *textFilename) { uint16 *strData; // Open input and output files - txxInp.open("TXX.INP", kFileReadMode); - txxNtp.open("TXX.NTP", kFileReadMode); + if (!txxInp.open("TXX.INP", kFileReadMode)) { + if (!txxInp.open("TXX.MOR", kFileReadMode)) { + printf("Missing TXX.INP/MOR"); + exit(-1); + } + } + if (!txxNtp.open("TXX.NTP", kFileReadMode)) { + if (!txxNtp.open("TXX.IND", kFileReadMode)) { + printf("Missing TXX.NTP/IND"); + exit(-1); + } + } textFile.open(textFilename, kFileWriteMode); // Read all the compressed string data into a buffer + printf("%d %d", txxInp.size(), txxNtp.size()); strData = (uint16 *)malloc(txxInp.size()); txxInp.read(strData, txxInp.size()); diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 2f31c0a7d9..4415f57c29 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 5be59d5ec5..b8be8384de 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -279,7 +279,22 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { */ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataType dataType) { // Figure out what language Id is needed - byte desiredLanguageId = (getLanguage() == Common::EN_ANY) ? LANG_ENGLISH : LANG_FRENCH; + byte desiredLanguageId; + switch(getLanguage()) { + case Common::EN_ANY: + desiredLanguageId = LANG_ENGLISH; + break; + case Common::FR_FRA: + desiredLanguageId = LANG_FRENCH; + break; + case Common::DE_DEU: + desiredLanguageId = LANG_GERMAN; + break; + default: + warning("Language not supported, switching to English"); + desiredLanguageId = LANG_ENGLISH; + break; + } // Read in the language byte languageId = f.readByte(); -- cgit v1.2.3 From 410f803e9124d94813bc4d29d5b7659d58c31476 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 12:49:25 +0200 Subject: MORTEVIELLE: Get rid of the hardcoded size of _cfiecBuffer --- engines/mortevielle/mortevielle.cpp | 10 +++++----- engines/mortevielle/mortevielle.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b8be8384de..38355ec558 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -197,7 +197,7 @@ Common::ErrorCode MortevielleEngine::initialise() { loadPalette(); loadCFIPH(); loadCFIEC(); - decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); _c_zzz = 1; init_nbrepm(); initMouse(); @@ -2474,12 +2474,12 @@ void MortevielleEngine::loadCFIEC() { error("Missing file - *cfiec.mor"); } - int size = ((f.size() / 128) + 1) * 128; + _cfiecBufferSize = ((f.size() / 128) + 1) * 128; if (!_reloadCFIEC) - _cfiecBuffer = (byte *)malloc(sizeof(byte) * size); + _cfiecBuffer = (byte *)malloc(sizeof(byte) * _cfiecBufferSize); - for (int i = 0; i < size; ++i) + for (int i = 0; i < _cfiecBufferSize; ++i) _cfiecBuffer[i] = f.readByte(); f.close(); @@ -3749,7 +3749,7 @@ int MortevielleEngine::testou() { break; case '\26' : if ((_c_zzz == 1) || (_c_zzz == 2)) { - decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); ++_c_zzz; return 61; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e22732600f..97bc814d61 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -273,6 +273,7 @@ private: Common::String _hintPctMessage; byte *_cfiecBuffer; + int _cfiecBufferSize; byte _touv[8]; int _nbrep[9]; int _nbrepm[9]; -- cgit v1.2.3 From b27b77b3547dd0d3045da48ee7944bc65d19cd17 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 16:39:18 +0200 Subject: MORTEVIELLE: Modify copyright string to include 1987. --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/detection.cpp | 2 +- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/dialogs.h | 2 +- engines/mortevielle/graphics.cpp | 5 +++++ engines/mortevielle/graphics.h | 5 +++++ engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/menu.h | 2 +- engines/mortevielle/mortevielle.cpp | 5 +++++ engines/mortevielle/mortevielle.h | 5 +++++ engines/mortevielle/mouse.cpp | 2 +- engines/mortevielle/mouse.h | 2 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/outtext.h | 2 +- engines/mortevielle/saveload.cpp | 2 +- engines/mortevielle/saveload.h | 2 +- engines/mortevielle/sound.cpp | 2 +- engines/mortevielle/sound.h | 2 +- engines/mortevielle/speech.cpp | 2 +- engines/mortevielle/speech.h | 2 +- 20 files changed, 36 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 2f39b61bad..4e6dfb0cf0 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/scummsys.h" diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 994563d497..9fe0927706 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -51,7 +51,7 @@ public: } virtual const char *getOriginalCopyright() const { - return "Mortville Manor (C) 1988-89 Lankhor"; + return "Mortville Manor (C) 1987-89 Lankhor"; } virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 1947705fe5..0a1cb420de 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/str.h" diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 1ed87456a9..740b5facd4 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_ALERT_H diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index a49bda7b73..fec2cfbf6b 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -20,6 +20,11 @@ * */ +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1987-1989 Lankhor + */ + #include "common/endian.h" #include "common/system.h" #include "graphics/palette.h" diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 498322680d..03e0d016ec 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -20,6 +20,11 @@ * */ +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1987-1989 Lankhor + */ + #ifndef MORTEVIELLE_GRAPHICS_H #define MORTEVIELLE_GRAPHICS_H diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 1cfafb8ff1..99509f8490 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/scummsys.h" diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 37612edd06..03c091909e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_MENU_H diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 38355ec558..c93722cb54 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -20,6 +20,11 @@ * */ +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1987-1989 Lankhor + */ + #include "common/system.h" #include "common/config-manager.h" #include "common/debug-channels.h" diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 97bc814d61..3f5c133010 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -20,6 +20,11 @@ * */ +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1987-1989 Lankhor + */ + #ifndef MORTEVIELLE_H #define MORTEVIELLE_H diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index b46b1d6598..598677f762 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/endian.h" diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 0e235ad894..abfc315677 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_MOUSE_H diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e44dc989c6..9e903bb133 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/file.h" diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index cc7bb1fb4a..25162981c6 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_OUTTEXT_H diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index af00de265e..48ae04678d 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/file.h" diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index a89fc9db89..21522102a2 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_SAVELOAD_H diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 9f0738c6c8..bb85221d75 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/scummsys.h" diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 9ad46e84d3..675fc78f78 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_SOUND_H diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 09b0af730e..2c15db253d 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #include "common/endian.h" diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 42be466a57..c27f2bfc15 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -22,7 +22,7 @@ /* * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor + * Copyright (c) 1987-1989 Lankhor */ #ifndef MORTEVIELLE_PAROLE_H -- cgit v1.2.3 From c7eba15ee74cc2b44b3a222b25eb149cc90b8009 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 17:55:18 +0200 Subject: MORTEVIELLE: Fix regression in 4edc3bff94b4cb27b32f46a4934bf486ab834e1c --- engines/mortevielle/actions.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 4e6dfb0cf0..cf68d7d496 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -68,9 +68,7 @@ void MortevielleEngine::fctMove() { } else if (_num == 7) { _coreVar._currPlace = ATTIC; _menu.setDestinationText(ATTIC); - } - - if (_num != 6) + } else if (_num != 6) _coreVar._currPlace = ROOM26; if ((_num > 1) && (_num < 6)) -- cgit v1.2.3 From d31151eb5532bb72acc407b3e02a5b973dcbdc4e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 29 Mar 2012 19:15:12 +0200 Subject: MORTEVIELLE: Fix regression in 2c73b82b8ee95f9809af5e0d9893245f2c57247e --- engines/mortevielle/mortevielle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c93722cb54..a5c5dab2e9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -2243,8 +2243,7 @@ Common::String MortevielleEngine::getString(int num) { char let; do { cinq_huit(let, hint, point, endFl); - if (length < 254) - wrkStr += let; + wrkStr += let; ++length; } while (!endFl); } -- cgit v1.2.3 From 025d3a9eee31b344ec4f4efc9a89d2f9e67f9802 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 May 2012 23:28:11 +0200 Subject: MORTEVIELLE: Some renaming --- engines/mortevielle/dialogs.cpp | 145 ++++++++++++++++++++-------------------- engines/mortevielle/dialogs.h | 2 +- 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 0a1cb420de..b2be026ff5 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -39,41 +39,38 @@ namespace Mortevielle { * @remarks Originally called 'do_alert' */ int Alert::show(const Common::String &msg, int n) { - int coldep, esp, i, caseNumb, quoi, ix; - Common::String st, chaine; - int limit[3][3]; - Common::String s[3]; - Common::Point curPos; - int nbcol, lignNumb; - bool newaff, test, test1, test2, test3, dum; - Common::String cas; - // Make a copy of the current screen surface for later restore g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); - memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - int do_alert_result; g_vm->_mouse.hideMouse(); while (g_vm->keyPressed()) g_vm->getChar(); g_vm->setMouseClick(false); - decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas); + + int colNumb = 0; + int lignNumb = 0; + int caseNumb = 0; + Common::String alertStr = ""; + Common::String caseStr; + + decodeAlertDetails(msg, caseNumb, lignNumb, colNumb, alertStr, caseStr); g_vm->sauvecr(50, (NUM_LINES + 1) << 4); - i = 0; - if (chaine == "") { - drawAlertBox(10, 5, nbcol); + int i = 0; + Common::Point curPos; + if (alertStr == "") { + drawAlertBox(10, 5, colNumb); } else { - drawAlertBox(8, 7, nbcol); + drawAlertBox(8, 7, colNumb); i = 0; g_vm->_screenSurface._textPos.y = 70; do { curPos.x = 320; - st = ""; - while ((chaine[i + 1] != '\174') && (chaine[i + 1] != '\135')) { + Common::String displayStr = ""; + while ((alertStr[i + 1] != '\174') && (alertStr[i + 1] != '\135')) { ++i; - st = st + chaine[i]; + displayStr += alertStr[i]; if (g_vm->_res == 2) curPos.x -= 3; else @@ -81,78 +78,87 @@ int Alert::show(const Common::String &msg, int n) { } g_vm->_screenSurface.putxy(curPos.x, g_vm->_screenSurface._textPos.y); g_vm->_screenSurface._textPos.y += 6; - g_vm->_screenSurface.drawString(st, 4); + g_vm->_screenSurface.drawString(displayStr, 4); ++i; - } while (chaine[i] != ']'); + } while (alertStr[i] != ']'); } + int esp; if (caseNumb == 1) - esp = nbcol - 40; + esp = colNumb - 40; else - esp = (uint)(nbcol - caseNumb * 40) >> 1; - coldep = 320 - ((uint)nbcol >> 1) + ((uint)esp >> 1); - setButtonText(cas, coldep, caseNumb, &s[0], esp); - limit[1][1] = ((uint)(coldep) >> 1) * g_vm->_res; + esp = (uint)(colNumb - caseNumb * 40) / 2; + + int coldep = 320 - ((uint)colNumb / 2) + ((uint)esp / 2); + Common::String buttonStr[3]; + setButtonText(caseStr, coldep, caseNumb, &buttonStr[0], esp); + + int limit[3][3]; + memset(&limit[0][0], 0, sizeof(int) * 3 * 3); + + limit[1][1] = ((uint)(coldep) / 2) * g_vm->_res; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) >> 1) * g_vm->_res; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_res; limit[2][2] = (limit[2][1]) + 40; } g_vm->_mouse.showMouse(); - quoi = 0; - dum = false; + int id = 0; + bool dummyFl = false; + bool test3; do { char dummyKey = '\377'; - g_vm->_mouse.moveMouse(dum, dummyKey); + g_vm->_mouse.moveMouse(dummyFl, dummyKey); CHECK_QUIT0; curPos = g_vm->_mouse._pos; - test = (curPos.y > 95) && (curPos.y < 105); - newaff = false; - if (test) { - test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); - test2 = test1; + bool newaff = false; + if ((curPos.y > 95) && (curPos.y < 105)) { + bool test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); + bool test2 = test1; if (caseNumb > 1) - test2 = test1 || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2])); + test2 |= ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2])); if (test2) { newaff = true; + + int ix; if (test1) ix = 1; else ix = 2; - if (ix != quoi) { + if (ix != id) { g_vm->_mouse.hideMouse(); - if (quoi != 0) { - setPosition(quoi, coldep, esp); + if (id != 0) { + setPosition(id, coldep, esp); - Common::String tmp(" "); - tmp += s[quoi]; - tmp += " "; - g_vm->_screenSurface.drawString(tmp, 0); + Common::String tmpStr(" "); + tmpStr += buttonStr[id]; + tmpStr += " "; + g_vm->_screenSurface.drawString(tmpStr, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; - tmp2 += s[ix]; + tmp2 += buttonStr[ix]; tmp2 += " "; g_vm->_screenSurface.drawString(tmp2, 1); - quoi = ix; + id = ix; g_vm->_mouse.showMouse(); } } } - if ((quoi != 0) && ! newaff) { + if ((id != 0) && !newaff) { g_vm->_mouse.hideMouse(); - setPosition(quoi, coldep, esp); + setPosition(id, coldep, esp); Common::String tmp3(" "); - tmp3 += s[quoi]; + tmp3 += buttonStr[id]; tmp3 += " "; g_vm->_screenSurface.drawString(tmp3, 0); - quoi = 0; + id = 0; g_vm->_mouse.showMouse(); } test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2])) @@ -161,21 +167,20 @@ int Alert::show(const Common::String &msg, int n) { g_vm->setMouseClick(false); g_vm->_mouse.hideMouse(); if (!test3) { - quoi = n; + id = n; setPosition(n, coldep, esp); Common::String tmp4(" "); - tmp4 += s[n]; + tmp4 += buttonStr[n]; tmp4 += " "; g_vm->_screenSurface.drawString(tmp4, 1); } - g_vm->charecr(50, (NUM_LINES + 1) << 4); + g_vm->charecr(50, (NUM_LINES + 1) * 16); g_vm->_mouse.showMouse(); /* Restore the background area */ g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); - do_alert_result = quoi; - return do_alert_result; + return id; } /** @@ -233,10 +238,10 @@ void Alert::setPosition(int ji, int coldep, int esp) { void Alert::drawAlertBox(int lidep, int nli, int tx) { if (tx > 640) tx = 640; - int x = 320 - ((uint)tx >> 1); - int y = (lidep - 1) << 3; + int x = 320 - ((uint)tx / 2); + int y = (lidep - 1) * 8; int xx = x + tx; - int yy = y + (nli << 3); + int yy = y + (nli * 8); g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); @@ -247,16 +252,13 @@ void Alert::drawAlertBox(int lidep, int nli, int tx) { * @remarks Originally called 'fait_choix' */ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { - int i, l, x; - char ch; - - i = 1; - x = coldep; - for (l = 1; l <= nbcase; ++l) { + int i = 1; + int x = coldep; + for (int l = 1; l <= nbcase; ++l) { str[l] = ""; do { ++i; - ch = c[i]; + char ch = c[i]; str[l] += ch; } while (c[i + 1] != ']'); i += 2; @@ -284,12 +286,6 @@ bool KnowledgeCheck::show() { const int textIndexArr[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; const int correctAnswerArr[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; - char key; - int optionPosY; - int maxLength; - int rep; - int firstOption, lastOption; - Hotspot coor[kMaxHotspots+1]; for (int i = 0; i <= kMaxHotspots; ++i) { @@ -315,6 +311,9 @@ bool KnowledgeCheck::show() { Common::String tmpStr = g_vm->getString(textIndexArr[indx]); g_vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); + int firstOption; + int lastOption; + if (indx != 9) { firstOption = textIndexArr[indx] + 1; lastOption = textIndexArr[indx + 1] - 1; @@ -322,8 +321,8 @@ bool KnowledgeCheck::show() { firstOption = 503; lastOption = 510; } - optionPosY = 35; - maxLength = 0; + int optionPosY = 35; + int maxLength = 0; prevChoice = 1; for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) { @@ -344,6 +343,7 @@ bool KnowledgeCheck::show() { } } coor[lastOption - firstOption + 2]._enabled = false; + int rep; if (g_vm->_res == 1) rep = 10; else @@ -356,6 +356,7 @@ bool KnowledgeCheck::show() { do { g_vm->setMouseClick(false); bool flag; + char key; g_vm->_mouse.moveMouse(flag, key); CHECK_QUIT0; diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 740b5facd4..9b980af379 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -48,7 +48,7 @@ private: static void drawAlertBox(int lidep, int nli, int tx); static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: - static int show(const Common::String &s, int n); + static int show(const Common::String &msg, int n); }; class KnowledgeCheck { -- cgit v1.2.3 From 4c9c1e17d174528877a5b0b9e175c9853c833d50 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 May 2012 23:29:25 +0200 Subject: TOOLS: Translate a couple of strings used in Mortevielle English --- devtools/create_mortdat/enginetext.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index 68db310a6b..c4929141d3 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -30,9 +30,9 @@ const char *engineDataEn[] = { "[2][ ][YES][NO]", "Go to", "Someone enters, looks surised, but says nothing", - "Cool", - " Lourde ", - "Malsaine", + " Cool ", + "Oppressive", + " Tense ", "Idem", "You", "are", @@ -47,14 +47,14 @@ const char *engineDataEn[] = { " Save", " Load", - " Restart ", + " Restart", "F3: Repeat", "F8: Proceed", "Hide self", "take", " probe ", " raise ", - " -SUITE- ", + " -MORE- ", " -STOP- ", "[1] [So, use the DEP menu] [Ok]", "lift", -- cgit v1.2.3 From 47a9db86a17e5735a75c518ddd8a783cf30ae005 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 14 Jun 2012 18:47:03 +0200 Subject: MORTEVIELLE: Fix recurrent Valgrind warnings (thanks DrMcCoy for reporting) --- engines/mortevielle/mortevielle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index a5c5dab2e9..21f2ba314e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -112,7 +112,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _place = -1; _c_zzz = -1; - + _caff = -1; } MortevielleEngine::~MortevielleEngine() { @@ -489,6 +489,8 @@ static byte CURSOR_ARROW_DATA[16 * 16] = { void MortevielleEngine::initMouse() { CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); CursorMan.showMouse(true); + + _mouse.initMouse(); } /** -- cgit v1.2.3 From 200436dc60d5b96af46e87d88671fc635f94f16b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Jun 2012 00:27:59 +0200 Subject: MORTEVIELLE: Initialize some more variables --- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/speech.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 21f2ba314e..8ff7d02c9e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -113,6 +113,8 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _c_zzz = -1; _caff = -1; + + memset(_mem, 0, sizeof(_mem)); } MortevielleEngine::~MortevielleEngine() { diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 2c15db253d..0d06edcd48 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -58,6 +58,14 @@ const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, SpeechManager::SpeechManager() { _typlec = 0; _phonemeNumb = 0; + + for (int i = 0; i < 3; i++) { + _queue[i]._val; + _queue[i]._code; + _queue[i]._acc; + _queue[i]._freq; + _queue[i]._rep; + } } void SpeechManager::spfrac(int wor) { -- cgit v1.2.3 From 39e2f21bae36b71e54a7f1698cab77715f4e7017 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Jun 2012 00:27:59 +0200 Subject: MORTEVIELLE: Initialize some more variables --- engines/mortevielle/speech.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 0d06edcd48..853d6baae0 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -60,11 +60,11 @@ SpeechManager::SpeechManager() { _phonemeNumb = 0; for (int i = 0; i < 3; i++) { - _queue[i]._val; - _queue[i]._code; - _queue[i]._acc; - _queue[i]._freq; - _queue[i]._rep; + _queue[i]._val = 0; + _queue[i]._code = 0; + _queue[i]._acc = 0; + _queue[i]._freq = 0; + _queue[i]._rep = 0; } } -- cgit v1.2.3 From 1274c02d1d1dc4c0af156e7f769e9155499b67a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 15 Jun 2012 20:39:03 +0200 Subject: MORTEVIELLE: Fix a couple of Valgrind warnings --- engines/mortevielle/mortevielle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8ff7d02c9e..58708f3bcb 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -113,8 +113,10 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _c_zzz = -1; _caff = -1; + _day = 0; memset(_mem, 0, sizeof(_mem)); + _anyone = false; } MortevielleEngine::~MortevielleEngine() { @@ -2483,11 +2485,12 @@ void MortevielleEngine::loadCFIEC() { } _cfiecBufferSize = ((f.size() / 128) + 1) * 128; + int32 fileSize = f.size(); if (!_reloadCFIEC) _cfiecBuffer = (byte *)malloc(sizeof(byte) * _cfiecBufferSize); - for (int i = 0; i < _cfiecBufferSize; ++i) + for (int32 i = 0; i < fileSize; ++i) _cfiecBuffer[i] = f.readByte(); f.close(); -- cgit v1.2.3 From e0ca30ad3da63f8dee025244b4ec6d4a719c1258 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 8 Oct 2012 08:00:00 +0200 Subject: MORTEVIELLE: Get rid of some magic values --- engines/mortevielle/actions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index cf68d7d496..bff5d638ee 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -453,7 +453,7 @@ void MortevielleEngine::fctLook() { treg(147); if ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 3)) treg(149); - if ((_coreVar._currPlace == 9) && (_num == 2)) + if ((_coreVar._currPlace == ROOM9) && (_num == 2)) treg(30); if ((_coreVar._currPlace == DINING_ROOM) && (_num == 3)) treg(31); @@ -610,7 +610,7 @@ void MortevielleEngine::fctOpen() { ++tmpPlace; } while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == _num))); if (ord(_touv[tmpPlace]) != _num) { - if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == 9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) + if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == ROOM9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) || ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 5)) || ((_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) @@ -926,7 +926,7 @@ void MortevielleEngine::fctKnock() { _speechManager.startSpeech(11, rand, 1); int p = getPresenceStats(rand, _coreVar._faithScore, _ment); int l = _ment; - if (l != 0) { + if (l != OWN_ROOM) { if (p != -500) { if (rand > p) _crep = 190; @@ -938,7 +938,7 @@ void MortevielleEngine::fctKnock() { getKnockAnswer(); } - if (_ment == 8) + if (_ment == GREEN_ROOM2) _crep = 190; } } @@ -1050,7 +1050,7 @@ void MortevielleEngine::fctListen() { int rand; int p = getPresenceStats(rand, _coreVar._faithScore, _ment); int l = _ment; - if (l != 0) { + if (l != OWN_ROOM) { if (p != -500) { if (rand > p) _crep = 101; -- cgit v1.2.3 From b2f2f8d7b08b40e43702e8db325f8136066f10be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 10 Oct 2012 08:19:54 +0200 Subject: MORTEVIELLE: Some renaming --- engines/mortevielle/actions.cpp | 50 ++++++++++++++++++------------------- engines/mortevielle/mortevielle.cpp | 30 +++++++++++----------- engines/mortevielle/mortevielle.h | 14 +++++------ 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index bff5d638ee..f53dd91497 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -72,9 +72,9 @@ void MortevielleEngine::fctMove() { _coreVar._currPlace = ROOM26; if ((_num > 1) && (_num < 6)) - _ment = _num - 1; + _roomDoorId = _num - 1; else if (_num > 7) - _ment = _num - 3; + _roomDoorId = _num - 3; if (_num != 6) affrep(); @@ -207,10 +207,10 @@ void MortevielleEngine::fctTake() { } else { _tabdon[kAcha + ((_mchai - 1) * 10) + _cs - 1] = 0; tsuiv(); - ++_dobj; - if (_dobj > 6) { + ++_takeObjCount; + if (_takeObjCount > 6) { _coreVar._faithScore += 2; - _dobj = 0; + _takeObjCount = 0; } } } @@ -583,7 +583,7 @@ void MortevielleEngine::fctOpen() { ecr3(getEngineString(S_OPEN)); if (_caff == ROOM26) { - if (_ment != 0) { + if (_roomDoorId != OWN_ROOM) { _msg[4] = OPCODE_ENTER; _syn = true; } else @@ -604,7 +604,7 @@ void MortevielleEngine::fctOpen() { if (_num != 0) { if (_currBitIndex > 0) _coreVar._faithScore += 2; - ++_iouv; + ++_openObjCount; int tmpPlace = 0; do { ++tmpPlace; @@ -880,9 +880,9 @@ void MortevielleEngine::fctClose() { aniof(2, _num); _crep = 998; _touv[cx] = chr(0); - --_iouv; - if (_iouv < 0) - _iouv = 0; + --_openObjCount; + if (_openObjCount < 0) + _openObjCount = 0; int chai = 9999; rechai(chai); if (_mchai == chai) @@ -924,8 +924,8 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; _speechManager.startSpeech(11, rand, 1); - int p = getPresenceStats(rand, _coreVar._faithScore, _ment); - int l = _ment; + int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); + int l = _roomDoorId; if (l != OWN_ROOM) { if (p != -500) { if (rand > p) @@ -938,7 +938,7 @@ void MortevielleEngine::fctKnock() { getKnockAnswer(); } - if (_ment == GREEN_ROOM2) + if (_roomDoorId == GREEN_ROOM2) _crep = 190; } } @@ -1048,8 +1048,8 @@ void MortevielleEngine::fctListen() { if (_currBitIndex != 0) ++_coreVar._faithScore; int rand; - int p = getPresenceStats(rand, _coreVar._faithScore, _ment); - int l = _ment; + int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); + int l = _roomDoorId; if (l != OWN_ROOM) { if (p != -500) { if (rand > p) @@ -1126,17 +1126,17 @@ void MortevielleEngine::fctEnter() { _menu.setDestinationText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); - else if (_ment == 0) + else if (_roomDoorId == OWN_ROOM) _crep = 997; - else if ((_ment == 9) && (_coreVar._selectedObjectId != 136)) { + else if ((_roomDoorId == ROOM9) && (_coreVar._selectedObjectId != 136)) { _crep = 189; _coreVar._teauto[8] = '*'; } else { int z = 0; if (!_blo) - z = getPresence(_ment); + z = getPresence(_roomDoorId); if (z != 0) { - if ((_ment == 3) || (_ment == 7)) + if ((_roomDoorId == TOILETS) || (_roomDoorId == BATHROOM)) _crep = 179; else { _x = (getRandomNumber(0, 10)) - 5; @@ -1149,26 +1149,26 @@ void MortevielleEngine::fctEnter() { _msg[3] = MENU_DISCUSS; _msg[4] = _menu._discussMenu[_x]; _syn = true; - if (_ment == 9) { + if (_roomDoorId == ROOM9) { _col = true; _caff = 70; afdes(); repon(2, _caff); } else _col = false; - resetRoomVariables(_ment); - _ment = 0; + resetRoomVariables(_roomDoorId); + _roomDoorId = OWN_ROOM; } } else { _x = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, _x, 1); aniof(1, 1); - _coreVar._currPlace = _ment; + _coreVar._currPlace = _roomDoorId; affrep(); resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); - _ment = 0; + _roomDoorId = OWN_ROOM; _savedBitIndex = 0; _currBitIndex = 0; } @@ -1460,7 +1460,7 @@ void MortevielleEngine::fctDiscuss() { if (_col) { _col = false; _coreVar._currPlace = 15; - if (_iouv > 0) + if (_openObjCount > 0) max = 8; else max = 4; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 58708f3bcb..9f41292f49 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -111,7 +111,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _newGraphicalDevice = -1; _place = -1; - _c_zzz = -1; + _x26KeyCount = -1; _caff = -1; _day = 0; @@ -207,7 +207,7 @@ Common::ErrorCode MortevielleEngine::initialise() { loadCFIPH(); loadCFIEC(); decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - _c_zzz = 1; + _x26KeyCount = 1; init_nbrepm(); initMouse(); @@ -587,7 +587,7 @@ void MortevielleEngine::mainGame() { if (_reloadCFIEC) loadCFIEC(); - for (_crep = 1; _crep <= _c_zzz; ++_crep) + for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); loadBRUIT5(); @@ -1679,8 +1679,8 @@ void MortevielleEngine::startMusicOrSpeech(int so) { */ void MortevielleEngine::loseGame() { initouv(); - _ment = 0; - _iouv = 0; + _roomDoorId = OWN_ROOM; + _openObjCount = 0; _mchai = 0; _menu.unsetSearchMenu(); if (!_blo) @@ -1892,14 +1892,14 @@ void MortevielleEngine::gameLoaded() { _endHour = 0; _cs = 0; _is = 0; - _ment = 0; + _roomDoorId = OWN_ROOM; _syn = true; _heroSearching = true; _mchai = 0; _manorDistance = 0; initouv(); - _iouv = 0; - _dobj = 0; + _openObjCount = 0; + _takeObjCount = 0; affrep(); _hintPctMessage = getString(580); @@ -3393,7 +3393,7 @@ void MortevielleEngine::affrep() { * @remarks Originally called 'tsort' */ void MortevielleEngine::exitRoom() { - if ((_iouv > 0) && (_coreVar._currPlace != OWN_ROOM)) { + if ((_openObjCount > 0) && (_coreVar._currPlace != OWN_ROOM)) { if (_coreVar._faithScore < 50) _coreVar._faithScore += 2; else @@ -3402,8 +3402,8 @@ void MortevielleEngine::exitRoom() { for (int cx = 1; cx <= 7; ++cx) _touv[cx] = chr(0); - _ment = 0; - _iouv = 0; + _roomDoorId = OWN_ROOM; + _openObjCount = 0; _mchai = 0; resetRoomVariables(_coreVar._currPlace); } @@ -3523,7 +3523,7 @@ L1: else _speechManager.startSpeech(4, 4, 1); - if (_iouv == 0) + if (_openObjCount == 0) _coreVar._faithScore += 2; else if (_coreVar._faithScore < 50) _coreVar._faithScore += 4; @@ -3568,7 +3568,7 @@ void MortevielleEngine::tsuiv() { tbcl = _tabdon[cl]; } while ((tbcl == 0) && (_cs <= 9)); - if ((tbcl != 0) && (_cs < 11)) { + if ((tbcl != 0) && (_cs < 11)) { // 2nd check useless as _cs is <= 10 ++_is; _caff = tbcl; _crep = _caff + 400; @@ -3759,9 +3759,9 @@ int MortevielleEngine::testou() { _soundOff = !_soundOff; break; case '\26' : - if ((_c_zzz == 1) || (_c_zzz == 2)) { + if ((_x26KeyCount == 1) || (_x26KeyCount == 2)) { decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - ++_c_zzz; + ++_x26KeyCount; return 61; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 3f5c133010..ec7e86f1fa 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -157,7 +157,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, 26 "A photograph$", 27 "The coat of arms$", */ -enum places { +enum Places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, @@ -173,7 +173,7 @@ struct nhom { byte _hom[4]; }; -struct t_pcga { +struct CgaPalette { byte _p; nhom _a[16]; }; @@ -260,12 +260,12 @@ private: int _startHour; int _endHour; Common::Point _stdPal[91][17]; - t_pcga _cgaPal[91]; + CgaPalette _cgaPal[91]; - int _c_zzz; - int _ment; - int _iouv; - int _dobj; + int _x26KeyCount; + int _roomDoorId; + int _openObjCount; + int _takeObjCount; int _num; int _cs; int _prebru; -- cgit v1.2.3 From bba9d9fc807a28dc485a8c214d7425cb95285636 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 10 Oct 2012 08:29:27 +0200 Subject: MORTEVIELLE: Fix merge --- engines/configure.engines | 1 + engines/plugins_table.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/engines/configure.engines b/engines/configure.engines index a8eb89a7fa..ee29e3223a 100644 --- a/engines/configure.engines +++ b/engines/configure.engines @@ -24,6 +24,7 @@ add_engine lastexpress "The Last Express" no "" "" "16bit" add_engine lure "Lure of the Temptress" yes add_engine made "MADE" yes add_engine mohawk "Mohawk" yes "cstime myst riven" "Living Books" +add_engine mortevielle "Mortevielle" no add_engine cstime "Where in Time is Carmen Sandiego?" no add_engine riven "Riven: The Sequel to Myst" no "" "" "16bit" add_engine myst "Myst" no "" "" "16bit" diff --git a/engines/plugins_table.h b/engines/plugins_table.h index 010de0d5e2..5097c87a9d 100644 --- a/engines/plugins_table.h +++ b/engines/plugins_table.h @@ -41,6 +41,9 @@ LINK_PLUGIN(HUGO) #if PLUGIN_ENABLED_STATIC(KYRA) LINK_PLUGIN(KYRA) #endif +#if PLUGIN_ENABLED_STATIC(MORTEVIELLE) +LINK_PLUGIN(MORTEVIELLE) +#endif #if PLUGIN_ENABLED_STATIC(LASTEXPRESS) LINK_PLUGIN(LASTEXPRESS) #endif -- cgit v1.2.3 From 6238c034fd20017ec6734a43ba4ad1c36c9741c2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 11 Oct 2012 00:45:46 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 64 +++++----- engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/mortevielle.cpp | 235 +++++++++++++++++++----------------- engines/mortevielle/mortevielle.h | 18 +-- 4 files changed, 169 insertions(+), 152 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index f53dd91497..2e4a237d53 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -43,8 +43,8 @@ void MortevielleEngine::fctMove() { if ((_coreVar._currPlace == ROOM26) && (_msg[4] == _menu._moveMenu[6])) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; - afdes(); - repon(2, _coreVar._currPlace); + drawPictureWithText(); + handleDescriptionText(2, _coreVar._currPlace); } if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { if (!_syn) @@ -314,7 +314,7 @@ void MortevielleEngine::fctInventoryTake() { _menu.setInventoryText(); avpoing(cz); _crep = 998; - clearScreenType2(); + clearDescriptionBar(); } /** @@ -686,7 +686,7 @@ void MortevielleEngine::fctPlace() { // Open hidden passage aniof(1, 2); aniof(1, 1); - repon(2, 165); + handleDescriptionText(2, 165); displayEmptyHand(); _speechManager.startSpeech(6, -9, 1); @@ -700,8 +700,8 @@ void MortevielleEngine::fctPlace() { _mouse.hideMouse(); hirs(); drawRightFrame(); - clearScreenType2(); - clearScreenType3(); + clearDescriptionBar(); + clearVerbBar(); _mouse.showMouse(); prepareRoom(); drawClock(); @@ -717,7 +717,7 @@ void MortevielleEngine::fctPlace() { } else { _menu.setDestinationText(_coreVar._currPlace); setPal(14); - dessin(); + drawPicture(); aniof(1, 2); aniof(1, 1); alertTxt = getString(577); @@ -788,7 +788,7 @@ void MortevielleEngine::fctTurn() { if (_num != 0) { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { - repon(2, 167); + handleDescriptionText(2, 167); _speechManager.startSpeech(7, 9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) @@ -797,8 +797,8 @@ void MortevielleEngine::fctTurn() { _crep = 168; } if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { - repon(2, 175); - clearScreenType3(); + handleDescriptionText(2, 175); + clearVerbBar(); _speechManager.startSpeech(6, -9, 1); int answer = Alert::show(getEngineString(S_YES_NO), 1); if (answer == 1) { @@ -1152,8 +1152,8 @@ void MortevielleEngine::fctEnter() { if (_roomDoorId == ROOM9) { _col = true; _caff = 70; - afdes(); - repon(2, _caff); + drawPictureWithText(); + handleDescriptionText(2, _caff); } else _col = false; resetRoomVariables(_roomDoorId); @@ -1190,12 +1190,12 @@ void MortevielleEngine::fctSleep() { exitRoom(); _coreVar._currPlace = OWN_ROOM; affrep(); - afdes(); + drawPictureWithText(); resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); } - clearScreenType3(); - clearScreenType2(); + clearVerbBar(); + clearDescriptionBar(); prepareScreenType2(); ecr2(getEngineString(S_WANT_TO_WAKE_UP)); updateHour(j, h, m); @@ -1285,7 +1285,7 @@ void MortevielleEngine::fctLeave() { */ void MortevielleEngine::fctWait() { _savedBitIndex = 0; - clearScreenType3(); + clearVerbBar(); int answer; do { @@ -1304,7 +1304,7 @@ void MortevielleEngine::fctWait() { prepareRoom(); return; } - repon(2, 102); + handleDescriptionText(2, 102); answer = Alert::show(getEngineString(S_YES_NO), 1); } while (answer != 2); _crep = 998; @@ -1347,8 +1347,8 @@ void MortevielleEngine::fctDiscuss() { ++cx; } while (_menu._discussMenu[cx] != _msg[4]); _caff = 69 + cx; - afdes(); - repon(2, _caff); + drawPictureWithText(); + handleDescriptionText(2, _caff); suj = _caff + 60; } testKey(false); @@ -1522,7 +1522,7 @@ void MortevielleEngine::fctDiscuss() { affrep(); /* chech;*/ _menu.setDestinationText(_coreVar._currPlace); - clearScreenType3(); + clearVerbBar(); } /** @@ -1565,10 +1565,10 @@ void MortevielleEngine::endGame() { _quitGame = true; tlu(13, 152); displayEmptyHand(); - clearScreenType1(); - clearScreenType2(); - clearScreenType3(); - repon(9, 1509); + clearUpperLeftPart(); + clearDescriptionBar(); + clearVerbBar(); + handleDescriptionText(9, 1509); testKey(false); _mouse.hideMouse(); _caff = 70; @@ -1577,14 +1577,14 @@ void MortevielleEngine::endGame() { premtet(); startDialog(141); _mouse.showMouse(); - clearScreenType1(); - repon(9, 1509); - repon(2, 142); + clearUpperLeftPart(); + handleDescriptionText(9, 1509); + handleDescriptionText(2, 142); testKey(false); _caff = 32; - afdes(); - repon(6, 34); - repon(2, 35); + drawPictureWithText(); + handleDescriptionText(6, 34); + handleDescriptionText(2, 35); startMusicOrSpeech(0); testKey(false); // A wait message was displayed. @@ -1600,7 +1600,7 @@ void MortevielleEngine::endGame() { * @remarks Originally called 'tencore' */ void MortevielleEngine::askRestart() { - clearScreenType2(); + clearDescriptionBar(); startMusicOrSpeech(0); testKey(false); displayEmptyHand(); @@ -1612,7 +1612,7 @@ void MortevielleEngine::askRestart() { _minute = 0; _hour = 10; _day = 0; - repon(2, 180); + handleDescriptionText(2, 180); int answer = Alert::show(getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b2be026ff5..f0f4452899 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -462,7 +462,7 @@ void f3f8::aff50(bool drawAni50Fl) { if (drawAni50Fl) ani50(); else - g_vm->repon(2, kDialogStringIndex + 142); + g_vm->handleDescriptionText(2, kDialogStringIndex + 142); // Draw the f3/f8 dialog draw(); @@ -474,7 +474,7 @@ void f3f8::ani50() { g_vm->_crep = g_vm->animof(2, 1); g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); g_vm->_largestClearScreen = (g_vm->_res == 1); - g_vm->repon(2, kDialogStringIndex + 143); + g_vm->handleDescriptionText(2, kDialogStringIndex + 143); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 9f41292f49..a6fda733f2 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -635,7 +635,7 @@ void MortevielleEngine::handleAction() { char inkey = '\0'; bool oo, funct = 0; - clearScreenType3(); + clearVerbBar(); oo = false; _controlMenu = 0; if (!_keyPressedEsc) { @@ -690,7 +690,7 @@ void MortevielleEngine::handleAction() { if ((funct) && (inkey != '\77')) return; if (temps > lim) { - repon(2, 141); + handleDescriptionText(2, 141); if (_num == 9999) _num = 0; } else { @@ -722,10 +722,10 @@ void MortevielleEngine::handleAction() { g_vm->_text.taffich(); if (_okdes) { _okdes = false; - dessin(); + drawPicture(); } if ((!_syn) || (_col)) - repon(2, _crep); + handleDescriptionText(2, _crep); } } while (_syn); if (_controlMenu != 0) @@ -883,7 +883,7 @@ void MortevielleEngine::showPeoplePresent(int bitIndex) { for (int i = 1; i <= 8; ++i) _menu.disableMenuItem(_menu._discussMenu[i]); - clearScreenType10(); + clearUpperRightPart(); if ((bitIndex & 128) == 128) { _screenSurface.putxy(xp, 24); _screenSurface.drawString("LEO", 4); @@ -1082,7 +1082,7 @@ void MortevielleEngine::displayAloneText() { Common::String sAre = getEngineString(S_ARE); Common::String sAlone = getEngineString(S_ALONE); - clearScreenType10(); + clearUpperRightPart(); _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); _screenSurface.drawString(sYou, 4); _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); @@ -1687,11 +1687,11 @@ void MortevielleEngine::loseGame() { getPresence(MANOR_FRONT); _loseGame = true; - clearScreenType1(); + clearUpperLeftPart(); _screenSurface.drawBox(60, 35, 400, 50, 15); - repon(9, _crep); - clearScreenType2(); - clearScreenType3(); + handleDescriptionText(9, _crep); + clearDescriptionBar(); + clearVerbBar(); _col = false; _syn = false; _okdes = false; @@ -1776,9 +1776,9 @@ void MortevielleEngine::gotoDiningRoom() { _currBitIndex = 255; // Everybody is present showPeoplePresent(_currBitIndex); _caff = 77; - afdes(); + drawPictureWithText(); _screenSurface.drawBox(223, 47, 155, 91, 15); - repon(2, 33); + handleDescriptionText(2, 33); testKey(false); mennor(); _mouse.hideMouse(); @@ -1861,11 +1861,11 @@ void MortevielleEngine::changeGraphicalDevice(int newDevice) { showPeoplePresent(_currBitIndex); else displayAloneText(); - clearScreenType2(); - clearScreenType3(); + clearDescriptionBar(); + clearVerbBar(); _maff = 68; - afdes(); - repon(2, _crep); + drawPictureWithText(); + handleDescriptionText(2, _crep); _menu.displayMenu(); } @@ -1911,9 +1911,9 @@ void MortevielleEngine::gameLoaded() { displayAloneText(); prepareRoom(); drawClock(); - afdes(); - repon(2, _crep); - clearScreenType3(); + drawPictureWithText(); + handleDescriptionText(2, _crep); + clearVerbBar(); _endGame = false; _menu.setDestinationText(_coreVar._currPlace); _menu.setInventoryText(); @@ -1928,7 +1928,7 @@ void MortevielleEngine::gameLoaded() { */ void MortevielleEngine::handleOpcode() { if (!_col) - clearScreenType2(); + clearDescriptionBar(); _syn = false; _keyPressedEsc = false; if (!_anyone) { @@ -2063,20 +2063,20 @@ void MortevielleEngine::charToHour() { } /** - * Engine function - Clear Screen - Type 1 + * Engine function - Clear upper left part of Screen - Type 1 * @remarks Originally called 'clsf1' */ -void MortevielleEngine::clearScreenType1() { +void MortevielleEngine::clearUpperLeftPart() { _mouse.hideMouse(); _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); _mouse.showMouse(); } /** - * Engine function - Clear Screen - Type 2 + * Engine function - Clear low bar used by description * @remarks Originally called 'clsf2' */ -void MortevielleEngine::clearScreenType2() { +void MortevielleEngine::clearDescriptionBar() { _mouse.hideMouse(); if (_largestClearScreen) { _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); @@ -2090,10 +2090,10 @@ void MortevielleEngine::clearScreenType2() { } /** - * Engine function - Clear Screen - Type 3 + * Engine function - Clear lowest bar used by verbs * @remarks Originally called 'clsf3' */ -void MortevielleEngine::clearScreenType3() { +void MortevielleEngine::clearVerbBar() { _mouse.hideMouse(); _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); _screenSurface.drawBox(0, 191, 634, 8, 15); @@ -2101,22 +2101,23 @@ void MortevielleEngine::clearScreenType3() { } /** - * Engine function - Clear Screen - Type 10 + * Engine function - Clear upper right part of the screen * @remarks Originally called 'clsf10' */ -void MortevielleEngine::clearScreenType10() { - int co, cod; +void MortevielleEngine::clearUpperRightPart() { + int x1, x2; Common::String st; _mouse.hideMouse(); if (_res == 1) { - co = 634; - cod = 534; + x2 = 634; + x1 = 534; } else { - co = 600; - cod = 544; + x2 = 600; + x1 = 544; } - _screenSurface.fillRect(15, Common::Rect(cod, 93, co, 98)); + // Clear ambiance description + _screenSurface.fillRect(15, Common::Rect(x1, 93, x2, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) @@ -2124,12 +2125,12 @@ void MortevielleEngine::clearScreenType10() { else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - co = 580 - (_screenSurface.getStringWidth(st) / 2); - _screenSurface.putxy(co, 92); + x1 = 580 - (_screenSurface.getStringWidth(st) / 2); + _screenSurface.putxy(x1, 92); _screenSurface.drawString(st, 4); + // Clear person list _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - /* rempli(69,12,32,5,255);*/ _mouse.showMouse(); } @@ -2555,7 +2556,7 @@ void MortevielleEngine::music() { */ void MortevielleEngine::showTitleScreen() { hirs(); - repon(7, 2035); + handleDescriptionText(7, 2035); _caff = 51; _text.taffich(); testKeyboard(); @@ -2736,12 +2737,12 @@ void MortevielleEngine::prepareRoom() { _brt = true; _startHour = readclock(); if (getRandomNumber(1, 5) < 5) { - clearScreenType3(); + clearVerbBar(); prepareScreenType2(); ecr3(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(1, rand, 1); - clearScreenType3(); + clearVerbBar(); } } } @@ -2860,7 +2861,7 @@ void MortevielleEngine::initCaveOrCellar() { _coreVar._faithScore += 2; if (_coreVar._faithScore > 69) _coreVar._faithScore += (_coreVar._faithScore / 10); - clearScreenType3(); + clearVerbBar(); prepareScreenType2(); ecr3(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; @@ -2869,7 +2870,7 @@ void MortevielleEngine::initCaveOrCellar() { // The original was doing here a useless loop. // It has been removed - clearScreenType3(); + clearVerbBar(); displayAloneText(); } @@ -2878,7 +2879,7 @@ void MortevielleEngine::initCaveOrCellar() { * @remarks Originally called 'tctrm' */ void MortevielleEngine::displayControlMenu() { - repon(2, (3000 + _controlMenu)); + handleDescriptionText(2, (3000 + _controlMenu)); _controlMenu = 0; } @@ -2933,41 +2934,49 @@ int MortevielleEngine::animof(int ouf, int num) { return animof_result; } -void MortevielleEngine::text1(int x, int y, int nb, int m) { +/** + * Display text in description bar + * @remarks Originally called 'text1' + */ +void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { int co; if (_res == 1) co = 10; else co = 6; - Common::String tmpStr = getString(m); + Common::String tmpStr = getString(mesgId); if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) y = 176; _text.displayStr(tmpStr, x, y, nb, 20, _textColor); } -void MortevielleEngine::repon(int f, int m) { - if ((m > 499) && (m < 563)) { - Common::String tmpStr = getString(m - 501 + kInventoryStringIndex); +/** + * Display description text + * @remarks Originally called 'repon' + */ +void MortevielleEngine::handleDescriptionText(int f, int mesgId) { + if ((mesgId > 499) && (mesgId < 563)) { + Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); if ((int) tmpStr.size() > ((58 + (_res - 1) * 37) << 1)) _largestClearScreen = true; else _largestClearScreen = false; - clearScreenType2(); + clearDescriptionBar(); _text.displayStr(tmpStr, 8, 176, 85, 3, 5); } else { - modif(m); + mapMessageId(mesgId); switch (f) { case 2: case 8: - clearScreenType2(); + clearDescriptionBar(); prepareScreenType2(); - text1(8, 182, 103, m); - if ((m == 68) || (m == 69)) + displayTextInDescriptionBar(8, 182, 103, mesgId); + if ((mesgId == 68) || (mesgId == 69)) _coreVar._teauto[40] = '*'; - if ((m == 104) && (_caff == 14)) { + if ((mesgId == 104) && (_caff == 14)) { _coreVar._teauto[36] = '*'; if (_coreVar._teauto[39] == '*') { _coreVar._pourc[3] = '*'; @@ -2984,12 +2993,12 @@ void MortevielleEngine::repon(int f, int m) { else i = 5; - Common::String tmpStr = getString(m); + Common::String tmpStr = getString(mesgId); _text.displayStr(tmpStr, 80, 40, 60, 25, i); - if (m == 180) + if (mesgId == 180) _coreVar._pourc[6] = '*'; - else if (m == 179) + else if (mesgId == 179) _coreVar._pourc[10] = '*'; } break; @@ -2999,43 +3008,47 @@ void MortevielleEngine::repon(int f, int m) { } } -void MortevielleEngine::modif(int &nu) { - if (nu == 26) - nu = 25; - else if ((nu > 29) && (nu < 36)) - nu -= 4; - else if ((nu > 69) && (nu < 78)) - nu -= 37; - else if ((nu > 99) && (nu < 194)) - nu -= 59; - else if ((nu > 996) && (nu < 1000)) - nu -= 862; - else if ((nu > 1500) && (nu < 1507)) - nu -= 1363; - else if ((nu > 1507) && (nu < 1513)) - nu -= 1364; - else if ((nu > 1999) && (nu < 2002)) - nu -= 1851; - else if (nu == 2010) - nu = 151; - else if ((nu > 2011) && (nu < 2025)) - nu -= 1860; - else if (nu == 2026) - nu = 165; - else if ((nu > 2029) && (nu < 2037)) - nu -= 1864; - else if ((nu > 3000) && (nu < 3005)) - nu -= 2828; - else if (nu == 4100) - nu = 177; - else if (nu == 4150) - nu = 178; - else if ((nu > 4151) && (nu < 4156)) - nu -= 3973; - else if (nu == 4157) - nu = 183; - else if ((nu == 4160) || (nu == 4161)) - nu -= 3976; +/** + * Recompute message Id + * @remarks Originally called 'modif' + */ +void MortevielleEngine::mapMessageId(int &mesgId) { + if (mesgId == 26) + mesgId = 25; + else if ((mesgId > 29) && (mesgId < 36)) + mesgId -= 4; + else if ((mesgId > 69) && (mesgId < 78)) + mesgId -= 37; + else if ((mesgId > 99) && (mesgId < 194)) + mesgId -= 59; + else if ((mesgId > 996) && (mesgId < 1000)) + mesgId -= 862; + else if ((mesgId > 1500) && (mesgId < 1507)) + mesgId -= 1363; + else if ((mesgId > 1507) && (mesgId < 1513)) + mesgId -= 1364; + else if ((mesgId > 1999) && (mesgId < 2002)) + mesgId -= 1851; + else if (mesgId == 2010) + mesgId = 151; + else if ((mesgId > 2011) && (mesgId < 2025)) + mesgId -= 1860; + else if (mesgId == 2026) + mesgId = 165; + else if ((mesgId > 2029) && (mesgId < 2037)) + mesgId -= 1864; + else if ((mesgId > 3000) && (mesgId < 3005)) + mesgId -= 2828; + else if (mesgId == 4100) + mesgId = 177; + else if (mesgId == 4150) + mesgId = 178; + else if ((mesgId > 4151) && (mesgId < 4156)) + mesgId -= 3973; + else if (mesgId == 4157) + mesgId = 183; + else if ((mesgId == 4160) || (mesgId == 4161)) + mesgId -= 3976; } void MortevielleEngine::initouv() { @@ -3057,7 +3070,7 @@ void MortevielleEngine::ecr2(Common::String text) { _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); } else { _largestClearScreen = true; - clearScreenType2(); + clearDescriptionBar(); _screenSurface.putxy(8, 176); _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); _screenSurface.putxy(8, 182); @@ -3068,7 +3081,7 @@ void MortevielleEngine::ecr2(Common::String text) { } void MortevielleEngine::ecr3(Common::String text) { - clearScreenType3(); + clearVerbBar(); _screenSurface.putxy(8, 192); _screenSurface.drawString(text, 5); } @@ -3296,8 +3309,12 @@ void MortevielleEngine::aniof(int ouf, int num) { prepareScreenType1(); } -void MortevielleEngine::dessin() { - clearScreenType1(); +/** + * Draw Picture + * @remarks Originally called 'dessin' + */ +void MortevielleEngine::drawPicture() { + clearUpperLeftPart(); if (_caff > 99) { draw(kAdrDes, 60, 33); _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box @@ -3332,9 +3349,9 @@ void MortevielleEngine::dessin() { } } -void MortevielleEngine::afdes() { +void MortevielleEngine::drawPictureWithText() { _text.taffich(); - dessin(); + drawPicture(); _okdes = false; } @@ -3374,9 +3391,9 @@ void MortevielleEngine::testKey(bool d) { void MortevielleEngine::tlu(int af, int ob) { _caff = 32; - afdes(); - repon(6, ob + 4000); - repon(2, 999); + drawPictureWithText(); + handleDescriptionText(6, ob + 4000); + handleDescriptionText(2, 999); testKey(true); _caff = af; _msg[3] = OPCODE_NONE; @@ -3517,7 +3534,7 @@ L1: if (!_hiddenHero) { if (_crep == 997) _crep = 138; - repon(2, _crep); + handleDescriptionText(2, _crep); if (_crep == 138) _speechManager.startSpeech(5, 2, 1); else @@ -3544,10 +3561,10 @@ L1: _crep = 137; goto L1; } else { - repon(2, 136); + handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(3, rand, 1); - clearScreenType2(); + clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); affrep(); @@ -3677,11 +3694,11 @@ void MortevielleEngine::treg(int objId) { _caff = objId; if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_msg[4] == OPCODE_SLOOK)) { - afdes(); + drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) - repon(2, _caff); + handleDescriptionText(2, _caff); else - repon(2, _caff + 400); + handleDescriptionText(2, _caff + 400); testKey(true); _caff = mdes; _msg[3] = 0; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index ec7e86f1fa..20390af293 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -323,10 +323,10 @@ private: void endSearch(); int convertCharacterIndexToBitIndex(int characterIndex); int convertBitIndexToCharacterIndex(int bitIndex); - void clearScreenType1(); - void clearScreenType2(); - void clearScreenType3(); - void clearScreenType10(); + void clearUpperLeftPart(); + void clearDescriptionBar(); + void clearVerbBar(); + void clearUpperRightPart(); int getRandomNumber(int minval, int maxval); void showMoveMenuAlert(); void showConfigScreen(); @@ -424,8 +424,8 @@ private: void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); void copcha(); void adzon(); - void text1(int x, int y, int nb, int m); - void modif(int &nu); + void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); + void mapMessageId(int &mesgId); void initouv(); void phaz(int &rand, int &p, int cf); void writetp(Common::String s, int t); @@ -437,8 +437,8 @@ private: void ecr3(Common::String text); void init_nbrepm(); void aniof(int ouf, int num); - void dessin(); - void afdes(); + void drawPicture(); + void drawPictureWithText(); void tlu(int af, int ob); void affrep(); void mennor(); @@ -522,7 +522,7 @@ public: void hirs(); int testou(); - void repon(int f, int m); + void handleDescriptionText(int f, int mesgId); int animof(int ouf, int num); void pictout(int seg, int dep, int x, int y); void sauvecr(int y, int dy); -- cgit v1.2.3 From 957c220556b6c643a27bafc400f064addc853cd0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 12 Oct 2012 07:31:30 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 20 ++++++++++---------- engines/mortevielle/mortevielle.cpp | 37 ++++++++++++++++++++----------------- engines/mortevielle/mortevielle.h | 6 +++--- engines/mortevielle/outtext.cpp | 2 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 2e4a237d53..9aca451685 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -52,7 +52,7 @@ void MortevielleEngine::fctMove() { tfleche(); if (_keyPressedEsc) - _okdes = false; + _destinationOk = false; if ((_anyone) || (_keyPressedEsc)) return; @@ -180,7 +180,7 @@ void MortevielleEngine::fctMove() { void MortevielleEngine::fctTake() { if (_caff > 99) { int cx = _caff; - avpoing(cx); + putInHand(cx); if (_crep != 139) { if (_currBitIndex > 0) _coreVar._faithScore += 3; @@ -236,34 +236,34 @@ void MortevielleEngine::fctTake() { _coreVar._faithScore += 3; _crep = 997; if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) - avpoing(_coreVar._purpleRoomObjectId); + putInHand(_coreVar._purpleRoomObjectId); if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { - avpoing(_coreVar._atticBallHoleObjectId); + putInHand(_coreVar._atticBallHoleObjectId); if ((_crep != 997) && (_crep != 139)) aniof(2, 7); } if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { - avpoing(_coreVar._atticRodHoleObjectId); + putInHand(_coreVar._atticRodHoleObjectId); if ((_crep != 997) && (_crep != 139)) aniof(2, 6); } if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { - avpoing(_coreVar._cellarObjectId); + putInHand(_coreVar._cellarObjectId); if ((_crep != 997) && (_crep != 139)) aniof(2, 2); } if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) - avpoing(_coreVar._cryptObjectId); + putInHand(_coreVar._cryptObjectId); if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) { - avpoing(_coreVar._secretPassageObjectId); + putInHand(_coreVar._secretPassageObjectId); if ((_crep != 997) && (_crep != 139)) { _crep = 182; aniof(2, 1); } } if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { - avpoing(_coreVar._wellObjectId); + putInHand(_coreVar._wellObjectId); if ((_crep != 997) && (_crep != 139)) aniof(2, 1); } @@ -312,7 +312,7 @@ void MortevielleEngine::fctInventoryTake() { cz = ord(_coreVar._sjer[cy]); _coreVar._sjer[cy] = chr(0); _menu.setInventoryText(); - avpoing(cz); + putInHand(cz); _crep = 998; clearDescriptionBar(); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index a6fda733f2..df80408b63 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -102,9 +102,9 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _col = false; _syn = false; _obpart = false; - _okdes = false; + _destinationOk = false; _anyone = false; - _brt = false; + _uptodatePresence = false; _textColor = 0; _currGraphicalDevice = -1; @@ -116,7 +116,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _day = 0; memset(_mem, 0, sizeof(_mem)); - _anyone = false; } MortevielleEngine::~MortevielleEngine() { @@ -720,8 +719,8 @@ void MortevielleEngine::handleAction() { if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { g_vm->_text.taffich(); - if (_okdes) { - _okdes = false; + if (_destinationOk) { + _destinationOk = false; drawPicture(); } if ((!_syn) || (_col)) @@ -1694,7 +1693,7 @@ void MortevielleEngine::loseGame() { clearVerbBar(); _col = false; _syn = false; - _okdes = false; + _destinationOk = false; } /** @@ -1810,7 +1809,7 @@ void MortevielleEngine::checkManorDistance() { _crep = 1506; loseGame(); } else { - _okdes = true; + _destinationOk = true; _coreVar._currPlace = MOUNTAIN; affrep(); } @@ -1878,10 +1877,10 @@ void MortevielleEngine::gameLoaded() { _menu._menuDisplayed = false; _loseGame = true; _anyone = false; - _okdes = true; + _destinationOk = true; _col = false; _hiddenHero = false; - _brt = false; + _uptodatePresence = false; _maff = 68; _menuOpcode = OPCODE_NONE; _prebru = 0; @@ -1903,7 +1902,7 @@ void MortevielleEngine::gameLoaded() { affrep(); _hintPctMessage = getString(580); - _okdes = false; + _destinationOk = false; _endGame = true; _loseGame = false; _heroSearching = false; @@ -1932,7 +1931,7 @@ void MortevielleEngine::handleOpcode() { _syn = false; _keyPressedEsc = false; if (!_anyone) { - if (_brt) { + if (_uptodatePresence) { if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { _controlMenu = 4; mennor(); @@ -2733,8 +2732,8 @@ void MortevielleEngine::prepareRoom() { initCaveOrCellar(); } else if (_currBitIndex == 10) { _currBitIndex = 0; - if (!_brt) { - _brt = true; + if (!_uptodatePresence) { + _uptodatePresence = true; _startHour = readclock(); if (getRandomNumber(1, 5) < 5) { clearVerbBar(); @@ -2753,9 +2752,9 @@ void MortevielleEngine::prepareRoom() { } } _endHour = readclock(); - if ((_brt) && ((_endHour - _startHour) > 17)) { + if ((_uptodatePresence) && ((_endHour - _startHour) > 17)) { getPresenceBitIndex(_place); - _brt = false; + _uptodatePresence = false; _startHour = 0; if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; @@ -3352,7 +3351,7 @@ void MortevielleEngine::drawPicture() { void MortevielleEngine::drawPictureWithText() { _text.taffich(); drawPicture(); - _okdes = false; + _destinationOk = false; } /** @@ -3710,7 +3709,11 @@ void MortevielleEngine::treg(int objId) { } } -void MortevielleEngine::avpoing(int &objId) { +/** + * Engine function - Put in hand + * @remarks Originally called 'avpoing' + */ +void MortevielleEngine::putInHand(int &objId) { _crep = 999; if (_coreVar._selectedObjectId != 0) ajjer(_coreVar._selectedObjectId); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 20390af293..390ff7a1ef 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -243,7 +243,7 @@ private: bool _syn; bool _obpart; bool _anyone; - bool _brt; + bool _uptodatePresence; int _textColor; int _place; @@ -445,7 +445,7 @@ private: void ajjer(int ob); void tsuiv(); void treg(int objId); - void avpoing(int &objId); + void putInHand(int &objId); void rechai(int &ch); void fenat(char ans); @@ -456,7 +456,7 @@ public: byte _tabdon[4001]; bool _soundOff; bool _blo; - bool _okdes; + bool _destinationOk; bool _largestClearScreen; int _currGraphicalDevice; int _newGraphicalDevice; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 9e903bb133..e105002f7c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -242,7 +242,7 @@ void TextHandler::taffich() { break; } - g_vm->_okdes = true; + g_vm->_destinationOk = true; g_vm->_mouse.hideMouse(); lgt = 0; Common::String filename; -- cgit v1.2.3 From 121039101d1b48eaad9e2da6935ff008a02061d1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 12 Oct 2012 07:46:58 +0200 Subject: MORTEVIELLE: Remove dead code. m was computed to in order to display a message while loading the next resource. As there are no more delays, the message isn't displayed anymore, thus it's useless to compute the message id. --- engines/mortevielle/actions.cpp | 1 - engines/mortevielle/mortevielle.cpp | 5 +---- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/outtext.cpp | 23 ----------------------- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9aca451685..5bcaf4cf03 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -512,7 +512,6 @@ void MortevielleEngine::fctSearch() { rechai(_mchai); if (_mchai != 0) { _cs = 0; - _is = 0; _heroSearching = true; _menu.setSearchMenu(); tsuiv(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index df80408b63..e4e9610f4a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -1753,7 +1753,6 @@ void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; _cs = 0; - _is = 0; _menu.unsetSearchMenu(); } @@ -1890,7 +1889,6 @@ void MortevielleEngine::gameLoaded() { _startHour = 0; _endHour = 0; _cs = 0; - _is = 0; _roomDoorId = OWN_ROOM; _syn = true; _heroSearching = true; @@ -3584,8 +3582,7 @@ void MortevielleEngine::tsuiv() { tbcl = _tabdon[cl]; } while ((tbcl == 0) && (_cs <= 9)); - if ((tbcl != 0) && (_cs < 11)) { // 2nd check useless as _cs is <= 10 - ++_is; + if ((tbcl != 0) && (_cs < 11)) { _caff = tbcl; _crep = _caff + 400; if (_currBitIndex != 0) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 390ff7a1ef..59fd6f645b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -470,7 +470,7 @@ public: int _res; int _caff; int _crep; - byte _is; +// byte _is; byte _v_lieu[7][25]; // TODO: Replace the following with proper implementations, or refactor out the code using them diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e105002f7c..e18c5c1692 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -248,29 +248,6 @@ void TextHandler::taffich() { Common::String filename; if ((a != 50) && (a != 51)) { - int m = a + 2000; - if ((m > 2001) && (m < 2010)) - m = 2001; - if (m == 2011) - m = 2010; - if (a == 32) - m = 2034; - if ((a == 17) && (g_vm->_maff == 14)) - m = 2018; - - if (a > 99) { - if ((g_vm->_is == 1) || (g_vm->_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) && (((g_vm->_maff > 69) && (!g_vm->_coreVar._alreadyEnteredManor)) || (g_vm->_maff > 99))) || ((g_vm->_maff > 29) && (g_vm->_maff < 33))) - m = 2033; - g_vm->_maff = a; if (a == 159) a = 86; -- cgit v1.2.3 From c33462da12e9704ad196edf29ee48d0c90d0f0d7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 13 Oct 2012 12:10:48 +0200 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 65 ++++++++++++++++++++++--------------- engines/mortevielle/mortevielle.cpp | 50 ++++++++++++++-------------- engines/mortevielle/mortevielle.h | 23 +++++++------ 3 files changed, 74 insertions(+), 64 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5bcaf4cf03..1bf64cca0f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -205,7 +205,7 @@ void MortevielleEngine::fctTake() { _obpart = false; affrep(); } else { - _tabdon[kAcha + ((_mchai - 1) * 10) + _cs - 1] = 0; + _tabdon[kAcha + ((_mchai - 1) * 10) + _searchCount - 1] = 0; tsuiv(); ++_takeObjCount; if (_takeObjCount > 6) { @@ -502,8 +502,8 @@ void MortevielleEngine::fctSearch() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_touv[cx]))); - if (_num != ord(_touv[cx])) + } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); + if (_num != ord(_openObjects[cx])) _crep = 187; else { if (_currBitIndex > 0) @@ -511,7 +511,7 @@ void MortevielleEngine::fctSearch() { rechai(_mchai); if (_mchai != 0) { - _cs = 0; + _searchCount = 0; _heroSearching = true; _menu.setSearchMenu(); tsuiv(); @@ -590,7 +590,7 @@ void MortevielleEngine::fctOpen() { return; } - if (_caff == 15) { + if (_caff == LANDING) { showMoveMenuAlert(); return; } @@ -607,21 +607,31 @@ void MortevielleEngine::fctOpen() { int tmpPlace = 0; do { ++tmpPlace; - } while (!((tmpPlace > 6) || (ord(_touv[tmpPlace]) == 0) || (ord(_touv[tmpPlace]) == _num))); - if (ord(_touv[tmpPlace]) != _num) { - if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == ROOM9) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) - || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) + } while (!((tmpPlace > 6) || (ord(_openObjects[tmpPlace]) == 0) || (ord(_openObjects[tmpPlace]) == _num))); + if (ord(_openObjects[tmpPlace]) != _num) { + if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) + || (_coreVar._currPlace == ROOM9) + || (_coreVar._currPlace == BLUE_ROOM) + || (_coreVar._currPlace == BATHROOM))) + || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) + || (_coreVar._currPlace == PURPLE_ROOM) + || (_coreVar._currPlace == RED_ROOM))) || ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 5)) - || ((_num == 6) && ((_coreVar._currPlace == BATHROOM) || (_coreVar._currPlace == DINING_ROOM) || (_coreVar._currPlace == GREEN_ROOM2) || (_coreVar._currPlace == ATTIC))) + || ((_num == 6) && ((_coreVar._currPlace == BATHROOM) + || (_coreVar._currPlace == DINING_ROOM) + || (_coreVar._currPlace == GREEN_ROOM2) + || (_coreVar._currPlace == ATTIC))) || ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 2)) || ((_coreVar._currPlace == KITCHEN) && (_num == 7))) ) { if ( ((_coreVar._currPlace > DINING_ROOM) && (_coreVar._currPlace < CELLAR)) || ((_coreVar._currPlace > RED_ROOM) && (_coreVar._currPlace < DINING_ROOM)) - || (_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { + || (_coreVar._currPlace == OWN_ROOM) + || (_coreVar._currPlace == PURPLE_ROOM) + || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } - _touv[tmpPlace] = chr(_num); + _openObjects[tmpPlace] = chr(_num); aniof(1, _num); } tmpPlace = _coreVar._currPlace; @@ -631,6 +641,7 @@ void MortevielleEngine::fctOpen() { if (_crep == 254) _crep = 999; } else + // display "Already Opened" _crep = 18; } } @@ -874,11 +885,11 @@ void MortevielleEngine::fctClose() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_touv[cx]))); - if (_num == ord(_touv[cx])) { + } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); + if (_num == ord(_openObjects[cx])) { aniof(2, _num); _crep = 998; - _touv[cx] = chr(0); + _openObjects[cx] = chr(0); --_openObjCount; if (_openObjCount < 0) _openObjCount = 0; @@ -973,8 +984,8 @@ void MortevielleEngine::fctSelfPut() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_touv[cx]))); - if (_num != ord(_touv[cx])) + } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); + if (_num != ord(_openObjects[cx])) _crep = 187; else { _mchai = chai; @@ -1106,7 +1117,7 @@ void MortevielleEngine::fctEat() { h = 1; } - _jh += h; + _currentHourCount += h; _crep = 135; prepareRoom(); } else { @@ -1138,15 +1149,15 @@ void MortevielleEngine::fctEnter() { if ((_roomDoorId == TOILETS) || (_roomDoorId == BATHROOM)) _crep = 179; else { - _x = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, _x, 1); + int randVal = (getRandomNumber(0, 10)) - 5; + _speechManager.startSpeech(7, randVal, 1); aniof(1, 1); - _x = convertBitIndexToCharacterIndex(z); + int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _msg[3] = MENU_DISCUSS; - _msg[4] = _menu._discussMenu[_x]; + _msg[4] = _menu._discussMenu[charIndex]; _syn = true; if (_roomDoorId == ROOM9) { _col = true; @@ -1159,8 +1170,8 @@ void MortevielleEngine::fctEnter() { _roomDoorId = OWN_ROOM; } } else { - _x = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, _x, 1); + int randVal = (getRandomNumber(0, 10)) - 5; + _speechManager.startSpeech(7, randVal, 1); aniof(1, 1); _coreVar._currPlace = _roomDoorId; @@ -1206,10 +1217,10 @@ void MortevielleEngine::fctSleep() { z = (7 - h) * 2; if (m == 30) --z; - _jh += z; + _currentHourCount += z; h = 7; } - _jh += 2; + _currentHourCount += 2; ++h; if (h > 23) h = 0; @@ -1288,7 +1299,7 @@ void MortevielleEngine::fctWait() { int answer; do { - ++_jh; + ++_currentHourCount; prepareRoom(); if (!_blo) getPresence(_coreVar._currPlace); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index e4e9610f4a..68889b4796 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -791,7 +791,7 @@ void MortevielleEngine::prepareScreenType3() { */ void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { int newHour = readclock(); - int th = _jh + ((newHour - _mh) / _t); + int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration); minute = ((th % 2) + _currHalfHour) * 30; hour = ((uint)th >> 1) + _currHour; if (minute == 60) { @@ -1455,11 +1455,11 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) { */ void MortevielleEngine::initGame() { _place = MANOR_FRONT; - _jh = 0; + _currentHourCount = 0; if (!_coreVar._alreadyEnteredManor) _blo = true; - _t = kTime1; - _mh = readclock(); + _inGameHourDuration = kTime1; + _currentDayHour = readclock(); } /** @@ -1649,10 +1649,10 @@ void MortevielleEngine::startMusicOrSpeech(int so) { if (so == 0) { /* musik(0) */ ; - } else if ((_prebru == 0) && (!_coreVar._alreadyEnteredManor)) { + } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech _speechManager.startSpeech(10, 1, 1); - ++_prebru; + _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech @@ -1752,7 +1752,7 @@ void MortevielleEngine::startDialog(int16 rep) { void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; - _cs = 0; + _searchCount = 0; _menu.unsetSearchMenu(); } @@ -1882,13 +1882,13 @@ void MortevielleEngine::gameLoaded() { _uptodatePresence = false; _maff = 68; _menuOpcode = OPCODE_NONE; - _prebru = 0; + _introSpeechPlayed = false; _x = 0; _y = 0; _num = 0; _startHour = 0; _endHour = 0; - _cs = 0; + _searchCount = 0; _roomDoorId = OWN_ROOM; _syn = true; _heroSearching = true; @@ -2667,22 +2667,22 @@ void MortevielleEngine::prepareRoom() { if (!_blo) { if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - _t = kTime2; + _inGameHourDuration = kTime2; else - _t = kTime1; + _inGameHourDuration = kTime1; cf = _coreVar._faithScore; if ((cf > 33) && (cf < 66)) - _t -= (_t / 3); + _inGameHourDuration -= (_inGameHourDuration / 3); if (cf > 65) - _t -= ((_t / 3) * 2); + _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); - int nh = readclock(); - if ((nh - _mh) > _t) { + int newHour = readclock(); + if ((newHour - _currentDayHour) > _inGameHourDuration) { bool activeMenu = _menu._menuActive; _menu.eraseMenu(); - _jh += ((nh - _mh) / _t); - _mh = nh; + _currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration); + _currentDayHour = newHour; switch (_place) { case GREEN_ROOM: case DARKBLUE_ROOM: @@ -3050,7 +3050,7 @@ void MortevielleEngine::mapMessageId(int &mesgId) { void MortevielleEngine::initouv() { for (int cx = 1; cx <= 7; ++cx) - _touv[cx] = chr(0); + _openObjects[cx] = chr(0); } void MortevielleEngine::ecr2(Common::String text) { @@ -3323,8 +3323,8 @@ void MortevielleEngine::drawPicture() { prepareScreenType1(); if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { - if (ord(_touv[cx]) != 0) - aniof(1, ord(_touv[cx])); + if (ord(_openObjects[cx]) != 0) + aniof(1, ord(_openObjects[cx])); } if (_caff == 13) { @@ -3415,7 +3415,7 @@ void MortevielleEngine::exitRoom() { } for (int cx = 1; cx <= 7; ++cx) - _touv[cx] = chr(0); + _openObjects[cx] = chr(0); _roomDoorId = OWN_ROOM; _openObjCount = 0; _mchai = 0; @@ -3577,12 +3577,12 @@ void MortevielleEngine::tsuiv() { int cx = 0; do { ++cx; - ++_cs; - int cl = cy + _cs; + ++_searchCount; + int cl = cy + _searchCount; tbcl = _tabdon[cl]; - } while ((tbcl == 0) && (_cs <= 9)); + } while ((tbcl == 0) && (_searchCount <= 9)); - if ((tbcl != 0) && (_cs < 11)) { + if ((tbcl != 0) && (_searchCount < 11)) { _caff = tbcl; _crep = _caff + 400; if (_currBitIndex != 0) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 59fd6f645b..a57a304ad1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -267,23 +267,22 @@ private: int _openObjCount; int _takeObjCount; int _num; - int _cs; - int _prebru; - int _t; + int _searchCount; + bool _introSpeechPlayed; + int _inGameHourDuration; int _x; int _y; - int _jh; - int _mh; - + int _currentHourCount; + int _currentDayHour; Common::String _hintPctMessage; - byte *_cfiecBuffer; - int _cfiecBufferSize; - byte _touv[8]; - int _nbrep[9]; - int _nbrepm[9]; + byte *_cfiecBuffer; + int _cfiecBufferSize; + byte _openObjects[8]; + int _nbrep[9]; + int _nbrepm[9]; uint16 _inpBuffer[kMaxTi + 1]; - Hint _ntpBuffer[kMaxTd + 1]; + Hint _ntpBuffer[kMaxTd + 1]; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); -- cgit v1.2.3 From d7a9cfb80fd574643130f8ea43ff2f206627614c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 13 Oct 2012 12:41:27 +0200 Subject: MORTEVIELLE: rework _openObjects use, rename resetOpenObjects --- engines/mortevielle/actions.cpp | 20 ++++++++++---------- engines/mortevielle/mortevielle.cpp | 24 +++++++++++++----------- engines/mortevielle/mortevielle.h | 4 ++-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1bf64cca0f..2f4af8538d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -502,8 +502,8 @@ void MortevielleEngine::fctSearch() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); - if (_num != ord(_openObjects[cx])) + } while ((cx <= 6) && (_num != _openObjects[cx])); + if (_num != _openObjects[cx]) _crep = 187; else { if (_currBitIndex > 0) @@ -607,8 +607,8 @@ void MortevielleEngine::fctOpen() { int tmpPlace = 0; do { ++tmpPlace; - } while (!((tmpPlace > 6) || (ord(_openObjects[tmpPlace]) == 0) || (ord(_openObjects[tmpPlace]) == _num))); - if (ord(_openObjects[tmpPlace]) != _num) { + } while (!((tmpPlace > 6) || (_openObjects[tmpPlace] == 0) || (_openObjects[tmpPlace] == _num))); + if (_openObjects[tmpPlace] != _num) { if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == ROOM9) || (_coreVar._currPlace == BLUE_ROOM) @@ -631,7 +631,7 @@ void MortevielleEngine::fctOpen() { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } - _openObjects[tmpPlace] = chr(_num); + _openObjects[tmpPlace] = _num; aniof(1, _num); } tmpPlace = _coreVar._currPlace; @@ -885,11 +885,11 @@ void MortevielleEngine::fctClose() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); - if (_num == ord(_openObjects[cx])) { + } while ((cx <= 6) && (_num != _openObjects[cx])); + if (_num == _openObjects[cx]) { aniof(2, _num); _crep = 998; - _openObjects[cx] = chr(0); + _openObjects[cx] = 0; --_openObjCount; if (_openObjCount < 0) _openObjCount = 0; @@ -984,8 +984,8 @@ void MortevielleEngine::fctSelfPut() { int cx = 0; do { ++cx; - } while ((cx <= 6) && (_num != ord(_openObjects[cx]))); - if (_num != ord(_openObjects[cx])) + } while ((cx <= 6) && (_num != _openObjects[cx])); + if (_num != _openObjects[cx]) _crep = 187; else { _mchai = chai; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 68889b4796..088c8809cd 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -1677,9 +1677,8 @@ void MortevielleEngine::startMusicOrSpeech(int so) { * @remarks Originally called 'tperd' */ void MortevielleEngine::loseGame() { - initouv(); + resetOpenObjects(); _roomDoorId = OWN_ROOM; - _openObjCount = 0; _mchai = 0; _menu.unsetSearchMenu(); if (!_blo) @@ -1894,8 +1893,7 @@ void MortevielleEngine::gameLoaded() { _heroSearching = true; _mchai = 0; _manorDistance = 0; - initouv(); - _openObjCount = 0; + resetOpenObjects(); _takeObjCount = 0; affrep(); _hintPctMessage = getString(580); @@ -3048,9 +3046,14 @@ void MortevielleEngine::mapMessageId(int &mesgId) { mesgId -= 3976; } -void MortevielleEngine::initouv() { +/** + * Initialize open objects array + * @remarks Originally called 'initouv' + */ +void MortevielleEngine::resetOpenObjects() { for (int cx = 1; cx <= 7; ++cx) - _openObjects[cx] = chr(0); + _openObjects[cx] = 0; + _openObjCount = 0; } void MortevielleEngine::ecr2(Common::String text) { @@ -3323,8 +3326,8 @@ void MortevielleEngine::drawPicture() { prepareScreenType1(); if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { - if (ord(_openObjects[cx]) != 0) - aniof(1, ord(_openObjects[cx])); + if (_openObjects[cx] != 0) + aniof(1, _openObjects[cx]); } if (_caff == 13) { @@ -3414,10 +3417,9 @@ void MortevielleEngine::exitRoom() { _coreVar._faithScore += (_coreVar._faithScore / 10); } - for (int cx = 1; cx <= 7; ++cx) - _openObjects[cx] = chr(0); + resetOpenObjects(); + _roomDoorId = OWN_ROOM; - _openObjCount = 0; _mchai = 0; resetRoomVariables(_coreVar._currPlace); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index a57a304ad1..7e0f717142 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -278,7 +278,7 @@ private: Common::String _hintPctMessage; byte *_cfiecBuffer; int _cfiecBufferSize; - byte _openObjects[8]; + int _openObjects[8]; int _nbrep[9]; int _nbrepm[9]; uint16 _inpBuffer[kMaxTi + 1]; @@ -425,7 +425,7 @@ private: void adzon(); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void mapMessageId(int &mesgId); - void initouv(); + void resetOpenObjects(); void phaz(int &rand, int &p, int cf); void writetp(Common::String s, int t); void premtet(); -- cgit v1.2.3 From ad3c7febd7b5f03d72b30e6ff1d0e8cbd2114b8f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 14 Oct 2012 10:28:03 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 159 +++++++++++++++++++----------------- engines/mortevielle/menu.cpp | 5 +- engines/mortevielle/mortevielle.cpp | 41 ++++++---- engines/mortevielle/mortevielle.h | 5 +- engines/mortevielle/mouse.cpp | 14 ++-- engines/mortevielle/mouse.h | 2 +- engines/mortevielle/saveload.cpp | 2 +- 7 files changed, 122 insertions(+), 106 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 2f4af8538d..6d8e095a3a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -298,19 +298,19 @@ void MortevielleEngine::fctTake() { * @remarks Originally called 'tsprendre' */ void MortevielleEngine::fctInventoryTake() { - int cx = 0; + int inventIndex = 0; do { - ++cx; - } while (_menu._inventoryMenu[cx] != _msg[4]); + ++inventIndex; + } while (_menu._inventoryMenu[inventIndex] != _msg[4]); int cz = 0; int cy = 0; do { ++cy; - if (ord(_coreVar._sjer[cy]) != 0) + if (_coreVar._inventory[cy] != 0) ++cz; - } while (cz != cx); - cz = ord(_coreVar._sjer[cy]); - _coreVar._sjer[cy] = chr(0); + } while (cz != inventIndex); + cz = _coreVar._inventory[cy]; + _coreVar._inventory[cy] = 0; _menu.setInventoryText(); putInHand(cz); _crep = 998; @@ -1342,15 +1342,18 @@ void MortevielleEngine::fctSound() { * @remarks Originally called 'tparler' */ void MortevielleEngine::fctDiscuss() { - bool te[47]; - int cy, cx, max, suj, co, lig, icm, i, choi, x, y, c; - char tou; + bool questionAsked[47]; + int cy, cx; + int x, y; +// int c; Common::String lib[47]; - bool f; + + int choice; + int displId; endSearch(); if (_col) - suj = 128; + displId = 128; else { cx = 0; do { @@ -1359,54 +1362,55 @@ void MortevielleEngine::fctDiscuss() { _caff = 69 + cx; drawPictureWithText(); handleDescriptionText(2, _caff); - suj = _caff + 60; + displId = _caff + 60; } testKey(false); mennor(); _mouse.hideMouse(); hirs(); premtet(); - startDialog(suj); + startDialog(displId); hirs(); for (int ix = 1; ix <= 46; ++ix) - te[ix] = false; + questionAsked[ix] = false; for (int ix = 1; ix <= 45; ++ix) { lib[ix] = getString(ix + kQuestionStringIndex); - for (i = lib[ix].size(); i <= 40; ++i) + for (int i = lib[ix].size(); i <= 40; ++i) lib[ix] = lib[ix] + ' '; } lib[46] = lib[45]; lib[45] = ' '; _mouse.showMouse(); do { - choi = 0; - icm = 0; - co = 0; - lig = 0; - do { - ++icm; - _screenSurface.putxy(co, lig); + choice = 0; + int posX = 0; + int posY = 0; + for (int icm = 1; icm < 43; icm++) { + _screenSurface.putxy(posX, posY); if (_coreVar._teauto[icm] == '*') { - if (te[icm]) + // If question already asked, write it in reverse video + if (questionAsked[icm]) writetp(lib[icm], 1); else writetp(lib[icm], 0); } if (icm == 23) { - lig = 0; - co = 320; + posY = 0; + posX = 320; } else - lig = lig + 8; - } while (icm != 42); + posY += 8; + } _screenSurface.putxy(320, 176); writetp(lib[46], 0); - tou = '\0'; + char retKey = '\0'; + bool click; do { - _mouse.moveMouse(f, tou); + bool dummyFl; + _mouse.moveMouse(dummyFl, retKey); CHECK_QUIT; - _mouse.getMousePosition(x, y, c); + _mouse.getMousePosition(x, y, click); x *= (3 - _res); if (x > 319) cx = 41; @@ -1414,95 +1418,98 @@ void MortevielleEngine::fctDiscuss() { cx = 1; cy = ((uint)y >> 3) + 1; // 0-199 => 1-25 if ((cy > 23) || ((cx == 41) && ((cy >= 20) && (cy <= 22)))) { - if (choi != 0) { - lig = ((choi - 1) % 23) << 3; - if (choi > 23) - co = 320; + if (choice != 0) { + posY = ((choice - 1) % 23) << 3; + if (choice > 23) + posX = 320; else - co = 0; - _screenSurface.putxy(co, lig); - if (te[choi]) - writetp(lib[choi], 0); + posX = 0; + _screenSurface.putxy(posX, posY); + if (questionAsked[choice]) + writetp(lib[choice], 0); else - writetp(lib[choi], 1); - te[choi] = !te[choi]; - choi = 0; + writetp(lib[choice], 1); + questionAsked[choice] = !questionAsked[choice]; + choice = 0; } } else { int ix = cy; if (cx == 41) ix += 23; - if (ix != choi) { - if (choi != 0) { - lig = ((choi - 1) % 23) << 3; - if (choi > 23) - co = 320; + if (ix != choice) { + if (choice != 0) { + posY = ((choice - 1) % 23) << 3; + if (choice > 23) + posX = 320; else - co = 0; - _screenSurface.putxy(co, lig); - if (te[choi]) - writetp(lib[choi], 0); + posX = 0; + _screenSurface.putxy(posX, posY); + if (questionAsked[choice]) + writetp(lib[choice], 0); else - writetp(lib[choi], 1); - te[choi] = ! te[choi]; + writetp(lib[choice], 1); + questionAsked[choice] = ! questionAsked[choice]; } if ((_coreVar._teauto[ix] == '*') || (ix == 46)) { - lig = ((ix - 1) % 23) << 3; + posY = ((ix - 1) % 23) << 3; if (ix > 23) - co = 320; + posX = 320; else - co = 0; - _screenSurface.putxy(co, lig); - if (te[ix]) + posX = 0; + _screenSurface.putxy(posX, posY); + if (questionAsked[ix]) writetp(lib[ix], 0); else writetp(lib[ix], 1); - te[ix] = ! te[ix]; - choi = ix; + questionAsked[ix] = ! questionAsked[ix]; + choice = ix; } else - choi = 0; + choice = 0; } } - } while (!((tou == '\15') || (((c != 0) || getMouseClick()) && (choi != 0)))); + } while (!((retKey == '\15') || (((click != 0) || getMouseClick()) && (choice != 0)))); setMouseClick(false); - if (choi != 46) { - int ix = choi - 1; + + // If choice is not "End of Conversation" + if (choice != 46) { + int ix = choice - 1; if (_col) { _col = false; _coreVar._currPlace = 15; + int maxRandVal; if (_openObjCount > 0) - max = 8; + maxRandVal = 8; else - max = 4; - if (getRandomNumber(1, max) == 2) - suj = 129; + maxRandVal = 4; + if (getRandomNumber(1, maxRandVal) == 2) + displId = 129; else { - suj = 138; + displId = 138; _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } } else if (_nbrep[_caff - 69] < _nbrepm[_caff - 69]) { - suj = _tabdon[kArep + (ix << 3) + (_caff - 70)]; + displId = _tabdon[kArep + (ix << 3) + (_caff - 70)]; _coreVar._faithScore += _tabdon[kArcf + ix]; ++_nbrep[_caff - 69]; } else { _coreVar._faithScore += 3; - suj = 139; + displId = 139; } _mouse.hideMouse(); hirs(); premtet(); - startDialog(suj); + startDialog(displId); _mouse.showMouse(); - if ((suj == 84) || (suj == 86)) { + if ((displId == 84) || (displId == 86)) { _coreVar._pourc[5] = '*'; _coreVar._teauto[7] = '*'; } - if ((suj == 106) || (suj == 108) || (suj == 94)) { + if ((displId == 106) || (displId == 108) || (displId == 94)) { for (int indx = 29; indx <= 31; ++indx) _coreVar._teauto[indx] = '*'; _coreVar._pourc[7] = '*'; } - if (suj == 70) { + if (displId == 70) { _coreVar._pourc[8] = '*'; _coreVar._teauto[32] = '*'; } @@ -1510,7 +1517,7 @@ void MortevielleEngine::fctDiscuss() { hirs(); _mouse.showMouse(); } - } while ((choi != 46) && (suj != 138)); + } while ((choice != 46) && (displId != 138)); if (_col) { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); _mouse.hideMouse(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 99509f8490..f03d6661e4 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -576,14 +576,13 @@ void Menu::unsetSearchMenu() { * @remarks Originally called 'modinv' */ void Menu::setInventoryText() { - int r; Common::String nomp; int cy = 0; for (int i = 1; i <= 6; ++i) { - if (g_vm->_coreVar._sjer[i] != chr(0)) { + if (g_vm->_coreVar._inventory[i] != 0) { ++cy; - r = (ord(g_vm->_coreVar._sjer[i]) + 400); + int r = g_vm->_coreVar._inventory[i] + 400; nomp = g_vm->getString(r - 501 + kInventoryStringIndex); setText(_inventoryMenu[cy], nomp); enableMenuItem(_inventoryMenu[i]); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 088c8809cd..782c811b1f 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -1702,7 +1702,7 @@ void MortevielleEngine::loseGame() { bool MortevielleEngine::checkInventory(int objectId) { bool retVal = false; for (int i = 1; i <= 6; ++i) - retVal = (retVal || (ord(_coreVar._sjer[i]) == objectId)); + retVal = (retVal || (_coreVar._inventory[i] == objectId)); if (_coreVar._selectedObjectId == objectId) retVal = true; @@ -2234,7 +2234,7 @@ Common::String MortevielleEngine::getString(int num) { Common::String wrkStr = ""; if (num < 0) { - warning("deline: num < 0! Skipping"); + warning("getString(%d): num < 0! Skipping", num); } else if (!_txxFileFl) { wrkStr = getGameString(num); } else { @@ -2285,9 +2285,11 @@ void MortevielleEngine::resetVariables() { _coreVar._currPlace = MANOR_FRONT; for (int i = 2; i <= 6; ++i) - _coreVar._sjer[i] = chr(0); + _coreVar._inventory[i] = 0; + + // Only object in inventory: a gun + _coreVar._inventory[1] = 113; - _coreVar._sjer[1] = chr(113); _coreVar._fullHour = chr(20); for (int i = 1; i <= 10; ++i) @@ -3361,7 +3363,8 @@ void MortevielleEngine::drawPictureWithText() { */ void MortevielleEngine::testKey(bool d) { bool quest = false; - int x, y, c; + int x, y; + bool click; _mouse.hideMouse(); fenat('K'); @@ -3371,18 +3374,18 @@ void MortevielleEngine::testKey(bool d) { _key = testou(); do { - _mouse.getMousePosition(x, y, c); + _mouse.getMousePosition(x, y, click); keyPressed(); - } while (c != 0); + } while (click); // Event loop do { if (d) prepareRoom(); quest = keyPressed(); - _mouse.getMousePosition(x, y, c); + _mouse.getMousePosition(x, y, click); CHECK_QUIT; - } while (!(quest || (c != 0) || (d && _anyone))); + } while (!(quest || (click) || (d && _anyone))); if (quest) testou(); setMouseClick(false); @@ -3506,16 +3509,21 @@ void MortevielleEngine::ajchai() { _crep = 192; } -void MortevielleEngine::ajjer(int ob) { - int cx = 0; +/** + * Check if inventory is full and, if not, add object in it. + * @remarks Originally called 'ajjer' + */ +void MortevielleEngine::addObjectToInventory(int objectId) { + int i = 0; do { - ++cx; - } while ((cx <= 5) && (ord(_coreVar._sjer[cx]) != 0)); + ++i; + } while ((i <= 5) && (_coreVar._inventory[i] != 0)); - if (ord(_coreVar._sjer[cx]) == 0) { - _coreVar._sjer[(cx)] = chr(ob); + if (_coreVar._inventory[i] == 0) { + _coreVar._inventory[i] = objectId; _menu.setInventoryText(); } else + // Inventory is full _crep = 139; } @@ -3715,8 +3723,9 @@ void MortevielleEngine::treg(int objId) { void MortevielleEngine::putInHand(int &objId) { _crep = 999; if (_coreVar._selectedObjectId != 0) - ajjer(_coreVar._selectedObjectId); + addObjectToInventory(_coreVar._selectedObjectId); + // If inventory wasn't full if (_crep != 139) { displayItemInHand(objId + 400); _coreVar._selectedObjectId = objId; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 7e0f717142..1141f70026 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -187,7 +187,7 @@ struct SaveStruct { int _faithScore; byte _pourc[11]; byte _teauto[43]; - byte _sjer[31]; + byte _inventory[31]; int _currPlace; int _atticBallHoleObjectId; int _atticRodHoleObjectId; @@ -441,7 +441,7 @@ private: void tlu(int af, int ob); void affrep(); void mennor(); - void ajjer(int ob); + void addObjectToInventory(int objectId); void tsuiv(); void treg(int objId); void putInHand(int &objId); @@ -469,7 +469,6 @@ public: int _res; int _caff; int _crep; -// byte _is; byte _v_lieu[7][25]; // TODO: Replace the following with proper implementations, or refactor out the code using them diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 598677f762..96b40d8114 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -238,10 +238,10 @@ void MouseHandler::setMousePosition(Common::Point newPos) { * Get mouse poisition * @remarks Originally called 'read_pos_mouse' */ -void MouseHandler::getMousePosition(int &x, int &y, int &c) { +void MouseHandler::getMousePosition(int &x, int &y, bool &click) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; - c = g_vm->getMouseClick() ? 1 : 0; + click = g_vm->getMouseClick(); } /** @@ -251,7 +251,8 @@ void MouseHandler::getMousePosition(int &x, int &y, int &c) { void MouseHandler::moveMouse(bool &funct, char &key) { bool p_key; char in1, in2; - int cx, cy, cd; + int cx, cy; + bool click; // Set defaults and check pending events funct = false; @@ -267,7 +268,7 @@ void MouseHandler::moveMouse(bool &funct, char &key) { CHECK_QUIT; in1 = g_vm->getChar(); - getMousePosition(cx, cy, cd); + getMousePosition(cx, cy, click); switch (toupper(in1)) { case '4': cx -= 8; @@ -408,9 +409,10 @@ void MouseHandler::moveMouse(bool &funct, char &key) { * @remarks Originally called 'dans_rect' */ bool MouseHandler::isMouseIn(Common::Rect r) { - int x, y, c; + int x, y; + bool click; - getMousePosition(x, y, c); + getMousePosition(x, y, click); if ((x > r.left) && (x < r.right) && (y > r.top) && (y < r.bottom)) return true; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index abfc315677..58e3fc78d0 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -43,7 +43,7 @@ public: void hideMouse(); void showMouse(); void setMousePosition(Common::Point newPos); - void getMousePosition(int &x, int &y, int &c); + void getMousePosition(int &x, int &y, bool &click); void moveMouse(bool &funct, char &key); bool isMouseIn(Common::Rect r); }; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 48ae04678d..e4fb38c20a 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -50,7 +50,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) { for (int i = 0; i < 43; ++i) sz.syncAsByte(g_vm->_saveStruct._teauto[i]); for (int i = 0; i < 31; ++i) - sz.syncAsByte(g_vm->_saveStruct._sjer[i]); + sz.syncAsByte(g_vm->_saveStruct._inventory[i]); sz.syncAsSint16LE(g_vm->_saveStruct._currPlace); sz.syncAsSint16LE(g_vm->_saveStruct._atticBallHoleObjectId); -- cgit v1.2.3 From 3f60cd79fed0e245dffe97e8cd33a7990ae90f48 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 14 Oct 2012 21:59:27 +0200 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 72 +++++++-------- engines/mortevielle/dialogs.cpp | 16 ++-- engines/mortevielle/graphics.cpp | 6 +- engines/mortevielle/menu.cpp | 38 ++++---- engines/mortevielle/mortevielle.cpp | 173 +++++++++++++++++------------------- engines/mortevielle/mortevielle.h | 33 +++---- engines/mortevielle/mouse.cpp | 22 ++--- engines/mortevielle/outtext.cpp | 32 +++---- engines/mortevielle/saveload.cpp | 4 +- 9 files changed, 193 insertions(+), 203 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6d8e095a3a..392ea17df1 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -48,7 +48,7 @@ void MortevielleEngine::fctMove() { } if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { if (!_syn) - ecr3(getEngineString(S_GO_TO)); + displayTextInVerbBar(getEngineString(S_GO_TO)); tfleche(); if (_keyPressedEsc) @@ -217,7 +217,7 @@ void MortevielleEngine::fctTake() { return; } if (!_syn) - ecr3(getEngineString(S_TAKE)); + displayTextInVerbBar(getEngineString(S_TAKE)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -323,7 +323,7 @@ void MortevielleEngine::fctInventoryTake() { */ void MortevielleEngine::fctLift() { if (!_syn) - ecr3(getEngineString(S_LIFT)); + displayTextInVerbBar(getEngineString(S_LIFT)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -360,7 +360,7 @@ void MortevielleEngine::fctRead() { getReadDescription(_caff); else { if (!_syn) - ecr3(getEngineString(S_READ)); + displayTextInVerbBar(getEngineString(S_READ)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(4); @@ -393,7 +393,7 @@ void MortevielleEngine::fctLook() { return; } if (!_syn) - ecr3(getEngineString(S_LOOK)); + displayTextInVerbBar(getEngineString(S_LOOK)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -483,7 +483,7 @@ void MortevielleEngine::fctSearch() { } if (!_syn) - ecr3(getEngineString(S_SEARCH)); + displayTextInVerbBar(getEngineString(S_SEARCH)); tfleche(); if (_anyone || _keyPressedEsc) @@ -579,7 +579,7 @@ void MortevielleEngine::fctSelfSearch() { */ void MortevielleEngine::fctOpen() { if (!_syn) - ecr3(getEngineString(S_OPEN)); + displayTextInVerbBar(getEngineString(S_OPEN)); if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { @@ -657,7 +657,7 @@ void MortevielleEngine::fctPlace() { } if (!_syn) - ecr3(getEngineString(S_PUT)); + displayTextInVerbBar(getEngineString(S_PUT)); tfleche(); if (_keyPressedEsc) @@ -669,7 +669,7 @@ void MortevielleEngine::fctPlace() { setCoordinates(8); if (_num != 0) { _crep = 999; - if (_caff == 13) { + if (_caff == ATTIC) { if (_num == 1) { if (_coreVar._atticBallHoleObjectId != 0) { _crep = 188; @@ -687,7 +687,7 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 14) { + if (_caff == CELLAR) { if (_coreVar._cellarObjectId != 0) { _crep = 188; } else { @@ -745,14 +745,14 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 16) { + if (_caff == CRYPT) { if (_coreVar._cryptObjectId == 0) _coreVar._cryptObjectId = _coreVar._selectedObjectId; else _crep = 188; } - if (_caff == 17) { + if (_caff == SECRET_PASSAGE) { if (_coreVar._secretPassageObjectId != 0) { _crep = 188; } else if (_coreVar._selectedObjectId == 143) { @@ -764,7 +764,7 @@ void MortevielleEngine::fctPlace() { } } - if (_caff == 24) { + if (_caff == WELL) { if (_coreVar._wellObjectId != 0) { _crep = 188; } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { @@ -790,7 +790,7 @@ void MortevielleEngine::fctTurn() { return; } if (!_syn) - ecr3(getEngineString(S_TURN)); + displayTextInVerbBar(getEngineString(S_TURN)); tfleche(); if ((_anyone) || (_keyPressedEsc)) return; @@ -826,7 +826,7 @@ void MortevielleEngine::fctTurn() { */ void MortevielleEngine::fctSelfHide() { if (!_syn) - ecr3(getEngineString(S_HIDE_SELF)); + displayTextInVerbBar(getEngineString(S_HIDE_SELF)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(10); @@ -848,7 +848,7 @@ void MortevielleEngine::fctAttach() { _crep = 186; else { if (!_syn) - ecr3(getEngineString(S_TIE)); + displayTextInVerbBar(getEngineString(S_TIE)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(8); @@ -872,7 +872,7 @@ void MortevielleEngine::fctAttach() { */ void MortevielleEngine::fctClose() { if (!_syn) - ecr3(getEngineString(S_CLOSE)); + displayTextInVerbBar(getEngineString(S_CLOSE)); if (_caff < ROOM26) { tfleche(); @@ -912,7 +912,7 @@ void MortevielleEngine::fctClose() { */ void MortevielleEngine::fctKnock() { if (!_syn) - ecr3(getEngineString(S_HIT)); + displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); @@ -959,7 +959,7 @@ void MortevielleEngine::fctKnock() { */ void MortevielleEngine::fctSelfPut() { if (!_syn) - ecr3(getEngineString(S_POSE)); + displayTextInVerbBar(getEngineString(S_POSE)); if (_coreVar._selectedObjectId == 0) _crep = 186; else { @@ -1095,7 +1095,7 @@ void MortevielleEngine::fctEat() { } else { exitRoom(); _coreVar._currPlace = DINING_ROOM; - _caff = 10; + _caff = DINING_ROOM; resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); @@ -1140,7 +1140,7 @@ void MortevielleEngine::fctEnter() { _crep = 997; else if ((_roomDoorId == ROOM9) && (_coreVar._selectedObjectId != 136)) { _crep = 189; - _coreVar._teauto[8] = '*'; + _coreVar._availableQuestion[8] = '*'; } else { int z = 0; if (!_blo) @@ -1238,8 +1238,8 @@ void MortevielleEngine::fctSleep() { */ void MortevielleEngine::fctForce() { if (!_syn) - ecr3(getEngineString(S_SMASH)); - if (_caff < 25) + displayTextInVerbBar(getEngineString(S_SMASH)); + if (_caff < DOOR) tfleche(); if ((!_anyone) && (!_keyPressedEsc)) { @@ -1328,7 +1328,7 @@ void MortevielleEngine::fctWait() { */ void MortevielleEngine::fctSound() { if (!_syn) - ecr3(getEngineString(S_PROBE2)); + displayTextInVerbBar(getEngineString(S_PROBE2)); if (_caff < 27) { tfleche(); if (!(_anyone) && (!_keyPressedEsc)) @@ -1387,7 +1387,7 @@ void MortevielleEngine::fctDiscuss() { int posY = 0; for (int icm = 1; icm < 43; icm++) { _screenSurface.putxy(posX, posY); - if (_coreVar._teauto[icm] == '*') { + if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) writetp(lib[icm], 1); @@ -1411,7 +1411,7 @@ void MortevielleEngine::fctDiscuss() { CHECK_QUIT; _mouse.getMousePosition(x, y, click); - x *= (3 - _res); + x *= (3 - _resolutionScaler); if (x > 319) cx = 41; else @@ -1450,7 +1450,7 @@ void MortevielleEngine::fctDiscuss() { writetp(lib[choice], 1); questionAsked[choice] = ! questionAsked[choice]; } - if ((_coreVar._teauto[ix] == '*') || (ix == 46)) { + if ((_coreVar._availableQuestion[ix] == '*') || (ix == 46)) { posY = ((ix - 1) % 23) << 3; if (ix > 23) posX = 320; @@ -1501,17 +1501,17 @@ void MortevielleEngine::fctDiscuss() { startDialog(displId); _mouse.showMouse(); if ((displId == 84) || (displId == 86)) { - _coreVar._pourc[5] = '*'; - _coreVar._teauto[7] = '*'; + _coreVar._pctHintFound[5] = '*'; + _coreVar._availableQuestion[7] = '*'; } if ((displId == 106) || (displId == 108) || (displId == 94)) { for (int indx = 29; indx <= 31; ++indx) - _coreVar._teauto[indx] = '*'; - _coreVar._pourc[7] = '*'; + _coreVar._availableQuestion[indx] = '*'; + _coreVar._pctHintFound[7] = '*'; } if (displId == 70) { - _coreVar._pourc[8] = '*'; - _coreVar._teauto[32] = '*'; + _coreVar._pctHintFound[8] = '*'; + _coreVar._availableQuestion[32] = '*'; } _mouse.hideMouse(); hirs(); @@ -1550,10 +1550,10 @@ void MortevielleEngine::fctSmell() { _crep = 119; if (_caff < ROOM26) { if (!_syn) - ecr3(getEngineString(S_SMELL)); + displayTextInVerbBar(getEngineString(S_SMELL)); tfleche(); if (!(_anyone) && !(_keyPressedEsc)) - if (_caff == 16) + if (_caff == CRYPT) _crep = 153; } else if (_caff == 123) _crep = 110; @@ -1568,7 +1568,7 @@ void MortevielleEngine::fctScratch() { _crep = 155; if (_caff < 27) { if (!_syn) - ecr3(getEngineString(S_SCRATCH)); + displayTextInVerbBar(getEngineString(S_SCRATCH)); tfleche(); } _num = 0; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f0f4452899..ee6eb697fb 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -71,7 +71,7 @@ int Alert::show(const Common::String &msg, int n) { while ((alertStr[i + 1] != '\174') && (alertStr[i + 1] != '\135')) { ++i; displayStr += alertStr[i]; - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) curPos.x -= 3; else curPos.x -= 5; @@ -95,12 +95,12 @@ int Alert::show(const Common::String &msg, int n) { int limit[3][3]; memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - limit[1][1] = ((uint)(coldep) / 2) * g_vm->_res; + limit[1][1] = ((uint)(coldep) / 2) * g_vm->_resolutionScaler; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_res; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_resolutionScaler; limit[2][2] = (limit[2][1]) + 40; } g_vm->_mouse.showMouse(); @@ -221,7 +221,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li } ++i; choiceListStr = g_vm->copy(inputStr, i, 30); - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) col *= 6; else col *= 10; @@ -303,7 +303,7 @@ bool KnowledgeCheck::show() { g_vm->hirs(); g_vm->_mouse.showMouse(); int dialogHeight; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) dialogHeight = 29; else dialogHeight = 23; @@ -335,7 +335,7 @@ bool KnowledgeCheck::show() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._rect = Common::Rect(45 * g_vm->_res, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_res, 34 + j * 8); + coor[j]._rect = Common::Rect(45 * g_vm->_resolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_resolutionScaler, 34 + j * 8); coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { @@ -344,7 +344,7 @@ bool KnowledgeCheck::show() { } coor[lastOption - firstOption + 2]._enabled = false; int rep; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) rep = 10; else rep = 6; @@ -473,7 +473,7 @@ void f3f8::ani50() { g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); g_vm->_crep = g_vm->animof(2, 1); g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); - g_vm->_largestClearScreen = (g_vm->_res == 1); + g_vm->_largestClearScreen = (g_vm->_resolutionScaler == 1); g_vm->handleDescriptionText(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index fec2cfbf6b..5bf3aedc99 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -996,7 +996,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (g_vm->_res == 1) { + if (g_vm->_resolutionScaler == 1) { x = (uint)x >> 1; dx = (uint)dx >> 1; } @@ -1063,7 +1063,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { g_vm->_mouse.hideMouse(); pt = _textPos; - if (g_vm->_res == 2) + if (g_vm->_resolutionScaler == 2) i = 6; else i = 10; @@ -1105,7 +1105,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (g_vm->_res == 2) ? 6 : 10; + int charWidth = (g_vm->_resolutionScaler == 2) ? 6 : 10; return s.size() * charWidth; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f03d6661e4..8e6d94c449 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -93,8 +93,8 @@ void Menu::setDestinationText(int roomId) { roomId = LANDING; int destinationId = 0; - for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) { - nomp = g_vm->getString(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); + for (; (destinationId < 7) && (g_vm->_destinationArray[destinationId][roomId]); ++destinationId) { + nomp = g_vm->getString(g_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; setText(_moveMenu[destinationId + 1], nomp); @@ -178,7 +178,7 @@ void Menu::displayMenu() { g_vm->_mouse.hideMouse(); g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * g_vm->_res; + col = 28 * g_vm->_resolutionScaler; if (g_vm->_currGraphicalDevice == MODE_CGA) color = 1; else @@ -207,7 +207,7 @@ void Menu::displayMenu() { } while (k != 3); ++y; } while (y != 9); - col += 48 * g_vm->_res; + col += 48 * g_vm->_resolutionScaler; } while (num_letr != 6); g_vm->_mouse.showMouse(); } @@ -284,14 +284,14 @@ void Menu::util(Common::Point pos) { int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; int dxcar = _menuConstants[_msg3 - 1][2]; - int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_res; + int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_resolutionScaler; int ix; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) ix = 5; else ix = 3; - int xmx = dxcar * ix * g_vm->_res + xmn + 2; + int xmx = dxcar * ix * g_vm->_resolutionScaler + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); if (ix != _msg4) { @@ -321,7 +321,7 @@ void Menu::menuDown(int ii) { g_vm->_mouse.hideMouse(); g_vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) cx = 10; else cx = 6; @@ -433,24 +433,24 @@ void Menu::mdn() { g_vm->_prevPos = curPos; bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * g_vm->_res) && curPos.x <= (28 * g_vm->_res + 24)) - || (curPos.x >= (76 * g_vm->_res) && curPos.x <= (76 * g_vm->_res + 24)) - || ((curPos.x > 124 * g_vm->_res) && (curPos.x < 124 * g_vm->_res + 24)) - || ((curPos.x > 172 * g_vm->_res) && (curPos.x < 172 * g_vm->_res + 24)) - || ((curPos.x > 220 * g_vm->_res) && (curPos.x < 220 * g_vm->_res + 24)) - || ((curPos.x > 268 * g_vm->_res) && (curPos.x < 268 * g_vm->_res + 24))); + && ((curPos.x >= (28 * g_vm->_resolutionScaler) && curPos.x <= (28 * g_vm->_resolutionScaler + 24)) + || (curPos.x >= (76 * g_vm->_resolutionScaler) && curPos.x <= (76 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 124 * g_vm->_resolutionScaler) && (curPos.x < 124 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 172 * g_vm->_resolutionScaler) && (curPos.x < 172 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 220 * g_vm->_resolutionScaler) && (curPos.x < 220 * g_vm->_resolutionScaler + 24)) + || ((curPos.x > 268 * g_vm->_resolutionScaler) && (curPos.x < 268 * g_vm->_resolutionScaler + 24))); if (tes) { int ix; - if (curPos.x < 76 * g_vm->_res) + if (curPos.x < 76 * g_vm->_resolutionScaler) ix = MENU_INVENTORY; - else if (curPos.x < 124 * g_vm->_res) + else if (curPos.x < 124 * g_vm->_resolutionScaler) ix = MENU_MOVE; - else if (curPos.x < 172 * g_vm->_res) + else if (curPos.x < 172 * g_vm->_resolutionScaler) ix = MENU_ACTION; - else if (curPos.x < 220 * g_vm->_res) + else if (curPos.x < 220 * g_vm->_resolutionScaler) ix = MENU_SELF; - else if (curPos.x < 268 * g_vm->_res) + else if (curPos.x < 268 * g_vm->_resolutionScaler) ix = MENU_DISCUSS; else ix = MENU_FILE; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 782c811b1f..2b95bcea0e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -180,7 +180,7 @@ Common::ErrorCode MortevielleEngine::initialise() { // Set the screen mode _currGraphicalDevice = MODE_EGA; - _res = 2; + _resolutionScaler = 2; _txxFileFl = false; // Load texts from TXX files @@ -673,7 +673,7 @@ void MortevielleEngine::handleAction() { } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { _msg[4] = _menuOpcode; - ecr3(getEngineString(S_IDEM)); + displayTextInVerbBar(getEngineString(S_IDEM)); } else return; } else if (inkey == '\104') { @@ -746,7 +746,7 @@ void MortevielleEngine::loadPlaces() { for (int i = 0; i < 7; ++i) { for (int j = 0; j < 25; ++j) - _v_lieu[i][j] = f.readByte(); + _destinationArray[i][j] = f.readByte(); } f.close(); @@ -2004,8 +2004,8 @@ void MortevielleEngine::handleOpcode() { } int hour, day, minute; updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != 10)) || - ((hour > 0) && (hour < 6) && (_coreVar._currPlace != 0))) + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != DINING_ROOM)) || + ((hour > 0) && (hour < 6) && (_coreVar._currPlace != OWN_ROOM))) ++_coreVar._faithScore; if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { @@ -2104,7 +2104,7 @@ void MortevielleEngine::clearUpperRightPart() { Common::String st; _mouse.hideMouse(); - if (_res == 1) { + if (_resolutionScaler == 1) { x2 = 634; x1 = 534; } else { @@ -2293,21 +2293,21 @@ void MortevielleEngine::resetVariables() { _coreVar._fullHour = chr(20); for (int i = 1; i <= 10; ++i) - _coreVar._pourc[i] = ' '; + _coreVar._pctHintFound[i] = ' '; for (int i = 1; i <= 6; ++i) - _coreVar._teauto[i] = '*'; + _coreVar._availableQuestion[i] = '*'; for (int i = 7; i <= 9; ++i) - _coreVar._teauto[i] = ' '; + _coreVar._availableQuestion[i] = ' '; for (int i = 10; i <= 28; ++i) - _coreVar._teauto[i] = '*'; + _coreVar._availableQuestion[i] = '*'; for (int i = 29; i <= 42; ++i) - _coreVar._teauto[i] = ' '; + _coreVar._availableQuestion[i] = ' '; - _coreVar._teauto[33] = '*'; + _coreVar._availableQuestion[33] = '*'; for (int i = 1; i <= 8; ++i) _nbrep[i] = 0; @@ -2563,7 +2563,7 @@ void MortevielleEngine::showTitleScreen() { draw(kAdrDes, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * _res, 185); + _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); _screenSurface.drawString(cpr, 0); } @@ -2609,14 +2609,7 @@ int MortevielleEngine::readclock() { * @remarks Originally called 'tinke' */ void MortevielleEngine::prepareRoom() { - Common::String d1 = getEngineString(S_SHOULD_HAVE_NOTICED); - Common::String d2 = getEngineString(S_NUMBER_OF_HINTS); - const char d3 = '['; - const char d4 = ']'; - const char d5 = '1'; - Common::String d6 = getEngineString(S_OK); - int cf, day, hour, minute; - Common::String stpo; + int day, hour, minute; _anyone = false; updateHour(day, hour, minute); @@ -2634,29 +2627,26 @@ void MortevielleEngine::prepareRoom() { _hour = hour; _minute = 0; drawClock(); - cf = 0; + int hintCount = 0; for (int i = 1; i <= 10; ++i) { - if (_coreVar._pourc[i] == '*') - ++cf; + if (_coreVar._pctHintFound[i] == '*') + ++hintCount; } - if (cf == 10) - stpo = "10"; + Common::String pctStr; + if (hintCount == 10) + pctStr = "10"; else - stpo = chr(cf + 48); - - _hintPctMessage = Common::String(d3); - _hintPctMessage += d5; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d1; - _hintPctMessage += stpo; + pctStr = chr(hintCount + 48); + + _hintPctMessage = "[1]["; + _hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED); + _hintPctMessage += pctStr; _hintPctMessage += '0'; - _hintPctMessage += d2; - _hintPctMessage += d4; - _hintPctMessage += d3; - _hintPctMessage += d6; - _hintPctMessage += d4; + _hintPctMessage += getEngineString(S_NUMBER_OF_HINTS); + _hintPctMessage += "]["; + _hintPctMessage += getEngineString(S_OK); + _hintPctMessage += ']'; } if (minute > _minute) { _minute = 30; @@ -2670,11 +2660,10 @@ void MortevielleEngine::prepareRoom() { _inGameHourDuration = kTime2; else _inGameHourDuration = kTime1; - cf = _coreVar._faithScore; - if ((cf > 33) && (cf < 66)) + if ((_coreVar._faithScore > 33) && (_coreVar._faithScore < 66)) _inGameHourDuration -= (_inGameHourDuration / 3); - if (cf > 65) + if (_coreVar._faithScore > 65) _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); int newHour = readclock(); @@ -2686,40 +2675,40 @@ void MortevielleEngine::prepareRoom() { switch (_place) { case GREEN_ROOM: case DARKBLUE_ROOM: - setRandomPresenceGreenRoom(cf); + setRandomPresenceGreenRoom(_coreVar._faithScore); break; case PURPLE_ROOM: - setRandomPresencePurpleRoom(cf); + setRandomPresencePurpleRoom(_coreVar._faithScore); break; case BLUE_ROOM: - setRandomPresenceBlueRoom(cf); + setRandomPresenceBlueRoom(_coreVar._faithScore); break; case RED_ROOM: case GREEN_ROOM2: - setRandomPresenceRedRoom(cf); + setRandomPresenceRedRoom(_coreVar._faithScore); break; case ROOM9: - setRandomPresenceRoom9(cf); + setRandomPresenceRoom9(_coreVar._faithScore); break; case DINING_ROOM: - setRandomPresenceDiningRoom(cf); + setRandomPresenceDiningRoom(_coreVar._faithScore); break; case BUREAU: - setRandomPresenceBureau(cf); + setRandomPresenceBureau(_coreVar._faithScore); break; case KITCHEN: - setRandomPresenceKitchen(cf); + setRandomPresenceKitchen(_coreVar._faithScore); break; case ATTIC: case CELLAR: - setRandomPresenceAttic(cf); + setRandomPresenceAttic(_coreVar._faithScore); break; case LANDING: case ROOM26: - setRandomPresenceLanding(cf); + setRandomPresenceLanding(_coreVar._faithScore); break; case CHAPEL: - setRandomPresenceChapel(cf); + setRandomPresenceChapel(_coreVar._faithScore); break; } if ((_savedBitIndex != 0) && (_currBitIndex != 10)) @@ -2736,7 +2725,7 @@ void MortevielleEngine::prepareRoom() { if (getRandomNumber(1, 5) < 5) { clearVerbBar(); prepareScreenType2(); - ecr3(getEngineString(S_HEAR_NOISE)); + displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(1, rand, 1); clearVerbBar(); @@ -2771,29 +2760,29 @@ void MortevielleEngine::drawClock() { const int x = 580; const int y = 123; const int rg = 9; - int h, co; + int hourColor; _mouse.hideMouse(); _screenSurface.drawRectangle(570, 118, 20, 10); _screenSurface.drawRectangle(578, 114, 6, 18); if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) - co = 0; + hourColor = 0; else - co = 1; + hourColor = 1; if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y - rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), hourColor); else - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)x >> 1) * _res, (y + rg), co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), hourColor); - h = _hour; - if (h > 12) - h -= 12; - if (h == 0) - h = 12; + int hour12 = _hour; + if (hour12 > 12) + hour12 -= 12; + if (hour12 == 0) + hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * _res, y, ((uint)(x + cv[0][h - 1]) >> 1) * _res, y + cv[1][h - 1], co); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], hourColor); _mouse.showMouse(); _screenSurface.putxy(568, 154); @@ -2840,12 +2829,12 @@ void MortevielleEngine::hirs() { if (_currGraphicalDevice == MODE_TANDY) { _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); - _res = 1; + _resolutionScaler = 1; } else if (_currGraphicalDevice == MODE_CGA) { palette(1); - _res = 1; + _resolutionScaler = 1; } else - _res = 2; + _resolutionScaler = 2; _screenSurface.clearScreen(); } @@ -2860,7 +2849,7 @@ void MortevielleEngine::initCaveOrCellar() { _coreVar._faithScore += (_coreVar._faithScore / 10); clearVerbBar(); prepareScreenType2(); - ecr3(getEngineString(S_SOMEONE_ENTERS)); + displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; _speechManager.startSpeech(2, rand, 1); @@ -2938,7 +2927,7 @@ int MortevielleEngine::animof(int ouf, int num) { void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { int co; - if (_res == 1) + if (_resolutionScaler == 1) co = 10; else co = 6; @@ -2956,7 +2945,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { if ((mesgId > 499) && (mesgId < 563)) { Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); - if ((int) tmpStr.size() > ((58 + (_res - 1) * 37) << 1)) + if ((int) tmpStr.size() > ((58 + (_resolutionScaler - 1) * 37) << 1)) _largestClearScreen = true; else _largestClearScreen = false; @@ -2972,12 +2961,12 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { prepareScreenType2(); displayTextInDescriptionBar(8, 182, 103, mesgId); if ((mesgId == 68) || (mesgId == 69)) - _coreVar._teauto[40] = '*'; - if ((mesgId == 104) && (_caff == 14)) { - _coreVar._teauto[36] = '*'; - if (_coreVar._teauto[39] == '*') { - _coreVar._pourc[3] = '*'; - _coreVar._teauto[38] = '*'; + _coreVar._availableQuestion[40] = '*'; + if ((mesgId == 104) && (_caff == CELLAR)) { + _coreVar._availableQuestion[36] = '*'; + if (_coreVar._availableQuestion[39] == '*') { + _coreVar._pctHintFound[3] = '*'; + _coreVar._availableQuestion[38] = '*'; } } break; @@ -2994,9 +2983,9 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { _text.displayStr(tmpStr, 80, 40, 60, 25, i); if (mesgId == 180) - _coreVar._pourc[6] = '*'; + _coreVar._pctHintFound[6] = '*'; else if (mesgId == 179) - _coreVar._pourc[10] = '*'; + _coreVar._pctHintFound[10] = '*'; } break; default: @@ -3061,7 +3050,7 @@ void MortevielleEngine::resetOpenObjects() { void MortevielleEngine::ecr2(Common::String text) { // Some dead code was present in the original: removed _screenSurface.putxy(8, 177); - int tlig = 59 + (_res - 1) * 36; + int tlig = 59 + (_resolutionScaler - 1) * 36; if ((int)text.size() < tlig) _screenSurface.drawString(text, 5); @@ -3082,7 +3071,7 @@ void MortevielleEngine::ecr2(Common::String text) { } } -void MortevielleEngine::ecr3(Common::String text) { +void MortevielleEngine::displayTextInVerbBar(Common::String text) { clearVerbBar(); _screenSurface.putxy(8, 192); _screenSurface.drawString(text, 5); @@ -3282,19 +3271,19 @@ int MortevielleEngine::getPresence(int roomId) { } void MortevielleEngine::writetp(Common::String s, int t) { - if (_res == 2) + if (_resolutionScaler == 2) _screenSurface.drawString(s, t); else _screenSurface.drawString(copy(s, 1, 25), t); } void MortevielleEngine::aniof(int ouf, int num) { - if ((_caff == 7) && ((num == 4) || (num == 5))) + if ((_caff == BATHROOM) && ((num == 4) || (num == 5))) return; - if ((_caff == 10) && (num == 7)) + if ((_caff == DINING_ROOM) && (num == 7)) num = 6; - else if (_caff == 12) { + else if (_caff == KITCHEN) { if (num == 3) num = 4; else if (num == 4) @@ -3332,17 +3321,17 @@ void MortevielleEngine::drawPicture() { aniof(1, _openObjects[cx]); } - if (_caff == 13) { + if (_caff == ATTIC) { if (_coreVar._atticBallHoleObjectId == 141) aniof(1, 7); if (_coreVar._atticRodHoleObjectId == 159) aniof(1, 6); - } else if ((_caff == 14) && (_coreVar._cellarObjectId == 151)) + } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) aniof(1, 2); - else if ((_caff == 17) && (_coreVar._secretPassageObjectId == 143)) + else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) aniof(1, 1); - else if ((_caff == 24) && (_coreVar._wellObjectId != 0)) + else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) aniof(1, 1); } @@ -3622,7 +3611,7 @@ void MortevielleEngine::tfleche() { CHECK_QUIT; if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * _res) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); prepareRoom(); } while (!(qust || inRect || _anyone)); @@ -3679,10 +3668,10 @@ void MortevielleEngine::setCoordinates(int sx) { cy = 1; do { cb += 2; - sx = _tabdon[a + cb] * _res; + sx = _tabdon[a + cb] * _resolutionScaler; sy = _tabdon[(a + cb + 1)]; cb += 2; - ix = _tabdon[a + cb] * _res; + ix = _tabdon[a + cb] * _resolutionScaler; iy = _tabdon[(a + cb + 1)]; ++cy; } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 1141f70026..81baab91b4 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -154,8 +154,7 @@ static const int _actionMenu[12] = { OPCODE_NONE, /* 9 "A glance at the forbidden$", 18 "It's already open$", -26 "A photograph$", -27 "The coat of arms$", +26 "A photograph$" */ enum Places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, @@ -163,7 +162,7 @@ enum Places { DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, - DOOR = 25, ROOM26 = 26, ROOM27 = 27 + DOOR = 25, ROOM26 = 26, COAT_ARMS = 27 }; enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; @@ -185,8 +184,8 @@ struct Pattern { struct SaveStruct { int _faithScore; - byte _pourc[11]; - byte _teauto[43]; + byte _pctHintFound[11]; + byte _availableQuestion[43]; byte _inventory[31]; int _currPlace; int _atticBallHoleObjectId; @@ -420,31 +419,32 @@ private: void delay(int amount); void handleOpcode(); - void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); - void copcha(); - void adzon(); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void mapMessageId(int &mesgId); void resetOpenObjects(); + void setCoordinates(int sx); + void displayTextInVerbBar(Common::String text); + void drawPicture(); + void drawPictureWithText(); + void addObjectToInventory(int objectId); + void putInHand(int &objId); + + void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); + void copcha(); + void adzon(); void phaz(int &rand, int &p, int cf); void writetp(Common::String s, int t); void premtet(); void ajchai(); void tfleche(); - void setCoordinates(int sx); void ecr2(Common::String text); - void ecr3(Common::String text); void init_nbrepm(); void aniof(int ouf, int num); - void drawPicture(); - void drawPictureWithText(); void tlu(int af, int ob); void affrep(); void mennor(); - void addObjectToInventory(int objectId); void tsuiv(); void treg(int objId); - void putInHand(int &objId); void rechai(int &ch); void fenat(char ans); @@ -466,10 +466,11 @@ public: SaveStruct _coreVar, _saveStruct; int _maff; - int _res; int _caff; int _crep; - byte _v_lieu[7][25]; + + int _resolutionScaler; + byte _destinationArray[7][25]; // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 96b40d8114..bc0f5fe7d3 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -219,8 +219,8 @@ void MouseHandler::showMouse() { * @remarks Originally called 'pos_mouse' */ void MouseHandler::setMousePosition(Common::Point newPos) { - if (newPos.x > 314 * g_vm->_res) - newPos.x = 314 * g_vm->_res; + if (newPos.x > 314 * g_vm->_resolutionScaler) + newPos.x = 314 * g_vm->_resolutionScaler; else if (newPos.x < 0) newPos.x = 0; if (newPos.y > 199) @@ -291,16 +291,16 @@ void MouseHandler::moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * g_vm->_res; + cx = 315 * g_vm->_resolutionScaler; cy = 1; break; case '3': cy = 190; - cx = 315 * g_vm->_res; + cx = 315 * g_vm->_resolutionScaler; break; case '5': cy = 100; - cx = 155 * g_vm->_res; + cx = 155 * g_vm->_resolutionScaler; break; case ' ': case '\15': @@ -354,27 +354,27 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } break; case 'I': - cx = g_vm->_res * 32; + cx = g_vm->_resolutionScaler * 32; cy = 8; break; case 'D': - cx = 80 * g_vm->_res; + cx = 80 * g_vm->_resolutionScaler; cy = 8; break; case 'A': - cx = 126 * g_vm->_res; + cx = 126 * g_vm->_resolutionScaler; cy = 8; break; case 'S': - cx = 174 * g_vm->_res; + cx = 174 * g_vm->_resolutionScaler; cy = 8; break; case 'P': - cx = 222 * g_vm->_res; + cx = 222 * g_vm->_resolutionScaler; cy = 8; break; case 'F': - cx = g_vm->_res * 270; + cx = g_vm->_resolutionScaler * 270; cy = 8; break; case '\23': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e18c5c1692..4bdfcb4699 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -60,7 +60,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int inputStr += '$'; g_vm->_screenSurface.putxy(x, y); - if (g_vm->_res == 1) + if (g_vm->_resolutionScaler == 1) tab = 10; else tab = 6; @@ -206,37 +206,37 @@ void TextHandler::taffich() { switch (a) { case 16: - g_vm->_coreVar._pourc[9] = '*'; - g_vm->_coreVar._teauto[42] = '*'; + g_vm->_coreVar._pctHintFound[9] = '*'; + g_vm->_coreVar._availableQuestion[42] = '*'; break; case 20: - g_vm->_coreVar._teauto[39] = '*'; - if (g_vm->_coreVar._teauto[36] == '*') { - g_vm->_coreVar._pourc[3] = '*'; - g_vm->_coreVar._teauto[38] = '*'; + g_vm->_coreVar._availableQuestion[39] = '*'; + if (g_vm->_coreVar._availableQuestion[36] == '*') { + g_vm->_coreVar._pctHintFound[3] = '*'; + g_vm->_coreVar._availableQuestion[38] = '*'; } break; case 24: - g_vm->_coreVar._teauto[37] = '*'; + g_vm->_coreVar._availableQuestion[37] = '*'; break; case 30: - g_vm->_coreVar._teauto[9] = '*'; + g_vm->_coreVar._availableQuestion[9] = '*'; break; - case 31: - g_vm->_coreVar._pourc[4] = '*'; - g_vm->_coreVar._teauto[35] = '*'; + case 31: // Coat of arms + g_vm->_coreVar._pctHintFound[4] = '*'; + g_vm->_coreVar._availableQuestion[35] = '*'; break; case 118: - g_vm->_coreVar._teauto[41] = '*'; + g_vm->_coreVar._availableQuestion[41] = '*'; break; case 143: - g_vm->_coreVar._pourc[1] = '*'; + g_vm->_coreVar._pctHintFound[1] = '*'; break; case 150: - g_vm->_coreVar._teauto[34] = '*'; + g_vm->_coreVar._availableQuestion[34] = '*'; break; case 151: - g_vm->_coreVar._pourc[2] = '*'; + g_vm->_coreVar._pctHintFound[2] = '*'; break; default: break; diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index e4fb38c20a..093f22e9cf 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -46,9 +46,9 @@ Common::String SavegameManager::generateSaveName(int slotNumber) { void SavegameManager::sync_save(Common::Serializer &sz) { sz.syncAsSint16LE(g_vm->_saveStruct._faithScore); for (int i = 0; i < 11; ++i) - sz.syncAsByte(g_vm->_saveStruct._pourc[i]); + sz.syncAsByte(g_vm->_saveStruct._pctHintFound[i]); for (int i = 0; i < 43; ++i) - sz.syncAsByte(g_vm->_saveStruct._teauto[i]); + sz.syncAsByte(g_vm->_saveStruct._availableQuestion[i]); for (int i = 0; i < 31; ++i) sz.syncAsByte(g_vm->_saveStruct._inventory[i]); -- cgit v1.2.3 From 42b0f5535e8bc55417af91bc49e1ebf8500d4bd4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 20 Feb 2013 23:54:14 +0100 Subject: MORTEVIELLE:Add initial English translation --- devtools/create_mortdat/gametext.h | 286 ++++++++++++++++++------------------- 1 file changed, 143 insertions(+), 143 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index 0e0948e95f..9efb55bc53 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -320,149 +320,149 @@ const char *gameDataEn[] = { "$", "$", "END OF THE CONVERSATION$", - "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", - "TBT - Je n'en sais rien !$", - "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", - "TBT - Madame DEFRANCK est morte d'un coup de froid$", - "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", - "TBT - Ce sont toujours les meilleurs qui partent les premiers$", - "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", - "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", - "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", - "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", - "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", - "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", - "TBT - Ce sont ses affaires ...$", - "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", - "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", - "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", - "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", - "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", - "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", - "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", - "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", - "TBT - Les bijoux ...$", - "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", - "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", - "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", - "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", - "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", - "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", - "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", - "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", - "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", - "TBT - Moi je n'ai rien … lui reprocher$", - "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", - "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", - "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", - "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", - "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", - "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", - "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", - "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", - "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", - "TBT - C'est pour un rendez-vous ?$", - "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", - "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", - "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", - "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", - "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", - "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", - "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", - "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", - "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", - "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", - "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", - "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", - "TBT - Elle aussi, faisait des recherches ...$", - "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", - "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", - "TBT - Je crois que tout le monde l'aimait bien$", - "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", - "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", - "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", - "TBT - A part sa famille, pas grand monde$", - "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", - "TBT - Non rien !$", - "TBT - Non ... Pas que le sache$", - "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", - "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", - "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", - "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", - "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", - "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", - "TBT - Son dernier pr‚sent m'a surpris$", - "TBT - Quel cadeau ?$", - "TBT - Un chandellier ...$", - "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", - "TBT - Et bien oui ! Comme tout le monde, je crois$", - "TBT - Un poignard$", - "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", - "TBT - Vous avez un don de double-vue ou un passe-partout$", - "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", - "TBT - Vous savez, je la connaissais assez peu$", - "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", - "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", - "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", - "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", - "TBT - Si la chambre est ferm‚e, demandez … L‚o$", - "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", - "TBT - Vous savez ce que c'est : Des relations familiales$", - "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", - "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", - "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", - "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", - "TBT - Je ne me rappelle pas$", - "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", - "TBT - Vous tes bien curieux !... C'est sans valeur$", - "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", - "TBT - Dommage que la devise soit manquante ...$", - "TBT - C'est trŠs beau ... Et trŠs vieux ...$", - "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", - "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", - "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", - "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", - "TBT - Ca reste pour moi le plus grand des mystŠres$", - "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", - "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", - "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", - "TBT - Quoi ?! Quel corps ? Quel crypte ?$", - "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", - "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", - "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", - "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", - "TBT - Julia aimait beaucoup la peinture$", - "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", - "TBT - Que faites-vous l… ?$", - "TBT - Je suis s–r que vous cherchez quelque chose ici$", - "TBT - Je vous ‚coute$", - "TBT - Que d‚sirez-vous ?$", - "TBT - Oui ?$", - "TBT - Je suis … vous ...$", - "TBT - C'est pourquoi ?$", - "TBT - Allez-y$", - "TBT - C'est … quel sujet ?$", - "TBT - Max : … votre service, monsieur$", - "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", - "TBT - Vous tes trop curieux !$", - "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", - "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", - "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", - "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "That was the name old people gave to the mountain range that lies at the foot of the manor!$", + "These are the mountains one can see in front of the manor$", + "I don't know!$", + "She died from pulmonary embolism$", + "Mother died suddenly. And yet her health had seemed to improve‚$", + "Miss DEFRANCK died from a cold$", + "She died from pulmonary embolism$", + "Excuse me but I prefer to say nothing for now$", + "Only the good die young$", + "I loved my mother . My only regret is that she died in the DEFRANCK's manor$", + "That region has a lot of history and there is plenty to keep me busy. And also I love horses..$", + "He is a history enthusiast and a gambler. By the way he won a large sum one year ago$", + "He is already very busy with the management and maintenance of the mansion...$", + "I am the CEO of a small perfume company. But when I am here, I rest$", + "He is a dynamic man who has succeeded in perfurmes$", + "Him! He is an upstart rogue! Perfumes must have killed his common sense. Moreover, when he's here he spends his evenings in his room$", + "I was very concerned about my mother's health, and now I don't feel like doing anything at all$", + "He would have done better to look after me a bit more and a bit less after his mother$", + "(313) It is his business...$", + "He does not have much luck at the moment although his business is satisfactory$", + "I work with Pat but it's not going too well at the moment$", + "Oh really?! He has activities? He better take care of them seriously then$", + "Him and Pat are patners. I think it's going pretty well$", + "I take care of myself and that's already lots. How about you?$", + "(319) Oh that! I trust her. She knows how to keep herself busy$", + "(320) What! You have not yet discovered her main occupation..?$", + "She is working in the decoration business, and tastefully with that. She is always very well dressed$", + "If you like jewels, I have some good deals to propose for a short while$", + "The jewels...$", + "I don't know, but I'd like him to give me a bit more slack!$", + "When one is a housewife, one always find something to do...$", + "She could stay there doing nothing, but no! She sews, she reads ...$", + "She probably doesn't have very fulfilling occupations...$", + "A woman like there is no more: She is interested in everything!$", + "With the cooking and the cleaning I do not have much time for you$", + "I do not know how he manages to do everything. That's wonderful!$", + "He would do more if he showed less interest in gossip and alcohol$", + "I am very independant. As long as nobody interferes in my business: No problem$", + "He is selfish. I wonder if he likes something else than his horses and grimoires$", + "I think he gets along well with everyone, except, perhaps, with Guy$", + "He has a temper. You have to learn how to deal with him ..$", + "Business is business. As for the family, I leave it as it is ...$", + "Relations? Friendly relations? Financial relations, without a doubt$", + "Oh I don't have anything against him$", + "He is a resourceful businessman. He sometimes tries to swim upstream but … he will always find a way to make it work$", + "(340) They all bore me .. No! Not even that .. Even if .. some people ..$", + "Contrary to his mother, he is a very shy person ! So when you say relations ..$", + "He must be trying very hard to remain nice despite all his troubles$", + "(343) His romantic relationship: it's over. His relationship with me: hasn't really started. As for the other ones: I don't follow the \"other ones\"$", + "I like everyone, as long as they are not trying to screw me over$", + "It is not enough to have a bit of money and to know how to talk for everyone to like you$", + "Not much to say about him .. He is a nice and generous man. And what's more, he can be quite funny$", + "Nowadays I get along rather well with everyone. But, here, I am not going to say more about this$", + "(348) Nice feathers, but a bird's brain... Ask her husband$", + "Is it for an appointment?$", + "(350) She is very lively! She does not burden herself with stupids prejudices$", + "In my line of work, one mostly encounters beautiful women and gangsters$", + "The only sure thing he has going for him, it's his jewelery .. And his wife, but he doesn't realize that$", + "It's an interesting character. Who is not always very easy to follow, but worth knowing$", + "I hate no one, but I like things and people when they stay where they should be$", + "This stays between us. But you see: when I speak with her, I soon start to feel a bit uncomfortable!$", + "You'd have to try hard to not get along with her$", + "You know, in my line of work you hear everything but don't remember anything, and service is well done$", + "He's a submissive hypocrite! Personally I don't trust him$", + "I don't know what he thinks deep down inside, but he's always polite and impeccable$", + "Someone who lived in the manor, a year ago .. maybe more$", + "She was more than a friend to my mother. In these moments, I would have loved to have her by my side$", + "Murielle has been Julia's lady-in-waiting$", + "She, too, was doing some research ...$", + "She was a very educated person. Her abrupt leaving, a year ago, surprised me and caused me great sorrow$", + "Her and Leo shared a common passion for history and the local area$", + "I think everyone liked her$", + "She got along with everyone. She loved her son dearly. As for the relations between mother-in-law and daughter-in-law ..$", + "Apart from Leo, she got along very well with Max ...$", + "Even if your relations were unfrequent, Jerome, there was still a place for you in her heart ...$", + "(370) Apart from her family, not a lot of people$", + "Oh right! I think she deeply regretted this friend's leaving .. err! Marielle .. or Mireille ...$", + "No, nothing!$", + "No … Not that I know of$", + "I met Julia when buying the manor. It was the only thing she owned. But all my wealth was hers ...$", + "Apart from a few personal belongings, I think she didn't own anything anymore$", + "I think all her fortune came from Leo. So, pfft!$", + "(377) Apart from the letter for you I posted, nothing very important!$", + "I was very happy she gave me her bound bible as a present$", + "It happened fast and she didn't have time to make any particular will$", + "Her last gift suprised me$", + "Which gift?$", + "A chandelier ...$", + "Yes, I got a present. My wife even got a bible$", + "Well yes! Like everyone, I believe$", + "A dagger$", + "I have never been looking around in the attic!$", + "(387) You either can read the past or pick a door$", + "The portrait of a young girl: it's Murielle ...$", + "You know, I didn't know her that well$", + "She was very charming, but above all she was Julia's lady-in-waiting$", + "She was the only truly interesting woman I've met$", + "She had a great knowledge in history, and you learned a great deal when you asked her about it$", + "(393) I've always wondered why some people fancied her!$", + "If the room is closed, ask Leo$", + "(395) I closed her door after her death and I'd like it to remain this way for a while$", + "You know how it is: family relations$", + "All those years, I've never regretted serving her$", + "I loved her as much as she loved me, I think$", + "What made you think you could enter my wife's room?!!$", + "It must be the picture of Murielle with Julia's godson$", + "I don't remember$", + "This is Murielle. I took that picture, and actually they developed it backwards$", + "You sure are curious!... It's not worth anything$", + "(404) Grimoires, parchment and manuscripts: it is Leo's realm$", + "Too bad the motto doesn't appear here ...$", + "This is beautiful … And very old ...$", + "Hey! That's a place I've never visited$", + "According to Leo, it seems that the Moons are more recent$", + "Even under this weather, you managed to find a sun ...$", + "Profound and disturbing: Progress is good$", + "For me, it remains the biggest of all mysteries$", + "The last days she was talking about a trip. And then ...$", + "A little over a year ago, one night, she decided to leave ...$", + "In any case, she wasn't meant to live here$", + "What?! Whose body? Which crypt?$", + "If there are any, I have never found them ...$", + "Of course! And ghosts too ...$", + "It's the oldest in the area: it is from the 11th century$", + "It was slightly renovated after the French Revolution$", + "Julia loved paintings$", + "They are different in styles, but not all of them are worth a lot$", + "What are you doing h-$", + "I'm sure you are looking for something in here$", + "I'm listening$", + "What do you want?$", + "Yes?$", + "I'm all yours ...$", + "What's the matter?$", + "Go ahead$", + "What is it about?$", + "Max: at your service, sir$", + "In any case you have no business being in here! Get out!!$", + "You are too curious!$", + "Jerome! It's been a while … I'm very sad to announce you that Julia died. Her family is here: Guy, her son; Eva, her daughter-in-law; Leo, her husband, of course; her son-in-law Pat; cousins, too: Bob, Ida, Luc. The storm is getting stronger, you must stay here. Meals are served at 12am and 7pm, and there is a mass at the chapel every day at 10am$", + "When I saw you I knew you would uncover the truth … I knew why you were here: I had found the draft of Julia's letter. But I love to play, so … She hadn't wanted your task to be too easy, to protect me, probably, but she couldn't die knowing this mystery would remain unsolved. Did you find out that the wall of silence is the name the builders gave, during the construction of the manor, to the wall on which the coat of arms hangs? .. And those gifts Julia left before dying were as many false leads, and their true purpose was to highlight how important the parchments were … That's right, more than a year ago I was working with Murielle on the decryption of those manuscripts I had just found. My wife made the connection between our work and Murielle's disappearance, but she never had any proof. Except that ring she found one day while going through my belongings. One night, we went exploring the secret passage we had found. Murielle died by accident in the room of the Virgin. I quickly took the ring from her, found the treasure and ran away. I didn't think she was still alive, and I didn't say a word because I needed the money. I told everyone the money was coming from a winning bet at the horseraces … Leave now, since you're not a policeman. Leave me alone!$", + "February 1951 ,,, Occupation: private eye. The cold was freezing Paris off, and my cases as well, when ...$", + "A letter, a call, memories from a childhood not that long ago. Echoes of the many games we played in the disused rooms of Mortville Manor … And Julia, now an old woman.$", " to the bureau$", " to the kitchen$", " to the cellar$", -- cgit v1.2.3 From 0a1dd302fe6b6e14e90801a949ef038b3b64e726 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Feb 2013 00:53:52 +0100 Subject: MORTEVIELLE: Some renaming, remove useless variables, add debugger --- engines/mortevielle/debugger.cpp | 36 +++++++++++++++++++++++++++++ engines/mortevielle/debugger.h | 45 +++++++++++++++++++++++++++++++++++++ engines/mortevielle/graphics.h | 4 ++-- engines/mortevielle/menu.cpp | 7 +++--- engines/mortevielle/menu.h | 4 ++-- engines/mortevielle/module.mk | 1 + engines/mortevielle/mortevielle.cpp | 23 ++++++++++++------- engines/mortevielle/mortevielle.h | 2 ++ 8 files changed, 107 insertions(+), 15 deletions(-) create mode 100644 engines/mortevielle/debugger.cpp create mode 100644 engines/mortevielle/debugger.h diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp new file mode 100644 index 0000000000..fc0e54ab6d --- /dev/null +++ b/engines/mortevielle/debugger.cpp @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "mortevielle/debugger.h" +#include "mortevielle/mortevielle.h" + +namespace Mortevielle { + +Debugger::Debugger() : GUI::Debugger() { + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); +} + +void Debugger::setParent(MortevielleEngine *vm) { + _vm = vm; +} + +} // End of namespace Mortevielle diff --git a/engines/mortevielle/debugger.h b/engines/mortevielle/debugger.h new file mode 100644 index 0000000000..57ca94e78b --- /dev/null +++ b/engines/mortevielle/debugger.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MORTEVIELLE_DEBUGGER_H +#define MORTEVIELLE_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" + +namespace Mortevielle { + +class MortevielleEngine; + +class Debugger : public GUI::Debugger { +private: + MortevielleEngine *_vm; + +public: + Debugger(); + virtual ~Debugger() {} + void setParent(MortevielleEngine *vm); +}; + +} // End of namespace Mortevielle + +#endif diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 03e0d016ec..7bf39c3662 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -48,8 +48,8 @@ public: class GfxSurface: public Graphics::Surface { private: int _xp, _yp; - int _xSize, _ySize, _var12; - int _var14, _lookupIndex, _lookupValue; + int _xSize, _ySize; + int _lookupIndex, _lookupValue; bool _nibbleFlag; int _thickness; int _yInc, _yEnd, _xInc, _xEnd; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 8e6d94c449..5d64961f23 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -390,9 +390,9 @@ void Menu::menuDown(int ii) { /** * Menu is being removed, so restore the previous background area. */ -void Menu::menuUp(int xx) { +void Menu::menuUp(int msgId) { if (_multiTitle) { - g_vm->charecr(10, (_menuConstants[xx - 1][1] + 1) << 1); + g_vm->charecr(10, (_menuConstants[msgId - 1][1] + 1) << 1); /* Restore the background area */ assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); @@ -420,8 +420,9 @@ void Menu::eraseMenu() { /** * Handle updates to the menu + * @remarks Originally called 'mdn' */ -void Menu::mdn() { +void Menu::updateMenu() { if (!_menuActive) return; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 03c091909e..712242e6bc 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -68,9 +68,9 @@ public: void enableMenuItem(int menuId); void displayMenu(); void drawMenu(); - void menuUp(int xx); + void menuUp(int msgId); void eraseMenu(); - void mdn(); + void updateMenu(); void initMenu(); void setSearchMenu(); diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 38e6e0508d..9cce597566 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -2,6 +2,7 @@ MODULE := engines/mortevielle MODULE_OBJS := \ actions.o \ + debugger.o \ detection.o \ dialogs.o \ graphics.o \ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 2b95bcea0e..3875d8d458 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -74,6 +74,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"), _soundManager(_mixer) { g_vm = this; + _debugger.setParent(this); _lastGameFrame = 0; _mouseClick = false; _inMainGameLoop = false; @@ -345,6 +346,8 @@ bool MortevielleEngine::keyPressed() { _lastGameFrame = g_system->getMillis(); _screenSurface.updateScreen(); + + _debugger.onFrame(); } // Delay briefly to keep CPU usage down @@ -409,8 +412,13 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { // Character to add char ch = evt.kbd.ascii; - // Handle alphabetic keys - if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { + // Check for debugger + if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger.attach(); + _debugger.onFrame(); + } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { + // Handle alphabetic keys if (evt.kbd.hasFlags(Common::KBD_CTRL)) ch = evt.kbd.keycode - Common::KEYCODE_a + 1; else @@ -523,6 +531,8 @@ void MortevielleEngine::delay(int amount) { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); _screenSurface.updateScreen(); + + _debugger.onFrame(); } g_system->delayMillis(10); @@ -647,7 +657,7 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { - _menu.mdn(); + _menu.updateMenu(); prepareRoom(); _mouse.moveMouse(funct, inkey); CHECK_QUIT; @@ -982,7 +992,7 @@ int MortevielleEngine::getPresenceStatsGreenRoom() { else if ((hour >= 0) && (hour < 8)) retVal = 70; - _menu.mdn(); + _menu.updateMenu(); return retVal; } @@ -2258,11 +2268,8 @@ Common::String MortevielleEngine::getString(int num) { } void MortevielleEngine::copcha() { - int i = kAcha; - do { + for (int i = kAcha; i < kAcha + 390; i++) _tabdon[i] = _tabdon[i + 390]; - ++i; - } while (i != kAcha + 390); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 81baab91b4..aeef3dd1e2 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -37,6 +37,7 @@ #include "engines/engine.h" #include "common/error.h" #include "graphics/surface.h" +#include "mortevielle/debugger.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" #include "mortevielle/mouse.h" @@ -475,6 +476,7 @@ public: // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; + Debugger _debugger; ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; -- cgit v1.2.3 From fab337c61c551beea5c8181a0d83694755e3867d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Feb 2013 00:55:58 +0100 Subject: MORTEVIELLE: Add new DAT file containing initial English translation --- dists/engine-data/mort.dat | Bin 79412 -> 77851 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 4415f57c29..f9cd1ec127 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From a5e263cd0533409c8b718363ccd1c8f04a801db5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 21 Feb 2013 07:57:31 +0100 Subject: MORTEVIELLE: Add two debug functions required to check the English translation --- engines/mortevielle/debugger.cpp | 17 +++++++++++++++++ engines/mortevielle/debugger.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index fc0e54ab6d..b0b9dc7d2c 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -27,8 +27,25 @@ namespace Mortevielle { Debugger::Debugger() : GUI::Debugger() { DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); + DCmd_Register("show_questions", WRAP_METHOD(Debugger, Cmd_showAllQuestions)); + DCmd_Register("reset_parano", WRAP_METHOD(Debugger, Cmd_resetParano)); } +bool Debugger::Cmd_showAllQuestions(int argc, const char **argv) { + for (int i = 1; i <= 10; ++i) + _vm->_coreVar._pctHintFound[i] = '*'; + + for (int i = 1; i <= 42; ++i) + _vm->_coreVar._availableQuestion[i] = '*'; + + return true; +} + +bool Debugger::Cmd_resetParano(int argc, const char **argv) { + _vm->_coreVar._faithScore = 0; + + return true; +} void Debugger::setParent(MortevielleEngine *vm) { _vm = vm; } diff --git a/engines/mortevielle/debugger.h b/engines/mortevielle/debugger.h index 57ca94e78b..9041d90110 100644 --- a/engines/mortevielle/debugger.h +++ b/engines/mortevielle/debugger.h @@ -34,6 +34,10 @@ class Debugger : public GUI::Debugger { private: MortevielleEngine *_vm; +protected: + bool Cmd_showAllQuestions(int argc, const char **argv); + bool Cmd_resetParano(int argc, const char **argv); + public: Debugger(); virtual ~Debugger() {} -- cgit v1.2.3 From 2ea263f62bbab12447d1f0080f8d93f1d706eeaf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 22 Feb 2013 13:42:01 +0100 Subject: MORTEVIELLE: Fix minor glitches in DAT file --- devtools/create_mortdat/gametext.h | 760 ++++++++++++++++++------------------- dists/engine-data/mort.dat | Bin 77851 -> 77839 bytes 2 files changed, 380 insertions(+), 380 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index 9efb55bc53..bd3c340f1b 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -285,7 +285,7 @@ const char *gameDataEn[] = { "Julia's bedroom$", "The photo at Julia's home$", "Julia and yourself...$", - "L‚o's occupations$", + "Léo's occupations$", "Pat's occupations$", "Guy's occupations$", "Bob's occupations$", @@ -294,7 +294,7 @@ const char *gameDataEn[] = { "Ida's occupations$", "Max's occupations$", "Your occupations$", - "L‚o's relationships$", + "Léo's relationships$", "Pat's relationships$", "Guy's relationships$", "Bob's relationships$", @@ -324,7 +324,7 @@ const char *gameDataEn[] = { "These are the mountains one can see in front of the manor$", "I don't know!$", "She died from pulmonary embolism$", - "Mother died suddenly. And yet her health had seemed to improve‚$", + "Mother died suddenly. And yet her health had seemed to improve$", "Miss DEFRANCK died from a cold$", "She died from pulmonary embolism$", "Excuse me but I prefer to say nothing for now$", @@ -345,13 +345,13 @@ const char *gameDataEn[] = { "Him and Pat are patners. I think it's going pretty well$", "I take care of myself and that's already lots. How about you?$", "(319) Oh that! I trust her. She knows how to keep herself busy$", - "(320) What! You have not yet discovered her main occupation..?$", + "(320) What! You have not yet discovered her main occupation...?$", "She is working in the decoration business, and tastefully with that. She is always very well dressed$", "If you like jewels, I have some good deals to propose for a short while$", "The jewels...$", "I don't know, but I'd like him to give me a bit more slack!$", "When one is a housewife, one always find something to do...$", - "She could stay there doing nothing, but no! She sews, she reads ...$", + "She could stay there doing nothing, but no! She sews, she reads...$", "She probably doesn't have very fulfilling occupations...$", "A woman like there is no more: She is interested in everything!$", "With the cooking and the cleaning I do not have much time for you$", @@ -360,24 +360,24 @@ const char *gameDataEn[] = { "I am very independant. As long as nobody interferes in my business: No problem$", "He is selfish. I wonder if he likes something else than his horses and grimoires$", "I think he gets along well with everyone, except, perhaps, with Guy$", - "He has a temper. You have to learn how to deal with him ..$", - "Business is business. As for the family, I leave it as it is ...$", + "He has a temper. You have to learn how to deal with him...$", + "Business is business. As for the family, I leave it as it is...$", "Relations? Friendly relations? Financial relations, without a doubt$", "Oh I don't have anything against him$", - "He is a resourceful businessman. He sometimes tries to swim upstream but … he will always find a way to make it work$", - "(340) They all bore me .. No! Not even that .. Even if .. some people ..$", - "Contrary to his mother, he is a very shy person ! So when you say relations ..$", + "He is a resourceful businessman. He sometimes tries to swim upstream but... he will always find a way to make it work$", + "(340) They all bore me... No! Not even that... Even if... some people...$", + "Contrary to his mother, he is a very shy person ! So when you say relations...$", "He must be trying very hard to remain nice despite all his troubles$", "(343) His romantic relationship: it's over. His relationship with me: hasn't really started. As for the other ones: I don't follow the \"other ones\"$", "I like everyone, as long as they are not trying to screw me over$", "It is not enough to have a bit of money and to know how to talk for everyone to like you$", - "Not much to say about him .. He is a nice and generous man. And what's more, he can be quite funny$", + "Not much to say about him... He is a nice and generous man. And what's more, he can be quite funny$", "Nowadays I get along rather well with everyone. But, here, I am not going to say more about this$", "(348) Nice feathers, but a bird's brain... Ask her husband$", "Is it for an appointment?$", "(350) She is very lively! She does not burden herself with stupids prejudices$", "In my line of work, one mostly encounters beautiful women and gangsters$", - "The only sure thing he has going for him, it's his jewelery .. And his wife, but he doesn't realize that$", + "The only sure thing he has going for him, it's his jewelery... And his wife, but he doesn't realize that$", "It's an interesting character. Who is not always very easy to follow, but worth knowing$", "I hate no one, but I like things and people when they stay where they should be$", "This stays between us. But you see: when I speak with her, I soon start to feel a bit uncomfortable!$", @@ -385,21 +385,21 @@ const char *gameDataEn[] = { "You know, in my line of work you hear everything but don't remember anything, and service is well done$", "He's a submissive hypocrite! Personally I don't trust him$", "I don't know what he thinks deep down inside, but he's always polite and impeccable$", - "Someone who lived in the manor, a year ago .. maybe more$", + "Someone who lived in the manor, a year ago... maybe more$", "She was more than a friend to my mother. In these moments, I would have loved to have her by my side$", "Murielle has been Julia's lady-in-waiting$", - "She, too, was doing some research ...$", + "She, too, was doing some research...$", "She was a very educated person. Her abrupt leaving, a year ago, surprised me and caused me great sorrow$", "Her and Leo shared a common passion for history and the local area$", "I think everyone liked her$", - "She got along with everyone. She loved her son dearly. As for the relations between mother-in-law and daughter-in-law ..$", - "Apart from Leo, she got along very well with Max ...$", - "Even if your relations were unfrequent, Jerome, there was still a place for you in her heart ...$", + "She got along with everyone. She loved her son dearly. As for the relations between mother-in-law and daughter-in-law...$", + "Apart from Leo, she got along very well with Max....$", + "Even if your relations were unfrequent, Jerome, there was still a place for you in her heart...$", "(370) Apart from her family, not a lot of people$", - "Oh right! I think she deeply regretted this friend's leaving .. err! Marielle .. or Mireille ...$", + "Oh right! I think she deeply regretted this friend's leaving... err! Marielle... or Mireille...$", "No, nothing!$", - "No … Not that I know of$", - "I met Julia when buying the manor. It was the only thing she owned. But all my wealth was hers ...$", + "No... Not that I know of$", + "I met Julia when buying the manor. It was the only thing she owned. But all my wealth was hers...$", "Apart from a few personal belongings, I think she didn't own anything anymore$", "I think all her fortune came from Leo. So, pfft!$", "(377) Apart from the letter for you I posted, nothing very important!$", @@ -407,13 +407,13 @@ const char *gameDataEn[] = { "It happened fast and she didn't have time to make any particular will$", "Her last gift suprised me$", "Which gift?$", - "A chandelier ...$", + "A chandelier...$", "Yes, I got a present. My wife even got a bible$", "Well yes! Like everyone, I believe$", "A dagger$", "I have never been looking around in the attic!$", "(387) You either can read the past or pick a door$", - "The portrait of a young girl: it's Murielle ...$", + "The portrait of a young girl: it's Murielle...$", "You know, I didn't know her that well$", "She was very charming, but above all she was Julia's lady-in-waiting$", "She was the only truly interesting woman I've met$", @@ -430,19 +430,19 @@ const char *gameDataEn[] = { "This is Murielle. I took that picture, and actually they developed it backwards$", "You sure are curious!... It's not worth anything$", "(404) Grimoires, parchment and manuscripts: it is Leo's realm$", - "Too bad the motto doesn't appear here ...$", - "This is beautiful … And very old ...$", + "Too bad the motto doesn't appear here...$", + "This is beautiful... And very old...$", "Hey! That's a place I've never visited$", "According to Leo, it seems that the Moons are more recent$", - "Even under this weather, you managed to find a sun ...$", + "Even under this weather, you managed to find a sun...$", "Profound and disturbing: Progress is good$", "For me, it remains the biggest of all mysteries$", - "The last days she was talking about a trip. And then ...$", - "A little over a year ago, one night, she decided to leave ...$", + "The last days she was talking about a trip. And then...$", + "A little over a year ago, one night, she decided to leave...$", "In any case, she wasn't meant to live here$", "What?! Whose body? Which crypt?$", - "If there are any, I have never found them ...$", - "Of course! And ghosts too ...$", + "If there are any, I have never found them...$", + "Of course! And ghosts too...$", "It's the oldest in the area: it is from the 11th century$", "It was slightly renovated after the French Revolution$", "Julia loved paintings$", @@ -452,17 +452,17 @@ const char *gameDataEn[] = { "I'm listening$", "What do you want?$", "Yes?$", - "I'm all yours ...$", + "I'm all yours...$", "What's the matter?$", "Go ahead$", "What is it about?$", "Max: at your service, sir$", "In any case you have no business being in here! Get out!!$", "You are too curious!$", - "Jerome! It's been a while … I'm very sad to announce you that Julia died. Her family is here: Guy, her son; Eva, her daughter-in-law; Leo, her husband, of course; her son-in-law Pat; cousins, too: Bob, Ida, Luc. The storm is getting stronger, you must stay here. Meals are served at 12am and 7pm, and there is a mass at the chapel every day at 10am$", - "When I saw you I knew you would uncover the truth … I knew why you were here: I had found the draft of Julia's letter. But I love to play, so … She hadn't wanted your task to be too easy, to protect me, probably, but she couldn't die knowing this mystery would remain unsolved. Did you find out that the wall of silence is the name the builders gave, during the construction of the manor, to the wall on which the coat of arms hangs? .. And those gifts Julia left before dying were as many false leads, and their true purpose was to highlight how important the parchments were … That's right, more than a year ago I was working with Murielle on the decryption of those manuscripts I had just found. My wife made the connection between our work and Murielle's disappearance, but she never had any proof. Except that ring she found one day while going through my belongings. One night, we went exploring the secret passage we had found. Murielle died by accident in the room of the Virgin. I quickly took the ring from her, found the treasure and ran away. I didn't think she was still alive, and I didn't say a word because I needed the money. I told everyone the money was coming from a winning bet at the horseraces … Leave now, since you're not a policeman. Leave me alone!$", - "February 1951 ,,, Occupation: private eye. The cold was freezing Paris off, and my cases as well, when ...$", - "A letter, a call, memories from a childhood not that long ago. Echoes of the many games we played in the disused rooms of Mortville Manor … And Julia, now an old woman.$", + "Jerome! It's been a while... I'm very sad to announce you that Julia died. Her family is here: Guy, her son; Eva, her daughter-in-law; Leo, her husband, of course; her son-in-law Pat; cousins, too: Bob, Ida, Luc. The storm is getting stronger, you must stay here. Meals are served at 12am and 7pm, and there is a mass at the chapel every day at 10am$", + "When I saw you I knew you would uncover the truth... I knew why you were here: I had found the draft of Julia's letter. But I love to play, so ŕ She hadn't wanted your task to be too easy, to protect me, probably, but she couldn't die knowing this mystery would remain unsolved. Did you find out that the wall of silence is the name the builders gave, during the construction of the manor, to the wall on which the coat of arms hangs?.. And those gifts Julia left before dying were as many false leads, and their true purpose was to highlight how important the parchments were ŕ That's right, more than a year ago I was working with Murielle on the decryption of those manuscripts I had just found. My wife made the connection between our work and Murielle's disappearance, but she never had any proof. Except that ring she found one day while going through my belongings. One night, we went exploring the secret passage we had found. Murielle died by accident in the room of the Virgin. I quickly took the ring from her, found the treasure and ran away. I didn't think she was still alive, and I didn't say a word because I needed the money. I told everyone the money was coming from a winning bet at the horseraces ŕ Leave now, since you're not a policeman. Leave me alone!$", + "February 1951... Occupation: private eye. The cold was freezing Paris off, and my cases as well, when...$", + "A letter, a call, memories from a childhood not that long ago. Echoes of the many games we played in the disused rooms of Mortville Manor... And Julia, now an old woman.$", " to the bureau$", " to the kitchen$", " to the cellar$", @@ -493,7 +493,7 @@ const char *gameDataEn[] = { "Directed by: KYILKHOR CREATION and LANGLOIS$", "$", "With the cooperation of...$", - "B‚atrice et Jean_Luc LANGLOIS$", + "Béatrice et Jean_Luc LANGLOIS$", "for the music and the voices,$", "Bernard GRELAUD for the graphic conception,$", "MARIA-DOLORES for the graphic direction,$", @@ -592,7 +592,7 @@ const char *gameDataEn[] = { "- 11$", "What was the first name@of the unknown character?$", "- Mireille$", - "- Fran‡oise$", + "- Françoise$", "- Maguy$", "- Emilie$", "- Murielle$", @@ -609,7 +609,7 @@ const char *gameDataEn[] = { "[1][ | Disk error | All stop... ][ok]$", "[1][ | You should have noticed |00% of the clues ][ok]$", "[3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", "TBT - MASTER .$", "TBT - rorL$", NULL @@ -617,9 +617,9 @@ const char *gameDataEn[] = { const char *gameDataFr[] = { "Le calme dans la tourmente$", - "Des go—ts et des couleurs!$", + "Des goűts et des couleurs!$", "Mauve qui peut!$", - "PriŠre de laisser en sortant...$", + "Pričre de laisser en sortant...$", "Trou noir troublant$", "Bleu... comme \"peur bleue\"!$", "Chambre de \"Saigneur\"!$", @@ -629,33 +629,33 @@ const char *gameDataFr[] = { "Odeur de feux de bois et de tabac$", "Tabac et vieux bouquins$", "Oignons, cannelle et spiritueux$", - "Un endroit bien peu visit‚$", - "Humidit‚ et moisissure$", + "Un endroit bien peu visité$", + "Humidité et moisissure$", "Avis aux colporteurs...$", - "Corps putr‚fi‚ : cryptomanie mortelle!$", - "Et en plus... des piŠges d‚samorc‚s!$", - "C'est d‚j… ouvert$", + "Corps putréfié : cryptomanie mortelle!$", + "Et en plus... des pičges désamorcés!$", + "C'est déjŕ ouvert$", "Danger : avalanches$", - "Une odeur de saintet‚!$", + "Une odeur de sainteté!$", "Une btisse imposante$", - "L'envers du mystŠre!$", - "Dr“le d'horoscope!$", + "L'envers du mystčre!$", + "Drôle d'horoscope!$", "Tant va la cruche...$", - "Une porte en chŠne$", + "Une porte en chčne$", "Une photo$", "Les armoiries$", "$", - "Max, le domestique, vous accueille puis vous conduit … votre chambre$", - "Mortevielle, le 16/2/51@ Mon cher J‚r“me,@ Suite … mon t‚l‚gramme, je vous fais part des raisons de mon inqui‚tude :il y a un an, Murielle, ma dame de compagnie, disparaissait . D‚part ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile … comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'… pr‚sent, faire le jour sur cette affaire, je compte sur vous pour la mener … bien . Si mon ‚tat de sant‚ ne s'am‚liorait pas, prenez les d‚cisions qui vous sembleront le plus appropri‚es...@ Amiti‚s. JULIA DEFRANCK$", - "Plus tard, Guy vous apprendra le suicide de L‚o... aprŠs un pari insens‚ aux courses!$", + "Max, le domestique, vous accueille puis vous conduit ŕ votre chambre$", + "Mortevielle, le 16/2/51@ Mon cher Jérôme,@ Suite ŕ mon télégramme, je vous fais part des raisons de mon inquiétude :il y a un an, Murielle, ma dame de compagnie, disparaissait . Départ ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile ŕ comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'ŕ présent, faire le jour sur cette affaire, je compte sur vous pour la mener ŕ bien . Si mon état de santé ne s'améliorait pas, prenez les décisions qui vous sembleront le plus appropriées...@ Amitiés. JULIA DEFRANCK$", + "Plus tard, Guy vous apprendra le suicide de Léo... aprčs un pari insensé aux courses!$", "F3: encore@F8: suite$", - "Le maŚtre des lieux$", - "Le futur h‚ritier$", + "Le maître des lieux$", + "Le futur héritier$", "Le fils de JULIA$", "Joli brin!!!$", "Superman!$", "Le mari d'Ida$", - "Propos int‚ressants?$", + "Propos intéressants?$", "Service compris...$", "Rien dessous!$", "Un ange passe...$", @@ -663,61 +663,61 @@ const char *gameDataFr[] = { "Admirez! Contemplez!$", "Non ! Rien !$", "Impossible$", - "‡a tache !$", - "Un trait‚ sur l'histoire de la r‚gion$", - "Quelques piŠces$", + "ça tache !$", + "Un traité sur l'histoire de la région$", + "Quelques pičces$", "Premier commandement...$", - "Des p‚tales plein les narines !$", + "Des pétales plein les narines !$", "Pique, Coeur...$", - "‡a ne manque pas de cachets !$", + "ça ne manque pas de cachets !$", "Un roman d'amour$", "Souffler n'est pas jouer$", - "Pas une r‚ussite!$", + "Pas une réussite!$", "Gare aux rebondissements !$", "Sombre et profond...$", "Sensations normales$", "Sniff!$", "Pas discret ! Contentez-vous de regarder !$", - "Atchoum! De la p... poussiŠre$", - "La toile est sign‚e... pas le papier peint !$", + "Atchoum! De la p... poussičre$", + "La toile est signée... pas le papier peint !$", "Pas de chance, rien !$", "Soyez plus discret !$", "Les volets sont clos$", "De la neige, encore de la neige !$", - "G‚nial : une toile de maŚtre !$", - "Aucun doute : une v‚ritable imitation$", + "Génial : une toile de maître !$", + "Aucun doute : une véritable imitation$", "Hum ! Vous tiquez : de l'antique en toc !$", - "Une piŠce rare de valeur !$", + "Une pičce rare de valeur !$", "Rien de remarquable$", "Linge, objets personnels...$", - "Pas n'importe o— !$", + "Pas n'importe oů !$", "Ce n'est pas l'heure !$", - "On ne parle pas la bouche pleine ! Donc, une fois le repas termin‚...$", + "On ne parle pas la bouche pleine ! Donc, une fois le repas terminé...$", "Quelqu'un entre, s'affaire, ressort...$", "On s'approche de votre cachette !$", "On vous surprend !$", - "Non : vous tes trop charg‚ !$", + "Non : vous ętes trop chargé !$", "Essayez de nouveau$", "Vous restez perplexe !?$", "Vous quittez le Manoir. A Paris, un message vous attend...$", - "A‹e, a‹e, a‹e !$", + "Aďe, aďe, aďe !$", "Rien de plus$", - "Le son paraŚt normal$", + "Le son paraît normal$", "Ca ne bouge pas$", - "On vous r‚pond$", + "On vous répond$", "Pas le moment !$", - "Mme matiŠre, autre face !$", - "Le reflet est piqu‚, mais le cadre est d'or$", + "Męme matičre, autre face !$", + "Le reflet est piqué, mais le cadre est d'or$", "Bibelots, babioles...$", - "Vous essuyez un ‚chec !$", + "Vous essuyez un échec !$", "Il est des odeurs... qu'il vaut mieux ne pas voir !$", - "Des produits m‚nagers$", - "‡a vous d‚mange ?$", - "C'est coinc‚, gel‚ ! Brrrr...$", - "Les huisseries sont bloqu‚es !$", + "Des produits ménagers$", + "ça vous démange ?$", + "C'est coincé, gelé ! Brrrr...$", + "Les huisseries sont bloquées !$", "Des papiers...$", - "Non ! Le pŠre Nol n'est pas coinc‚ !$", - "‡a donne sur un couloir$", + "Non ! Le pčre Noęl n'est pas coincé !$", + "ça donne sur un couloir$", "Vaisselle, argenterie...$", "Non ! Ce ne sont pas les restes de Julia !$", "Une gravure ancienne$", @@ -726,17 +726,17 @@ const char *gameDataFr[] = { "Le passage se ferme$", "Un tiroir secret... Un livret ! Le lisez-vous ?$", "Le tiroir se referme$", - "Rien ! Sang et chairs collent … la pierre !$", - "Des d‚tails vous font supposer que... la mort ne fut pas imm‚diate !$", - "Des projets v‚reux ?$", - "Sa vie n'aurait-elle tenu qu'… un doigt ?$", - "Un tr‚sor se serait-il fait la malle ?$", - "Une fente de la taille d'une piŠce !$", - "Quelques pierres pivotent... Une crypte ! Y p‚n‚trez-vous ?$", + "Rien ! Sang et chairs collent ŕ la pierre !$", + "Des détails vous font supposer que... la mort ne fut pas immédiate !$", + "Des projets véreux ?$", + "Sa vie n'aurait-elle tenu qu'ŕ un doigt ?$", + "Un trésor se serait-il fait la malle ?$", + "Une fente de la taille d'une pičce !$", + "Quelques pierres pivotent... Une crypte ! Y pénétrez-vous ?$", "La bague tourne, le mur se referme...$", - "Une colonne de pierres derriŠre l'autel$", + "Une colonne de pierres derričre l'autel$", "Il y a du bruit...$", - "Occup‚ !$", + "Occupé !$", "Retentez-vous votre chance ?$", "Trop profond !$", "Le mur de la cave pivote$", @@ -745,45 +745,45 @@ const char *gameDataFr[] = { "L'objet glisse au fond...$", "Vous n'avez rien en main$", "Ce n'est pas ouvert$", - "Il y a d‚j… quelque chose$", - "La porte est ferm‚e$", - "Pas de r‚ponse$", + "Il y a déjŕ quelque chose$", + "La porte est fermée$", + "Pas de réponse$", "Une boule de bois pleine$", "Il n'y a plus de place$", - "Une boule de bois perc‚e par le travers$", + "Une boule de bois percée par le travers$", "? ?$", "A vous de jouer$", "OK !$", - "Soudain Max survient avec votre valise : \"Merci de votre visite ! D‚tective \"priv‚\"... de bon sens et de discr‚tion sans doute\" . D‚‡u d‚moralis‚, vous quittez le manoir@Vous Štes NUL !$", - "L‚o vous interrompt : \"la tempŠte est calm‚e. Je pars en ville dans 1 heure. Tenez-vous prt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", - "Congestion, grippe fatale : vous y restez ! Votre enquŠte tombe … l'eau$", - "L'eau monte trŠs vite et refroidit vos derniŠres illusions... Avant que vous n'ayez eu le temps de r‚agir, vous Štes mort!$", - "A peine Štes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", - "La tempŠte recouvre vos traces . Un mur de silence s'abat sur vos ‚paules . Lentement vous succombez … la morsure du froid !$", - "Pas si seul que ‡a ! Une lame glac‚e s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", - "Vous ignorez la responsabilit‚ exacte de L‚o dans la mort de Murielle... Est-elle morte sur le coup ? De toutes fa‡ons les problŠmes familiaux d‚couverts lors de votre enquŠte justifient l'attitude de L‚o... Vous n'Štes pas s—r que Julia vous ait appel‚ pour ‡a mais c'est suffisant pour vous ! Par respect pour elle, et aprŠs certaines pr‚cautions, vous avez une entrevue r‚v‚latrice avec L‚o$", + "Soudain Max survient avec votre valise : \"Merci de votre visite ! Détective \"privé\"... de bon sens et de discrétion sans doute\" . Déçu démoralisé, vous quittez le manoir@Vous čtes NUL !$", + "Léo vous interrompt : \"la tempčte est calmée. Je pars en ville dans 1 heure. Tenez-vous pręt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", + "Congestion, grippe fatale : vous y restez ! Votre enqučte tombe ŕ l'eau$", + "L'eau monte trčs vite et refroidit vos derničres illusions... Avant que vous n'ayez eu le temps de réagir, vous čtes mort!$", + "A peine čtes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", + "La tempčte recouvre vos traces . Un mur de silence s'abat sur vos épaules . Lentement vous succombez ŕ la morsure du froid !$", + "Pas si seul que ça ! Une lame glacée s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", + "Vous ignorez la responsabilité exacte de Léo dans la mort de Murielle... Est-elle morte sur le coup ? De toutes façons les problčmes familiaux découverts lors de votre enqučte justifient l'attitude de Léo... Vous n'čtes pas sűr que Julia vous ait appelé pour ça mais c'est suffisant pour vous ! Par respect pour elle, et aprčs certaines précautions, vous avez une entrevue révélatrice avec Léo$", "$", - "Vous n'avez pas les clefs du Manoir . Vos appels restent sans r‚ponse . Vous allez attraper... la mort !$", - "D'un mouvement circulaire, l'‚p‚e vous fend par le travers : tripes et boyaux … l'air, bonjour les vers!$", + "Vous n'avez pas les clefs du Manoir . Vos appels restent sans réponse . Vous allez attraper... la mort !$", + "D'un mouvement circulaire, l'épée vous fend par le travers : tripes et boyaux ŕ l'air, bonjour les vers!$", "Home, Sweet home !$", - "MystŠre d'une porte close$", - "Charme envo—tant de vieilles piŠces$", + "Mystčre d'une porte close$", + "Charme envoűtant de vieilles pičces$", "La faim au ventre$", - "Plus prŠs du ciel? Pas s—r !$", + "Plus prčs du ciel? Pas sűr !$", "Peur du noir?$", "Vieux tapis et reflets d'or$", "Angoisse !$", - "Sauv‚ ? Pas certain !$", - "Mal … l'aise, hein !$", + "Sauvé ? Pas certain !$", + "Mal ŕ l'aise, hein !$", "Toujours plus loin !$", "Votre chemin de croix !$", - "A la d‚couverte de...$", - "Attention … ce que cache...$", + "A la découverte de...$", + "Attention ŕ ce que cache...$", "Une descente aux Enfers !$", "Si ce n'est pas dans vos cordes :@ ne soyez pas sot!$", - "Avant la mise en piŠce !$", + "Avant la mise en pičce !$", "Gros plan sur :$", - "Vous remarquez particuliŠrement...$", + "Vous remarquez particuličrement...$", "Et encore...$", "C'est fini !$", "Un peu de lecture$", @@ -794,17 +794,17 @@ const char *gameDataFr[] = { "Non ! Pas ce coup-ci$", "Trop tard$", "$", - "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumiŠre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artŠre comme un rat au coeur mme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", - "10/1/50: Nous avons r‚solu le mystŠre du manuscrit et localis‚ la crypte . Est-ce l'id‚e d'aboutir dans ce qui n'‚tait qu'un \"rŠve\" qui me rend si anxieuse ?@Je regrette de m'tre engag‚e vis … vis de L‚o . Non! je dois continuer ! J'aurais d— mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", - "Porte ta priŠre au lieu saint qui se doit, changes-en l'air, tu auras la matiŠre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton …me s'ouvrira un chemin et gagnera son Šre . Avance comme un Orph‚e peu soucieux des t‚nŠbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'… la myst‚rieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premiŠre.$", - "Les montagnes sont les crocs d'une gueule dantesque ouverte … l'infini de quelqu' orgie c‚leste, mastiquant des ‚toiles comme nous broyons du noir .@Tu d‚poseras l'accord de pierre … tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mŠtre . Tu passeras ainsi entre les deux croissants, par del… les abŚmes du Mur du Silence . La Cl‚ des champs est … ta port‚e, tu n'as qu'… retrouver la note qui d‚note.$", + "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumičre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artčre comme un rat au coeur męme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", + "10/1/50: Nous avons résolu le mystčre du manuscrit et localisé la crypte . Est-ce l'idée d'aboutir dans ce qui n'était qu'un \"ręve\" qui me rend si anxieuse ?@Je regrette de m'ętre engagée vis ŕ vis de Léo . Non! je dois continuer ! J'aurais dű mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", + "Porte ta pričre au lieu saint qui se doit, changes-en l'air, tu auras la matičre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton âme s'ouvrira un chemin et gagnera son čre . Avance comme un Orphée peu soucieux des ténčbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'ŕ la mystérieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premičre.$", + "Les montagnes sont les crocs d'une gueule dantesque ouverte ŕ l'infini de quelqu' orgie céleste, mastiquant des étoiles comme nous broyons du noir .@Tu déposeras l'accord de pierre ŕ tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mčtre . Tu passeras ainsi entre les deux croissants, par delŕ les abîmes du Mur du Silence . La Clé des champs est ŕ ta portée, tu n'as qu'ŕ retrouver la note qui dénote.$", " DECEMBRE@ 9 REMISE 518 13 AGIOS 23@ 19 VIREMENT 1203 17 TRESOR 1598@ TOTAL 1721 TOTAL 1721$", - " Le 5/01/51@@ Luc, mon amour@ Guy connaŚt notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'… toi ! Max me relance mais j'ai d‚finitivement rompu avec lui . Qu'il reste … ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", - " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr‚t‚s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", - " Mortevielle, le 15/2/51@ MaŚtre,@ Je vous ‚cris au sujet de notre affaire. Je suis d‚cid‚ … aller jusqu'au bout, certain que mon associ‚, Pat DEFRANCK, a falsifi‚ un livre de comptes . Malgr‚$", + " Le 5/01/51@@ Luc, mon amour@ Guy connaît notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'ŕ toi ! Max me relance mais j'ai définitivement rompu avec lui . Qu'il reste ŕ ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", + " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai prétés pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", + " Mortevielle, le 15/2/51@ Maître,@ Je vous écris au sujet de notre affaire. Je suis décidé ŕ aller jusqu'au bout, certain que mon associé, Pat DEFRANCK, a falsifié un livre de comptes . Malgré$", " Une pipe$", - " Un stylo … plume$", - " Un briquet … essence$", + " Un stylo ŕ plume$", + " Un briquet ŕ essence$", " Une cornue$", " Un blaireau$", " Un pot de peinture$", @@ -814,13 +814,13 @@ const char *gameDataFr[] = { " Un vieux bouquin$", " Un porte-monnaie$", " Un poignard$", - " Un r‚volver$", + " Un révolver$", " Une bible$", " Une bougie$", - " Un coffret … bijoux$", - " Un fer … repasser$", + " Un coffret ŕ bijoux$", + " Un fer ŕ repasser$", " Une photo$", - " Une montre … gousset$", + " Une montre ŕ gousset$", " Une corde$", " Des clefs$", " Un collier de perles$", @@ -830,9 +830,9 @@ const char *gameDataFr[] = { " Une bourse en cuir$", " Une balle de tennis$", " Des munitions$", - " Un rasoir … main$", - " Une brosse … cheveux$", - " Une brosse … linge$", + " Un rasoir ŕ main$", + " Une brosse ŕ cheveux$", + " Une brosse ŕ linge$", " Un jeu de cartes$", " Un chausse pied$", " Un tournevis$", @@ -843,14 +843,14 @@ const char *gameDataFr[] = { " Un pinceau$", " Une corde$", " Un objet en bois$", - " Des somnifŠres$", + " Des somnifčres$", " Une bague en or$", - " Un coffret … bijoux$", - " Un r‚veil matin$", + " Un coffret ŕ bijoux$", + " Un réveil matin$", " Une cotte de mailles$", " Un chandellier$", " Une paire de gants$", - " Une coupe cisel‚e$", + " Une coupe ciselée$", " Un parchemin$", " Un poignard$", " Un dossier$", @@ -868,13 +868,13 @@ const char *gameDataFr[] = { "La mort de Julia$", "Les relations de Julia$", "Un message de Julia$", - "L'h‚ritage de Julia$", + "L'héritage de Julia$", "Derniers actes de Julia$", "Les cadeaux de Julia$", "La chambre de Julia$", "La photo chez Julia$", "Julia et vous...$", - "Les occupations de L‚o$", + "Les occupations de Léo$", "Les occupations de Pat$", "Les occupations de Guy$", "Les occupations de Bob$", @@ -883,7 +883,7 @@ const char *gameDataFr[] = { "Les occupations d'Ida$", "Les occupations de Max$", "Vos occupations$", - "Les relations de L‚o$", + "Les relations de Léo$", "Les relations de Pat$", "Les relations de Guy$", "Les relations de Bob$", @@ -910,169 +910,169 @@ const char *gameDataFr[] = { "$", "FIN DE LA CONVERSATION$", "Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "C'est le massif montagneux que l'on aperçoit devant le manoir$", "Je n'en sais rien !$", "Elle est morte d'une embolie pulmonaire$", - "Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "Ma mére est morte soudainement . Son état semblait pourtant s'ętre amélioré$", "Madame DEFRANCK est morte d'un coup de froid$", "Elle est morte d'une embolie pulmonaire$", - "Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "Pardonnez moi mais je préfčre, actuellement garder le silence$", "Ce sont toujours les meilleurs qui partent les premiers$", - "J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", - "Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", - "C'est un homme dynamique qui a r‚ussi dans le parfum$", - "Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", - "J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", - "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "J'aimais beaucoup ma mčre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "C'est une région qui a un passé chargé et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "C'est un passionné d'histoire et un joueur invétéré . D'ailleurs, voici un an il a gagné une grosse somme$", + "Il a déjŕ beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "Je suis PDG d'une petite société de parfums . Mais quand je suis ici, je me repose$", + "C'est un homme dynamique qui a réussi dans le parfum$", + "Lui ! C'est un arriviste véreux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soirées dans sa chambre$", + "J'ai été trčs préoccupé par la santé de ma mčre, et maintenant je n'ai plus goűt ŕ rien$", + "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mčre$", "Ce sont ses affaires ...$", "Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", - "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", - "Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", - "Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", - "Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", - "Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", - "Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", - "Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "Je travaille avec Pat mais ça ne va pas trčs fort en ce moment$", + "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper sérieusement alors$", + "Lui et Pat sont associés . Je crois que ça ne va pas trop mal$", + "Je m'occupe de moi et c'est déjŕ beaucoup . Et vous ?$", + "Oh ça ! Je lui fais confiance . Elle sait s'occuper$", + "Mais ! Vous n'avez pas encore découvert son occupation principale ...?$", + "Elle fait dans la décoration avec beaucoup degoűt d'ailleurs . Elle est toujours trčs bien habillée$", + "Si les bijoux vous interessent, j'ai quelques affaires interessantes ŕ saisir rapidement$", "Les bijoux ...$", "Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "Quand on est une femme d'intérieur on trouve toujours de quoi s'occuper...$", "Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "Elle n'a sűrement pas des occupations trčs épanouissantes ...$", "Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "Entre la cuisine et le ménage, je n'ai pas beaucoup de temps ŕ vous accorder$", "Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", - "Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", - "C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", - "C'est un homme de caractŠre . Il faut savoir le prendre ..$", - "Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", - "Relations ? Relations amicales ? Relations financiŠres sans doute$", - "Moi je n'ai rien … lui reprocher$", - "C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", - "Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", - "A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", - "Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", - "Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "Il en ferait plus si il s'occupait moins des ragôts et de la bouteille$", + "Je suis trčs indépendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problčme$", + "C'est un égoďste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "Je crois qu'il s'entend bien avec tout le monde, mis ŕ part, peut ętre, avec Guy$", + "C'est un homme de caractčre . Il faut savoir le prendre ..$", + "Les affaires sont les affaires . Quant ŕ la famille, je la laisse pour ce qu'elle est ...$", + "Relations ? Relations amicales ? Relations financičres sans doute$", + "Moi je n'ai rien ŕ lui reprocher$", + "C'est un homme d'affaire débrouillard . Il nage parfois ŕ contre-courant mais ... il s'en sortira toujours$", + "Ils m'ennuient tous .. Non ! Ce n'est męme pas ça .. Quoique .. certains ..$", + "A l'inverse de sa mčre, c'est une personne trčs renfermée ! Alors question relations ..$", + "Il doit sans doute faire beaucoup d'effort pour rester agréable malgré tous ses ennuis$", + "Ses relations amoureuses : C'est terminé . Ses relations avec moi : Pas vraiment commencées . Quant aux autres : Je ne suis pas les \"autres\"$", "J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", - "Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", - "Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", - "Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "Il ne suffit pas d'avoir un peu d'argent et d'ętre beau parleur pour plaire ŕ tout le monde$", + "Sans histoire .. C'est quelqu'un d'agréable et généreux . De plus, il ne manque pas d'humour$", + "Actuellement je m'entends plutôt bien avec tout le monde . Mais, ici, je ne vais pas m'étendre sur le sujet$", + "Beau plumage, mais ça ne vole pas haut ... Parlez en ŕ son mari$", "C'est pour un rendez-vous ?$", - "Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", - "Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", - "La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", - "C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", - "Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", - "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", - "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", - "Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "Elle est trčs vivante ! Elle ne s'embarrasse pas de préjugés stupides$", + "Dans mon métier, on côtoit surtout des belles femmes et des truands$", + "La seule valeur sűre chez lui, c'est ses bijoux .. Et sa femme, mais ça il ne s'en rend pas compte$", + "C'est quelqu'un d'interessant . De pas toujours facile ŕ comprendre, mais qui mérite le détour$", + "Je ne déteste personne, mais j'aime les choses et les gens quand ils sont ŕ leur place$", + "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite ŕ l'étroit !$", + "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volonté$", + "Vous savez dans mon métier on entend tout mais on ne retient rien, et le service est bien fait$", "C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", - "C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", - "C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", - "Murielle a ‚t‚ la dame de compagnie de Julia$", + "Je ne connait pas le fond de sa pensée mais c'est quelqu'un de toujours trčs correct et impeccable$", + "C'était une personne qui a vécu au manoir, il y a un an .. peut ętre plus$", + "C'était plus qu'une amie pour ma mčre . En ces moments, j'aurais aimé qu'elle soit ŕ mes cotés$", + "Murielle a été la dame de compagnie de Julia$", "Elle aussi, faisait des recherches ...$", - "C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", - "Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "C'était une femme trčs cultivée . Son brusque départ, il y a un an, m'a surpris et beaucoup chagriné$", + "Elle partageait avec Léo sa passion de l'histoire et de la région$", "Je crois que tout le monde l'aimait bien$", - "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", - "A part L‚o, elle avait de trŠs bon rapport avec Max ...$", - "Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mčre, belle-fille ..$", + "A part Léo, elle avait de trčs bon rapport avec Max ...$", + "Bien que vos relations furent peu soutenues, Jérôme, elle vous portait toujours dans son coeur ...$", "A part sa famille, pas grand monde$", - "Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "Ah oui ! Je crois qu'elle a beaucoup regretté le départ de cette amie .. euh ! Marielle .. ou Mireille ...$", "Non rien !$", "Non ... Pas que le sache$", - "J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", - "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", - "Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", - "A part la lettre pour vous que j'ai post‚, rien de bien important !$", - "J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", - "Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", - "Son dernier pr‚sent m'a surpris$", + "J'ai connu Julia en achetant le manoir . C'était son seul bien . Mais toute ma fortune était la sienne ...$", + "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien ŕ elle$", + "Je crois que toute sa fortune venait de Léo . Alors, Pfuuut !$", + "A part la lettre pour vous que j'ai posté, rien de bien important !$", + "J'ai été trčs heureuse qu'elle m'offre sa bible reliée$", + "Ca a été rapide et elle n'a pas eu le temps de prendre des dispositions particuličres$", + "Son dernier présent m'a surpris$", "Quel cadeau ?$", "Un chandellier ...$", - "Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "Oui, j'ai eu un cadeau . Ma femme a męme eu une bible$", "Et bien oui ! Comme tout le monde, je crois$", "Un poignard$", - "Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "Je n'ai jamais été fouiller dans le grenier !$", "Vous avez un don de double-vue ou un passe-partout$", "Le portrait d'une jeune fille : C'est Murielle ...$", "Vous savez, je la connaissais assez peu$", - "Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", - "C'est la seule femme vraiment interessante que j'ai rencontr‚$", - "Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", - "Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", - "Si la chambre est ferm‚e, demandez … L‚o$", - "J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "Elle était trčs charmante, mais c'était surtout la dame de compagnie de Julia$", + "C'est la seule femme vraiment interessante que j'ai rencontré$", + "Elle avait de grandes connaissances historiques, et la consulter était trčs enrichissant$", + "Je me suis toujours demandé ce que certains pouvaient lui trouver !$", + "Si la chambre est fermée, demandez ŕ Léo$", + "J'ai fermé sa chambre aprčs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", "Vous savez ce que c'est : Des relations familiales$", - "Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "Durant toutes ces années, je ne l'ai jamais servie ŕ contre-coeur$", "Je l'aimais autant qu'elle m'aimais, je crois$", - "De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "De quel droit avez-vous pénétré dans la chambre de ma femme ?!!$", "C'est sans doute la photo de Murielle avec le filleul de Julia$", "Je ne me rappelle pas$", - "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", - "Vous tes bien curieux !... C'est sans valeur$", - "Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tirée ŕ l'envers$", + "Vous ętes bien curieux !... C'est sans valeur$", + "Grimoires, parchemins et manuscrits : C'est le domaine de Léo$", "Dommage que la devise soit manquante ...$", - "C'est trŠs beau ... Et trŠs vieux ...$", - "Tiens ! C'est un endroit que je n'ai jamais visit‚$", - "D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", - "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", - "Profond et inqui‚tant : Le progrŠs a du bon$", - "Ca reste pour moi le plus grand des mystŠres$", + "C'est trčs beau ... Et trčs vieux ...$", + "Tiens ! C'est un endroit que je n'ai jamais visité$", + "D'aprés Léo, il semblerait que les Lunes soient plus récentes$", + "Męme par ce temps, vous avez déniché un soleil ...$", + "Profond et inquiétant : Le progrčs a du bon$", + "Ca reste pour moi le plus grand des mystčres$", "Les derniers temps elle parlait d'un voyage . Et puis ...$", - "Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", - "De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "Il y a un peu plus d'un an, un soir, elle a décidé de partir ...$", + "De toutes façons elle n'était pas faite pour vivre ici$", "Quoi ?! Quel corps ? Quel crypte ?$", - "Si il y en a, je ne les ai jamais trouv‚ ...$", - "Bien s–r ! ... Et des fant“mes aussi ...$", - "C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", - "Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "Si il y en a, je ne les ai jamais trouvé ...$", + "Bien sűr ! ... Et des fantômes aussi ...$", + "C'est la plus vielle de la région : Elle date du XI eme sičcle$", + "Elle fut légčrement restaurée aprčs la révolution$", "Julia aimait beaucoup la peinture$", - "Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", - "Que faites-vous l… ?$", - "Je suis s–r que vous cherchez quelque chose ici$", - "Je vous ‚coute$", - "Que d‚sirez-vous ?$", + "Ils ont différents styles, mais n'ont pas tous une trčs grande valeur$", + "Que faites-vous lŕ ?$", + "Je suis sűr que vous cherchez quelque chose ici$", + "Je vous écoute$", + "Que désirez-vous ?$", "Oui ?$", - "Je suis … vous ...$", + "Je suis ŕ vous ...$", "C'est pourquoi ?$", "Allez-y$", - "C'est … quel sujet ?$", - "Max : … votre service, monsieur$", - "De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", - "Vous tes trop curieux !$", - "J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", - "En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", - "F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", - "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "C'est ŕ quel sujet ?$", + "Max : ŕ votre service, monsieur$", + "De toutes façons vous n'avez rien ŕ faire ici ! Sortez !!$", + "Vous ętes trop curieux !$", + "Jérôme ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . Léo, son mari bien sűr . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempčte redouble, il vous faut rester . Les repas sont ŕ 12h et 19h et il y a un recueillement ŕ la chapelle tous les jours ŕ 10h$", + "En vous voyant j'ai compris que vous decouvririez la vérité ... Car je savais pourquoi vous veniez : J'avais retrouvé le brouillon de la lettre de Julia . Mais je suis trčs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me protéger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous découvert que le mur du silence est le nom que les maçons ont donné au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laissé avant de mourir étaient autant de faux indices qui ne servaient qu'ŕ faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au décryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouvé un jour dans mes affaires . Une nuit, nous nous sommes aventurés dans le passage secret que nous avions découvert . Murielle est morte par accident dans la pičce de la vierge . J'ai récupéré la bague rapidement, trouvé le trésor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'ętes pas de la police . Laissez moi seul !$", + "Février 1951 ... Profession : detective privé . Le froid figeait Paris et mes affaires lorsque ...$", + "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les pičces délabrées du manoir de Mortevielle . Julia, une vieille femme a présent .$", " au bureau$", - " … la cuisine$", - " … la cave$", + " ŕ la cuisine$", + " ŕ la cave$", " dans le couloir$", " dehors$", - " la salle … manger$", + " la salle ŕ manger$", " dans le manoir$", " devant le manoir$", - " … la chapelle$", + " ŕ la chapelle$", " devant le puits$", " au nord$", - " derriŠre le manoir$", + " derričre le manoir$", " au sud$", - " … l'est$", - " … l'ouest$", + " ŕ l'est$", + " ŕ l'ouest$", " vers le manoir$", " plus loin$", " dans l'eau$", " hors du puits$", " dans le puits$", - " choix sur ‚cran$", + " choix sur écran$", " Dans la serie MYSTERE...$", " LE MANOIR DE MORTEVIELLE$", "$", @@ -1095,9 +1095,9 @@ const char *gameDataFr[] = { " A VOUS DE JOUER$", " attacher$", " attendre$", - " d‚foncer$", + " défoncer$", " dormir$", - " ‚couter$", + " écouter$", " entrer$", " fermer$", " fouiller$", @@ -1119,7 +1119,7 @@ const char *gameDataFr[] = { " lire$", " poser$", " regarder$", - " L‚o$", + " Léo$", " Pat$", " Guy$", " Eva$", @@ -1128,40 +1128,40 @@ const char *gameDataFr[] = { " Ida$", " Max$", "Comment Julia est-elle morte ?$", - "Elle s'est suicid‚e$", - "Elle est morte assassin‚e$", + "Elle s'est suicidée$", + "Elle est morte assassinée$", "Elle est morte accidentellement$", "Elle est morte naturellement$", - "D'o— provenait l'argent qui a permis la restauration du manoir ?$", + "D'oů provenait l'argent qui a permis la restauration du manoir ?$", "chantage$", "travail$", - "h‚ritage$", + "héritage$", "courses$", "rentes$", "hold-up$", - "d‚couverte$", - "Quel est le hobby de L‚o ?$", + "découverte$", + "Quel est le hobby de Léo ?$", "recherches historiques$", "politique$", "peinture$", "drogue$", "sciences occultes$", "direction d'une secte$", - "Julia a laiss‚ une s‚rie d'indices . Ceux-ci sont repr‚sent‚s en un seul lieu . Lequel ?$", + "Julia a laissé une série d'indices . Ceux-ci sont représentés en un seul lieu . Lequel ?$", "Chapelle$", - "Ext‚rieur$", + "Extérieur$", "Cave$", "Grenier$", "Cuisine$", - "Salle … manger$", + "Salle ŕ manger$", "Chambre Julia$", - "Chambre L‚o$", + "Chambre Léo$", "Chambre Pat$", "Chambre Bob$", "Chambre Max$", "Chambre Luc/Ida$", "Chambre Guy/Eva$", - "L'indice principal qui vous a permis d'arriver … la porte du souterrain est :$", + "L'indice principal qui vous a permis d'arriver ŕ la porte du souterrain est :$", "Un poignard$", "Une bague$", "Un livre$", @@ -1175,30 +1175,30 @@ const char *gameDataFr[] = { "Trois$", "Quatre$", "Cinq$", - "Combien de personnes sont m‚l‚es … cette histoire - Julia y comprise, vous except‚ - ?$", + "Combien de personnes sont mélées ŕ cette histoire - Julia y comprise, vous excepté - ?$", "Neuf$", "Dix$", "Onze$", - "Quel ‚tait le pr‚nom de la personne inconnue ?$", + "Quel était le prénom de la personne inconnue ?$", "Mireille$", - "Fran‡oise$", + "Françoise$", "Maguy$", "Emilie$", "Murielle$", "Sophie$", - "De qui Murielle ‚tait-elle la maŚtresse ?$", + "De qui Murielle était-elle la maîtresse ?$", "Bob$", "Luc$", "Guy$", - "L‚o$", + "Léo$", "Max$", "Murielle partageait une occupation avec une autre personne . Qui ?$", - "[1][ |Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", - "[1][ |Ins‚rez la disquette 1 dans le lecteur A][ok]$", + "[1][ |Seul le hazard vous a permis d'arriver ici . Vous préférez|retourner enquéter afin de mieux comprendre ...][ok]$", + "[1][ |Insérez la disquette 1 dans le lecteur A][ok]$", "[1][ |! ERREUR DISQUETTE !|On arrete tout][ok]$", - "[1][ |Vous devriez avoir remarqu‚|00% des indices][ok]$", - "[1][ |Ins‚rez la disquette 2 dans le lecteur A][ok]$", - "[1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "[1][ |Vous devriez avoir remarqué|00% des indices][ok]$", + "[1][ |Insérez la disquette 2 dans le lecteur A][ok]$", + "[1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", " MASTER .$", " rorL$", }; @@ -1462,7 +1462,7 @@ const char *gameDataDe[] = { "TBT - Julia's bedroom$", "TBT - The photo at Julia's home$", "TBT - Julia and yourself...$", - "TBT - L‚o's occupations$", + "TBT - Léo's occupations$", "TBT - Pat's occupations$", "TBT - Guy's occupations$", "TBT - Bob's occupations$", @@ -1471,7 +1471,7 @@ const char *gameDataDe[] = { "TBT - Ida's occupations$", "TBT - Max's occupations$", "TBT - Your occupations$", - "TBT - L‚o's relationships$", + "TBT - Léo's relationships$", "TBT - Pat's relationships$", "TBT - Guy's relationships$", "TBT - Bob's relationships$", @@ -1498,148 +1498,148 @@ const char *gameDataDe[] = { "TBT - $", "TBT - END OF THE CONVERSATION$", "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "TBT - C'est le massif montagneux que l'on aperçoit devant le manoir$", "TBT - Je n'en sais rien !$", "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "TBT - Ma mére est morte soudainement . Son état semblait pourtant s'ętre amélioré$", "TBT - Madame DEFRANCK est morte d'un coup de froid$", "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "TBT - Pardonnez moi mais je préfčre, actuellement garder le silence$", "TBT - Ce sont toujours les meilleurs qui partent les premiers$", - "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", - "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", - "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", - "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", - "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", - "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "TBT - J'aimais beaucoup ma mčre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "TBT - C'est une région qui a un passé chargé et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "TBT - C'est un passionné d'histoire et un joueur invétéré . D'ailleurs, voici un an il a gagné une grosse somme$", + "TBT - Il a déjŕ beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "TBT - Je suis PDG d'une petite société de parfums . Mais quand je suis ici, je me repose$", + "TBT - C'est un homme dynamique qui a réussi dans le parfum$", + "TBT - Lui ! C'est un arriviste véreux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soirées dans sa chambre$", + "TBT - J'ai été trčs préoccupé par la santé de ma mčre, et maintenant je n'ai plus goűt ŕ rien$", + "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mčre$", "TBT - Ce sont ses affaires ...$", "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", - "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", - "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", - "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", - "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", - "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", - "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", - "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "TBT - Je travaille avec Pat mais ça ne va pas trčs fort en ce moment$", + "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper sérieusement alors$", + "TBT - Lui et Pat sont associés . Je crois que ça ne va pas trop mal$", + "TBT - Je m'occupe de moi et c'est déjŕ beaucoup . Et vous ?$", + "TBT - Oh ça ! Je lui fais confiance . Elle sait s'occuper$", + "TBT - Mais ! Vous n'avez pas encore découvert son occupation principale ..?$", + "TBT - Elle fait dans la décoration avec beaucoup degoűt d'ailleurs . Elle est toujours trčs bien habillée$", + "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes ŕ saisir rapidement$", "TBT - Les bijoux ...$", "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "TBT - Quand on est une femme d'intérieur on trouve toujours de quoi s'occuper...$", "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "TBT - Elle n'a sűrement pas des occupations trčs épanouissantes ...$", "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "TBT - Entre la cuisine et le ménage, je n'ai pas beaucoup de temps ŕ vous accorder$", "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", - "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", - "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", - "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", - "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", - "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", - "TBT - Moi je n'ai rien … lui reprocher$", - "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", - "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", - "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", - "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", - "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "TBT - Il en ferait plus si il s'occupait moins des ragôts et de la bouteille$", + "TBT - Je suis trčs indépendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problčme$", + "TBT - C'est un égoďste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "TBT - Je crois qu'il s'entend bien avec tout le monde, mis ŕ part, peut ętre, avec Guy$", + "TBT - C'est un homme de caractčre . Il faut savoir le prendre ..$", + "TBT - Les affaires sont les affaires . Quant ŕ la famille, je la laisse pour ce qu'elle est ...$", + "TBT - Relations ? Relations amicales ? Relations financičres sans doute$", + "TBT - Moi je n'ai rien ŕ lui reprocher$", + "TBT - C'est un homme d'affaire débrouillard . Il nage parfois ŕ contre-courant mais ... il s'en sortira toujours$", + "TBT - Ils m'ennuient tous .. Non ! Ce n'est męme pas ça .. Quoique .. certains ..$", + "TBT - A l'inverse de sa mčre, c'est une personne trčs renfermée ! Alors question relations ..$", + "TBT - Il doit sans doute faire beaucoup d'effort pour rester agréable malgré tous ses ennuis$", + "TBT - Ses relations amoureuses : C'est terminé . Ses relations avec moi : Pas vraiment commencées . Quant aux autres : Je ne suis pas les \"autres\"$", "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", - "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", - "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", - "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "TBT - Il ne suffit pas d'avoir un peu d'argent et d'ętre beau parleur pour plaire ŕ tout le monde$", + "TBT - Sans histoire .. C'est quelqu'un d'agréable et généreux . De plus, il ne manque pas d'humour$", + "TBT - Actuellement je m'entends plutôt bien avec tout le monde . Mais, ici, je ne vais pas m'étendre sur le sujet$", + "TBT - Beau plumage, mais ça ne vole pas haut ... Parlez en ŕ son mari$", "TBT - C'est pour un rendez-vous ?$", - "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", - "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", - "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", - "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", - "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", - "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", - "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", - "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "TBT - Elle est trčs vivante ! Elle ne s'embarrasse pas de préjugés stupides$", + "TBT - Dans mon métier, on côtoit surtout des belles femmes et des truands$", + "TBT - La seule valeur sűre chez lui, c'est ses bijoux .. Et sa femme, mais ça il ne s'en rend pas compte$", + "TBT - C'est quelqu'un d'interessant . De pas toujours facile ŕ comprendre, mais qui mérite le détour$", + "TBT - Je ne déteste personne, mais j'aime les choses et les gens quand ils sont ŕ leur place$", + "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite ŕ l'étroit !$", + "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volonté$", + "TBT - Vous savez dans mon métier on entend tout mais on ne retient rien, et le service est bien fait$", "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", - "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", - "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", - "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", + "TBT - Je ne connait pas le fond de sa pensée mais c'est quelqu'un de toujours trčs correct et impeccable$", + "TBT - C'était une personne qui a vécu au manoir, il y a un an .. peut ętre plus$", + "TBT - C'était plus qu'une amie pour ma mčre . En ces moments, j'aurais aimé qu'elle soit ŕ mes cotés$", + "TBT - Murielle a été la dame de compagnie de Julia$", "TBT - Elle aussi, faisait des recherches ...$", - "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", - "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "TBT - C'était une femme trčs cultivée . Son brusque départ, il y a un an, m'a surpris et beaucoup chagriné$", + "TBT - Elle partageait avec Léo sa passion de l'histoire et de la région$", "TBT - Je crois que tout le monde l'aimait bien$", - "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", - "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", - "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mčre, belle-fille ..$", + "TBT - A part Léo, elle avait de trčs bon rapport avec Max ...$", + "TBT - Bien que vos relations furent peu soutenues, Jérôme, elle vous portait toujours dans son coeur ...$", "TBT - A part sa famille, pas grand monde$", - "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "TBT - Ah oui ! Je crois qu'elle a beaucoup regretté le départ de cette amie .. euh ! Marielle .. ou Mireille ...$", "TBT - Non rien !$", "TBT - Non ... Pas que le sache$", - "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", - "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", - "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", - "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", - "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", - "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", - "TBT - Son dernier pr‚sent m'a surpris$", + "TBT - J'ai connu Julia en achetant le manoir . C'était son seul bien . Mais toute ma fortune était la sienne ...$", + "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien ŕ elle$", + "TBT - Je crois que toute sa fortune venait de Léo . Alors, Pfuuut !$", + "TBT - A part la lettre pour vous que j'ai posté, rien de bien important !$", + "TBT - J'ai été trčs heureuse qu'elle m'offre sa bible reliée$", + "TBT - Ca a été rapide et elle n'a pas eu le temps de prendre des dispositions particuličres$", + "TBT - Son dernier présent m'a surpris$", "TBT - Quel cadeau ?$", "TBT - Un chandellier ...$", - "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "TBT - Oui, j'ai eu un cadeau . Ma femme a męme eu une bible$", "TBT - Et bien oui ! Comme tout le monde, je crois$", "TBT - Un poignard$", - "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "TBT - Je n'ai jamais été fouiller dans le grenier !$", "TBT - Vous avez un don de double-vue ou un passe-partout$", "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", "TBT - Vous savez, je la connaissais assez peu$", - "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", - "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", - "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", - "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", - "TBT - Si la chambre est ferm‚e, demandez … L‚o$", - "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "TBT - Elle était trčs charmante, mais c'était surtout la dame de compagnie de Julia$", + "TBT - C'est la seule femme vraiment interessante que j'ai rencontré$", + "TBT - Elle avait de grandes connaissances historiques, et la consulter était trčs enrichissant$", + "TBT - Je me suis toujours demandé ce que certains pouvaient lui trouver !$", + "TBT - Si la chambre est fermée, demandez ŕ Léo$", + "TBT - J'ai fermé sa chambre aprčs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", "TBT - Vous savez ce que c'est : Des relations familiales$", - "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "TBT - Durant toutes ces années, je ne l'ai jamais servie ŕ contre-coeur$", "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", - "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "TBT - De quel droit avez-vous pénétré dans la chambre de ma femme ?!!$", "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", "TBT - Je ne me rappelle pas$", - "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", - "TBT - Vous tes bien curieux !... C'est sans valeur$", - "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tirée ŕ l'envers$", + "TBT - Vous ętes bien curieux !... C'est sans valeur$", + "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de Léo$", "TBT - Dommage que la devise soit manquante ...$", - "TBT - C'est trŠs beau ... Et trŠs vieux ...$", - "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", - "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", - "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", - "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", - "TBT - Ca reste pour moi le plus grand des mystŠres$", + "TBT - C'est trčs beau ... Et trčs vieux ...$", + "TBT - Tiens ! C'est un endroit que je n'ai jamais visité$", + "TBT - D'aprés Léo, il semblerait que les Lunes soient plus récentes$", + "TBT - Męme par ce temps, vous avez déniché un soleil ...$", + "TBT - Profond et inquiétant : Le progrčs a du bon$", + "TBT - Ca reste pour moi le plus grand des mystčres$", "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", - "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", - "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "TBT - Il y a un peu plus d'un an, un soir, elle a décidé de partir ...$", + "TBT - De toutes façons elle n'était pas faite pour vivre ici$", "TBT - Quoi ?! Quel corps ? Quel crypte ?$", - "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", - "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", - "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", - "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "TBT - Si il y en a, je ne les ai jamais trouvé ...$", + "TBT - Bien sűr ! ... Et des fantômes aussi ...$", + "TBT - C'est la plus vielle de la région : Elle date du XI eme sičcle$", + "TBT - Elle fut légčrement restaurée aprčs la révolution$", "TBT - Julia aimait beaucoup la peinture$", - "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", - "TBT - Que faites-vous l… ?$", - "TBT - Je suis s–r que vous cherchez quelque chose ici$", - "TBT - Je vous ‚coute$", - "TBT - Que d‚sirez-vous ?$", + "TBT - Ils ont différents styles, mais n'ont pas tous une trčs grande valeur$", + "TBT - Que faites-vous lŕ ?$", + "TBT - Je suis sűr que vous cherchez quelque chose ici$", + "TBT - Je vous écoute$", + "TBT - Que désirez-vous ?$", "TBT - Oui ?$", - "TBT - Je suis … vous ...$", + "TBT - Je suis ŕ vous ...$", "TBT - C'est pourquoi ?$", "TBT - Allez-y$", - "TBT - C'est … quel sujet ?$", - "TBT - Max : … votre service, monsieur$", - "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", - "TBT - Vous tes trop curieux !$", - "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", - "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", - "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", - "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "TBT - C'est ŕ quel sujet ?$", + "TBT - Max : ŕ votre service, monsieur$", + "TBT - De toutes façons vous n'avez rien ŕ faire ici ! Sortez !!$", + "TBT - Vous ętes trop curieux !$", + "TBT - Jérôme ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . Léo, son mari bien sűr . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempčte redouble, il vous faut rester . Les repas sont ŕ 12h et 19h et il y a un recueillement ŕ la chapelle tous les jours ŕ 10h$", + "TBT - En vous voyant j'ai compris que vous decouvririez la vérité ... Car je savais pourquoi vous veniez : J'avais retrouvé le brouillon de la lettre de Julia . Mais je suis trčs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me protéger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous découvert que le mur du silence est le nom que les maçons ont donné au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laissé avant de mourir étaient autant de faux indices qui ne servaient qu'ŕ faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au décryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouvé un jour dans mes affaires . Une nuit, nous nous sommes aventurés dans le passage secret que nous avions découvert . Murielle est morte par accident dans la pičce de la vierge . J'ai récupéré la bague rapidement, trouvé le trésor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'ętes pas de la police . Laissez moi seul !$", + "TBT - Février 1951 ... Profession : detective privé . Le froid figeait Paris et mes affaires lorsque ...$", + "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les pičces délabrées du manoir de Mortevielle . Julia, une vieille femme a présent .$", "TBT - to the bureau$", "TBT - to the kitchen$", "TBT - to the cellar$", @@ -1670,7 +1670,7 @@ const char *gameDataDe[] = { "TBT - Directed by: KYILKHOR CREATION and LANGLOIS$", "TBT - $", "TBT - With the cooperation of...$", - "TBT - B‚atrice et Jean_Luc LANGLOIS$", + "TBT - Béatrice et Jean_Luc LANGLOIS$", "TBT - for the music and the voices,$", "TBT - Bernard GRELAUD for the graphic conception,$", "TBT - MARIA-DOLORES for the graphic direction,$", @@ -1769,7 +1769,7 @@ const char *gameDataDe[] = { "TBT - - 11$", "TBT - What was the first name@of the unknown character?$", "TBT - - Mireille$", - "TBT - - Fran‡oise$", + "TBT - - Françoise$", "TBT - - Maguy$", "TBT - - Emilie$", "TBT - - Murielle$", @@ -1786,7 +1786,7 @@ const char *gameDataDe[] = { "TBT - [1][ | Disk error | All stop... ][ok]$", "TBT - [1][ | You should have noticed |00% of the clues ][ok]$", "TBT - [3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", "TBT - MASTER .$", "TBT - rorL$", NULL diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index f9cd1ec127..0731d3c2c9 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 348e149739c6d97f282e352f6a97db6fff0be2dc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Feb 2013 08:21:38 +0100 Subject: MORTEVIELLE: Integrate translations fixes. --- devtools/create_mortdat/gametext.h | 782 ++++++++++++++++++------------------- dists/engine-data/mort.dat | Bin 77839 -> 77889 bytes 2 files changed, 391 insertions(+), 391 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index bd3c340f1b..ebaa422f2c 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -103,7 +103,7 @@ const char *gameDataEn[] = { "Linen, personal belongings...$", "Not just anywhere!$", "It's not time!$", - "One doesn't speak with ones mouth full!$", + "One doesn't speak with ones mouth full! So once the meal is over...$", "Someone comes in, messes about then goes out again$", "Someone's approaching your hiding-place$", "Someone surprises you!$", @@ -120,7 +120,7 @@ const char *gameDataEn[] = { "The same matter, from another angle!$", "The reflection is tarnished, but the frame is gold!$", "Bric-a-brac$", - "Face to face with failure!$", + "Facing failure!$", "Smells like something you'd rather not see!$", "Cleaning products$", "Got an itch?$", @@ -168,11 +168,11 @@ const char *gameDataEn[] = { "Suddenly Max arrives with your suitcase: \"Thank you for your @visit!\".Mister discreet \"private eye\" (in need of a private optici@an!). Thoroughly demoralised, you@leave the manor. You are useless!$", "Leo interrupts: \"The storm has died down,I am going into town in@1 hour. Get ready\". You have lost@time...but not your life$", "Congestion, the deadly flu... You@are stuck here! Your whole case@sinks slowly beneath the water$", - "The water is rising fast,freezing your last illusions. Before you@have time to react...you are dead$", + "The water is rising fast, freezing your last illusions. Before you@have time to react...you are dead$", "As soon as you reach the bottom of the well, a hand cuts the rope@Farewell sweet life!$", "The storm covers your footprints.A wall of silence falls heavily@on your shoulders. Slowly you succumb to frosbite...$", - "You're not completely alone! A cold blade plunges into your backup@In future, be more care!$", - "You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case,the family problems thatyou have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", + "You're not completely alone! A cold blade plunges into your back@In future, be more careful!$", + "You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case, the family problems that you have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", "$", "You don't have the keys to the manor. Your cries rest unheard@You're going to catch... your death!$", "With a circular movement, the sword slices across you. Guts and@intestines spill out all over. A sorry state of affairs!$", @@ -205,8 +205,8 @@ const char *gameDataEn[] = { "No, not just now$", "Too late$", "$", - "Like a deep stony stare, a solitary eye that points towards the@stars; the artery that links hea-ven and hell. You must fathom@these depths keeping hold of that@which is, and will become. Monday, Tuesday, Wednesday, Sunday, from@Monday 1st to Sunday 1st,plunging from one day to the next your@\"IS\" or \"WILL BECOME\". Carrying your burden with love and light,@the smallest oversight will seal your fate.$", - "10/1/51: We think we've solved the mystery of the manuscript and@located the crypt. Is it the idea@of success in what seems like a dream that disturbs me so? I feel@I have committed myself rather too much, as far as Leo is concer@ned... No! I should go on. @I should have put Guy in the pic-ture but for a week now, I've had@no news of him$", + "Like a deep stony stare, a solitary eye that points towards the@stars; the artery that links hea-ven and hell. You must fathom@these depths keeping hold of that@which is, and will become. Monday, Tuesday, Wednesday, Sunday, from@the first Monday to the first Sunday,plunging from one day to the next your@\"IS\" or \"WILL BECOME\". Carrying your burden with love and light,@the smallest oversight will seal your fate.$", + "10/1/51: We think we've solved the mystery of the manuscript and@located the crypt. Is it the idea@of success in what seems like a dream that disturbs me so? I feel@I have committed myself rather too much, as far as Leo is @concerned... No! I mustgo on. @I should have put Guy in the picture but for a week now, I've had@no news of him$", "Take your prayers as you would to the holy place. From the pillar@of wisdom, bring the sun to his@knees. Thus will it show you the place to offer alms of another@kind and like young Arthur, open the way of darkness.White is your@colour, golden your hearth. So@advance with caution Orpheus and light your way unto the sad@virgin. Offer her the circle of the man with three faces. That he@may regain the world and turn with it to its original@inglory!$", "The mountains are the fangs in a monstrous mouth opening on the@finity of a celestial orgy, grin-ding the stars as we grind our@teeth into dust. You will drop your chord of stone at your feet.@The laugh of silence at the@highest pitch, and in your right hand, the measure of genius. Thus@will you pass between the two crescents beyond the abyss of the@wall of silence. The key to the melody is within your grasp. It@suffices to find the note that clashes.$", " 9/12 INTER. 518 3/13 EXPENS. 23@ 9/12 SALES 1203 7/12 CHEQUE 1598@ TOTAL 1721 TOTAL 1721$", @@ -285,7 +285,7 @@ const char *gameDataEn[] = { "Julia's bedroom$", "The photo at Julia's home$", "Julia and yourself...$", - "Léo's occupations$", + "L‚o's occupations$", "Pat's occupations$", "Guy's occupations$", "Bob's occupations$", @@ -294,7 +294,7 @@ const char *gameDataEn[] = { "Ida's occupations$", "Max's occupations$", "Your occupations$", - "Léo's relationships$", + "L‚o's relationships$", "Pat's relationships$", "Guy's relationships$", "Bob's relationships$", @@ -324,7 +324,7 @@ const char *gameDataEn[] = { "These are the mountains one can see in front of the manor$", "I don't know!$", "She died from pulmonary embolism$", - "Mother died suddenly. And yet her health had seemed to improve$", + "Mother died suddenly. And yet her health had seemed to improve‚$", "Miss DEFRANCK died from a cold$", "She died from pulmonary embolism$", "Excuse me but I prefer to say nothing for now$", @@ -345,20 +345,20 @@ const char *gameDataEn[] = { "Him and Pat are patners. I think it's going pretty well$", "I take care of myself and that's already lots. How about you?$", "(319) Oh that! I trust her. She knows how to keep herself busy$", - "(320) What! You have not yet discovered her main occupation...?$", + "(320) What! You have not yet discovered her main occupation..?$", "She is working in the decoration business, and tastefully with that. She is always very well dressed$", "If you like jewels, I have some good deals to propose for a short while$", "The jewels...$", "I don't know, but I'd like him to give me a bit more slack!$", "When one is a housewife, one always find something to do...$", "She could stay there doing nothing, but no! She sews, she reads...$", - "She probably doesn't have very fulfilling occupations...$", + "She has probably not very fulfilling occupations...$", "A woman like there is no more: She is interested in everything!$", "With the cooking and the cleaning I do not have much time for you$", - "I do not know how he manages to do everything. That's wonderful!$", + "I do not know how he manages to do everything. That's wonderful!", "He would do more if he showed less interest in gossip and alcohol$", "I am very independant. As long as nobody interferes in my business: No problem$", - "He is selfish. I wonder if he likes something else than his horses and grimoires$", + "He is selfish. I wonder if he likes something other than his horses and grimoires$", "I think he gets along well with everyone, except, perhaps, with Guy$", "He has a temper. You have to learn how to deal with him...$", "Business is business. As for the family, I leave it as it is...$", @@ -388,12 +388,12 @@ const char *gameDataEn[] = { "Someone who lived in the manor, a year ago... maybe more$", "She was more than a friend to my mother. In these moments, I would have loved to have her by my side$", "Murielle has been Julia's lady-in-waiting$", - "She, too, was doing some research...$", + "She, too, was doing some research....$", "She was a very educated person. Her abrupt leaving, a year ago, surprised me and caused me great sorrow$", "Her and Leo shared a common passion for history and the local area$", "I think everyone liked her$", "She got along with everyone. She loved her son dearly. As for the relations between mother-in-law and daughter-in-law...$", - "Apart from Leo, she got along very well with Max....$", + "Apart from Leo, she got along very well with Max...$", "Even if your relations were unfrequent, Jerome, there was still a place for you in her heart...$", "(370) Apart from her family, not a lot of people$", "Oh right! I think she deeply regretted this friend's leaving... err! Marielle... or Mireille...$", @@ -460,10 +460,10 @@ const char *gameDataEn[] = { "In any case you have no business being in here! Get out!!$", "You are too curious!$", "Jerome! It's been a while... I'm very sad to announce you that Julia died. Her family is here: Guy, her son; Eva, her daughter-in-law; Leo, her husband, of course; her son-in-law Pat; cousins, too: Bob, Ida, Luc. The storm is getting stronger, you must stay here. Meals are served at 12am and 7pm, and there is a mass at the chapel every day at 10am$", - "When I saw you I knew you would uncover the truth... I knew why you were here: I had found the draft of Julia's letter. But I love to play, so ŕ She hadn't wanted your task to be too easy, to protect me, probably, but she couldn't die knowing this mystery would remain unsolved. Did you find out that the wall of silence is the name the builders gave, during the construction of the manor, to the wall on which the coat of arms hangs?.. And those gifts Julia left before dying were as many false leads, and their true purpose was to highlight how important the parchments were ŕ That's right, more than a year ago I was working with Murielle on the decryption of those manuscripts I had just found. My wife made the connection between our work and Murielle's disappearance, but she never had any proof. Except that ring she found one day while going through my belongings. One night, we went exploring the secret passage we had found. Murielle died by accident in the room of the Virgin. I quickly took the ring from her, found the treasure and ran away. I didn't think she was still alive, and I didn't say a word because I needed the money. I told everyone the money was coming from a winning bet at the horseraces ŕ Leave now, since you're not a policeman. Leave me alone!$", + "When I saw you I knew you would uncover the truth... I knew why you were here: I had found the draft of Julia's letter. But I love to play, so... She hadn't wanted your task to be too easy, to protect me, probably, but she couldn't die knowing this mystery would remain unsolved. Did you find out that the wall of silence is the name the builders gave, during the construction of the manor, to the wall on which the coat of arms hangs?... And those gifts Julia left before dying were as many false leads, and their true purpose was to highlight how important the parchments were... That's right, more than a year ago I was working with Murielle on the decryption of those manuscripts I had just found. My wife made the connection between our work and Murielle's disappearance, but she never had any proof. Except that ring she found one day while going through my belongings. One night, we went exploring the secret passage we had found. Murielle died by accident in the room of the Virgin. I quickly took the ring from her, found the treasure and ran away. I didn't think she was still alive, and I didn't say a word because I needed the money. I told everyone the money was coming from a winning bet at the horseraces... Leave now, since you're not a policeman. Leave me alone!$", "February 1951... Occupation: private eye. The cold was freezing Paris off, and my cases as well, when...$", "A letter, a call, memories from a childhood not that long ago. Echoes of the many games we played in the disused rooms of Mortville Manor... And Julia, now an old woman.$", - " to the bureau$", + " to the office$", " to the kitchen$", " to the cellar$", " to the landing$", @@ -472,7 +472,7 @@ const char *gameDataEn[] = { " inside the manor$", " front of the manor$", " to the chapel$", - " to the weel$", + " to the well$", " north$", " behind the manor$", " south$", @@ -481,8 +481,8 @@ const char *gameDataEn[] = { " towards the manor$", " further$", " in the water$", - " out of the weel$", - " in the weel$", + " out of the well$", + " in the well$", " choice on screen$", "In the MYSTERY series...$", "MORTVILLE MANOR$", @@ -493,7 +493,7 @@ const char *gameDataEn[] = { "Directed by: KYILKHOR CREATION and LANGLOIS$", "$", "With the cooperation of...$", - "Béatrice et Jean_Luc LANGLOIS$", + "B‚atrice et Jean_Luc LANGLOIS$", "for the music and the voices,$", "Bernard GRELAUD for the graphic conception,$", "MARIA-DOLORES for the graphic direction,$", @@ -543,7 +543,7 @@ const char *gameDataEn[] = { "- Was she murdered?$", "- Did she die by accident?$", "- Did she die of natural causes?$", - "Where did the money come from@for the restoration of the manor?$", + "Where did the money used for the@restoration of the manor come from?$", "- Blackmail$", "- Honest work$", "- Inheritance$", @@ -557,8 +557,8 @@ const char *gameDataEn[] = { "- Painting$", "- Drugs$", "- Occult sciences$", - "- Management of a sect$", - "Julia left several clues that are@represented in one place. Which?$", + "- Leader of a sect$", + "Julia left several clues that are@represented in one place. Which one?$", "- Chapel$", "- Outside$", "- Cellar$", @@ -572,7 +572,7 @@ const char *gameDataEn[] = { "- Max's room$", "- Luc/Ida's room$", "- Guy/Eva's room$", - "The main clue that leads you@to the underground door is:$", + "The main clue that lead you@to the underground door is:$", "- A dagger$", "- A ring$", "- A book$", @@ -580,24 +580,24 @@ const char *gameDataEn[] = { "- A letter$", "- A pendulum$", "How many parchments were there in the manor?$", - "- 0$", - "- 1$", - "- 2$", - "- 3$", - "- 4$", - "- 5$", - "How many persons are involved in@this story?@(Julia included, but not yourself)$", - "- 9$", - "- 10$", - "- 11$", + "- None$", + "- Just one$", + "- Two$", + "- Three$", + "- Four$", + "- Five$", + "How many persons are involved in@this story?@(including Julia, but not yourself)$", + "- Nine$", + "- Ten$", + "- Eleven$", "What was the first name@of the unknown character?$", "- Mireille$", - "- Françoise$", + "- Fran‡oise$", "- Maguy$", "- Emilie$", "- Murielle$", "- Sophie$", - "Wo did Murielle have an affair with?$", + "Who did Murielle have an affair with?$", "- Bob$", "- Luc$", "- Guy$", @@ -609,7 +609,7 @@ const char *gameDataEn[] = { "[1][ | Disk error | All stop... ][ok]$", "[1][ | You should have noticed |00% of the clues ][ok]$", "[3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", + "[1][ |Before going any further, you decide to| look back on the knowledge you gained][ok]$", "TBT - MASTER .$", "TBT - rorL$", NULL @@ -617,9 +617,9 @@ const char *gameDataEn[] = { const char *gameDataFr[] = { "Le calme dans la tourmente$", - "Des goűts et des couleurs!$", + "Des go—ts et des couleurs!$", "Mauve qui peut!$", - "Pričre de laisser en sortant...$", + "PriŠre de laisser en sortant...$", "Trou noir troublant$", "Bleu... comme \"peur bleue\"!$", "Chambre de \"Saigneur\"!$", @@ -629,33 +629,33 @@ const char *gameDataFr[] = { "Odeur de feux de bois et de tabac$", "Tabac et vieux bouquins$", "Oignons, cannelle et spiritueux$", - "Un endroit bien peu visité$", - "Humidité et moisissure$", + "Un endroit bien peu visit‚$", + "Humidit‚ et moisissure$", "Avis aux colporteurs...$", - "Corps putréfié : cryptomanie mortelle!$", - "Et en plus... des pičges désamorcés!$", - "C'est déjŕ ouvert$", + "Corps putr‚fi‚ : cryptomanie mortelle!$", + "Et en plus... des piŠges d‚samorc‚s!$", + "C'est d‚j… ouvert$", "Danger : avalanches$", - "Une odeur de sainteté!$", + "Une odeur de saintet‚!$", "Une btisse imposante$", - "L'envers du mystčre!$", - "Drôle d'horoscope!$", + "L'envers du mystŠre!$", + "Dr“le d'horoscope!$", "Tant va la cruche...$", - "Une porte en chčne$", + "Une porte en chŠne$", "Une photo$", "Les armoiries$", "$", - "Max, le domestique, vous accueille puis vous conduit ŕ votre chambre$", - "Mortevielle, le 16/2/51@ Mon cher Jérôme,@ Suite ŕ mon télégramme, je vous fais part des raisons de mon inquiétude :il y a un an, Murielle, ma dame de compagnie, disparaissait . Départ ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile ŕ comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'ŕ présent, faire le jour sur cette affaire, je compte sur vous pour la mener ŕ bien . Si mon état de santé ne s'améliorait pas, prenez les décisions qui vous sembleront le plus appropriées...@ Amitiés. JULIA DEFRANCK$", - "Plus tard, Guy vous apprendra le suicide de Léo... aprčs un pari insensé aux courses!$", + "Max, le domestique, vous accueille puis vous conduit … votre chambre$", + "Mortevielle, le 16/2/51@ Mon cher J‚r“me,@ Suite … mon t‚l‚gramme, je vous fais part des raisons de mon inqui‚tude :il y a un an, Murielle, ma dame de compagnie, disparaissait . D‚part ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile … comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'… pr‚sent, faire le jour sur cette affaire, je compte sur vous pour la mener … bien . Si mon ‚tat de sant‚ ne s'am‚liorait pas, prenez les d‚cisions qui vous sembleront le plus appropri‚es...@ Amiti‚s. JULIA DEFRANCK$", + "Plus tard, Guy vous apprendra le suicide de L‚o... aprŠs un pari insens‚ aux courses!$", "F3: encore@F8: suite$", - "Le maître des lieux$", - "Le futur héritier$", + "Le maŚtre des lieux$", + "Le futur h‚ritier$", "Le fils de JULIA$", "Joli brin!!!$", "Superman!$", "Le mari d'Ida$", - "Propos intéressants?$", + "Propos int‚ressants?$", "Service compris...$", "Rien dessous!$", "Un ange passe...$", @@ -663,61 +663,61 @@ const char *gameDataFr[] = { "Admirez! Contemplez!$", "Non ! Rien !$", "Impossible$", - "ça tache !$", - "Un traité sur l'histoire de la région$", - "Quelques pičces$", + "‡a tache !$", + "Un trait‚ sur l'histoire de la r‚gion$", + "Quelques piŠces$", "Premier commandement...$", - "Des pétales plein les narines !$", + "Des p‚tales plein les narines !$", "Pique, Coeur...$", - "ça ne manque pas de cachets !$", + "‡a ne manque pas de cachets !$", "Un roman d'amour$", "Souffler n'est pas jouer$", - "Pas une réussite!$", + "Pas une r‚ussite!$", "Gare aux rebondissements !$", "Sombre et profond...$", "Sensations normales$", "Sniff!$", "Pas discret ! Contentez-vous de regarder !$", - "Atchoum! De la p... poussičre$", - "La toile est signée... pas le papier peint !$", + "Atchoum! De la p... poussiŠre$", + "La toile est sign‚e... pas le papier peint !$", "Pas de chance, rien !$", "Soyez plus discret !$", "Les volets sont clos$", "De la neige, encore de la neige !$", - "Génial : une toile de maître !$", - "Aucun doute : une véritable imitation$", + "G‚nial : une toile de maŚtre !$", + "Aucun doute : une v‚ritable imitation$", "Hum ! Vous tiquez : de l'antique en toc !$", - "Une pičce rare de valeur !$", + "Une piŠce rare de valeur !$", "Rien de remarquable$", "Linge, objets personnels...$", - "Pas n'importe oů !$", + "Pas n'importe o— !$", "Ce n'est pas l'heure !$", - "On ne parle pas la bouche pleine ! Donc, une fois le repas terminé...$", + "On ne parle pas la bouche pleine ! Donc, une fois le repas termin‚...$", "Quelqu'un entre, s'affaire, ressort...$", "On s'approche de votre cachette !$", "On vous surprend !$", - "Non : vous ętes trop chargé !$", + "Non : vous tes trop charg‚ !$", "Essayez de nouveau$", "Vous restez perplexe !?$", "Vous quittez le Manoir. A Paris, un message vous attend...$", - "Aďe, aďe, aďe !$", + "A‹e, a‹e, a‹e !$", "Rien de plus$", - "Le son paraît normal$", + "Le son paraŚt normal$", "Ca ne bouge pas$", - "On vous répond$", + "On vous r‚pond$", "Pas le moment !$", - "Męme matičre, autre face !$", - "Le reflet est piqué, mais le cadre est d'or$", + "Mme matiŠre, autre face !$", + "Le reflet est piqu‚, mais le cadre est d'or$", "Bibelots, babioles...$", - "Vous essuyez un échec !$", + "Vous essuyez un ‚chec !$", "Il est des odeurs... qu'il vaut mieux ne pas voir !$", - "Des produits ménagers$", - "ça vous démange ?$", - "C'est coincé, gelé ! Brrrr...$", - "Les huisseries sont bloquées !$", + "Des produits m‚nagers$", + "‡a vous d‚mange ?$", + "C'est coinc‚, gel‚ ! Brrrr...$", + "Les huisseries sont bloqu‚es !$", "Des papiers...$", - "Non ! Le pčre Noęl n'est pas coincé !$", - "ça donne sur un couloir$", + "Non ! Le pŠre Nol n'est pas coinc‚ !$", + "‡a donne sur un couloir$", "Vaisselle, argenterie...$", "Non ! Ce ne sont pas les restes de Julia !$", "Une gravure ancienne$", @@ -726,17 +726,17 @@ const char *gameDataFr[] = { "Le passage se ferme$", "Un tiroir secret... Un livret ! Le lisez-vous ?$", "Le tiroir se referme$", - "Rien ! Sang et chairs collent ŕ la pierre !$", - "Des détails vous font supposer que... la mort ne fut pas immédiate !$", - "Des projets véreux ?$", - "Sa vie n'aurait-elle tenu qu'ŕ un doigt ?$", - "Un trésor se serait-il fait la malle ?$", - "Une fente de la taille d'une pičce !$", - "Quelques pierres pivotent... Une crypte ! Y pénétrez-vous ?$", + "Rien ! Sang et chairs collent … la pierre !$", + "Des d‚tails vous font supposer que... la mort ne fut pas imm‚diate !$", + "Des projets v‚reux ?$", + "Sa vie n'aurait-elle tenu qu'… un doigt ?$", + "Un tr‚sor se serait-il fait la malle ?$", + "Une fente de la taille d'une piŠce !$", + "Quelques pierres pivotent... Une crypte ! Y p‚n‚trez-vous ?$", "La bague tourne, le mur se referme...$", - "Une colonne de pierres derričre l'autel$", + "Une colonne de pierres derriŠre l'autel$", "Il y a du bruit...$", - "Occupé !$", + "Occup‚ !$", "Retentez-vous votre chance ?$", "Trop profond !$", "Le mur de la cave pivote$", @@ -745,45 +745,45 @@ const char *gameDataFr[] = { "L'objet glisse au fond...$", "Vous n'avez rien en main$", "Ce n'est pas ouvert$", - "Il y a déjŕ quelque chose$", - "La porte est fermée$", - "Pas de réponse$", + "Il y a d‚j… quelque chose$", + "La porte est ferm‚e$", + "Pas de r‚ponse$", "Une boule de bois pleine$", "Il n'y a plus de place$", - "Une boule de bois percée par le travers$", + "Une boule de bois perc‚e par le travers$", "? ?$", "A vous de jouer$", "OK !$", - "Soudain Max survient avec votre valise : \"Merci de votre visite ! Détective \"privé\"... de bon sens et de discrétion sans doute\" . Déçu démoralisé, vous quittez le manoir@Vous čtes NUL !$", - "Léo vous interrompt : \"la tempčte est calmée. Je pars en ville dans 1 heure. Tenez-vous pręt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", - "Congestion, grippe fatale : vous y restez ! Votre enqučte tombe ŕ l'eau$", - "L'eau monte trčs vite et refroidit vos derničres illusions... Avant que vous n'ayez eu le temps de réagir, vous čtes mort!$", - "A peine čtes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", - "La tempčte recouvre vos traces . Un mur de silence s'abat sur vos épaules . Lentement vous succombez ŕ la morsure du froid !$", - "Pas si seul que ça ! Une lame glacée s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", - "Vous ignorez la responsabilité exacte de Léo dans la mort de Murielle... Est-elle morte sur le coup ? De toutes façons les problčmes familiaux découverts lors de votre enqučte justifient l'attitude de Léo... Vous n'čtes pas sűr que Julia vous ait appelé pour ça mais c'est suffisant pour vous ! Par respect pour elle, et aprčs certaines précautions, vous avez une entrevue révélatrice avec Léo$", + "Soudain Max survient avec votre valise : \"Merci de votre visite ! D‚tective \"priv‚\"... de bon sens et de discr‚tion sans doute\" . D‚‡u d‚moralis‚, vous quittez le manoir@Vous Štes NUL !$", + "L‚o vous interrompt : \"la tempŠte est calm‚e. Je pars en ville dans 1 heure. Tenez-vous prt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", + "Congestion, grippe fatale : vous y restez ! Votre enquŠte tombe … l'eau$", + "L'eau monte trŠs vite et refroidit vos derniŠres illusions... Avant que vous n'ayez eu le temps de r‚agir, vous Štes mort!$", + "A peine Štes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", + "La tempŠte recouvre vos traces . Un mur de silence s'abat sur vos ‚paules . Lentement vous succombez … la morsure du froid !$", + "Pas si seul que ‡a ! Une lame glac‚e s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", + "Vous ignorez la responsabilit‚ exacte de L‚o dans la mort de Murielle... Est-elle morte sur le coup ? De toutes fa‡ons les problŠmes familiaux d‚couverts lors de votre enquŠte justifient l'attitude de L‚o... Vous n'Štes pas s—r que Julia vous ait appel‚ pour ‡a mais c'est suffisant pour vous ! Par respect pour elle, et aprŠs certaines pr‚cautions, vous avez une entrevue r‚v‚latrice avec L‚o$", "$", - "Vous n'avez pas les clefs du Manoir . Vos appels restent sans réponse . Vous allez attraper... la mort !$", - "D'un mouvement circulaire, l'épée vous fend par le travers : tripes et boyaux ŕ l'air, bonjour les vers!$", + "Vous n'avez pas les clefs du Manoir . Vos appels restent sans r‚ponse . Vous allez attraper... la mort !$", + "D'un mouvement circulaire, l'‚p‚e vous fend par le travers : tripes et boyaux … l'air, bonjour les vers!$", "Home, Sweet home !$", - "Mystčre d'une porte close$", - "Charme envoűtant de vieilles pičces$", + "MystŠre d'une porte close$", + "Charme envo—tant de vieilles piŠces$", "La faim au ventre$", - "Plus prčs du ciel? Pas sűr !$", + "Plus prŠs du ciel? Pas s—r !$", "Peur du noir?$", "Vieux tapis et reflets d'or$", "Angoisse !$", - "Sauvé ? Pas certain !$", - "Mal ŕ l'aise, hein !$", + "Sauv‚ ? Pas certain !$", + "Mal … l'aise, hein !$", "Toujours plus loin !$", "Votre chemin de croix !$", - "A la découverte de...$", - "Attention ŕ ce que cache...$", + "A la d‚couverte de...$", + "Attention … ce que cache...$", "Une descente aux Enfers !$", "Si ce n'est pas dans vos cordes :@ ne soyez pas sot!$", - "Avant la mise en pičce !$", + "Avant la mise en piŠce !$", "Gros plan sur :$", - "Vous remarquez particuličrement...$", + "Vous remarquez particuliŠrement...$", "Et encore...$", "C'est fini !$", "Un peu de lecture$", @@ -794,17 +794,17 @@ const char *gameDataFr[] = { "Non ! Pas ce coup-ci$", "Trop tard$", "$", - "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumičre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artčre comme un rat au coeur męme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", - "10/1/50: Nous avons résolu le mystčre du manuscrit et localisé la crypte . Est-ce l'idée d'aboutir dans ce qui n'était qu'un \"ręve\" qui me rend si anxieuse ?@Je regrette de m'ętre engagée vis ŕ vis de Léo . Non! je dois continuer ! J'aurais dű mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", - "Porte ta pričre au lieu saint qui se doit, changes-en l'air, tu auras la matičre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton âme s'ouvrira un chemin et gagnera son čre . Avance comme un Orphée peu soucieux des ténčbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'ŕ la mystérieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premičre.$", - "Les montagnes sont les crocs d'une gueule dantesque ouverte ŕ l'infini de quelqu' orgie céleste, mastiquant des étoiles comme nous broyons du noir .@Tu déposeras l'accord de pierre ŕ tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mčtre . Tu passeras ainsi entre les deux croissants, par delŕ les abîmes du Mur du Silence . La Clé des champs est ŕ ta portée, tu n'as qu'ŕ retrouver la note qui dénote.$", + "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumiŠre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artŠre comme un rat au coeur mme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", + "10/1/50: Nous avons r‚solu le mystŠre du manuscrit et localis‚ la crypte . Est-ce l'id‚e d'aboutir dans ce qui n'‚tait qu'un \"rŠve\" qui me rend si anxieuse ?@Je regrette de m'tre engag‚e vis … vis de L‚o . Non! je dois continuer ! J'aurais d— mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", + "Porte ta priŠre au lieu saint qui se doit, changes-en l'air, tu auras la matiŠre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton …me s'ouvrira un chemin et gagnera son Šre . Avance comme un Orph‚e peu soucieux des t‚nŠbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'… la myst‚rieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premiŠre.$", + "Les montagnes sont les crocs d'une gueule dantesque ouverte … l'infini de quelqu' orgie c‚leste, mastiquant des ‚toiles comme nous broyons du noir .@Tu d‚poseras l'accord de pierre … tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mŠtre . Tu passeras ainsi entre les deux croissants, par del… les abŚmes du Mur du Silence . La Cl‚ des champs est … ta port‚e, tu n'as qu'… retrouver la note qui d‚note.$", " DECEMBRE@ 9 REMISE 518 13 AGIOS 23@ 19 VIREMENT 1203 17 TRESOR 1598@ TOTAL 1721 TOTAL 1721$", - " Le 5/01/51@@ Luc, mon amour@ Guy connaît notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'ŕ toi ! Max me relance mais j'ai définitivement rompu avec lui . Qu'il reste ŕ ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", - " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai prétés pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", - " Mortevielle, le 15/2/51@ Maître,@ Je vous écris au sujet de notre affaire. Je suis décidé ŕ aller jusqu'au bout, certain que mon associé, Pat DEFRANCK, a falsifié un livre de comptes . Malgré$", + " Le 5/01/51@@ Luc, mon amour@ Guy connaŚt notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'… toi ! Max me relance mais j'ai d‚finitivement rompu avec lui . Qu'il reste … ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", + " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr‚t‚s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", + " Mortevielle, le 15/2/51@ MaŚtre,@ Je vous ‚cris au sujet de notre affaire. Je suis d‚cid‚ … aller jusqu'au bout, certain que mon associ‚, Pat DEFRANCK, a falsifi‚ un livre de comptes . Malgr‚$", " Une pipe$", - " Un stylo ŕ plume$", - " Un briquet ŕ essence$", + " Un stylo … plume$", + " Un briquet … essence$", " Une cornue$", " Un blaireau$", " Un pot de peinture$", @@ -814,13 +814,13 @@ const char *gameDataFr[] = { " Un vieux bouquin$", " Un porte-monnaie$", " Un poignard$", - " Un révolver$", + " Un r‚volver$", " Une bible$", " Une bougie$", - " Un coffret ŕ bijoux$", - " Un fer ŕ repasser$", + " Un coffret … bijoux$", + " Un fer … repasser$", " Une photo$", - " Une montre ŕ gousset$", + " Une montre … gousset$", " Une corde$", " Des clefs$", " Un collier de perles$", @@ -830,9 +830,9 @@ const char *gameDataFr[] = { " Une bourse en cuir$", " Une balle de tennis$", " Des munitions$", - " Un rasoir ŕ main$", - " Une brosse ŕ cheveux$", - " Une brosse ŕ linge$", + " Un rasoir … main$", + " Une brosse … cheveux$", + " Une brosse … linge$", " Un jeu de cartes$", " Un chausse pied$", " Un tournevis$", @@ -843,14 +843,14 @@ const char *gameDataFr[] = { " Un pinceau$", " Une corde$", " Un objet en bois$", - " Des somnifčres$", + " Des somnifŠres$", " Une bague en or$", - " Un coffret ŕ bijoux$", - " Un réveil matin$", + " Un coffret … bijoux$", + " Un r‚veil matin$", " Une cotte de mailles$", " Un chandellier$", " Une paire de gants$", - " Une coupe ciselée$", + " Une coupe cisel‚e$", " Un parchemin$", " Un poignard$", " Un dossier$", @@ -868,13 +868,13 @@ const char *gameDataFr[] = { "La mort de Julia$", "Les relations de Julia$", "Un message de Julia$", - "L'héritage de Julia$", + "L'h‚ritage de Julia$", "Derniers actes de Julia$", "Les cadeaux de Julia$", "La chambre de Julia$", "La photo chez Julia$", "Julia et vous...$", - "Les occupations de Léo$", + "Les occupations de L‚o$", "Les occupations de Pat$", "Les occupations de Guy$", "Les occupations de Bob$", @@ -883,7 +883,7 @@ const char *gameDataFr[] = { "Les occupations d'Ida$", "Les occupations de Max$", "Vos occupations$", - "Les relations de Léo$", + "Les relations de L‚o$", "Les relations de Pat$", "Les relations de Guy$", "Les relations de Bob$", @@ -910,169 +910,169 @@ const char *gameDataFr[] = { "$", "FIN DE LA CONVERSATION$", "Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "C'est le massif montagneux que l'on aperçoit devant le manoir$", + "C'est le massif montagneux que l'on aper‡oit devant le manoir$", "Je n'en sais rien !$", "Elle est morte d'une embolie pulmonaire$", - "Ma mére est morte soudainement . Son état semblait pourtant s'ętre amélioré$", + "Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", "Madame DEFRANCK est morte d'un coup de froid$", "Elle est morte d'une embolie pulmonaire$", - "Pardonnez moi mais je préfčre, actuellement garder le silence$", + "Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", "Ce sont toujours les meilleurs qui partent les premiers$", - "J'aimais beaucoup ma mčre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "C'est une région qui a un passé chargé et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "C'est un passionné d'histoire et un joueur invétéré . D'ailleurs, voici un an il a gagné une grosse somme$", - "Il a déjŕ beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "Je suis PDG d'une petite société de parfums . Mais quand je suis ici, je me repose$", - "C'est un homme dynamique qui a réussi dans le parfum$", - "Lui ! C'est un arriviste véreux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soirées dans sa chambre$", - "J'ai été trčs préoccupé par la santé de ma mčre, et maintenant je n'ai plus goűt ŕ rien$", - "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mčre$", - "Ce sont ses affaires ...$", + "J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", + "Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir...$", + "Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", + "C'est un homme dynamique qui a r‚ussi dans le parfum$", + "Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", + "J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", + "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "Ce sont ses affaires...$", "Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "Je travaille avec Pat mais ça ne va pas trčs fort en ce moment$", - "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper sérieusement alors$", - "Lui et Pat sont associés . Je crois que ça ne va pas trop mal$", - "Je m'occupe de moi et c'est déjŕ beaucoup . Et vous ?$", - "Oh ça ! Je lui fais confiance . Elle sait s'occuper$", - "Mais ! Vous n'avez pas encore découvert son occupation principale ...?$", - "Elle fait dans la décoration avec beaucoup degoűt d'ailleurs . Elle est toujours trčs bien habillée$", - "Si les bijoux vous interessent, j'ai quelques affaires interessantes ŕ saisir rapidement$", - "Les bijoux ...$", + "Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", + "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", + "Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", + "Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", + "Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", + "Mais ! Vous n'avez pas encore d‚couvert son occupation principale..?$", + "Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs. Elle est toujours trŠs bien habill‚e$", + "Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "Les bijoux...$", "Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "Quand on est une femme d'intérieur on trouve toujours de quoi s'occuper...$", + "Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", "Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "Elle n'a sűrement pas des occupations trčs épanouissantes ...$", + "Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", "Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "Entre la cuisine et le ménage, je n'ai pas beaucoup de temps ŕ vous accorder$", + "Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", "Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "Il en ferait plus si il s'occupait moins des ragôts et de la bouteille$", - "Je suis trčs indépendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problčme$", - "C'est un égoďste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "Je crois qu'il s'entend bien avec tout le monde, mis ŕ part, peut ętre, avec Guy$", - "C'est un homme de caractčre . Il faut savoir le prendre ..$", - "Les affaires sont les affaires . Quant ŕ la famille, je la laisse pour ce qu'elle est ...$", - "Relations ? Relations amicales ? Relations financičres sans doute$", - "Moi je n'ai rien ŕ lui reprocher$", - "C'est un homme d'affaire débrouillard . Il nage parfois ŕ contre-courant mais ... il s'en sortira toujours$", - "Ils m'ennuient tous .. Non ! Ce n'est męme pas ça .. Quoique .. certains ..$", - "A l'inverse de sa mčre, c'est une personne trčs renfermée ! Alors question relations ..$", - "Il doit sans doute faire beaucoup d'effort pour rester agréable malgré tous ses ennuis$", - "Ses relations amoureuses : C'est terminé . Ses relations avec moi : Pas vraiment commencées . Quant aux autres : Je ne suis pas les \"autres\"$", + "Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", + "Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", + "C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", + "C'est un homme de caractŠre . Il faut savoir le prendre ..$", + "Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", + "Relations ? Relations amicales ? Relations financiŠres sans doute$", + "Moi je n'ai rien … lui reprocher$", + "C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", + "Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", + "A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", + "Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", + "Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", "J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "Il ne suffit pas d'avoir un peu d'argent et d'ętre beau parleur pour plaire ŕ tout le monde$", - "Sans histoire .. C'est quelqu'un d'agréable et généreux . De plus, il ne manque pas d'humour$", - "Actuellement je m'entends plutôt bien avec tout le monde . Mais, ici, je ne vais pas m'étendre sur le sujet$", - "Beau plumage, mais ça ne vole pas haut ... Parlez en ŕ son mari$", + "Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", + "Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", + "Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", + "Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", "C'est pour un rendez-vous ?$", - "Elle est trčs vivante ! Elle ne s'embarrasse pas de préjugés stupides$", - "Dans mon métier, on côtoit surtout des belles femmes et des truands$", - "La seule valeur sűre chez lui, c'est ses bijoux .. Et sa femme, mais ça il ne s'en rend pas compte$", - "C'est quelqu'un d'interessant . De pas toujours facile ŕ comprendre, mais qui mérite le détour$", - "Je ne déteste personne, mais j'aime les choses et les gens quand ils sont ŕ leur place$", - "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite ŕ l'étroit !$", - "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volonté$", - "Vous savez dans mon métier on entend tout mais on ne retient rien, et le service est bien fait$", + "Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", + "Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", + "La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", + "C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", + "Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", + "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", + "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", + "Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", "C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "Je ne connait pas le fond de sa pensée mais c'est quelqu'un de toujours trčs correct et impeccable$", - "C'était une personne qui a vécu au manoir, il y a un an .. peut ętre plus$", - "C'était plus qu'une amie pour ma mčre . En ces moments, j'aurais aimé qu'elle soit ŕ mes cotés$", - "Murielle a été la dame de compagnie de Julia$", + "Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", + "C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", + "C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", + "Murielle a ‚t‚ la dame de compagnie de Julia$", "Elle aussi, faisait des recherches ...$", - "C'était une femme trčs cultivée . Son brusque départ, il y a un an, m'a surpris et beaucoup chagriné$", - "Elle partageait avec Léo sa passion de l'histoire et de la région$", + "C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", + "Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", "Je crois que tout le monde l'aimait bien$", - "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mčre, belle-fille ..$", - "A part Léo, elle avait de trčs bon rapport avec Max ...$", - "Bien que vos relations furent peu soutenues, Jérôme, elle vous portait toujours dans son coeur ...$", + "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", + "A part L‚o, elle avait de trŠs bon rapport avec Max ...$", + "Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", "A part sa famille, pas grand monde$", - "Ah oui ! Je crois qu'elle a beaucoup regretté le départ de cette amie .. euh ! Marielle .. ou Mireille ...$", + "Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", "Non rien !$", "Non ... Pas que le sache$", - "J'ai connu Julia en achetant le manoir . C'était son seul bien . Mais toute ma fortune était la sienne ...$", - "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien ŕ elle$", - "Je crois que toute sa fortune venait de Léo . Alors, Pfuuut !$", - "A part la lettre pour vous que j'ai posté, rien de bien important !$", - "J'ai été trčs heureuse qu'elle m'offre sa bible reliée$", - "Ca a été rapide et elle n'a pas eu le temps de prendre des dispositions particuličres$", - "Son dernier présent m'a surpris$", + "J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", + "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", + "Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", + "A part la lettre pour vous que j'ai post‚, rien de bien important !$", + "J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", + "Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", + "Son dernier pr‚sent m'a surpris$", "Quel cadeau ?$", "Un chandellier ...$", - "Oui, j'ai eu un cadeau . Ma femme a męme eu une bible$", + "Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", "Et bien oui ! Comme tout le monde, je crois$", "Un poignard$", - "Je n'ai jamais été fouiller dans le grenier !$", + "Je n'ai jamais ‚t‚ fouiller dans le grenier !$", "Vous avez un don de double-vue ou un passe-partout$", "Le portrait d'une jeune fille : C'est Murielle ...$", "Vous savez, je la connaissais assez peu$", - "Elle était trčs charmante, mais c'était surtout la dame de compagnie de Julia$", - "C'est la seule femme vraiment interessante que j'ai rencontré$", - "Elle avait de grandes connaissances historiques, et la consulter était trčs enrichissant$", - "Je me suis toujours demandé ce que certains pouvaient lui trouver !$", - "Si la chambre est fermée, demandez ŕ Léo$", - "J'ai fermé sa chambre aprčs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", + "C'est la seule femme vraiment interessante que j'ai rencontr‚$", + "Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", + "Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", + "Si la chambre est ferm‚e, demandez … L‚o$", + "J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", "Vous savez ce que c'est : Des relations familiales$", - "Durant toutes ces années, je ne l'ai jamais servie ŕ contre-coeur$", + "Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", "Je l'aimais autant qu'elle m'aimais, je crois$", - "De quel droit avez-vous pénétré dans la chambre de ma femme ?!!$", + "De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", "C'est sans doute la photo de Murielle avec le filleul de Julia$", "Je ne me rappelle pas$", - "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tirée ŕ l'envers$", - "Vous ętes bien curieux !... C'est sans valeur$", - "Grimoires, parchemins et manuscrits : C'est le domaine de Léo$", + "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", + "Vous tes bien curieux !... C'est sans valeur$", + "Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", "Dommage que la devise soit manquante ...$", - "C'est trčs beau ... Et trčs vieux ...$", - "Tiens ! C'est un endroit que je n'ai jamais visité$", - "D'aprés Léo, il semblerait que les Lunes soient plus récentes$", - "Męme par ce temps, vous avez déniché un soleil ...$", - "Profond et inquiétant : Le progrčs a du bon$", - "Ca reste pour moi le plus grand des mystčres$", + "C'est trŠs beau ... Et trŠs vieux ...$", + "Tiens ! C'est un endroit que je n'ai jamais visit‚$", + "D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", + "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "Profond et inqui‚tant : Le progrŠs a du bon$", + "Ca reste pour moi le plus grand des mystŠres$", "Les derniers temps elle parlait d'un voyage . Et puis ...$", - "Il y a un peu plus d'un an, un soir, elle a décidé de partir ...$", - "De toutes façons elle n'était pas faite pour vivre ici$", + "Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", + "De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", "Quoi ?! Quel corps ? Quel crypte ?$", - "Si il y en a, je ne les ai jamais trouvé ...$", - "Bien sűr ! ... Et des fantômes aussi ...$", - "C'est la plus vielle de la région : Elle date du XI eme sičcle$", - "Elle fut légčrement restaurée aprčs la révolution$", + "Si il y en a, je ne les ai jamais trouv‚ ...$", + "Bien s–r ! ... Et des fant“mes aussi ...$", + "C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", + "Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", "Julia aimait beaucoup la peinture$", - "Ils ont différents styles, mais n'ont pas tous une trčs grande valeur$", - "Que faites-vous lŕ ?$", - "Je suis sűr que vous cherchez quelque chose ici$", - "Je vous écoute$", - "Que désirez-vous ?$", + "Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", + "Que faites-vous l… ?$", + "Je suis s–r que vous cherchez quelque chose ici$", + "Je vous ‚coute$", + "Que d‚sirez-vous ?$", "Oui ?$", - "Je suis ŕ vous ...$", + "Je suis … vous ...$", "C'est pourquoi ?$", "Allez-y$", - "C'est ŕ quel sujet ?$", - "Max : ŕ votre service, monsieur$", - "De toutes façons vous n'avez rien ŕ faire ici ! Sortez !!$", - "Vous ętes trop curieux !$", - "Jérôme ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . Léo, son mari bien sűr . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempčte redouble, il vous faut rester . Les repas sont ŕ 12h et 19h et il y a un recueillement ŕ la chapelle tous les jours ŕ 10h$", - "En vous voyant j'ai compris que vous decouvririez la vérité ... Car je savais pourquoi vous veniez : J'avais retrouvé le brouillon de la lettre de Julia . Mais je suis trčs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me protéger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous découvert que le mur du silence est le nom que les maçons ont donné au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laissé avant de mourir étaient autant de faux indices qui ne servaient qu'ŕ faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au décryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouvé un jour dans mes affaires . Une nuit, nous nous sommes aventurés dans le passage secret que nous avions découvert . Murielle est morte par accident dans la pičce de la vierge . J'ai récupéré la bague rapidement, trouvé le trésor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'ętes pas de la police . Laissez moi seul !$", - "Février 1951 ... Profession : detective privé . Le froid figeait Paris et mes affaires lorsque ...$", - "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les pičces délabrées du manoir de Mortevielle . Julia, une vieille femme a présent .$", + "C'est … quel sujet ?$", + "Max : … votre service, monsieur$", + "De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", + "Vous tes trop curieux !$", + "J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", + "En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", + "F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", + "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", " au bureau$", - " ŕ la cuisine$", - " ŕ la cave$", + " … la cuisine$", + " … la cave$", " dans le couloir$", " dehors$", - " la salle ŕ manger$", + " la salle … manger$", " dans le manoir$", " devant le manoir$", - " ŕ la chapelle$", + " … la chapelle$", " devant le puits$", " au nord$", - " derričre le manoir$", + " derriŠre le manoir$", " au sud$", - " ŕ l'est$", - " ŕ l'ouest$", + " … l'est$", + " … l'ouest$", " vers le manoir$", " plus loin$", " dans l'eau$", " hors du puits$", " dans le puits$", - " choix sur écran$", + " choix sur ‚cran$", " Dans la serie MYSTERE...$", " LE MANOIR DE MORTEVIELLE$", "$", @@ -1095,9 +1095,9 @@ const char *gameDataFr[] = { " A VOUS DE JOUER$", " attacher$", " attendre$", - " défoncer$", + " d‚foncer$", " dormir$", - " écouter$", + " ‚couter$", " entrer$", " fermer$", " fouiller$", @@ -1119,7 +1119,7 @@ const char *gameDataFr[] = { " lire$", " poser$", " regarder$", - " Léo$", + " L‚o$", " Pat$", " Guy$", " Eva$", @@ -1128,40 +1128,40 @@ const char *gameDataFr[] = { " Ida$", " Max$", "Comment Julia est-elle morte ?$", - "Elle s'est suicidée$", - "Elle est morte assassinée$", + "Elle s'est suicid‚e$", + "Elle est morte assassin‚e$", "Elle est morte accidentellement$", "Elle est morte naturellement$", - "D'oů provenait l'argent qui a permis la restauration du manoir ?$", + "D'o— provenait l'argent qui a permis la restauration du manoir ?$", "chantage$", "travail$", - "héritage$", + "h‚ritage$", "courses$", "rentes$", "hold-up$", - "découverte$", - "Quel est le hobby de Léo ?$", + "d‚couverte$", + "Quel est le hobby de L‚o ?$", "recherches historiques$", "politique$", "peinture$", "drogue$", "sciences occultes$", "direction d'une secte$", - "Julia a laissé une série d'indices . Ceux-ci sont représentés en un seul lieu . Lequel ?$", + "Julia a laiss‚ une s‚rie d'indices . Ceux-ci sont repr‚sent‚s en un seul lieu . Lequel ?$", "Chapelle$", - "Extérieur$", + "Ext‚rieur$", "Cave$", "Grenier$", "Cuisine$", - "Salle ŕ manger$", + "Salle … manger$", "Chambre Julia$", - "Chambre Léo$", + "Chambre L‚o$", "Chambre Pat$", "Chambre Bob$", "Chambre Max$", "Chambre Luc/Ida$", "Chambre Guy/Eva$", - "L'indice principal qui vous a permis d'arriver ŕ la porte du souterrain est :$", + "L'indice principal qui vous a permis d'arriver … la porte du souterrain est :$", "Un poignard$", "Une bague$", "Un livre$", @@ -1175,30 +1175,30 @@ const char *gameDataFr[] = { "Trois$", "Quatre$", "Cinq$", - "Combien de personnes sont mélées ŕ cette histoire - Julia y comprise, vous excepté - ?$", + "Combien de personnes sont m‚l‚es … cette histoire - Julia y comprise, vous except‚ - ?$", "Neuf$", "Dix$", "Onze$", - "Quel était le prénom de la personne inconnue ?$", + "Quel ‚tait le pr‚nom de la personne inconnue ?$", "Mireille$", - "Françoise$", + "Fran‡oise$", "Maguy$", "Emilie$", "Murielle$", "Sophie$", - "De qui Murielle était-elle la maîtresse ?$", + "De qui Murielle ‚tait-elle la maŚtresse ?$", "Bob$", "Luc$", "Guy$", - "Léo$", + "L‚o$", "Max$", "Murielle partageait une occupation avec une autre personne . Qui ?$", - "[1][ |Seul le hazard vous a permis d'arriver ici . Vous préférez|retourner enquéter afin de mieux comprendre ...][ok]$", - "[1][ |Insérez la disquette 1 dans le lecteur A][ok]$", + "[1][ |Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", + "[1][ |Ins‚rez la disquette 1 dans le lecteur A][ok]$", "[1][ |! ERREUR DISQUETTE !|On arrete tout][ok]$", - "[1][ |Vous devriez avoir remarqué|00% des indices][ok]$", - "[1][ |Insérez la disquette 2 dans le lecteur A][ok]$", - "[1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", + "[1][ |Vous devriez avoir remarqu‚|00% des indices][ok]$", + "[1][ |Ins‚rez la disquette 2 dans le lecteur A][ok]$", + "[1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", " MASTER .$", " rorL$", }; @@ -1280,7 +1280,7 @@ const char *gameDataDe[] = { "TBT - Linen, personal belongings...$", "TBT - Not just anywhere!$", "TBT - It's not time!$", - "TBT - One doesn't speak with ones mouth full!$", + "TBT - One doesn't speak with ones mouth full! So once the meal is over...$", "TBT - Someone comes in, messes about then goes out again$", "TBT - Someone's approaching your hiding-place$", "TBT - Someone surprises you!$", @@ -1297,7 +1297,7 @@ const char *gameDataDe[] = { "TBT - The same matter, from another angle!$", "TBT - The reflection is tarnished, but the frame is gold!$", "TBT - Bric-a-brac$", - "TBT - Face to face with failure!$", + "TBT - Facing failure!$", "TBT - Smells like something you'd rather not see!$", "TBT - Cleaning products$", "TBT - Got an itch?$", @@ -1462,7 +1462,7 @@ const char *gameDataDe[] = { "TBT - Julia's bedroom$", "TBT - The photo at Julia's home$", "TBT - Julia and yourself...$", - "TBT - Léo's occupations$", + "TBT - L‚o's occupations$", "TBT - Pat's occupations$", "TBT - Guy's occupations$", "TBT - Bob's occupations$", @@ -1471,7 +1471,7 @@ const char *gameDataDe[] = { "TBT - Ida's occupations$", "TBT - Max's occupations$", "TBT - Your occupations$", - "TBT - Léo's relationships$", + "TBT - L‚o's relationships$", "TBT - Pat's relationships$", "TBT - Guy's relationships$", "TBT - Bob's relationships$", @@ -1498,149 +1498,149 @@ const char *gameDataDe[] = { "TBT - $", "TBT - END OF THE CONVERSATION$", "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "TBT - C'est le massif montagneux que l'on aperçoit devant le manoir$", + "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", "TBT - Je n'en sais rien !$", "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Ma mére est morte soudainement . Son état semblait pourtant s'ętre amélioré$", + "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", "TBT - Madame DEFRANCK est morte d'un coup de froid$", "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Pardonnez moi mais je préfčre, actuellement garder le silence$", + "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", "TBT - Ce sont toujours les meilleurs qui partent les premiers$", - "TBT - J'aimais beaucoup ma mčre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "TBT - C'est une région qui a un passé chargé et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "TBT - C'est un passionné d'histoire et un joueur invétéré . D'ailleurs, voici un an il a gagné une grosse somme$", - "TBT - Il a déjŕ beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "TBT - Je suis PDG d'une petite société de parfums . Mais quand je suis ici, je me repose$", - "TBT - C'est un homme dynamique qui a réussi dans le parfum$", - "TBT - Lui ! C'est un arriviste véreux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soirées dans sa chambre$", - "TBT - J'ai été trčs préoccupé par la santé de ma mčre, et maintenant je n'ai plus goűt ŕ rien$", - "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mčre$", + "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", + "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", + "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", + "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", + "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", + "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", + "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", "TBT - Ce sont ses affaires ...$", "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "TBT - Je travaille avec Pat mais ça ne va pas trčs fort en ce moment$", - "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper sérieusement alors$", - "TBT - Lui et Pat sont associés . Je crois que ça ne va pas trop mal$", - "TBT - Je m'occupe de moi et c'est déjŕ beaucoup . Et vous ?$", - "TBT - Oh ça ! Je lui fais confiance . Elle sait s'occuper$", - "TBT - Mais ! Vous n'avez pas encore découvert son occupation principale ..?$", - "TBT - Elle fait dans la décoration avec beaucoup degoűt d'ailleurs . Elle est toujours trčs bien habillée$", - "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes ŕ saisir rapidement$", + "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", + "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", + "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", + "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", + "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", + "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", + "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", + "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", "TBT - Les bijoux ...$", "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "TBT - Quand on est une femme d'intérieur on trouve toujours de quoi s'occuper...$", + "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "TBT - Elle n'a sűrement pas des occupations trčs épanouissantes ...$", + "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "TBT - Entre la cuisine et le ménage, je n'ai pas beaucoup de temps ŕ vous accorder$", + "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "TBT - Il en ferait plus si il s'occupait moins des ragôts et de la bouteille$", - "TBT - Je suis trčs indépendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problčme$", - "TBT - C'est un égoďste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "TBT - Je crois qu'il s'entend bien avec tout le monde, mis ŕ part, peut ętre, avec Guy$", - "TBT - C'est un homme de caractčre . Il faut savoir le prendre ..$", - "TBT - Les affaires sont les affaires . Quant ŕ la famille, je la laisse pour ce qu'elle est ...$", - "TBT - Relations ? Relations amicales ? Relations financičres sans doute$", - "TBT - Moi je n'ai rien ŕ lui reprocher$", - "TBT - C'est un homme d'affaire débrouillard . Il nage parfois ŕ contre-courant mais ... il s'en sortira toujours$", - "TBT - Ils m'ennuient tous .. Non ! Ce n'est męme pas ça .. Quoique .. certains ..$", - "TBT - A l'inverse de sa mčre, c'est une personne trčs renfermée ! Alors question relations ..$", - "TBT - Il doit sans doute faire beaucoup d'effort pour rester agréable malgré tous ses ennuis$", - "TBT - Ses relations amoureuses : C'est terminé . Ses relations avec moi : Pas vraiment commencées . Quant aux autres : Je ne suis pas les \"autres\"$", + "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", + "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", + "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", + "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", + "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", + "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", + "TBT - Moi je n'ai rien … lui reprocher$", + "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", + "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", + "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", + "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", + "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "TBT - Il ne suffit pas d'avoir un peu d'argent et d'ętre beau parleur pour plaire ŕ tout le monde$", - "TBT - Sans histoire .. C'est quelqu'un d'agréable et généreux . De plus, il ne manque pas d'humour$", - "TBT - Actuellement je m'entends plutôt bien avec tout le monde . Mais, ici, je ne vais pas m'étendre sur le sujet$", - "TBT - Beau plumage, mais ça ne vole pas haut ... Parlez en ŕ son mari$", + "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", + "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", + "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", + "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", "TBT - C'est pour un rendez-vous ?$", - "TBT - Elle est trčs vivante ! Elle ne s'embarrasse pas de préjugés stupides$", - "TBT - Dans mon métier, on côtoit surtout des belles femmes et des truands$", - "TBT - La seule valeur sűre chez lui, c'est ses bijoux .. Et sa femme, mais ça il ne s'en rend pas compte$", - "TBT - C'est quelqu'un d'interessant . De pas toujours facile ŕ comprendre, mais qui mérite le détour$", - "TBT - Je ne déteste personne, mais j'aime les choses et les gens quand ils sont ŕ leur place$", - "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite ŕ l'étroit !$", - "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volonté$", - "TBT - Vous savez dans mon métier on entend tout mais on ne retient rien, et le service est bien fait$", + "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", + "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", + "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", + "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", + "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", + "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", + "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", + "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "TBT - Je ne connait pas le fond de sa pensée mais c'est quelqu'un de toujours trčs correct et impeccable$", - "TBT - C'était une personne qui a vécu au manoir, il y a un an .. peut ętre plus$", - "TBT - C'était plus qu'une amie pour ma mčre . En ces moments, j'aurais aimé qu'elle soit ŕ mes cotés$", - "TBT - Murielle a été la dame de compagnie de Julia$", + "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", + "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", + "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", + "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", "TBT - Elle aussi, faisait des recherches ...$", - "TBT - C'était une femme trčs cultivée . Son brusque départ, il y a un an, m'a surpris et beaucoup chagriné$", - "TBT - Elle partageait avec Léo sa passion de l'histoire et de la région$", + "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", + "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", "TBT - Je crois que tout le monde l'aimait bien$", - "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mčre, belle-fille ..$", - "TBT - A part Léo, elle avait de trčs bon rapport avec Max ...$", - "TBT - Bien que vos relations furent peu soutenues, Jérôme, elle vous portait toujours dans son coeur ...$", + "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", + "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", + "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", "TBT - A part sa famille, pas grand monde$", - "TBT - Ah oui ! Je crois qu'elle a beaucoup regretté le départ de cette amie .. euh ! Marielle .. ou Mireille ...$", + "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", "TBT - Non rien !$", "TBT - Non ... Pas que le sache$", - "TBT - J'ai connu Julia en achetant le manoir . C'était son seul bien . Mais toute ma fortune était la sienne ...$", - "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien ŕ elle$", - "TBT - Je crois que toute sa fortune venait de Léo . Alors, Pfuuut !$", - "TBT - A part la lettre pour vous que j'ai posté, rien de bien important !$", - "TBT - J'ai été trčs heureuse qu'elle m'offre sa bible reliée$", - "TBT - Ca a été rapide et elle n'a pas eu le temps de prendre des dispositions particuličres$", - "TBT - Son dernier présent m'a surpris$", + "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", + "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", + "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", + "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", + "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", + "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", + "TBT - Son dernier pr‚sent m'a surpris$", "TBT - Quel cadeau ?$", "TBT - Un chandellier ...$", - "TBT - Oui, j'ai eu un cadeau . Ma femme a męme eu une bible$", + "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", "TBT - Et bien oui ! Comme tout le monde, je crois$", "TBT - Un poignard$", - "TBT - Je n'ai jamais été fouiller dans le grenier !$", + "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", "TBT - Vous avez un don de double-vue ou un passe-partout$", "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", "TBT - Vous savez, je la connaissais assez peu$", - "TBT - Elle était trčs charmante, mais c'était surtout la dame de compagnie de Julia$", - "TBT - C'est la seule femme vraiment interessante que j'ai rencontré$", - "TBT - Elle avait de grandes connaissances historiques, et la consulter était trčs enrichissant$", - "TBT - Je me suis toujours demandé ce que certains pouvaient lui trouver !$", - "TBT - Si la chambre est fermée, demandez ŕ Léo$", - "TBT - J'ai fermé sa chambre aprčs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", + "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", + "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", + "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", + "TBT - Si la chambre est ferm‚e, demandez … L‚o$", + "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", "TBT - Vous savez ce que c'est : Des relations familiales$", - "TBT - Durant toutes ces années, je ne l'ai jamais servie ŕ contre-coeur$", + "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", - "TBT - De quel droit avez-vous pénétré dans la chambre de ma femme ?!!$", + "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", "TBT - Je ne me rappelle pas$", - "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tirée ŕ l'envers$", - "TBT - Vous ętes bien curieux !... C'est sans valeur$", - "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de Léo$", + "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", + "TBT - Vous tes bien curieux !... C'est sans valeur$", + "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", "TBT - Dommage que la devise soit manquante ...$", - "TBT - C'est trčs beau ... Et trčs vieux ...$", - "TBT - Tiens ! C'est un endroit que je n'ai jamais visité$", - "TBT - D'aprés Léo, il semblerait que les Lunes soient plus récentes$", - "TBT - Męme par ce temps, vous avez déniché un soleil ...$", - "TBT - Profond et inquiétant : Le progrčs a du bon$", - "TBT - Ca reste pour moi le plus grand des mystčres$", + "TBT - C'est trŠs beau ... Et trŠs vieux ...$", + "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", + "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", + "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", + "TBT - Ca reste pour moi le plus grand des mystŠres$", "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", - "TBT - Il y a un peu plus d'un an, un soir, elle a décidé de partir ...$", - "TBT - De toutes façons elle n'était pas faite pour vivre ici$", + "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", + "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", "TBT - Quoi ?! Quel corps ? Quel crypte ?$", - "TBT - Si il y en a, je ne les ai jamais trouvé ...$", - "TBT - Bien sűr ! ... Et des fantômes aussi ...$", - "TBT - C'est la plus vielle de la région : Elle date du XI eme sičcle$", - "TBT - Elle fut légčrement restaurée aprčs la révolution$", + "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", + "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", + "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", + "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", "TBT - Julia aimait beaucoup la peinture$", - "TBT - Ils ont différents styles, mais n'ont pas tous une trčs grande valeur$", - "TBT - Que faites-vous lŕ ?$", - "TBT - Je suis sűr que vous cherchez quelque chose ici$", - "TBT - Je vous écoute$", - "TBT - Que désirez-vous ?$", + "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", + "TBT - Que faites-vous l… ?$", + "TBT - Je suis s–r que vous cherchez quelque chose ici$", + "TBT - Je vous ‚coute$", + "TBT - Que d‚sirez-vous ?$", "TBT - Oui ?$", - "TBT - Je suis ŕ vous ...$", + "TBT - Je suis … vous ...$", "TBT - C'est pourquoi ?$", "TBT - Allez-y$", - "TBT - C'est ŕ quel sujet ?$", - "TBT - Max : ŕ votre service, monsieur$", - "TBT - De toutes façons vous n'avez rien ŕ faire ici ! Sortez !!$", - "TBT - Vous ętes trop curieux !$", - "TBT - Jérôme ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . Léo, son mari bien sűr . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempčte redouble, il vous faut rester . Les repas sont ŕ 12h et 19h et il y a un recueillement ŕ la chapelle tous les jours ŕ 10h$", - "TBT - En vous voyant j'ai compris que vous decouvririez la vérité ... Car je savais pourquoi vous veniez : J'avais retrouvé le brouillon de la lettre de Julia . Mais je suis trčs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me protéger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous découvert que le mur du silence est le nom que les maçons ont donné au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laissé avant de mourir étaient autant de faux indices qui ne servaient qu'ŕ faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au décryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouvé un jour dans mes affaires . Une nuit, nous nous sommes aventurés dans le passage secret que nous avions découvert . Murielle est morte par accident dans la pičce de la vierge . J'ai récupéré la bague rapidement, trouvé le trésor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'ętes pas de la police . Laissez moi seul !$", - "TBT - Février 1951 ... Profession : detective privé . Le froid figeait Paris et mes affaires lorsque ...$", - "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les pičces délabrées du manoir de Mortevielle . Julia, une vieille femme a présent .$", - "TBT - to the bureau$", + "TBT - C'est … quel sujet ?$", + "TBT - Max : … votre service, monsieur$", + "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", + "TBT - Vous tes trop curieux !$", + "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", + "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", + "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", + "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "TBT - to the office$", "TBT - to the kitchen$", "TBT - to the cellar$", "TBT - to the landing$", @@ -1649,7 +1649,7 @@ const char *gameDataDe[] = { "TBT - inside the manor$", "TBT - front of the manor$", "TBT - to the chapel$", - "TBT - to the weel$", + "TBT - to the well$", "TBT - north$", "TBT - behind the manor$", "TBT - south$", @@ -1658,8 +1658,8 @@ const char *gameDataDe[] = { "TBT - towards the manor$", "TBT - further$", "TBT - in the water$", - "TBT - out of the weel$", - "TBT - in the weel$", + "TBT - out of the well$", + "TBT - in the well$", "TBT - choice on screen$", "TBT - In the MYSTERY series...$", "TBT - MORTVILLE MANOR$", @@ -1670,7 +1670,7 @@ const char *gameDataDe[] = { "TBT - Directed by: KYILKHOR CREATION and LANGLOIS$", "TBT - $", "TBT - With the cooperation of...$", - "TBT - Béatrice et Jean_Luc LANGLOIS$", + "TBT - B‚atrice et Jean_Luc LANGLOIS$", "TBT - for the music and the voices,$", "TBT - Bernard GRELAUD for the graphic conception,$", "TBT - MARIA-DOLORES for the graphic direction,$", @@ -1720,7 +1720,7 @@ const char *gameDataDe[] = { "TBT - - Was she murdered?$", "TBT - - Did she die by accident?$", "TBT - - Did she die of natural causes?$", - "TBT - Where did the money come from@for the restoration of the manor?$", + "TBT - Where did the money used@for the restoration of the manor come from?$", "TBT - - Blackmail$", "TBT - - Honest work$", "TBT - - Inheritance$", @@ -1769,7 +1769,7 @@ const char *gameDataDe[] = { "TBT - - 11$", "TBT - What was the first name@of the unknown character?$", "TBT - - Mireille$", - "TBT - - Françoise$", + "TBT - - Fran‡oise$", "TBT - - Maguy$", "TBT - - Emilie$", "TBT - - Murielle$", @@ -1786,7 +1786,7 @@ const char *gameDataDe[] = { "TBT - [1][ | Disk error | All stop... ][ok]$", "TBT - [1][ | You should have noticed |00% of the clues ][ok]$", "TBT - [3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'état de vos connaissances][ok]$", + "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", "TBT - MASTER .$", "TBT - rorL$", NULL diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 0731d3c2c9..125d37fdbb 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 9c6590fdeb546f2c55f57ca645d8bf7b5618ac9a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Feb 2013 23:22:07 +0100 Subject: MORTEVIELLE: remove a magic value, initialize the last bytes of cfiecBuffer --- engines/mortevielle/mortevielle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3875d8d458..664908440f 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -597,7 +597,7 @@ void MortevielleEngine::mainGame() { loadCFIEC(); for (_crep = 1; _crep <= _x26KeyCount; ++_crep) - decodeNumber(&_cfiecBuffer[161 * 16], ((822 * 128) - (161 * 16)) / 64); + decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); loadBRUIT5(); _menu.initMenu(); @@ -2498,6 +2498,9 @@ void MortevielleEngine::loadCFIEC() { for (int32 i = 0; i < fileSize; ++i) _cfiecBuffer[i] = f.readByte(); + for (int i = fileSize; i < _cfiecBufferSize; i++) + _cfiecBuffer[i] = 0; + f.close(); _reloadCFIEC = false; -- cgit v1.2.3 From f59512c47ea21c851535eeabf822aabdfde9167f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 17 May 2013 00:18:09 +0300 Subject: RECORDER: Implement Events Recorder --- audio/mixer.cpp | 13 +- backends/events/default/default-events.cpp | 3 +- backends/events/sdl/sdl-events.cpp | 4 +- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 30 +- backends/graphics/surfacesdl/surfacesdl-graphics.h | 3 + backends/mixer/nullmixer/nullsdl-mixer.cpp | 75 ++ backends/mixer/nullmixer/nullsdl-mixer.h | 62 ++ backends/modular-backend.cpp | 3 + backends/module.mk | 8 +- backends/mutex/sdl/sdl-mutex.cpp | 6 +- backends/platform/android/android.cpp | 2 +- backends/platform/android/android.h | 2 +- backends/platform/bada/system.cpp | 2 +- backends/platform/bada/system.h | 2 +- backends/platform/dc/dc.h | 2 +- backends/platform/dc/time.cpp | 2 +- backends/platform/ds/arm9/source/dsmain.cpp | 2 +- backends/platform/ds/arm9/source/dsmain.h | 2 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- backends/platform/iphone/osys_main.cpp | 2 +- backends/platform/iphone/osys_main.h | 2 +- backends/platform/n64/osys_n64.h | 2 +- backends/platform/n64/osys_n64_base.cpp | 2 +- backends/platform/null/null.cpp | 2 +- backends/platform/ps2/systemps2.cpp | 2 +- backends/platform/ps2/systemps2.h | 2 +- backends/platform/psp/osys_psp.cpp | 2 +- backends/platform/psp/osys_psp.h | 2 +- backends/platform/psp/rtc.cpp | 2 +- backends/platform/psp/rtc.h | 2 +- backends/platform/sdl/sdl.cpp | 28 +- backends/platform/sdl/sdl.h | 3 +- backends/platform/wii/osystem.cpp | 2 +- backends/platform/wii/osystem.h | 2 +- backends/saves/recorder/recorder-saves.cpp | 35 + backends/saves/recorder/recorder-saves.h | 36 + backends/timer/default/default-timer.cpp | 2 +- base/commandLine.cpp | 33 +- base/main.cpp | 33 +- common/EventDispatcher.cpp | 12 +- common/EventRecorder.cpp | 428 -------- common/EventRecorder.h | 110 -- common/debug.h | 4 + common/events.h | 12 +- common/memstream.h | 37 +- common/module.mk | 6 +- common/random.cpp | 9 +- common/recorderfile.cpp | 708 +++++++++++++ common/recorderfile.h | 180 ++++ common/system.cpp | 11 +- common/system.h | 18 +- configure | 29 +- engines/advancedDetector.cpp | 9 +- engines/advancedDetector.h | 3 + engines/cge/cge.cpp | 1 - engines/dreamweb/dreamweb.cpp | 1 - engines/sword25/gfx/image/renderedimage.cpp | 57 +- engines/sword25/gfx/image/renderedimage.h | 3 - engines/wintermute/wintermute.cpp | 1 - graphics/cursorman.cpp | 7 + graphics/cursorman.h | 6 +- graphics/scaler.h | 6 + graphics/scaler/thumbnail_intern.cpp | 32 +- graphics/thumbnail.cpp | 53 +- graphics/thumbnail.h | 18 + gui/EventRecorder.cpp | 699 +++++++++++++ gui/EventRecorder.h | 293 ++++++ gui/ThemeEngine.cpp | 35 +- gui/ThemeEngine.h | 13 + gui/dialog.h | 3 + gui/editrecorddialog.cpp | 87 ++ gui/editrecorddialog.h | 56 ++ gui/gui-manager.cpp | 138 +-- gui/gui-manager.h | 6 + gui/launcher.cpp | 83 +- gui/launcher.h | 15 +- gui/module.mk | 8 + gui/onscreendialog.cpp | 231 +++++ gui/onscreendialog.h | 64 ++ gui/recorderdialog.cpp | 291 ++++++ gui/recorderdialog.h | 81 ++ gui/themes/default.inc | 1052 ++++++++++++-------- gui/themes/scummclassic.zip | Bin 104059 -> 110000 bytes gui/themes/scummclassic/classic_layout.stx | 128 +++ gui/themes/scummclassic/classic_layout_lowres.stx | 104 ++ gui/themes/scummmodern.zip | Bin 1462338 -> 1485585 bytes gui/themes/scummmodern/editbtn.bmp | Bin 0 -> 3126 bytes gui/themes/scummmodern/editbtn_small.bmp | Bin 0 -> 822 bytes gui/themes/scummmodern/fastreplay.bmp | Bin 0 -> 3126 bytes gui/themes/scummmodern/fastreplay_small.bmp | Bin 0 -> 822 bytes gui/themes/scummmodern/scummmodern_gfx.stx | 8 + gui/themes/scummmodern/scummmodern_layout.stx | 130 +++ .../scummmodern/scummmodern_layout_lowres.stx | 125 +++ gui/themes/scummmodern/stopbtn.bmp | Bin 0 -> 3126 bytes gui/themes/scummmodern/stopbtn_small.bmp | Bin 0 -> 822 bytes gui/themes/scummmodern/switchbtn.bmp | Bin 0 -> 3126 bytes gui/themes/scummmodern/switchbtn_small.bmp | Bin 0 -> 822 bytes 98 files changed, 4633 insertions(+), 1201 deletions(-) create mode 100644 backends/mixer/nullmixer/nullsdl-mixer.cpp create mode 100644 backends/mixer/nullmixer/nullsdl-mixer.h create mode 100644 backends/saves/recorder/recorder-saves.cpp create mode 100644 backends/saves/recorder/recorder-saves.h delete mode 100644 common/EventRecorder.cpp delete mode 100644 common/EventRecorder.h create mode 100644 common/recorderfile.cpp create mode 100644 common/recorderfile.h create mode 100644 gui/EventRecorder.cpp create mode 100644 gui/EventRecorder.h create mode 100644 gui/editrecorddialog.cpp create mode 100644 gui/editrecorddialog.h create mode 100644 gui/onscreendialog.cpp create mode 100644 gui/onscreendialog.h create mode 100644 gui/recorderdialog.cpp create mode 100644 gui/recorderdialog.h create mode 100644 gui/themes/scummmodern/editbtn.bmp create mode 100644 gui/themes/scummmodern/editbtn_small.bmp create mode 100644 gui/themes/scummmodern/fastreplay.bmp create mode 100644 gui/themes/scummmodern/fastreplay_small.bmp create mode 100644 gui/themes/scummmodern/stopbtn.bmp create mode 100644 gui/themes/scummmodern/stopbtn_small.bmp create mode 100644 gui/themes/scummmodern/switchbtn.bmp create mode 100644 gui/themes/scummmodern/switchbtn_small.bmp diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 8ff364b98d..ab3ed9eb2d 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -20,6 +20,8 @@ * */ +#include "gui/EventRecorder.h" + #include "common/util.h" #include "common/system.h" #include "common/textconsole.h" @@ -427,6 +429,7 @@ void MixerImpl::pauseHandle(SoundHandle handle, bool paused) { bool MixerImpl::isSoundIDActive(int id) { Common::StackLock lock(_mutex); + g_eventRec.updateSubsystems(); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->getId() == id) return true; @@ -443,6 +446,7 @@ int MixerImpl::getSoundID(SoundHandle handle) { bool MixerImpl::isSoundHandleActive(SoundHandle handle) { Common::StackLock lock(_mutex); + g_eventRec.updateSubsystems(); const int index = handle._val % NUM_CHANNELS; return _channels[index] && _channels[index]->getHandle()._val == handle._val; } @@ -556,12 +560,12 @@ void Channel::pause(bool paused) { _pauseLevel++; if (_pauseLevel == 1) - _pauseStartTime = g_system->getMillis(); + _pauseStartTime = g_system->getMillis(true); } else if (_pauseLevel > 0) { _pauseLevel--; if (!_pauseLevel) { - _pauseTime = (g_system->getMillis() - _pauseStartTime); + _pauseTime = (g_system->getMillis(true) - _pauseStartTime); _pauseStartTime = 0; } } @@ -579,7 +583,7 @@ Timestamp Channel::getElapsedTime() { if (isPaused()) delta = _pauseStartTime - _mixerTimeStamp; else - delta = g_system->getMillis() - _mixerTimeStamp - _pauseTime; + delta = g_system->getMillis(true) - _mixerTimeStamp - _pauseTime; // Convert the number of samples into a time duration. @@ -599,13 +603,12 @@ int Channel::mix(int16 *data, uint len) { assert(_stream); int res = 0; - if (_stream->endOfData()) { // TODO: call drain method } else { assert(_converter); _samplesConsumed = _samplesDecoded; - _mixerTimeStamp = g_system->getMillis(); + _mixerTimeStamp = g_system->getMillis(true); _pauseTime = 0; res = _converter->flow(*_stream, data, len, _volL, _volR); _samplesDecoded += res; diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 38a0c8d46f..bf76bbc1cb 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -84,7 +84,8 @@ void DefaultEventManager::init() { } bool DefaultEventManager::pollEvent(Common::Event &event) { - uint32 time = g_system->getMillis(); + // Skip recording of these events + uint32 time = g_system->getMillis(true); bool result = false; _dispatcher.dispatch(); diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index 0ca5bbb059..e2ef7f6bf6 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -106,7 +106,9 @@ void SdlEventSource::processMouseEvent(Common::Event &event, int x, int y) { } void SdlEventSource::handleKbdMouse() { - uint32 curTime = g_system->getMillis(); + // Skip recording of these events + uint32 curTime = g_system->getMillis(true); + if (curTime >= _km.last_time + _km.delay_time) { _km.last_time = curTime; if (_km.x_down_count == 1) { diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 02e58ab319..e174a6e807 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -40,6 +40,7 @@ #include "graphics/scaler.h" #include "graphics/scaler/aspect.h" #include "graphics/surface.h" +#include "gui/EventRecorder.h" static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { {"1x", _s("Normal (no scaling)"), GFX_NORMAL}, @@ -135,6 +136,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou _paletteDirtyStart(0), _paletteDirtyEnd(0), _screenIsLocked(false), _graphicsMutex(0), + _displayDisabled(false), #ifdef USE_SDL_DEBUG_FOCUSRECT _enableFocusRectDebugCode(false), _enableFocusRect(false), _focusRect(), #endif @@ -765,9 +767,20 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { fixupResolutionForAspectRatio(_videoMode.desiredAspectRatio, _videoMode.hardwareWidth, _videoMode.hardwareHeight); } - _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, - _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE - ); + +#ifdef ENABLE_KEYMAPPER + _displayDisabled = ConfMan.getBool("disable_display"); + + if (_displayDisabled) { + _hwscreen = g_eventRec.getSurface(_videoMode.hardwareWidth, _videoMode.hardwareHeight); + } else +#endif + { + _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, + _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE + ); + } + #ifdef USE_RGB_COLOR detectSupportedFormats(); #endif @@ -865,7 +878,12 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() { } if (_hwscreen) { - SDL_FreeSurface(_hwscreen); + if (_displayDisabled) { + delete _hwscreen; + } else { + SDL_FreeSurface(_hwscreen); + } + _hwscreen = NULL; } @@ -1188,7 +1206,9 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() { #endif // Finally, blit all our changes to the screen - SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); + if (!_displayDisabled) { + SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList); + } } _numDirtyRects = 0; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 21444cc25d..97de0f9c97 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -232,6 +232,9 @@ protected: int _scalerType; int _transactionMode; + // Indicates whether it is needed to free _hwsurface in destructor + bool _displayDisabled; + bool _screenIsLocked; Graphics::Surface _framebuffer; diff --git a/backends/mixer/nullmixer/nullsdl-mixer.cpp b/backends/mixer/nullmixer/nullsdl-mixer.cpp new file mode 100644 index 0000000000..2fd652e19f --- /dev/null +++ b/backends/mixer/nullmixer/nullsdl-mixer.cpp @@ -0,0 +1,75 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "backends/mixer/nullmixer/nullsdl-mixer.h" +#include "common/savefile.h" + +NullSdlMixerManager::NullSdlMixerManager() : SdlMixerManager() { + _outputRate = 22050; + _callsCounter = 0; + _callbackPeriod = 10; + _samples = 8192; + while (_samples * 16 > _outputRate * 2) + _samples >>= 1; + _samplesBuf = new uint8[_samples * 4]; +} + +NullSdlMixerManager::~NullSdlMixerManager() { + delete _samplesBuf; +} + +void NullSdlMixerManager::init() { + _mixer = new Audio::MixerImpl(g_system, _outputRate); + assert(_mixer); + _mixer->setReady(true); +} + +void NullSdlMixerManager::suspendAudio() { + _audioSuspended = true; +} + +int NullSdlMixerManager::resumeAudio() { + if (!_audioSuspended) { + return -2; + } + _audioSuspended = false; + return 0; +} + + +void NullSdlMixerManager::startAudio() { +} + +void NullSdlMixerManager::callbackHandler(byte *samples, int len) { + assert(_mixer); + _mixer->mixCallback(samples, len); +} + +void NullSdlMixerManager::update() { + if (_audioSuspended) { + return; + } + _callsCounter++; + if ((_callsCounter % _callbackPeriod) == 0) { + callbackHandler(_samplesBuf, _samples); + } +} diff --git a/backends/mixer/nullmixer/nullsdl-mixer.h b/backends/mixer/nullmixer/nullsdl-mixer.h new file mode 100644 index 0000000000..94248ced66 --- /dev/null +++ b/backends/mixer/nullmixer/nullsdl-mixer.h @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BACKENDS_MIXER_NULLSDL_H +#define BACKENDS_MIXER_NULLSDL_H + +#include "backends/mixer/sdl/sdl-mixer.h" +#include "common/str.h" + +/** Audio mixer which in fact does not output audio. + * + * It is used by events recorder since the recorder is intentionally + * turning sound off to avoid stuttering. + * + * It returns correct output and shoots callbacks, so all OSystem + * users could work without modifications. + */ + +class NullSdlMixerManager : public SdlMixerManager { +public: + NullSdlMixerManager(); + virtual ~NullSdlMixerManager(); + + virtual void init(); + void update(); + + virtual void suspendAudio(); + virtual int resumeAudio(); + +protected: + + virtual void startAudio(); + virtual void callbackHandler(byte *samples, int len); + +private: + uint32 _outputRate; + uint32 _callsCounter; + uint8 _callbackPeriod; + uint32 _samples; + uint8 *_samplesBuf; +}; + +#endif diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index b46f33a2bc..94d0595fea 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -26,6 +26,7 @@ #include "backends/graphics/graphics.h" #include "backends/mutex/mutex.h" +#include "gui/EventRecorder.h" #include "audio/mixer.h" #include "graphics/pixelformat.h" @@ -141,7 +142,9 @@ void ModularBackend::fillScreen(uint32 col) { } void ModularBackend::updateScreen() { + g_eventRec.preDrawOverlayGui(); _graphicsManager->updateScreen(); + g_eventRec.postDrawOverlayGui(); } void ModularBackend::setShakePos(int shakeOffset) { diff --git a/backends/module.mk b/backends/module.mk index a4f525d21d..12cdc3d029 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -70,7 +70,7 @@ MODULE_OBJS += \ mutex/sdl/sdl-mutex.o \ plugins/sdl/sdl-provider.o \ timer/sdl/sdl-timer.o - + # SDL 1.3 removed audio CD support ifndef USE_SDL13 MODULE_OBJS += \ @@ -214,5 +214,11 @@ MODULE_OBJS += \ plugins/wii/wii-provider.o endif +ifdef ENABLE_EVENTRECORDER +MODULE_OBJS += \ + mixer/nullmixer/nullsdl-mixer.o \ + saves/recorder/recorder-saves.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/backends/mutex/sdl/sdl-mutex.cpp b/backends/mutex/sdl/sdl-mutex.cpp index 8491ae468c..a51e6f0e38 100644 --- a/backends/mutex/sdl/sdl-mutex.cpp +++ b/backends/mutex/sdl/sdl-mutex.cpp @@ -33,15 +33,15 @@ OSystem::MutexRef SdlMutexManager::createMutex() { } void SdlMutexManager::lockMutex(OSystem::MutexRef mutex) { - SDL_mutexP((SDL_mutex *) mutex); + SDL_mutexP((SDL_mutex *)mutex); } void SdlMutexManager::unlockMutex(OSystem::MutexRef mutex) { - SDL_mutexV((SDL_mutex *) mutex); + SDL_mutexV((SDL_mutex *)mutex); } void SdlMutexManager::deleteMutex(OSystem::MutexRef mutex) { - SDL_DestroyMutex((SDL_mutex *) mutex); + SDL_DestroyMutex((SDL_mutex *)mutex); } #endif diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 0b31ee717c..e066ea0239 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -450,7 +450,7 @@ bool OSystem_Android::getFeatureState(Feature f) { } } -uint32 OSystem_Android::getMillis() { +uint32 OSystem_Android::getMillis(bool skipRecord) { timeval curTime; gettimeofday(&curTime, 0); diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 5f2f40b726..b4813b3bdf 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -274,7 +274,7 @@ public: virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual MutexRef createMutex(void); diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index 3f862c2571..5c3c25c63d 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -373,7 +373,7 @@ bool BadaSystem::pollEvent(Common::Event &event) { return _appForm->pollEvent(event); } -uint32 BadaSystem::getMillis() { +uint32 BadaSystem::getMillis(bool skipRecord) { long long result, ticks = 0; SystemTime::GetTicks(ticks); result = ticks - _epoch; diff --git a/backends/platform/bada/system.h b/backends/platform/bada/system.h index c28686cb3d..89394c58ec 100644 --- a/backends/platform/bada/system.h +++ b/backends/platform/bada/system.h @@ -83,7 +83,7 @@ private: void updateScreen(); bool pollEvent(Common::Event &event); - uint32 getMillis(); + uint32 getMillis(bool skipRecord = false); void delayMillis(uint msecs); void getTimeAndDate(TimeDate &t) const; void fatalError(); diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index d41839d961..d62ced02e1 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -151,7 +151,7 @@ public: void setShakePos(int shake_pos); // Get the number of milliseconds since the program was started. - uint32 getMillis(); + uint32 getMillis(bool skipRecord = false); // Delay for a specified amount of milliseconds void delayMillis(uint msecs); diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp index 8cc3a71e8d..1e5f44ec85 100644 --- a/backends/platform/dc/time.cpp +++ b/backends/platform/dc/time.cpp @@ -26,7 +26,7 @@ #include "dc.h" -uint32 OSystem_Dreamcast::getMillis() +uint32 OSystem_Dreamcast::getMillis(bool skipRecord) { static uint32 msecs=0; static unsigned int t0=0; diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 830c782b90..9dc66e80d7 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -2280,7 +2280,7 @@ void VBlankHandler(void) { //REG_IF = IRQ_VBLANK; } -int getMillis() { +int getMillis(bool skipRecord) { return currentTimeMillis; // return frameCount * FRAME_TIME; } diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index ad49ae276d..5e91fae13a 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -88,7 +88,7 @@ void setGamma(int gamma); // Timers void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval -int getMillis(); // Return the current runtime in milliseconds +int getMillis(bool skipRecord = false); // Return the current runtime in milliseconds void doTimerCallback(); // Call callback function if required // Sound diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index a4b9c842fc..2f6358d8ee 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -656,7 +656,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) { return false; } -uint32 OSystem_DS::getMillis() { +uint32 OSystem_DS::getMillis(bool skipRecord) { return DS::getMillis(); } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index a6001da764..4550e22b2c 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -117,7 +117,7 @@ public: virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format); virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &t) const; diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index ed2c886213..460d3fd2ac 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -166,7 +166,7 @@ void OSystem_IPHONE::suspendLoop() { _timeSuspended += getMillis() - startTime; } -uint32 OSystem_IPHONE::getMillis() { +uint32 OSystem_IPHONE::getMillis(bool skipRecord) { //printf("getMillis()\n"); struct timeval currentTime; diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 037125490d..811a8ddb2e 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -165,7 +165,7 @@ public: virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual MutexRef createMutex(void); diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index bc6b3cb1a5..10138b230a 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -184,7 +184,7 @@ public: virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual MutexRef createMutex(void); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index 1e2aca9e51..afd93f5e09 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -810,7 +810,7 @@ void OSystem_N64::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, return; } -uint32 OSystem_N64::getMillis() { +uint32 OSystem_N64::getMillis(bool skipRecord) { return getMilliTick(); } diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 4690a67c55..9e05539799 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -49,7 +49,7 @@ public: virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &t) const {} diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 5628658381..a7d782b07c 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -571,7 +571,7 @@ void OSystem_PS2::displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); } -uint32 OSystem_PS2::getMillis(void) { +uint32 OSystem_PS2::getMillis(bool skipRecord) { return msecCount; } diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 99482d4da4..3ba40a70f9 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -82,7 +82,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index fb8c1c60bf..8559066e53 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -349,7 +349,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { return _inputHandler.getAllInputs(event); } -uint32 OSystem_PSP::getMillis() { +uint32 OSystem_PSP::getMillis(bool skipRecord) { return PspRtc::instance().getMillis(); } diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 2afdabd0fc..f4591e476d 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -125,7 +125,7 @@ public: bool processInput(Common::Event &event); // Time - uint32 getMillis(); + uint32 getMillis(bool skipRecord = false); void delayMillis(uint msecs); // Timer diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp index cbbb7d3f80..4f15e45535 100644 --- a/backends/platform/psp/rtc.cpp +++ b/backends/platform/psp/rtc.cpp @@ -52,7 +52,7 @@ void PspRtc::init() { // init our starting ticks // Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause // unpredictable results -uint32 PspRtc::getMillis() { +uint32 PspRtc::getMillis(bool skipRecord) { uint32 ticks[2]; sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays diff --git a/backends/platform/psp/rtc.h b/backends/platform/psp/rtc.h index 45885c3e66..d2689681dd 100644 --- a/backends/platform/psp/rtc.h +++ b/backends/platform/psp/rtc.h @@ -40,7 +40,7 @@ public: init(); } void init(); - uint32 getMillis(); + uint32 getMillis(bool skipRecord = false); uint32 getMicros(); }; diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index d54854352d..77e6f73d48 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -30,7 +30,7 @@ #include "backends/platform/sdl/sdl.h" #include "common/config-manager.h" -#include "common/EventRecorder.h" +#include "gui/EventRecorder.h" #include "common/taskbar.h" #include "common/textconsole.h" @@ -97,7 +97,9 @@ OSystem_SDL::~OSystem_SDL() { _audiocdManager = 0; delete _mixerManager; _mixerManager = 0; - delete _timerManager; + + delete g_eventRec.getTimerManager(); + _timerManager = 0; delete _mutexManager; _mutexManager = 0; @@ -131,9 +133,6 @@ void OSystem_SDL::init() { if (_mutexManager == 0) _mutexManager = new SdlMutexManager(); - if (_timerManager == 0) - _timerManager = new SdlTimerManager(); - #if defined(USE_TASKBAR) if (_taskbarManager == 0) _taskbarManager = new Common::TaskbarManager(); @@ -191,10 +190,12 @@ void OSystem_SDL::initBackend() { if (_mixerManager == 0) { _mixerManager = new SdlMixerManager(); - // Setup and start mixer _mixerManager->init(); } + g_eventRec.registerMixerManager(_mixerManager); + + g_eventRec.registerTimerManager(new SdlTimerManager()); if (_audiocdManager == 0) { // Audio CD support was removed with SDL 1.3 @@ -466,14 +467,15 @@ void OSystem_SDL::setupIcon() { free(icon); } -uint32 OSystem_SDL::getMillis() { + +uint32 OSystem_SDL::getMillis(bool skipRecord) { uint32 millis = SDL_GetTicks(); - g_eventRec.processMillis(millis); + g_eventRec.processMillis(millis, skipRecord); return millis; } void OSystem_SDL::delayMillis(uint msecs) { - if (!g_eventRec.processDelayMillis(msecs)) + if (!g_eventRec.processDelayMillis()) SDL_Delay(msecs); } @@ -491,12 +493,12 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const { Audio::Mixer *OSystem_SDL::getMixer() { assert(_mixerManager); - return _mixerManager->getMixer(); + return getMixerManager()->getMixer(); } SdlMixerManager *OSystem_SDL::getMixerManager() { assert(_mixerManager); - return _mixerManager; + return g_eventRec.getMixerManager(); } #ifdef USE_OPENGL @@ -654,4 +656,8 @@ void OSystem_SDL::setupGraphicsModes() { } } +Common::TimerManager *OSystem_SDL::getTimerManager() { + return g_eventRec.getTimerManager(); +} + #endif diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index f05207b482..840e73ff09 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -68,10 +68,11 @@ public: virtual void setWindowCaption(const char *caption); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &td) const; virtual Audio::Mixer *getMixer(); + virtual Common::TimerManager *getTimerManager(); protected: bool _inited; diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 22a6495f8f..9d3a7473e3 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -203,7 +203,7 @@ bool OSystem_Wii::getFeatureState(Feature f) { } } -uint32 OSystem_Wii::getMillis() { +uint32 OSystem_Wii::getMillis(bool skipRecord) { return ticks_to_millisecs(diff_ticks(_startup_time, gettime())); } diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 5d6998d0b6..287c70ad6b 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -193,7 +193,7 @@ public: const Graphics::PixelFormat *format); virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); + virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); virtual MutexRef createMutex(); diff --git a/backends/saves/recorder/recorder-saves.cpp b/backends/saves/recorder/recorder-saves.cpp new file mode 100644 index 0000000000..49b4672913 --- /dev/null +++ b/backends/saves/recorder/recorder-saves.cpp @@ -0,0 +1,35 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "backends/saves/recorder/recorder-saves.h" +#include "gui/EventRecorder.h" +#include "common/savefile.h" + +Common::InSaveFile *RecorderSaveFileManager::openForLoading(const Common::String &filename) { + Common::InSaveFile *result = g_eventRec.processSaveStream(filename); + return result; +} + +Common::StringArray RecorderSaveFileManager::listSaveFiles(const Common::String &pattern) { + return g_eventRec.listSaveFiles(pattern); +} + diff --git a/backends/saves/recorder/recorder-saves.h b/backends/saves/recorder/recorder-saves.h new file mode 100644 index 0000000000..692aeca329 --- /dev/null +++ b/backends/saves/recorder/recorder-saves.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BACKEND_SAVES_RECORDER_H +#define BACKEND_SAVES_RECORDER_H + +#include "backends/saves/default/default-saves.h" + +/** + * Provides a savefile manager implementation for event recorder. + */ +class RecorderSaveFileManager : public DefaultSaveFileManager { + virtual Common::StringArray listSaveFiles(const Common::String &pattern); + virtual Common::InSaveFile *openForLoading(const Common::String &filename); +}; + +#endif diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp index 9f56d58b12..ce93320f3d 100644 --- a/backends/timer/default/default-timer.cpp +++ b/backends/timer/default/default-timer.cpp @@ -80,7 +80,7 @@ DefaultTimerManager::~DefaultTimerManager() { void DefaultTimerManager::handler() { Common::StackLock lock(_mutex); - const uint32 curTime = g_system->getMillis(); + uint32 curTime = g_system->getMillis(true); // Repeat as long as there is a TimerSlot that is scheduled to fire. TimerSlot *slot = _head->next; diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 42a3a64d34..6f173a594d 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -118,6 +118,13 @@ static const char HELP_STRING[] = " --aspect-ratio Enable aspect ratio correction\n" " --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n" " hercAmber, amiga)\n" +#ifdef ENABLE_EVENTRECORDER + " --record-mode=MODE Specify record mode for event recorder (record, playback,\n" + " passthrough [default])\n" + " --record-file=FILE Specify record file name\n" + " --disable-display Disable any gfx output. Used for headless events\n" + " playback by Event Recorder\n" +#endif "\n" #if defined(ENABLE_SKY) || defined(ENABLE_QUEEN) " --alt-intro Use alternative intro for CD versions of Beneath a\n" @@ -232,10 +239,9 @@ void registerDefaults() { ConfMan.registerDefault("confirm_exit", false); ConfMan.registerDefault("disable_sdl_parachute", false); + ConfMan.registerDefault("disable_display", false); ConfMan.registerDefault("record_mode", "none"); ConfMan.registerDefault("record_file_name", "record.bin"); - ConfMan.registerDefault("record_temp_file_name", "record.tmp"); - ConfMan.registerDefault("record_time_file_name", "record.time"); ConfMan.registerDefault("gui_saveload_chooser", "grid"); ConfMan.registerDefault("gui_saveload_last_pos", "0"); @@ -424,6 +430,17 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha DO_OPTION_BOOL('f', "fullscreen") END_OPTION +#ifdef ENABLE_EVENTRECORDER + DO_LONG_OPTION_INT("disable-display") + END_OPTION + + DO_LONG_OPTION("record-mode") + END_OPTION + + DO_LONG_OPTION("record-file-name") + END_OPTION +#endif + DO_LONG_OPTION("opl-driver") END_OPTION @@ -569,18 +586,6 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha END_OPTION #endif - DO_LONG_OPTION("record-mode") - END_OPTION - - DO_LONG_OPTION("record-file-name") - END_OPTION - - DO_LONG_OPTION("record-temp-file-name") - END_OPTION - - DO_LONG_OPTION("record-time-file-name") - END_OPTION - #ifdef IPHONE // This is automatically set when launched from the Springboard. DO_LONG_OPTION_OPT("launchedFromSB", 0) diff --git a/base/main.cpp b/base/main.cpp index 355a65f883..3f51c97949 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -42,8 +42,11 @@ #include "common/debug.h" #include "common/debug-channels.h" /* for debug manager */ #include "common/events.h" -#include "common/EventRecorder.h" +#include "gui/EventRecorder.h" #include "common/fs.h" +#ifdef ENABLE_EVENTRECORDER +#include "common/recorderfile.h" +#endif #include "common/system.h" #include "common/textconsole.h" #include "common/tokenizer.h" @@ -409,7 +412,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { settings["gfx-mode"] = "default"; } } - + if (settings.contains("disable-display")) { + ConfMan.setInt("disable-display", 1, Common::ConfigManager::kTransientDomain); + } setupGraphics(system); // Init the different managers that are used by the engines. @@ -428,7 +433,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // TODO: This is just to match the current behavior, when we further extend // our event recorder, we might do this at another place. Or even change // the whole API for that ;-). - g_eventRec.init(); + g_eventRec.RegisterEventSource(); // Now as the event manager is created, setup the keymapper setupKeymapper(system); @@ -448,6 +453,21 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // to save memory PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, plugin); +#ifdef ENABLE_EVENTRECORDER + Common::String recordMode = ConfMan.get("record_mode"); + Common::String recordFileName = ConfMan.get("record_file_name"); + + if (recordMode == "record") { + g_eventRec.init(g_eventRec.generateRecordFileName(ConfMan.getActiveDomainName()), GUI::EventRecorder::kRecorderRecord); + } else if (recordMode == "playback") { + g_eventRec.init(recordFileName, GUI::EventRecorder::kRecorderPlayback); + } else if ((recordMode == "info") && (!recordFileName.empty())) { + Common::PlaybackFile record; + record.openRead(recordFileName); + debug("info:author=%s name=%s description=%s", record.getHeader().author.c_str(), record.getHeader().name.c_str(), record.getHeader().description.c_str()); + break; + } +#endif // Try to run the game Common::Error result = runGame(plugin, system, specialDebug); @@ -478,6 +498,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { #ifdef FORCE_RTL g_system->getEventManager()->resetQuit(); #endif + #ifdef ENABLE_EVENTRECORDER + if (g_eventRec.checkForContinueGame()) { + continue; + } + #endif // Discard any command line options. It's unlikely that the user // wanted to apply them to *all* games ever launched. @@ -501,7 +526,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { GUI::GuiManager::destroy(); Common::ConfigManager::destroy(); Common::DebugManager::destroy(); - Common::EventRecorder::destroy(); + GUI::EventRecorder::destroy(); Common::SearchManager::destroy(); #ifdef USE_TRANSLATION Common::TranslationManager::destroy(); diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index 012a2dfce5..dc123e8f8f 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -38,7 +38,9 @@ EventDispatcher::~EventDispatcher() { delete i->observer; } - delete _mapper; + if (_autoFreeMapper) { + delete _mapper; + } _mapper = 0; } @@ -68,11 +70,15 @@ void EventDispatcher::dispatch() { } } -void EventDispatcher::registerMapper(EventMapper *mapper) { - delete _mapper; +void EventDispatcher::registerMapper(EventMapper *mapper, bool autoFree) { + if (_autoFreeMapper) { + delete _mapper; + } _mapper = mapper; + _autoFreeMapper = autoFree; } + void EventDispatcher::registerSource(EventSource *source, bool autoFree) { SourceEntry newEntry; diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp deleted file mode 100644 index 5e24f128c3..0000000000 --- a/common/EventRecorder.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "common/EventRecorder.h" - -#include "common/bufferedstream.h" -#include "common/config-manager.h" -#include "common/random.h" -#include "common/savefile.h" -#include "common/textconsole.h" - -namespace Common { - -DECLARE_SINGLETON(EventRecorder); - -#define RECORD_SIGNATURE 0x54455354 -#define RECORD_VERSION 1 - -uint32 readTime(ReadStream *inFile) { - uint32 d = inFile->readByte(); - if (d == 0xff) { - d = inFile->readUint32LE(); - } - - return d; -} - -void writeTime(WriteStream *outFile, uint32 d) { - //Simple RLE compression - if (d >= 0xff) { - outFile->writeByte(0xff); - outFile->writeUint32LE(d); - } else { - outFile->writeByte(d); - } -} - -void readRecord(SeekableReadStream *inFile, uint32 &diff, Event &event, uint32 &millis) { - millis = readTime(inFile); - - diff = inFile->readUint32LE(); - - event.type = (EventType)inFile->readUint32LE(); - - switch (event.type) { - case EVENT_KEYDOWN: - case EVENT_KEYUP: - event.kbd.keycode = (KeyCode)inFile->readSint32LE(); - event.kbd.ascii = inFile->readUint16LE(); - event.kbd.flags = inFile->readByte(); - break; - case EVENT_MOUSEMOVE: - case EVENT_LBUTTONDOWN: - case EVENT_LBUTTONUP: - case EVENT_RBUTTONDOWN: - case EVENT_RBUTTONUP: - case EVENT_WHEELUP: - case EVENT_WHEELDOWN: - case EVENT_MBUTTONDOWN: - case EVENT_MBUTTONUP: - event.mouse.x = inFile->readSint16LE(); - event.mouse.y = inFile->readSint16LE(); - break; - default: - break; - } -} - -void writeRecord(WriteStream *outFile, uint32 diff, const Event &event, uint32 millis) { - writeTime(outFile, millis); - - outFile->writeUint32LE(diff); - - outFile->writeUint32LE((uint32)event.type); - - switch (event.type) { - case EVENT_KEYDOWN: - case EVENT_KEYUP: - outFile->writeSint32LE(event.kbd.keycode); - outFile->writeUint16LE(event.kbd.ascii); - outFile->writeByte(event.kbd.flags); - break; - case EVENT_MOUSEMOVE: - case EVENT_LBUTTONDOWN: - case EVENT_LBUTTONUP: - case EVENT_RBUTTONDOWN: - case EVENT_RBUTTONUP: - case EVENT_WHEELUP: - case EVENT_WHEELDOWN: - case EVENT_MBUTTONDOWN: - case EVENT_MBUTTONUP: - outFile->writeSint16LE(event.mouse.x); - outFile->writeSint16LE(event.mouse.y); - break; - default: - break; - } -} - -EventRecorder::EventRecorder() { - _recordFile = NULL; - _recordTimeFile = NULL; - _playbackFile = NULL; - _playbackTimeFile = NULL; - _timeMutex = g_system->createMutex(); - _recorderMutex = g_system->createMutex(); - - _eventCount = 0; - _lastEventCount = 0; - _lastMillis = 0; - _lastEventMillis = 0; - - _recordMode = kPassthrough; -} - -EventRecorder::~EventRecorder() { - deinit(); - - g_system->deleteMutex(_timeMutex); - g_system->deleteMutex(_recorderMutex); -} - -void EventRecorder::init() { - String recordModeString = ConfMan.get("record_mode"); - if (recordModeString.compareToIgnoreCase("record") == 0) { - _recordMode = kRecorderRecord; - - debug(3, "EventRecorder: record"); - } else { - if (recordModeString.compareToIgnoreCase("playback") == 0) { - _recordMode = kRecorderPlayback; - debug(3, "EventRecorder: playback"); - } else { - _recordMode = kPassthrough; - debug(3, "EventRecorder: passthrough"); - } - } - - _recordFileName = ConfMan.get("record_file_name"); - if (_recordFileName.empty()) { - _recordFileName = "record.bin"; - } - _recordTempFileName = ConfMan.get("record_temp_file_name"); - if (_recordTempFileName.empty()) { - _recordTempFileName = "record.tmp"; - } - _recordTimeFileName = ConfMan.get("record_time_file_name"); - if (_recordTimeFileName.empty()) { - _recordTimeFileName = "record.time"; - } - - // recorder stuff - if (_recordMode == kRecorderRecord) { - _recordCount = 0; - _recordTimeCount = 0; - _recordFile = wrapBufferedWriteStream(g_system->getSavefileManager()->openForSaving(_recordTempFileName), 128 * 1024); - _recordTimeFile = wrapBufferedWriteStream(g_system->getSavefileManager()->openForSaving(_recordTimeFileName), 128 * 1024); - _recordSubtitles = ConfMan.getBool("subtitles"); - } - - uint32 sign; - uint32 randomSourceCount; - if (_recordMode == kRecorderPlayback) { - _playbackCount = 0; - _playbackTimeCount = 0; - _playbackFile = wrapBufferedSeekableReadStream(g_system->getSavefileManager()->openForLoading(_recordFileName), 128 * 1024, DisposeAfterUse::YES); - _playbackTimeFile = wrapBufferedSeekableReadStream(g_system->getSavefileManager()->openForLoading(_recordTimeFileName), 128 * 1024, DisposeAfterUse::YES); - - if (!_playbackFile) { - warning("Cannot open playback file %s. Playback was switched off", _recordFileName.c_str()); - _recordMode = kPassthrough; - } - - if (!_playbackTimeFile) { - warning("Cannot open playback time file %s. Playback was switched off", _recordTimeFileName.c_str()); - _recordMode = kPassthrough; - } - } - - if (_recordMode == kRecorderPlayback) { - sign = _playbackFile->readUint32LE(); - if (sign != RECORD_SIGNATURE) { - error("Unknown record file signature"); - } - - _playbackFile->readUint32LE(); // version - - // conf vars - ConfMan.setBool("subtitles", _playbackFile->readByte() != 0); - - _recordCount = _playbackFile->readUint32LE(); - _recordTimeCount = _playbackFile->readUint32LE(); - - randomSourceCount = _playbackFile->readUint32LE(); - for (uint i = 0; i < randomSourceCount; ++i) { - RandomSourceRecord rec; - rec.name = ""; - uint32 sLen = _playbackFile->readUint32LE(); - for (uint j = 0; j < sLen; ++j) { - char c = _playbackFile->readSByte(); - rec.name += c; - } - rec.seed = _playbackFile->readUint32LE(); - _randomSourceRecords.push_back(rec); - } - - _hasPlaybackEvent = false; - } - - g_system->getEventManager()->getEventDispatcher()->registerSource(this, false); - g_system->getEventManager()->getEventDispatcher()->registerObserver(this, EventManager::kEventRecorderPriority, false, true); -} - -void EventRecorder::deinit() { - debug(3, "EventRecorder: deinit"); - - g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); - g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); - - g_system->lockMutex(_timeMutex); - g_system->lockMutex(_recorderMutex); - _recordMode = kPassthrough; - g_system->unlockMutex(_timeMutex); - g_system->unlockMutex(_recorderMutex); - - delete _playbackFile; - delete _playbackTimeFile; - - if (_recordFile != NULL) { - _recordFile->finalize(); - delete _recordFile; - _recordTimeFile->finalize(); - delete _recordTimeFile; - - _playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName); - - assert(_playbackFile); - - _recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName); - _recordFile->writeUint32LE(RECORD_SIGNATURE); - _recordFile->writeUint32LE(RECORD_VERSION); - - // conf vars - _recordFile->writeByte(_recordSubtitles ? 1 : 0); - - _recordFile->writeUint32LE(_recordCount); - _recordFile->writeUint32LE(_recordTimeCount); - - _recordFile->writeUint32LE(_randomSourceRecords.size()); - for (uint i = 0; i < _randomSourceRecords.size(); ++i) { - _recordFile->writeUint32LE(_randomSourceRecords[i].name.size()); - _recordFile->writeString(_randomSourceRecords[i].name); - _recordFile->writeUint32LE(_randomSourceRecords[i].seed); - } - - for (uint i = 0; i < _recordCount; ++i) { - uint32 tempDiff; - Event tempEvent; - uint32 millis; - readRecord(_playbackFile, tempDiff, tempEvent, millis); - writeRecord(_recordFile, tempDiff, tempEvent, millis); - } - - _recordFile->finalize(); - delete _recordFile; - delete _playbackFile; - - //TODO: remove recordTempFileName'ed file - } -} - -void EventRecorder::registerRandomSource(RandomSource &rnd, const String &name) { - if (_recordMode == kRecorderRecord) { - RandomSourceRecord rec; - rec.name = name; - rec.seed = rnd.getSeed(); - _randomSourceRecords.push_back(rec); - } - - if (_recordMode == kRecorderPlayback) { - for (uint i = 0; i < _randomSourceRecords.size(); ++i) { - if (_randomSourceRecords[i].name == name) { - rnd.setSeed(_randomSourceRecords[i].seed); - _randomSourceRecords.remove_at(i); - break; - } - } - } -} - -void EventRecorder::processMillis(uint32 &millis) { - uint32 d; - if (_recordMode == kPassthrough) { - return; - } - - g_system->lockMutex(_timeMutex); - if (_recordMode == kRecorderRecord) { - d = millis - _lastMillis; - writeTime(_recordTimeFile, d); - - _recordTimeCount++; - } - - if (_recordMode == kRecorderPlayback) { - if (_recordTimeCount > _playbackTimeCount) { - d = readTime(_playbackTimeFile); - - while ((_lastMillis + d > millis) && (_lastMillis + d - millis > 50)) { - _recordMode = kPassthrough; - g_system->delayMillis(50); - millis = g_system->getMillis(); - _recordMode = kRecorderPlayback; - } - - millis = _lastMillis + d; - _playbackTimeCount++; - } - } - - _lastMillis = millis; - g_system->unlockMutex(_timeMutex); -} - -bool EventRecorder::processDelayMillis(uint &msecs) { - if (_recordMode == kRecorderPlayback) { - _recordMode = kPassthrough; - - uint32 millis = g_system->getMillis(); - - _recordMode = kRecorderPlayback; - - if (_lastMillis > millis) { - // Skip delay if we're getting late - return true; - } - } - - return false; -} - -bool EventRecorder::notifyEvent(const Event &ev) { - if (_recordMode != kRecorderRecord) - return false; - - StackLock lock(_recorderMutex); - ++_eventCount; - - writeRecord(_recordFile, _eventCount - _lastEventCount, ev, _lastMillis - _lastEventMillis); - - _recordCount++; - _lastEventCount = _eventCount; - _lastEventMillis = _lastMillis; - - return false; -} - -bool EventRecorder::notifyPoll() { - if (_recordMode != kRecorderRecord) - return false; - - ++_eventCount; - - return false; -} - -bool EventRecorder::pollEvent(Event &ev) { - uint32 millis; - - if (_recordMode != kRecorderPlayback) - return false; - - StackLock lock(_recorderMutex); - ++_eventCount; - - if (!_hasPlaybackEvent) { - if (_recordCount > _playbackCount) { - readRecord(_playbackFile, const_cast(_playbackDiff), _playbackEvent, millis); - _playbackCount++; - _hasPlaybackEvent = true; - } - } - - if (_hasPlaybackEvent) { - if (_playbackDiff <= (_eventCount - _lastEventCount)) { - switch (_playbackEvent.type) { - case EVENT_MOUSEMOVE: - case EVENT_LBUTTONDOWN: - case EVENT_LBUTTONUP: - case EVENT_RBUTTONDOWN: - case EVENT_RBUTTONUP: - case EVENT_WHEELUP: - case EVENT_WHEELDOWN: - g_system->warpMouse(_playbackEvent.mouse.x, _playbackEvent.mouse.y); - break; - default: - break; - } - ev = _playbackEvent; - _hasPlaybackEvent = false; - _lastEventCount = _eventCount; - return true; - } - } - - return false; -} - -} // End of namespace Common diff --git a/common/EventRecorder.h b/common/EventRecorder.h deleted file mode 100644 index 43a08b08cd..0000000000 --- a/common/EventRecorder.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef COMMON_EVENTRECORDER_H -#define COMMON_EVENTRECORDER_H - -#include "common/scummsys.h" -#include "common/events.h" -#include "common/singleton.h" -#include "common/mutex.h" -#include "common/array.h" - -#define g_eventRec (Common::EventRecorder::instance()) - -namespace Common { - -class RandomSource; -class SeekableReadStream; -class WriteStream; - -/** - * Our generic event recorder. - * - * TODO: Add more documentation. - */ -class EventRecorder : private EventSource, private EventObserver, public Singleton { - friend class Singleton; - EventRecorder(); - ~EventRecorder(); -public: - void init(); - void deinit(); - - /** Register random source so it can be serialized in game test purposes */ - void registerRandomSource(RandomSource &rnd, const String &name); - - /** TODO: Add documentation, this is only used by the backend */ - void processMillis(uint32 &millis); - - /** TODO: Add documentation, this is only used by the backend */ - bool processDelayMillis(uint &msecs); - -private: - bool notifyEvent(const Event &ev); - bool notifyPoll(); - bool pollEvent(Event &ev); - bool allowMapping() const { return false; } - - class RandomSourceRecord { - public: - String name; - uint32 seed; - }; - Array _randomSourceRecords; - - bool _recordSubtitles; - volatile uint32 _recordCount; - volatile uint32 _lastRecordEvent; - volatile uint32 _recordTimeCount; - volatile uint32 _lastEventMillis; - WriteStream *_recordFile; - WriteStream *_recordTimeFile; - MutexRef _timeMutex; - MutexRef _recorderMutex; - volatile uint32 _lastMillis; - - volatile uint32 _playbackCount; - volatile uint32 _playbackDiff; - volatile bool _hasPlaybackEvent; - volatile uint32 _playbackTimeCount; - Event _playbackEvent; - SeekableReadStream *_playbackFile; - SeekableReadStream *_playbackTimeFile; - - volatile uint32 _eventCount; - volatile uint32 _lastEventCount; - - enum RecordMode { - kPassthrough = 0, - kRecorderRecord = 1, - kRecorderPlayback = 2 - }; - volatile RecordMode _recordMode; - String _recordFileName; - String _recordTempFileName; - String _recordTimeFileName; -}; - -} // End of namespace Common - -#endif diff --git a/common/debug.h b/common/debug.h index dc94839082..859f3c41b3 100644 --- a/common/debug.h +++ b/common/debug.h @@ -117,5 +117,9 @@ void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3); */ extern int gDebugLevel; +//Global constant for EventRecorder debug channel +enum GlobalDebugLevels { + kDebugLevelEventRec = 1 << 30 +}; #endif diff --git a/common/events.h b/common/events.h index 7366c51d36..9029a4096a 100644 --- a/common/events.h +++ b/common/events.h @@ -288,11 +288,14 @@ public: * to the EventDispatcher, thus it will be deleted * with "delete", when EventDispatcher is destroyed. * - * Note there is only one mapper per EventDispatcher - * possible, thus when this method is called twice, - * the former mapper will be destroied. + * @param autoFree Destroy previous mapper [default] + * Normally we allow only one event mapper to exists, + * However Event Recorder must intervent into normal + * event flow without altering its semantics. Thus during + * Event Recorder playback and recording we allow + * two mappers. */ - void registerMapper(EventMapper *mapper); + void registerMapper(EventMapper *mapper, bool autoFree = true); /** * Queries the setup event mapper. @@ -326,6 +329,7 @@ public: */ void unregisterObserver(EventObserver *obs); private: + bool _autoFreeMapper; EventMapper *_mapper; struct Entry { diff --git a/common/memstream.h b/common/memstream.h index 260fb64d84..7fa6500753 100644 --- a/common/memstream.h +++ b/common/memstream.h @@ -89,8 +89,9 @@ public: */ class MemoryWriteStream : public WriteStream { private: - byte *_ptr; const uint32 _bufSize; +protected: + byte *_ptr; uint32 _pos; bool _err; public: @@ -116,6 +117,40 @@ public: virtual void clearErr() { _err = false; } }; +/** + * MemoryWriteStream subclass with ability to set stream position indicator. + */ +class SeekableMemoryWriteStream : public MemoryWriteStream { +private: + byte *_ptrOrig; +public: + SeekableMemoryWriteStream(byte *buf, uint32 len) : MemoryWriteStream(buf, len), _ptrOrig(buf) {} + uint32 seek(uint32 offset, int whence = SEEK_SET) { + switch (whence) { + case SEEK_END: + // SEEK_END works just like SEEK_SET, only 'reversed', + // i.e. from the end. + offset = size() + offset; + // Fall through + case SEEK_SET: + _ptr = _ptrOrig + offset; + _pos = offset; + break; + case SEEK_CUR: + _ptr += offset; + _pos += offset; + break; + } + // Post-Condition + if (_pos > size()) { + _pos = size(); + _ptr = _ptrOrig + _pos; + } + return _pos; + } +}; + + /** * A sort of hybrid between MemoryWriteStream and Array classes. A stream * that grows as it's written to. diff --git a/common/module.mk b/common/module.mk index d96b11ee40..9f9126c8ef 100644 --- a/common/module.mk +++ b/common/module.mk @@ -10,7 +10,6 @@ MODULE_OBJS := \ error.o \ EventDispatcher.o \ EventMapper.o \ - EventRecorder.o \ file.o \ fs.o \ gui_options.o \ @@ -51,5 +50,10 @@ MODULE_OBJS += \ rdft.o \ sinetables.o +ifdef ENABLE_EVENTRECORDER +MODULE_OBJS += \ + recorderfile.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/common/random.cpp b/common/random.cpp index fd75534c44..a74ab831ea 100644 --- a/common/random.cpp +++ b/common/random.cpp @@ -21,7 +21,7 @@ #include "common/random.h" #include "common/system.h" -#include "common/EventRecorder.h" +#include "gui/EventRecorder.h" namespace Common { @@ -30,13 +30,8 @@ RandomSource::RandomSource(const String &name) { // Use system time as RNG seed. Normally not a good idea, if you are using // a RNG for security purposes, but good enough for our purposes. assert(g_system); - uint32 seed = g_system->getMillis(); + uint32 seed = g_eventRec.getRandomSeed(name); setSeed(seed); - - // Register this random source with the event recorder. This may end - // up querying or resetting the current seed, so we must call it - // *after* the initial seed has been set. - g_eventRec.registerRandomSource(*this, name); } void RandomSource::setSeed(uint32 seed) { diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp new file mode 100644 index 0000000000..60c47e11ce --- /dev/null +++ b/common/recorderfile.cpp @@ -0,0 +1,708 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/system.h" +#include "gui/EventRecorder.h" +#include "common/md5.h" +#include "common/recorderfile.h" +#include "common/savefile.h" +#include "common/bufferedstream.h" +#include "graphics/thumbnail.h" +#include "graphics/surface.h" +#include "graphics/scaler.h" + +#define RECORD_VERSION 1 + +namespace Common { + +PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmpPlaybackFile(_tmpBuffer, kRecordBuffSize) { + _readStream = NULL; + _writeStream = NULL; + _screenshotsFile = NULL; + _mode = kClosed; +} + +PlaybackFile::~PlaybackFile() { + close(); +} + +bool PlaybackFile::openWrite(const String &fileName) { + close(); + _header.fileName = fileName; + _writeStream = wrapBufferedWriteStream(g_system->getSavefileManager()->openForSaving(fileName), 128 * 1024); + _headerDumped = false; + _recordCount = 0; + if (_writeStream == NULL) { + return false; + } + _mode = kWrite; + return true; +} + +bool PlaybackFile::openRead(const String &fileName) { + close(); + _header.fileName = fileName; + _eventsSize = 0; + _tmpPlaybackFile.seek(0); + _readStream = wrapBufferedSeekableReadStream(g_system->getSavefileManager()->openForLoading(fileName), 128 * 1024, DisposeAfterUse::YES); + if (_readStream == NULL) { + debugC(1, kDebugLevelEventRec, "playback:action=\"Load File\" result=fail reason=\"file %s not found\"", fileName.c_str()); + return false; + } + if (!parseHeader()) { + debugC(1, kDebugLevelEventRec, "playback:action=\"Load File\" result=fail reason=\"header parsing failed\""); + return false; + } + _screenshotsFile = wrapBufferedWriteStream(g_system->getSavefileManager()->openForSaving("screenshots.bin"), 128 * 1024); + debugC(1, kDebugLevelEventRec, "playback:action=\"Load File\" result=success"); + _mode = kRead; + return true; +} + +void PlaybackFile::close() { + delete _readStream; + _readStream = NULL; + if (_writeStream != NULL) { + dumpRecordsToFile(); + _writeStream->finalize(); + delete _writeStream; + _writeStream = NULL; + updateHeader(); + } + if (_screenshotsFile != NULL) { + _screenshotsFile->finalize(); + delete _screenshotsFile; + _screenshotsFile = NULL; + } + for (HashMap::iterator i = _header.saveFiles.begin(); i != _header.saveFiles.end(); ++i) { + free(i->_value.buffer); + } + _header.saveFiles.clear(); + _mode = kClosed; +} + +bool PlaybackFile::parseHeader() { + PlaybackFileHeader result; + ChunkHeader nextChunk; + _playbackParseState = kFileStateCheckFormat; + if (!readChunkHeader(nextChunk)) { + _playbackParseState = kFileStateError; + return false; + } + while ((_playbackParseState != kFileStateDone) && (_playbackParseState != kFileStateError)) { + if (processChunk(nextChunk)) { + if (!readChunkHeader(nextChunk)) { + warning("Error in header parsing"); + _playbackParseState = kFileStateError; + } + } + } + return _playbackParseState == kFileStateDone; +} + +bool PlaybackFile::checkPlaybackFileVersion() { + uint32 version; + version = _readStream->readUint32LE(); + if (version != RECORD_VERSION) { + warning("Incorrect playback file version. Expected version %d, but got %d.", RECORD_VERSION, version); + return false; + } + return true; +} + + +String PlaybackFile::readString(int len) { + String result; + char buf[50]; + int readSize = 49; + while (len > 0) { + if (len <= 49) { + readSize = len; + } + _readStream->read(buf, readSize); + buf[readSize] = 0; + result += buf; + len -= readSize; + } + return result; +} + +bool PlaybackFile::readChunkHeader(PlaybackFile::ChunkHeader &nextChunk) { + nextChunk.id = (FileTag)_readStream->readUint32LE(); + nextChunk.len = _readStream->readUint32LE(); + return !_readStream->err() && !_readStream->eos(); +} + +bool PlaybackFile::processChunk(ChunkHeader &nextChunk) { + switch (_playbackParseState) { + case kFileStateCheckFormat: + if (nextChunk.id == kFormatIdTag) { + _playbackParseState = kFileStateCheckVersion; + } else { + warning("Unknown playback file signature"); + _playbackParseState = kFileStateError; + } + break; + case kFileStateCheckVersion: + if ((nextChunk.id == kVersionTag) && checkPlaybackFileVersion()) { + _playbackParseState = kFileStateSelectSection; + } else { + _playbackParseState = kFileStateError; + } + break; + case kFileStateSelectSection: + switch (nextChunk.id) { + case kHeaderSectionTag: + _playbackParseState = kFileStateProcessHeader; + break; + case kHashSectionTag: + _playbackParseState = kFileStateProcessHash; + break; + case kRandomSectionTag: + _playbackParseState = kFileStateProcessRandom; + break; + case kEventTag: + case kScreenShotTag: + _readStream->seek(-8, SEEK_CUR); + _playbackParseState = kFileStateDone; + return false; + case kSaveTag: + _playbackParseState = kFileStateProcessSave; + break; + case kSettingsSectionTag: + _playbackParseState = kFileStateProcessSettings; + warning("Loading record header"); + break; + default: + _readStream->skip(nextChunk.len); + break; + } + break; + case kFileStateProcessSave: + if (nextChunk.id == kSaveRecordTag) { + readSaveRecord(); + } else { + _playbackParseState = kFileStateSelectSection; + return false; + } + break; + case kFileStateProcessHeader: + switch (nextChunk.id) { + case kAuthorTag: + _header.author = readString(nextChunk.len); + break; + case kCommentsTag: + _header.notes = readString(nextChunk.len); + break; + case kNameTag: + _header.name = readString(nextChunk.len); + break; + default: + _playbackParseState = kFileStateSelectSection; + return false; + } + break; + case kFileStateProcessHash: + if (nextChunk.id == kHashRecordTag) { + readHashMap(nextChunk); + } else { + _playbackParseState = kFileStateSelectSection; + return false; + } + break; + case kFileStateProcessRandom: + if (nextChunk.id == kRandomRecordTag) { + processRndSeedRecord(nextChunk); + } else { + _playbackParseState = kFileStateSelectSection; + return false; + } + break; + case kFileStateProcessSettings: + if (nextChunk.id == kSettingsRecordTag) { + if (!processSettingsRecord()) { + _playbackParseState = kFileStateError; + return false; + } + } else { + _playbackParseState = kFileStateSelectSection; + return false; + } + break; + default: + return false; + } + return true; +} + +void PlaybackFile::returnToChunkHeader() { + _readStream->seek(-8, SEEK_CUR); +} + +void PlaybackFile::readHashMap(ChunkHeader chunk) { + String hashName = readString(chunk.len - 32); + String hashMd5 = readString(32); + _header.hashRecords[hashName] = hashMd5; +} + +void PlaybackFile::processRndSeedRecord(ChunkHeader chunk) { + String randomSourceName = readString(chunk.len - 4); + uint32 randomSourceSeed = _readStream->readUint32LE(); + _header.randomSourceRecords[randomSourceName] = randomSourceSeed; +} + +bool PlaybackFile::processSettingsRecord() { + ChunkHeader keyChunk; + if (!readChunkHeader(keyChunk) || (keyChunk.id != kSettingsRecordKeyTag)) { + warning("Invalid format of settings section"); + return false; + } + String key = readString(keyChunk.len); + ChunkHeader valueChunk; + if (!readChunkHeader(valueChunk) || (valueChunk.id != kSettingsRecordValueTag)) { + warning("Invalid format of settings section"); + return false; + } + String value = readString(valueChunk.len); + _header.settingsRecords[key] = value; + return true; +} + + +bool PlaybackFile::readSaveRecord() { + ChunkHeader fileNameChunk; + if (!readChunkHeader(fileNameChunk) || (fileNameChunk.id != kSaveRecordNameTag)) { + warning("Invalid format of save section"); + return false; + } + String fileName = readString(fileNameChunk.len); + ChunkHeader saveBufferChunk; + if (!readChunkHeader(saveBufferChunk) || (saveBufferChunk.id != kSaveRecordBufferTag)) { + warning("Invalid format of save section"); + return false; + } + SaveFileBuffer buf; + buf.size = saveBufferChunk.len; + buf.buffer = (byte *)malloc(saveBufferChunk.len); + _readStream->read(buf.buffer, buf.size); + _header.saveFiles[fileName] = buf; + debugC(1, kDebugLevelEventRec, "playback:action=\"Load save file\" filename=%s len=%d", fileName.c_str(), buf.size); + return true; +} + + + +RecorderEvent PlaybackFile::getNextEvent() { + assert(_mode == kRead); + if (isEventsBufferEmpty()) { + PlaybackFile::ChunkHeader header; + header.id = kFormatIdTag; + while (header.id != kEventTag) { + if (!readChunkHeader(header) || _readStream->eos()) { + break; + } + switch (header.id) { + case kEventTag: + readEventsToBuffer(header.len); + break; + case kScreenShotTag: + _readStream->seek(-4, SEEK_CUR); + header.len = _readStream->readUint32BE(); + _readStream->skip(header.len-8); + break; + case kMD5Tag: + checkRecordedMD5(); + break; + default: + _readStream->skip(header.len); + break; + } + } + } + RecorderEvent result; + readEvent(result); + return result; +} + +bool PlaybackFile::isEventsBufferEmpty() { + return (uint32)_tmpPlaybackFile.pos() == _eventsSize; +} + +void PlaybackFile::readEvent(RecorderEvent& event) { + event.recordedtype = (RecorderEventType)_tmpPlaybackFile.readByte(); + switch (event.recordedtype) { + case kRecorderEventTypeTimer: + event.time = _tmpPlaybackFile.readUint32LE(); + break; + case kRecorderEventTypeNormal: + event.type = (EventType)_tmpPlaybackFile.readUint32LE(); + switch (event.type) { + case EVENT_KEYDOWN: + case EVENT_KEYUP: + event.time = _tmpPlaybackFile.readUint32LE(); + event.kbd.keycode = (KeyCode)_tmpPlaybackFile.readSint32LE(); + event.kbd.ascii = _tmpPlaybackFile.readUint16LE(); + event.kbd.flags = _tmpPlaybackFile.readByte(); + break; + case EVENT_MOUSEMOVE: + case EVENT_LBUTTONDOWN: + case EVENT_LBUTTONUP: + case EVENT_RBUTTONDOWN: + case EVENT_RBUTTONUP: + case EVENT_WHEELUP: + case EVENT_WHEELDOWN: + case EVENT_MBUTTONDOWN: + case EVENT_MBUTTONUP: + event.time = _tmpPlaybackFile.readUint32LE(); + event.mouse.x = _tmpPlaybackFile.readSint16LE(); + event.mouse.y = _tmpPlaybackFile.readSint16LE(); + break; + default: + event.time = _tmpPlaybackFile.readUint32LE(); + break; + } + break; + } + event.synthetic = true; +} + +void PlaybackFile::readEventsToBuffer(uint32 size) { + _readStream->read(_tmpBuffer, size); + _tmpPlaybackFile.seek(0); + _eventsSize = size; +} + +void PlaybackFile::saveScreenShot(Graphics::Surface &screen, byte md5[16]) { + dumpRecordsToFile(); + _writeStream->writeUint32LE(kMD5Tag); + _writeStream->writeUint32LE(16); + _writeStream->write(md5, 16); + Graphics::saveThumbnail(*_writeStream, screen); +} + +void PlaybackFile::dumpRecordsToFile() { + if (!_headerDumped) { + dumpHeaderToFile(); + _headerDumped = true; + } + if (_recordCount == 0) { + return; + } + _writeStream->writeUint32LE(kEventTag); + _writeStream->writeUint32LE(_tmpRecordFile.pos()); + _writeStream->write(_tmpBuffer, _tmpRecordFile.pos()); + _tmpRecordFile.seek(0); + _recordCount = 0; +} + +void PlaybackFile::dumpHeaderToFile() { + _writeStream->writeUint32LE(kFormatIdTag); + // Specify size for first tag as NULL since we cannot calculate + // size of the file at time of the header dumping + _writeStream->writeUint32LE(0); + _writeStream->writeUint32LE(kVersionTag); + _writeStream->writeUint32LE(4); + _writeStream->writeUint32LE(RECORD_VERSION); + writeHeaderSection(); + writeGameHash(); + writeRandomRecords(); + writeGameSettings(); + writeSaveFilesSection(); +} + +void PlaybackFile::writeHeaderSection() { + uint32 headerSize = 0; + if (!_header.author.empty()) { + headerSize = _header.author.size() + 8; + } + if (!_header.notes.empty()) { + headerSize += _header.notes.size() + 8; + } + if (!_header.name.empty()) { + headerSize += _header.name.size() + 8; + } + if (headerSize == 0) { + return; + } + _writeStream->writeUint32LE(kHeaderSectionTag); + _writeStream->writeUint32LE(headerSize); + if (!_header.author.empty()) { + _writeStream->writeUint32LE(kAuthorTag); + _writeStream->writeUint32LE(_header.author.size()); + _writeStream->writeString(_header.author); + } + if (!_header.notes.empty()) { + _writeStream->writeUint32LE(kCommentsTag); + _writeStream->writeUint32LE(_header.notes.size()); + _writeStream->writeString(_header.notes); + } + if (!_header.name.empty()) { + _writeStream->writeUint32LE(kNameTag); + _writeStream->writeUint32LE(_header.name.size()); + _writeStream->writeString(_header.name); + } +} + +void PlaybackFile::writeGameHash() { + uint32 hashSectionSize = 0; + for (StringMap::iterator i = _header.hashRecords.begin(); i != _header.hashRecords.end(); ++i) { + hashSectionSize = hashSectionSize + i->_key.size() + i->_value.size() + 8; + } + if (_header.hashRecords.size() == 0) { + return; + } + _writeStream->writeUint32LE(kHashSectionTag); + _writeStream->writeUint32LE(hashSectionSize); + for (StringMap::iterator i = _header.hashRecords.begin(); i != _header.hashRecords.end(); ++i) { + _writeStream->writeUint32LE(kHashRecordTag); + _writeStream->writeUint32LE(i->_key.size() + i->_value.size()); + _writeStream->writeString(i->_key); + _writeStream->writeString(i->_value); + } +} + +void PlaybackFile::writeRandomRecords() { + uint32 randomSectionSize = 0; + for (RandomSeedsDictionary::iterator i = _header.randomSourceRecords.begin(); i != _header.randomSourceRecords.end(); ++i) { + randomSectionSize = randomSectionSize + i->_key.size() + 12; + } + if (_header.randomSourceRecords.size() == 0) { + return; + } + _writeStream->writeUint32LE(kRandomSectionTag); + _writeStream->writeUint32LE(randomSectionSize); + for (RandomSeedsDictionary::iterator i = _header.randomSourceRecords.begin(); i != _header.randomSourceRecords.end(); ++i) { + _writeStream->writeUint32LE(kRandomRecordTag); + _writeStream->writeUint32LE(i->_key.size() + 4); + _writeStream->writeString(i->_key); + _writeStream->writeUint32LE(i->_value); + } +} + +void PlaybackFile::writeEvent(const RecorderEvent &event) { + assert(_mode == kWrite); + _recordCount++; + _tmpRecordFile.writeByte(event.recordedtype); + switch (event.recordedtype) { + case kRecorderEventTypeTimer: + _tmpRecordFile.writeUint32LE(event.time); + break; + case kRecorderEventTypeNormal: + _tmpRecordFile.writeUint32LE((uint32)event.type); + switch(event.type) { + case EVENT_KEYDOWN: + case EVENT_KEYUP: + _tmpRecordFile.writeUint32LE(event.time); + _tmpRecordFile.writeSint32LE(event.kbd.keycode); + _tmpRecordFile.writeUint16LE(event.kbd.ascii); + _tmpRecordFile.writeByte(event.kbd.flags); + break; + case EVENT_MOUSEMOVE: + case EVENT_LBUTTONDOWN: + case EVENT_LBUTTONUP: + case EVENT_RBUTTONDOWN: + case EVENT_RBUTTONUP: + case EVENT_WHEELUP: + case EVENT_WHEELDOWN: + case EVENT_MBUTTONDOWN: + case EVENT_MBUTTONUP: + _tmpRecordFile.writeUint32LE(event.time); + _tmpRecordFile.writeSint16LE(event.mouse.x); + _tmpRecordFile.writeSint16LE(event.mouse.y); + break; + default: + _tmpRecordFile.writeUint32LE(event.time); + break; + } + break; + } + if (_recordCount == kMaxBufferedRecords) { + dumpRecordsToFile(); + } +} + +void PlaybackFile::writeGameSettings() { + _writeStream->writeUint32LE(kSettingsSectionTag); + uint32 settingsSectionSize = 0; + for (StringMap::iterator i = _header.settingsRecords.begin(); i != _header.settingsRecords.end(); ++i) { + settingsSectionSize += i->_key.size() + i->_value.size() + 24; + } + _writeStream->writeUint32LE(settingsSectionSize); + for (StringMap::iterator i = _header.settingsRecords.begin(); i != _header.settingsRecords.end(); ++i) { + _writeStream->writeUint32LE(kSettingsRecordTag); + _writeStream->writeUint32LE(i->_key.size() + i->_value.size() + 16); + _writeStream->writeUint32LE(kSettingsRecordKeyTag); + _writeStream->writeUint32LE(i->_key.size()); + _writeStream->writeString(i->_key); + _writeStream->writeUint32LE(kSettingsRecordValueTag); + _writeStream->writeUint32LE(i->_value.size()); + _writeStream->writeString(i->_value); + } +} + +int PlaybackFile::getScreensCount() { + if (_mode != kRead) { + return 0; + } + _readStream->seek(0); + int result = 0; + while (skipToNextScreenshot()) { + uint32 size = _readStream->readUint32BE(); + _readStream->skip(size-8); + ++result; + } + return result; +} + +bool PlaybackFile::skipToNextScreenshot() { + while (true) { + FileTag id = (FileTag)_readStream->readUint32LE(); + if (_readStream->eos()) { + break; + } + if (id == kScreenShotTag) { + return true; + } + else { + uint32 size = _readStream->readUint32LE(); + _readStream->skip(size); + } + } + return false; +} + +Graphics::Surface *PlaybackFile::getScreenShot(int number) { + if (_mode != kRead) { + return NULL; + } + _readStream->seek(0); + int screenCount = 1; + while (skipToNextScreenshot()) { + if (screenCount == number) { + screenCount++; + _readStream->seek(-4, SEEK_CUR); + return Graphics::loadThumbnail(*_readStream); + } else { + uint32 size = _readStream->readUint32BE(); + _readStream->skip(size-8); + screenCount++; + } + } + return NULL; +} + +void PlaybackFile::updateHeader() { + if (_mode == kWrite) { + _readStream = g_system->getSavefileManager()->openForLoading(_header.fileName); + } + _readStream->seek(0); + skipHeader(); + String tmpFilename = "_" + _header.fileName; + _writeStream = g_system->getSavefileManager()->openForSaving(tmpFilename); + dumpHeaderToFile(); + uint32 readedSize = 0; + do { + readedSize = _readStream->read(_tmpBuffer, kRecordBuffSize); + _writeStream->write(_tmpBuffer, readedSize); + } while (readedSize != 0); + delete _writeStream; + _writeStream = NULL; + delete _readStream; + _readStream = NULL; + g_system->getSavefileManager()->removeSavefile(_header.fileName); + g_system->getSavefileManager()->renameSavefile(tmpFilename, _header.fileName); + if (_mode == kRead) { + openRead(_header.fileName); + } +} + +void PlaybackFile::skipHeader() { + while (true) { + uint32 id = _readStream->readUint32LE(); + if (_readStream->eos()) { + break; + } + if ((id == kScreenShotTag) || (id == kEventTag) || (id == kMD5Tag)) { + _readStream->seek(-4, SEEK_CUR); + return; + } + else { + uint32 size = _readStream->readUint32LE(); + _readStream->skip(size); + } + } +} + +void PlaybackFile::addSaveFile(const String &fileName, InSaveFile *saveStream) { + uint oldPos = saveStream->pos(); + saveStream->seek(0); + _header.saveFiles[fileName].buffer = (byte *)malloc(saveStream->size()); + _header.saveFiles[fileName].size = saveStream->size(); + saveStream->read(_header.saveFiles[fileName].buffer, saveStream->size()); + saveStream->seek(oldPos); +} + +void PlaybackFile::writeSaveFilesSection() { + uint size = 0; + for (HashMap::iterator i = _header.saveFiles.begin(); i != _header.saveFiles.end(); ++i) { + size += i->_value.size + i->_key.size() + 24; + } + if (size == 0) { + return; + } + _writeStream->writeSint32LE(kSaveTag); + _writeStream->writeSint32LE(size); + for (HashMap::iterator i = _header.saveFiles.begin(); i != _header.saveFiles.end(); ++i) { + _writeStream->writeSint32LE(kSaveRecordTag); + _writeStream->writeSint32LE(i->_key.size() + i->_value.size + 16); + _writeStream->writeSint32LE(kSaveRecordNameTag); + _writeStream->writeSint32LE(i->_key.size()); + _writeStream->writeString(i->_key); + _writeStream->writeSint32LE(kSaveRecordBufferTag); + _writeStream->writeSint32LE(i->_value.size); + _writeStream->write(i->_value.buffer, i->_value.size); + } +} + + +void PlaybackFile::checkRecordedMD5() { + uint8 currentMD5[16]; + uint8 savedMD5[16]; + Graphics::Surface screen; + _readStream->read(savedMD5, 16); + if (!g_eventRec.grabScreenAndComputeMD5(screen, currentMD5)) { + return; + } + uint32 seconds = g_system->getMillis(true) / 1000; + String screenTime = String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60); + if (memcmp(savedMD5, currentMD5, 16) != 0) { + debugC(1, kDebugLevelEventRec, "playback:action=\"Check screenshot\" time=%s result = fail", screenTime.c_str()); + warning("Recorded and current screenshots are different"); + } else { + debugC(1, kDebugLevelEventRec, "playback:action=\"Check screenshot\" time=%s result = success", screenTime.c_str()); + } + Graphics::saveThumbnail(*_screenshotsFile, screen); + screen.free(); +} + + +} diff --git a/common/recorderfile.h b/common/recorderfile.h new file mode 100644 index 0000000000..1c95e5a915 --- /dev/null +++ b/common/recorderfile.h @@ -0,0 +1,180 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef COMMON_RECORDERFILE_H +#define COMMON_RECORDERFILE_H + +#include "common/scummsys.h" +#include "common/events.h" +#include "common/mutex.h" +#include "common/memstream.h" +#include "common/config-manager.h" +#include "common/savefile.h" + +//capacity of records buffer +#define kMaxBufferedRecords 10000 +#define kRecordBuffSize sizeof(RecorderEvent) * kMaxBufferedRecords + +namespace Common { + +enum RecorderEventType { + kRecorderEventTypeNormal = 0, + kRecorderEventTypeTimer = 1 +}; + +struct RecorderEvent : Event { + RecorderEventType recordedtype; + uint32 time; +}; + + + +class PlaybackFile { + typedef HashMap RandomSeedsDictionary; + enum fileMode { + kRead = 0, + kWrite = 1, + kClosed = 2 + }; + enum PlaybackFileState { + kFileStateCheckFormat, + kFileStateCheckVersion, + kFileStateProcessHash, + kFileStateProcessHeader, + kFileStateProcessRandom, + kFileStateSelectSection, + kFileStateProcessSettings, + kFileStateProcessSave, + kFileStateDone, + kFileStateError + }; + enum FileTag { + kFormatIdTag = MKTAG('P','B','C','K'), + kVersionTag = MKTAG('V','E','R','S'), + kHeaderSectionTag = MKTAG('H','E','A','D'), + kHashSectionTag = MKTAG('H','A','S','H'), + kRandomSectionTag = MKTAG('R','A','N','D'), + kEventTag = MKTAG('E','V','N','T'), + kScreenShotTag = MKTAG('B','M','H','T'), + kSettingsSectionTag = MKTAG('S','E','T','T'), + kAuthorTag = MKTAG('H','A','U','T'), + kCommentsTag = MKTAG('H','C','M','T'), + kNameTag = MKTAG('H','N','A','M'), + kHashRecordTag = MKTAG('H','R','C','D'), + kRandomRecordTag = MKTAG('R','R','C','D'), + kSettingsRecordTag = MKTAG('S','R','E','C'), + kSettingsRecordKeyTag = MKTAG('S','K','E','Y'), + kSettingsRecordValueTag = MKTAG('S','V','A','L'), + kSaveTag = MKTAG('S','A','V','E'), + kSaveRecordTag = MKTAG('R','S','A','V'), + kSaveRecordNameTag = MKTAG('S','N','A','M'), + kSaveRecordBufferTag = MKTAG('S','B','U','F'), + kMD5Tag = MKTAG('M','D','5',' ') + }; + struct ChunkHeader { + FileTag id; + uint32 len; + }; +public: + struct SaveFileBuffer { + byte *buffer; + uint32 size; + }; + struct PlaybackFileHeader { + String fileName; + String author; + String name; + String notes; + String description; + StringMap hashRecords; + StringMap settingsRecords; + HashMap saveFiles; + RandomSeedsDictionary randomSourceRecords; + }; + PlaybackFile(); + ~PlaybackFile(); + + bool openWrite(const String &fileName); + bool openRead(const String &fileName); + void close(); + + RecorderEvent getNextEvent(); + void writeEvent(const RecorderEvent &event); + + void saveScreenShot(Graphics::Surface &screen, byte md5[16]); + Graphics::Surface *getScreenShot(int number); + int getScreensCount(); + + bool isEventsBufferEmpty(); + PlaybackFileHeader &getHeader() {return _header;} + void updateHeader(); + void addSaveFile(const String &fileName, InSaveFile *saveStream); +private: + WriteStream *_recordFile; + WriteStream *_writeStream; + WriteStream *_screenshotsFile; + MemoryReadStream _tmpPlaybackFile; + SeekableReadStream *_readStream; + SeekableMemoryWriteStream _tmpRecordFile; + + fileMode _mode; + bool _headerDumped; + int _recordCount; + uint32 _eventsSize; + byte _tmpBuffer[kRecordBuffSize]; + PlaybackFileHeader _header; + PlaybackFileState _playbackParseState; + + void skipHeader(); + bool parseHeader(); + bool processChunk(ChunkHeader &nextChunk); + void returnToChunkHeader(); + + bool readSaveRecord(); + void checkRecordedMD5(); + bool readChunkHeader(ChunkHeader &nextChunk); + void processRndSeedRecord(ChunkHeader chunk); + bool processSettingsRecord(); + + bool checkPlaybackFileVersion(); + + void dumpHeaderToFile(); + void writeSaveFilesSection(); + void writeGameSettings(); + void writeHeaderSection(); + void writeGameHash(); + void writeRandomRecords(); + + void dumpRecordsToFile(); + + String readString(int len); + void readHashMap(ChunkHeader chunk); + + bool skipToNextScreenshot(); + void readEvent(RecorderEvent& event); + void readEventsToBuffer(uint32 size); + bool grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5[16]); +}; + +} // End of namespace Common + +#endif diff --git a/common/system.cpp b/common/system.cpp index 59210544ab..b40072afad 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -30,6 +30,7 @@ #include "common/taskbar.h" #include "common/updates.h" #include "common/textconsole.h" +#include "gui/EventRecorder.h" #include "backends/audiocd/default/default-audiocd.h" #include "backends/fs/fs-factory.h" @@ -84,7 +85,7 @@ void OSystem::initBackend() { error("Backend failed to instantiate audio CD manager"); if (!_eventManager) error("Backend failed to instantiate event manager"); - if (!_timerManager) + if (!getTimerManager()) error("Backend failed to instantiate timer manager"); // TODO: We currently don't check _savefileManager, because at least @@ -152,3 +153,11 @@ Common::String OSystem::getDefaultConfigFileName() { Common::String OSystem::getSystemLanguage() const { return "en_US"; } + +Common::TimerManager *OSystem::getTimerManager() { + return _timerManager; +} + +Common::SaveFileManager *OSystem::getSavefileManager() { + return g_eventRec.getSaveManager(_savefileManager); +} diff --git a/common/system.h b/common/system.h index 99b947d7f3..81c4bdf34e 100644 --- a/common/system.h +++ b/common/system.h @@ -890,8 +890,14 @@ public: /** @name Events and Time */ //@{ - /** Get the number of milliseconds since the program was started. */ - virtual uint32 getMillis() = 0; + /** Get the number of milliseconds since the program was started. + + @param skipRecord Skip recording of this value by event recorder. + This could be needed particularly when we are in + an on-screen GUI loop where player can pause + the recording. + */ + virtual uint32 getMillis(bool skipRecord = false) = 0; /** Delay/sleep for the specified amount of milliseconds. */ virtual void delayMillis(uint msecs) = 0; @@ -907,9 +913,7 @@ public: * Return the timer manager singleton. For more information, refer * to the TimerManager documentation. */ - inline Common::TimerManager *getTimerManager() { - return _timerManager; - } + virtual Common::TimerManager *getTimerManager(); /** * Return the event manager singleton. For more information, refer @@ -1086,9 +1090,7 @@ public: * and other modifiable persistent game data. For more information, * refer to the SaveFileManager documentation. */ - inline Common::SaveFileManager *getSavefileManager() { - return _savefileManager; - } + Common::SaveFileManager *getSavefileManager(); #if defined(USE_TASKBAR) /** diff --git a/configure b/configure index db347c160d..08eba6595c 100755 --- a/configure +++ b/configure @@ -138,9 +138,10 @@ _build_hq_scalers=yes _enable_prof=no _global_constructors=no _bink=yes -# Default vkeybd/keymapper options +# Default vkeybd/keymapper/eventrec options _vkeybd=no _keymapper=no +_eventrec=auto # GUI translation options _translation=yes # Default platform settings @@ -1036,6 +1037,8 @@ for ac_option in $@; do --disable-vkeybd) _vkeybd=no ;; --enable-keymapper) _keymapper=yes ;; --disable-keymapper) _keymapper=no ;; + --enable-eventrecorder) _eventrec=yes ;; + --disable-eventrecorder) _eventrec=no ;; --enable-text-console) _text_console=yes ;; --disable-text-console) _text_console=no ;; --with-fluidsynth-prefix=*) @@ -2881,6 +2884,20 @@ case $_backend in ;; esac +# +# Enable Event Recorder only for backends that support it +# +case $_backend in + sdl) + if test "$_eventrec" = auto ; then + _eventrec=yes + fi + ;; + *) + _eventrec=no + ;; +esac + # # Disable savegame timestamp support for backends which don't have a reliable real time clock # @@ -3797,10 +3814,12 @@ fi define_in_config_if_yes $_nasm 'USE_NASM' # -# Enable vkeybd / keymapper +# Enable vkeybd / keymapper / event recorder # define_in_config_if_yes $_vkeybd 'ENABLE_VKEYBD' define_in_config_if_yes $_keymapper 'ENABLE_KEYMAPPER' +define_in_config_if_yes $_eventrec 'ENABLE_EVENTRECORDER' +add_line_to_config_mk_if_yes $_eventrec "ENABLE_EVENTRECORDER = 1" # Check whether to build translation support # @@ -3946,7 +3965,11 @@ if test "$_vkeybd" = yes ; then fi if test "$_keymapper" = yes ; then - echo ", keymapper" + echo_n ", keymapper" +fi + +if test "$_eventrec" = yes ; then + echo ", event recorder" else echo fi diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index b1d1008b60..9023548c83 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -29,7 +29,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "common/translation.h" - +#include "gui/EventRecorder.h" #include "engines/advancedDetector.h" #include "engines/obsolete.h" @@ -301,6 +301,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) return Common::kUserCanceled; debug(2, "Running %s", gameDescriptor.description().c_str()); + initSubSystems(agdDesc); if (!createInstance(syst, engine, agdDesc)) return Common::kNoGameDataFoundError; else @@ -606,3 +607,9 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con _maxScanDepth = 1; _directoryGlobs = NULL; } + +void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const { + if (gameDesc) { + g_eventRec.processGameDescription(gameDesc); + } +} diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 3eec33abe5..71d2c4a446 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -280,6 +280,9 @@ protected: return 0; } +private: + void initSubSystems(const ADGameDescription *gameDesc) const; + protected: /** * Detect games in specified directory. diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 6cc0c45963..af7e91f7eb 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -25,7 +25,6 @@ #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/fs.h" #include "engines/advancedDetector.h" diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index c3ede46df2..08838a784a 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -23,7 +23,6 @@ #include "common/config-manager.h" #include "common/debug-channels.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/func.h" #include "common/system.h" diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index c8a6666046..81a29c727f 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -41,6 +41,7 @@ #include "sword25/gfx/renderobjectmanager.h" #include "common/system.h" +#include "graphics/thumbnail.h" namespace Sword25 { @@ -509,60 +510,4 @@ void RenderedImage::checkForTransparency() { } } -/** - * Scales a passed surface, creating a new surface with the result - * @param srcImage Source image to scale - * @param scaleFactor Scale amount. Must be between 0 and 1.0 (but not zero) - * @remarks Caller is responsible for freeing the returned surface - */ -Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) { - Graphics::Surface *s = new Graphics::Surface(); - s->create(xSize, ySize, srcImage.format); - - int *horizUsage = scaleLine(xSize, srcImage.w); - int *vertUsage = scaleLine(ySize, srcImage.h); - - // Loop to create scaled version - for (int yp = 0; yp < ySize; ++yp) { - const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]); - byte *destP = (byte *)s->getBasePtr(0, yp); - - for (int xp = 0; xp < xSize; ++xp) { - const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel); - for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) { - *destP++ = *tempSrcP++; - } - } - } - - // Delete arrays and return surface - delete[] horizUsage; - delete[] vertUsage; - return s; -} - -/** - * Returns an array indicating which pixels of a source image horizontally or vertically get - * included in a scaled image - */ -int *RenderedImage::scaleLine(int size, int srcSize) { - int scale = 100 * size / srcSize; - assert(scale > 0); - int *v = new int[size]; - Common::fill(v, &v[size], 0); - - int distCtr = 0; - int *destP = v; - for (int distIndex = 0; distIndex < srcSize; ++distIndex) { - distCtr += scale; - while (distCtr >= 100) { - assert(destP < &v[size]); - *destP++ = distIndex; - distCtr -= 100; - } - } - - return v; -} - } // End of namespace Sword25 diff --git a/engines/sword25/gfx/image/renderedimage.h b/engines/sword25/gfx/image/renderedimage.h index a25b258592..116f97de26 100644 --- a/engines/sword25/gfx/image/renderedimage.h +++ b/engines/sword25/gfx/image/renderedimage.h @@ -104,8 +104,6 @@ public: return true; } - static Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize); - void setIsTransparent(bool isTransparent) { _isTransparent = isTransparent; } virtual bool isSolid() const { return !_isTransparent; } @@ -119,7 +117,6 @@ private: Graphics::Surface *_backSurface; void checkForTransparency(); - static int *scaleLine(int size, int srcSize); }; } // End of namespace Sword25 diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 89a6f1b3e0..19848b002e 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -26,7 +26,6 @@ #include "common/debug.h" #include "common/debug-channels.h" #include "common/error.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/fs.h" #include "common/tokenizer.h" diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index c818101645..6825767dfd 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -48,6 +48,9 @@ bool CursorManager::isVisible() { bool CursorManager::showMouse(bool visible) { if (_cursorStack.empty()) return false; + if (_locked) { + return false; + } _cursorStack.top()->_visible = visible; @@ -225,6 +228,10 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu } } +void CursorManager::lock(bool locked) { + _locked = locked; +} + CursorManager::Cursor::Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (!format) diff --git a/graphics/cursorman.h b/graphics/cursorman.h index 66e8d1ba56..b4d8ad94ce 100644 --- a/graphics/cursorman.h +++ b/graphics/cursorman.h @@ -160,12 +160,15 @@ public: */ void replaceCursorPalette(const byte *colors, uint start, uint num); + void lock(bool locked); private: friend class Common::Singleton; // Even though this is basically the default constructor we implement it // ourselves, so it is private and thus there is no way to create this class // except from the Singleton code. - CursorManager() {} + CursorManager() { + _locked = false; + } ~CursorManager(); struct Cursor { @@ -198,6 +201,7 @@ private: }; Common::Stack _cursorStack; Common::Stack _cursorPaletteStack; + bool _locked; }; } // End of namespace Graphics diff --git a/graphics/scaler.h b/graphics/scaler.h index 1e5b796631..54d022d202 100644 --- a/graphics/scaler.h +++ b/graphics/scaler.h @@ -89,4 +89,10 @@ extern bool createThumbnailFromScreen(Graphics::Surface *surf); */ extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette); +/** + * Downscale screenshot to thumbnale size. + * + */ +extern bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in); + #endif diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 88f3cc2077..8a98263eee 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -134,7 +134,7 @@ static bool grabScreen565(Graphics::Surface *surf) { return true; } -static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) { +bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) { uint16 width = in.w; uint16 inHeight = in.h; @@ -206,7 +206,7 @@ static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) { return true; } -bool createThumbnailFromScreen(Graphics::Surface* surf) { +bool createThumbnailFromScreen(Graphics::Surface *surf) { assert(surf); Graphics::Surface screen; @@ -236,3 +236,31 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, return createThumbnail(*surf, screen); } + +// this is somewhat awkward, but createScreenShot should logically be in graphics, +// but moving other functions in this file into that namespace breaks several engines +namespace Graphics { +bool createScreenShot(Graphics::Surface &surf) { + Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); + //convert surface to 2 bytes pixel format to avoid problems with palette saving and loading + if ((screenFormat.bytesPerPixel == 1) || (screenFormat.bytesPerPixel == 2)) { + return grabScreen565(&surf); + } else { + Graphics::Surface *screen = g_system->lockScreen(); + if (!screen) { + return false; + } + surf.create(screen->w, screen->h, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); + for (uint y = 0; y < screen->h; ++y) { + for (uint x = 0; x < screen->w; ++x) { + byte r = 0, g = 0, b = 0, a = 0; + uint32 col = READ_UINT32(screen->getBasePtr(x, y)); + screenFormat.colorToARGB(col, a, r, g, b); + ((uint32 *)surf.pixels)[y * surf.w + x] = Graphics::ARGBToColor >(a, r, g, b); + } + } + g_system->unlockScreen(); + return true; + } +} +} // End of namespace Graphics diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index ddb377306d..d04c218624 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -23,6 +23,7 @@ #include "graphics/scaler.h" #include "graphics/colormasks.h" #include "common/endian.h" +#include "common/algorithm.h" #include "common/system.h" #include "common/stream.h" #include "common/textconsole.h" @@ -143,7 +144,6 @@ Graphics::Surface *loadThumbnail(Common::SeekableReadStream &in) { assert(0); } } - return to; } @@ -216,4 +216,55 @@ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) { return true; } + +/** + * Returns an array indicating which pixels of a source image horizontally or vertically get + * included in a scaled image + */ +int *scaleLine(int size, int srcSize) { + int scale = 100 * size / srcSize; + assert(scale > 0); + int *v = new int[size]; + Common::fill(v, &v[size], 0); + + int distCtr = 0; + int *destP = v; + for (int distIndex = 0; distIndex < srcSize; ++distIndex) { + distCtr += scale; + while (distCtr >= 100) { + assert(destP < &v[size]); + *destP++ = distIndex; + distCtr -= 100; + } + } + + return v; +} + +Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize) { + Graphics::Surface *s = new Graphics::Surface(); + s->create(xSize, ySize, srcImage.format); + + int *horizUsage = scaleLine(xSize, srcImage.w); + int *vertUsage = scaleLine(ySize, srcImage.h); + + // Loop to create scaled version + for (int yp = 0; yp < ySize; ++yp) { + const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]); + byte *destP = (byte *)s->getBasePtr(0, yp); + + for (int xp = 0; xp < xSize; ++xp) { + const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel); + for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) { + *destP++ = *tempSrcP++; + } + } + } + + // Delete arrays and return surface + delete[] horizUsage; + delete[] vertUsage; + return s; +} + } // End of namespace Graphics diff --git a/graphics/thumbnail.h b/graphics/thumbnail.h index 45a0fdbf07..c857809c91 100644 --- a/graphics/thumbnail.h +++ b/graphics/thumbnail.h @@ -64,6 +64,24 @@ bool saveThumbnail(Common::WriteStream &out); */ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb); +/** + * Grabs framebuffer into surface + * + * @param surf a surface + * @return false if a error occurred + */ +bool createScreenShot(Graphics::Surface &surf); + +/** + * Scales a passed surface, creating a new surface with the result + * @param srcImage Source image to scale + * @param xSize New surface width + * @param ySize New surface height + * @remarks Caller is responsible for freeing the returned surface + */ +Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize); + + } // End of namespace Graphics #endif diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp new file mode 100644 index 0000000000..94b955cb22 --- /dev/null +++ b/gui/EventRecorder.cpp @@ -0,0 +1,699 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include "gui/EventRecorder.h" + +namespace Common { +DECLARE_SINGLETON(GUI::EventRecorder); +} + +#ifdef ENABLE_EVENTRECORDER + +#include "common/debug-channels.h" +#include "backends/timer/sdl/sdl-timer.h" +#include "backends/mixer/sdl/sdl-mixer.h" +#include "common/config-manager.h" +#include "common/md5.h" +#include "gui/gui-manager.h" +#include "gui/widget.h" +#include "gui/onscreendialog.h" +#include "common/random.h" +#include "common/savefile.h" +#include "common/textconsole.h" +#include "graphics/thumbnail.h" +#include "graphics/surface.h" +#include "graphics/scaler.h" + +namespace GUI { + + +const int kMaxRecordsNames = 0x64; +const int kDefaultScreenshotPeriod = 60000; +const int kDefaultBPP = 2; + +uint32 readTime(Common::ReadStream *inFile) { + uint32 d = inFile->readByte(); + if (d == 0xff) { + d = inFile->readUint32LE(); + } + + return d; +} + +void writeTime(Common::WriteStream *outFile, uint32 d) { + //Simple RLE compression + if (d >= 0xff) { + outFile->writeByte(0xff); + outFile->writeUint32LE(d); + } else { + outFile->writeByte(d); + } +} + +EventRecorder::EventRecorder() { + _timerManager = NULL; + _recordMode = kPassthrough; + _fakeMixerManager = NULL; + _initialized = false; + _needRedraw = false; + _fastPlayback = false; + DebugMan.addDebugChannel(kDebugLevelEventRec, "EventRec", "Event recorder debug level"); +} + +EventRecorder::~EventRecorder() { + if (_timerManager != NULL) { + delete _timerManager; + } +} + +void EventRecorder::deinit() { + if (!_initialized) { + return; + } + setFileHeader(); + _needRedraw = false; + _initialized = false; + _recordMode = kPassthrough; + delete _fakeMixerManager; + _fakeMixerManager = NULL; + controlPanel->close(); + delete controlPanel; + debugC(1, kDebugLevelEventRec, "playback:action=stopplayback"); + g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); + _recordMode = kPassthrough; + _playbackFile->close(); + delete _playbackFile; + switchMixer(); + switchTimerManagers(); + DebugMan.disableDebugChannel("EventRec"); +} + +void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { + if (!_initialized) { + return; + } + if (skipRecord) { + millis = _fakeTimer; + return; + } + if (_recordMode == kRecorderPlaybackPause) { + millis = _fakeTimer; + } + uint32 millisDelay; + Common::RecorderEvent timerEvent; + switch (_recordMode) { + case kRecorderRecord: + updateSubsystems(); + millisDelay = millis - _lastMillis; + _lastMillis = millis; + _fakeTimer += millisDelay; + controlPanel->setReplayedTime(_fakeTimer); + timerEvent.recordedtype = Common::kRecorderEventTypeTimer; + timerEvent.time = _fakeTimer; + _playbackFile->writeEvent(timerEvent); + takeScreenshot(); + _timerManager->handler(); + break; + case kRecorderPlayback: + updateSubsystems(); + if (_nextEvent.recordedtype == Common::kRecorderEventTypeTimer) { + _fakeTimer = _nextEvent.time; + _nextEvent = _playbackFile->getNextEvent(); + _timerManager->handler(); + } else { + if (_nextEvent.type == Common::EVENT_RTL) { + error("playback:action=stopplayback"); + } else { + uint32 seconds = _fakeTimer / 1000; + Common::String screenTime = Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60); + error("playback:action=error reason=\"synchronization error\" time = %s", screenTime.c_str()); + } + } + millis = _fakeTimer; + controlPanel->setReplayedTime(_fakeTimer); + break; + case kRecorderPlaybackPause: + millis = _fakeTimer; + break; + default: + break; + } +} + +bool EventRecorder::processDelayMillis() { + return _fastPlayback; +} + +void EventRecorder::checkForKeyCode(const Common::Event &event) { + if ((event.type == Common::EVENT_KEYDOWN) && (event.kbd.flags & Common::KBD_CTRL) && (event.kbd.keycode == Common::KEYCODE_p) && (!event.synthetic)) { + togglePause(); + } +} + +bool EventRecorder::pollEvent(Common::Event &ev) { + if ((_recordMode != kRecorderPlayback) || !_initialized) + return false; + + if ((_nextEvent.recordedtype == Common::kRecorderEventTypeTimer) || (_nextEvent.type == Common::EVENT_INVALID)) { + return false; + } + + switch (_nextEvent.type) { + case Common::EVENT_MOUSEMOVE: + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONUP: + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + g_system->warpMouse(_nextEvent.mouse.x, _nextEvent.mouse.y); + break; + default: + break; + } + ev = _nextEvent; + _nextEvent = _playbackFile->getNextEvent(); + return true; +} + +void EventRecorder::switchFastMode() { + if (_recordMode == kRecorderPlaybackPause) { + _fastPlayback = !_fastPlayback; + } +} + +void EventRecorder::togglePause() { + RecordMode oldState; + switch (_recordMode) { + case kRecorderPlayback: + case kRecorderRecord: + oldState = _recordMode; + _recordMode = kRecorderPlaybackPause; + controlPanel->runModal(); + _recordMode = oldState; + _initialized = true; + break; + case kRecorderPlaybackPause: + controlPanel->close(); + break; + default: + break; + } +} + +void EventRecorder::RegisterEventSource() { + g_system->getEventManager()->getEventDispatcher()->registerMapper(this, false); +} + +uint32 EventRecorder::getRandomSeed(const Common::String &name) { + uint32 result = g_system->getMillis(); + if (_recordMode == kRecorderRecord) { + _playbackFile->getHeader().randomSourceRecords[name] = result; + } else if (_recordMode == kRecorderPlayback) { + result = _playbackFile->getHeader().randomSourceRecords[name]; + } + return result; +} + +Common::String EventRecorder::generateRecordFileName(const Common::String &target) { + Common::String pattern(target+".r??"); + Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern); + for (int i = 0; i < kMaxRecordsNames; ++i) { + Common::String recordName = Common::String::format("%s.r%02d", target.c_str(), i); + if (find(files.begin(), files.end(), recordName) != files.end()) { + continue; + } + return recordName; + } + return ""; +} + + +void EventRecorder::init(Common::String recordFileName, RecordMode mode) { + _fakeMixerManager = new NullSdlMixerManager(); + _fakeMixerManager->init(); + _fakeMixerManager->suspendAudio(); + _fakeTimer = 0; + _lastMillis = g_system->getMillis(); + _playbackFile = new Common::PlaybackFile(); + _lastScreenshotTime = 0; + _recordMode = mode; + _needcontinueGame = false; + if (ConfMan.hasKey("disable_display")) { + DebugMan.enableDebugChannel("EventRec"); + gDebugLevel = 1; + } + if (_recordMode == kRecorderPlayback) { + debugC(1, kDebugLevelEventRec, "playback:action=\"Load file\" filename=%s", recordFileName.c_str()); + } + g_system->getEventManager()->getEventDispatcher()->registerSource(this, false); + _screenshotPeriod = ConfMan.getInt("screenshot_period"); + if (_screenshotPeriod == 0) { + _screenshotPeriod = kDefaultScreenshotPeriod; + } + if (!openRecordFile(recordFileName)) { + deinit(); + error("playback:action=error reason=\"Record file loading error\""); + return; + } + if (_recordMode != kPassthrough) { + controlPanel = new GUI::OnScreenDialog(_recordMode == kRecorderRecord); + } + if (_recordMode == kRecorderPlayback) { + applyPlaybackSettings(); + _nextEvent = _playbackFile->getNextEvent(); + } + if (_recordMode == kRecorderRecord) { + getConfig(); + } + + switchMixer(); + switchTimerManagers(); + _needRedraw = true; + _initialized = true; +} + + +/** + * Opens or creates file depend of recording mode. + * + *@param id of recording or playing back game + *@return true in case of success, false in case of error + * + */ +bool EventRecorder::openRecordFile(const Common::String &fileName) { + bool result; + switch (_recordMode) { + case kRecorderRecord: + return _playbackFile->openWrite(fileName); + case kRecorderPlayback: + _recordMode = kPassthrough; + result = _playbackFile->openRead(fileName); + _recordMode = kRecorderPlayback; + return result; + default: + return false; + } + return true; +} + +bool EventRecorder::checkGameHash(const ADGameDescription *gameDesc) { + if ((gameDesc == NULL) && (_playbackFile->getHeader().hashRecords.size() != 0)) { + warning("Engine doesn't contain description table"); + return false; + } + for (const ADGameFileDescription *fileDesc = gameDesc->filesDescriptions; fileDesc->fileName; fileDesc++) { + if (_playbackFile->getHeader().hashRecords.find(fileDesc->fileName) == _playbackFile->getHeader().hashRecords.end()) { + warning("MD5 hash for file %s not found in record file", fileDesc->fileName); + debugC(1, kDebugLevelEventRec, "playback:action=\"Check game hash\" filename=%s filehash=%s storedhash=\"\" result=different", fileDesc->fileName, fileDesc->md5); + return false; + } + if (_playbackFile->getHeader().hashRecords[fileDesc->fileName] != fileDesc->md5) { + warning("Incorrect version of game file %s. Stored MD5 is %s. MD5 of loaded game is %s", fileDesc->fileName, _playbackFile->getHeader().hashRecords[fileDesc->fileName].c_str(), fileDesc->md5); + debugC(1, kDebugLevelEventRec, "playback:action=\"Check game hash\" filename=%s filehash=%s storedhash=%s result=different", fileDesc->fileName, fileDesc->md5, _playbackFile->getHeader().hashRecords[fileDesc->fileName].c_str()); + return false; + } + debugC(1, kDebugLevelEventRec, "playback:action=\"Check game hash\" filename=%s filehash=%s storedhash=%s result=equal", fileDesc->fileName, fileDesc->md5, _playbackFile->getHeader().hashRecords[fileDesc->fileName].c_str()); + } + return true; +} + +void EventRecorder::registerMixerManager(SdlMixerManager *mixerManager) { + _realMixerManager = mixerManager; +} + +void EventRecorder::switchMixer() { + if (_recordMode == kPassthrough) { + _realMixerManager->resumeAudio(); + } else { + _realMixerManager->suspendAudio(); + _fakeMixerManager->resumeAudio(); + } +} + +SdlMixerManager *EventRecorder::getMixerManager() { + if (_recordMode == kPassthrough) { + return _realMixerManager; + } else { + return _fakeMixerManager; + } +} + +void EventRecorder::getConfigFromDomain(Common::ConfigManager::Domain *domain) { + for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { + _playbackFile->getHeader().settingsRecords[entry->_key] = entry->_value; + } +} + +void EventRecorder::getConfig() { + getConfigFromDomain(ConfMan.getDomain(ConfMan.kApplicationDomain)); + getConfigFromDomain(ConfMan.getActiveDomain()); + _playbackFile->getHeader().settingsRecords["save_slot"] = ConfMan.get("save_slot"); +} + + +void EventRecorder::applyPlaybackSettings() { + for (Common::StringMap::iterator i = _playbackFile->getHeader().settingsRecords.begin(); i != _playbackFile->getHeader().settingsRecords.end(); ++i) { + Common::String currentValue = ConfMan.get(i->_key); + if (currentValue != i->_value) { + ConfMan.set(i->_key, i->_value, ConfMan.kTransientDomain); + debugC(1, kDebugLevelEventRec, "playback:action=\"Apply settings\" key=%s storedvalue=%s currentvalue=%s result=different", i->_key.c_str(), i->_value.c_str(), currentValue.c_str()); + } else { + debugC(1, kDebugLevelEventRec, "playback:action=\"Apply settings\" key=%s storedvalue=%s currentvalue=%s result=equal", i->_key.c_str(), i->_value.c_str(), currentValue.c_str()); + } + } + removeDifferentEntriesInDomain(ConfMan.getDomain(ConfMan.kApplicationDomain)); + removeDifferentEntriesInDomain(ConfMan.getActiveDomain()); +} + +void EventRecorder::removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain) { + for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { + if (_playbackFile->getHeader().settingsRecords.find(entry->_key) == _playbackFile->getHeader().settingsRecords.end()) { + debugC(1, kDebugLevelEventRec, "playback:action=\"Apply settings\" checksettings:key=%s storedvalue=%s currentvalue="" result=different", entry->_key.c_str(), entry->_value.c_str()); + domain->erase(entry->_key); + } + } +} + +DefaultTimerManager *EventRecorder::getTimerManager() { + return _timerManager; +} + +void EventRecorder::registerTimerManager(DefaultTimerManager *timerManager) { + _timerManager = timerManager; +} + +void EventRecorder::switchTimerManagers() { + delete _timerManager; + if (_recordMode == kPassthrough) { + _timerManager = new SdlTimerManager(); + } else { + _timerManager = new DefaultTimerManager(); + } +} + +void EventRecorder::updateSubsystems() { + if (_recordMode == kPassthrough) { + return; + } + RecordMode oldRecordMode = _recordMode; + _recordMode = kPassthrough; + _fakeMixerManager->update(); + _recordMode = oldRecordMode; +} + +Common::List EventRecorder::mapEvent(const Common::Event &ev, Common::EventSource *source) { + if ((!_initialized) && (_recordMode != kRecorderPlaybackPause)) { + return DefaultEventMapper::mapEvent(ev, source); + } + + checkForKeyCode(ev); + Common::Event evt = ev; + evt.mouse.x = evt.mouse.x * (g_system->getOverlayWidth() / g_system->getWidth()); + evt.mouse.y = evt.mouse.y * (g_system->getOverlayHeight() / g_system->getHeight()); + switch (_recordMode) { + case kRecorderPlayback: + if (ev.synthetic != true) { + return Common::List(); + } + return Common::DefaultEventMapper::mapEvent(ev, source); + break; + case kRecorderRecord: + g_gui.processEvent(evt, controlPanel); + if (((evt.type == Common::EVENT_LBUTTONDOWN) || (evt.type == Common::EVENT_LBUTTONUP) || (evt.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + return Common::List(); + } else { + Common::RecorderEvent e; + memcpy(&e, &ev, sizeof(ev)); + e.recordedtype = Common::kRecorderEventTypeNormal; + e.time = _fakeTimer; + _playbackFile->writeEvent(e); + return DefaultEventMapper::mapEvent(ev, source); + } + break; + case kRecorderPlaybackPause: { + Common::Event dialogEvent; + if (controlPanel->isEditDlgVisible()) { + dialogEvent = ev; + } else { + dialogEvent = evt; + } + g_gui.processEvent(dialogEvent, controlPanel->getActiveDlg()); + if (((dialogEvent.type == Common::EVENT_LBUTTONDOWN) || (dialogEvent.type == Common::EVENT_LBUTTONUP) || (dialogEvent.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + return Common::List(); + } + return Common::DefaultEventMapper::mapEvent(dialogEvent, source); + } + break; + default: + return Common::DefaultEventMapper::mapEvent(ev, source); + } +} + +void EventRecorder::setGameMd5(const ADGameDescription *gameDesc) { + for (const ADGameFileDescription *fileDesc = gameDesc->filesDescriptions; fileDesc->fileName; fileDesc++) { + if (fileDesc->md5 != NULL) { + _playbackFile->getHeader().hashRecords[fileDesc->fileName] = fileDesc->md5; + } + } +} + +void EventRecorder::processGameDescription(const ADGameDescription *desc) { + if (_recordMode == kRecorderRecord) { + setGameMd5(desc); + } + if ((_recordMode == kRecorderPlayback) && !checkGameHash(desc)) { + deinit(); + error("playback:action=error reason=\"\""); + } +} + +void EventRecorder::deleteRecord(const Common::String& fileName) { + g_system->getSavefileManager()->removeSavefile(fileName); +} + +void EventRecorder::takeScreenshot() { + if ((_fakeTimer - _lastScreenshotTime) > _screenshotPeriod) { + Graphics::Surface screen; + uint8 md5[16]; + if (grabScreenAndComputeMD5(screen, md5)) { + _lastScreenshotTime = _fakeTimer; + _playbackFile->saveScreenShot(screen, md5); + screen.free(); + } + } +} + +bool EventRecorder::grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5[16]) { + if (!createScreenShot(screen)) { + warning("Can't save screenshot"); + return false; + } + Common::MemoryReadStream bitmapStream((const byte*)screen.pixels, screen.w * screen.h * screen.format.bytesPerPixel); + computeStreamMD5(bitmapStream, md5); + return true; +} + +Common::SeekableReadStream *EventRecorder::processSaveStream(const Common::String &fileName) { + Common::InSaveFile *saveFile; + switch (_recordMode) { + case kRecorderPlayback: + debugC(1, kDebugLevelEventRec, "playback:action=\"Process save file\" filename=%s len=%d", fileName.c_str(), _playbackFile->getHeader().saveFiles[fileName].size); + return new Common::MemoryReadStream(_playbackFile->getHeader().saveFiles[fileName].buffer, _playbackFile->getHeader().saveFiles[fileName].size); + case kRecorderRecord: + saveFile = _realSaveManager->openForLoading(fileName); + if (saveFile != NULL) { + _playbackFile->addSaveFile(fileName, saveFile); + saveFile->seek(0); + } + return saveFile; + default: + return NULL; + break; + } +} + +Common::SaveFileManager *EventRecorder::getSaveManager(Common::SaveFileManager *realSaveManager) { + _realSaveManager = realSaveManager; + if (_recordMode != kPassthrough) { + return &_fakeSaveManager; + } else { + return realSaveManager; + } +} + +void EventRecorder::preDrawOverlayGui() { + if ((_initialized) || (_needRedraw)) { + RecordMode oldMode = _recordMode; + _recordMode = kPassthrough; + g_system->showOverlay(); + g_gui.theme()->clearAll(); + g_gui.theme()->openDialog(true, GUI::ThemeEngine::kShadingNone); + controlPanel->drawDialog(); + g_gui.theme()->finishBuffering(); + g_gui.theme()->updateScreen(); + _recordMode = oldMode; + } +} + +void EventRecorder::postDrawOverlayGui() { + if ((_initialized) || (_needRedraw)) { + RecordMode oldMode = _recordMode; + _recordMode = kPassthrough; + g_system->hideOverlay(); + _recordMode = oldMode; + } +} + +Common::StringArray EventRecorder::listSaveFiles(const Common::String &pattern) { + if (_recordMode == kRecorderPlayback) { + Common::StringArray result; + for (Common::HashMap::iterator i = _playbackFile->getHeader().saveFiles.begin(); i != _playbackFile->getHeader().saveFiles.end(); ++i) { + if (i->_key.matchString(pattern, false, true)) { + result.push_back(i->_key); + } + } + return result; + } else { + return _realSaveManager->listSavefiles(pattern); + } +} + +void EventRecorder::setFileHeader() { + if (_recordMode != kRecorderRecord) { + return; + } + TimeDate t; + const EnginePlugin *plugin = 0; + GameDescriptor desc = EngineMan.findGame(ConfMan.getActiveDomainName(), &plugin); + g_system->getTimeAndDate(t); + if (_author.empty()) { + setAuthor("Unknown Author"); + } + if (_name.empty()) { + g_eventRec.setName(Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description()); + } + _playbackFile->getHeader().author = _author; + _playbackFile->getHeader().notes = _desc; + _playbackFile->getHeader().name = _name; +} + +SDL_Surface *EventRecorder::getSurface(int width, int height) { + SDL_Surface *surface = new SDL_Surface(); + surface->format = new SDL_PixelFormat(); + surface->flags = 0; + surface->format->palette = NULL; + surface->format->BitsPerPixel = 16; + surface->format->BytesPerPixel = 2; + surface->format->Rloss = 3; + surface->format->Gloss = 2; + surface->format->Bloss = 3; + surface->format->Aloss = 8; + surface->format->Rshift = 11; + surface->format->Gshift = 5; + surface->format->Bshift = 0; + surface->format->Ashift = 0; + surface->format->Rmask = 63488; + surface->format->Gmask = 2016; + surface->format->Bmask = 31; + surface->format->Amask = 0; + surface->format->colorkey = 0; + surface->format->alpha = 255; + surface->w = width; + surface->h = height; + surface->pitch = width * 2; + surface->pixels = (char *)malloc(surface->pitch * surface->h); + surface->offset = 0; + surface->hwdata = NULL; + surface->clip_rect.x = 0; + surface->clip_rect.y = 0; + surface->clip_rect.w = width; + surface->clip_rect.h = height; + surface->unused1 = 0; + surface->locked = 0; + surface->map = NULL; + surface->format_version = 4; + surface->refcount = 1; + return surface; +} + +bool EventRecorder::switchMode() { + const Common::String gameId = ConfMan.get("gameid"); + const EnginePlugin *plugin = 0; + EngineMan.findGame(gameId, &plugin); + bool metaInfoSupport = (*plugin)->hasFeature(MetaEngine::kSavesSupportMetaInfo); + bool featuresSupport = metaInfoSupport && + g_engine->canSaveGameStateCurrently() && + (*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && + (*plugin)->hasFeature(MetaEngine::kSupportsDeleteSave); + if (!featuresSupport) { + return false; + } + + int emptySlot = 1; + SaveStateList saveList = (*plugin)->listSaves(gameId.c_str()); + for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) { + int saveSlot = x->getSaveSlot(); + if (saveSlot == 0) { + continue; + } + if (emptySlot != saveSlot) { + break; + } + emptySlot++; + } + Common::String saveName; + if (emptySlot >= 0) { + saveName = Common::String::format("Save %d", emptySlot + 1); + Common::Error status = g_engine->saveGameState(emptySlot, saveName); + if (status.getCode() == Common::kNoError) { + Common::Event eventRTL; + eventRTL.type = Common::EVENT_RTL; + g_system->getEventManager()->pushEvent(eventRTL); + } + } + ConfMan.set("record_mode", "", Common::ConfigManager::kTransientDomain); + ConfMan.setInt("save_slot", emptySlot, Common::ConfigManager::kTransientDomain); + _needcontinueGame = true; + return true; +} + +bool EventRecorder::checkForContinueGame() { + bool result = _needcontinueGame; + _needcontinueGame = false; + return result; +} + +void EventRecorder::deleteTemporarySave() { + if (_temporarySlot == -1) return; + const Common::String gameId = ConfMan.get("gameid"); + const EnginePlugin *plugin = 0; + EngineMan.findGame(gameId, &plugin); + (*plugin)->removeSaveState(gameId.c_str(), _temporarySlot); + _temporarySlot = -1; +} + +} // End of namespace GUI + +#endif // ENABLE_EVENTRECORDER + diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h new file mode 100644 index 0000000000..3e32d89232 --- /dev/null +++ b/gui/EventRecorder.h @@ -0,0 +1,293 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GUI_EVENTRECORDER_H +#define GUI_EVENTRECORDER_H + +#include "common/system.h" + +#include "common/events.h" +#include "common/savefile.h" +#include "common/singleton.h" + +#include "engines/advancedDetector.h" + +#ifdef ENABLE_EVENTRECORDER + +#include "common/mutex.h" +#include "common/array.h" +#include "common/memstream.h" +#include "backends/keymapper/keymapper.h" +#include "backends/mixer/sdl/sdl-mixer.h" +#include "common/hashmap.h" +#include "common/hash-str.h" +#include "backends/timer/sdl/sdl-timer.h" +#include "common/config-manager.h" +#include "common/recorderfile.h" +#include "backends/saves/recorder/recorder-saves.h" +#include "backends/mixer/nullmixer/nullsdl-mixer.h" +#include "backends/saves/default/default-saves.h" + + +#define g_eventRec (GUI::EventRecorder::instance()) + +namespace GUI { + class OnScreenDialog; +} + +namespace GUI { +class RandomSource; +class SeekableReadStream; +class WriteStream; + + +/** + * Our generic event recorder. + * + * TODO: Add more documentation. + */ +class EventRecorder : private Common::EventSource, public Common::Singleton, private Common::DefaultEventMapper { + friend class Common::Singleton; + EventRecorder(); + ~EventRecorder(); +public: + /** Specify operation mode of Event Recorder */ + enum RecordMode { + kPassthrough = 0, /**< kPassthrough, do nothing */ + kRecorderRecord = 1, /**< kRecorderRecord, do the recording */ + kRecorderPlayback = 2, /**< kRecorderPlayback, playback existing recording */ + kRecorderPlaybackPause = 3 /**< kRecordetPlaybackPause, interal state when user pauses the playback */ + }; + + void init(Common::String recordFileName, RecordMode mode); + void deinit(); + bool processDelayMillis(); + uint32 getRandomSeed(const Common::String &name); + void processMillis(uint32 &millis, bool skipRecord); + bool processAudio(uint32 &samples, bool paused); + void processGameDescription(const ADGameDescription *desc); + Common::SeekableReadStream *processSaveStream(const Common::String & fileName); + + /** Hooks for intercepting into GUI processing, so required events could be shoot + * or filtered out */ + void preDrawOverlayGui(); + void postDrawOverlayGui(); + + /** Set recording author + * + * @see getAuthor + */ + void setAuthor(const Common::String &author) { + _author = author; + } + + /** Set recording notes + * + * @see getNotes + */ + void setNotes(const Common::String &desc){ + _desc = desc; + } + + /** Set descriptive name of the recording + * + * @see getName + */ + void setName(const Common::String &name) { + _name = name; + } + + /** Get recording author + * + * @see getAuthor + */ + const Common::String getAuthor() { + return _author; + } + + /** Get recording notes + * + * @see setNotes + */ + const Common::String getNotes() { + return _desc; + } + + /** Get recording name + * + * @see setName + */ + const Common::String getName() { + return _name; + } + void setRedraw(bool redraw) { + _needRedraw = redraw; + } + + void registerMixerManager(SdlMixerManager *mixerManager); + void registerTimerManager(DefaultTimerManager *timerManager); + + SdlMixerManager *getMixerManager(); + DefaultTimerManager *getTimerManager(); + + void deleteRecord(const Common::String& fileName); + bool checkForContinueGame(); + + void suspendRecording() { + _savedState = _initialized; + _initialized = false; + } + + void resumeRecording() { + _initialized = _savedState; + } + + Common::StringArray listSaveFiles(const Common::String &pattern); + Common::String generateRecordFileName(const Common::String &target); + + Common::SaveFileManager *getSaveManager(Common::SaveFileManager *realSaveManager); + SDL_Surface *getSurface(int width, int height); + void RegisterEventSource(); + + /** Retrieve game screenshot and compute its checksum for comparison */ + bool grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5[16]); + + void updateSubsystems(); + bool switchMode(); + void switchFastMode(); + +private: + virtual Common::List mapEvent(const Common::Event &ev, Common::EventSource *source); + bool notifyPoll(); + bool pollEvent(Common::Event &ev); + bool _initialized; + volatile uint32 _fakeTimer; + bool _savedState; + bool _needcontinueGame; + int _temporarySlot; + Common::String _author; + Common::String _desc; + Common::String _name; + + Common::SaveFileManager *_realSaveManager; + SdlMixerManager *_realMixerManager; + DefaultTimerManager *_timerManager; + RecorderSaveFileManager _fakeSaveManager; + NullSdlMixerManager *_fakeMixerManager; + GUI::OnScreenDialog *controlPanel; + Common::RecorderEvent _nextEvent; + + void setFileHeader(); + void setGameMd5(const ADGameDescription *gameDesc); + void getConfig(); + void getConfigFromDomain(Common::ConfigManager::Domain *domain); + void removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain); + void applyPlaybackSettings(); + + void switchMixer(); + void switchTimerManagers(); + + void togglePause(); + + void takeScreenshot(); + + bool openRecordFile(const Common::String &fileName); + + bool checkGameHash(const ADGameDescription *desc); + + void checkForKeyCode(const Common::Event &event); + bool allowMapping() const { return false; } + + volatile uint32 _lastMillis; + uint32 _lastScreenshotTime; + uint32 _screenshotPeriod; + Common::PlaybackFile *_playbackFile; + + void saveScreenShot(); + void checkRecordedMD5(); + void deleteTemporarySave(); + volatile RecordMode _recordMode; + Common::String _recordFileName; + bool _fastPlayback; + bool _needRedraw; +}; + +} // End of namespace GUI + +#else + +#ifdef SDL_BACKEND +#include "backends/timer/default/default-timer.h" +#include "backends/mixer/sdl/sdl-mixer.h" +#endif + +#define g_eventRec (GUI::EventRecorder::instance()) + +namespace GUI { + +class EventRecorder : private Common::EventSource, public Common::Singleton, private Common::DefaultEventMapper { + friend class Common::Singleton; + + public: + EventRecorder() { +#ifdef SDL_BACKEND + _timerManager = NULL; + _realMixerManager = NULL; +#endif + } + ~EventRecorder() {} + + bool pollEvent(Common::Event &ev) { return false; } + void RegisterEventSource() {} + void deinit() {} + void suspendRecording() {} + void resumeRecording() {} + void preDrawOverlayGui() {} + void postDrawOverlayGui() {} + void processGameDescription(const ADGameDescription *desc) {} + void updateSubsystems() {} + uint32 getRandomSeed(const Common::String &name) { return g_system->getMillis(); } + Common::SaveFileManager *getSaveManager(Common::SaveFileManager *realSaveManager) { return realSaveManager; } + +#ifdef SDL_BACKEND + private: + DefaultTimerManager *_timerManager; + SdlMixerManager *_realMixerManager; + + public: + DefaultTimerManager *getTimerManager() { return _timerManager; } + void registerTimerManager(DefaultTimerManager *timerManager) { _timerManager = timerManager; } + + SdlMixerManager *getMixerManager() { return _realMixerManager; } + void registerMixerManager(SdlMixerManager *mixerManager) { _realMixerManager = mixerManager; } + + void processMillis(uint32 &millis, bool skipRecord) {} + bool processDelayMillis() { return false; } +#endif + +}; + +} // namespace GUI + +#endif // ENABLE_EVENTRECORDER + +#endif diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index e2fa2580f5..3ce043cb39 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -50,6 +50,14 @@ const char * const ThemeEngine::kImageEraser = "eraser.bmp"; const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp"; const char * const ThemeEngine::kImageList = "list.bmp"; const char * const ThemeEngine::kImageGrid = "grid.bmp"; +const char * const ThemeEngine::kImageStopbtn = "stopbtn.bmp"; +const char * const ThemeEngine::kImageEditbtn = "editbtn.bmp"; +const char * const ThemeEngine::kImageSwitchModebtn = "switchbtn.bmp"; +const char * const ThemeEngine::kImageFastReplaybtn = "fastreplay.bmp"; +const char * const ThemeEngine::kImageStopSmallbtn = "stopbtn_small.bmp"; +const char * const ThemeEngine::kImageEditSmallbtn = "editbtn_small.bmp"; +const char * const ThemeEngine::kImageSwitchModeSmallbtn = "switchbtn_small.bmp"; +const char * const ThemeEngine::kImageFastReplaySmallbtn = "fastreplay_small.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; @@ -465,11 +473,7 @@ void ThemeEngine::enable() { if (_enabled) return; - if (_useCursor) { - CursorMan.pushCursorPalette(_cursorPal, 0, _cursorPalSize); - CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); - CursorMan.showMouse(true); - } + showCursor(); _system->showOverlay(); clearAll(); @@ -482,10 +486,8 @@ void ThemeEngine::disable() { _system->hideOverlay(); - if (_useCursor) { - CursorMan.popCursorPalette(); - CursorMan.popCursor(); - } + hideCursor(); + _enabled = false; } @@ -1787,5 +1789,20 @@ Common::String ThemeEngine::getThemeId(const Common::String &filename) { } } +void ThemeEngine::showCursor() { + if (_useCursor) { + CursorMan.pushCursorPalette(_cursorPal, 0, _cursorPalSize); + CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); + CursorMan.showMouse(true); + } +} + +void ThemeEngine::hideCursor() { + if (_useCursor) { + CursorMan.popCursorPalette(); + CursorMan.popCursor(); + } +} + } // End of namespace GUI. diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 6e5fd291b7..160ceb3259 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -234,6 +234,14 @@ public: static const char *const kImageDelbtn; ///< Delete characters in the predictive dialog static const char *const kImageList; ///< List image used in save/load chooser selection static const char *const kImageGrid; ///< Grid image used in save/load chooser selection + static const char *const kImageStopbtn; ///< Stop recording button in recorder onscreen dialog + static const char *const kImageEditbtn; ///< Edit recording metadata in recorder onscreen dialog + static const char *const kImageSwitchModebtn; ///< Switch mode button in recorder onscreen dialog + static const char *const kImageFastReplaybtn; ///< Fast playback mode button in recorder onscreen dialog + static const char *const kImageStopSmallbtn; ///< Stop recording button in recorder onscreen dialog (for 320xY) + static const char *const kImageEditSmallbtn; ///< Edit recording metadata in recorder onscreen dialog (for 320xY) + static const char *const kImageSwitchModeSmallbtn; ///< Switch mode button in recorder onscreen dialog (for 320xY) + static const char *const kImageFastReplaySmallbtn; ///< Fast playback mode button in recorder onscreen dialog (for 320xY) /** * Graphics mode enumeration. @@ -275,8 +283,13 @@ public: void refresh(); void enable(); + + void showCursor(); + void hideCursor(); + void disable(); + /** * Query the set up pixel format. */ diff --git a/gui/dialog.h b/gui/dialog.h index 1773c6633e..d269a2f645 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -37,6 +37,8 @@ struct Event; namespace GUI { +class EventRecorder; + class Widget; // Some "common" commands sent to handleCommand() @@ -47,6 +49,7 @@ enum { class Dialog : public GuiObject { friend class GuiManager; + friend class EventRecorder; friend class Tooltip; protected: Widget *_mouseWidget; diff --git a/gui/editrecorddialog.cpp b/gui/editrecorddialog.cpp new file mode 100644 index 0000000000..a6a7a2560e --- /dev/null +++ b/gui/editrecorddialog.cpp @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "editrecorddialog.h" +#include "gui/widgets/edittext.h" +#include "common/translation.h" + + +namespace GUI { + +const Common::String EditRecordDialog::getAuthor() { + return _authorEdit->getEditString(); +} + +void EditRecordDialog::setAuthor(const Common::String &author) { + _authorEdit->setEditString(author); +} + +const Common::String EditRecordDialog::getNotes() { + return _notesEdit->getEditString(); +} + +void EditRecordDialog::setNotes(const Common::String &desc) { + _notesEdit->setEditString(desc); +} + +const Common::String EditRecordDialog::getName() { + return _nameEdit->getEditString(); +} + +void EditRecordDialog::setName(const Common::String &name) { + _nameEdit->setEditString(name); +} + +EditRecordDialog::~EditRecordDialog() { +} + +EditRecordDialog::EditRecordDialog(const Common::String author, const Common::String name, const Common::String notes) : Dialog("EditRecordDialog") { + new StaticTextWidget(this,"EditRecordDialog.AuthorLabel",_("Author:")); + new StaticTextWidget(this,"EditRecordDialog.NameLabel",_("Name:")); + new StaticTextWidget(this,"EditRecordDialog.NotesLabel",_("Notes:")); + _authorEdit = new EditTextWidget(this, "EditRecordDialog.AuthorEdit",""); + _notesEdit = new EditTextWidget(this, "EditRecordDialog.NotesEdit",""); + _nameEdit = new EditTextWidget(this, "EditRecordDialog.NameEdit",""); + _authorEdit->setEditString(author); + _notesEdit->setEditString(notes); + _nameEdit->setEditString(name); + new GUI::ButtonWidget(this, "EditRecordDialog.Cancel", _("Cancel"), 0, kCloseCmd); + new GUI::ButtonWidget(this, "EditRecordDialog.OK", _("Ok"), 0, kOKCmd); +} + +void EditRecordDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { + switch(cmd) { + case kCloseCmd: + setResult(kCloseCmd); + close(); + break; + case kOKCmd: + setResult(kOKCmd); + close(); + break; + default: + Dialog::handleCommand(sender, cmd, data); + break; + } +} + +} diff --git a/gui/editrecorddialog.h b/gui/editrecorddialog.h new file mode 100644 index 0000000000..c8da4521ca --- /dev/null +++ b/gui/editrecorddialog.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GUI_EDITRECORDDIALOG_H +#define GUI_EDITRECORDDIALOG_H + +#include "gui/dialog.h" + +namespace GUI { + +class EditTextWidget; +class StaticTextWidget; + +class EditRecordDialog : public Dialog { +private: + EditTextWidget *_notesEdit; + EditTextWidget *_nameEdit; + EditTextWidget *_authorEdit; + EditRecordDialog() : Dialog("EditRecordDialog") {}; +public: + EditRecordDialog(const Common::String author, const Common::String name, const Common::String notes); + ~EditRecordDialog(); + + const Common::String getAuthor(); + const Common::String getNotes(); + const Common::String getName(); + + void setAuthor(const Common::String &author); + void setNotes(const Common::String &desc); + void setName(const Common::String &name); + + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); +}; + +}// End of namespace GUI + +#endif diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index a0ef4216aa..78b40a46ce 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -27,6 +27,7 @@ #include "common/rect.h" #include "common/textconsole.h" #include "common/translation.h" +#include "gui/EventRecorder.h" #include "backends/keymapper/keymapper.h" @@ -253,12 +254,13 @@ Dialog *GuiManager::getTopDialog() const { void GuiManager::runLoop() { Dialog * const activeDialog = getTopDialog(); bool didSaveState = false; - int button; - uint32 time; if (activeDialog == 0) return; + // Suspend recording while GUI is shown + g_eventRec.suspendRecording(); + if (!_stateIsSaved) { saveState(); _theme->enable(); @@ -296,10 +298,10 @@ void GuiManager::runLoop() { // _theme->updateScreen(); // _system->updateScreen(); - if (lastRedraw + waitTime < _system->getMillis()) { + if (lastRedraw + waitTime < _system->getMillis(true)) { _theme->updateScreen(); _system->updateScreen(); - lastRedraw = _system->getMillis(); + lastRedraw = _system->getMillis(true); } Common::Event event; @@ -314,72 +316,21 @@ void GuiManager::runLoop() { if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED) continue; - Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); - - switch (event.type) { - case Common::EVENT_KEYDOWN: - activeDialog->handleKeyDown(event.kbd); - break; - case Common::EVENT_KEYUP: - activeDialog->handleKeyUp(event.kbd); - break; - case Common::EVENT_MOUSEMOVE: - activeDialog->handleMouseMoved(mouse.x, mouse.y, 0); - - if (mouse.x != _lastMousePosition.x || mouse.y != _lastMousePosition.y) { - _lastMousePosition.x = mouse.x; - _lastMousePosition.y = mouse.y; - _lastMousePosition.time = _system->getMillis(); - } + processEvent(event, activeDialog); + if (event.type == Common::EVENT_MOUSEMOVE) { tooltipCheck = true; - break; - // We don't distinguish between mousebuttons (for now at least) - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_RBUTTONDOWN: - button = (event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2); - time = _system->getMillis(); - if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay) - && ABS(_lastClick.x - event.mouse.x) < 3 - && ABS(_lastClick.y - event.mouse.y) < 3) { - _lastClick.count++; - } else { - _lastClick.x = event.mouse.x; - _lastClick.y = event.mouse.y; - _lastClick.count = 1; - } - _lastClick.time = time; - activeDialog->handleMouseDown(mouse.x, mouse.y, button, _lastClick.count); - break; - case Common::EVENT_LBUTTONUP: - case Common::EVENT_RBUTTONUP: - button = (event.type == Common::EVENT_LBUTTONUP ? 1 : 2); - activeDialog->handleMouseUp(mouse.x, mouse.y, button, _lastClick.count); - break; - case Common::EVENT_WHEELUP: - activeDialog->handleMouseWheel(mouse.x, mouse.y, -1); - break; - case Common::EVENT_WHEELDOWN: - activeDialog->handleMouseWheel(mouse.x, mouse.y, 1); - break; - case Common::EVENT_SCREEN_CHANGED: - screenChange(); - break; - default: -#ifdef ENABLE_KEYMAPPER - activeDialog->handleOtherEvent(event); -#endif - break; } - if (lastRedraw + waitTime < _system->getMillis()) { + + if (lastRedraw + waitTime < _system->getMillis(true)) { _theme->updateScreen(); _system->updateScreen(); - lastRedraw = _system->getMillis(); + lastRedraw = _system->getMillis(true); } } - if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) { + if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis(true)) { Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y); if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { Tooltip *tooltip = new Tooltip(); @@ -409,6 +360,9 @@ void GuiManager::runLoop() { restoreState(); _useStdCursor = false; } + + // Resume recording once GUI is shown + g_eventRec.resumeRecording(); } #pragma mark - @@ -492,7 +446,7 @@ void GuiManager::setupCursor() { // very much. We could plug in a different cursor here if we like to. void GuiManager::animateCursor() { - int time = _system->getMillis(); + int time = _system->getMillis(true); if (time > _cursorAnimateTimer + kCursorAnimateDelay) { for (int i = 0; i < 15; i++) { if ((i < 6) || (i > 8)) { @@ -537,4 +491,64 @@ void GuiManager::screenChange() { _system->updateScreen(); } +void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDialog) { + int button; + uint32 time; + Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); + switch (event.type) { + case Common::EVENT_KEYDOWN: + activeDialog->handleKeyDown(event.kbd); + break; + case Common::EVENT_KEYUP: + activeDialog->handleKeyUp(event.kbd); + break; + case Common::EVENT_MOUSEMOVE: + activeDialog->handleMouseMoved(mouse.x, mouse.y, 0); + + if (mouse.x != _lastMousePosition.x || mouse.y != _lastMousePosition.y) { + _lastMousePosition.x = mouse.x; + _lastMousePosition.y = mouse.y; + _lastMousePosition.time = _system->getMillis(true); + } + + break; + // We don't distinguish between mousebuttons (for now at least) + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + button = (event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2); + time = _system->getMillis(true); + if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay) + && ABS(_lastClick.x - event.mouse.x) < 3 + && ABS(_lastClick.y - event.mouse.y) < 3) { + _lastClick.count++; + } else { + _lastClick.x = event.mouse.x; + _lastClick.y = event.mouse.y; + _lastClick.count = 1; + } + _lastClick.time = time; + activeDialog->handleMouseDown(mouse.x, mouse.y, button, _lastClick.count); + break; + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONUP: + button = (event.type == Common::EVENT_LBUTTONUP ? 1 : 2); + activeDialog->handleMouseUp(mouse.x, mouse.y, button, _lastClick.count); + break; + case Common::EVENT_WHEELUP: + activeDialog->handleMouseWheel(mouse.x, mouse.y, -1); + break; + case Common::EVENT_WHEELDOWN: + activeDialog->handleMouseWheel(mouse.x, mouse.y, 1); + break; + case Common::EVENT_SCREEN_CHANGED: + screenChange(); + break; + default: + #ifdef ENABLE_KEYMAPPER + activeDialog->handleOtherEvent(event); + #endif + break; + } +} + } // End of namespace GUI diff --git a/gui/gui-manager.h b/gui/gui-manager.h index 49542fd001..b52d91ba08 100644 --- a/gui/gui-manager.h +++ b/gui/gui-manager.h @@ -35,6 +35,10 @@ namespace Graphics { class Font; } +namespace Common { + struct Event; +} + namespace GUI { class Dialog; @@ -67,6 +71,8 @@ public: // until no dialogs are active anymore. void runLoop(); + void processEvent(const Common::Event &event, Dialog *const activeDialog); + bool isActive() const { return ! _dialogStack.empty(); } bool loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled, bool force = false); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 4e35b54db8..77d4cce794 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -37,6 +37,11 @@ #include "gui/message.h" #include "gui/gui-manager.h" #include "gui/options.h" +#ifdef ENABLE_EVENTRECORDER +#include "gui/onscreendialog.h" +#include "gui/recorderdialog.h" +#include "gui/EventRecorder.h" +#endif #include "gui/saveload.h" #include "gui/widgets/edittext.h" #include "gui/widgets/list.h" @@ -596,7 +601,6 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat LauncherDialog::LauncherDialog() : Dialog(0, 0, 320, 200) { _backgroundType = GUI::ThemeEngine::kDialogBackgroundMain; - const int screenW = g_system->getOverlayWidth(); const int screenH = g_system->getOverlayHeight(); @@ -779,10 +783,9 @@ void LauncherDialog::updateListing() { } void LauncherDialog::addGame() { - int modifiers = g_system->getEventManager()->getModifierState(); #ifndef DISABLE_MASS_ADD - const bool massAdd = (modifiers & Common::KBD_SHIFT) != 0; + const bool massAdd = checkModifier(Common::KBD_SHIFT); if (massAdd) { MessageDialog alert(_("Do you really want to run the mass game detector? " @@ -975,6 +978,49 @@ void LauncherDialog::editGame(int item) { } } +void LauncherDialog::loadGameButtonPressed(int item) { +#ifdef ENABLE_EVENTRECORDER + const bool shiftPressed = checkModifier(Common::KBD_SHIFT); + if (shiftPressed) { + recordGame(item); + } else { + loadGame(item); + } + updateButtons(); +#else + loadGame(item); +#endif +} + +#ifdef ENABLE_EVENTRECORDER +void LauncherDialog::recordGame(int item) { + RecorderDialog recorderDialog; + MessageDialog alert(_("Do you want to load savegame?"), + _("Yes"), _("No")); + switch(recorderDialog.runModal(_domains[item])) { + case RecorderDialog::kRecordDialogClose: + break; + case RecorderDialog::kRecordDialogPlayback: + ConfMan.setActiveDomain(_domains[item]); + close(); + ConfMan.set("record_mode", "playback", ConfigManager::kTransientDomain); + ConfMan.set("record_file_name", recorderDialog.getFileName(), ConfigManager::kTransientDomain); + break; + case RecorderDialog::kRecordDialogRecord: + ConfMan.setActiveDomain(_domains[item]); + if (alert.runModal() == GUI::kMessageOK) { + loadGame(item); + } + close(); + g_eventRec.setAuthor(recorderDialog._author); + g_eventRec.setName(recorderDialog._name); + g_eventRec.setNotes(recorderDialog._notes); + ConfMan.set("record_mode", "record", ConfigManager::kTransientDomain); + break; + } +} +#endif + void LauncherDialog::loadGame(int item) { String gameId = ConfMan.get("gameid", _domains[item]); if (gameId.empty()) @@ -1039,7 +1085,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat editGame(item); break; case kLoadGameCmd: - loadGame(item); + loadGameButtonPressed(item); break; case kOptionsCmd: { GlobalOptionsDialog options; @@ -1109,20 +1155,28 @@ void LauncherDialog::updateButtons() { _loadButton->setEnabled(en); _loadButton->draw(); } + switchButtonsText(_addButton, "~A~dd Game...", "Mass Add..."); +#ifdef ENABLE_EVENTRECORDER + switchButtonsText(_loadButton, "~L~oad...", "Record..."); +#endif +} - // Update the label of the "Add" button depending on whether shift is pressed or not - int modifiers = g_system->getEventManager()->getModifierState(); - const bool massAdd = (modifiers & Common::KBD_SHIFT) != 0; +// Update the label of the button depending on whether shift is pressed or not +void LauncherDialog::switchButtonsText(ButtonWidget *button, const char *normalText, const char *shiftedText) { + const bool shiftPressed = checkModifier(Common::KBD_SHIFT); const bool lowRes = g_system->getOverlayWidth() <= 320; - const char *newAddButtonLabel = massAdd - ? (lowRes ? _c("Mass Add...", "lowres") : _("Mass Add...")) - : (lowRes ? _c("~A~dd Game...", "lowres") : _("~A~dd Game...")); + const char *newAddButtonLabel = shiftPressed + ? (lowRes ? _c(shiftedText, "lowres") : _(shiftedText)) + : (lowRes ? _c(normalText, "lowres") : _(normalText)); - if (_addButton->getLabel() != newAddButtonLabel) - _addButton->setLabel(newAddButtonLabel); + if (button->getLabel() != newAddButtonLabel) + button->setLabel(newAddButtonLabel); } + + + void LauncherDialog::reflowLayout() { #ifndef DISABLE_FANCY_THEMES if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) { @@ -1186,4 +1240,9 @@ void LauncherDialog::reflowLayout() { Dialog::reflowLayout(); } +bool LauncherDialog::checkModifier(int checkedModifier) { + int modifiers = g_system->getEventManager()->getModifierState(); + return (modifiers & checkedModifier) != 0; +} + } // End of namespace GUI diff --git a/gui/launcher.h b/gui/launcher.h index fc0484350a..2ab47be98d 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -56,7 +56,7 @@ protected: ListWidget *_list; ButtonWidget *_addButton; Widget *_startButton; - Widget *_loadButton; + ButtonWidget *_loadButton; Widget *_editButton; Widget *_removeButton; #ifndef DISABLE_FANCY_THEMES @@ -80,6 +80,7 @@ protected: void updateListing(); void updateButtons(); + void switchButtonsText(ButtonWidget *button, const char *normalText, const char *shiftedText); void open(); void close(); @@ -99,6 +100,16 @@ protected: */ void editGame(int item); + /** + * Facade for "Load..."/"Record..." buttons. + */ + void loadGameButtonPressed(int item); + + /** + * Handle "Record..." button. + */ + void recordGame(int item); + /** * Handle "Load..." button. */ @@ -111,6 +122,8 @@ protected: * @target name of target to select */ void selectTarget(const String &target); +private: + bool checkModifier(int modifier); }; } // End of namespace GUI diff --git a/gui/module.mk b/gui/module.mk index bda3c88cd5..338e43c6a4 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ debugger.o \ dialog.o \ error.o \ + EventRecorder.o \ gui-manager.o \ launcher.o \ massadd.o \ @@ -38,6 +39,13 @@ MODULE_OBJS += \ browser.o endif +ifdef ENABLE_EVENTRECORDER +MODULE_OBJS += \ + editrecorddialog.o \ + onscreendialog.o \ + recorderdialog.o +endif + ifdef USE_FLUIDSYNTH MODULE_OBJS += \ fluidsynth-dialog.o diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp new file mode 100644 index 0000000000..efe8038e68 --- /dev/null +++ b/gui/onscreendialog.cpp @@ -0,0 +1,231 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/system.h" + +#include "gui/gui-manager.h" + +#include "gui/EventRecorder.h" + +#include "common/events.h" +#include "common/rect.h" +#include "common/translation.h" + +#include "graphics/cursorman.h" + +#include "gui/editrecorddialog.h" +#include "gui/ThemeEval.h" + +#include "gui/onscreendialog.h" + +namespace GUI { + +bool OnScreenDialog::isVisible() const { + return true; +} + +enum { + kStopCmd = 'STOP', + kEditCmd = 'EDIT', + kSwitchModeCmd = 'MODE', + kFastModeCmd = 'FAST' +}; + +void OnScreenDialog::reflowLayout() { + GuiObject::reflowLayout(); +} + +void OnScreenDialog::releaseFocus() { +} + +OnScreenDialog::OnScreenDialog(bool isRecord) : Dialog("OnScreenDialog") { + _x = _y = 0; + +#ifndef DISABLE_FANCY_THEMES + if (g_gui.xmlEval()->getVar("Globals.OnScreenDialog.ShowPics") == 1 && g_gui.theme()->supportsImages()) { + GUI::PicButtonWidget *btn; + btn = new PicButtonWidget(this, "OnScreenDialog.StopButton", 0, kStopCmd, 0); + btn->useThemeTransparency(true); + + if (g_system->getOverlayWidth() > 320) + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageStopbtn)); + else + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageStopSmallbtn)); + + if (isRecord) { + btn = new PicButtonWidget(this, "OnScreenDialog.EditButton", 0, kEditCmd, 0); + btn->useThemeTransparency(true); + + if (g_system->getOverlayWidth() > 320) + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEditbtn)); + else + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEditSmallbtn)); + } else { + btn = new PicButtonWidget(this, "OnScreenDialog.SwitchModeButton", 0, kSwitchModeCmd, 0); + btn->useThemeTransparency(true); + if (g_system->getOverlayWidth() > 320) + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSwitchModebtn)); + else + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSwitchModeSmallbtn)); + + btn = new PicButtonWidget(this, "OnScreenDialog.FastReplayButton", 0, kFastModeCmd, 0); + btn->useThemeTransparency(true); + if (g_system->getOverlayWidth() > 320) + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageFastReplaybtn)); + else + btn->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageFastReplaySmallbtn)); + } + } else +#endif + { + GUI::ButtonWidget *btn; + if (g_system->getOverlayWidth() > 320) + btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[ ]", _("Stop"), kStopCmd); + else + btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[]", _("Stop"), kStopCmd); + + if (isRecord) { + btn = new ButtonWidget(this, "OnScreenDialog.EditButton", "E", _("Edit record description"), kEditCmd); + } else { + btn = new ButtonWidget(this, "OnScreenDialog.SwitchModeButton", "G", _("Switch to Game"), kSwitchModeCmd); + + btn = new ButtonWidget(this, "OnScreenDialog.FastReplayButton", ">>", _("Fast replay"), kFastModeCmd); + } + } + + + text = new GUI::StaticTextWidget(this, "OnScreenDialog.TimeLabel", "00:00:00"); + _enableDrag = false; + _mouseOver = false; + _editDlgShown = false; +} + +void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + Common::Event eventRTL; + switch (cmd) { + case kStopCmd: + eventRTL.type = Common::EVENT_RTL; + g_system->getEventManager()->pushEvent(eventRTL); + close(); + break; + case kEditCmd: + dlg = new EditRecordDialog(g_eventRec.getAuthor(), g_eventRec.getName(), g_eventRec.getNotes()); + CursorMan.lock(false); + g_eventRec.setRedraw(false); + g_system->showOverlay(); + _editDlgShown = true; + dlg->runModal(); + _editDlgShown = false; + g_system->hideOverlay(); + g_eventRec.setRedraw(true); + CursorMan.lock(true); + g_eventRec.setAuthor(((EditRecordDialog *)dlg)->getAuthor()); + g_eventRec.setName(((EditRecordDialog *)dlg)->getName()); + g_eventRec.setNotes(((EditRecordDialog *)dlg)->getNotes()); + delete dlg; + break; + case kSwitchModeCmd: + if (g_eventRec.switchMode()) { + close(); + } + break; + case kFastModeCmd: + g_eventRec.switchFastMode(); + break; + } +} + +void OnScreenDialog::setReplayedTime(uint32 newTime) { + if (newTime - lastTime > 1000) { + uint32 seconds = newTime / 1000; + text->setLabel(Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60)); + lastTime = newTime; + } +} + +OnScreenDialog::~OnScreenDialog() { +} + +void OnScreenDialog::handleMouseMoved(int x, int y, int button) { + if (_enableDrag) { + _x = _x + x - _dragPoint.x; + _y = _y + y - _dragPoint.y; + } + Dialog::handleMouseMoved(x, y, button); + if (isMouseOver(x, y)) { + if (_mouseOver == false) { + g_gui.theme()->showCursor(); + CursorMan.lock(true); + } + _mouseOver = true; + } else { + if (_mouseOver == true) { + CursorMan.lock(false); + g_gui.theme()->hideCursor(); + } + _mouseOver = false; + } +} + +void OnScreenDialog::handleMouseDown(int x, int y, int button, int clickCount) { + if (isMouseOver(x, y)) { + _dragPoint.x = x; + _dragPoint.y = y; + _enableDrag = true; + } + Dialog::handleMouseDown(x, y, button, clickCount); +} + +void OnScreenDialog::handleMouseUp(int x, int y, int button, int clickCount) { + if (isMouseOver(x, y)) { + + } + _enableDrag = false; + Dialog::handleMouseUp(x, y, button, clickCount); +} + +bool OnScreenDialog::isMouseOver(int x, int y) { + return (x >= 0 && x < _w && y >= 0 && y < _h); +} + +bool OnScreenDialog::isMouseOver() { + return _mouseOver; +} + +void OnScreenDialog::close() { + CursorMan.lock(false); + Dialog::close(); +} + +Dialog *OnScreenDialog::getActiveDlg() { + if (_editDlgShown) { + return dlg; + } else { + return this; + } +} + +bool OnScreenDialog::isEditDlgVisible() { + return _editDlgShown; +} + +} diff --git a/gui/onscreendialog.h b/gui/onscreendialog.h new file mode 100644 index 0000000000..4f3839acb6 --- /dev/null +++ b/gui/onscreendialog.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GUI_ONSCREENDIALOG_H +#define GUI_ONSCREENDIALOG_H + +#include "gui/dialog.h" +#include "gui/widget.h" + +namespace GUI { + +class OnScreenDialog : public Dialog { +private: + uint32 lastTime; + bool _enableDrag; + bool _mouseOver; + bool _editDlgShown; + Common::Point _dragPoint; + GUI::StaticTextWidget *text; + Dialog *dlg; + bool isMouseOver(int x, int y); +public: + OnScreenDialog(bool recordingMode); + ~OnScreenDialog(); + virtual void close(); + virtual bool isVisible() const; + virtual void reflowLayout(); + + void setReplayedTime(uint32 newTime); + + virtual void handleMouseMoved(int x, int y, int button); + virtual void handleMouseDown(int x, int y, int button, int clickCount); + virtual void handleMouseUp(int x, int y, int button, int clickCount); + void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + + bool isMouseOver(); + bool isEditDlgVisible(); + Dialog *getActiveDlg(); +protected: + virtual void releaseFocus(); +}; + +} // End of namespace GUI + +#endif diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp new file mode 100644 index 0000000000..55f342d4a1 --- /dev/null +++ b/gui/recorderdialog.cpp @@ -0,0 +1,291 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "common/algorithm.h" +#include "common/bufferedstream.h" +#include "common/savefile.h" +#include "common/system.h" +#include "graphics/colormasks.h" +#include "graphics/palette.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" +#include "common/translation.h" +#include "gui/widgets/list.h" +#include "gui/editrecorddialog.h" +#include "gui/EventRecorder.h" +#include "gui/message.h" +#include "gui/saveload.h" +#include "common/system.h" +#include "gui/ThemeEval.h" +#include "gui/gui-manager.h" +#include "recorderdialog.h" + +#define MAX_RECORDS_NAMES 0xFF + +namespace GUI { + +enum { + kRecordCmd = 'RCRD', + kPlaybackCmd = 'PBCK', + kDeleteCmd = 'DEL ', + kNextScreenshotCmd = 'NEXT', + kPrevScreenshotCmd = 'PREV', + kEditRecordCmd = 'EDIT' +}; + +RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentScreenshot(0) { + _backgroundType = ThemeEngine::kDialogBackgroundSpecial; + + new StaticTextWidget(this, "SaveLoadChooser.Title", _("Recorder or Playback Gameplay")); + + _list = new GUI::ListWidget(this, "RecorderDialog.List"); + _list->setNumberingMode(GUI::kListNumberingOff); + + _deleteButton = new GUI::ButtonWidget(this, "RecorderDialog.Delete", _("Delete"), 0, kDeleteCmd); + new GUI::ButtonWidget(this, "RecorderDialog.Cancel", _("Cancel"), 0, kCloseCmd); + new GUI::ButtonWidget(this, "RecorderDialog.Record", _("Record"), 0, kRecordCmd); + _playbackButton = new GUI::ButtonWidget(this, "RecorderDialog.Playback", _("Playback"), 0, kPlaybackCmd); + + _editButton = new GUI::ButtonWidget(this, "RecorderDialog.Edit", _("Edit"), 0, kEditRecordCmd); + + _editButton->setEnabled(false); + _deleteButton->setEnabled(false); + _playbackButton->setEnabled(false); + + _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); + _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); + if (g_gui.xmlEval()->getVar("Globals.RecorderDialog.ExtInfo.Visible") == 1) { + new GUI::ButtonWidget(this,"RecorderDialog.NextScreenShotButton", "<", 0, kPrevScreenshotCmd); + new GUI::ButtonWidget(this, "RecorderDialog.PreviousScreenShotButton", ">", 0, kNextScreenshotCmd); + _currentScreenshotText = new StaticTextWidget(this, "RecorderDialog.currentScreenshot", "0/0"); + _authorText = new StaticTextWidget(this, "RecorderDialog.Author", _("Author: ")); + _notesText = new StaticTextWidget(this, "RecorderDialog.Notes", _("Notes: ")); + } + if (_gfxWidget) + _gfxWidget->setGfx(0); +} + + +void RecorderDialog::reflowLayout() { + if (g_gui.xmlEval()->getVar("Globals.RecorderDialog.ExtInfo.Visible") == 1) { + int16 x, y; + uint16 w, h; + + if (!g_gui.xmlEval()->getWidgetData("RecorderDialog.Thumbnail", x, y, w, h)) { + error("Error when loading position data for Recorder Thumbnails"); + } + + int thumbW = kThumbnailWidth; + int thumbH = kThumbnailHeight2; + int thumbX = x + (w >> 1) - (thumbW >> 1); + int thumbY = y + kLineHeight; + + _container->resize(x, y, w, h); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + + _container->setVisible(true); + _gfxWidget->setVisible(true); + updateSelection(false); + } else { + _container->setVisible(false); + _gfxWidget->setVisible(false); + } + Dialog::reflowLayout(); +} + + + +void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { + switch(cmd) { + case kEditRecordCmd: { + if (_list->getSelected() >= 0) { + EditRecordDialog editDlg(_fileHeaders[_list->getSelected()].author, _fileHeaders[_list->getSelected()].name, _fileHeaders[_list->getSelected()].notes); + if (editDlg.runModal() != kOKCmd) { + return; + } + _playbackFile.openRead(_fileHeaders[_list->getSelected()].fileName); + _playbackFile.getHeader().author = editDlg.getAuthor(); + _playbackFile.getHeader().name = editDlg.getName(); + _playbackFile.getHeader().notes = editDlg.getNotes(); + _playbackFile.updateHeader(); + _fileHeaders[_list->getSelected()] = _playbackFile.getHeader(); + int oldselection = _list->getSelected(); + updateList(); + _list->setSelected(oldselection); + updateSelection(true); + _playbackFile.close(); + } + } + break; + case kNextScreenshotCmd: + ++_currentScreenshot; + updateScreenshot(); + break; + case kPrevScreenshotCmd: + --_currentScreenshot; + updateScreenshot(); + break; + case kDeleteCmd: + if (_list->getSelected() >= 0) { + MessageDialog alert(_("Do you really want to delete this record?"), + _("Delete"), _("Cancel")); + if (alert.runModal() == GUI::kMessageOK) { + _playbackFile.close(); + g_eventRec.deleteRecord(_fileHeaders[_list->getSelected()].fileName); + _list->setSelected(-1); + updateList(); + } + } + break; + case GUI::kListSelectionChangedCmd: + updateSelection(true); + break; + case kRecordCmd: { + TimeDate t; + Common::String gameId = ConfMan.get("gameid", _target); + const EnginePlugin *plugin = 0; + GameDescriptor desc = EngineMan.findGame(gameId, &plugin); + g_system->getTimeAndDate(t); + EditRecordDialog editDlg("Unknown Author", Common::String::format("%.2d.%.2d.%.4d ", t.tm_mday, t.tm_mon, 1900 + t.tm_year) + desc.description(), ""); + if (editDlg.runModal() != kOKCmd) { + return; + } + _author = editDlg.getAuthor(); + _name = editDlg.getName(); + _notes = editDlg.getNotes(); + _filename = g_eventRec.generateRecordFileName(_target); + setResult(kRecordDialogRecord); + close(); + } + break; + case kPlaybackCmd: + if (_list->getSelected() >= 0) { + _filename = _fileHeaders[_list->getSelected()].fileName; + setResult(kRecordDialogPlayback); + close(); + } + break; + case kCloseCmd: + setResult(kRecordDialogClose); + default: + Dialog::handleCommand(sender, cmd, data); + } + } + +void RecorderDialog::updateList() { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::String pattern(_target+".r??"); + Common::StringArray files = saveFileMan->listSavefiles(pattern); + Common::PlaybackFile file; + Common::StringArray namesList; + _fileHeaders.clear(); + for (Common::StringArray::iterator i = files.begin(); i != files.end(); ++i) { + if (file.openRead(*i)) { + namesList.push_back(file.getHeader().name); + _fileHeaders.push_back(file.getHeader()); + } + file.close(); + } + _list->setList(namesList); + _list->draw(); +} + +int RecorderDialog::runModal(Common::String &target) { + _target = target; + updateList(); + return Dialog::runModal(); +} + +RecorderDialog::~RecorderDialog() { +} + +void RecorderDialog::updateSelection(bool redraw) { + if (_list->getSelected() >= 0) { + _editButton->setEnabled(true); + _deleteButton->setEnabled(true); + _playbackButton->setEnabled(true); + } + + if (g_gui.xmlEval()->getVar("Globals.RecorderDialog.ExtInfo.Visible") != 1) + return; + + _gfxWidget->setGfx(-1, -1, 0, 0, 0); + _screenShotsCount = 0; + _currentScreenshot = 0; + updateScreenShotsText(); + if (_list->getSelected() >= 0) { + _authorText->setLabel(_("Author: ") + _fileHeaders[_list->getSelected()].author); + _notesText->setLabel(_("Notes: ") + _fileHeaders[_list->getSelected()].notes); + + _firstScreenshotUpdate = true; + updateScreenshot(); + if ((_screenShotsCount) > 0) { + _currentScreenshot = 1; + } + updateScreenshot(); + } else { + _authorText->setLabel(_("Author: ")); + _notesText->setLabel(_("Notes: ")); + _screenShotsCount = -1; + _currentScreenshot = 0; + _gfxWidget->setGfx(-1, -1, 0, 0, 0); + _gfxWidget->draw(); + updateScreenShotsText(); + } +} + +void RecorderDialog::updateScreenshot() { + if (_list->getSelected() == -1) { + return; + } + if (_currentScreenshot < 1) { + _currentScreenshot = _screenShotsCount; + } + if (_currentScreenshot > _screenShotsCount) { + _currentScreenshot = 1; + } + if (_firstScreenshotUpdate) { + _playbackFile.openRead(_fileHeaders[_list->getSelected()].fileName); + _screenShotsCount = _playbackFile.getScreensCount(); + _firstScreenshotUpdate = false; + } + Graphics::Surface *srcsf = _playbackFile.getScreenShot(_currentScreenshot); + if (srcsf != NULL) { + Graphics::Surface *destsf = Graphics::scale(*srcsf, _gfxWidget->getWidth(), _gfxWidget->getHeight()); + _gfxWidget->setGfx(destsf); + updateScreenShotsText(); + delete destsf; + delete srcsf; + } else { + _gfxWidget->setGfx(-1, -1, 0, 0, 0); + } + _gfxWidget->draw(); +} + +void RecorderDialog::updateScreenShotsText() { + if (_screenShotsCount == -1) { + _currentScreenshotText->setLabel(Common::String::format("%d / ?", _currentScreenshot)); + } else { + _currentScreenshotText->setLabel(Common::String::format("%d / %d", _currentScreenshot, _screenShotsCount)); + } +} + +} // End of namespace GUI diff --git a/gui/recorderdialog.h b/gui/recorderdialog.h new file mode 100644 index 0000000000..eb690a4f38 --- /dev/null +++ b/gui/recorderdialog.h @@ -0,0 +1,81 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef GUI_RECORDER_DIALOG_H +#define GUI_RECORDER_DIALOG_H +#include "common/stream.h" +#include "common/recorderfile.h" +#include "gui/dialog.h" +namespace GUI { + +class ListWidget; +class GraphicsWidget; +class ButtonWidget; +class CommandSender; +class ContainerWidget; +class StaticTextWidget; + +class RecorderDialog : public GUI::Dialog { +private: + bool _firstScreenshotUpdate; + Common::PlaybackFile _playbackFile; + Common::String _target; + Common::String _filename; + int _currentScreenshot; + int _screenShotsCount; + Common::Array _fileHeaders; + GUI::ListWidget *_list; + GUI::ContainerWidget *_container; + GUI::GraphicsWidget *_gfxWidget; + GUI::StaticTextWidget *_currentScreenshotText; + GUI::StaticTextWidget *_authorText; + GUI::StaticTextWidget *_notesText; + GUI::ButtonWidget *_editButton; + GUI::ButtonWidget *_deleteButton; + GUI::ButtonWidget *_playbackButton; + + void updateList(); + void updateScreenShotsText(); + void updateSelection(bool redraw); + void updateScreenshot(); +public: + Common::String _author; + Common::String _name; + Common::String _notes; + enum DialogResult { + kRecordDialogClose, + kRecordDialogRecord, + kRecordDialogPlayback + }; + RecorderDialog(); + ~RecorderDialog(); + + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); + virtual void reflowLayout(); + + int runModal(Common::String &target); + const Common::String getFileName() {return _filename;} +}; + +} // End of namespace GUI + + +#endif diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 6d8e6baac7..1b6ae3ec27 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -610,50 +610,54 @@ "/> " " " " " -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " +" " +" " +" " " " " " " " " " " " " " " " " " " " +" " +" " " " " " -" " +" " " " -" " +" " " " @@ -702,38 +712,39 @@ " " " " " " -" " +" " " " " " " " " " " " -" " +" " +" " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -741,7 +752,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -760,10 +771,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -784,7 +795,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -802,7 +813,7 @@ " " " " " " -" " +" " " " @@ -810,7 +821,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -818,7 +829,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -826,7 +837,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -840,7 +851,7 @@ "type='Radiobutton' " "/> " " " -" " +" " " " @@ -854,8 +865,9 @@ " " " " " " -" " -" " +" " +" " +" " " " @@ -866,7 +878,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -877,7 +889,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -888,8 +900,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -897,8 +909,8 @@ " " " " " " -" " -" " +" " +" " " " @@ -906,7 +918,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -921,7 +933,7 @@ " " -" " +" " " " @@ -934,14 +946,14 @@ "/> " " " " " " " " " " " " " -" " +" " " " @@ -959,7 +971,7 @@ " " " " " " -" " +" " " " @@ -971,7 +983,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -983,7 +995,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1007,7 +1019,7 @@ " " " " " " -" " +" " " " @@ -1015,31 +1027,25 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1097,7 +1103,7 @@ " " " " " " -" " +" " " " @@ -1105,7 +1111,7 @@ " " " " " " -" " +" " " " @@ -1113,7 +1119,7 @@ " " " " " " -" " +" " " " @@ -1121,7 +1127,7 @@ " " " " " " -" " +" " " " @@ -1129,43 +1135,34 @@ " " " " " " -" " -" " +" " +" " " " " " " " -" " +" " " " " " " " -" " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " -" " +" " +" " " " @@ -1187,7 +1184,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1199,7 +1196,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1210,7 +1207,7 @@ " " " " " " -" " +" " " " @@ -1235,55 +1232,57 @@ " " " " " " -" " +" " " " " " -" " +" " +" " " " " " -" " +" " " " " " " " -" " -" " +" " " " " " " " " " " " " " -" " +" " +" " +" " " " @@ -1294,7 +1293,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1305,7 +1304,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1316,34 +1315,33 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " +" " +" " +" " " " -" " " " " " " " " " -" " -" " -" " +" " " " @@ -1354,8 +1352,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -1372,7 +1370,7 @@ " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1450,7 +1448,7 @@ " " " " " " -" " +" " " " @@ -1505,7 +1503,7 @@ " " " " " " -" " +" " " " " " " " " " -" " -" " +" " +" " +" " +" " +" " +" " +" " " " -" " +" " +" " +" " " " -" " +" " " " @@ -1546,7 +1559,7 @@ " " " " " " " " +" " " " " " " " " " -" " -" " +" " +" " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " -" " +" " " " @@ -1588,7 +1718,7 @@ " " " " " " " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -1630,20 +1760,20 @@ " " " " " " -" " +" " " " " " " " " " " " " " " " " " -" " +" " " " -" " +" " " " " " " " +" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " " " -" " -" " +" " +" " " " +" " " " " " " " " " " " " " -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " -" " -" " -" " " " " " " " " " " " " " " " " " " " +" " +" " " " " " -" " +" " " " -" " +" " " " @@ -1835,39 +1973,38 @@ " " " " " " -" " +" " " " " " " " " " " " -" " -" " +" " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -1875,7 +2012,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1894,10 +2031,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1918,7 +2055,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1936,7 +2073,7 @@ " " " " " " -" " +" " " " @@ -1944,7 +2081,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1952,7 +2089,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1960,7 +2097,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1974,7 +2111,7 @@ "type='Radiobutton' " "/> " " " -" " +" " " " @@ -1988,9 +2125,8 @@ " " " " " " -" " -" " -" " +" " +" " " " @@ -2001,7 +2137,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -2012,7 +2148,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -2023,8 +2159,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -2032,8 +2168,8 @@ " " " " " " -" " -" " +" " +" " " " @@ -2041,7 +2177,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -2056,7 +2192,7 @@ " " -" " +" " " " @@ -2069,14 +2205,14 @@ "/> " " " " " " " " " " " " " -" " +" " " " @@ -2094,7 +2230,7 @@ " " " " " " -" " +" " " " @@ -2106,7 +2242,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -2118,7 +2254,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -2142,7 +2278,7 @@ " " " " " " -" " +" " " " @@ -2150,25 +2286,31 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -2226,7 +2368,7 @@ " " " " " " -" " +" " " " @@ -2234,7 +2376,7 @@ " " " " " " -" " +" " " " @@ -2242,7 +2384,7 @@ " " " " " " -" " +" " " " @@ -2250,7 +2392,7 @@ " " " " " " -" " +" " " " @@ -2258,34 +2400,43 @@ " " " " " " -" " -" " +" " +" " " " " " " " -" " +" " " " " " " " -" " +" " +" " " " " " " " -" " +" " " " " " " " " " -" " -" " +" " +" " " " @@ -2307,7 +2458,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -2319,7 +2470,7 @@ "width='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -2330,7 +2481,7 @@ " " " " " " -" " +" " " " @@ -2355,57 +2506,55 @@ " " " " " " -" " +" " " " " " -" " -" " +" " " " " " -" " +" " " " " " " " +" " +" " -" " " " " " " " " " " " " " -" " -" " -" " +" " " " @@ -2416,7 +2565,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -2427,7 +2576,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -2438,33 +2587,34 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " -" " +" " " " +" " " " " " " " " " -" " +" " +" " +" " " " @@ -2475,8 +2625,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -2493,7 +2643,7 @@ " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -2571,7 +2721,7 @@ " " " " " " -" " +" " " " @@ -2626,7 +2776,7 @@ " " " " " " -" " +" " " " " " " " " " -" " -" " -" " -" " -" " -" " -" " +" " +" " " " -" " -" " -" " +" " " " -" " +" " " " @@ -2682,7 +2817,7 @@ " " " " " " " " -" " " " " " " " " " -" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " -" " +" " " " @@ -2725,7 +2951,7 @@ " " " " " " " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -2767,20 +2993,20 @@ " " " " " " -" " +" " " " " " " " " " " " " " " " " " -" " +" " " " -" " +" " " " " " " " -" " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " " " -" " -" " +" " +" " " " -" " " " " " " " " " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 297ff20344..4154c6c33a 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 180e8fba74..5fd2d6f835 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -36,6 +36,9 @@ + + + @@ -101,6 +104,12 @@ size = '15, 18' padding = '0, 3, 4, 0' /> + + @@ -1019,6 +1028,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -99,6 +102,12 @@ size = '32, 18' padding = '0, 0, 1, 0' /> + + @@ -1013,6 +1022,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 49c13cf1b0..4fd6ae6eba 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -43,6 +43,9 @@ + + + @@ -106,6 +109,13 @@ size = '15, 18' padding = '0, 3, 4, 0' /> + + + @@ -1032,6 +1042,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -97,6 +100,12 @@ size = '32, 18' padding = '0, 0, 2, 0' /> + + @@ -1012,6 +1021,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _gameModule->getCurrentModuleNum(); + int previousModule = _vm->_gameModule->getPreviousModuleNum(); + int scene = _vm->gameState().sceneNum; + + DebugPrintf("Current module: %d, previous module: %d, scene %d\n", currentModule, previousModule, scene); + + if (argc != 3) { + DebugPrintf("Use room to change rooms\n"); + DebugPrintf("Modules are incremental by 100, from 1000 to 3000\n"); + } else { + int module = atoi(argv[1]); + int scene = atoi(argv[2]); + + _vm->gameState().sceneNum = scene; + _vm->_gameModule->createModule(module, -1); + } + + return true; +} + +} // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h new file mode 100644 index 0000000000..78a7338dc5 --- /dev/null +++ b/engines/neverhood/console.h @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef NEVERHOOD_CONSOLE_H +#define NEVERHOOD_CONSOLE_H + +#include "gui/debugger.h" + +namespace Neverhood { + +class NeverhoodEngine; + +class Console : public GUI::Debugger { +public: + Console(NeverhoodEngine *vm); + virtual ~Console(void); + +private: + NeverhoodEngine *_vm; + + bool Cmd_Room(int argc, const char **argv); +}; + +} // End of namespace Neverhood +#endif diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 8101d38009..1fb3557b81 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -55,6 +55,10 @@ public: void initCubeSymbolsPuzzle(); void initCrystalColorsPuzzle(); uint32 getCurrRadioMusicFileHash(); + int getCurrentModuleNum() { return _moduleNum; } + int getPreviousModuleNum() { return _moduleNum; } + + void createModule(int moduleNum, int which); protected: int _moduleNum; Entity *_prevChildObject; @@ -64,7 +68,6 @@ protected: bool _canRequestMainMenu; bool _mainMenuRequested; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); - void createModule(int moduleNum, int which); void createModuleByHash(uint32 nameHash); void updateModule(); void openMainMenu(); diff --git a/engines/neverhood/module.mk b/engines/neverhood/module.mk index 714fc3079b..030c78a407 100644 --- a/engines/neverhood/module.mk +++ b/engines/neverhood/module.mk @@ -3,6 +3,7 @@ MODULE := engines/neverhood MODULE_OBJS = \ background.o \ blbarchive.o \ + console.o \ detection.o \ diskplayerscene.o \ entity.o \ diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 6b27343d03..57fce58b94 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -22,12 +22,18 @@ #include "common/file.h" #include "common/config-manager.h" +#include "common/textconsole.h" + #include "base/plugins.h" #include "base/version.h" + #include "graphics/cursorman.h" + #include "engines/util.h" + #include "neverhood/neverhood.h" #include "neverhood/blbarchive.h" +#include "neverhood/console.h" #include "neverhood/gamemodule.h" #include "neverhood/gamevars.h" #include "neverhood/graphics.h" @@ -76,7 +82,8 @@ Common::Error NeverhoodEngine::run() { _gameVars = new GameVars(); _screen = new Screen(this); _res = new ResourceMan(); - + _console = new Console(this); + if (isDemo()) { _res->addArchive("a.blb"); _res->addArchive("nevdemo.blb"); @@ -123,6 +130,7 @@ Common::Error NeverhoodEngine::run() { delete _soundMan; delete _audioResourceMan; + delete _console; delete _res; delete _screen; @@ -140,6 +148,11 @@ void NeverhoodEngine::mainLoop() { while (eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: + if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) { + // Open debugger console + _console->attach(); + continue; + } _gameModule->handleKeyDown(event.kbd.keycode); _gameModule->handleAsciiKey(event.kbd.ascii); break; @@ -169,6 +182,7 @@ void NeverhoodEngine::mainLoop() { _gameModule->checkRequests(); _gameModule->handleUpdate(); _gameModule->draw(); + _console->onFrame(); _screen->update(); nextFrameTime = _screen->getNextFrameTime(); }; diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 577fbd7a66..18f2cc9f64 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -48,6 +48,7 @@ class Screen; class SoundMan; class AudioResourceMan; class StaticData; +class Console; struct NPoint; struct GameState { @@ -86,7 +87,8 @@ public: ResourceMan *_res; GameModule *_gameModule; StaticData *_staticData; - + Console *_console; + SoundMan *_soundMan; AudioResourceMan *_audioResourceMan; -- cgit v1.2.3 From f2d0f76939f713bfe4317798665e1ba004f122f3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 9 Jun 2013 16:08:40 +0300 Subject: NEVERHOOD: Fix a memory leak when changing modules --- engines/neverhood/gamemodule.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 49682b0d29..db4d0ef374 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -440,6 +440,10 @@ void GameModule::checkRequests() { void GameModule::createModule(int moduleNum, int which) { debug("GameModule::createModule(%d, %d)", moduleNum, which); _moduleNum = moduleNum; + + if (_childObject) + delete _childObject; + switch (_moduleNum) { case 1000: setGlobalVar(V_MODULE_NAME, 0x03294419); -- cgit v1.2.3 From 9e0c843c9f41239a878e8d2772c27507196428b6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 9 Jun 2013 17:11:24 +0300 Subject: NEVERHOOD: Remove superfluous check --- engines/neverhood/gamemodule.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index db4d0ef374..e63109adee 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -441,8 +441,7 @@ void GameModule::createModule(int moduleNum, int which) { debug("GameModule::createModule(%d, %d)", moduleNum, which); _moduleNum = moduleNum; - if (_childObject) - delete _childObject; + delete _childObject; switch (_moduleNum) { case 1000: -- cgit v1.2.3 From d00f5c0aa739a7a61618f14b47be137f517d92d7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 9 Jun 2013 17:13:23 +0300 Subject: NEVERHOOD: Add a console command to display the current surfaces --- engines/neverhood/background.cpp | 2 +- engines/neverhood/console.cpp | 9 +++++++++ engines/neverhood/console.h | 1 + engines/neverhood/graphics.cpp | 10 +++++----- engines/neverhood/graphics.h | 4 +++- engines/neverhood/menumodule.cpp | 2 +- engines/neverhood/module.h | 3 ++- engines/neverhood/modules/module2200.cpp | 6 +++--- engines/neverhood/scene.cpp | 13 +++++++++++++ engines/neverhood/scene.h | 3 +++ engines/neverhood/smackerplayer.cpp | 2 +- engines/neverhood/sprite.cpp | 4 ++-- 12 files changed, 44 insertions(+), 15 deletions(-) diff --git a/engines/neverhood/background.cpp b/engines/neverhood/background.cpp index 0a80bd8390..e9e5325e77 100644 --- a/engines/neverhood/background.cpp +++ b/engines/neverhood/background.cpp @@ -45,7 +45,7 @@ Background::~Background() { } void Background::createSurface(int surfacePriority, int16 width, int16 height) { - _surface = new BaseSurface(_vm, surfacePriority, width, height); + _surface = new BaseSurface(_vm, surfacePriority, width, height, "background"); _surface->setTransparent(false); _spriteResource.getPosition().x = width; _spriteResource.getPosition().y = height; diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index c82f3a5f38..c6c22f97ce 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -24,11 +24,13 @@ #include "gui/debugger.h" #include "neverhood/neverhood.h" #include "neverhood/gamemodule.h" +#include "neverhood/scene.h" namespace Neverhood { Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); + DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces)); } Console::~Console() { @@ -55,4 +57,11 @@ bool Console::Cmd_Room(int argc, const char **argv) { return true; } +bool Console::Cmd_Surfaces(int argc, const char **argv) { + if (_vm->_gameModule->_childObject) { + ((Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject)->printSurfaces(this); + } + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h index 78a7338dc5..3ae989b08a 100644 --- a/engines/neverhood/console.h +++ b/engines/neverhood/console.h @@ -38,6 +38,7 @@ private: NeverhoodEngine *_vm; bool Cmd_Room(int argc, const char **argv); + bool Cmd_Surfaces(int argc, const char **argv); }; } // End of namespace Neverhood diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 5099c7a00e..8a30b20df4 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -26,9 +26,9 @@ namespace Neverhood { -BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height) +BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, Common::String name) : _vm(vm), _priority(priority), _visible(true), _transparent(true), - _clipRects(NULL), _clipRectsCount(0), _version(0) { + _clipRects(NULL), _clipRectsCount(0), _version(0), _name(name) { _drawRect.x = 0; _drawRect.y = 0; @@ -130,7 +130,7 @@ void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, N // ShadowSurface ShadowSurface::ShadowSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, BaseSurface *shadowSurface) - : BaseSurface(vm, priority, width, height), _shadowSurface(shadowSurface) { + : BaseSurface(vm, priority, width, height, "shadow"), _shadowSurface(shadowSurface) { // Empty } @@ -143,7 +143,7 @@ void ShadowSurface::draw() { // FontSurface FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) - : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows), _charsPerRow(charsPerRow), _numRows(numRows), + : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) { _tracking = new NPointArray(); @@ -152,7 +152,7 @@ FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsP } FontSurface::FontSurface(NeverhoodEngine *vm, uint32 fileHash, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) - : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows), _charsPerRow(charsPerRow), _numRows(numRows), + : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) { SpriteResource fontSpriteResource(_vm); diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h index a0ac1f09d5..9ab0d87ab9 100644 --- a/engines/neverhood/graphics.h +++ b/engines/neverhood/graphics.h @@ -83,7 +83,7 @@ class MouseCursorResource; class BaseSurface { public: - BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height); + BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, Common::String name); virtual ~BaseSurface(); virtual void draw(); void clear(); @@ -104,10 +104,12 @@ public: void setVisible(bool value) { _visible = value; } void setTransparent(bool value) { _transparent = value; } Graphics::Surface *getSurface() { return _surface; } + const Common::String getName() const { return _name; } protected: NeverhoodEngine *_vm; int _priority; bool _visible; + Common::String _name; Graphics::Surface *_surface; NDrawRect _drawRect; NDrawRect _sysRect; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index a8631cb0d6..afa27543dc 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -608,7 +608,7 @@ void TextEditWidget::initialize() { _textLabelWidget->initialize(); if (_cursorFileHash != 0) { cursorSpriteResource.load(_cursorFileHash, true); - _cursorSurface = new BaseSurface(_vm, 0, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height); + _cursorSurface = new BaseSurface(_vm, 0, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height, "cursor"); _cursorSurface->drawSpriteResourceEx(cursorSpriteResource, false, false, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height); _cursorSurface->setVisible(!_readOnly); } diff --git a/engines/neverhood/module.h b/engines/neverhood/module.h index e98012cbea..ba1e1fa3db 100644 --- a/engines/neverhood/module.h +++ b/engines/neverhood/module.h @@ -48,9 +48,10 @@ public: Module(NeverhoodEngine *vm, Module *parentModule); virtual ~Module(); virtual void draw(); + + Entity *_childObject; protected: Module *_parentModule; - Entity *_childObject; bool _done; uint32 _moduleResult; SceneType _sceneType; diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index 4f2d9e8fd2..d382cd6bba 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -2142,17 +2142,17 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which) _fontSurface = FontSurface::createFontSurface(_vm, 0x0800090C); - _backgroundSurface = new BaseSurface(_vm, 0, 640, 480); + _backgroundSurface = new BaseSurface(_vm, 0, 640, 480, "background"); spriteResource.load(0x08100289, true); _backgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0); - _topBackgroundSurface = new BaseSurface(_vm, 0, 640, 192); + _topBackgroundSurface = new BaseSurface(_vm, 0, 640, 192, "top background"); spriteResource.load(!getGlobalVar(V_COLUMN_BACK_NAME) ? kScene2208FileHashes1[getGlobalVar(V_CLICKED_COLUMN_INDEX) % 6] : getGlobalVar(V_COLUMN_BACK_NAME), true); _topBackgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0); - _bottomBackgroundSurface = new BaseSurface(_vm, 0, 640, 192); + _bottomBackgroundSurface = new BaseSurface(_vm, 0, 640, 192, "bottom background"); spriteResource.load(kScene2208FileHashes2[getGlobalVar(V_CLICKED_COLUMN_INDEX) % 6], true); _bottomBackgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0); diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index 07d41754c9..c65bd3781d 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -20,6 +20,7 @@ * */ +#include "neverhood/console.h" #include "neverhood/scene.h" namespace Neverhood { @@ -135,6 +136,18 @@ bool Scene::removeSurface(BaseSurface *surface) { return false; } +void Scene::printSurfaces(Console *con) { + for (uint index = 0; index < _surfaces.size(); index++) { + NDrawRect drawRect = _surfaces[index]->getDrawRect(); + NRect clipRect = _surfaces[index]->getClipRect(); + int priority = _surfaces[index]->getPriority(); + con->DebugPrintf("%d ('%s'): Priority %d, draw rect (%d, %d, %d, %d), clip rect (%d, %d, %d, %d)\n", + index, _surfaces[index]->getName().c_str(), priority, + drawRect.x, drawRect.y, drawRect.x2(), drawRect.y2(), + clipRect.x1, clipRect.y1, clipRect.x2, clipRect.y2); + } +} + Sprite *Scene::addSprite(Sprite *sprite) { addEntity(sprite); addSurface(sprite->getSurface()); diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h index 1abcbfb964..813ffba0bb 100644 --- a/engines/neverhood/scene.h +++ b/engines/neverhood/scene.h @@ -37,6 +37,8 @@ namespace Neverhood { +class Console; + class Scene : public Entity { public: Scene(NeverhoodEngine *vm, Module *parentModule); @@ -46,6 +48,7 @@ public: bool removeEntity(Entity *entity); void addSurface(BaseSurface *surface); bool removeSurface(BaseSurface *surface); + void printSurfaces(Console *con); Sprite *addSprite(Sprite *sprite); void removeSprite(Sprite *sprite); void setSurfacePriority(BaseSurface *surface, int priority); diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index b67c8db9fc..ba89ec3efd 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -31,7 +31,7 @@ namespace Neverhood { // SmackerSurface SmackerSurface::SmackerSurface(NeverhoodEngine *vm) - : BaseSurface(vm, 0, 0, 0), _smackerFrame(NULL) { + : BaseSurface(vm, 0, 0, 0, "smacker"), _smackerFrame(NULL) { } void SmackerSurface::draw() { diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 45d131fd3c..50880089f9 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -83,7 +83,7 @@ void Sprite::loadDataResource(uint32 fileHash) { } void Sprite::createSurface(int surfacePriority, int16 width, int16 height) { - _surface = new BaseSurface(_vm, surfacePriority, width, height); + _surface = new BaseSurface(_vm, surfacePriority, width, height, "sprite"); } int16 Sprite::defFilterY(int16 y) { @@ -398,7 +398,7 @@ void AnimatedSprite::updateFrameInfo() { void AnimatedSprite::createSurface1(uint32 fileHash, int surfacePriority) { NDimensions dimensions = _animResource.loadSpriteDimensions(fileHash); - _surface = new BaseSurface(_vm, surfacePriority, dimensions.width, dimensions.height); + _surface = new BaseSurface(_vm, surfacePriority, dimensions.width, dimensions.height, "animated sprite"); } void AnimatedSprite::createShadowSurface1(BaseSurface *shadowSurface, uint32 fileHash, int surfacePriority) { -- cgit v1.2.3 From 4d56fe773da29f84639fa79ddd84998a1a2f4ca1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Jun 2013 23:12:34 +0200 Subject: HOPKINS: Fix code formatting --- engines/hopkins/hopkins.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 407f264116..0aa7481be4 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -793,14 +793,14 @@ bool HopkinsEngine::runFull() { if (_startGameSlot == -1) { if (getPlatform() == Common::kPlatformLinux) { - _graphicsMan->loadImage("H2"); - _graphicsMan->fadeInLong(); - _events->delay(500); - _graphicsMan->fadeOutLong(); - _globals->_speed = 2; - _globals->_eventMode = EVENTMODE_IGNORE; - _graphicsMan->_fadingFl = true; - _animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200); + _graphicsMan->loadImage("H2"); + _graphicsMan->fadeInLong(); + _events->delay(500); + _graphicsMan->fadeOutLong(); + _globals->_speed = 2; + _globals->_eventMode = EVENTMODE_IGNORE; + _graphicsMan->_fadingFl = true; + _animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200); } else { _animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200); _graphicsMan->fadeOutLong(); -- cgit v1.2.3 From a01b8a517435fcc943b98ddf169eb8b980a8237e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 10 Jun 2013 03:41:55 +0300 Subject: NEVERHOOD: Fix crash when viewing videos in the video viewer The crash was caused by stale pointers, exactly the same as in commit 2e4f64066da7c08edcd17b5c66c6463887b836b4 --- engines/neverhood/diskplayerscene.cpp | 15 +++++++++++---- engines/neverhood/diskplayerscene.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index d972943759..da1ec984a5 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -473,8 +473,15 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, return 0; } +void DiskplayerScene::openSmacker(uint32 fileHash, bool keepLastFrame) { + // The old Smacker surface is deleted when a new Smacker is opened. + removeSurface(_diskSmackerPlayer->getSurface()); + _diskSmackerPlayer->open(fileHash, keepLastFrame); + addSurface(_diskSmackerPlayer->getSurface()); +} + void DiskplayerScene::stop() { - _diskSmackerPlayer->open(0x08288103, true); + openSmacker(0x08288103, true); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); _ssPlayButton->release(); @@ -483,7 +490,7 @@ void DiskplayerScene::stop() { } void DiskplayerScene::tuneIn() { - _diskSmackerPlayer->open(0x900001C1, false); + openSmacker(0x900001C1, false); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); _ssPlayButton->release(); @@ -492,7 +499,7 @@ void DiskplayerScene::tuneIn() { } void DiskplayerScene::playDisk() { - _diskSmackerPlayer->open(kDiskplayerSmackerFileHashes[_diskIndex], false); + openSmacker(kDiskplayerSmackerFileHashes[_diskIndex], false); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); _updateStatus = kUSPlaying; @@ -500,7 +507,7 @@ void DiskplayerScene::playDisk() { } void DiskplayerScene::playStatic() { - _diskSmackerPlayer->open(0x90000101, false); + openSmacker(0x90000101, false); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); _ssPlayButton->release(); diff --git a/engines/neverhood/diskplayerscene.h b/engines/neverhood/diskplayerscene.h index f3fd9ea874..4afaf8af9f 100644 --- a/engines/neverhood/diskplayerscene.h +++ b/engines/neverhood/diskplayerscene.h @@ -99,6 +99,7 @@ protected: bool _dropKey; void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); + void openSmacker(uint32 fileHash, bool keepLastFrame); void stop(); void tuneIn(); void playDisk(); -- cgit v1.2.3 From 8dace22f97b579697d7fb60aed0a7b45d22604b8 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 9 Jun 2013 21:18:09 -0400 Subject: COMMON: Fix custom NE resource type names --- common/winexe.cpp | 2 +- common/winexe_ne.cpp | 32 ++++++++++++++++++++------------ common/winexe_ne.h | 50 +++++++++++++++++++++++++------------------------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/common/winexe.cpp b/common/winexe.cpp index 7cfc140452..877ab6baa1 100644 --- a/common/winexe.cpp +++ b/common/winexe.cpp @@ -73,7 +73,7 @@ String WinResourceID::toString() const { if (_idType == kIDTypeString) return _name; else if (_idType == kIDTypeNumerical) - return String::format("%08x", _id); + return String::format("0x%08x", _id); return ""; } diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp index 8690f6795b..6bb40e0980 100644 --- a/common/winexe_ne.cpp +++ b/common/winexe_ne.cpp @@ -187,8 +187,8 @@ uint32 NEResources::getResourceTableOffset() { static const char *s_resTypeNames[] = { "", "cursor", "bitmap", "icon", "menu", "dialog", "string", "font_dir", "font", "accelerator", "rc_data", "msg_table", - "group_cursor", "group_icon", "version", "dlg_include", - "plug_play", "vxd", "ani_cursor", "ani_icon", "html", + "group_cursor", "group_icon", "", "", "version", "dlg_include", + "", "plug_play", "vxd", "ani_cursor", "ani_icon", "html", "manifest" }; @@ -200,9 +200,16 @@ bool NEResources::readResourceTable(uint32 offset) { return false; uint32 align = 1 << _exe->readUint16LE(); - uint16 typeID = _exe->readUint16LE(); + while (typeID != 0) { + // High bit of the type means integer type + WinResourceID type; + if (typeID & 0x8000) + type = typeID & 0x7FFF; + else + type = getResourceString(*_exe, offset + typeID); + uint16 resCount = _exe->readUint16LE(); _exe->skip(4); // reserved @@ -218,17 +225,18 @@ bool NEResources::readResourceTable(uint32 offset) { res.handle = _exe->readUint16LE(); res.usage = _exe->readUint16LE(); - res.type = typeID; + res.type = type; - if ((id & 0x8000) == 0) - res.id = getResourceString(*_exe, offset + id); - else + // High bit means integer type + if (id & 0x8000) res.id = id & 0x7FFF; + else + res.id = getResourceString(*_exe, offset + id); - if (typeID & 0x8000 && ((typeID & 0x7FFF) < ARRAYSIZE(s_resTypeNames))) + if (typeID & 0x8000 && ((typeID & 0x7FFF) < ARRAYSIZE(s_resTypeNames)) && s_resTypeNames[typeID & 0x7FFF][0] != 0) debug(2, "Found resource %s %s", s_resTypeNames[typeID & 0x7FFF], res.id.toString().c_str()); else - debug(2, "Found resource %04x %s", typeID, res.id.toString().c_str()); + debug(2, "Found resource %s %s", type.toString().c_str(), res.id.toString().c_str()); _resources.push_back(res); } @@ -257,7 +265,7 @@ String NEResources::getResourceString(SeekableReadStream &exe, uint32 offset) { return string; } -const NEResources::Resource *NEResources::findResource(uint16 type, WinResourceID id) const { +const NEResources::Resource *NEResources::findResource(const WinResourceID &type, const WinResourceID &id) const { for (List::const_iterator it = _resources.begin(); it != _resources.end(); ++it) if (it->type == type && it->id == id) return &*it; @@ -265,7 +273,7 @@ const NEResources::Resource *NEResources::findResource(uint16 type, WinResourceI return 0; } -SeekableReadStream *NEResources::getResource(uint16 type, WinResourceID id) { +SeekableReadStream *NEResources::getResource(const WinResourceID &type, const WinResourceID &id) { const Resource *res = findResource(type, id); if (!res) @@ -275,7 +283,7 @@ SeekableReadStream *NEResources::getResource(uint16 type, WinResourceID id) { return _exe->readStream(res->size); } -const Array NEResources::getIDList(uint16 type) const { +const Array NEResources::getIDList(const WinResourceID &type) const { Array idArray; for (List::const_iterator it = _resources.begin(); it != _resources.end(); ++it) diff --git a/common/winexe_ne.h b/common/winexe_ne.h index 4a1b2343df..f00941412f 100644 --- a/common/winexe_ne.h +++ b/common/winexe_ne.h @@ -34,27 +34,27 @@ class SeekableReadStream; /** The default Windows resources. */ enum NEResourceType { - kNECursor = 0x8001, - kNEBitmap = 0x8002, - kNEIcon = 0x8003, - kNEMenu = 0x8004, - kNEDialog = 0x8005, - kNEString = 0x8006, - kNEFontDir = 0x8007, - kNEFont = 0x8008, - kNEAccelerator = 0x8009, - kNERCData = 0x800A, - kNEMessageTable = 0x800B, - kNEGroupCursor = 0x800C, - kNEGroupIcon = 0x800D, - kNEVersion = 0x8010, - kNEDlgInclude = 0x8011, - kNEPlugPlay = 0x8013, - kNEVXD = 0x8014, - kNEAniCursor = 0x8015, - kNEAniIcon = 0x8016, - kNEHTML = 0x8017, - kNEManifest = 0x8018 + kNECursor = 0x01, + kNEBitmap = 0x02, + kNEIcon = 0x03, + kNEMenu = 0x04, + kNEDialog = 0x05, + kNEString = 0x06, + kNEFontDir = 0x07, + kNEFont = 0x08, + kNEAccelerator = 0x09, + kNERCData = 0x0A, + kNEMessageTable = 0x0B, + kNEGroupCursor = 0x0C, + kNEGroupIcon = 0x0D, + kNEVersion = 0x10, + kNEDlgInclude = 0x11, + kNEPlugPlay = 0x13, + kNEVXD = 0x14, + kNEAniCursor = 0x15, + kNEAniIcon = 0x16, + kNEHTML = 0x17, + kNEManifest = 0x18 }; /** @@ -81,17 +81,17 @@ public: bool loadFromEXE(SeekableReadStream *stream); /** Return a list of resources for a given type. */ - const Array getIDList(uint16 type) const; + const Array getIDList(const WinResourceID &type) const; /** Return a stream to the specified resource (or 0 if non-existent). */ - SeekableReadStream *getResource(uint16 type, WinResourceID id); + SeekableReadStream *getResource(const WinResourceID &type, const WinResourceID &id); private: /** A resource. */ struct Resource { WinResourceID id; - uint16 type; ///< Type of the resource. + WinResourceID type; ///< Type of the resource. uint32 offset; ///< Offset within the EXE. uint32 size; ///< Size of the data. @@ -112,7 +112,7 @@ private: bool readResourceTable(uint32 offset); /** Find a specific resource. */ - const Resource *findResource(uint16 type, WinResourceID id) const; + const Resource *findResource(const WinResourceID &type, const WinResourceID &id) const; /** Read a resource string. */ static String getResourceString(SeekableReadStream &exe, uint32 offset); -- cgit v1.2.3 From 0d3902b345f25c71f6be81914bdb045bc8eec7f7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 10 Jun 2013 10:32:30 +0300 Subject: NEVERHOOD: Change the debuglevel of the scene changing debug output These are shown on each scene change, but should no longer be needed to be enabled by default, since we can now use the debugger to check and change the current scene --- engines/neverhood/gamemodule.cpp | 6 +++--- engines/neverhood/modules/module1000.cpp | 2 +- engines/neverhood/modules/module1100.cpp | 2 +- engines/neverhood/modules/module1200.cpp | 2 +- engines/neverhood/modules/module1300.cpp | 2 +- engines/neverhood/modules/module1400.cpp | 2 +- engines/neverhood/modules/module1500.cpp | 2 +- engines/neverhood/modules/module1600.cpp | 2 +- engines/neverhood/modules/module1700.cpp | 2 +- engines/neverhood/modules/module1800.cpp | 2 +- engines/neverhood/modules/module1900.cpp | 2 +- engines/neverhood/modules/module2000.cpp | 2 +- engines/neverhood/modules/module2100.cpp | 2 +- engines/neverhood/modules/module2200.cpp | 2 +- engines/neverhood/modules/module2300.cpp | 2 +- engines/neverhood/modules/module2400.cpp | 2 +- engines/neverhood/modules/module2500.cpp | 2 +- engines/neverhood/modules/module2600.cpp | 2 +- engines/neverhood/modules/module2700.cpp | 2 +- engines/neverhood/modules/module2800.cpp | 2 +- engines/neverhood/modules/module2900.cpp | 2 +- engines/neverhood/modules/module3000.cpp | 2 +- 22 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index e63109adee..2cb037616b 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -438,7 +438,7 @@ void GameModule::checkRequests() { } void GameModule::createModule(int moduleNum, int which) { - debug("GameModule::createModule(%d, %d)", moduleNum, which); + debug(1, "GameModule::createModule(%d, %d)", moduleNum, which); _moduleNum = moduleNum; delete _childObject; @@ -542,7 +542,7 @@ void GameModule::createModule(int moduleNum, int which) { } void GameModule::createModuleByHash(uint32 nameHash) { - debug("GameModule::createModuleByHash(%08X)", nameHash); + debug(1, "GameModule::createModuleByHash(%08X)", nameHash); switch (nameHash) { case 0x03294419: createModule(1000, -1); @@ -687,7 +687,7 @@ void GameModule::updateModule() { createModule(2300, 1); break; case 2300: - debug("module 23000 _moduleResult : %d", _moduleResult); + debug(1, "module 23000 _moduleResult : %d", _moduleResult); if (_moduleResult == 2) createModule(1200, 0); else if (_moduleResult == 0) diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index 415d0f72b1..2a5afe3617 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -48,7 +48,7 @@ Module1000::~Module1000() { } void Module1000::createScene(int sceneNum, int which) { - debug("Module1000::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1000::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index c4d90b5562..3149d7f67d 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -64,7 +64,7 @@ Module1100::~Module1100() { void Module1100::createScene(int sceneNum, int which) { static const uint32 kSmackerFileHashList06[] = {0x10880805, 0x1088081D, 0}; static const uint32 kSmackerFileHashList07[] = {0x00290321, 0x01881000, 0}; - debug("Module1100::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1100::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1200.cpp b/engines/neverhood/modules/module1200.cpp index 3be3635645..3e67ddb35a 100644 --- a/engines/neverhood/modules/module1200.cpp +++ b/engines/neverhood/modules/module1200.cpp @@ -45,7 +45,7 @@ Module1200::~Module1200() { } void Module1200::createScene(int sceneNum, int which) { - debug("Module1200::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1200::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index 8dbfcf616c..a60fb25f52 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -109,7 +109,7 @@ Module1300::~Module1300() { } void Module1300::createScene(int sceneNum, int which) { - debug("Module1300::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1300::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 1: diff --git a/engines/neverhood/modules/module1400.cpp b/engines/neverhood/modules/module1400.cpp index 4f69637ee0..56c6ca5f13 100644 --- a/engines/neverhood/modules/module1400.cpp +++ b/engines/neverhood/modules/module1400.cpp @@ -47,7 +47,7 @@ Module1400::~Module1400() { } void Module1400::createScene(int sceneNum, int which) { - debug("Module1400::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1400::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1500.cpp b/engines/neverhood/modules/module1500.cpp index 2a9597b1fd..00d64a8c2d 100644 --- a/engines/neverhood/modules/module1500.cpp +++ b/engines/neverhood/modules/module1500.cpp @@ -35,7 +35,7 @@ Module1500::Module1500(NeverhoodEngine *vm, Module *parentModule, int which) } void Module1500::createScene(int sceneNum, int which) { - debug("Module1500::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1500::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1600.cpp b/engines/neverhood/modules/module1600.cpp index f7e3c37d84..40faa1e82d 100644 --- a/engines/neverhood/modules/module1600.cpp +++ b/engines/neverhood/modules/module1600.cpp @@ -59,7 +59,7 @@ Module1600::~Module1600() { } void Module1600::createScene(int sceneNum, int which) { - debug("Module1600::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1600::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1700.cpp b/engines/neverhood/modules/module1700.cpp index 3a6d1f80cb..38ed561d51 100644 --- a/engines/neverhood/modules/module1700.cpp +++ b/engines/neverhood/modules/module1700.cpp @@ -58,7 +58,7 @@ Module1700::~Module1700() { } void Module1700::createScene(int sceneNum, int which) { - debug("Module1700::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1700::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1800.cpp b/engines/neverhood/modules/module1800.cpp index 2a6057f9c8..b7371c9a4a 100644 --- a/engines/neverhood/modules/module1800.cpp +++ b/engines/neverhood/modules/module1800.cpp @@ -61,7 +61,7 @@ Module1800::~Module1800() { void Module1800::createScene(int sceneNum, int which) { static const byte kNavigationTypes00[] = {1, 0, 2, 0}; static const byte kNavigationTypes01[] = {5}; - debug("Module1800::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1800::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module1900.cpp b/engines/neverhood/modules/module1900.cpp index 1a9ffa127b..7f08b01d3f 100644 --- a/engines/neverhood/modules/module1900.cpp +++ b/engines/neverhood/modules/module1900.cpp @@ -52,7 +52,7 @@ Module1900::~Module1900() { } void Module1900::createScene(int sceneNum, int which) { - debug("Module1900::createScene(%d, %d)", sceneNum, which); + debug(1, "Module1900::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2000.cpp b/engines/neverhood/modules/module2000.cpp index 5039da1b01..644b7c479a 100644 --- a/engines/neverhood/modules/module2000.cpp +++ b/engines/neverhood/modules/module2000.cpp @@ -43,7 +43,7 @@ Module2000::~Module2000() { } void Module2000::createScene(int sceneNum, int which) { - debug("Module2000::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2000::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2100.cpp b/engines/neverhood/modules/module2100.cpp index 0d7f3dd22a..b664e93dde 100644 --- a/engines/neverhood/modules/module2100.cpp +++ b/engines/neverhood/modules/module2100.cpp @@ -47,7 +47,7 @@ Module2100::~Module2100() { } void Module2100::createScene(int sceneNum, int which) { - debug("Module2100::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2100::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index d382cd6bba..39e3788ea8 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -47,7 +47,7 @@ Module2200::~Module2200() { } void Module2200::createScene(int sceneNum, int which) { - debug("Module2200::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2200::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2300.cpp b/engines/neverhood/modules/module2300.cpp index 34eca14bea..b434fb98c0 100644 --- a/engines/neverhood/modules/module2300.cpp +++ b/engines/neverhood/modules/module2300.cpp @@ -68,7 +68,7 @@ Module2300::~Module2300() { } void Module2300::createScene(int sceneNum, int which) { - debug("Module2300::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2300::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 450812a5f3..47f842b939 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -41,7 +41,7 @@ Module2400::~Module2400() { } void Module2400::createScene(int sceneNum, int which) { - debug("Module2400::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2400::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2500.cpp b/engines/neverhood/modules/module2500.cpp index a997b5aab1..e3a3b74280 100644 --- a/engines/neverhood/modules/module2500.cpp +++ b/engines/neverhood/modules/module2500.cpp @@ -73,7 +73,7 @@ Module2500::~Module2500() { } void Module2500::createScene(int sceneNum, int which) { - debug("Module2500::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2500::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2600.cpp b/engines/neverhood/modules/module2600.cpp index b8dbf7bff1..56b4c65f8d 100644 --- a/engines/neverhood/modules/module2600.cpp +++ b/engines/neverhood/modules/module2600.cpp @@ -54,7 +54,7 @@ Module2600::~Module2600() { } void Module2600::createScene(int sceneNum, int which) { - debug("Module2600::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2600::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 8b69bc050e..19655d128b 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -111,7 +111,7 @@ Module2700::~Module2700() { } void Module2700::createScene(int sceneNum, int which) { - debug("Module2700::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2700::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 26df0aefa5..ee3f270645 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -58,7 +58,7 @@ Module2800::~Module2800() { } void Module2800::createScene(int sceneNum, int which) { - debug("Module2800::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2800::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module2900.cpp b/engines/neverhood/modules/module2900.cpp index bd95b82f4c..248fb81bdc 100644 --- a/engines/neverhood/modules/module2900.cpp +++ b/engines/neverhood/modules/module2900.cpp @@ -42,7 +42,7 @@ Module2900::Module2900(NeverhoodEngine *vm, Module *parentModule, int which) } void Module2900::createScene(int sceneNum, int which) { - debug("Module2900::createScene(%d, %d)", sceneNum, which); + debug(1, "Module2900::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { case 0: diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index 2bdb9f0497..b5cc83deaa 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -75,7 +75,7 @@ Module3000::~Module3000() { void Module3000::createScene(int sceneNum, int which) { static const byte kNavigationTypes05[] = {3, 0}; static const byte kNavigationTypes06[] = {5}; - debug("Module3000::createScene(%d, %d)", sceneNum, which); + debug(1, "Module3000::createScene(%d, %d)", sceneNum, which); _vm->gameState().sceneNum = sceneNum; switch (_vm->gameState().sceneNum) { case 1: -- cgit v1.2.3 From 36a88d2f7229bc6c92b5d7df0eed56dabc911f7e Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Mon, 10 Jun 2013 12:01:37 +0200 Subject: NEVERHOOD: Check that the supplied nhc.exe is the correct one --- devtools/create_neverhood/create_neverhood.cpp | 37 +++- devtools/create_neverhood/md5.cpp | 273 +++++++++++++++++++++++++ devtools/create_neverhood/md5.h | 41 ++++ devtools/create_neverhood/module.mk | 1 + 4 files changed, 348 insertions(+), 4 deletions(-) create mode 100644 devtools/create_neverhood/md5.cpp create mode 100644 devtools/create_neverhood/md5.h diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp index 323066d8b1..f34f20882c 100644 --- a/devtools/create_neverhood/create_neverhood.cpp +++ b/devtools/create_neverhood/create_neverhood.cpp @@ -32,10 +32,16 @@ #include #include "create_neverhood.h" +#include "md5.h" #include "tables.h" const int DAT_VERSION = 0; +// The MD5 hash of the nhc.exe used to extract the tables from +const uint8 kNhcExeMd5[16] = { + 0x37, 0xD6, 0x54, 0xA2, 0xA7, 0xBB, 0xB0, 0x1F, + 0x8C, 0x41, 0x9A, 0xB8, 0x49, 0xFF, 0x29, 0xD4}; + uint32 dataSize; byte *data; uint32 dataStart = 0x004AE000; @@ -48,12 +54,33 @@ class NavigationList; void addMessageList(uint32 messageListCount, uint32 messageListOffset); -void loadExe(const char *filename) { +bool loadExe(const char *filename) { FILE *exe = fopen(filename, "rb"); + if (!exe) { + printf("Could not open nhc.exe for reading! Quitting...\n"); + return false; + } dataSize = fileSize(exe); data = new byte[dataSize]; fread(data, dataSize, 1, exe); fclose(exe); + return true; +} + +bool validateMd5() { + uint8 digest[16]; + + md5_buffer(data, dataSize, digest); + + printf("MD5 of nhc.exe is %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], + digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); + + if (memcmp(kNhcExeMd5, digest, 16)) { + printf("MD5 hash of nhc.exe doesn't match the expected value! Quitting...\n"); + return false; + } + return true; } byte *getData(uint32 offset) { @@ -506,9 +533,11 @@ void addMessageList(uint32 messageListCount, uint32 messageListOffset) { int main(int argc, char *argv[]) { - FILE *datFile; + if (!loadExe("nhc.exe") || + !validateMd5()) + return 1; - loadExe("nhc.exe"); + FILE *datFile; hitRectLists.loadListVector(hitRectListOffsets); rectLists.loadListVector(rectListOffsets); @@ -516,7 +545,7 @@ int main(int argc, char *argv[]) { navigationLists.loadListVector(navigationListOffsets); sceneInfo140Items.loadVector(sceneInfo140Offsets); sceneInfo2700Items.loadVector(sceneInfo2700Offsets); - + datFile = fopen("neverhood.dat", "wb"); writeUint32LE(datFile, 0x11223344); // Some magic diff --git a/devtools/create_neverhood/md5.cpp b/devtools/create_neverhood/md5.cpp new file mode 100644 index 0000000000..50f7406a47 --- /dev/null +++ b/devtools/create_neverhood/md5.cpp @@ -0,0 +1,273 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include "md5.h" + +#define GET_UINT32(n, b, i) (n) = READ_LE_UINT32(b + i) +#define PUT_UINT32(n, b, i) WRITE_LE_UINT32(b + i, n) + +void md5_starts(md5_context *ctx) { + ctx->total[0] = 0; + ctx->total[1] = 0; + + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; +} + +static void md5_process(md5_context *ctx, const uint8 data[64]) { + uint32 X[16], A, B, C, D; + + GET_UINT32(X[0], data, 0); + GET_UINT32(X[1], data, 4); + GET_UINT32(X[2], data, 8); + GET_UINT32(X[3], data, 12); + GET_UINT32(X[4], data, 16); + GET_UINT32(X[5], data, 20); + GET_UINT32(X[6], data, 24); + GET_UINT32(X[7], data, 28); + GET_UINT32(X[8], data, 32); + GET_UINT32(X[9], data, 36); + GET_UINT32(X[10], data, 40); + GET_UINT32(X[11], data, 44); + GET_UINT32(X[12], data, 48); + GET_UINT32(X[13], data, 52); + GET_UINT32(X[14], data, 56); + GET_UINT32(X[15], data, 60); + +#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define P(a, b, c, d, k, s, t) \ +{ \ + a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + +#define F(x, y, z) (z ^ (x & (y ^ z))) + + P(A, B, C, D, 0, 7, 0xD76AA478); + P(D, A, B, C, 1, 12, 0xE8C7B756); + P(C, D, A, B, 2, 17, 0x242070DB); + P(B, C, D, A, 3, 22, 0xC1BDCEEE); + P(A, B, C, D, 4, 7, 0xF57C0FAF); + P(D, A, B, C, 5, 12, 0x4787C62A); + P(C, D, A, B, 6, 17, 0xA8304613); + P(B, C, D, A, 7, 22, 0xFD469501); + P(A, B, C, D, 8, 7, 0x698098D8); + P(D, A, B, C, 9, 12, 0x8B44F7AF); + P(C, D, A, B, 10, 17, 0xFFFF5BB1); + P(B, C, D, A, 11, 22, 0x895CD7BE); + P(A, B, C, D, 12, 7, 0x6B901122); + P(D, A, B, C, 13, 12, 0xFD987193); + P(C, D, A, B, 14, 17, 0xA679438E); + P(B, C, D, A, 15, 22, 0x49B40821); + +#undef F + +#define F(x, y, z) (y ^ (z & (x ^ y))) + + P(A, B, C, D, 1, 5, 0xF61E2562); + P(D, A, B, C, 6, 9, 0xC040B340); + P(C, D, A, B, 11, 14, 0x265E5A51); + P(B, C, D, A, 0, 20, 0xE9B6C7AA); + P(A, B, C, D, 5, 5, 0xD62F105D); + P(D, A, B, C, 10, 9, 0x02441453); + P(C, D, A, B, 15, 14, 0xD8A1E681); + P(B, C, D, A, 4, 20, 0xE7D3FBC8); + P(A, B, C, D, 9, 5, 0x21E1CDE6); + P(D, A, B, C, 14, 9, 0xC33707D6); + P(C, D, A, B, 3, 14, 0xF4D50D87); + P(B, C, D, A, 8, 20, 0x455A14ED); + P(A, B, C, D, 13, 5, 0xA9E3E905); + P(D, A, B, C, 2, 9, 0xFCEFA3F8); + P(C, D, A, B, 7, 14, 0x676F02D9); + P(B, C, D, A, 12, 20, 0x8D2A4C8A); + +#undef F + +#define F(x, y, z) (x ^ y ^ z) + + P(A, B, C, D, 5, 4, 0xFFFA3942); + P(D, A, B, C, 8, 11, 0x8771F681); + P(C, D, A, B, 11, 16, 0x6D9D6122); + P(B, C, D, A, 14, 23, 0xFDE5380C); + P(A, B, C, D, 1, 4, 0xA4BEEA44); + P(D, A, B, C, 4, 11, 0x4BDECFA9); + P(C, D, A, B, 7, 16, 0xF6BB4B60); + P(B, C, D, A, 10, 23, 0xBEBFBC70); + P(A, B, C, D, 13, 4, 0x289B7EC6); + P(D, A, B, C, 0, 11, 0xEAA127FA); + P(C, D, A, B, 3, 16, 0xD4EF3085); + P(B, C, D, A, 6, 23, 0x04881D05); + P(A, B, C, D, 9, 4, 0xD9D4D039); + P(D, A, B, C, 12, 11, 0xE6DB99E5); + P(C, D, A, B, 15, 16, 0x1FA27CF8); + P(B, C, D, A, 2, 23, 0xC4AC5665); + +#undef F + +#define F(x, y, z) (y ^ (x | ~z)) + + P(A, B, C, D, 0, 6, 0xF4292244); + P(D, A, B, C, 7, 10, 0x432AFF97); + P(C, D, A, B, 14, 15, 0xAB9423A7); + P(B, C, D, A, 5, 21, 0xFC93A039); + P(A, B, C, D, 12, 6, 0x655B59C3); + P(D, A, B, C, 3, 10, 0x8F0CCC92); + P(C, D, A, B, 10, 15, 0xFFEFF47D); + P(B, C, D, A, 1, 21, 0x85845DD1); + P(A, B, C, D, 8, 6, 0x6FA87E4F); + P(D, A, B, C, 15, 10, 0xFE2CE6E0); + P(C, D, A, B, 6, 15, 0xA3014314); + P(B, C, D, A, 13, 21, 0x4E0811A1); + P(A, B, C, D, 4, 6, 0xF7537E82); + P(D, A, B, C, 11, 10, 0xBD3AF235); + P(C, D, A, B, 2, 15, 0x2AD7D2BB); + P(B, C, D, A, 9, 21, 0xEB86D391); + +#undef F + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; +} + +void md5_update(md5_context *ctx, const uint8 *input, uint32 length) { + uint32 left, fill; + + if (!length) + return; + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += length; + ctx->total[0] &= 0xFFFFFFFF; + + if (ctx->total[0] < length) + ctx->total[1]++; + + if (left && length >= fill) { + memcpy((void *)(ctx->buffer + left), (const void *)input, fill); + md5_process(ctx, ctx->buffer); + length -= fill; + input += fill; + left = 0; + } + + while (length >= 64) { + md5_process(ctx, input); + length -= 64; + input += 64; + } + + if (length) { + memcpy((void *)(ctx->buffer + left), (const void *)input, length); + } +} + +static const uint8 md5_padding[64] = { + 0x80, 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, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +void md5_finish(md5_context *ctx, uint8 digest[16]) { + uint32 last, padn; + uint32 high, low; + uint8 msglen[8]; + + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); + + PUT_UINT32(low, msglen, 0); + PUT_UINT32(high, msglen, 4); + + last = ctx->total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + md5_update(ctx, md5_padding, padn); + md5_update(ctx, msglen, 8); + + PUT_UINT32(ctx->state[0], digest, 0); + PUT_UINT32(ctx->state[1], digest, 4); + PUT_UINT32(ctx->state[2], digest, 8); + PUT_UINT32(ctx->state[3], digest, 12); +} + +bool md5_file(const char *name, uint8 digest[16], uint32 length) { + FILE *f; + + f = fopen(name, "rb"); + if (f == NULL) { + printf("md5_file couldn't open '%s'\n", name); + return false; + } + + md5_context ctx; + uint32 i; + unsigned char buf[1000]; + bool restricted = (length != 0); + int readlen; + + if (!restricted || sizeof(buf) <= length) + readlen = sizeof(buf); + else + readlen = length; + + md5_starts(&ctx); + + + while ((i = (uint32)fread(buf, 1, readlen, f)) > 0) { + md5_update(&ctx, buf, i); + + length -= i; + if (restricted && length == 0) + break; + + if (restricted && sizeof(buf) > length) + readlen = length; + } + + md5_finish(&ctx, digest); + fclose(f); + return true; +} + +void md5_buffer(byte *buf, uint32 len, uint8 digest[16]) { + md5_context ctx; + + md5_starts(&ctx); + md5_update(&ctx, buf, len); + md5_finish(&ctx, digest); +} + diff --git a/devtools/create_neverhood/md5.h b/devtools/create_neverhood/md5.h new file mode 100644 index 0000000000..81bc03ff83 --- /dev/null +++ b/devtools/create_neverhood/md5.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef COMMON_MD5_H +#define COMMON_MD5_H + +#include "util.h" + +typedef struct { + uint32 total[2]; + uint32 state[4]; + uint8 buffer[64]; +} md5_context; + +void md5_starts(md5_context *ctx); +void md5_update(md5_context *ctx, const uint8 *input, uint32 length); +void md5_finish(md5_context *ctx, uint8 digest[16]); + +bool md5_file(const char *name, uint8 digest[16], uint32 length = 0); +void md5_buffer(byte *buf, uint32 len, uint8 digest[16]); + +#endif diff --git a/devtools/create_neverhood/module.mk b/devtools/create_neverhood/module.mk index 284e19105d..8e263559b5 100644 --- a/devtools/create_neverhood/module.mk +++ b/devtools/create_neverhood/module.mk @@ -3,6 +3,7 @@ MODULE := devtools/create_neverhood MODULE_OBJS := \ create_neverhood.o \ + md5.o \ util.o # Set the name of the executable -- cgit v1.2.3 From ad38029e6e10db27652e2f79c9c68b87593ebffa Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 10 Jun 2013 20:05:21 +0200 Subject: TONY: Remove varargs from mpalQueryCORO(). CID 1002105 It didn't always reach va_end(), but rather than adding a call it makes more sense to just drop the varargs from it, since it didn't use it anyway. --- engines/tony/mpal/mpal.cpp | 7 +------ engines/tony/mpal/mpal.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 1de5c6850c..fff8676a89 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -1876,14 +1876,11 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { * @remarks This is the specialised version of the original single mpalQuery * method that needs to run within a co-routine context. */ -void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...) { +void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet) { CORO_BEGIN_CONTEXT; uint32 dwRet; CORO_END_CONTEXT(_ctx); - va_list v; - va_start(v, dwRet); - CORO_BEGIN_CODE(_ctx); if (wQueryType == MPQ_DIALOG_WAITFORCHOICE) { @@ -1909,8 +1906,6 @@ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...) { } CORO_END_CODE; - - va_end(v); } /** diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h index 779bdd6188..2d22ee8faf 100644 --- a/engines/tony/mpal/mpal.h +++ b/engines/tony/mpal/mpal.h @@ -417,7 +417,7 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...); * @remarks This is the specialised version of the original single mpalQuery * method that needs to run within a co-routine context. */ -void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet, ...); +void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet); /** * Execute a script. The script runs on multitasking by a thread. -- cgit v1.2.3 From 9c0297bc9e91b3ba32de0e8d7e82447218b3e529 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Jun 2013 07:54:49 +0200 Subject: TONY: Add detection for English version unpacked Thanks Tomaso for reporting the problem --- engines/tony/detection_tables.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h index ee137927dc..537f88df45 100644 --- a/engines/tony/detection_tables.h +++ b/engines/tony/detection_tables.h @@ -196,6 +196,23 @@ static const TonyGameDescription gameDescriptions[] = { }, }, + { + // Tony Tough English Unpacked + { + "tony", + 0, + { + {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, + {"roasted.mpc", 0, "57c4a3860cf899443c357e0078ea6f49", 366773}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From daebd2657a0f6671329f145d239633ee4c30bbfe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Jun 2013 08:11:45 +0200 Subject: TONY: Add detection for German "Shoe Box", bug #3582420 --- engines/tony/detection_tables.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h index 537f88df45..ca16495903 100644 --- a/engines/tony/detection_tables.h +++ b/engines/tony/detection_tables.h @@ -213,6 +213,23 @@ static const TonyGameDescription gameDescriptions[] = { }, }, + { + // Tony Tough German "Shoe Box", reported in bug #3582420 + { + "tony", + 0, + { + {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, + {"roasted.mpc", 0, "bc3471f098e591dc509dcad401a8d8a5", 389554}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From 90a8b1b781a9a06bdca721451b13059b1482e7bc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Jun 2013 08:21:01 +0200 Subject: HOPKINS: Fix glitch at the end of the intro caused by a double long fade out Thanks Greencis for reporting it --- engines/hopkins/hopkins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0aa7481be4..529997b259 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -164,7 +164,7 @@ bool HopkinsEngine::runWin95Demo() { _globals->_speed = 3; if (_startGameSlot == -1) - _graphicsMan->fadeOutLong(); + _graphicsMan->fadeOutShort(); _globals->_eventMode = EVENTMODE_IGNORE; _globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR"); -- cgit v1.2.3 From 8fee7849654cdca69ce31cbb345f89ff9e33f28f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 11 Jun 2013 11:46:01 +0300 Subject: NEVERHOOD: Cleanup, merge some duplicate code --- engines/neverhood/diskplayerscene.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index da1ec984a5..534b2b9fe0 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -478,12 +478,12 @@ void DiskplayerScene::openSmacker(uint32 fileHash, bool keepLastFrame) { removeSurface(_diskSmackerPlayer->getSurface()); _diskSmackerPlayer->open(fileHash, keepLastFrame); addSurface(_diskSmackerPlayer->getSurface()); + _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); + _palette->usePalette(); } void DiskplayerScene::stop() { openSmacker(0x08288103, true); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); _ssPlayButton->release(); _updateStatus = kUSStopped; _diskSlots[_diskIndex]->activate(); @@ -491,8 +491,6 @@ void DiskplayerScene::stop() { void DiskplayerScene::tuneIn() { openSmacker(0x900001C1, false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); _ssPlayButton->release(); _updateStatus = kUSTuningIn; _diskSlots[_diskIndex]->activate(); @@ -500,16 +498,12 @@ void DiskplayerScene::tuneIn() { void DiskplayerScene::playDisk() { openSmacker(kDiskplayerSmackerFileHashes[_diskIndex], false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); _updateStatus = kUSPlaying; _diskSlots[_diskIndex]->play(); } void DiskplayerScene::playStatic() { openSmacker(0x90000101, false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); _ssPlayButton->release(); _updateStatus = kUSPlaying; _diskSlots[_diskIndex]->activate(); -- cgit v1.2.3 From 19e92a09fc790dfc1da69f886b1d330a878d7e75 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 11 Jun 2013 11:47:12 +0300 Subject: NEVERHOOD: Fix crashes in scene 3009 (cannon scene), and add a FIXME --- engines/neverhood/modules/module3000.cpp | 47 +++++++++++++++++++------------- engines/neverhood/modules/module3000.h | 4 ++- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index b5cc83deaa..75e44edbd6 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -786,8 +786,8 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) } } - _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, kScene3009CannonScopeVideos[_cannonTargetStatus], false, _keepVideo)); - _smackerPlayer->setDrawPos(89, 37); + _cannonSmackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, kScene3009CannonScopeVideos[_cannonTargetStatus], false, _keepVideo)); + _cannonSmackerPlayer->setDrawPos(89, 37); _palette->usePalette(); // Use it again since the SmackerPlayer overrides the usage insertStaticSprite(0x8540252C, 400); @@ -817,32 +817,43 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) } +Scene3009::~Scene3009() { + removeSurface(_cannonSmackerPlayer->getSurface()); + // FIXME: Deleting the player crashes the game when leaving the cannon scene! + //delete _cannonSmackerPlayer; +} + +void Scene3009::openSmacker(uint32 fileHash, bool keepLastFrame) { + // The old Smacker surface is deleted when a new Smacker is opened. + removeSurface(_cannonSmackerPlayer->getSurface()); + _cannonSmackerPlayer->open(fileHash, keepLastFrame); + addSurface(_cannonSmackerPlayer->getSurface()); + //_vm->_screen->setSmackerDecoder(_cannonSmackerPlayer->getSmackerDecoder()); + _palette->usePalette(); +} + void Scene3009::update() { Scene::update(); - if (!_keepVideo && _smackerPlayer->isDone() && _cannonTargetStatus <= kCTSCount) { + if (!_keepVideo && _cannonSmackerPlayer->isDone() && _cannonTargetStatus <= kCTSCount) { switch (_cannonTargetStatus) { case kCTSNull: case kCTSLowerCannon: - _smackerPlayer->open(0x340A0049, true); - _palette->usePalette(); + openSmacker(0x340A0049, true); _keepVideo = true; break; case kCTSRightRobotNoTarget: - _smackerPlayer->open(0x0082080D, true); - _palette->usePalette(); + openSmacker(0x0082080D, true); _keepVideo = true; _isTurning = false; break; case kCTSRightRobotIsTarget: - _smackerPlayer->open(0x0282080D, true); - _palette->usePalette(); + openSmacker(0x0282080D, true); _keepVideo = true; _isTurning = false; break; case kCTSRightNoRobot: - _smackerPlayer->open(0x0882080D, true); - _palette->usePalette(); + openSmacker(0x0882080D, true); _keepVideo = true; _isTurning = false; break; @@ -851,12 +862,11 @@ void Scene3009::update() { case kCTSLeftNoRobot: if (_moveCannonLeftFirst) { if (_cannonTargetStatus == kCTSLeftRobotNoTarget) - _smackerPlayer->open(0x110A000F, false); + openSmacker(0x110A000F, false); else if (_cannonTargetStatus == kCTSLeftRobotIsTarget) - _smackerPlayer->open(0x500B004F, false); + openSmacker(0x500B004F, false); else if (_cannonTargetStatus == kCTSLeftNoRobot) - _smackerPlayer->open(0x100B010E, false); - _palette->usePalette(); + openSmacker(0x100B010E, false); _moveCannonLeftFirst = false; _asHorizontalIndicator->stMoveLeft(); } else { @@ -955,15 +965,14 @@ uint32 Scene3009::handleMessage(int messageNum, const MessageParam ¶m, Entit // Cannon is at the right position if (!getGlobalVar(V_ROBOT_TARGET)) { _cannonTargetStatus = kCTSLeftRobotNoTarget; - _smackerPlayer->open(0x108A000F, false); + openSmacker(0x108A000F, false); } else if (!getGlobalVar(V_ROBOT_HIT)) { _cannonTargetStatus = kCTSLeftRobotIsTarget; - _smackerPlayer->open(0x500B002F, false); + openSmacker(0x500B002F, false); } else { _cannonTargetStatus = kCTSLeftNoRobot; - _smackerPlayer->open(0x100B008E, false); + openSmacker(0x100B008E, false); } - _palette->usePalette(); _moveCannonLeftFirst = true; _isTurning = true; _keepVideo = false; diff --git a/engines/neverhood/modules/module3000.h b/engines/neverhood/modules/module3000.h index 7634360d7c..797be1885f 100644 --- a/engines/neverhood/modules/module3000.h +++ b/engines/neverhood/modules/module3000.h @@ -128,11 +128,12 @@ protected: class Scene3009 : public Scene { public: Scene3009(NeverhoodEngine *vm, Module *parentModule, int which); + virtual ~Scene3009(); bool isTurning(); protected: int _lockSymbolsPart1Countdown; int _lockSymbolsPart2Countdown; - SmackerPlayer *_smackerPlayer; + SmackerPlayer *_cannonSmackerPlayer; Sprite *_ssFireCannonButton; SsScene3009SymbolEdges *_ssSymbolEdges[2]; SsScene3009TargetLine *_ssTargetLines[2]; @@ -149,6 +150,7 @@ protected: void playActionVideo(); bool isSymbolsPart1Solved(); bool isSymbolsPart2Solved(); + void openSmacker(uint32 fileHash, bool keepLastFrame); }; // Scene3010 -- cgit v1.2.3 From add321c93049e006c202c67bdb0170b8bca83833 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 11 Jun 2013 11:33:05 +0200 Subject: NEVERHOOD: Try to fix the Smacker issues inside of SmackerPlayer only (instead the numerous classes using it) SmackerPlayer now creates a surface in the constructor and deletes it in the destructor. There will be only this surface during the lifetime of the player, so there shouldn't be any issues any more when the player is reused for different Smacker files. This is imo nicer than to remove/add the surface. I kept the several openSmacker since it wraps some code which is nice. --- engines/neverhood/diskplayerscene.cpp | 7 +------ engines/neverhood/modules/module3000.cpp | 6 ------ engines/neverhood/navigationscene.cpp | 15 +++---------- engines/neverhood/navigationscene.h | 1 - engines/neverhood/smackerplayer.cpp | 36 +++++++++++++++++++++++++------- engines/neverhood/smackerplayer.h | 1 + 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index 534b2b9fe0..94a68a7526 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -354,9 +354,7 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int insertPuzzleMouse(0x000408A8, 20, 620); showMouse(false); - _diskSmackerPlayer = new SmackerPlayer(_vm, this, 0x08288103, false, true); - addEntity(_diskSmackerPlayer); - addSurface(_diskSmackerPlayer->getSurface()); + _diskSmackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08288103, false, true)); _diskSmackerPlayer->setDrawPos(154, 86); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); @@ -474,10 +472,7 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, } void DiskplayerScene::openSmacker(uint32 fileHash, bool keepLastFrame) { - // The old Smacker surface is deleted when a new Smacker is opened. - removeSurface(_diskSmackerPlayer->getSurface()); _diskSmackerPlayer->open(fileHash, keepLastFrame); - addSurface(_diskSmackerPlayer->getSurface()); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); } diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index 75e44edbd6..a2c0eb7ec0 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -818,16 +818,10 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) } Scene3009::~Scene3009() { - removeSurface(_cannonSmackerPlayer->getSurface()); - // FIXME: Deleting the player crashes the game when leaving the cannon scene! - //delete _cannonSmackerPlayer; } void Scene3009::openSmacker(uint32 fileHash, bool keepLastFrame) { - // The old Smacker surface is deleted when a new Smacker is opened. - removeSurface(_cannonSmackerPlayer->getSurface()); _cannonSmackerPlayer->open(fileHash, keepLastFrame); - addSurface(_cannonSmackerPlayer->getSurface()); //_vm->_screen->setSmackerDecoder(_cannonSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); } diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 9752ee618c..33e2a264a8 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -41,9 +41,7 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint SetUpdateHandler(&NavigationScene::update); SetMessageHandler(&NavigationScene::handleMessage); - _smackerPlayer = new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true); - addEntity(_smackerPlayer); - addSurface(_smackerPlayer->getSurface()); + _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true)); createMouseCursor(); @@ -69,7 +67,7 @@ int NavigationScene::getNavigationAreaType() { void NavigationScene::update() { if (_smackerFileHash != 0) { showMouse(false); - openSmacker(_smackerFileHash, false); + _smackerPlayer->open(_smackerFileHash, false); _vm->_screen->clear(); _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); _smackerDone = false; @@ -92,7 +90,7 @@ void NavigationScene::update() { _vm->_soundMan->setTwoSoundsPlayFlag(false); _vm->_soundMan->setSoundThreePlayFlag(false); _smackerDone = false; - openSmacker(navigationItem.fileHash, true); + _smackerPlayer->open(navigationItem.fileHash, true); _vm->_screen->clear(); _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); sendMessage(_parentModule, 0x100A, _navigationIndex); @@ -101,13 +99,6 @@ void NavigationScene::update() { Scene::update(); } -void NavigationScene::openSmacker(uint32 fileHash, bool keepLastFrame) { - // The old Smacker surface is deleted when a new Smacker is opened. - removeSurface(_smackerPlayer->getSurface()); - _smackerPlayer->open(fileHash, keepLastFrame); - addSurface(_smackerPlayer->getSurface()); -} - uint32 NavigationScene::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x0000: diff --git a/engines/neverhood/navigationscene.h b/engines/neverhood/navigationscene.h index 767b3f5d20..ebe9a3597c 100644 --- a/engines/neverhood/navigationscene.h +++ b/engines/neverhood/navigationscene.h @@ -50,7 +50,6 @@ protected: bool _leaveSceneAfter; const byte *_itemsTypes; void update(); - void openSmacker(uint32 fileHash, bool keepLastFrame); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); void createMouseCursor(); void handleNavigation(const NPoint &mousePos); diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index ba89ec3efd..21d8851f48 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -51,6 +51,18 @@ void SmackerSurface::setSmackerFrame(const Graphics::Surface *smackerFrame) { _smackerFrame = smackerFrame; } +void SmackerSurface::unsetSmackerFrame() { + _drawRect.x = 0; + _drawRect.y = 0; + _drawRect.width = 0; + _drawRect.height = 0; + _sysRect.x = 0; + _sysRect.y = 0; + _sysRect.width = 0; + _sysRect.height = 0; + _smackerFrame = NULL; +} + // SmackerDoubleSurface SmackerDoubleSurface::SmackerDoubleSurface(NeverhoodEngine *vm) @@ -62,6 +74,8 @@ void SmackerDoubleSurface::draw() { _vm->_screen->drawDoubleSurface2(_smackerFrame, _drawRect); } +// NeverhoodSmackerDecoder + void NeverhoodSmackerDecoder::forceSeekToFrame(uint frame) { if (!isVideoLoaded()) return; @@ -92,11 +106,20 @@ SmackerPlayer::SmackerPlayer(NeverhoodEngine *vm, Scene *scene, uint32 fileHash, _drawX(-1), _drawY(-1) { SetUpdateHandler(&SmackerPlayer::update); + + if (_doubleSurface) { + _smackerSurface = new SmackerDoubleSurface(_vm); + } else { + _smackerSurface = new SmackerSurface(_vm); + } + open(fileHash, flag); } SmackerPlayer::~SmackerPlayer() { close(); + delete _smackerSurface; + _smackerSurface = NULL; } void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) { @@ -107,12 +130,6 @@ void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) { close(); - if (_doubleSurface) { - _smackerSurface = new SmackerDoubleSurface(_vm); - } else { - _smackerSurface = new SmackerSurface(_vm); - } - _smackerFirst = true; _stream = _vm->_res->createStream(fileHash); @@ -134,11 +151,10 @@ void SmackerPlayer::close() { delete _smackerDecoder; delete _palette; // NOTE The SmackerDecoder deletes the _stream - delete _smackerSurface; _smackerDecoder = NULL; _palette = NULL; _stream = NULL; - _smackerSurface = NULL; + _smackerSurface->unsetSmackerFrame(); } void SmackerPlayer::gotoFrame(int frameNumber) { @@ -200,6 +216,10 @@ void SmackerPlayer::update() { } void SmackerPlayer::updateFrame() { + + if (!_smackerDecoder || !_smackerSurface) + return; + const Graphics::Surface *smackerFrame = _smackerDecoder->decodeNextFrame(); if (_smackerFirst) { diff --git a/engines/neverhood/smackerplayer.h b/engines/neverhood/smackerplayer.h index 26ebff5d33..f13b653757 100644 --- a/engines/neverhood/smackerplayer.h +++ b/engines/neverhood/smackerplayer.h @@ -37,6 +37,7 @@ public: SmackerSurface(NeverhoodEngine *vm); virtual void draw(); void setSmackerFrame(const Graphics::Surface *smackerFrame); + void unsetSmackerFrame(); protected: const Graphics::Surface *_smackerFrame; }; -- cgit v1.2.3 From d4f3f6baa4eae9b6ab47b6f29dbd585a892e791d Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 11 Jun 2013 11:39:28 +0200 Subject: NEVERHOOD: Fix warning about shadowed variable --- engines/neverhood/console.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index c6c22f97ce..87891285d7 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -47,11 +47,11 @@ bool Console::Cmd_Room(int argc, const char **argv) { DebugPrintf("Use room to change rooms\n"); DebugPrintf("Modules are incremental by 100, from 1000 to 3000\n"); } else { - int module = atoi(argv[1]); - int scene = atoi(argv[2]); + int newModule = atoi(argv[1]); + int newScene = atoi(argv[2]); - _vm->gameState().sceneNum = scene; - _vm->_gameModule->createModule(module, -1); + _vm->gameState().sceneNum = newScene; + _vm->_gameModule->createModule(newModule, -1); } return true; -- cgit v1.2.3 From 974e7e80a83a0b44108ff9bdcb2863382b79b32e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 11 Jun 2013 14:03:44 +0300 Subject: NEVERHOOD: Remove cheat debug code, and introduce a new command, "cheat" --- engines/neverhood/console.cpp | 93 ++++++++++++++++++++++++++++++++ engines/neverhood/console.h | 1 + engines/neverhood/gamemodule.cpp | 15 ------ engines/neverhood/modules/module1100.cpp | 7 --- engines/neverhood/modules/module1600.h | 2 + engines/neverhood/modules/module2800.cpp | 12 ----- engines/neverhood/modules/module3000.cpp | 15 ------ 7 files changed, 96 insertions(+), 49 deletions(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 87891285d7..917eae596f 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -25,12 +25,14 @@ #include "neverhood/neverhood.h" #include "neverhood/gamemodule.h" #include "neverhood/scene.h" +#include "neverhood/modules/module1600.h" namespace Neverhood { Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces)); + DCmd_Register("cheat", WRAP_METHOD(Console, Cmd_Cheat)); } Console::~Console() { @@ -64,4 +66,95 @@ bool Console::Cmd_Surfaces(int argc, const char **argv) { return true; } +bool Console::Cmd_Cheat(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Cheats for various puzzles in the game\n"); + DebugPrintf("Use %s to use a cheat.\n", argv[0]); + DebugPrintf("Cheats:\n-------\n"); + DebugPrintf(" buttons - enables all 3 buttons on the door in the purple building, module 3000, scene 9\n"); + DebugPrintf(" cannon - sets the correct cannon combination in module 3000, scene 8\n"); + DebugPrintf(" dice - shows the correct dice combination in the teddy bear puzzle, module 1100, scene 6\n"); + DebugPrintf(" memory - solves the memory puzzle, module 1400, scene 4\n"); + DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); + DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); + DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n"); + return true; + } + + Common::String cheatName = argv[1]; + int module = _vm->_gameModule->getCurrentModuleNum(); + int scene = _vm->gameState().sceneNum; + + if (cheatName == "buttons") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + + scene->setSubVar(VA_LOCKS_DISABLED, 0x304008D2, 1); // kScene3010ButtonNameHashes[0] + scene->setSubVar(VA_LOCKS_DISABLED, 0x40119852, 1); // kScene3010ButtonNameHashes[1] + scene->setSubVar(VA_LOCKS_DISABLED, 0x01180951, 1); // kScene3010ButtonNameHashes[2] + + DebugPrintf("All 3 door buttons have been enabled\n"); + } else if (cheatName == "cannon") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + + for (int i = 0; i < 3; i++) + scene->setSubVar(VA_CURR_CANNON_SYMBOLS, i, scene->getSubVar(VA_GOOD_CANNON_SYMBOLS_1, i)); + + for (int i = 3; i < 6; i++) + scene->setSubVar(VA_CURR_CANNON_SYMBOLS, i, scene->getSubVar(VA_GOOD_CANNON_SYMBOLS_2, i - 3)); + + DebugPrintf("Puzzle solved\n"); + } else if (cheatName == "dice") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + DebugPrintf("Good: (%d %d %d), current: (%d %d %d)\n", + scene->getSubVar(VA_GOOD_DICE_NUMBERS, 0), scene->getSubVar(VA_GOOD_DICE_NUMBERS, 1), scene->getSubVar(VA_GOOD_DICE_NUMBERS, 2), + scene->getSubVar(VA_CURR_DICE_NUMBERS, 0), scene->getSubVar(VA_CURR_DICE_NUMBERS, 1), scene->getSubVar(VA_CURR_DICE_NUMBERS, 2) + ); + } else if (cheatName == "memory") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + + // Autosolve all tiles and leave only two matching tiles closed + for (int i = 0; i < 48; i++) + scene->setSubVar(VA_IS_TILE_MATCH, i, 1); + + // Close the top left tile + scene->setSubVar(VA_IS_TILE_MATCH, 0, 0); + + // Find and close the pair of the top left tile + for (int i = 0; i < 48; i++) { + if (i != 0 && scene->getSubVar(VA_TILE_SYMBOLS, i) == scene->getSubVar(VA_TILE_SYMBOLS, 0)) { + scene->setSubVar(VA_IS_TILE_MATCH, i, 0); + break; + } + } + + DebugPrintf("Puzzle solved\n"); + } else if (cheatName == "radio") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + scene->setGlobalVar(V_RADIO_ENABLED, 1); + + DebugPrintf("The radio has been enabled\n"); + } else if (cheatName == "symbols") { + if (module == 1600 && scene == 8) { + Scene1609 *scene = ((Scene1609 *)((Module1600 *)_vm->_gameModule->_childObject)->_childObject); + + for (int index = 0; index < 12; index++) { + scene->_asSymbols[index]->change((int)scene->getSubVar(VA_CODE_SYMBOLS, index) + 12, index == (int)scene->getSubVar(VA_CODE_SYMBOLS, scene->_noisySymbolIndex)); + } + + scene->_changeCurrentSymbol = false; + scene->_symbolPosition = 11; + + DebugPrintf("Puzzle solved\n"); + } else { + DebugPrintf("Only available in module 1600, scene 8\n"); + } + } else if (cheatName == "tubes") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + DebugPrintf("Tube set 1: %d %d %d\n", scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 1), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2)); + DebugPrintf("Tube set 2: %d %d %d\n", scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2)); + } + + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h index 3ae989b08a..7349820507 100644 --- a/engines/neverhood/console.h +++ b/engines/neverhood/console.h @@ -39,6 +39,7 @@ private: bool Cmd_Room(int argc, const char **argv); bool Cmd_Surfaces(int argc, const char **argv); + bool Cmd_Cheat(int argc, const char **argv); }; } // End of namespace Neverhood diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 2cb037616b..70450e2918 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -194,21 +194,6 @@ void GameModule::initMemoryPuzzle() { tileSymbolIndex = 0; } setSubVar(VA_IS_PUZZLE_INIT, 0xC8606803, 1); - - // DEBUG Enable to autosolve all tiles and leave only two matching tiles open -#if 0 - for (int i = 0; i < 48; i++) - setSubVar(VA_IS_TILE_MATCH, i, 1); - int debugIndex = 0; - setSubVar(VA_IS_TILE_MATCH, debugIndex, 0); - for (int i = 0; i < 48; i++) { - if (i != debugIndex && getSubVar(VA_TILE_SYMBOLS, i) == getSubVar(VA_TILE_SYMBOLS, debugIndex)) { - setSubVar(VA_IS_TILE_MATCH, i, 0); - break; - } - } -#endif - } } diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 3149d7f67d..0c09ed5242 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -625,13 +625,6 @@ void Scene1105::upClosePanel() { } void Scene1105::update() { - - // DEBUG: Show the correct code - debug("(%d, %d) (%d, %d) (%d, %d)", - getSubVar(VA_GOOD_DICE_NUMBERS, 0), getSubVar(VA_CURR_DICE_NUMBERS, 0), - getSubVar(VA_GOOD_DICE_NUMBERS, 1), getSubVar(VA_CURR_DICE_NUMBERS, 1), - getSubVar(VA_GOOD_DICE_NUMBERS, 2), getSubVar(VA_CURR_DICE_NUMBERS, 2)); - Scene::update(); if (_countdown != 0 && (--_countdown == 0)) createObjects(); diff --git a/engines/neverhood/modules/module1600.h b/engines/neverhood/modules/module1600.h index 0bf44ff7b8..5f0da528ab 100644 --- a/engines/neverhood/modules/module1600.h +++ b/engines/neverhood/modules/module1600.h @@ -26,6 +26,7 @@ #include "neverhood/neverhood.h" #include "neverhood/module.h" #include "neverhood/scene.h" +#include "neverhood/console.h" #include "neverhood/modules/module3000.h" namespace Neverhood { @@ -162,6 +163,7 @@ protected: }; class Scene1609 : public Scene { + friend class Console; public: Scene1609(NeverhoodEngine *vm, Module *parentModule); protected: diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index ee3f270645..f359cc3caf 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -2443,18 +2443,6 @@ uint32 Scene2808::handleMessage(int messageNum, const MessageParam ¶m, Entit } void Scene2808::update() { - - // DEBUG>>> Show correct values - #if 1 - debug("---------------"); - if (_testTubeSetNum == 0) - debug("%03d %03d %03d", getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 1), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2)); - else - debug("%03d %03d %03d", getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2)); - debug("%03d %03d %03d", _asTestTubes[0]->getFillLevel(), _asTestTubes[1]->getFillLevel(), _asTestTubes[2]->getFillLevel()); - #endif - // DEBUG<<< - Scene::update(); if (_countdown != 0 && (--_countdown) == 0) { leaveScene(_leaveResult); diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index a2c0eb7ec0..373bfb57f6 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -807,14 +807,6 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene3009::handleMessage); SetUpdateHandler(&Scene3009::update); - - // DEBUG Enable to set the correct code -#if 0 - for (int i = 0; i < 6; i++) - setSubVar(VA_CURR_CANNON_SYMBOLS, i, _correctSymbols[i]); - sendMessage(this, 0x2003, 0); -#endif - } Scene3009::~Scene3009() { @@ -1227,13 +1219,6 @@ Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) int initCountdown = 0; - // DEBUG Enable to activate all buttons -#if 0 - setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[0], 1); - setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[1], 1); - setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[2], 1); -#endif - setBackground(0x80802626); setPalette(0x80802626); -- cgit v1.2.3 From 72e2fbc1ae68fd9c69445435b34c599b29ffdf58 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 11 Jun 2013 18:26:26 +0200 Subject: NEVERHOOD: Fix GCC warnings about shadowed variables --- engines/neverhood/console.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 917eae596f..eae6b92ba6 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -82,8 +82,8 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { } Common::String cheatName = argv[1]; - int module = _vm->_gameModule->getCurrentModuleNum(); - int scene = _vm->gameState().sceneNum; + int moduleNum = _vm->_gameModule->getCurrentModuleNum(); + int sceneNum = _vm->gameState().sceneNum; if (cheatName == "buttons") { Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; @@ -134,7 +134,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf("The radio has been enabled\n"); } else if (cheatName == "symbols") { - if (module == 1600 && scene == 8) { + if (moduleNum == 1600 && sceneNum == 8) { Scene1609 *scene = ((Scene1609 *)((Module1600 *)_vm->_gameModule->_childObject)->_childObject); for (int index = 0; index < 12; index++) { -- cgit v1.2.3 From eedf510c2dd0b31483acb9bde3f1eb80bbb26968 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 12 Jun 2013 08:22:41 +0200 Subject: HOPKINS: Fix glitch in Polish demo when leaving the first room Thanks Greencis for reporting it --- engines/hopkins/hopkins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 529997b259..305a805c58 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -235,7 +235,7 @@ bool HopkinsEngine::runWin95Demo() { _soundMan->removeSample(2); _soundMan->removeSample(3); _soundMan->removeSample(4); - _graphicsMan->fadeOutLong(); + _graphicsMan->fadeOutShort(); _globals->_saveData->_data[svBankAttackAnimPlayedFl] = 1; } _linesMan->setMaxLineIdx(5); -- cgit v1.2.3 From 9d489e82ce3925150485e5bf50653c81e553bbcb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Jun 2013 11:16:05 +0300 Subject: NEVERHOOD: Remove or silence by default some more debug output --- engines/neverhood/klaymen.cpp | 2 +- engines/neverhood/modules/module1000.cpp | 2 -- engines/neverhood/modules/module2200.cpp | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 06d606e18d..70567806fa 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -434,7 +434,7 @@ void Klaymen::stopWalking() { } void Klaymen::startIdleAnimation(uint32 fileHash, AnimationCb callback) { - debug("startIdleAnimation(%08X)", fileHash); + debug(1, "startIdleAnimation(%08X)", fileHash); NextState(callback); SetUpdateHandler(&Klaymen::upIdleAnimation); } diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index 2a5afe3617..a28d934cf6 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -27,8 +27,6 @@ namespace Neverhood { Module1000::Module1000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module1000(%d)", which); - _musicFileHash = getGlobalVar(V_ENTRANCE_OPEN) ? 0x81106480 : 0x00103144; _vm->_soundMan->addMusic(0x03294419, 0x061880C6); diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index 39e3788ea8..08ed274eb3 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -31,8 +31,6 @@ namespace Neverhood { Module2200::Module2200(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - debug("Create Module2200(%d)", which); - _vm->_soundMan->addMusic(0x11391412, 0x601C908C); if (which < 0) -- cgit v1.2.3 From 323fe8c45bc9e602c7d8a043210e67811bab9d38 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Jun 2013 11:17:41 +0300 Subject: NEVERHOOD: Stop all sounds before restoring / restarting This fixes the static heard when loading a saved game to a scene with music, when the current scene also has music --- engines/neverhood/gamemodule.cpp | 2 ++ engines/neverhood/sound.cpp | 46 +++++++++++++++++++++++++++++++++------- engines/neverhood/sound.h | 4 ++++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 70450e2918..96e8cc13a6 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -411,6 +411,8 @@ void GameModule::checkRequests() { } if (_restoreGameRequested) { _restoreGameRequested = false; + _vm->_audioResourceMan->stopAllSounds(); + _vm->_soundMan->stopAllSounds(); delete _childObject; delete _prevChildObject; _childObject = NULL; diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index c84b751e44..46ec8007b0 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -254,10 +254,26 @@ SoundMan::SoundMan(NeverhoodEngine *vm) } SoundMan::~SoundMan() { - for (uint i = 0; i < _soundItems.size(); ++i) - delete _soundItems[i]; - for (uint i = 0; i < _musicItems.size(); ++i) - delete _musicItems[i]; + stopAllSounds(); +} + +void SoundMan::stopAllSounds() { + for (uint i = 0; i < _soundItems.size(); ++i) { + if (_soundItems[i]) { + _soundItems[i]->stopSound(); + delete _soundItems[i]; + _soundItems[i] = NULL; + } + } + for (uint i = 0; i < _musicItems.size(); ++i) { + if (_musicItems[i]) { + _musicItems[i]->stopMusic(0, 0); + delete _musicItems[i]; + _musicItems[i] = NULL; + } + } + + _soundIndex1 = _soundIndex2 = _soundIndex3 = -1; } void SoundMan::addMusic(uint32 groupNameHash, uint32 musicFileHash) { @@ -708,11 +724,25 @@ AudioResourceMan::AudioResourceMan(NeverhoodEngine *vm) : _vm(vm) { } +void AudioResourceMan::stopAllSounds() { + for (uint i = 0; i < _soundItems.size(); ++i) { + if (_soundItems[i]) { + _soundItems[i]->stopSound(); + delete _soundItems[i]; + _soundItems[i] = NULL; + } + } + for (uint i = 0; i < _musicItems.size(); ++i) { + if (_musicItems[i]) { + _musicItems[i]->stopMusic(0); + delete _musicItems[i]; + _musicItems[i] = NULL; + } + } +} + AudioResourceMan::~AudioResourceMan() { - for (uint i = 0; i < _soundItems.size(); ++i) - delete _soundItems[i]; - for (uint i = 0; i < _musicItems.size(); ++i) - delete _musicItems[i]; + stopAllSounds(); } int16 AudioResourceMan::addSound(uint32 fileHash) { diff --git a/engines/neverhood/sound.h b/engines/neverhood/sound.h index d3318998db..aa5da284ea 100644 --- a/engines/neverhood/sound.h +++ b/engines/neverhood/sound.h @@ -129,6 +129,8 @@ public: SoundMan(NeverhoodEngine *vm); ~SoundMan(); + void stopAllSounds(); + // Music void addMusic(uint32 groupNameHash, uint32 musicFileHash); void deleteMusic(uint32 musicFileHash); @@ -262,6 +264,8 @@ public: AudioResourceMan(NeverhoodEngine *vm); ~AudioResourceMan(); + void stopAllSounds(); + int16 addSound(uint32 fileHash); void removeSound(int16 soundIndex); -- cgit v1.2.3 From 6bdc262c0728ed025b2c467db8018ede9104d5f3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Jun 2013 11:18:27 +0300 Subject: NEVERHOOD: Move some more cheat code to the cheat console command --- engines/neverhood/console.cpp | 4 ++++ engines/neverhood/modules/module2800.cpp | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index eae6b92ba6..411e5eceb7 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -76,6 +76,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf(" dice - shows the correct dice combination in the teddy bear puzzle, module 1100, scene 6\n"); DebugPrintf(" memory - solves the memory puzzle, module 1400, scene 4\n"); DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); + DebugPrintf(" music - shows the correct index in the radio music puzzle, module 2800, scene 1\n"); DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n"); return true; @@ -128,6 +129,9 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { } DebugPrintf("Puzzle solved\n"); + } else if (cheatName == "music") { + Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; + DebugPrintf("Good music index: %d, current radio music index: %d\n", scene->getGlobalVar(V_CURR_RADIO_MUSIC_INDEX), scene->getGlobalVar(V_GOOD_RADIO_MUSIC_INDEX)); } else if (cheatName == "radio") { Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; scene->setGlobalVar(V_RADIO_ENABLED, 1); diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index f359cc3caf..3d76d05762 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -616,10 +616,6 @@ void Scene2802::update() { if (prevTuneStatus != _currTuneStatus) changeTuneStatus(prevTuneStatus, _currTuneStatus); - //DEBUG>>> - //debug("_currRadioMusicIndex = %d; V_GOOD_RADIO_MUSIC_INDEX = %d", _currRadioMusicIndex, getGlobalVar(V_GOOD_RADIO_MUSIC_INDEX)); - //DEBUG<<< - if (getGlobalVar(V_RADIO_MOVE_DISH_VIDEO) && prevTuneStatus != _currTuneStatus && _currRadioMusicIndex != 0) { setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 0); leaveScene(1); -- cgit v1.2.3 From 09b235e2bd2abf5d4f377e955a8252aed30fc3af Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Jun 2013 11:25:19 +0300 Subject: NEVERHOOD: Fix a slight glitch with the symbols cheat command Now, the countdown to show the next symbol is properly reset when the command is used --- engines/neverhood/console.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 411e5eceb7..8db62d8487 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -147,6 +147,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { scene->_changeCurrentSymbol = false; scene->_symbolPosition = 11; + scene->_countdown1 = 36; DebugPrintf("Puzzle solved\n"); } else { -- cgit v1.2.3 From 4c13725a55fed393188a008a6e95a28e0c9c74c8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 12 Jun 2013 11:34:49 +0300 Subject: NEVERHOOD: Hook the dump vars debug code into a command, "dumpvars" Also, did some minor cleanup of the console commands (alphabetical reordering) --- engines/neverhood/console.cpp | 11 +++++++++-- engines/neverhood/console.h | 1 + engines/neverhood/gamevars.cpp | 5 +++-- engines/neverhood/gamevars.h | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 8db62d8487..7b5add65c7 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -30,9 +30,10 @@ namespace Neverhood { Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("cheat", WRAP_METHOD(Console, Cmd_Cheat)); + DCmd_Register("dumpvars", WRAP_METHOD(Console, Cmd_Dumpvars)); DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces)); - DCmd_Register("cheat", WRAP_METHOD(Console, Cmd_Cheat)); } Console::~Console() { @@ -75,8 +76,8 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf(" cannon - sets the correct cannon combination in module 3000, scene 8\n"); DebugPrintf(" dice - shows the correct dice combination in the teddy bear puzzle, module 1100, scene 6\n"); DebugPrintf(" memory - solves the memory puzzle, module 1400, scene 4\n"); - DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); DebugPrintf(" music - shows the correct index in the radio music puzzle, module 2800, scene 1\n"); + DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n"); return true; @@ -162,4 +163,10 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { return true; } +bool Console::Cmd_Dumpvars(int argc, const char **argv) { + _vm->_gameVars->dumpVars(this); + + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h index 7349820507..40c11b50e3 100644 --- a/engines/neverhood/console.h +++ b/engines/neverhood/console.h @@ -40,6 +40,7 @@ private: bool Cmd_Room(int argc, const char **argv); bool Cmd_Surfaces(int argc, const char **argv); bool Cmd_Cheat(int argc, const char **argv); + bool Cmd_Dumpvars(int argc, const char **argv); }; } // End of namespace Neverhood diff --git a/engines/neverhood/gamevars.cpp b/engines/neverhood/gamevars.cpp index 87f5fe6dd9..dc25f74e56 100644 --- a/engines/neverhood/gamevars.cpp +++ b/engines/neverhood/gamevars.cpp @@ -20,6 +20,7 @@ * */ +#include "neverhood/console.h" #include "neverhood/gamevars.h" namespace Neverhood { @@ -123,10 +124,10 @@ int16 GameVars::getSubVarIndex(int16 varIndex, uint32 subNameHash) { return subVarIndex; } -void GameVars::dumpVars() { +void GameVars::dumpVars(Console *con) { for (Common::Array::iterator it = _vars.begin(); it != _vars.end(); ++it) { GameVar gameVar = *it; - debug("%08X %08X %3d %3d", gameVar.nameHash, gameVar.value, gameVar.firstIndex, gameVar.nextIndex); + con->DebugPrintf("hash: %08X, var: %08X, first index: %3d, next index: %3d\n", gameVar.nameHash, gameVar.value, gameVar.firstIndex, gameVar.nextIndex); } } diff --git a/engines/neverhood/gamevars.h b/engines/neverhood/gamevars.h index 5337c13394..de9ffb8ec5 100644 --- a/engines/neverhood/gamevars.h +++ b/engines/neverhood/gamevars.h @@ -169,6 +169,8 @@ struct GameVar { int16 firstIndex, nextIndex; }; +class Console; + class GameVars { public: GameVars(); @@ -179,7 +181,7 @@ public: void setGlobalVar(uint32 nameHash, uint32 value); uint32 getSubVar(uint32 nameHash, uint32 subNameHash); void setSubVar(uint32 nameHash, uint32 subNameHash, uint32 value); - void dumpVars(); + void dumpVars(Console *con); protected: Common::Array _vars; int16 addVar(uint32 nameHash, uint32 value); -- cgit v1.2.3 From 49ec202701164cc5a6c985dd26c19c21305db8c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 14 Jun 2013 08:36:16 +0200 Subject: HOPKINS: Fix Heisenbug occuring when finishing the Polish demo Thanks Greencis for reporting it. --- engines/hopkins/hopkins.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 305a805c58..173c4d5f11 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1904,10 +1904,7 @@ void HopkinsEngine::bombExplosion() { } void HopkinsEngine::restoreSystem() { - // If the game isn't alerady trying to quit, flag that quitting is needed - if (!shouldQuit()) - quitGame(); - + quitGame(); _events->refreshEvents(); } -- cgit v1.2.3 From 2ca36ab53aa9e8a6c0e3a51779087bb0e8d00cb1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 15 Jun 2013 15:06:17 +0300 Subject: NEVERHOOD: Fix 2 off-by-one errors in the savegame slot selection box --- engines/neverhood/menumodule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index afa27543dc..368bfd60a7 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -821,7 +821,7 @@ void SavegameListBox::scrollUp() { } void SavegameListBox::scrollDown() { - if (_lastVisibleItem < (int)_textLabelItems.size()) { + if (_lastVisibleItem < (int)_textLabelItems.size() - 1) { ++_firstVisibleItem; ++_lastVisibleItem; refresh(); @@ -838,7 +838,7 @@ void SavegameListBox::pageUp() { } void SavegameListBox::pageDown() { - int amount = MIN((int)_textLabelItems.size() - _lastVisibleItem, _maxVisibleItemsCount); + int amount = MIN((int)_textLabelItems.size() - _lastVisibleItem - 1, _maxVisibleItemsCount); if (amount > 0) { _firstVisibleItem += amount; _lastVisibleItem += amount; -- cgit v1.2.3 From 869999f3c6193505a1c3ac0090c436213a63e850 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Jun 2013 14:59:05 +0200 Subject: Hopkins: Add some comments --- engines/hopkins/hopkins.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 173c4d5f11..5fdcb82243 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -201,12 +201,15 @@ bool HopkinsEngine::runWin95Demo() { switch (_globals->_exitId) { case 1: + // Handles room: Apartment _linesMan->setMaxLineIdx(40); _globals->_characterMaxPosY = 435; _objectsMan->sceneControl2("IM01", "IM01", "ANIM01", "IM01", 2, true); break; case 3: + // - Displays bank attack when leaving the apartment + // - Handles room: bottom of the apartment if (!_globals->_saveData->_data[svBankAttackAnimPlayedFl]) { _soundMan->playSound(3); if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS) @@ -244,12 +247,14 @@ bool HopkinsEngine::runWin95Demo() { break; case 4: + // Handle room: City map _globals->_disableInventFl = true; _objectsMan->handleCityMap(); _globals->_disableInventFl = false; break; case 5: + // Handle room: Outside the bank _linesMan->setMaxLineIdx(5); _globals->_characterMaxPosY = 455; -- cgit v1.2.3 From f0233216c8cc0c87af903a177108586fa3aea907 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Jun 2013 15:00:09 +0200 Subject: HOPKINS: Fix glitch before entering bank, in Windows demo Thanks Greencis for reporting it --- engines/hopkins/script.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index c39273203d..78339ce1a6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -536,6 +536,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 12: + // Bank - negotiations between Hopkins and one of the killers _vm->_fontMan->hideText(9); _vm->_events->refreshScreenAndEvents(); _vm->_events->refreshScreenAndEvents(); @@ -543,6 +544,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 13: + // Bank - after negotiations, Hopkins enters the bank _vm->_events->_mouseButton = _vm->_events->_curMouseButton; _vm->_globals->_disableInventFl = true; _vm->_graphicsMan->fadeOutLong(); @@ -553,9 +555,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { _vm->_graphicsMan->endDisplayBob(); _vm->_objectsMan->clearScreen(); - if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) { - _vm->_graphicsMan->fadeOutLong(); - } else { + if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) { _vm->_soundMan->playSoundFile("SOUND17.WAV"); _vm->_graphicsMan->_fadingFl = true; _vm->_animMan->playSequence2("HELICO.SEQ", 10, 4, 10); -- cgit v1.2.3 From c2475c9c546a072ab8138c6524f025942b22adba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 17 Jun 2013 08:23:19 +0200 Subject: HOPKINS: Fix a glitch on the roof of the bank, in Windows demo Thanks Greencis for reporting it --- engines/hopkins/script.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 78339ce1a6..7868e52be6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -615,10 +615,6 @@ int ScriptManager::handleOpcode(const byte *dataP) { _vm->_graphicsMan->_fadingFl = true; _vm->_animMan->playSequence2("ASSOM.SEQ", 10, 4, 500); _vm->_soundMan->_specialSoundNum = 0; - - if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) - _vm->_graphicsMan->fadeOutLong(); - _vm->_globals->_disableInventFl = false; _vm->_objectsMan->_helicopterFl = true; break; -- cgit v1.2.3 From f449268380baf0cfa015162903f7e65222146ef0 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Mon, 17 Jun 2013 09:21:16 +0200 Subject: NEVERHOOD: Fix Smacker errors in Scene1317 (bug #3613666) --- engines/neverhood/modules/module1300.cpp | 2 ++ engines/neverhood/scene.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index a60fb25f52..cc5c22085c 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -1711,6 +1711,7 @@ Scene1317::Scene1317(NeverhoodEngine *vm, Module *parentModule) void Scene1317::update() { if (_smackerFileHash) { _smackerPlayer->open(_smackerFileHash, _keepLastSmackerFrame); + _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); _smackerFileHash = 0; } Scene::update(); @@ -1733,6 +1734,7 @@ void Scene1317::upChooseKing() { if (_smackerFileHash) { _smackerPlayer->open(_smackerFileHash, _keepLastSmackerFrame); + _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); _smackerFileHash = 0; } diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index c65bd3781d..80a2b69169 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -59,6 +59,8 @@ Scene::Scene(NeverhoodEngine *vm, Module *parentModule) Scene::~Scene() { + _vm->_screen->setSmackerDecoder(NULL); + if (_palette) { removeEntity(_palette); delete _palette; -- cgit v1.2.3 From 61b4981b120ae0c75d05f6f2c5012e269abb9f57 Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 7 Jun 2013 18:23:59 +1000 Subject: BACKENDS: fix FTBFS on GNU Hurd by replacing MAXHOSTNAMELEN with NI_MAXHOST Bug-ScummVM: https://sourceforge.net/tracker/?func=detail&atid=418820&aid=3614268&group_id=37116 See more in similar http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=387665 --- backends/midi/timidity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index 5cefe668cd..d2c60bec9d 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -148,7 +148,7 @@ MidiDriver_TIMIDITY::MidiDriver_TIMIDITY() { int MidiDriver_TIMIDITY::open() { char *res; - char timidity_host[MAXHOSTNAMELEN]; + char timidity_host[NI_MAXHOST]; int timidity_port, data_port, i; /* count ourselves open */ -- cgit v1.2.3 From 4b6907141b82b2f38fab5d13ffab4081a8d2264d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 17 Jun 2013 21:08:29 +0300 Subject: TINSEL: Fix incorrect byte swapping on BE systems (bug #3614416) This is a regression from commit c90d56355fa0bbcdd3122f3e376e5609422338b3 Thanks to canavan for his testing and bisecting work --- engines/tinsel/scene.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index b652e394a0..17cb23b98f 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -130,14 +130,14 @@ const SCENE_STRUC *GetSceneStruc(const byte *pStruc) { const byte *p = pStruc; memset(&g_tempStruc, 0, sizeof(SCENE_STRUC)); - g_tempStruc.numEntrance = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.numPoly = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.numTaggedActor = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.defRefer = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.hSceneScript = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.hEntrance = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.hPoly = FROM_LE_32(READ_32(p)); p += sizeof(uint32); - g_tempStruc.hTaggedActor = FROM_LE_32(READ_32(p)); p += sizeof(uint32); + g_tempStruc.numEntrance = READ_32(p); p += sizeof(uint32); + g_tempStruc.numPoly = READ_32(p); p += sizeof(uint32); + g_tempStruc.numTaggedActor = READ_32(p); p += sizeof(uint32); + g_tempStruc.defRefer = READ_32(p); p += sizeof(uint32); + g_tempStruc.hSceneScript = READ_32(p); p += sizeof(uint32); + g_tempStruc.hEntrance = READ_32(p); p += sizeof(uint32); + g_tempStruc.hPoly = READ_32(p); p += sizeof(uint32); + g_tempStruc.hTaggedActor = READ_32(p); p += sizeof(uint32); return &g_tempStruc; } -- cgit v1.2.3 From c48a7ee0e327dd75882a505bbb7c1bbdc4af9604 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 17 Jun 2013 21:14:59 +0300 Subject: SKY: Fix double scene init when the intro is skipped (bug #3512069) --- engines/sky/sky.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index fd90015aa3..4c47dfafc7 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -187,9 +187,14 @@ Common::Error SkyEngine::go() { } if (!shouldQuit()) { - _skyLogic->initScreen0(); + // restartGame() takes us to the first scene, without showing the + // initial animation where Foster is being chased. initScreen0() + // shows the first scene together with that animation. We can't + // call both, as they both load the same scene. if (introSkipped) _skyControl->restartGame(); + else + _skyLogic->initScreen0(); } } -- cgit v1.2.3 From 7cc19bf29d391801fe8a720b36fce311fdcdd9a0 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 01:35:49 +0200 Subject: WINTERMUTE: Avoid explicitly including --- engines/wintermute/base/scriptables/script_ext_math.cpp | 1 - engines/wintermute/math/math_util.cpp | 2 +- engines/wintermute/math/matrix4.cpp | 2 +- engines/wintermute/math/vector2.cpp | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index d816fbec65..f4c6be2d6c 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -31,7 +31,6 @@ #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/persistent.h" #include "common/math.h" -#include namespace Wintermute { diff --git a/engines/wintermute/math/math_util.cpp b/engines/wintermute/math/math_util.cpp index 31af77538a..0aa0f841ac 100644 --- a/engines/wintermute/math/math_util.cpp +++ b/engines/wintermute/math/math_util.cpp @@ -27,7 +27,7 @@ */ #include "engines/wintermute/math/math_util.h" -#include +#include "common/scummsys.h" namespace Wintermute { diff --git a/engines/wintermute/math/matrix4.cpp b/engines/wintermute/math/matrix4.cpp index ca1eae8813..a50514457e 100644 --- a/engines/wintermute/math/matrix4.cpp +++ b/engines/wintermute/math/matrix4.cpp @@ -28,7 +28,7 @@ #include "engines/wintermute/math/matrix4.h" #include "engines/wintermute/math/vector2.h" -#include +#include "common/scummsys.h" namespace Wintermute { diff --git a/engines/wintermute/math/vector2.cpp b/engines/wintermute/math/vector2.cpp index 74c5586d62..98dca70b44 100644 --- a/engines/wintermute/math/vector2.cpp +++ b/engines/wintermute/math/vector2.cpp @@ -27,7 +27,7 @@ */ #include "engines/wintermute/math/vector2.h" -#include +#include "common/scummsys.h" namespace Wintermute { -- cgit v1.2.3 From 6e3510ac6154783a99b58bfae83c86145954435f Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 18 Jun 2013 18:46:54 +0200 Subject: SCI: Add note about LSL1vga DoSoundSendMidi --- engines/sci/sound/soundcmd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index daba976f50..9f3deca8ff 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -534,8 +534,11 @@ reg_t SoundCommandParser::kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc) { byte channel = argv[1].toUint16() & 0xf; byte midiCmd = argv[2].toUint16() & 0xff; - // TODO: first there is a 4-parameter variant of this call which needs to get reversed - // second the current code isn't 100% accurate, sierra sci does checks on the 4th parameter + // TODO: There is a 4 parameter variant of this call, + // used by at least lsl1vga. + // It lacks a midiCmd argument, but for this variant midiCmd defaults to + // 0xB0 (controller). If argv[2] is 0xFF, midiCmd is 0xE0 + // (pitchwheel). The exact parameters need to be investigated further. if (argc == 4) return acc; -- cgit v1.2.3 From 6db82968fba459bf41d30ca6b6ebfcf9f1276729 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 22:05:15 +0200 Subject: Revert "WINTERMUTE: Prevent warning about duplicate files when autodetecting." This reverts commit 4401f40f7203f7aaa78c2e1c904c70902325436c. --- engines/wintermute/wintermute.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 92381742de..89a6f1b3e0 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -292,6 +292,7 @@ bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String Common::SeekableReadStream *stream = nullptr; // Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG, true); + fileMan->registerPackages(fslist); stream = fileMan->openFile("startup.settings", false, false); // The process is as follows: Check the "GAME=" tag in startup.settings, to decide where the -- cgit v1.2.3 From 1e1e502628f23425ea489fb9f646eef0d786f8e5 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 22:15:09 +0200 Subject: WINTERMUTE: Add detection entry for Beyond the Threshold. --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 00ec51a715..ce35e95d6c 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -27,6 +27,7 @@ namespace Wintermute { static const PlainGameDescriptor wintermuteGames[] = { {"5ld", "Five Lethal Demons"}, {"5ma", "Five Magical Amulets"}, + {"bthreshold", "Beyond the Threshold"}, {"actualdest", "Actual Destination"}, {"carolreed4", "Carol Reed 4 - East Side Story"}, {"carolreed5", "Carol Reed 5 - The Colour of Murder"}, @@ -83,6 +84,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Beyond the Threshold + { + "bthreshold", + "", + AD_ENTRY1s("data.dcp", "d49bf9ccb2e74507447c82d6ad3e2bc4", 12773712), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Carol Reed 4 - East Side Story (Demo) { "carolreed4", -- cgit v1.2.3 From c3022b537a02cc1af2bd691ece53fb25855ff6f1 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 22:27:19 +0200 Subject: WINTERMUTE: Minor formatting fix. --- engines/wintermute/detection_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index ce35e95d6c..eb04fd7ba5 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -45,7 +45,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"mirage", "Mirage"}, {"pigeons", "Pigeons in the Park"}, {"reversion1", "Reversion: The Escape"}, - {"reversion2", "Reversion: The Meeting"}, + {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, {"thebox", "The Box"}, {"twc", "the white chamber"}, -- cgit v1.2.3 From 4f98984fbd45f9ec708facad2ceaf7df5f6dbb46 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 22:29:13 +0200 Subject: WINTERMUTE: Add detection entry for The Trader of Stories (Demo) --- engines/wintermute/detection_tables.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index eb04fd7ba5..8fb45dc8b9 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -48,6 +48,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, {"thebox", "The Box"}, + {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, {"wintermute", "Wintermute engine game"}, {0, 0} @@ -556,6 +557,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // The Trader of Stories + { + "tradestory", + "Demo", + AD_ENTRY1s("data.dcp", "0a0b51191636cc8ead89b905281c3218", 40401902), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // the white chamber (multi-language) { "twc", -- cgit v1.2.3 From e61f1bd091f7fb5beb9a2037427a6d5ed2dc3793 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 18 Jun 2013 23:05:21 +0200 Subject: WINTERMUTE: Add detection for Des Reves Elastiques Avec Mille Insectes Nommes Georges With the accents removed to avoid breaking encoding. --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 8fb45dc8b9..9f654dc4b7 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -37,6 +37,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"carolreed9", "Carol Reed 9 - Cold Case Summer"}, {"chivalry", "Chivalry is Not Dead"}, {"deadcity", "Dead City"}, + {"dreaming", "Des Reves Elastiques Avec Mille Insectes Nommes Georges"}, {"dirtysplit", "Dirty Split"}, {"dreamscape", "Dreamscape"}, {"ghostsheet", "Ghost in the Sheet"}, @@ -249,6 +250,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Des Reves Elastiques Avec Mille Insectes Nommes Georges + { + "dreaming", + "", + AD_ENTRY1s("data.dcp", "4af26d97ea063fc1277ce30ae431de90", 8804073), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dreamscape { "dreamscape", -- cgit v1.2.3 From 233cbb13b8a0f28d63e2a9cacd914024579566d9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Jun 2013 23:16:17 +0200 Subject: CRUISE: Remove useless fields in CRUISEGameDescription --- engines/cruise/cruise.h | 4 ---- engines/cruise/detection.cpp | 37 +------------------------------------ 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h index 9782df8f09..3e49e77770 100644 --- a/engines/cruise/cruise.h +++ b/engines/cruise/cruise.h @@ -43,10 +43,6 @@ */ namespace Cruise { -enum CruiseGameType { - GType_CRUISE = 1 -}; - #define GAME_FRAME_DELAY_1 50 #define GAME_FRAME_DELAY_2 100 diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp index b632e4ea7a..bce3f184db 100644 --- a/engines/cruise/detection.cpp +++ b/engines/cruise/detection.cpp @@ -20,8 +20,6 @@ * */ - - #include "base/plugins.h" #include "common/savefile.h" #include "common/system.h" @@ -34,21 +32,12 @@ namespace Cruise { struct CRUISEGameDescription { ADGameDescription desc; - - int gameType; - uint32 features; }; const char *CruiseEngine::getGameId() const { return _gameDescription->desc.gameid; } -int CruiseEngine::getGameType() const { - return _gameDescription->gameType; -} -uint32 CruiseEngine::getFeatures() const { - return _gameDescription->features; -} Common::Language CruiseEngine::getLanguage() const { return _gameDescription->desc.language; } @@ -77,8 +66,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -90,8 +77,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -103,8 +88,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -116,8 +99,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -129,8 +110,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -142,8 +121,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -155,8 +132,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { // Amiga English US GOLD edition. { @@ -168,8 +143,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { // Amiga Italian US GOLD edition. { @@ -181,8 +154,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { // AtariST English KixxXL edition. { @@ -194,8 +165,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -207,8 +176,6 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, { { @@ -220,10 +187,8 @@ static const CRUISEGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - GType_CRUISE, - 0, }, - {AD_TABLE_END_MARKER, 0, 0} + {AD_TABLE_END_MARKER} }; } -- cgit v1.2.3 From 8c31fa9cbaf1ede3387416697cf62172ca16fc96 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Jun 2013 23:52:43 +0200 Subject: HOPKINS: Fix glitch occurring when skipping the flight cut scene. Thanks Greencis for reporting it --- engines/hopkins/hopkins.cpp | 4 ++++ engines/hopkins/script.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5fdcb82243..81dbcabd57 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1158,6 +1158,7 @@ bool HopkinsEngine::runFull() { break; case 34: + // In the airport, before the flight cut-scene _objectsMan->sceneControl("IM34", "IM34", "ANIM34", "IM34", 2, false); break; @@ -1188,6 +1189,7 @@ bool HopkinsEngine::runFull() { } case 50: + // Flight cut scene playPlaneCutscene(); _globals->_exitId = 51; break; @@ -2234,6 +2236,8 @@ void HopkinsEngine::playPlaneCutscene() { if (!_events->_escKeyFl) { _graphicsMan->_fadingFl = true; _animMan->playAnim("PARA00A.ANM", "PARA00.ANM", 9, 9, 9); + } else { + _graphicsMan->fadeOutShort(); } _events->_escKeyFl = false; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7868e52be6..3d298b2e9e 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1980,6 +1980,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 216: + // Discuss with pilot just before Flight cutscene _vm->_globals->_introSpeechOffFl = true; _vm->_talkMan->startAnimatedCharacterDialogue("aviat1.pe2"); _vm->_globals->_introSpeechOffFl = false; -- cgit v1.2.3 From 7ffaa3936d139a0604ff99c8866e58348938fc38 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 19 Jun 2013 00:15:09 +0200 Subject: WINTERMUTE: Add detection for James Peris: No License Nor Control (demo) --- engines/wintermute/detection_tables.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 9f654dc4b7..a4eca5ef41 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -42,6 +42,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"dreamscape", "Dreamscape"}, {"ghostsheet", "Ghost in the Sheet"}, {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, + {"jamesperis", "James Peris: No License Nor Control"}, {"julia", "J.U.L.I.A."}, {"mirage", "Mirage"}, {"pigeons", "Pigeons in the Park"}, @@ -291,6 +292,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // James Peris: No License Nor Control + { + "jamesperis", + "Demo", + AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // J.U.L.I.A. (English) { "julia", -- cgit v1.2.3 From b490801e6402e24754954eea1ff88f1d792e8dde Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 19 Jun 2013 00:42:17 +0200 Subject: WINTERMUTE: Set language of James Peris to unknown for now. The selection is done via registry, so no easy fix is available yet. --- engines/wintermute/detection_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index a4eca5ef41..ad4256e6b9 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -297,7 +297,7 @@ static const ADGameDescription gameDescriptions[] = { "jamesperis", "Demo", AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), - Common::EN_ANY, + Common::UNK_LANG, // No solution in place to select language Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DEMO, -- cgit v1.2.3 From 125b146b06945eb738f8d0358ce1c1ede1208f81 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 19 Jun 2013 02:02:05 +0300 Subject: SCI: Implement the 4-param version of kDoSoundSendMidi - bug #3614447 Many thanks to wjp for his help with disassembly --- engines/sci/sound/soundcmd.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 9f3deca8ff..b0102a002b 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -530,20 +530,21 @@ void SoundCommandParser::processUpdateCues(reg_t obj) { } reg_t SoundCommandParser::kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc) { + // The 4 parameter variant of this call is used in at least LSL1VGA, room + // 110 (Lefty's bar), to distort the music when Larry is drunk and stands + // up - bug #3614447. reg_t obj = argv[0]; byte channel = argv[1].toUint16() & 0xf; - byte midiCmd = argv[2].toUint16() & 0xff; - - // TODO: There is a 4 parameter variant of this call, - // used by at least lsl1vga. - // It lacks a midiCmd argument, but for this variant midiCmd defaults to - // 0xB0 (controller). If argv[2] is 0xFF, midiCmd is 0xE0 - // (pitchwheel). The exact parameters need to be investigated further. - if (argc == 4) - return acc; + byte midiCmd = (argc == 5) ? argv[2].toUint16() & 0xff : 0xB0; // 0xB0: controller + uint16 controller = (argc == 5) ? argv[3].toUint16() : argv[2].toUint16(); + uint16 param = (argc == 5) ? argv[4].toUint16() : argv[3].toUint16(); - uint16 controller = argv[3].toUint16(); - uint16 param = argv[4].toUint16(); + if (argc == 4 && controller == 0xFF) { + midiCmd = 0xE0; // 0xE0: pitch wheel + uint16 pitch = CLIP(argv[3].toSint16() + 0x2000, 0x0000, 0x3FFF); + controller = pitch & 0x7F; + param = pitch >> 7; + } debugC(kDebugLevelSound, "kDoSound(sendMidi): %04x:%04x, %d, %d, %d, %d", PRINT_REG(obj), channel, midiCmd, controller, param); if (channel) -- cgit v1.2.3 From e5e467f5a1dffde7f4371a7c585351188677f746 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 19 Nov 2012 13:13:36 -0500 Subject: CONFIGURE: Add libmpeg2 as an optional dependency again --- configure | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/configure b/configure index dbd78d3f9d..41d96fbf72 100755 --- a/configure +++ b/configure @@ -113,6 +113,7 @@ _seq_midi=auto _sndio=auto _timidity=auto _zlib=auto +_mpeg2=auto _sparkle=auto _png=auto _theoradec=auto @@ -924,6 +925,9 @@ Optional Libraries: --with-zlib-prefix=DIR Prefix where zlib is installed (optional) --disable-zlib disable zlib (compression) support [autodetect] + --with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional) + --enable-mpeg2 enable mpeg2 codec for cutscenes [autodetect] + --with-opengl-prefix=DIR Prefix where OpenGL (ES) is installed (optional) --disable-opengl disable OpenGL (ES) support [autodetect] @@ -1004,6 +1008,8 @@ for ac_option in $@; do --disable-sparkle) _sparkle=no ;; --enable-nasm) _nasm=yes ;; --disable-nasm) _nasm=no ;; + --enable-mpeg2) _mpeg2=yes ;; + --disable-mpeg2) _mpeg2=no ;; --disable-png) _png=no ;; --enable-png) _png=yes ;; --disable-theoradec) _theoradec=no ;; @@ -1043,6 +1049,11 @@ for ac_option in $@; do FLUIDSYNTH_CFLAGS="-I$arg/include" FLUIDSYNTH_LIBS="-L$arg/lib" ;; + --with-mpeg2-prefix=*) + arg=`echo $ac_option | cut -d '=' -f 2` + MPEG2_CFLAGS="-I$arg/include" + MPEG2_LIBS="-L$arg/lib" + ;; --with-alsa-prefix=*) arg=`echo $ac_option | cut -d '=' -f 2` ALSA_CFLAGS="-I$arg/include" @@ -3460,6 +3471,49 @@ fi define_in_config_if_yes "$_zlib" 'USE_ZLIB' echo "$_zlib" +# +# Check for LibMPEG2 +# +echocheck "libmpeg2 >= 0.3.2" +if test "$_mpeg2" = auto ; then + _mpeg2=no + cat > $TMPC << EOF +typedef signed $type_1_byte int8_t; +typedef signed $type_2_byte int16_t; +typedef signed $type_4_byte int32_t; + +typedef unsigned $type_1_byte uint8_t; +typedef unsigned $type_2_byte uint16_t; +typedef unsigned $type_4_byte uint32_t; + +#include +int main(void) { + /* mpeg2_state_t first appears in 0.4.0 */ + mpeg2_state_t state; + + #ifdef MPEG2_RELEASE + if (MPEG2_RELEASE >= MPEG2_VERSION(0, 3, 2)) + return 0; + #endif + return 1; +} +EOF + + if test -n "$_host"; then + # don't execute while cross compiling + cc_check $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && _mpeg2=yes + else + cc_check_no_clean $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO$HOSTEXEEXT && _mpeg2=yes + cc_check_clean + fi +fi +if test "$_mpeg2" = yes ; then + INCLUDES="$INCLUDES $MPEG2_CFLAGS" + LIBS="$LIBS $MPEG2_LIBS -lmpeg2" +fi +define_in_config_if_yes "$_mpeg2" 'USE_MPEG2' +echo "$_mpeg2" + # # Check for Sparkle if updates support is enabled # -- cgit v1.2.3 From 36bc47df446f1580edf15a407228579291196b4a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 19 Jun 2013 23:59:04 -0400 Subject: VIDEO: Add an MPEG 1/2 decoder --- video/codecs/mpeg.cpp | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ video/codecs/mpeg.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ video/module.mk | 5 +++ 3 files changed, 210 insertions(+) create mode 100644 video/codecs/mpeg.cpp create mode 100644 video/codecs/mpeg.h diff --git a/video/codecs/mpeg.cpp b/video/codecs/mpeg.cpp new file mode 100644 index 0000000000..cb3c63fcfc --- /dev/null +++ b/video/codecs/mpeg.cpp @@ -0,0 +1,107 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/debug.h" +#include "common/stream.h" +#include "common/system.h" +#include "common/textconsole.h" +#include "graphics/surface.h" +#include "graphics/yuv_to_rgb.h" + +#include "video/codecs/mpeg.h" + +namespace Video { + +MPEGDecoder::MPEGDecoder() : Codec() { + _pixelFormat = g_system->getScreenFormat(); + _surface = 0; + + _mpegDecoder = mpeg2_init(); + + if (!_mpegDecoder) + error("Could not initialize libmpeg2"); + + _mpegInfo = mpeg2_info(_mpegDecoder); +} + +MPEGDecoder::~MPEGDecoder() { + mpeg2_close(_mpegDecoder); + + if (_surface) { + _surface->free(); + delete _surface; + } +} + +const Graphics::Surface *MPEGDecoder::decodeImage(Common::SeekableReadStream *stream) { + uint32 framePeriod; + decodePacket(stream, framePeriod); + return _surface; +} + +bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32 &framePeriod, Graphics::Surface *dst) { + // Decode as much as we can out of this packet + uint32 size = 0xFFFFFFFF; + mpeg2_state_t state; + bool foundFrame = false; + framePeriod = 0; + + do { + state = mpeg2_parse(_mpegDecoder); + + switch (state) { + case STATE_BUFFER: + size = packet->read(_buffer, BUFFER_SIZE); + mpeg2_buffer(_mpegDecoder, _buffer, _buffer + size); + break; + case STATE_SLICE: + case STATE_END: + if (_mpegInfo->display_fbuf) { + foundFrame = true; + const mpeg2_sequence_t *sequence = _mpegInfo->sequence; + + framePeriod += sequence->frame_period; + + if (!dst) { + // If no destination is specified, use our internal storage + if (!_surface) { + _surface = new Graphics::Surface(); + _surface->create(sequence->picture_width, sequence->picture_height, _pixelFormat); + } + + dst = _surface; + } + + YUVToRGBMan.convert420(dst, Graphics::YUVToRGBManager::kScaleITU, _mpegInfo->display_fbuf->buf[0], + _mpegInfo->display_fbuf->buf[1], _mpegInfo->display_fbuf->buf[2], sequence->picture_width, + sequence->picture_height, sequence->width, sequence->chroma_width); + } + break; + default: + break; + } + } while (size != 0); + + return foundFrame; +} + +} // End of namespace Video diff --git a/video/codecs/mpeg.h b/video/codecs/mpeg.h new file mode 100644 index 0000000000..0082844537 --- /dev/null +++ b/video/codecs/mpeg.h @@ -0,0 +1,98 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef USE_MPEG2 + +#ifndef VIDEO_CODECS_MPEG_H +#define VIDEO_CODECS_MPEG_H + +#include "video/codecs/codec.h" +#include "graphics/pixelformat.h" + +#if defined(__PLAYSTATION2__) + typedef uint8 uint8_t; + typedef uint16 uint16_t; + typedef uint32 uint32_t; +#elif defined(_WIN32_WCE) + typedef signed char int8_t; + typedef signed short int16_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; +#elif defined(_MSC_VER) + typedef signed char int8_t; + typedef signed short int16_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + #if !defined(SDL_COMPILEDVERSION) || (SDL_COMPILEDVERSION < 1210) + typedef signed long int32_t; + typedef unsigned long uint32_t; + #endif +#else +# include +#endif + +extern "C" { + #include +} + +namespace Common { +class SeekableReadStream; +} + +namespace Graphics { +struct Surface; +} + +namespace Video { + +// MPEG 1/2 video decoder + +class MPEGDecoder : public Codec { +public: + MPEGDecoder(); + ~MPEGDecoder(); + + // Codec interface + const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); + Graphics::PixelFormat getPixelFormat() const { return _pixelFormat; } + + // MPEGPSDecoder call + bool decodePacket(Common::SeekableReadStream *packet, uint32 &framePeriod, Graphics::Surface *dst = 0); + +private: + Graphics::PixelFormat _pixelFormat; + Graphics::Surface *_surface; + + enum { + BUFFER_SIZE = 4096 + }; + + byte _buffer[BUFFER_SIZE]; + mpeg2dec_t *_mpegDecoder; + const mpeg2_info_t *_mpegInfo; +}; + +} // End of namespace Video + +#endif // VIDEO_CODECS_MPEG_H + +#endif // USE_MPEG2 diff --git a/video/module.mk b/video/module.mk index 287e14ce18..a491947aaf 100644 --- a/video/module.mk +++ b/video/module.mk @@ -31,5 +31,10 @@ MODULE_OBJS += \ theora_decoder.o endif +ifdef USE_MPEG2 +MODULE_OBJS += \ + codecs/mpeg.o +endif + # Include common rules include $(srcdir)/rules.mk -- cgit v1.2.3 From 0b81e59d0ad5955c82c26817d6a3260242e794e4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 28 Nov 2012 18:56:13 -0500 Subject: VIDEO: Update AVI code for parsing sword1/sword2 MPEG-2 files --- video/avi_decoder.cpp | 42 +++++++++++++++++++++++++++--------------- video/avi_decoder.h | 2 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 6fe9c773b8..8553642b7c 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -64,8 +64,8 @@ namespace Video { #define ID_VEDT MKTAG('v','e','d','t') #define ID_IDX1 MKTAG('i','d','x','1') #define ID_STRD MKTAG('s','t','r','d') -#define ID_00AM MKTAG('0','0','A','M') //#define ID_INFO MKTAG('I','N','F','O') +#define ID_ISFT MKTAG('I','S','F','T') // Codec tags #define ID_RLE MKTAG('R','L','E',' ') @@ -75,6 +75,7 @@ namespace Video { #define ID_CVID MKTAG('c','v','i','d') #define ID_IV32 MKTAG('i','v','3','2') #define ID_DUCK MKTAG('D','U','C','K') +#define ID_MPG2 MKTAG('m','p','g','2') static byte char2num(char c) { c = tolower((byte)c); @@ -91,6 +92,7 @@ static uint16 getStreamType(uint32 tag) { AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { _decodedHeader = false; + _foundMovieList = false; _fileStream = 0; memset(&_ixInfo, 0, sizeof(_ixInfo)); memset(&_header, 0, sizeof(_header)); @@ -137,6 +139,7 @@ void AVIDecoder::runHandle(uint32 tag) { case ID_STRD: // Extra stream info, safe to ignore case ID_VEDT: // Unknown, safe to ignore case ID_JUNK: // Alignment bytes, should be ignored + case ID_ISFT: // Metadata, safe to ignore { uint32 junkSize = _fileStream->readUint32LE(); _fileStream->skip(junkSize + (junkSize & 1)); // Alignment @@ -165,6 +168,13 @@ void AVIDecoder::handleList() { debug(0, "Found LIST of type %s", tag2str(listType)); + if (listType == ID_MOVI) { + // Found the 'movi' list + // We're done parsing everything + _foundMovieList = true; + return; + } + while ((_fileStream->pos() - curPos) < listSize) runHandle(_fileStream->readUint32BE()); @@ -263,26 +273,24 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { _fileStream = stream; _decodedHeader = false; + _foundMovieList = false; // Read chunks until we have decoded the header - while (!_decodedHeader) + while (!_decodedHeader && _fileStream->pos() < _fileStream->size()) runHandle(_fileStream->readUint32BE()); - uint32 nextTag = _fileStream->readUint32BE(); - - // Throw out any JUNK section - if (nextTag == ID_JUNK) { - runHandle(ID_JUNK); - nextTag = _fileStream->readUint32BE(); + if (_fileStream->pos() >= _fileStream->size()) { + warning("Failed to find AVI header"); + return false; } - // Ignore the 'movi' LIST - if (nextTag == ID_LIST) { - _fileStream->readUint32BE(); // Skip size - if (_fileStream->readUint32BE() != ID_MOVI) - error("Expected 'movi' LIST"); - } else { - error("Expected 'movi' LIST"); + // Then read until we find the movie list + while (!_foundMovieList && _fileStream->pos() < _fileStream->size()) + runHandle(_fileStream->readUint32BE()); + + if (_fileStream->pos() >= _fileStream->size()) { + warning("Failed to find AVI 'movi' LIST"); + return false; } return true; @@ -294,6 +302,7 @@ void AVIDecoder::close() { delete _fileStream; _fileStream = 0; _decodedHeader = false; + _foundMovieList = false; delete[] _ixInfo.indices; memset(&_ixInfo, 0, sizeof(_ixInfo)); @@ -428,6 +437,9 @@ Codec *AVIDecoder::AVIVideoTrack::createCodec() { case ID_DUCK: return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height); #endif + case ID_MPG2: + warning("Unhandled MPEG-2 codec in AVI file"); + break; default: warning("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler)); } diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 34a67f4c28..bc870eac33 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -219,7 +219,7 @@ private: AVIHeader _header; Common::SeekableReadStream *_fileStream; - bool _decodedHeader; + bool _decodedHeader, _foundMovieList; Audio::Mixer::SoundType _soundType; -- cgit v1.2.3 From f39c9d58bddc558a3322137684190983ea403d52 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 28 Nov 2012 19:33:42 -0500 Subject: VIDEO: Hook up MPEG decoder to AVI --- video/avi_decoder.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 8553642b7c..32238eca4e 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -36,6 +36,7 @@ // Video Codecs #include "video/codecs/cinepak.h" #include "video/codecs/indeo3.h" +#include "video/codecs/mpeg.h" #include "video/codecs/msvideo1.h" #include "video/codecs/msrle.h" #include "video/codecs/truemotion1.h" @@ -437,9 +438,10 @@ Codec *AVIDecoder::AVIVideoTrack::createCodec() { case ID_DUCK: return new TrueMotion1Decoder(_bmInfo.width, _bmInfo.height); #endif +#ifdef USE_MPEG2 case ID_MPG2: - warning("Unhandled MPEG-2 codec in AVI file"); - break; + return new MPEGDecoder(); +#endif default: warning("Unknown/Unhandled compression format \'%s\'", tag2str(_vidsHeader.streamHandler)); } -- cgit v1.2.3 From aa2d41701d14a651c23c4e2a4c5098a300f2235f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 29 Nov 2012 15:50:43 -0500 Subject: VIDEO: Allow AVI frame rate to be overriden with a constant Required for sword1/sword2 MPEG videos --- video/avi_decoder.cpp | 24 +++++++++++++++++++----- video/avi_decoder.h | 3 +++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 32238eca4e..ff728a8437 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -91,7 +91,20 @@ static uint16 getStreamType(uint32 tag) { return tag & 0xffff; } -AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) { +AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) { + initCommon(); +} + +AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType) + : _frameRateOverride(frameRateOverride), _soundType(soundType) { + initCommon(); +} + +AVIDecoder::~AVIDecoder() { + close(); +} + +void AVIDecoder::initCommon() { _decodedHeader = false; _foundMovieList = false; _fileStream = 0; @@ -99,10 +112,6 @@ AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType memset(&_header, 0, sizeof(_header)); } -AVIDecoder::~AVIDecoder() { - close(); -} - void AVIDecoder::runHandle(uint32 tag) { assert(_fileStream); if (_fileStream->eos()) @@ -214,6 +223,11 @@ void AVIDecoder::handleStreamHeader() { uint32 startPos = _fileStream->pos(); if (sHeader.streamType == ID_VIDS) { + if (_frameRateOverride != 0) { + sHeader.rate = _frameRateOverride.getNumerator(); + sHeader.scale = _frameRateOverride.getDenominator(); + } + BitmapInfoHeader bmInfo; bmInfo.size = _fileStream->readUint32LE(); bmInfo.width = _fileStream->readUint32LE(); diff --git a/video/avi_decoder.h b/video/avi_decoder.h index bc870eac33..1652614bd8 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -56,6 +56,7 @@ class Codec; class AVIDecoder : public VideoDecoder { public: AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); virtual ~AVIDecoder(); bool loadStream(Common::SeekableReadStream *stream); @@ -222,6 +223,8 @@ private: bool _decodedHeader, _foundMovieList; Audio::Mixer::SoundType _soundType; + Common::Rational _frameRateOverride; + void initCommon(); void runHandle(uint32 tag); void handleList(); -- cgit v1.2.3 From 468274a83a49ac9deca346761c17dbef97ff759a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 20 Jun 2013 23:34:48 +0300 Subject: TINSEL: Clip mouse position to be within the screen (bug #3613765) The mouse cursor warping code via the keyboard allows the cursor to go outside the screen. We now limit the cursor's position to always stay within the screen --- engines/tinsel/tinsel.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index 56fed3007f..5eb3b7d7b8 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -226,7 +226,11 @@ public: Graphics::Surface &screen() { return _screenSurface; } Common::Point getMousePosition() const { return _mousePos; } - void setMousePosition(const Common::Point &pt) { + void setMousePosition(Common::Point pt) { + // Clip mouse position to be within the screen coordinates + pt.x = CLIP(pt.x, 0, SCREEN_WIDTH - 1); + pt.y = CLIP(pt.y, 0, SCREEN_HEIGHT - 1); + int yOffset = TinselV2 ? (g_system->getHeight() - _screenSurface.h) / 2 : 0; g_system->warpMouse(pt.x, pt.y + yOffset); _mousePos = pt; -- cgit v1.2.3 From e1ff60da7aa311793cc424f23495442756762ee8 Mon Sep 17 00:00:00 2001 From: richiesams Date: Wed, 19 Jun 2013 17:27:05 -0500 Subject: COMMON: Add erase method to String class --- common/str.cpp | 19 +++++++++++++++++++ common/str.h | 5 +++++ test/common/str.h | 8 ++++++++ 3 files changed, 32 insertions(+) diff --git a/common/str.cpp b/common/str.cpp index 5d647ee4f0..4a10792373 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -361,6 +361,25 @@ void String::deleteChar(uint32 p) { _size--; } +void String::erase(uint32 p, uint32 len) { + assert(p < _size); + + makeUnique(); + // If len == npos or p + len is over the end, remove all the way to the end + if (len == npos || p + len >= _size) { + // Delete char at p as well. So _size = (p - 1) + 1 + _size = p; + // Null terminate + _str[_size] = 0; + return; + } + + for ( ; p + len <= _size; p++) { + _str[p] = _str[p + len]; + } + _size -= len; +} + void String::clear() { decRefCount(_extern._refCount); diff --git a/common/str.h b/common/str.h index 5039130707..6b4475e1c4 100644 --- a/common/str.h +++ b/common/str.h @@ -43,6 +43,8 @@ namespace Common { * behavior in some operations. */ class String { +public: + static const uint32 npos = 0xFFFFFFFF; protected: /** * The size of the internal storage. Increasing this means less heap @@ -191,6 +193,9 @@ public: /** Remove the character at position p from the string. */ void deleteChar(uint32 p); + /** Remove all characters from position p to the p + len. If len = String::npos, removes all characters to the end */ + void erase(uint32 p, uint32 len = npos); + /** Set character c at position p, replacing the previous character there. */ void setChar(char c, uint32 p); diff --git a/test/common/str.h b/test/common/str.h index 2c563f3132..adc6a099e4 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -243,6 +243,14 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(str, "012345678923456789012345678901"); } + void test_erase() { + Common::String str("01234567890123456789012345678901"); + str.erase(18); + TS_ASSERT_EQUALS(str, "012345678901234567"); + str.erase(7, 5); + TS_ASSERT_EQUALS(str, "0123456234567"); + } + void test_sharing() { Common::String str("01234567890123456789012345678901"); Common::String str2(str); -- cgit v1.2.3 From 69a1e8ac3677a6f634264e16cf4d94be6c770c7b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 28 Nov 2012 19:34:09 -0500 Subject: SWORD1: Add back MPEG-2 video support --- engines/sword1/animation.cpp | 56 +++++++++++++++++++++++++++----------------- engines/sword1/animation.h | 3 ++- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 206bd68b07..79ec060bc1 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -37,7 +37,14 @@ #include "gui/message.h" +#ifdef USE_MPEG2 +#include "video/avi_decoder.h" +#endif + +#ifdef USE_ZLIB #include "video/dxa_decoder.h" +#endif + #include "video/psx_decoder.h" #include "video/smk_decoder.h" @@ -176,27 +183,26 @@ bool MoviePlayer::load(uint32 id) { break; case kVideoDecoderPSX: filename = Common::String::format("%s.str", (_vm->_systemVars.isDemo) ? sequenceList[id] : sequenceListPSX[id]); + break; + case kVideoDecoderMP2: + filename = Common::String::format("%s.mp2", sequenceList[id]); + break; + } - // Need to switch to true color + // Need to switch to true color for PSX/MP2 videos + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) initGraphics(g_system->getWidth(), g_system->getHeight(), true, 0); - // Need to load here in case it fails in which case we'd need - // to go back to paletted mode - if (_decoder->loadFile(filename)) { - _decoder->start(); - return true; - } else { + if (!_decoder->loadFile(filename)) { + // Go back to 8bpp color + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) initGraphics(g_system->getWidth(), g_system->getHeight(), true); - return false; - } - break; - } - if (!_decoder->loadFile(filename)) return false; + } - // For DXA, also add the external sound file - if (_decoderType == kVideoDecoderDXA) + // For DXA/MP2, also add the external sound file + if (_decoderType == kVideoDecoderDXA || _decoderType == kVideoDecoderMP2) _decoder->addStreamFileTrack(sequenceList[id]); _decoder->start(); @@ -224,9 +230,9 @@ void MoviePlayer::play() { } void MoviePlayer::performPostProcessing(byte *screen) { - // TODO: We don't support the PSX stream videos yet + // TODO: We don't support displaying these in true color yet, // nor using the PSX fonts to display subtitles. - if (_vm->isPsx()) + if (_vm->isPsx() || _decoderType == kVideoDecoderMP2) return; if (!_movieTexts.empty()) { @@ -414,20 +420,19 @@ bool MoviePlayer::playVideo() { _vm->_system->delayMillis(10); } - if (_decoderType == kVideoDecoderPSX) { - // Need to jump back to paletted color + // Need to jump back to paletted color + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) initGraphics(g_system->getWidth(), g_system->getHeight(), true); - } return !_vm->shouldQuit() && !skipped; } uint32 MoviePlayer::getBlackColor() { - return (_decoderType == kVideoDecoderPSX) ? g_system->getScreenFormat().RGBToColor(0x00, 0x00, 0x00) : _black; + return (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) ? g_system->getScreenFormat().RGBToColor(0x00, 0x00, 0x00) : _black; } uint32 MoviePlayer::findTextColor() { - if (_decoderType == kVideoDecoderPSX) { + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) { // We're in true color mode, so return the actual colors switch (_textColor) { case 1: @@ -547,9 +552,16 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * filename = Common::String::format("%s.mp2", sequenceList[id]); if (Common::File::exists(filename)) { - GUI::MessageDialog dialog(_("MPEG2 cutscenes are no longer supported"), _("OK")); +#ifdef USE_MPEG2 + // HACK: Old ScummVM builds ignored the AVI frame rate field and forced the video + // to be played back at 12fps. + Video::VideoDecoder *aviDecoder = new Video::AVIDecoder(12); + return new MoviePlayer(vm, textMan, resMan, system, aviDecoder, kVideoDecoderMP2); +#else + GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2"), _("OK")); dialog.runModal(); return 0; +#endif } if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) { diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index d0c61f5eb3..2c51a74f71 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -41,7 +41,8 @@ namespace Sword1 { enum DecoderType { kVideoDecoderDXA = 0, kVideoDecoderSMK = 1, - kVideoDecoderPSX = 2 + kVideoDecoderPSX = 2, + kVideoDecoderMP2 = 3 }; class MovieText { -- cgit v1.2.3 From 15a4d52ef7c55d2c004979244ea6e823ac33fe18 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 28 Nov 2012 19:51:03 -0500 Subject: SWORD2: Add back MPEG-2 video support --- engines/sword2/animation.cpp | 55 +++++++++++++++++++++++++++----------------- engines/sword2/animation.h | 3 ++- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 00260f789a..713120ad43 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -42,7 +42,14 @@ #include "gui/message.h" +#ifdef USE_MPEG2 +#include "video/avi_decoder.h" +#endif + +#ifdef USE_ZLIB #include "video/dxa_decoder.h" +#endif + #include "video/smk_decoder.h" #include "video/psx_decoder.h" @@ -88,26 +95,26 @@ bool MoviePlayer::load(const char *name) { break; case kVideoDecoderPSX: filename = Common::String::format("%s.str", name); + break; + case kVideoDecoderMP2: + filename = Common::String::format("%s.mp2", name); + break; + } - // Need to switch to true color - initGraphics(640, 480, true, 0); + // Need to switch to true color for PSX/MP2 videos + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) + initGraphics(g_system->getWidth(), g_system->getHeight(), true, 0); - // Need to load here in case it fails in which case we'd need - // to go back to paletted mode - if (_decoder->loadFile(filename)) { - _decoder->start(); - return true; - } else { - initGraphics(640, 480, true); - return false; - } - } + if (!_decoder->loadFile(filename)) { + // Go back to 8bpp color + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) + initGraphics(g_system->getWidth(), g_system->getHeight(), true); - if (!_decoder->loadFile(filename)) return false; + } - // For DXA, also add the external sound file - if (_decoderType == kVideoDecoderDXA) + // For DXA/MP2, also add the external sound file + if (_decoderType == kVideoDecoderDXA || _decoderType == kVideoDecoderMP2) _decoder->addStreamFileTrack(name); _decoder->start(); @@ -136,10 +143,9 @@ void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadI _vm->_sound->stopSpeech(); } - if (_decoderType == kVideoDecoderPSX) { - // Need to jump back to paletted color + // Need to jump back to paletted color + if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) initGraphics(640, 480, true); - } } void MoviePlayer::openTextObject(uint32 index) { @@ -378,11 +384,11 @@ bool MoviePlayer::playVideo() { } uint32 MoviePlayer::getBlackColor() { - return (_decoderType == kVideoDecoderPSX) ? g_system->getScreenFormat().RGBToColor(0x00, 0x00, 0x00) : _black; + return (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) ? g_system->getScreenFormat().RGBToColor(0x00, 0x00, 0x00) : _black; } uint32 MoviePlayer::getWhiteColor() { - return (_decoderType == kVideoDecoderPSX) ? g_system->getScreenFormat().RGBToColor(0xFF, 0xFF, 0xFF) : _white; + return (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) ? g_system->getScreenFormat().RGBToColor(0xFF, 0xFF, 0xFF) : _white; } void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { @@ -446,9 +452,16 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system filename = Common::String::format("%s.mp2", name); if (Common::File::exists(filename)) { - GUI::MessageDialog dialog(_("MPEG2 cutscenes are no longer supported"), _("OK")); +#ifdef USE_MPEG2 + // HACK: Old ScummVM builds ignored the AVI frame rate field and forced the video + // to be played back at 12fps. + Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(12); + return new MoviePlayer(vm, system, aviDecoder, kVideoDecoderMP2); +#else + GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"), _("OK")); dialog.runModal(); return NULL; +#endif } // The demo tries to play some cutscenes that aren't there, so make those warnings more discreet. diff --git a/engines/sword2/animation.h b/engines/sword2/animation.h index b2a243b2ca..8669bdc8d8 100644 --- a/engines/sword2/animation.h +++ b/engines/sword2/animation.h @@ -40,7 +40,8 @@ namespace Sword2 { enum DecoderType { kVideoDecoderDXA = 0, kVideoDecoderSMK = 1, - kVideoDecoderPSX = 2 + kVideoDecoderPSX = 2, + kVideoDecoderMP2 = 3 }; struct MovieText { -- cgit v1.2.3 From 1ff09c581b72c9bc6b71e7b6b6aa676f9af6cecf Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 29 Nov 2012 15:53:19 -0500 Subject: VIDEO: Mark AVIDecoder as being used by sword1/sword2 --- video/avi_decoder.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 1652614bd8..6082232464 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -52,6 +52,8 @@ class Codec; * * Video decoder used in engines: * - sci + * - sword1 + * - sword2 */ class AVIDecoder : public VideoDecoder { public: -- cgit v1.2.3 From d530985a6b88d01b79b3384894e049cb1a7ccf24 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 21 Jun 2013 13:19:37 +0300 Subject: SCI: Avoid using g_sci for usesOldGfxFunctions() in the GfxPorts class --- engines/sci/graphics/ports.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index 527e2ae973..6d9dc03195 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -116,7 +116,7 @@ void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *te setPort(_wmgrPort); // SCI0 games till kq4 (.502 - not including) did not adjust against _wmgrPort in kNewWindow // We leave _wmgrPort top at 0, so the adjustment wont get done - if (!g_sci->_features->usesOldGfxFunctions()) { + if (!_usesOldGfxFunctions) { setOrigin(0, offTop); _wmgrPort->rect.bottom = _screen->getHeight() - offTop; } else { @@ -131,7 +131,7 @@ void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *te _picWind = addWindow(Common::Rect(0, offTop, _screen->getWidth(), _screen->getHeight()), 0, 0, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true); // For SCI0 games till kq4 (.502 - not including) we set _picWind top to offTop instead // Because of the menu/status bar - if (g_sci->_features->usesOldGfxFunctions()) + if (_usesOldGfxFunctions) _picWind->top = offTop; kernelInitPriorityBands(); -- cgit v1.2.3 From 726ae06d442bea5c2a071db5eac27dd5bea96ae1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 7 Jun 2013 14:20:01 +0300 Subject: NEVERHOOD: Fix warning --- engines/neverhood/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 8a30b20df4..66a7999e59 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -343,7 +343,7 @@ void unpackSpriteNormal(const byte *source, int width, int height, byte *dest, i int calcDistance(int16 x1, int16 y1, int16 x2, int16 y2) { const int16 deltaX = ABS(x1 - x2); const int16 deltaY = ABS(y1 - y2); - return sqrt((double)(deltaX * deltaX + deltaY * deltaY)); + return (int)sqrt((double)(deltaX * deltaX + deltaY * deltaY)); } } // End of namespace Neverhood -- cgit v1.2.3 From cdac272b8770cd8064b1f196157fbb29e61619b7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 22 Jun 2013 11:28:23 -0400 Subject: SCUMM: Added another Russian variant of Full Throttle --- devtools/scumm-md5.txt | 3 ++- engines/scumm/scumm-md5.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 414a25e906..3da700646d 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -346,7 +346,8 @@ ft Full Throttle 4bedb49943df95a9c900a5a82ccbe9de -1 fr All? - - - cyx 8bdb0bf87b5e303dd35693afb9351215 -1 de All? - - - dhewg 55518cd73cf9c6d23ea29c51ee06bdfe -1 it All? - - - delfino - 55e4cc866ff9046824e1c638ba2b8c7f -1 ru All? - - - sev + 55e4cc866ff9046824e1c638ba2b8c7f -1 ru All? - Fargus - sev + 291fb06071e65897f755846611f5ad40 19697 ru All? - Akella - sev e72bb4c2b613db2cf50f89ff6350e70a -1 es All? - - - fe381e45117878b1e942cb876b050fd6 513243679 en Mac - - Mac bundle Fingolfin 04401d747f1a2c1c4b388daff71ed378 535405461 de Mac - - Mac bundle Fingolfin diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 6aad52578d..d42c6522d0 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Thu May 2 21:27:50 2013 + This file was generated by the md5table tool on Sat Jun 22 15:26:39 2013 DO NOT EDIT MANUALLY! */ @@ -124,6 +124,7 @@ static const MD5Table md5table[] = { { "28d24a33448fab6795850bc9f159a4a2", "atlantis", "FM-TOWNS", "Demo", 11170, Common::JA_JPN, Common::kPlatformFMTowns }, { "28ef68ee3ed76d7e2ee8ee13c15fbd5b", "loom", "EGA", "EGA", 5748, Common::EN_ANY, Common::kPlatformDOS }, { "28f07458f1b6c24e118a1ea056827701", "lost", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, + { "291fb06071e65897f755846611f5ad40", "ft", "", "Akella", 19697, Common::RU_RUS, Common::kPlatformUnknown }, { "2a208ffbcd0e83e86f4356e6f64aa6e1", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformDOS }, { "2a41b53cf1a90b6e6f26c10cc6041084", "tentacle", "", "Demo", 2439158, Common::EN_ANY, Common::kPlatformMacintosh }, { "2a446817ffcabfef8716e0c456ecaf81", "puttzoo", "", "Demo", -1, Common::DE_DEU, Common::kPlatformWindows }, @@ -238,7 +239,7 @@ static const MD5Table md5table[] = { { "53e94115b55dd51d4b8ff0871aa1df1e", "spyfox", "", "Demo", 20103, Common::EN_ANY, Common::kPlatformUnknown }, { "54a936ad06161ff7bfefcb96200f7bff", "monkey", "VGA", "VGA Demo", 7617, Common::EN_ANY, Common::kPlatformAmiga }, { "55518cd73cf9c6d23ea29c51ee06bdfe", "ft", "", "", -1, Common::IT_ITA, Common::kPlatformUnknown }, - { "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown }, + { "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "Fargus", -1, Common::RU_RUS, Common::kPlatformUnknown }, { "55f4e9402bec2bded383843123f37c5c", "pajama2", "HE 98.5", "", -1, Common::DE_DEU, Common::kPlatformWindows }, { "566165a7338fa11029e7c14d94fa70d0", "freddi", "HE 73", "Demo", 9800, Common::EN_ANY, Common::kPlatformWindows }, { "56b5922751be7ffd771b38dda56b028b", "freddi", "HE 100", "", 34837, Common::NL_NLD, Common::kPlatformWii }, -- cgit v1.2.3 From c7ec14d1cb4620b891a76b57f63fd72719e37a7e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 23 Jun 2013 18:18:52 -0400 Subject: SCUMM: Corrected Russian Full Throttle variant names --- devtools/scumm-md5.txt | 4 ++-- engines/scumm/scumm-md5.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 3da700646d..6e3bae1d7e 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -346,8 +346,8 @@ ft Full Throttle 4bedb49943df95a9c900a5a82ccbe9de -1 fr All? - - - cyx 8bdb0bf87b5e303dd35693afb9351215 -1 de All? - - - dhewg 55518cd73cf9c6d23ea29c51ee06bdfe -1 it All? - - - delfino - 55e4cc866ff9046824e1c638ba2b8c7f -1 ru All? - Fargus - sev - 291fb06071e65897f755846611f5ad40 19697 ru All? - Akella - sev + 55e4cc866ff9046824e1c638ba2b8c7f -1 ru All? - Akella - sev + 291fb06071e65897f755846611f5ad40 19697 ru All? - 7-Wolf - sev e72bb4c2b613db2cf50f89ff6350e70a -1 es All? - - - fe381e45117878b1e942cb876b050fd6 513243679 en Mac - - Mac bundle Fingolfin 04401d747f1a2c1c4b388daff71ed378 535405461 de Mac - - Mac bundle Fingolfin diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index d42c6522d0..db8da21bbc 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Sat Jun 22 15:26:39 2013 + This file was generated by the md5table tool on Sun Jun 23 22:18:47 2013 DO NOT EDIT MANUALLY! */ @@ -124,7 +124,7 @@ static const MD5Table md5table[] = { { "28d24a33448fab6795850bc9f159a4a2", "atlantis", "FM-TOWNS", "Demo", 11170, Common::JA_JPN, Common::kPlatformFMTowns }, { "28ef68ee3ed76d7e2ee8ee13c15fbd5b", "loom", "EGA", "EGA", 5748, Common::EN_ANY, Common::kPlatformDOS }, { "28f07458f1b6c24e118a1ea056827701", "lost", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, - { "291fb06071e65897f755846611f5ad40", "ft", "", "Akella", 19697, Common::RU_RUS, Common::kPlatformUnknown }, + { "291fb06071e65897f755846611f5ad40", "ft", "", "7-Wolf", 19697, Common::RU_RUS, Common::kPlatformUnknown }, { "2a208ffbcd0e83e86f4356e6f64aa6e1", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformDOS }, { "2a41b53cf1a90b6e6f26c10cc6041084", "tentacle", "", "Demo", 2439158, Common::EN_ANY, Common::kPlatformMacintosh }, { "2a446817ffcabfef8716e0c456ecaf81", "puttzoo", "", "Demo", -1, Common::DE_DEU, Common::kPlatformWindows }, @@ -239,7 +239,7 @@ static const MD5Table md5table[] = { { "53e94115b55dd51d4b8ff0871aa1df1e", "spyfox", "", "Demo", 20103, Common::EN_ANY, Common::kPlatformUnknown }, { "54a936ad06161ff7bfefcb96200f7bff", "monkey", "VGA", "VGA Demo", 7617, Common::EN_ANY, Common::kPlatformAmiga }, { "55518cd73cf9c6d23ea29c51ee06bdfe", "ft", "", "", -1, Common::IT_ITA, Common::kPlatformUnknown }, - { "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "Fargus", -1, Common::RU_RUS, Common::kPlatformUnknown }, + { "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "Akella", -1, Common::RU_RUS, Common::kPlatformUnknown }, { "55f4e9402bec2bded383843123f37c5c", "pajama2", "HE 98.5", "", -1, Common::DE_DEU, Common::kPlatformWindows }, { "566165a7338fa11029e7c14d94fa70d0", "freddi", "HE 73", "Demo", 9800, Common::EN_ANY, Common::kPlatformWindows }, { "56b5922751be7ffd771b38dda56b028b", "freddi", "HE 100", "", 34837, Common::NL_NLD, Common::kPlatformWii }, -- cgit v1.2.3 From a81f13c14ed9177d0cbf1dc6f173e195c12d9ee2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Jun 2013 23:48:00 +0200 Subject: MORTEVIELLE: Remove CHECK_QUIT macros --- engines/mortevielle/actions.cpp | 3 ++- engines/mortevielle/dialogs.cpp | 9 ++++++--- engines/mortevielle/mortevielle.cpp | 26 +++++++++++++++++--------- engines/mortevielle/mortevielle.h | 3 --- engines/mortevielle/mouse.cpp | 3 ++- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 392ea17df1..47ffb2e4ba 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1408,7 +1408,8 @@ void MortevielleEngine::fctDiscuss() { do { bool dummyFl; _mouse.moveMouse(dummyFl, retKey); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; _mouse.getMousePosition(x, y, click); x *= (3 - _resolutionScaler); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index ee6eb697fb..90c53d1648 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -110,7 +110,8 @@ int Alert::show(const Common::String &msg, int n) { do { char dummyKey = '\377'; g_vm->_mouse.moveMouse(dummyFl, dummyKey); - CHECK_QUIT0; + if (g_vm->shouldQuit()) + return 0; curPos = g_vm->_mouse._pos; bool newaff = false; @@ -358,7 +359,8 @@ bool KnowledgeCheck::show() { bool flag; char key; g_vm->_mouse.moveMouse(flag, key); - CHECK_QUIT0; + if (g_vm->shouldQuit()) + return false; currChoice = 1; while (coor[currChoice]._enabled && !g_vm->_mouse.isMouseIn(coor[currChoice]._rect)) @@ -428,7 +430,8 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { do { g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); g_vm->_key = waitForF3F8(); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 664908440f..b013f87a1a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -576,13 +576,15 @@ void MortevielleEngine::showIntroduction() { f3f8::aff50(false); _speechManager._mlec = 0; f3f8::checkForF8(142, false); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; f3f8::ani50(); f3f8::checkForF8(143, true); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; - // TODO: Once music is implemented, only use the below delay if music is turned off + // TODO: Once music (Amiga/Atari ports) is implemented, only use the below delay if music is turned off showTitleScreen(); delay(3000); music(); @@ -611,7 +613,8 @@ void MortevielleEngine::mainGame() { // Loop to play the game do { playGame(); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; } while (!_quitGame); } @@ -625,7 +628,8 @@ void MortevielleEngine::playGame() { // Loop handling actions until the game has to be quit, or show the lose or end sequence do { handleAction(); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; } while (!((_quitGame) || (_endGame) || (_loseGame))); if (_endGame) @@ -660,7 +664,8 @@ void MortevielleEngine::handleAction() { _menu.updateMenu(); prepareRoom(); _mouse.moveMouse(funct, inkey); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; ++temps; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; @@ -1748,7 +1753,8 @@ void MortevielleEngine::startDialog(int16 rep) { do { _speechManager.startSpeech(rep, haut[_caff - 69], 0); key = f3f8::waitForF3F8(); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; } while (key != 66); hirs(); _mouse.showMouse(); @@ -3383,7 +3389,8 @@ void MortevielleEngine::testKey(bool d) { prepareRoom(); quest = keyPressed(); _mouse.getMousePosition(x, y, click); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; } while (!(quest || (click) || (d && _anyone))); if (quest) testou(); @@ -3618,7 +3625,8 @@ void MortevielleEngine::tfleche() { do { _mouse.moveMouse(qust, touch); - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; if (getMouseClick()) inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index aeef3dd1e2..bdf28e4514 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -533,9 +533,6 @@ public: extern MortevielleEngine *g_vm; -#define CHECK_QUIT if (g_vm->shouldQuit()) { return; } -#define CHECK_QUIT0 if (g_vm->shouldQuit()) { return 0; } - } // End of namespace Mortevielle #endif diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index bc0f5fe7d3..a6105d85de 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -265,7 +265,8 @@ void MouseHandler::moveMouse(bool &funct, char &key) { // Handle any pending keypresses while (p_key) { - CHECK_QUIT; + if (g_vm->shouldQuit()) + return; in1 = g_vm->getChar(); getMousePosition(cx, cy, click); -- cgit v1.2.3 From a36178ff1dfa21703b30a3a4c0660ca0bcaff93b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Jun 2013 23:09:29 -0400 Subject: TSAGE: Bugfix for #3540893 - Stuck animation in Blue Force floppy --- engines/tsage/blue_force/blueforce_scenes9.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index 1cb8191640..52115b95fe 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -705,6 +705,10 @@ void Scene900::process(Event &event) { void Scene900::dispatch() { SceneExt::dispatch(); + // WORKAROUND:: Fix for invalid data in the Blue Force floppy version when opening gate + if (_sceneMode == 9006 && (g_vm->getFeatures() & GF_FLOPPY) && BF_GLOBALS._player._endFrame == 8) + BF_GLOBALS._player._endFrame = 6; + if (BF_GLOBALS.getFlag(fWithLyle) && _lyle.isNoMover()) { _lyle.updateAngle(BF_GLOBALS._player._position); } -- cgit v1.2.3 From 9878c89b9753227bc73cd5914a69e6f817c302e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 07:14:29 +0200 Subject: HOPKINS: Add some comments --- engines/hopkins/hopkins.cpp | 2 ++ engines/hopkins/script.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 81dbcabd57..2aaf44c5d3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1138,12 +1138,14 @@ bool HopkinsEngine::runFull() { break; case 30: + // Shooting _linesMan->setMaxLineIdx(15); _globals->_characterMaxPosY = 440; _objectsMan->sceneControl2("IM30", "IM30", "ANIM30", "IM30", 24, false); break; case 31: + // Shooting target _objectsMan->sceneControl("IM31", "IM31", "ANIM31", "IM31", 10, true); break; diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 3d298b2e9e..7e150624b8 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -1217,6 +1217,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 88: + // Shooting target - Shooting at target if (_vm->_globals->_saveData->_data[svField183] == 1) { _vm->_objectsMan->setBobAnimDataIdx(1, 0); _vm->_objectsMan->setBobAnimDataIdx(2, 0); @@ -1294,6 +1295,7 @@ int ScriptManager::handleOpcode(const byte *dataP) { break; case 90: + // Shooting target - Using the level _vm->_soundMan->playSoundFile("SOUND52.WAV"); if (!_vm->_globals->_saveData->_data[svField186]) { _vm->_animMan->playSequence("CIB5A.SEQ", 1, 12, 1, false, false); -- cgit v1.2.3 From 16c814ee6ee68b4359a1924c3086a3efb492b130 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 08:00:11 +0200 Subject: MORTEVIELLE: Replace g_vm in Menu --- engines/mortevielle/menu.cpp | 168 ++++++++++++++++++------------------ engines/mortevielle/menu.h | 5 +- engines/mortevielle/mortevielle.cpp | 2 +- 3 files changed, 90 insertions(+), 85 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 5d64961f23..8c9fc038fc 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -93,8 +93,8 @@ void Menu::setDestinationText(int roomId) { roomId = LANDING; int destinationId = 0; - for (; (destinationId < 7) && (g_vm->_destinationArray[destinationId][roomId]); ++destinationId) { - nomp = g_vm->getString(g_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); + for (; (destinationId < 7) && (_vm->_destinationArray[destinationId][roomId]); ++destinationId) { + nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; setText(_moveMenu[destinationId + 1], nomp); @@ -175,11 +175,11 @@ void Menu::displayMenu() { int pt, x, y, color, msk, num_letr; - g_vm->_mouse.hideMouse(); + _vm->_mouse.hideMouse(); - g_vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * g_vm->_resolutionScaler; - if (g_vm->_currGraphicalDevice == MODE_CGA) + _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); + col = 28 * _vm->_resolutionScaler; + if (_vm->_currGraphicalDevice == MODE_CGA) color = 1; else color = 9; @@ -195,9 +195,9 @@ void Menu::displayMenu() { msk = 0x80; for (pt = 0; pt <= 7; ++pt) { if ((_charArr[num_letr - 1][ind_tabl] & msk) != 0) { - g_vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); - g_vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); - g_vm->_screenSurface.setPixel(Common::Point(x, y), color); + _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); + _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); + _vm->_screenSurface.setPixel(Common::Point(x, y), color); } msk = (uint)msk >> 1; ++x; @@ -207,9 +207,9 @@ void Menu::displayMenu() { } while (k != 3); ++y; } while (y != 9); - col += 48 * g_vm->_resolutionScaler; + col += 48 * _vm->_resolutionScaler; } while (num_letr != 6); - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); } /** @@ -221,7 +221,7 @@ void Menu::drawMenu() { _msg4 = OPCODE_NONE; _msg3 = OPCODE_NONE; _menuSelected = false; - g_vm->setMouseClick(false); + _vm->setMouseClick(false); _multiTitle = false; } @@ -235,7 +235,7 @@ void Menu::invert(int indx) { int menuIndex = lo(_msg4); - g_vm->_screenSurface.putxy(_menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + _vm->_screenSurface.putxy(_menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; switch (_msg3) { @@ -255,18 +255,18 @@ void Menu::invert(int indx) { str = _discussStringArray[menuIndex]; break; case 6: - str = g_vm->getEngineString(S_SAVE_LOAD + menuIndex); + str = _vm->getEngineString(S_SAVE_LOAD + menuIndex); break; case 7: - str = g_vm->getEngineString(S_SAVE_LOAD + 1); + str = _vm->getEngineString(S_SAVE_LOAD + 1); str += ' '; str += (char)(48 + menuIndex); break; case 8: if (menuIndex == 1) { - str = g_vm->getEngineString(S_RESTART); + str = _vm->getEngineString(S_RESTART); } else { - str = g_vm->getEngineString(S_SAVE_LOAD + 2); + str = _vm->getEngineString(S_SAVE_LOAD + 2); str += ' '; str += (char)(47 + menuIndex); } @@ -275,7 +275,7 @@ void Menu::invert(int indx) { break; } if ((str[0] != '*') && (str[0] != '<')) - g_vm->_screenSurface.drawString(str, indx); + _vm->_screenSurface.drawString(str, indx); else _msg4 = OPCODE_NONE; } @@ -284,14 +284,14 @@ void Menu::util(Common::Point pos) { int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; int dxcar = _menuConstants[_msg3 - 1][2]; - int xmn = (_menuConstants[_msg3 - 1][0] << 2) * g_vm->_resolutionScaler; + int xmn = (_menuConstants[_msg3 - 1][0] << 2) * _vm->_resolutionScaler; int ix; - if (g_vm->_resolutionScaler == 1) + if (_vm->_resolutionScaler == 1) ix = 5; else ix = 3; - int xmx = dxcar * ix * g_vm->_resolutionScaler + xmn + 2; + int xmx = dxcar * ix * _vm->_resolutionScaler + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); if (ix != _msg4) { @@ -313,78 +313,78 @@ void Menu::menuDown(int ii) { int lignNumb; // Make a copy of the current screen surface for later restore - g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); // Draw the menu xco = _menuConstants[ii - 1][0]; lignNumb = _menuConstants[ii - 1][3]; - g_vm->_mouse.hideMouse(); - g_vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); + _vm->_mouse.hideMouse(); + _vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; - if (g_vm->_resolutionScaler == 1) + if (_vm->_resolutionScaler == 1) cx = 10; else cx = 6; xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6; - if ((ii == 4) && (g_vm->getLanguage() == Common::EN_ANY)) + if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version xcc = 435; - g_vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); - g_vm->_screenSurface.putxy(xco, 16); + _vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.putxy(xco, 16); cx = 0; do { ++cx; switch (ii) { case 1: if (_inventoryStringArray[cx][0] != '*') - g_vm->_screenSurface.drawString(_inventoryStringArray[cx], 4); + _vm->_screenSurface.drawString(_inventoryStringArray[cx], 4); break; case 2: if (_moveStringArray[cx][0] != '*') - g_vm->_screenSurface.drawString(_moveStringArray[cx], 4); + _vm->_screenSurface.drawString(_moveStringArray[cx], 4); break; case 3: if (_actionStringArray[cx][0] != '*') - g_vm->_screenSurface.drawString(_actionStringArray[cx], 4); + _vm->_screenSurface.drawString(_actionStringArray[cx], 4); break; case 4: if (_selfStringArray[cx][0] != '*') - g_vm->_screenSurface.drawString(_selfStringArray[cx], 4); + _vm->_screenSurface.drawString(_selfStringArray[cx], 4); break; case 5: if (_discussStringArray[cx][0] != '*') - g_vm->_screenSurface.drawString(_discussStringArray[cx], 4); + _vm->_screenSurface.drawString(_discussStringArray[cx], 4); break; case 6: - g_vm->_screenSurface.drawString(g_vm->getEngineString(S_SAVE_LOAD + cx), 4); + _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + cx), 4); break; case 7: { - Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 1); + Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + cx); - g_vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface.drawString(s, 4); } break; case 8: if (cx == 1) - g_vm->_screenSurface.drawString(g_vm->getEngineString(S_RESTART), 4); + _vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4); else { - Common::String s = g_vm->getEngineString(S_SAVE_LOAD + 2); + Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + cx); - g_vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface.drawString(s, 4); } break; default: break; } - g_vm->_screenSurface.putxy(xco, g_vm->_screenSurface._textPos.y + 8); + _vm->_screenSurface.putxy(xco, _vm->_screenSurface._textPos.y + 8); } while (cx != lignNumb); _multiTitle = true; - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); } /** @@ -392,14 +392,14 @@ void Menu::menuDown(int ii) { */ void Menu::menuUp(int msgId) { if (_multiTitle) { - g_vm->charecr(10, (_menuConstants[msgId - 1][1] + 1) << 1); + _vm->charecr(10, (_menuConstants[msgId - 1][1] + 1) << 1); /* Restore the background area */ - assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch); + assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch); // Get a pointer to the source and destination of the area to restore - const byte *pSrc = (const byte *)g_vm->_backgroundSurface.getBasePtr(0, 10); - Graphics::Surface destArea = g_vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); + const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); + Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); byte *pDest = (byte *)destArea.getBasePtr(0, 0); // Copy the data @@ -414,7 +414,7 @@ void Menu::menuUp(int msgId) { */ void Menu::eraseMenu() { _menuActive = false; - g_vm->setMouseClick(false); + _vm->setMouseClick(false); menuUp(_msg3); } @@ -426,32 +426,32 @@ void Menu::updateMenu() { if (!_menuActive) return; - Common::Point curPos = g_vm->_mouse._pos; - if (!g_vm->getMouseClick()) { - if (curPos == g_vm->_prevPos) + Common::Point curPos = _vm->_mouse._pos; + if (!_vm->getMouseClick()) { + if (curPos == _vm->_prevPos) return; else - g_vm->_prevPos = curPos; + _vm->_prevPos = curPos; bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * g_vm->_resolutionScaler) && curPos.x <= (28 * g_vm->_resolutionScaler + 24)) - || (curPos.x >= (76 * g_vm->_resolutionScaler) && curPos.x <= (76 * g_vm->_resolutionScaler + 24)) - || ((curPos.x > 124 * g_vm->_resolutionScaler) && (curPos.x < 124 * g_vm->_resolutionScaler + 24)) - || ((curPos.x > 172 * g_vm->_resolutionScaler) && (curPos.x < 172 * g_vm->_resolutionScaler + 24)) - || ((curPos.x > 220 * g_vm->_resolutionScaler) && (curPos.x < 220 * g_vm->_resolutionScaler + 24)) - || ((curPos.x > 268 * g_vm->_resolutionScaler) && (curPos.x < 268 * g_vm->_resolutionScaler + 24))); + && ((curPos.x >= (28 * _vm->_resolutionScaler) && curPos.x <= (28 * _vm->_resolutionScaler + 24)) + || (curPos.x >= (76 * _vm->_resolutionScaler) && curPos.x <= (76 * _vm->_resolutionScaler + 24)) + || ((curPos.x > 124 * _vm->_resolutionScaler) && (curPos.x < 124 * _vm->_resolutionScaler + 24)) + || ((curPos.x > 172 * _vm->_resolutionScaler) && (curPos.x < 172 * _vm->_resolutionScaler + 24)) + || ((curPos.x > 220 * _vm->_resolutionScaler) && (curPos.x < 220 * _vm->_resolutionScaler + 24)) + || ((curPos.x > 268 * _vm->_resolutionScaler) && (curPos.x < 268 * _vm->_resolutionScaler + 24))); if (tes) { int ix; - if (curPos.x < 76 * g_vm->_resolutionScaler) + if (curPos.x < 76 * _vm->_resolutionScaler) ix = MENU_INVENTORY; - else if (curPos.x < 124 * g_vm->_resolutionScaler) + else if (curPos.x < 124 * _vm->_resolutionScaler) ix = MENU_MOVE; - else if (curPos.x < 172 * g_vm->_resolutionScaler) + else if (curPos.x < 172 * _vm->_resolutionScaler) ix = MENU_ACTION; - else if (curPos.x < 220 * g_vm->_resolutionScaler) + else if (curPos.x < 220 * _vm->_resolutionScaler) ix = MENU_SELF; - else if (curPos.x < 268 * g_vm->_resolutionScaler) + else if (curPos.x < 268 * _vm->_resolutionScaler) ix = MENU_DISCUSS; else ix = MENU_FILE; @@ -470,7 +470,7 @@ void Menu::updateMenu() { } else { // There was a click if ((_msg3 == MENU_FILE) && (_msg4 != OPCODE_NONE)) { // Another menu to be _displayed - g_vm->setMouseClick(false); + _vm->setMouseClick(false); menuUp(_msg3); if (lo(_msg4) == 1) _msg3 = 7; @@ -478,22 +478,24 @@ void Menu::updateMenu() { _msg3 = 8; menuDown(_msg3); - g_vm->setMouseClick(false); + _vm->setMouseClick(false); } else { // A menu was clicked on _menuSelected = (_multiTitle) && (_msg4 != OPCODE_NONE); menuUp(_msg3); - g_vm->_msg[4] = _msg4; - g_vm->_msg[3] = _msg3; + _vm->_msg[4] = _msg4; + _vm->_msg[3] = _msg3; _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; - g_vm->setMouseClick(false); + _vm->setMouseClick(false); } } } -void Menu::initMenu() { +void Menu::initMenu(MortevielleEngine *vm) { + _vm = vm; + int i; Common::File f; @@ -514,18 +516,18 @@ void Menu::initMenu() { _moveStringArray[i] = "* "; i = 1; do { - _actionStringArray[i] = g_vm->getString(i + kMenuActionStringIndex); + _actionStringArray[i] = _vm->getString(i + kMenuActionStringIndex); while (_actionStringArray[i].size() < 10) _actionStringArray[i] += ' '; if (i < 9) { if (i < 6) { - _selfStringArray[i] = g_vm->getString(i + kMenuSelfStringIndex); + _selfStringArray[i] = _vm->getString(i + kMenuSelfStringIndex); while (_selfStringArray[i].size() < 10) _selfStringArray[i] += ' '; } - _discussStringArray[i] = g_vm->getString(i + kMenuSayStringIndex) + ' '; + _discussStringArray[i] = _vm->getString(i + kMenuSayStringIndex) + ' '; } ++i; } while (i != 22); @@ -539,9 +541,9 @@ void Menu::initMenu() { } _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; - g_vm->_msg[3] = OPCODE_NONE; - g_vm->_msg[4] = OPCODE_NONE; - g_vm->setMouseClick(false); + _vm->_msg[3] = OPCODE_NONE; + _vm->_msg[4] = OPCODE_NONE; + _vm->setMouseClick(false); } /** @@ -555,8 +557,8 @@ void Menu::setSearchMenu() { for (int i = 1; i <= 11; ++i) disableMenuItem(_actionMenu[i]); - setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); + setText(OPCODE_SOUND, _vm->getEngineString(S_SUITE)); + setText(OPCODE_LIFT, _vm->getEngineString(S_STOP)); } /** @@ -564,12 +566,12 @@ void Menu::setSearchMenu() { * @remarks Originally called 'mfouen' */ void Menu::unsetSearchMenu() { - setDestinationText(g_vm->_coreVar._currPlace); + setDestinationText(_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]); - setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); + setText(OPCODE_SOUND, _vm->getEngineString(S_PROBE)); + setText(OPCODE_LIFT, _vm->getEngineString(S_RAISE)); } /** @@ -581,10 +583,10 @@ void Menu::setInventoryText() { int cy = 0; for (int i = 1; i <= 6; ++i) { - if (g_vm->_coreVar._inventory[i] != 0) { + if (_vm->_coreVar._inventory[i] != 0) { ++cy; - int r = g_vm->_coreVar._inventory[i] + 400; - nomp = g_vm->getString(r - 501 + kInventoryStringIndex); + int r = _vm->_coreVar._inventory[i] + 400; + nomp = _vm->getString(r - 501 + kInventoryStringIndex); setText(_inventoryMenu[cy], nomp); enableMenuItem(_inventoryMenu[i]); } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 712242e6bc..61430bfdaa 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -32,6 +32,7 @@ #include "common/str.h" namespace Mortevielle { +class MortevielleEngine; enum { MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4, @@ -40,6 +41,8 @@ enum { class Menu { private: + MortevielleEngine *_vm; + byte _charArr[7][24]; int _msg3; int _msg4; @@ -71,7 +74,7 @@ public: void menuUp(int msgId); void eraseMenu(); void updateMenu(); - void initMenu(); + void initMenu(MortevielleEngine *vm); void setSearchMenu(); void unsetSearchMenu(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b013f87a1a..86e7a12371 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -602,7 +602,7 @@ void MortevielleEngine::mainGame() { decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); loadBRUIT5(); - _menu.initMenu(); + _menu.initMenu(this); charToHour(); initGame(); -- cgit v1.2.3 From 785db3b190f5449c83fa3c235d65835e49307778 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 20:40:06 +0200 Subject: MORTEVIELLE: Replace g_vm in ScreenSurface --- engines/mortevielle/debugger.cpp | 1 + engines/mortevielle/graphics.cpp | 30 +++++++++++++++++------------- engines/mortevielle/graphics.h | 12 +++++++++--- engines/mortevielle/mortevielle.cpp | 2 ++ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index b0b9dc7d2c..9c24954f83 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -46,6 +46,7 @@ bool Debugger::Cmd_resetParano(int argc, const char **argv) { return true; } + void Debugger::setParent(MortevielleEngine *vm) { _vm = vm; } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 5bf3aedc99..39a38c2580 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -917,7 +917,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &g_vm->_mem[0x7000 * 16 + 2]; + const byte *paletteMap = &_vm->_mem[0x7000 * 16 + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { @@ -996,7 +996,7 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (g_vm->_resolutionScaler == 1) { + if (_vm->_resolutionScaler == 1) { x = (uint)x >> 1; dx = (uint)dx >> 1; } @@ -1060,10 +1060,10 @@ void ScreenSurface::drawString(const Common::String &l, int command) { if (l == "") return; - g_vm->_mouse.hideMouse(); + _vm->_mouse.hideMouse(); pt = _textPos; - if (g_vm->_resolutionScaler == 2) + if (_vm->_resolutionScaler == 2) i = 6; else i = 10; @@ -1073,7 +1073,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { case 1: case 3: { cecr = 0; - g_vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; case 4: @@ -1085,7 +1085,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { case 0: case 2: { cecr = 15; - g_vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; default: @@ -1095,17 +1095,17 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - g_vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); + _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); pt.x += i; } - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); } /** * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (g_vm->_resolutionScaler == 2) ? 6 : 10; + int charWidth = (_vm->_resolutionScaler == 2) ? 6 : 10; return s.size() * charWidth; } @@ -1129,7 +1129,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); + _vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i += step; } while (i != yy); } else { @@ -1141,7 +1141,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); + _vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (i != xx); } @@ -1154,11 +1154,15 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { int co; - if (g_vm->_currGraphicalDevice == MODE_CGA) + if (_vm->_currGraphicalDevice == MODE_CGA) co = 3; else co = 11; - g_vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); + _vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); +} + +void ScreenSurface::setParent(MortevielleEngine *vm) { + _vm = vm; } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 7bf39c3662..026950e127 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -34,10 +34,13 @@ #include "graphics/surface.h" namespace Mortevielle { +class MortevielleEngine; class PaletteManager { -public: +private: void setPalette(const int *palette, uint idx, uint size); + +public: void setDefaultPalette(); }; @@ -74,7 +77,7 @@ public: Common::Point _offset; // Transparency palette index int _transparency; -public: + ~GfxSurface(); void decode(const byte *pSrc); @@ -82,11 +85,13 @@ public: class ScreenSurface: public Graphics::Surface { private: + MortevielleEngine *_vm; + Common::List _dirtyRects; byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; + public: Common::Point _textPos; // Original called xwhere/ywhere -public: void readFontData(Common::File &f, int dataSize); Graphics::Surface lockArea(const Common::Rect &bounds); void updateScreen(); @@ -101,6 +106,7 @@ public: int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); void drawRectangle(int x, int y, int dx, int dy); + void setParent(MortevielleEngine *vm); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 86e7a12371..b651f43d74 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -75,6 +75,8 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _soundManager(_mixer) { g_vm = this; _debugger.setParent(this); + _screenSurface.setParent(this); + _lastGameFrame = 0; _mouseClick = false; _inMainGameLoop = false; -- cgit v1.2.3 From 25c786dbe9f9a7f7680470614977ddde668136d8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 21:01:49 +0200 Subject: MORTEVIELLE: Replace g_vm in MouseHandler --- engines/mortevielle/mortevielle.cpp | 1 + engines/mortevielle/mouse.cpp | 100 +++++++++++++++++++----------------- engines/mortevielle/mouse.h | 4 ++ 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b651f43d74..7834366dd9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -76,6 +76,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g g_vm = this; _debugger.setParent(this); _screenSurface.setParent(this); + _mouse.setParent(this); _lastGameFrame = 0; _mouseClick = false; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index a6105d85de..4d3d8bb2ab 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -40,7 +40,7 @@ void MouseHandler::initMouse() { _counter = 0; _pos = Common::Point(0, 0); - g_vm->setMouseClick(false); + _vm->setMouseClick(false); } /** @@ -51,15 +51,15 @@ void MouseHandler::hideMouse() { --_counter; if (_counter == 0) { int j = 0; - switch (g_vm->_currGraphicalDevice) { + switch (_vm->_currGraphicalDevice) { case MODE_CGA: { int k = 0; j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { - WRITE_LE_UINT16(&g_vm->_mem[0xb000 * 16 + j], s_s[0][k]); - WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j + 2], s_s[1][k]); - WRITE_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j], s_s[2][k]); - WRITE_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j + 2], s_s[3][k]); + WRITE_LE_UINT16(&_vm->_mem[0xb000 * 16 + j], s_s[0][k]); + WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j + 2], s_s[1][k]); + WRITE_LE_UINT16(&_vm->_mem[0xba00 * 16 + j], s_s[2][k]); + WRITE_LE_UINT16(&_vm->_mem[0xba00 * 16 + j + 2], s_s[3][k]); j += 80; ++k; } while (k < 5); @@ -72,10 +72,10 @@ void MouseHandler::hideMouse() { j = 0; do { if (imp) { - WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j], s_s[i][k]); j += 80 - 0x2000; } else { - WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j], s_s[i][k]); + WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j], s_s[i][k]); j += 0x2000; } imp = !imp; @@ -92,11 +92,11 @@ void MouseHandler::hideMouse() { do { // Useless ? // ps = mem[0xa000 * 16 + j]; - g_vm->_mem[0xa000 * 16 + j] = lo(s_s[i][k]); + _vm->_mem[0xa000 * 16 + j] = lo(s_s[i][k]); // Useless ?? // ps = mem[0xa000 * 16 + j + 1]; - g_vm->_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); + _vm->_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); j += 80; ++k; } while (k < 8); @@ -108,7 +108,7 @@ void MouseHandler::hideMouse() { j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (int i = 0; i <= 5; ++i) { for (int k = 0; k <= 3; ++k) - WRITE_LE_UINT16(&g_vm->_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); + WRITE_LE_UINT16(&_vm->_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); j += 80; } break; @@ -117,8 +117,8 @@ void MouseHandler::hideMouse() { int k = 0; do { for (int i = 0; i <= 3; ++i) { - WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); - WRITE_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); + WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); + WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); } j += 160; ++k; @@ -143,15 +143,15 @@ void MouseHandler::showMouse() { return; int j = 0; int i = _pos.x & 7; - switch (g_vm->_currGraphicalDevice) { + switch (_vm->_currGraphicalDevice) { case MODE_CGA: k = 0; j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); do { - s_s[0][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); - s_s[1][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j + 2]); - s_s[2][k] = READ_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j]); - s_s[3][k] = READ_LE_UINT16(&g_vm->_mem[0xba00 * 16 + j + 2]); + s_s[0][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); + s_s[1][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j + 2]); + s_s[2][k] = READ_LE_UINT16(&_vm->_mem[0xba00 * 16 + j]); + s_s[3][k] = READ_LE_UINT16(&_vm->_mem[0xba00 * 16 + j + 2]); j += 80; ++k; } while (k < 5); @@ -164,10 +164,10 @@ void MouseHandler::showMouse() { k = 0; do { if (imp) { - s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); j += 80 - 0x2000; } else { - s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + j]); + s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); j += 0x2000; } imp = !imp; @@ -182,7 +182,7 @@ void MouseHandler::showMouse() { k = 0; j = 0; do { - s_s[l][k] = g_vm->_mem[0xa000 * 16 + j] + (g_vm->_mem[(0xa000 * 16) + j + 1] << 8); + s_s[l][k] = _vm->_mem[0xa000 * 16 + j] + (_vm->_mem[(0xa000 * 16) + j + 1] << 8); j += 80; ++k; } while (k < 8); @@ -193,7 +193,7 @@ void MouseHandler::showMouse() { j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); for (i = 0; i <= 5; ++i) { for (k = 0; k <= 3; ++k) - s_s[i][k] = READ_LE_UINT16(&g_vm->_mem[0xb000 * 16 + k * 0x200 + j]); + s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb000 * 16 + k * 0x200 + j]); j += 80; } break; @@ -202,8 +202,8 @@ void MouseHandler::showMouse() { k = 0; do { for (i = 0; i <= 3; ++i) { - s_s[k][i + (k << 2)] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j]); - s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&g_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2]); + s_s[k][i + (k << 2)] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j]); + s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2]); } j += 160; ++k; @@ -219,8 +219,8 @@ void MouseHandler::showMouse() { * @remarks Originally called 'pos_mouse' */ void MouseHandler::setMousePosition(Common::Point newPos) { - if (newPos.x > 314 * g_vm->_resolutionScaler) - newPos.x = 314 * g_vm->_resolutionScaler; + if (newPos.x > 314 * _vm->_resolutionScaler) + newPos.x = 314 * _vm->_resolutionScaler; else if (newPos.x < 0) newPos.x = 0; if (newPos.y > 199) @@ -231,7 +231,7 @@ void MouseHandler::setMousePosition(Common::Point newPos) { return; // Set the new position - g_vm->setMousePos(newPos); + _vm->setMousePos(newPos); } /** @@ -239,9 +239,9 @@ void MouseHandler::setMousePosition(Common::Point newPos) { * @remarks Originally called 'read_pos_mouse' */ void MouseHandler::getMousePosition(int &x, int &y, bool &click) { - x = g_vm->getMousePos().x; - y = g_vm->getMousePos().y; - click = g_vm->getMouseClick(); + x = _vm->getMousePos().x; + y = _vm->getMousePos().y; + click = _vm->getMouseClick(); } /** @@ -257,18 +257,18 @@ void MouseHandler::moveMouse(bool &funct, char &key) { // Set defaults and check pending events funct = false; key = '\377'; - p_key = g_vm->keyPressed(); + p_key = _vm->keyPressed(); // If mouse button clicked, return it - if (g_vm->getMouseClick()) + if (_vm->getMouseClick()) return; // Handle any pending keypresses while (p_key) { - if (g_vm->shouldQuit()) + if (_vm->shouldQuit()) return; - in1 = g_vm->getChar(); + in1 = _vm->getChar(); getMousePosition(cx, cy, click); switch (toupper(in1)) { case '4': @@ -292,27 +292,27 @@ void MouseHandler::moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * g_vm->_resolutionScaler; + cx = 315 * _vm->_resolutionScaler; cy = 1; break; case '3': cy = 190; - cx = 315 * g_vm->_resolutionScaler; + cx = 315 * _vm->_resolutionScaler; break; case '5': cy = 100; - cx = 155 * g_vm->_resolutionScaler; + cx = 155 * _vm->_resolutionScaler; break; case ' ': case '\15': - g_vm->setMouseClick(true); + _vm->setMouseClick(true); return; break; case '\33': - p_key = g_vm->keyPressed(); + p_key = _vm->keyPressed(); if (p_key) { - in2 = g_vm->getChar(); + in2 = _vm->getChar(); if ((in2 >= ';') && (in2 <= 'D')) { funct = true; @@ -355,31 +355,31 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } break; case 'I': - cx = g_vm->_resolutionScaler * 32; + cx = _vm->_resolutionScaler * 32; cy = 8; break; case 'D': - cx = 80 * g_vm->_resolutionScaler; + cx = 80 * _vm->_resolutionScaler; cy = 8; break; case 'A': - cx = 126 * g_vm->_resolutionScaler; + cx = 126 * _vm->_resolutionScaler; cy = 8; break; case 'S': - cx = 174 * g_vm->_resolutionScaler; + cx = 174 * _vm->_resolutionScaler; cy = 8; break; case 'P': - cx = 222 * g_vm->_resolutionScaler; + cx = 222 * _vm->_resolutionScaler; cy = 8; break; case 'F': - cx = g_vm->_resolutionScaler * 270; + cx = _vm->_resolutionScaler * 270; cy = 8; break; case '\23': - g_vm->_soundOff = !g_vm->_soundOff; + _vm->_soundOff = !_vm->_soundOff; return; break; case '\24': // ^T => mode tandy @@ -401,7 +401,7 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } setMousePosition(Common::Point(cx, cy)); - p_key = g_vm->keyPressed(); + p_key = _vm->keyPressed(); } } @@ -420,4 +420,8 @@ bool MouseHandler::isMouseIn(Common::Rect r) { return false; } +void MouseHandler::setParent(MortevielleEngine *vm) { + _vm = vm; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 58e3fc78d0..1b9856e2c4 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -31,14 +31,18 @@ #include "common/rect.h" namespace Mortevielle { +class MortevielleEngine; class MouseHandler { private: + MortevielleEngine *_vm; + int s_s[12][6]; int _counter; public: Common::Point _pos; + void setParent(MortevielleEngine *vm); void initMouse(); void hideMouse(); void showMouse(); -- cgit v1.2.3 From a3f77d63df7d462d8c9c8e85cca9ccc84f5f1e70 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Jun 2013 21:49:30 +0200 Subject: MORTEVIELLE: Replace g_vm in TextHandler --- engines/mortevielle/mortevielle.cpp | 1 + engines/mortevielle/outtext.cpp | 108 +++++++++++++++++++----------------- engines/mortevielle/outtext.h | 3 + 3 files changed, 60 insertions(+), 52 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7834366dd9..104a340317 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -77,6 +77,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _debugger.setParent(this); _screenSurface.setParent(this); _mouse.setParent(this); + _text.setParent(this); _lastGameFrame = 0; _mouseClick = false; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4bdfcb4699..7778eb3484 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -59,8 +59,8 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int // Safeguard: add $ just in case inputStr += '$'; - g_vm->_screenSurface.putxy(x, y); - if (g_vm->_resolutionScaler == 1) + _vm->_screenSurface.putxy(x, y); + if (_vm->_resolutionScaler == 1) tab = 10; else tab = 6; @@ -76,43 +76,43 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int while (!stringParsed) { switch (inputStr[p]) { case '@': - g_vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface.drawString(s, typ); s = ""; ++p; xc = x; yc += 6; - g_vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface.putxy(xc, yc); break; case ' ': s += ' '; xc += tab; ++p; if (nextWord(p, inputStr.c_str(), tab) + xc > xf) { - g_vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface.drawString(s, typ); s = ""; xc = x; yc += 6; if (yc > yf) { - while (!g_vm->keyPressed()) + while (!_vm->keyPressed()) ; i = y; do { j = x; do { - g_vm->_screenSurface.putxy(j, i); - g_vm->_screenSurface.drawString(" ", 0); + _vm->_screenSurface.putxy(j, i); + _vm->_screenSurface.drawString(" ", 0); j += 6; } while (j <= xf); i += 6; } while (i <= yf); yc = y; } - g_vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface.putxy(xc, yc); } break; case '$': stringParsed = true; - g_vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface.drawString(s, typ); break; default: s += inputStr[p]; @@ -144,14 +144,14 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt int totalLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (totalLength > 0) { - f.read(&g_vm->_mem[memIndx], 128); + f.read(&_vm->_mem[memIndx], 128); totalLength -= 128; memIndx += 128; } f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_vm->_mem[0x7000 * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; + _vm->_mem[0x7000 * 16 + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; } /** @@ -175,14 +175,14 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt int fullLength = length + remainingSkipSize; int memIndx = 0x6000 * 16; while (fullLength > 0) { - f.read(&g_vm->_mem[memIndx], 128); + f.read(&_vm->_mem[memIndx], 128); fullLength -= 128; memIndx += 128; } f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - g_vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = g_vm->_mem[0x6000 * 16 + i]; + _vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; } void TextHandler::taffich() { @@ -195,60 +195,60 @@ void TextHandler::taffich() { int32 lgt; int alllum[16]; - int a = g_vm->_caff; + int a = _vm->_caff; if ((a >= 153) && (a <= 161)) a = tran2[a - 153]; else if ((a >= 136) && (a <= 140)) a = tran1[a - 136]; int b = a; - if (g_vm->_maff == a) + if (_vm->_maff == a) return; switch (a) { case 16: - g_vm->_coreVar._pctHintFound[9] = '*'; - g_vm->_coreVar._availableQuestion[42] = '*'; + _vm->_coreVar._pctHintFound[9] = '*'; + _vm->_coreVar._availableQuestion[42] = '*'; break; case 20: - g_vm->_coreVar._availableQuestion[39] = '*'; - if (g_vm->_coreVar._availableQuestion[36] == '*') { - g_vm->_coreVar._pctHintFound[3] = '*'; - g_vm->_coreVar._availableQuestion[38] = '*'; + _vm->_coreVar._availableQuestion[39] = '*'; + if (_vm->_coreVar._availableQuestion[36] == '*') { + _vm->_coreVar._pctHintFound[3] = '*'; + _vm->_coreVar._availableQuestion[38] = '*'; } break; case 24: - g_vm->_coreVar._availableQuestion[37] = '*'; + _vm->_coreVar._availableQuestion[37] = '*'; break; case 30: - g_vm->_coreVar._availableQuestion[9] = '*'; + _vm->_coreVar._availableQuestion[9] = '*'; break; case 31: // Coat of arms - g_vm->_coreVar._pctHintFound[4] = '*'; - g_vm->_coreVar._availableQuestion[35] = '*'; + _vm->_coreVar._pctHintFound[4] = '*'; + _vm->_coreVar._availableQuestion[35] = '*'; break; case 118: - g_vm->_coreVar._availableQuestion[41] = '*'; + _vm->_coreVar._availableQuestion[41] = '*'; break; case 143: - g_vm->_coreVar._pctHintFound[1] = '*'; + _vm->_coreVar._pctHintFound[1] = '*'; break; case 150: - g_vm->_coreVar._availableQuestion[34] = '*'; + _vm->_coreVar._availableQuestion[34] = '*'; break; case 151: - g_vm->_coreVar._pctHintFound[2] = '*'; + _vm->_coreVar._pctHintFound[2] = '*'; break; default: break; } - g_vm->_destinationOk = true; - g_vm->_mouse.hideMouse(); + _vm->_destinationOk = true; + _vm->_mouse.hideMouse(); lgt = 0; Common::String filename; if ((a != 50) && (a != 51)) { - g_vm->_maff = a; + _vm->_maff = a; if (a == 159) a = 86; else if (a > 140) @@ -268,28 +268,28 @@ void TextHandler::taffich() { npal = a; for (cx = 0; cx <= (a - 1); ++cx) - lgt += g_vm->_fxxBuffer[cx]; - handle = g_vm->_fxxBuffer[a]; + lgt += _vm->_fxxBuffer[cx]; + handle = _vm->_fxxBuffer[a]; filename = "DXX.mor"; } else { - if (g_vm->getLanguage() == Common::DE_DEU) + if (_vm->getLanguage() == Common::DE_DEU) filename = "DZZALL"; else filename = "DZZ.mor"; - handle = g_vm->_fxxBuffer[87]; + handle = _vm->_fxxBuffer[87]; if (a == 51) { lgt = handle; - handle = g_vm->_fxxBuffer[88]; + handle = _vm->_fxxBuffer[88]; } - g_vm->_maff = a; + _vm->_maff = a; npal = a + 37; } loadDesFile(filename, lgt, handle); - if (g_vm->_currGraphicalDevice == MODE_HERCULES) { + if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&g_vm->_mem[(0x7000 * 16) + ((i + 1) << 1)]); + int palh = READ_LE_UINT16(&_vm->_mem[(0x7000 * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -297,12 +297,12 @@ void TextHandler::taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - g_vm->_mem[(0x7000 * 16) + 2 + (k << 1)] = _rang[i]; + _vm->_mem[(0x7000 * 16) + 2 + (k << 1)] = _rang[i]; alllum[k] = -1; } } - g_vm->_numpal = npal; - g_vm->setPal(npal); + _vm->_numpal = npal; + _vm->setPal(npal); if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { lgt = 0; @@ -314,8 +314,8 @@ void TextHandler::taffich() { else if (b > 15) --b; for (cx = 0; cx <= (b - 1); ++cx) - lgt += g_vm->_fxxBuffer[cx + 89]; - handle = g_vm->_fxxBuffer[b + 89]; + lgt += _vm->_fxxBuffer[cx + 89]; + handle = _vm->_fxxBuffer[b + 89]; filename = "AXX.mor"; } else if (b == 50) { filename = "AZZ.mor"; @@ -323,14 +323,18 @@ void TextHandler::taffich() { } loadAniFile(filename, lgt, handle); } - g_vm->_mouse.showMouse(); - if ((a < 27) && ((g_vm->_maff < 27) || (g_vm->_coreVar._currPlace == LANDING)) && (g_vm->_msg[4] != OPCODE_ENTER)) { + _vm->_mouse.showMouse(); + if ((a < 27) && ((_vm->_maff < 27) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) - g_vm->displayAloneText(); - else if (!g_vm->_blo) - g_vm->getPresence(g_vm->_coreVar._currPlace); - g_vm->_savedBitIndex = 0; + _vm->displayAloneText(); + else if (!_vm->_blo) + _vm->getPresence(_vm->_coreVar._currPlace); + _vm->_savedBitIndex = 0; } } +void TextHandler::setParent(MortevielleEngine *vm) { + _vm = vm; +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 25162981c6..a4b078682a 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -31,13 +31,16 @@ #include "common/str.h" namespace Mortevielle { +class MortevielleEngine; const int kAdrAni = 0x7314; class TextHandler { private: + MortevielleEngine *_vm; int nextWord(int p, const char *ch, int &tab); public: + void setParent(MortevielleEngine *vm); void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); void loadDesFile(Common::String filename, int32 passe, int long_); void loadAniFile(Common::String filename, int32 skipSize, int length); -- cgit v1.2.3 From 0634f516968a2869895c942cb17859e738e4d802 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 25 Jun 2013 22:49:01 +0200 Subject: NEVERHOOD: Fix bug in Module 1100, scene 2 which made the "Klayman, up here" scene was unreachable. Sound bug still present, though. --- engines/neverhood/modules/module1100.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 0c09ed5242..dbd8c60210 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -64,6 +64,7 @@ Module1100::~Module1100() { void Module1100::createScene(int sceneNum, int which) { static const uint32 kSmackerFileHashList06[] = {0x10880805, 0x1088081D, 0}; static const uint32 kSmackerFileHashList07[] = {0x00290321, 0x01881000, 0}; + static const byte kNavigationTypes02[] = {1, 0, 4, 1}; debug(1, "Module1100::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; switch (_sceneNum) { @@ -80,9 +81,9 @@ void Module1100::createScene(int sceneNum, int which) { case 2: _vm->gameState().sceneNum = 2; if (getGlobalVar(V_ROBOT_TARGET)) { - createNavigationScene(0x004B84F0, which); + createNavigationScene(0x004B84F0, which, kNavigationTypes02); } else { - createNavigationScene(0x004B8490, which); + createNavigationScene(0x004B8490, which, kNavigationTypes02); } break; case 3: -- cgit v1.2.3 From 1989cc9911709ccddf3999b772e786ec79f8fc3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 01:06:22 +0200 Subject: MORTEVIELLE: Replace g_vm in SoundManager --- engines/mortevielle/mortevielle.cpp | 1 + engines/mortevielle/sound.cpp | 7 +++++-- engines/mortevielle/sound.h | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 104a340317..54bd0301aa 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -78,6 +78,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _screenSurface.setParent(this); _mouse.setParent(this); _text.setParent(this); + _soundManager.setParent(this); _lastGameFrame = 0; _mouseClick = false; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index bb85221d75..478af41c87 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -192,10 +192,13 @@ void SoundManager::musyc(tablint &tb, int nbseg, int att) { } // Keep waiting until the song has been finished - while (_speakerStream->isPlaying() && !g_vm->shouldQuit()) { - g_vm->delay(10); + while (_speakerStream->isPlaying() && !_vm->shouldQuit()) { + _vm->delay(10); } #endif } +void SoundManager::setParent(MortevielleEngine *vm) { + _vm = vm; +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 675fc78f78..a47e8db32e 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -34,6 +34,7 @@ #include "common/queue.h" namespace Mortevielle { +class MortevielleEngine; typedef int tablint[256]; @@ -93,6 +94,7 @@ public: class SoundManager { private: + MortevielleEngine *_vm; Audio::Mixer *_mixer; PCSpeaker *_speakerStream; Audio::SoundHandle _speakerHandle; @@ -100,6 +102,7 @@ public: SoundManager(Audio::Mixer *mixer); ~SoundManager(); + void setParent(MortevielleEngine *vm); void playNote(int frequency, int32 length); void decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg); -- cgit v1.2.3 From e26fb8e7d239052d9645aa0bfb75500ddc3aa132 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 26 Jun 2013 01:59:31 +0200 Subject: WINTERMUTE: Add detection for J.U.L.I.A. (Greenlight Demo) --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index ad4256e6b9..09426c9307 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -324,6 +324,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_DEMO, GUIO0() }, + // J.U.L.I.A. (English) (Greenlight Demo) + { + "julia", + "Greenlight Demo", + AD_ENTRY1s("data.dcp", "4befd448d36b0dae9c3ab1aa7cb8b78d", 7271886), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Mirage { "mirage", -- cgit v1.2.3 From 5086153512d78e0ee5b46808bbf2ba7a8259ab54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 07:42:49 +0200 Subject: MORTEVIELLE: Replace g_vm in SpeechManager --- engines/mortevielle/mortevielle.cpp | 1 + engines/mortevielle/speech.cpp | 31 +++++++++++++++++-------------- engines/mortevielle/speech.h | 3 +++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 54bd0301aa..6199252674 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -79,6 +79,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _mouse.setParent(this); _text.setParent(this); _soundManager.setParent(this); + _speechManager.setParent(this); _lastGameFrame = 0; _mouseClick = false; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 853d6baae0..1fe130af83 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -81,7 +81,7 @@ void SpeechManager::spfrac(int wor) { } void SpeechManager::charg_car(int &currWordNumb) { - int wor = swap(READ_LE_UINT16(&g_vm->_mem[kAdrWord + currWordNumb])); + int wor = swap(READ_LE_UINT16(&_vm->_mem[kAdrWord + currWordNumb])); int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { @@ -121,7 +121,7 @@ void SpeechManager::charg_car(int &currWordNumb) { void SpeechManager::entroct(byte o) { - g_vm->_mem[kAdrTroct * 16 + _ptr_oct] = o; + _vm->_mem[kAdrTroct * 16 + _ptr_oct] = o; ++_ptr_oct; } @@ -134,7 +134,7 @@ void SpeechManager::cctable(tablint &t) { tb[0] = 0; for (int k = 0; k <= 255; ++k) { - tb[k + 1] = g_vm->_addFix + tb[k]; + tb[k + 1] = _vm->_addFix + tb[k]; t[255 - k] = abs((int)tb[k] + 1); } } @@ -143,7 +143,7 @@ void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { - _cfiphBuffer[j] = READ_LE_UINT16(&g_vm->_mem[kAdrNoise3 + i]); + _cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[kAdrNoise3 + i]); i += 2; ++j; } while (i < kOffsetB3 + 8790); @@ -159,9 +159,9 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&g_vm->_mem[0x7414 * 16 + 0], 273); + f.read(&_vm->_mem[0x7414 * 16 + 0], 273); - g_vm->_soundManager.decodeMusic(&g_vm->_mem[0x7414 * 16], &g_vm->_mem[kAdrNoise * 16], 273); + _vm->_soundManager.decodeMusic(&_vm->_mem[0x7414 * 16], &_vm->_mem[kAdrNoise * 16], 273); f.close(); } @@ -192,10 +192,10 @@ void SpeechManager::loadNoise() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&g_vm->_mem[kAdrNoise * 16 + 0], 250); + f.read(&_vm->_mem[kAdrNoise * 16 + 0], 250); for (i = 0; i <= 19013; ++i) - g_vm->_mem[kAdrNoise * 16 + 32000 + i] = g_vm->_mem[kAdrNoise5 + i]; - f.read(&g_vm->_mem[kAdrNoise1 * 16 + kOffsetB1], 149); + _vm->_mem[kAdrNoise * 16 + 32000 + i] = _vm->_mem[kAdrNoise5 + i]; + f.read(&_vm->_mem[kAdrNoise1 * 16 + kOffsetB1], 149); f.close(); } @@ -531,7 +531,7 @@ void SpeechManager::handlePhoneme() { int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&g_vm->_mem[kAdrWord + currWord], _cfiphBuffer[i]); + WRITE_LE_UINT16(&_vm->_mem[kAdrWord + currWord], _cfiphBuffer[i]); _ptr_oct = 0; int currWord = 0; @@ -556,7 +556,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { int savph[501]; int tempo; - if (g_vm->_soundOff) + if (_vm->_soundOff) return; _phonemeNumb = rep; @@ -570,7 +570,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { tempo = kTempoF; else tempo = kTempoM; - g_vm->_addFix = (float)((tempo - 8)) / 256; + _vm->_addFix = (float)((tempo - 8)) / 256; cctable(_tbi); switch (typ) { case 1: @@ -586,13 +586,16 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { break; } handlePhoneme(); - g_vm->_soundManager.litph(_tbi, typ, tempo); + _vm->_soundManager.litph(_tbi, typ, tempo); if (_typlec != 0) for (int i = 0; i <= 500; ++i) { _cfiphBuffer[i] = savph[i]; _mlec = _typlec; } - g_vm->setPal(g_vm->_numpal); + _vm->setPal(_vm->_numpal); } +void SpeechManager::setParent(MortevielleEngine *vm) { + _vm = vm; +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index c27f2bfc15..4f98c4c3d7 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -66,6 +66,8 @@ struct SpeechQueue { class SpeechManager { private: + MortevielleEngine *_vm; + int _typlec; int _phonemeNumb; @@ -78,6 +80,7 @@ public: int _mlec; SpeechManager(); + void setParent(MortevielleEngine *vm); void spfrac(int wor); void charg_car(int &currWordNumb); void entroct(byte o); -- cgit v1.2.3 From cf26edf3854ec2441e9ce5e11fada17cfc530754 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 07:51:11 +0200 Subject: MORTEVIELLE: Remove some useless g_vm --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/mortevielle.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 47ffb2e4ba..3a27c27069 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1408,7 +1408,7 @@ void MortevielleEngine::fctDiscuss() { do { bool dummyFl; _mouse.moveMouse(dummyFl, retKey); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; _mouse.getMousePosition(x, y, click); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6199252674..c6cafac9d6 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -582,12 +582,12 @@ void MortevielleEngine::showIntroduction() { f3f8::aff50(false); _speechManager._mlec = 0; f3f8::checkForF8(142, false); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; f3f8::ani50(); f3f8::checkForF8(143, true); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; // TODO: Once music (Amiga/Atari ports) is implemented, only use the below delay if music is turned off @@ -619,7 +619,7 @@ void MortevielleEngine::mainGame() { // Loop to play the game do { playGame(); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; } while (!_quitGame); } @@ -634,7 +634,7 @@ void MortevielleEngine::playGame() { // Loop handling actions until the game has to be quit, or show the lose or end sequence do { handleAction(); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; } while (!((_quitGame) || (_endGame) || (_loseGame))); @@ -670,7 +670,7 @@ void MortevielleEngine::handleAction() { _menu.updateMenu(); prepareRoom(); _mouse.moveMouse(funct, inkey); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; ++temps; } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); @@ -739,7 +739,7 @@ void MortevielleEngine::handleAction() { handleOpcode(); if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { - g_vm->_text.taffich(); + _text.taffich(); if (_destinationOk) { _destinationOk = false; drawPicture(); @@ -1759,7 +1759,7 @@ void MortevielleEngine::startDialog(int16 rep) { do { _speechManager.startSpeech(rep, haut[_caff - 69], 0); key = f3f8::waitForF3F8(); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; } while (key != 66); hirs(); @@ -3395,7 +3395,7 @@ void MortevielleEngine::testKey(bool d) { prepareRoom(); quest = keyPressed(); _mouse.getMousePosition(x, y, click); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; } while (!(quest || (click) || (d && _anyone))); if (quest) @@ -3631,7 +3631,7 @@ void MortevielleEngine::tfleche() { do { _mouse.moveMouse(qust, touch); - if (g_vm->shouldQuit()) + if (shouldQuit()) return; if (getMouseClick()) -- cgit v1.2.3 From 7aceea722161038fa892f89d81479c06c5ab6a18 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 08:29:09 +0200 Subject: MORTEVIELLE: Introduce DialogManager and get rid of static functions --- engines/mortevielle/actions.cpp | 20 ++++++++++---------- engines/mortevielle/dialogs.cpp | 27 +++++++++++++++------------ engines/mortevielle/dialogs.h | 34 +++++++++++++++------------------- engines/mortevielle/mortevielle.cpp | 19 ++++++++++--------- engines/mortevielle/mortevielle.h | 3 ++- 5 files changed, 52 insertions(+), 51 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 3a27c27069..9026df8470 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -701,12 +701,12 @@ void MortevielleEngine::fctPlace() { _speechManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = Alert::show(getEngineString(S_YES_NO), 1); + int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { Common::String alertTxt = getString(582); - Alert::show(alertTxt, 1); + _dialogManager.show(alertTxt, 1); - bool enterPassageFl = KnowledgeCheck::show(); + bool enterPassageFl = _dialogManager.showKnowledgeCheck(); _mouse.hideMouse(); hirs(); drawRightFrame(); @@ -731,7 +731,7 @@ void MortevielleEngine::fctPlace() { aniof(1, 2); aniof(1, 1); alertTxt = getString(577); - Alert::show(alertTxt, 1); + _dialogManager.show(alertTxt, 1); aniof(2, 1); _crep = 166; } @@ -800,7 +800,7 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); _speechManager.startSpeech(7, 9, 1); - int answer = Alert::show(getEngineString(S_YES_NO), 1); + int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) _endGame = true; else @@ -810,7 +810,7 @@ void MortevielleEngine::fctTurn() { handleDescriptionText(2, 175); clearVerbBar(); _speechManager.startSpeech(6, -9, 1); - int answer = Alert::show(getEngineString(S_YES_NO), 1); + int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { _coreVar._currPlace = CRYPT; affrep(); @@ -915,7 +915,7 @@ void MortevielleEngine::fctKnock() { displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { - Alert::show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); + _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } @@ -1225,7 +1225,7 @@ void MortevielleEngine::fctSleep() { if (h > 23) h = 0; prepareRoom(); - answer = Alert::show(getEngineString(S_YES_NO), 1); + answer = _dialogManager.show(getEngineString(S_YES_NO), 1); _anyone = false; } while (answer != 1); _crep = 998; @@ -1315,7 +1315,7 @@ void MortevielleEngine::fctWait() { return; } handleDescriptionText(2, 102); - answer = Alert::show(getEngineString(S_YES_NO), 1); + answer = _dialogManager.show(getEngineString(S_YES_NO), 1); } while (answer != 2); _crep = 998; if (!_anyone) @@ -1632,7 +1632,7 @@ void MortevielleEngine::askRestart() { _day = 0; handleDescriptionText(2, 180); - int answer = Alert::show(getEngineString(S_YES_NO), 1); + int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 90c53d1648..4c7fddfccd 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -38,7 +38,7 @@ namespace Mortevielle { * Alert function - Show * @remarks Originally called 'do_alert' */ -int Alert::show(const Common::String &msg, int n) { +int DialogManager::show(const Common::String &msg, int n) { // Make a copy of the current screen surface for later restore g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); @@ -188,7 +188,7 @@ int Alert::show(const Common::String &msg, int n) { * Alert function - Decode Alert Details * @remarks Originally called 'decod' */ -void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr) { +void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr) { // The second character of the string contains the number of choices choiceNumb = atoi(inputStr.c_str() + 1); @@ -228,7 +228,7 @@ void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &li col *= 10; } -void Alert::setPosition(int ji, int coldep, int esp) { +void DialogManager::setPosition(int ji, int coldep, int esp) { g_vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); } @@ -236,7 +236,7 @@ void Alert::setPosition(int ji, int coldep, int esp) { * Alert function - Draw Alert Box * @remarks Originally called 'fait_boite' */ -void Alert::drawAlertBox(int lidep, int nli, int tx) { +void DialogManager::drawAlertBox(int lidep, int nli, int tx) { if (tx > 640) tx = 640; int x = 320 - ((uint)tx / 2); @@ -252,7 +252,7 @@ void Alert::drawAlertBox(int lidep, int nli, int tx) { * Alert function - Set Button Text * @remarks Originally called 'fait_choix' */ -void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { +void DialogManager::setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp) { int i = 1; int x = coldep; for (int l = 1; l <= nbcase; ++l) { @@ -283,7 +283,7 @@ void Alert::setButtonText(Common::String c, int coldep, int nbcase, Common::Stri /** * Questions asked before entering the hidden passage */ -bool KnowledgeCheck::show() { +bool DialogManager::showKnowledgeCheck() { const int textIndexArr[10] = {511, 516, 524, 531, 545, 552, 559, 563, 570, 576}; const int correctAnswerArr[10] = {4, 7, 1, 6, 4, 4, 2, 5, 3, 1 }; @@ -402,7 +402,7 @@ bool KnowledgeCheck::show() { /** * Draw the F3/F8 dialog */ -void f3f8::draw() { +void DialogManager::drawF3F8() { Common::String f3 = g_vm->getEngineString(S_F3); Common::String f8 = g_vm->getEngineString(S_F8); @@ -425,7 +425,7 @@ void f3f8::draw() { * Graphical Device if modified * @remarks Originally called 'diver' */ -void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { +void DialogManager::checkForF8(int SpeechNum, bool drawAni50Fl) { g_vm->testKeyboard(); do { g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); @@ -445,7 +445,7 @@ void f3f8::checkForF8(int SpeechNum, bool drawAni50Fl) { * Alert function - Loop until F3 or F8 is pressed * @remarks Originally called 'atf3f8' */ -int f3f8::waitForF3F8() { +int DialogManager::waitForF3F8() { int key; do { @@ -457,7 +457,7 @@ int f3f8::waitForF3F8() { return key; } -void f3f8::aff50(bool drawAni50Fl) { +void DialogManager::aff50(bool drawAni50Fl) { g_vm->_caff = 50; g_vm->_maff = 0; g_vm->_text.taffich(); @@ -468,10 +468,10 @@ void f3f8::aff50(bool drawAni50Fl) { g_vm->handleDescriptionText(2, kDialogStringIndex + 142); // Draw the f3/f8 dialog - draw(); + drawF3F8(); } -void f3f8::ani50() { +void DialogManager::ani50() { g_vm->_crep = g_vm->animof(1, 1); g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); g_vm->_crep = g_vm->animof(2, 1); @@ -480,4 +480,7 @@ void f3f8::ani50() { g_vm->handleDescriptionText(2, kDialogStringIndex + 143); } +void DialogManager::setParent(MortevielleEngine *vm) { + _vm = vm; +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 9b980af379..35c3c34cac 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -32,6 +32,7 @@ #include "common/str.h" namespace Mortevielle { +class MortevielleEngine; static const int NUM_LINES = 7; const int kMaxHotspots = 14; @@ -41,28 +42,23 @@ struct Hotspot { bool _enabled; }; -class Alert { +class DialogManager { private: - static void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); - static void setPosition(int ji, int coldep, int esp); - static void drawAlertBox(int lidep, int nli, int tx); - static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); -public: - static int show(const Common::String &msg, int n); -}; - -class KnowledgeCheck { -public: - static bool show(); -}; + MortevielleEngine *_vm; -class f3f8 { + void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); + void setPosition(int ji, int coldep, int esp); + void drawAlertBox(int lidep, int nli, int tx); + void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: - static void draw(); - static void checkForF8(int SpeechNum, bool drawAni50Fl); - static int waitForF3F8(); - static void aff50(bool drawAni50Fl); - static void ani50(); + void setParent(MortevielleEngine *vm); + int show(const Common::String &msg, int n); + void drawF3F8(); + void checkForF8(int SpeechNum, bool drawAni50Fl); + int waitForF3F8(); + void aff50(bool drawAni50Fl); + void ani50(); + bool showKnowledgeCheck(); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c6cafac9d6..95750f5c4a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -75,6 +75,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _soundManager(_mixer) { g_vm = this; _debugger.setParent(this); + _dialogManager.setParent(this); _screenSurface.setParent(this); _mouse.setParent(this); _text.setParent(this); @@ -579,14 +580,14 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - f3f8::aff50(false); + _dialogManager.aff50(false); _speechManager._mlec = 0; - f3f8::checkForF8(142, false); + _dialogManager.checkForF8(142, false); if (shouldQuit()) return; - f3f8::ani50(); - f3f8::checkForF8(143, true); + _dialogManager.ani50(); + _dialogManager.checkForF8(143, true); if (shouldQuit()) return; @@ -689,7 +690,7 @@ void MortevielleEngine::handleAction() { if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) _savegameManager.loadGame((_msg[4] & 15) - 1); if (inkey == '\103') { /* F9 */ - temps = Alert::show(_hintPctMessage, 1); + temps = _dialogManager.show(_hintPctMessage, 1); return; } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { @@ -1753,12 +1754,12 @@ void MortevielleEngine::startDialog(int16 rep) { _mouse.hideMouse(); Common::String dialogStr = getString(rep + kDialogStringIndex); _text.displayStr(dialogStr, 230, 4, 65, 24, 5); - f3f8::draw(); + _dialogManager.drawF3F8(); key = 0; do { _speechManager.startSpeech(rep, haut[_caff - 69], 0); - key = f3f8::waitForF3F8(); + key = _dialogManager.waitForF3F8(); if (shouldQuit()) return; } while (key != 66); @@ -2164,7 +2165,7 @@ int MortevielleEngine::getRandomNumber(int minval, int maxval) { * @remarks Originally called 'aldepl' */ void MortevielleEngine::showMoveMenuAlert() { - Alert::show(getEngineString(S_USE_DEP_MENU), 1); + _dialogManager.show(getEngineString(S_USE_DEP_MENU), 1); } /** @@ -3640,7 +3641,7 @@ void MortevielleEngine::tfleche() { } while (!(qust || inRect || _anyone)); if (qust && (touch == '\103')) - Alert::show(_hintPctMessage, 1); + _dialogManager.show(_hintPctMessage, 1); } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); if (touch == '\73') diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index bdf28e4514..9facc5ef86 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -38,6 +38,7 @@ #include "common/error.h" #include "graphics/surface.h" #include "mortevielle/debugger.h" +#include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" #include "mortevielle/mouse.h" @@ -487,6 +488,7 @@ public: Menu _menu; MouseHandler _mouse; TextHandler _text; + DialogManager _dialogManager; MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -528,7 +530,6 @@ public: void pictout(int seg, int dep, int x, int y); void sauvecr(int y, int dy); void charecr(int y, int dy); - }; extern MortevielleEngine *g_vm; -- cgit v1.2.3 From ac387835e4527c1814919093b4e4bc9798d5742d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 08:30:47 +0200 Subject: MORTEVIELLE: Use _vm instead of g_vm in DialogManager --- engines/mortevielle/dialogs.cpp | 178 ++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 4c7fddfccd..1fadf1eaab 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -40,13 +40,13 @@ namespace Mortevielle { */ int DialogManager::show(const Common::String &msg, int n) { // Make a copy of the current screen surface for later restore - g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); - g_vm->_mouse.hideMouse(); - while (g_vm->keyPressed()) - g_vm->getChar(); + _vm->_mouse.hideMouse(); + while (_vm->keyPressed()) + _vm->getChar(); - g_vm->setMouseClick(false); + _vm->setMouseClick(false); int colNumb = 0; int lignNumb = 0; @@ -55,7 +55,7 @@ int DialogManager::show(const Common::String &msg, int n) { Common::String caseStr; decodeAlertDetails(msg, caseNumb, lignNumb, colNumb, alertStr, caseStr); - g_vm->sauvecr(50, (NUM_LINES + 1) << 4); + _vm->sauvecr(50, (NUM_LINES + 1) << 4); int i = 0; Common::Point curPos; @@ -64,21 +64,21 @@ int DialogManager::show(const Common::String &msg, int n) { } else { drawAlertBox(8, 7, colNumb); i = 0; - g_vm->_screenSurface._textPos.y = 70; + _vm->_screenSurface._textPos.y = 70; do { curPos.x = 320; Common::String displayStr = ""; while ((alertStr[i + 1] != '\174') && (alertStr[i + 1] != '\135')) { ++i; displayStr += alertStr[i]; - if (g_vm->_resolutionScaler == 2) + if (_vm->_resolutionScaler == 2) curPos.x -= 3; else curPos.x -= 5; } - g_vm->_screenSurface.putxy(curPos.x, g_vm->_screenSurface._textPos.y); - g_vm->_screenSurface._textPos.y += 6; - g_vm->_screenSurface.drawString(displayStr, 4); + _vm->_screenSurface.putxy(curPos.x, _vm->_screenSurface._textPos.y); + _vm->_screenSurface._textPos.y += 6; + _vm->_screenSurface.drawString(displayStr, 4); ++i; } while (alertStr[i] != ']'); } @@ -95,25 +95,25 @@ int DialogManager::show(const Common::String &msg, int n) { int limit[3][3]; memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - limit[1][1] = ((uint)(coldep) / 2) * g_vm->_resolutionScaler; + limit[1][1] = ((uint)(coldep) / 2) * _vm->_resolutionScaler; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * g_vm->_resolutionScaler; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * _vm->_resolutionScaler; limit[2][2] = (limit[2][1]) + 40; } - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); int id = 0; bool dummyFl = false; bool test3; do { char dummyKey = '\377'; - g_vm->_mouse.moveMouse(dummyFl, dummyKey); - if (g_vm->shouldQuit()) + _vm->_mouse.moveMouse(dummyFl, dummyKey); + if (_vm->shouldQuit()) return 0; - curPos = g_vm->_mouse._pos; + curPos = _vm->_mouse._pos; bool newaff = false; if ((curPos.y > 95) && (curPos.y < 105)) { bool test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); @@ -129,57 +129,57 @@ int DialogManager::show(const Common::String &msg, int n) { else ix = 2; if (ix != id) { - g_vm->_mouse.hideMouse(); + _vm->_mouse.hideMouse(); if (id != 0) { setPosition(id, coldep, esp); Common::String tmpStr(" "); tmpStr += buttonStr[id]; tmpStr += " "; - g_vm->_screenSurface.drawString(tmpStr, 0); + _vm->_screenSurface.drawString(tmpStr, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += buttonStr[ix]; tmp2 += " "; - g_vm->_screenSurface.drawString(tmp2, 1); + _vm->_screenSurface.drawString(tmp2, 1); id = ix; - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); } } } if ((id != 0) && !newaff) { - g_vm->_mouse.hideMouse(); + _vm->_mouse.hideMouse(); setPosition(id, coldep, esp); Common::String tmp3(" "); tmp3 += buttonStr[id]; tmp3 += " "; - g_vm->_screenSurface.drawString(tmp3, 0); + _vm->_screenSurface.drawString(tmp3, 0); id = 0; - g_vm->_mouse.showMouse(); + _vm->_mouse.showMouse(); } test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2])) || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2]))); - } while (!g_vm->getMouseClick()); - g_vm->setMouseClick(false); - g_vm->_mouse.hideMouse(); + } while (!_vm->getMouseClick()); + _vm->setMouseClick(false); + _vm->_mouse.hideMouse(); if (!test3) { id = n; setPosition(n, coldep, esp); Common::String tmp4(" "); tmp4 += buttonStr[n]; tmp4 += " "; - g_vm->_screenSurface.drawString(tmp4, 1); + _vm->_screenSurface.drawString(tmp4, 1); } - g_vm->charecr(50, (NUM_LINES + 1) * 16); - g_vm->_mouse.showMouse(); + _vm->charecr(50, (NUM_LINES + 1) * 16); + _vm->_mouse.showMouse(); /* Restore the background area */ - g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); + _vm->_screenSurface.copyFrom(_vm->_backgroundSurface, 0, 0); return id; } @@ -221,15 +221,15 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, col += 6; } ++i; - choiceListStr = g_vm->copy(inputStr, i, 30); - if (g_vm->_resolutionScaler == 2) + choiceListStr = _vm->copy(inputStr, i, 30); + if (_vm->_resolutionScaler == 2) col *= 6; else col *= 10; } void DialogManager::setPosition(int ji, int coldep, int esp) { - g_vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); + _vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); } /** @@ -243,9 +243,9 @@ void DialogManager::drawAlertBox(int lidep, int nli, int tx) { int y = (lidep - 1) * 8; int xx = x + tx; int yy = y + (nli * 8); - g_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); - g_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); - g_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); + _vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); + _vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + _vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } /** @@ -267,13 +267,13 @@ void DialogManager::setButtonText(Common::String c, int coldep, int nbcase, Comm while (str[l].size() < 3) str[l] += ' '; - g_vm->_screenSurface.putxy(x, 98); + _vm->_screenSurface.putxy(x, 98); Common::String tmp(" "); tmp += str[l]; tmp += " "; - g_vm->_screenSurface.drawString(tmp, 0); + _vm->_screenSurface.drawString(tmp, 0); x += esp + 40; } } @@ -300,17 +300,17 @@ bool DialogManager::showKnowledgeCheck() { int correctCount = 0; for (int indx = 0; indx < 10; ++indx) { - g_vm->_mouse.hideMouse(); - g_vm->hirs(); - g_vm->_mouse.showMouse(); + _vm->_mouse.hideMouse(); + _vm->hirs(); + _vm->_mouse.showMouse(); int dialogHeight; - if (g_vm->_resolutionScaler == 1) + if (_vm->_resolutionScaler == 1) dialogHeight = 29; else dialogHeight = 23; - g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); - Common::String tmpStr = g_vm->getString(textIndexArr[indx]); - g_vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); + _vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); + Common::String tmpStr = _vm->getString(textIndexArr[indx]); + _vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); int firstOption; int lastOption; @@ -327,16 +327,16 @@ bool DialogManager::showKnowledgeCheck() { prevChoice = 1; for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) { - tmpStr = g_vm->getString(j); + tmpStr = _vm->getString(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); - g_vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0); + _vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0); choiceArray[prevChoice] = tmpStr; optionPosY += 8; } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._rect = Common::Rect(45 * g_vm->_resolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * g_vm->_resolutionScaler, 34 + j * 8); + coor[j]._rect = Common::Rect(45 * _vm->_resolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * _vm->_resolutionScaler, 34 + j * 8); coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { @@ -345,42 +345,42 @@ bool DialogManager::showKnowledgeCheck() { } coor[lastOption - firstOption + 2]._enabled = false; int rep; - if (g_vm->_resolutionScaler == 1) + if (_vm->_resolutionScaler == 1) rep = 10; else rep = 6; - g_vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); + _vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; prevChoice = 0; warning("Expected answer: %d", correctAnswerArr[indx]); do { - g_vm->setMouseClick(false); + _vm->setMouseClick(false); bool flag; char key; - g_vm->_mouse.moveMouse(flag, key); - if (g_vm->shouldQuit()) + _vm->_mouse.moveMouse(flag, key); + if (_vm->shouldQuit()) return false; currChoice = 1; - while (coor[currChoice]._enabled && !g_vm->_mouse.isMouseIn(coor[currChoice]._rect)) + while (coor[currChoice]._enabled && !_vm->_mouse.isMouseIn(coor[currChoice]._rect)) ++currChoice; if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; - g_vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { tmpStr = choiceArray[currChoice] + '$'; - g_vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); + _vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { tmpStr = choiceArray[prevChoice] + '$'; - g_vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } - } while (!((prevChoice != 0) && g_vm->getMouseClick())); + } while (!((prevChoice != 0) && _vm->getMouseClick())); if (prevChoice == correctAnswerArr[indx]) // Answer is correct @@ -403,21 +403,21 @@ bool DialogManager::showKnowledgeCheck() { * Draw the F3/F8 dialog */ void DialogManager::drawF3F8() { - Common::String f3 = g_vm->getEngineString(S_F3); - Common::String f8 = g_vm->getEngineString(S_F8); + Common::String f3 = _vm->getEngineString(S_F3); + Common::String f8 = _vm->getEngineString(S_F8); // Write the F3 and F8 text strings - g_vm->_screenSurface.putxy(3, 44); - g_vm->_screenSurface.drawString(f3, 5); - g_vm->_screenSurface._textPos.y = 51; - g_vm->_screenSurface.drawString(f8, 5); + _vm->_screenSurface.putxy(3, 44); + _vm->_screenSurface.drawString(f3, 5); + _vm->_screenSurface._textPos.y = 51; + _vm->_screenSurface.drawString(f8, 5); // Get the width of the written text strings - int f3Width = g_vm->_screenSurface.getStringWidth(f3); - int f8Width = g_vm->_screenSurface.getStringWidth(f8); + int f3Width = _vm->_screenSurface.getStringWidth(f3); + int f8Width = _vm->_screenSurface.getStringWidth(f8); // Write out the bounding box - g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); + _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); } /** @@ -426,19 +426,19 @@ void DialogManager::drawF3F8() { * @remarks Originally called 'diver' */ void DialogManager::checkForF8(int SpeechNum, bool drawAni50Fl) { - g_vm->testKeyboard(); + _vm->testKeyboard(); do { - g_vm->_speechManager.startSpeech(SpeechNum, 0, 0); - g_vm->_key = waitForF3F8(); - if (g_vm->shouldQuit()) + _vm->_speechManager.startSpeech(SpeechNum, 0, 0); + _vm->_key = waitForF3F8(); + if (_vm->shouldQuit()) return; - if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice) { - g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice; - g_vm->hirs(); + if (_vm->_newGraphicalDevice != _vm->_currGraphicalDevice) { + _vm->_currGraphicalDevice = _vm->_newGraphicalDevice; + _vm->hirs(); aff50(drawAni50Fl); } - } while (g_vm->_key != 66); // keycode for F8 + } while (_vm->_key != 66); // keycode for F8 } /** @@ -449,8 +449,8 @@ int DialogManager::waitForF3F8() { int key; do { - key = g_vm->testou(); - if (g_vm->shouldQuit()) + key = _vm->testou(); + if (_vm->shouldQuit()) return key; } while ((key != 61) && (key != 66)); @@ -458,26 +458,26 @@ int DialogManager::waitForF3F8() { } void DialogManager::aff50(bool drawAni50Fl) { - g_vm->_caff = 50; - g_vm->_maff = 0; - g_vm->_text.taffich(); - g_vm->draw(kAdrDes, 63, 12); + _vm->_caff = 50; + _vm->_maff = 0; + _vm->_text.taffich(); + _vm->draw(kAdrDes, 63, 12); if (drawAni50Fl) ani50(); else - g_vm->handleDescriptionText(2, kDialogStringIndex + 142); + _vm->handleDescriptionText(2, kDialogStringIndex + 142); // Draw the f3/f8 dialog drawF3F8(); } void DialogManager::ani50() { - g_vm->_crep = g_vm->animof(1, 1); - g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); - g_vm->_crep = g_vm->animof(2, 1); - g_vm->pictout(kAdrAni, g_vm->_crep, 63, 12); - g_vm->_largestClearScreen = (g_vm->_resolutionScaler == 1); - g_vm->handleDescriptionText(2, kDialogStringIndex + 143); + _vm->_crep = _vm->animof(1, 1); + _vm->pictout(kAdrAni, _vm->_crep, 63, 12); + _vm->_crep = _vm->animof(2, 1); + _vm->pictout(kAdrAni, _vm->_crep, 63, 12); + _vm->_largestClearScreen = (_vm->_resolutionScaler == 1); + _vm->handleDescriptionText(2, kDialogStringIndex + 143); } void DialogManager::setParent(MortevielleEngine *vm) { -- cgit v1.2.3 From 3d373281b440d5d139fbb01ef1ffa0ad0a76b3e8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 26 Jun 2013 12:40:54 +0300 Subject: NEVERHOOD: Stop sound updates while the main menu is active --- engines/neverhood/menumodule.cpp | 2 ++ engines/neverhood/neverhood.cpp | 11 ++++++++--- engines/neverhood/neverhood.h | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 368bfd60a7..accdaca63f 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -73,12 +73,14 @@ MenuModule::MenuModule(NeverhoodEngine *vm, Module *parentModule, int which) _savedPaletteData = _vm->_screen->getPaletteData(); _vm->_mixer->pauseAll(true); + _vm->toggleSoundUpdate(false); createScene(MAIN_MENU, -1); } MenuModule::~MenuModule() { _vm->_mixer->pauseAll(false); + _vm->toggleSoundUpdate(true); _vm->_screen->setPaletteData(_savedPaletteData); } diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 57fce58b94..d60d8b760f 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -105,7 +105,8 @@ Common::Error NeverhoodEngine::run() { _gameModule = new GameModule(this); _isSaveAllowed = true; - + _updateSound = true; + if (isDemo()) { // Adjust this navigation list for the demo version NavigationList *navigationList = _staticData->getNavigationList(0x004B67E8); @@ -186,8 +187,12 @@ void NeverhoodEngine::mainLoop() { _screen->update(); nextFrameTime = _screen->getNextFrameTime(); }; - _soundMan->update(); - _audioResourceMan->updateMusic(); + + if (_updateSound) { + _soundMan->update(); + _audioResourceMan->updateMusic(); + } + _system->updateScreen(); _system->delayMillis(10); } diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 18f2cc9f64..39bc9cef2c 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -134,7 +134,10 @@ public: int16 getMouseY() const { return _mouseY; } NPoint getMousePos(); -public: + void toggleSoundUpdate(bool state) { _updateSound = state; } + +private: + bool _updateSound; }; -- cgit v1.2.3 From 63c462efcef09dabf70f8b8ffb6117e23614b122 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 20:11:00 +0200 Subject: HOPKINS: Remove erroneous static keyword, get rid of g_vm --- engines/hopkins/hopkins.cpp | 3 --- engines/hopkins/hopkins.h | 3 --- engines/hopkins/saveload.cpp | 2 +- engines/hopkins/saveload.h | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2aaf44c5d3..b773808c50 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -35,12 +35,9 @@ namespace Hopkins { -HopkinsEngine *g_vm; - HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _randomSource("Hopkins") { DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); - g_vm = this; _animMan = new AnimationManager(this); _computer = new ComputerManager(this); _dialog = new DialogsManager(this); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 777fd1c335..398e41a4d2 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -183,9 +183,6 @@ public: virtual void syncSoundSettings(); }; -// Global reference to the HopkinsEngine object -extern HopkinsEngine *g_vm; - } // End of namespace Hopkins #endif /* HOPKINS_HOPKINS_H */ diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 45b4885c90..fd36480324 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -216,7 +216,7 @@ Common::Error SaveLoadManager::loadGame(int slot) { bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) { // Try and open the save file for reading Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( - g_vm->generateSaveName(slot)); + _vm->generateSaveName(slot)); if (!saveFile) return false; diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 221a445fd2..6fee814180 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -63,7 +63,7 @@ public: static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header); void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header); - static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); + bool readSavegameHeader(int slot, hopkinsSavegameHeader &header); Common::Error saveGame(int slot, const Common::String &saveName); Common::Error loadGame(int slot); -- cgit v1.2.3 From 6716fa39a6fb2a3925576288c256688c5aadd7e9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 26 Jun 2013 21:33:30 +0200 Subject: HOPKINS: Change some variable names for consistency This silences a GCC warning about a 'saveFile' variable shadowing a saveFile() method. --- engines/hopkins/saveload.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index fd36480324..98fb15046e 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -43,12 +43,12 @@ SaveLoadManager::SaveLoadManager(HopkinsEngine *vm) { } bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n) { - Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file); + Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(file); - if (f) { - size_t bytesWritten = f->write(buf, n); - f->finalize(); - delete f; + if (savefile) { + size_t bytesWritten = savefile->write(buf, n); + savefile->finalize(); + delete savefile; return bytesWritten == n; } else @@ -69,13 +69,13 @@ void SaveLoadManager::initSaves() { } void SaveLoadManager::load(const Common::String &file, byte *buf) { - Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file); - if (f == NULL) - error("Error openinig file - %s", file.c_str()); + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file); + if (savefile == NULL) + error("Error opening file - %s", file.c_str()); - int32 filesize = f->size(); - f->read(buf, filesize); - delete f; + int32 filesize = savefile->size(); + savefile->read(buf, filesize); + delete savefile; } bool SaveLoadManager::readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header) { @@ -215,13 +215,13 @@ Common::Error SaveLoadManager::loadGame(int slot) { bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) { // Try and open the save file for reading - Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading( _vm->generateSaveName(slot)); - if (!saveFile) + if (!savefile) return false; - bool result = readSavegameHeader(saveFile, header); - delete saveFile; + bool result = readSavegameHeader(savefile, header); + delete savefile; return result; } -- cgit v1.2.3 From 10a23f4d92f50467b0541474acd6a54068fb8483 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 23:16:49 +0200 Subject: MORTEVIELLE: Remove useless static --- engines/mortevielle/saveload.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 21522102a2..140b039b51 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -57,7 +57,7 @@ public: Common::Error loadGame(int n); Common::Error saveGame(int n, const Common::String &saveName); - static void writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName); + void writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName); static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header); static Common::String generateSaveName(int slotNumber); static SaveStateList listSaves(const char *target); -- cgit v1.2.3 From b770e315264cf97f5a673499514eb573b54676bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Jun 2013 23:31:54 +0200 Subject: MORTEVIELLE: Fix compilation --- engines/mortevielle/detection_tables.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 2b9a4511da..689fee1222 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -33,7 +33,7 @@ static const ADGameDescription MortevielleGameDescriptions[] = { AD_LISTEND }, Common::FR_FRA, - Common::kPlatformPC, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() }, @@ -47,7 +47,7 @@ static const ADGameDescription MortevielleGameDescriptions[] = { AD_LISTEND }, Common::FR_FRA, - Common::kPlatformPC, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() }, @@ -61,7 +61,7 @@ static const ADGameDescription MortevielleGameDescriptions[] = { AD_LISTEND }, Common::DE_DEU, - Common::kPlatformPC, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() }, @@ -77,7 +77,7 @@ static const ADGameDescription MortevielleGameDescriptions[] = { AD_LISTEND }, Common::EN_ANY, - Common::kPlatformPC, + Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() }, -- cgit v1.2.3 From fdabdae325ffcd3f6d19f335e10325a2339bd6be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Jun 2013 20:41:29 -0400 Subject: TSAGE: Bugfix for starting R2R scene 2000 --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 15 ++++++++++----- engines/tsage/ringworld2/ringworld2_scenes2.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 6a030e5b44..67830766f9 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -630,6 +630,7 @@ void Scene2000::Exit3::changeScene() { break; } } + void Scene2000::Exit4::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; @@ -756,19 +757,21 @@ void Scene2000::Exit5::changeScene() { } } -void Scene2000::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); - loadScene(2000); - +Scene2000::Scene2000(): SceneExt() { if (R2_GLOBALS._sceneManager._previousScene != -1) { R2_GLOBALS._v56605[1] = 21; R2_GLOBALS._v56605[2] = 21; } - if ((R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex] != R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) && (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 2350)) { + if ((R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex] + != R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) + && (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 2350)) { R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 0; } + _exitingFlag = false; +} +void Scene2000::postInit(SceneObjectList *OwnerList) { _exit1.setDetails(Rect(0, 100, 14, 140), EXITCURSOR_W, 2000); _exit1.setDest(Common::Point(14, 129)); _exit2.setDetails(Rect(305, 100, 320, 140), EXITCURSOR_E, 2000); @@ -917,6 +920,8 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { initPlayer(); _item1.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL); + + SceneExt::postInit(); } void Scene2000::remove() { diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 281d1da366..feceaa1537 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -80,6 +80,7 @@ public: Action1 _action1, _action2, _action3, _action4, _action5; SequenceManager _sequenceManager; + Scene2000(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void signal(); -- cgit v1.2.3 From 40b91e588baf7094d864f4322901d6f33dbbff68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Jun 2013 21:48:40 -0400 Subject: TSAGE: Fix for R2R freeze returning to scene 2000 from 2425 --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 67830766f9..02a0c05c0c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -1003,6 +1003,8 @@ void Scene2000::signal() { g_globals->_sceneManager.changeScene(2350); break; default: + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(); break; } } -- cgit v1.2.3 From 4a66ef231e01df1ba1e5be9350ae32c986285deb Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 13:38:24 +0200 Subject: JANITORIAL: Add [Debug|Release][32|64] to .gitignore MSVC11 seems to be using these as new default when running on x64. --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b834214a00..a046909bbf 100644 --- a/.gitignore +++ b/.gitignore @@ -161,6 +161,10 @@ ipch/ #Ignore default Visual Studio build folders [Dd]ebug/ [Rr]elease/ +[Dd]ebug32/ +[Rr]elease32/ +[Dd]ebug64/ +[Rr]elease64/ #Ignore Qt Creator project files ScummVM.config -- cgit v1.2.3 From 1e2a9900f21daed825dd5498bb51868bd0714a1a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Jun 2013 20:19:27 +0200 Subject: MORTEVIELLE: Move misc functions from Mortevielle to Utils --- engines/mortevielle/module.mk | 3 +- engines/mortevielle/mortevielle.cpp | 3417 ---------------------------------- engines/mortevielle/utils.cpp | 3454 +++++++++++++++++++++++++++++++++++ 3 files changed, 3456 insertions(+), 3418 deletions(-) create mode 100644 engines/mortevielle/utils.cpp diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index 9cce597566..e18657cb6a 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -12,7 +12,8 @@ MODULE_OBJS := \ outtext.o \ saveload.o \ sound.o \ - speech.o + speech.o \ + utils.o # This module can be built as a plugin ifeq ($(ENABLE_MORTEVIELLE), DYNAMIC_PLUGIN) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 95750f5c4a..6977ab47c0 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -30,7 +30,6 @@ #include "common/debug-channels.h" #include "engines/util.h" #include "engines/engine.h" -#include "graphics/cursorman.h" #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" @@ -43,31 +42,6 @@ namespace Mortevielle { -const byte tabdr[32] = { - 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 byte tab30[32] = { - 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 byte tab31[32]= { - 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 -}; - MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): @@ -339,213 +313,6 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp assert(dataSize == 0); } -/** - * Check is a key was pressed - * It also delays the engine and check if the screen has to be updated - * @remarks Originally called 'keypressed' - */ -bool MortevielleEngine::keyPressed() { - // Check for any pending key presses - handleEvents(); - - // Check if it's time to draw the next frame - if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { - _lastGameFrame = g_system->getMillis(); - - _screenSurface.updateScreen(); - - _debugger.onFrame(); - } - - // Delay briefly to keep CPU usage down - g_system->delayMillis(5); - - // Return if there are any pending key presses - return !_keypresses.empty(); -} - -/** - * Wait for a keypress - * @remarks Originally called 'get_ch' - */ -int MortevielleEngine::getChar() { - // If there isn't any pending keypress, wait until there is - while (!shouldQuit() && _keypresses.empty()) { - keyPressed(); - } - - // Return the top keypress - return shouldQuit() ? 0 : _keypresses.pop(); -} - -/** - * Handle pending events - * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, - * the mouse Y position is divided by 2 to keep the game thinking the Y goes from 0 - 199 - */ -bool MortevielleEngine::handleEvents() { - Common::Event event; - if (!g_system->getEventManager()->pollEvent(event)) - return false; - - switch (event.type) { - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_LBUTTONUP: - case Common::EVENT_MOUSEMOVE: - _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - _mouse._pos.x = event.mouse.x; - _mouse._pos.y = event.mouse.y / 2; - - if (event.type == Common::EVENT_LBUTTONDOWN) - _mouseClick = true; - else if (event.type == Common::EVENT_LBUTTONUP) - _mouseClick = false; - - break; - case Common::EVENT_KEYDOWN: - addKeypress(event); - break; - default: - break; - } - - return true; -} - -/** - * Add the specified key to the pending keypress stack - */ -void MortevielleEngine::addKeypress(Common::Event &evt) { - // Character to add - char ch = evt.kbd.ascii; - - // Check for debugger - if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { - // Attach to the debugger - _debugger.attach(); - _debugger.onFrame(); - } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { - // Handle alphabetic keys - if (evt.kbd.hasFlags(Common::KBD_CTRL)) - ch = evt.kbd.keycode - Common::KEYCODE_a + 1; - else - ch = evt.kbd.keycode - Common::KEYCODE_a + 'A'; - } else if ((evt.kbd.keycode >= Common::KEYCODE_F1) && (evt.kbd.keycode <= Common::KEYCODE_F12)) { - // Handle function keys - ch = 59 + evt.kbd.keycode - Common::KEYCODE_F1; - } else { - // Series of special cases - switch (evt.kbd.keycode) { - case Common::KEYCODE_KP4: - case Common::KEYCODE_LEFT: - ch = '4'; - break; - case Common::KEYCODE_KP2: - case Common::KEYCODE_DOWN: - ch = '2'; - break; - case Common::KEYCODE_KP6: - case Common::KEYCODE_RIGHT: - ch = '6'; - break; - case Common::KEYCODE_KP8: - case Common::KEYCODE_UP: - ch = '8'; - break; - case Common::KEYCODE_KP7: - ch = '7'; - break; - case Common::KEYCODE_KP1: - ch = '1'; - break; - case Common::KEYCODE_KP9: - ch = '9'; - break; - case Common::KEYCODE_KP3: - ch = '3'; - break; - case Common::KEYCODE_KP5: - ch = '5'; - break; - case Common::KEYCODE_RETURN: - ch = '\13'; - break; - case Common::KEYCODE_ESCAPE: - ch = '\33'; - break; - default: - break; - } - } - - if (ch != 0) - _keypresses.push(ch); -} - -static byte CURSOR_ARROW_DATA[16 * 16] = { - 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -/** - * Initialise the mouse - */ -void MortevielleEngine::initMouse() { - CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); - CursorMan.showMouse(true); - - _mouse.initMouse(); -} - -/** - * Sets the mouse position - * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, - * the mouse Y position is doubled to convert from 0-199 to 0-399 - */ -void MortevielleEngine::setMousePos(const Common::Point &pt) { - // Adjust the passed position from simulated 640x200 to 640x400 co-ordinates - Common::Point newPoint(pt.x, (pt.y == 199) ? 399 : pt.y * 2); - - if (newPoint != _mousePos) - // Warp the mouse to the new position - g_system->warpMouse(newPoint.x, newPoint.y); - - // Save the new position - _mousePos = newPoint; -} - -/** - * Delay by a given amount - */ -void MortevielleEngine::delay(int amount) { - uint32 endTime = g_system->getMillis() + amount; - - while (g_system->getMillis() < endTime) { - if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { - _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); - - _debugger.onFrame(); - } - - g_system->delayMillis(10); - } -} - /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { @@ -645,3188 +412,4 @@ void MortevielleEngine::playGame() { askRestart(); } -/** - * Waits for the user to select an action, and then handles it - * @remarks Originally called tecran - */ -void MortevielleEngine::handleAction() { - const int lim = 20000; - int temps = 0; - char inkey = '\0'; - bool oo, funct = 0; - - clearVerbBar(); - oo = false; - _controlMenu = 0; - if (!_keyPressedEsc) { - _menu.drawMenu(); - _menu._menuDisplayed = true; - temps = 0; - _key = 0; - funct = false; - inkey = '.'; - - _inMainGameLoop = true; - do { - _menu.updateMenu(); - prepareRoom(); - _mouse.moveMouse(funct, inkey); - if (shouldQuit()) - return; - ++temps; - } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); - _inMainGameLoop = false; - - _menu.eraseMenu(); - _menu._menuDisplayed = false; - if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); - return; - } - if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) { - Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 15); - _savegameManager.saveGame(_msg[4] & 15, saveName); - } - if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) - _savegameManager.loadGame((_msg[4] & 15) - 1); - if (inkey == '\103') { /* F9 */ - temps = _dialogManager.show(_hintPctMessage, 1); - return; - } else if (inkey == '\77') { - if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { - _msg[4] = _menuOpcode; - displayTextInVerbBar(getEngineString(S_IDEM)); - } else - return; - } else if (inkey == '\104') { - if ((_x != 0) && (_y != 0)) - _num = 9999; - return; - } - } - if (inkey == '\73') { - _quitGame = true; - hourToChar(); - } else { - if ((funct) && (inkey != '\77')) - return; - if (temps > lim) { - handleDescriptionText(2, 141); - if (_num == 9999) - _num = 0; - } else { - _menuOpcode = _msg[3]; - if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF)) - _menuOpcode = _msg[4]; - if (!_anyone) { - if ((_heroSearching) || (_obpart)) { - if (_mouse._pos.y < 12) - return; - - if ((_msg[4] == OPCODE_SOUND) || (_msg[4] == OPCODE_LIFT)) { - oo = true; - if ((_msg[4] == OPCODE_LIFT) || (_obpart)) { - endSearch(); - _caff = _coreVar._currPlace; - _crep = 998; - } else - tsuiv(); - mennor(); - } - } - } - do { - if (! oo) - handleOpcode(); - - if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { - _text.taffich(); - if (_destinationOk) { - _destinationOk = false; - drawPicture(); - } - if ((!_syn) || (_col)) - handleDescriptionText(2, _crep); - } - } while (_syn); - if (_controlMenu != 0) - displayControlMenu(); - } - } -} - -/** - * Engine function - Init Places - * @remarks Originally called 'init_lieu' - */ -void MortevielleEngine::loadPlaces() { - Common::File f; - - if (!f.open("MXX.mor")) - if (!f.open("MFXX.mor")) - error("Missing file - MXX.mor"); - - for (int i = 0; i < 7; ++i) { - for (int j = 0; j < 25; ++j) - _destinationArray[i][j] = f.readByte(); - } - - f.close(); -} - -/** - * Set Text Color - * @remarks Originally called 'text_color' - */ -void MortevielleEngine::setTextColor(int col) { - _textColor = col; -} - -/** - * Prepare screen - Type 1! - * @remarks Originally called 'ecrf1' - */ -void MortevielleEngine::prepareScreenType1() { - // Large drawing - _screenSurface.drawBox(0, 11, 512, 163, 15); -} - -/** - * Prepare room - Type 2! - * @remarks Originally called 'ecrf2' - */ -void MortevielleEngine::prepareScreenType2() { - setTextColor(5); -} - -/** - * Prepare room - Type 3! - * @remarks Originally called 'ecrf7' - */ -void MortevielleEngine::prepareScreenType3() { - setTextColor(4); -} - -/** - * Engine function - Update hour - * @remarks Originally called 'calch' - */ -void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { - int newHour = readclock(); - int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration); - minute = ((th % 2) + _currHalfHour) * 30; - hour = ((uint)th >> 1) + _currHour; - if (minute == 60) { - minute = 0; - ++hour; - } - day = (hour / 24) + _currDay; - hour = hour - ((day - _currDay) * 24); -} - -/** - * Engine function - Convert character index to bit index - * @remarks Originally called 'conv' - */ -int MortevielleEngine::convertCharacterIndexToBitIndex(int characterIndex) { - return 128 >> (characterIndex - 1); -} - -/** - * Engine function - Convert bit index to character index - * @remarks Originally called 'tip' - */ -int MortevielleEngine::convertBitIndexToCharacterIndex(int bitIndex) { - int retVal = 0; - - if (bitIndex == 128) - retVal = 1; - else if (bitIndex == 64) - retVal = 2; - else if (bitIndex == 32) - retVal = 3; - else if (bitIndex == 16) - retVal = 4; - else if (bitIndex == 8) - retVal = 5; - else if (bitIndex == 4) - retVal = 6; - else if (bitIndex == 2) - retVal = 7; - else if (bitIndex == 1) - retVal = 8; - - return retVal; -} - -/** - * Engine function - Reset presence in other rooms - * @remarks Originally called 't5' - */ -void MortevielleEngine::resetPresenceInRooms(int roomId) { - if (roomId == DINING_ROOM) - _blo = false; - - if (roomId != GREEN_ROOM) { - _roomPresenceLuc = false; - _roomPresenceIda = false; - } - - if (roomId != PURPLE_ROOM) - _purpleRoomPresenceLeo = false; - - if (roomId != DARKBLUE_ROOM) { - _roomPresenceGuy = false; - _roomPresenceEva = false; - } - - if (roomId != BLUE_ROOM) - _roomPresenceMax = false; - if (roomId != RED_ROOM) - _roomPresenceBob = false; - if (roomId != GREEN_ROOM2) - _roomPresencePat = false; - if (roomId != TOILETS) - _toiletsPresenceBobMax = false; - if (roomId != BATHROOM) - _bathRoomPresenceBobMax = false; - if (roomId != ROOM9) - _room9PresenceLeo = false; -} - -/** - * Engine function - Show the people present in the given room - * @remarks Originally called 'affper' - */ -void MortevielleEngine::showPeoplePresent(int bitIndex) { - int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); - - for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); - - clearUpperRightPart(); - if ((bitIndex & 128) == 128) { - _screenSurface.putxy(xp, 24); - _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]); - } - if ((bitIndex & 64) == 64) { - _screenSurface.putxy(xp, 32); - _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]); - } - if ((bitIndex & 32) == 32) { - _screenSurface.putxy(xp, 40); - _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]); - } - if ((bitIndex & 16) == 16) { - _screenSurface.putxy(xp, 48); - _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]); - } - if ((bitIndex & 8) == 8) { - _screenSurface.putxy(xp, 56); - _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]); - } - if ((bitIndex & 4) == 4) { - _screenSurface.putxy(xp, 64); - _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]); - } - if ((bitIndex & 2) == 2) { - _screenSurface.putxy(xp, 72); - _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]); - } - if ((bitIndex & 1) == 1) { - _screenSurface.putxy(xp, 80); - _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]); - } - _currBitIndex = bitIndex; -} - -/** - * Engine function - Select random characters - * @remarks Originally called 'choix' - */ -int MortevielleEngine::selectCharacters(int min, int max) { - bool invertSelection = false; - int rand = getRandomNumber(min, max); - - if (rand > 4) { - rand = 8 - rand; - invertSelection = true; - } - - int i = 0; - int retVal = 0; - while (i < rand) { - int charIndex = getRandomNumber(1, 8); - int charBitIndex = convertCharacterIndexToBitIndex(charIndex); - if ((retVal & charBitIndex) != charBitIndex) { - ++i; - retVal |= charBitIndex; - } - } - if (invertSelection) - retVal = 255 - retVal; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Green Room - * @remarks Originally called 'cpl1' - */ -int MortevielleEngine::getPresenceStatsGreenRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - // The original uses an || instead of an &&, resulting - // in an always true condition. Based on the other tests, - // and on other scenes, we use an && instead. - if ((hour > 7) && (hour < 11)) - retVal = 25; - else if ((hour > 10) && (hour < 14)) - retVal = 35; - else if ((hour > 13) && (hour < 16)) - retVal = 50; - else if ((hour > 15) && (hour < 18)) - retVal = 5; - else if ((hour > 17) && (hour < 22)) - retVal = 35; - else if ((hour > 21) && (hour < 24)) - retVal = 50; - else if ((hour >= 0) && (hour < 8)) - retVal = 70; - - _menu.updateMenu(); - - return retVal; -} -/** - * Engine function - Get Presence Statistics - Purple Room - * @remarks Originally called 'cpl2' - */ -int MortevielleEngine::getPresenceStatsPurpleRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 7) && (hour < 11)) - retVal = -2; - else if (hour == 11) - retVal = 100; - else if ((hour > 11) && (hour < 23)) - retVal = 10; - else if (hour == 23) - retVal = 20; - else if ((hour >= 0) && (hour < 8)) - retVal = 50; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Toilets - * @remarks Originally called 'cpl3' - */ -int MortevielleEngine::getPresenceStatsToilets() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 10)) || ((hour > 19) && (hour < 24))) - retVal = 34; - else if (((hour > 9) && (hour < 20)) || ((hour >= 0) && (hour < 9))) - retVal = 0; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Blue Room - * @remarks Originally called 'cpl5' - */ -int MortevielleEngine::getPresenceStatsBlueRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 6) && (hour < 10)) - retVal = 0; - else if (hour == 10) - retVal = 100; - else if ((hour > 10) && (hour < 24)) - retVal = 15; - else if ((hour >= 0) && (hour < 7)) - retVal = 50; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Red Room - * @remarks Originally called 'cpl6' - */ -int MortevielleEngine::getPresenceStatsRedRoom() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 7) && (hour < 13)) || ((hour > 17) && (hour < 20))) - retVal = -2; - else if (((hour > 12) && (hour < 17)) || ((hour > 19) && (hour < 24))) - retVal = 35; - else if (hour == 17) - retVal = 100; - else if ((hour >= 0) && (hour < 8)) - retVal = 60; - - return retVal; -} - -/** - * Shows the "you are alone" message in the status area - * on the right hand side of the screen - * @remarks Originally called 'person' - */ -void MortevielleEngine::displayAloneText() { - for (int cf = 1; cf <= 8; ++cf) - _menu.disableMenuItem(_menu._discussMenu[cf]); - - Common::String sYou = getEngineString(S_YOU); - Common::String sAre = getEngineString(S_ARE); - Common::String sAlone = getEngineString(S_ALONE); - - clearUpperRightPart(); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); - _screenSurface.drawString(sYou, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); - _screenSurface.drawString(sAre, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); - _screenSurface.drawString(sAlone, 4); - - _currBitIndex = 0; -} - -/** - * Engine function - Get Presence Statistics - Room Bureau - * @remarks Originally called 'cpl10' - */ -int MortevielleEngine::getPresenceStatsDiningRoom(int &hour) { - int day, minute; - - int retVal = 0; - updateHour(day, hour, minute); - if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - retVal = 100; - else if ((hour == 11) || ((hour > 20) && (hour < 24))) - retVal = 45; - else if (((hour > 13) && (hour < 17)) || (hour == 18)) - retVal = 35; - else if (hour == 17) - retVal = 60; - else if ((hour >= 0) && (hour < 8)) - retVal = 5; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Bureau - * @remarks Originally called 'cpl11' - */ -int MortevielleEngine::getPresenceStatsBureau(int &hour) { - int day, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) - retVal = 25; - else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) - retVal = 5; - else if ((hour > 13) && (hour < 17)) - retVal = 55; - else if ((hour > 16) && (hour < 19)) - retVal = 45; - else if ((hour >= 0) && (hour < 9)) - retVal = 0; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Kitchen - * @remarks Originally called 'cpl12' - */ -int MortevielleEngine::getPresenceStatsKitchen() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (((hour > 8) && (hour < 15)) || ((hour > 16) && (hour < 22))) - retVal = 55; - else if (((hour > 14) && (hour < 17)) || ((hour > 21) && (hour < 24))) - retVal = 25; - else if ((hour >= 0) && (hour < 5)) - retVal = 0; - else if ((hour > 4) && (hour < 9)) - retVal = 15; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Attic - * @remarks Originally called 'cpl13' - */ -int MortevielleEngine::getPresenceStatsAttic() { - return 0; -} - -/** - * Engine function - Get Presence Statistics - Room Landing - * @remarks Originally called 'cpl15' - */ -int MortevielleEngine::getPresenceStatsLanding() { - int day, hour, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if ((hour > 7) && (hour < 12)) - retVal = 25; - else if ((hour > 11) && (hour < 14)) - retVal = 0; - else if ((hour > 13) && (hour < 18)) - retVal = 10; - else if ((hour > 17) && (hour < 20)) - retVal = 55; - else if ((hour > 19) && (hour < 22)) - retVal = 5; - else if ((hour > 21) && (hour < 24)) - retVal = 15; - else if ((hour >= 0) && (hour < 8)) - retVal = -15; - - return retVal; -} - -/** - * Engine function - Get Presence Statistics - Room Chapel - * @remarks Originally called 'cpl20' - */ -int MortevielleEngine::getPresenceStatsChapel(int &hour) { - int day, minute; - int retVal = 0; - - updateHour(day, hour, minute); - if (hour == 10) - retVal = 65; - else if ((hour > 10) && (hour < 21)) - retVal = 5; - else if ((hour > 20) && (hour < 24)) - retVal = -15; - else if ((hour >= 0) && (hour < 5)) - retVal = -300; - else if ((hour > 4) && (hour < 10)) - retVal = -5; - - return retVal; -} - -/** - * Engine function - Check who is in the Green Room - * @remarks Originally called 'quelq1' - */ -void MortevielleEngine::setPresenceGreenRoom(int roomId) { - int rand = getRandomNumber(1, 2); - if (roomId == GREEN_ROOM) { - if (rand == 1) - _roomPresenceLuc = true; - else - _roomPresenceIda = true; - } else if (roomId == DARKBLUE_ROOM) { - if (rand == 1) - _roomPresenceGuy = true; - else - _roomPresenceEva = true; - } - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Purple Room - * @remarks Originally called 'quelq2' - */ -void MortevielleEngine::setPresencePurpleRoom() { - if (_place == PURPLE_ROOM) - _purpleRoomPresenceLeo = true; - else - _room9PresenceLeo = true; - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Blue Room - * @remarks Originally called 'quelq5' - */ -void MortevielleEngine::setPresenceBlueRoom() { - _roomPresenceMax = true; - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Red Room - * @remarks Originally called 'quelq6' - */ -void MortevielleEngine::setPresenceRedRoom(int roomId) { - if (roomId == RED_ROOM) - _roomPresenceBob = true; - else if (roomId == GREEN_ROOM2) - _roomPresencePat = true; - - _currBitIndex = 10; -} - -/** - * Engine function - Check who is in the Dining Room - * @remarks Originally called 'quelq10' - */ -int MortevielleEngine::setPresenceDiningRoom(int hour) { - int retVal = 0; - - if ((hour >= 0) && (hour < 8)) - retVal = checkLeoMaxRandomPresence(); - else { - int min = 0, max = 0; - if ((hour > 7) && (hour < 10)) { - min = 5; - max = 7; - } else if ((hour > 9) && (hour < 12)) { - min = 1; - max = 4; - } else if (((hour > 11) && (hour < 15)) || ((hour > 18) && (hour < 21))) { - min = 6; - max = 8; - } else if (((hour > 14) && (hour < 19)) || ((hour > 20) && (hour < 24))) { - min = 1; - max = 5; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Bureau - * @remarks Originally called 'quelq11' - */ -int MortevielleEngine::setPresenceBureau(int hour) { - int retVal = 0; - - if ((hour >= 0) && (hour < 8)) - retVal = checkLeoMaxRandomPresence(); - else { - int min = 0, max = 0; - if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { - min = 1; - max = 3; - } else if (((hour > 9) && (hour < 12)) || ((hour > 13) && (hour < 19))) { - min = 1; - max = 4; - } else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) { - min = 1; - max = 2; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Kitchen - * @remarks Originally called 'quelq12' - */ -int MortevielleEngine::setPresenceKitchen() { - int retVal = checkLeoMaxRandomPresence(); - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the Landing - * @remarks Originally called 'quelq15' - */ -int MortevielleEngine::setPresenceLanding() { - bool test = false; - int rand = 0; - do { - rand = getRandomNumber(1, 8); - test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || - ((rand == 2) && _roomPresencePat) || - ((rand == 3) && _roomPresenceGuy) || - ((rand == 4) && _roomPresenceEva) || - ((rand == 5) && _roomPresenceBob) || - ((rand == 6) && _roomPresenceLuc) || - ((rand == 7) && _roomPresenceIda) || - ((rand == 8) && _roomPresenceMax)); - } while (test); - - int retVal = convertCharacterIndexToBitIndex(rand); - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Check who is in the chapel - * @remarks Originally called 'quelq20' - */ -int MortevielleEngine::setPresenceChapel(int hour) { - int retVal = 0; - - if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) - retVal = checkLeoMaxRandomPresence(); - else { - int min = 0, max = 0; - if ((hour > 9) && (hour < 12)) { - min = 3; - max = 7; - } else if ((hour > 11) && (hour < 18)) { - min = 1; - max = 2; - } else if (hour == 18) { - min = 2; - max = 4; - } - retVal = selectCharacters(min, max); - } - showPeoplePresent(retVal); - - return retVal; -} - -/** - * Engine function - Get the answer after you known a door - * @remarks Originally called 'frap' - */ -void MortevielleEngine::getKnockAnswer() { - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour >= 0) && (hour < 8)) - _crep = 190; - else { - if (getRandomNumber(1, 100) > 70) - _crep = 190; - else - _crep = 147; - } -} - -/** - * Engine function - Get Room Presence Bit Index - * @remarks Originally called 'nouvp' - */ -int MortevielleEngine::getPresenceBitIndex(int roomId) { - int bitIndex = 0; - if (roomId == GREEN_ROOM) { - if (_roomPresenceLuc) - bitIndex = 4; // LUC - if (_roomPresenceIda) - bitIndex = 2; // IDA - } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) - || ((roomId == ROOM9) && (_room9PresenceLeo))) - bitIndex = 128; // LEO - else if (roomId == DARKBLUE_ROOM) { - if (_roomPresenceGuy) - bitIndex = 32; // GUY - if (_roomPresenceEva) - bitIndex = 16; // EVA - } else if ((roomId == BLUE_ROOM) && (_roomPresenceMax)) - bitIndex = 1; // MAX - else if ((roomId == RED_ROOM) && (_roomPresenceBob)) - bitIndex = 8; // BOB - else if ((roomId == GREEN_ROOM2) && (_roomPresencePat)) - bitIndex = 64; // PAT - else if ( ((roomId == TOILETS) && (_toiletsPresenceBobMax)) - || ((roomId == BATHROOM) && (_bathRoomPresenceBobMax)) ) - bitIndex = 9; // BOB + MAX - - if (bitIndex != 9) - showPeoplePresent(bitIndex); - - return bitIndex; -} - -/** - * Engine function - initGame - * @remarks Originally called 'dprog' - */ -void MortevielleEngine::initGame() { - _place = MANOR_FRONT; - _currentHourCount = 0; - if (!_coreVar._alreadyEnteredManor) - _blo = true; - _inGameHourDuration = kTime1; - _currentDayHour = readclock(); -} - -/** - * Engine function - Set Random Presence - Green Room - * @remarks Originally called 'pl1' - */ -void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { - if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) - || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { - int p = getPresenceStatsGreenRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceGreenRoom(_place); - } -} - -/** - * Engine function - Set Random Presence - Purple Room - * @remarks Originally called 'pl2' - */ -void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { - if (!_purpleRoomPresenceLeo) { - int p = getPresenceStatsPurpleRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresencePurpleRoom(); - } -} - -/** - * Engine function - Set Random Presence - Blue Room - * @remarks Originally called 'pl5' - */ -void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { - if (!_roomPresenceMax) { - int p = getPresenceStatsBlueRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceBlueRoom(); - } -} - -/** - * Engine function - Set Random Presence - Red Room - * @remarks Originally called 'pl6' - */ -void MortevielleEngine::setRandomPresenceRedRoom(int cf) { - if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) - || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { - int p = getPresenceStatsRedRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceRedRoom(_place); - } -} - -/** - * Engine function - Set Random Presence - Room 9 - * @remarks Originally called 'pl9' - */ -void MortevielleEngine::setRandomPresenceRoom9(int cf) { - if (!_room9PresenceLeo) { - cf = -10; - int p, rand; - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresencePurpleRoom(); - } -} - -/** - * Engine function - Set Random Presence - Dining Room - * @remarks Originally called 'pl10' - */ -void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { - int h, rand; - int p = getPresenceStatsDiningRoom(h); - phaz(rand, p, cf); - - if (rand > p) - displayAloneText(); - else - setPresenceDiningRoom(h); -} - -/** - * Engine function - Set Random Presence - Bureau - * @remarks Originally called 'pl11' - */ -void MortevielleEngine::setRandomPresenceBureau(int cf) { - int h, rand; - - int p = getPresenceStatsBureau(h); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceBureau(h); -} - -/** - * Engine function - Set Random Presence - Kitchen - * @remarks Originally called 'pl12' - */ -void MortevielleEngine::setRandomPresenceKitchen(int cf) { - int p, rand; - - p = getPresenceStatsKitchen(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceKitchen(); -} - -/** - * Engine function - Set Random Presence - Attic / Cellar - * @remarks Originally called 'pl13' - */ -void MortevielleEngine::setRandomPresenceAttic(int cf) { - int p, rand; - - p = getPresenceStatsAttic(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceKitchen(); -} - -/** - * Engine function - Set Random Presence - Landing - * @remarks Originally called 'pl15' - */ -void MortevielleEngine::setRandomPresenceLanding(int cf) { - int p, rand; - - p = getPresenceStatsLanding(); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceLanding(); -} - -/** - * Engine function - Set Random Presence - Chapel - * @remarks Originally called 'pl20' - */ -void MortevielleEngine::setRandomPresenceChapel(int cf) { - int h, rand; - - int p = getPresenceStatsChapel(h); - phaz(rand, p, cf); - if (rand > p) - displayAloneText(); - else - setPresenceChapel(h); -} - -/** - * Start music or speech - * @remarks Originally called 'musique' - */ -void MortevielleEngine::startMusicOrSpeech(int so) { - if (so == 0) { - /* musik(0) */ - ; - } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { - // Type 1: Speech - _speechManager.startSpeech(10, 1, 1); - _introSpeechPlayed = true; - } else { - if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) - // Type 1: Speech - _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); - else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) - // Type 1: Speech - _speechManager.startSpeech(8, 1, 1); - else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) - // Type 1: Speech - _speechManager.startSpeech(12, 1, 1); - else if (_coreVar._currPlace == INSIDE_WELL) - // Type 1: Speech - _speechManager.startSpeech(13, 1, 1); - else - // Type 2 : music - _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); - } -} - -/** - * Engine function - You lose! - * @remarks Originally called 'tperd' - */ -void MortevielleEngine::loseGame() { - resetOpenObjects(); - _roomDoorId = OWN_ROOM; - _mchai = 0; - _menu.unsetSearchMenu(); - if (!_blo) - getPresence(MANOR_FRONT); - - _loseGame = true; - clearUpperLeftPart(); - _screenSurface.drawBox(60, 35, 400, 50, 15); - handleDescriptionText(9, _crep); - clearDescriptionBar(); - clearVerbBar(); - _col = false; - _syn = false; - _destinationOk = false; -} - -/** - * Engine function - Check inventory for a given object - * @remarks Originally called 'cherjer' - */ -bool MortevielleEngine::checkInventory(int objectId) { - bool retVal = false; - for (int i = 1; i <= 6; ++i) - retVal = (retVal || (_coreVar._inventory[i] == objectId)); - - if (_coreVar._selectedObjectId == objectId) - retVal = true; - - return retVal; -} - -/** - * Engine function - Display Dining Room - * @remarks Originally called 'st1sama' - */ -void MortevielleEngine::displayDiningRoom() { - _coreVar._currPlace = DINING_ROOM; - affrep(); -} - -/** - * Engine function - Start non interactive Dialog - * @remarks Originally called 'sparl' - */ -void MortevielleEngine::startDialog(int16 rep) { - const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; - int key; - - assert(rep >= 0); - - _mouse.hideMouse(); - Common::String dialogStr = getString(rep + kDialogStringIndex); - _text.displayStr(dialogStr, 230, 4, 65, 24, 5); - _dialogManager.drawF3F8(); - - key = 0; - do { - _speechManager.startSpeech(rep, haut[_caff - 69], 0); - key = _dialogManager.waitForF3F8(); - if (shouldQuit()) - return; - } while (key != 66); - hirs(); - _mouse.showMouse(); -} - -/** - * Engine function - End of Search: reset globals - * @remarks Originally called 'finfouill' - */ -void MortevielleEngine::endSearch() { - _heroSearching = false; - _obpart = false; - _searchCount = 0; - _menu.unsetSearchMenu(); -} - -/** - * Engine function - Go to Dining room - * @remarks Originally called 't1sama' - */ -void MortevielleEngine::gotoDiningRoom() { - int day, hour, minute; - - updateHour(day, hour, minute); - if ((hour < 5) && (_coreVar._currPlace > ROOM18)) { - if (!checkInventory(137)) { //You don't have the keys, and it's late - _crep = 1511; - loseGame(); - } else - displayDiningRoom(); - } else if (!_coreVar._alreadyEnteredManor) { //Is it your first time? - _currBitIndex = 255; // Everybody is present - showPeoplePresent(_currBitIndex); - _caff = 77; - drawPictureWithText(); - _screenSurface.drawBox(223, 47, 155, 91, 15); - handleDescriptionText(2, 33); - testKey(false); - mennor(); - _mouse.hideMouse(); - hirs(); - premtet(); - startDialog(140); - drawRightFrame(); - drawClock(); - _mouse.showMouse(); - _coreVar._currPlace = OWN_ROOM; - affrep(); - resetPresenceInRooms(DINING_ROOM); - if (!_blo) - getPresence(OWN_ROOM); - _currBitIndex = 0; - _savedBitIndex = 0; - _coreVar._alreadyEnteredManor = true; - } else - displayDiningRoom(); -} - -/** - * Engine function - Check Manor distance (in the mountains) - * @remarks Originally called 't1neig' - */ -void MortevielleEngine::checkManorDistance() { - ++_manorDistance; - if (_manorDistance > 2) { - _crep = 1506; - loseGame(); - } else { - _destinationOk = true; - _coreVar._currPlace = MOUNTAIN; - affrep(); - } -} - -/** - * Engine function - Go to Manor front - * @remarks Originally called 't1deva' - */ -void MortevielleEngine::gotoManorFront() { - _manorDistance = 0; - _coreVar._currPlace = MANOR_FRONT; - affrep(); -} - -/** - * Engine function - Go to Manor back - * @remarks Originally called 't1derr' - */ -void MortevielleEngine::gotoManorBack() { - _coreVar._currPlace = MANOR_BACK; - affrep(); -} - -/** - * Engine function - Dead : Flooded in Well - * @remarks Originally called 't1deau' - */ -void MortevielleEngine::floodedInWell() { - _crep = 1503; - loseGame(); -} - -/** - * Engine function - Change Graphical Device - * @remarks Originally called 'change_gd' - */ -void MortevielleEngine::changeGraphicalDevice(int newDevice) { - _mouse.hideMouse(); - _currGraphicalDevice = newDevice; - hirs(); - _mouse.initMouse(); - _mouse.showMouse(); - drawRightFrame(); - prepareRoom(); - drawClock(); - if (_currBitIndex != 0) - showPeoplePresent(_currBitIndex); - else - displayAloneText(); - clearDescriptionBar(); - clearVerbBar(); - _maff = 68; - drawPictureWithText(); - handleDescriptionText(2, _crep); - _menu.displayMenu(); -} - -/** - * Called when a savegame has been loaded. - * @remarks Originally called 'antegame' - */ -void MortevielleEngine::gameLoaded() { - _mouse.hideMouse(); - _menu._menuDisplayed = false; - _loseGame = true; - _anyone = false; - _destinationOk = true; - _col = false; - _hiddenHero = false; - _uptodatePresence = false; - _maff = 68; - _menuOpcode = OPCODE_NONE; - _introSpeechPlayed = false; - _x = 0; - _y = 0; - _num = 0; - _startHour = 0; - _endHour = 0; - _searchCount = 0; - _roomDoorId = OWN_ROOM; - _syn = true; - _heroSearching = true; - _mchai = 0; - _manorDistance = 0; - resetOpenObjects(); - _takeObjCount = 0; - affrep(); - _hintPctMessage = getString(580); - - _destinationOk = false; - _endGame = true; - _loseGame = false; - _heroSearching = false; - - displayAloneText(); - prepareRoom(); - drawClock(); - drawPictureWithText(); - handleDescriptionText(2, _crep); - clearVerbBar(); - _endGame = false; - _menu.setDestinationText(_coreVar._currPlace); - _menu.setInventoryText(); - if (_coreVar._selectedObjectId != 0) - displayItemInHand(_coreVar._selectedObjectId + 400); - _mouse.showMouse(); -} - -/** - * Engine function - Handle OpCodes - * @remarks Originally called 'tsitu' - */ -void MortevielleEngine::handleOpcode() { - if (!_col) - clearDescriptionBar(); - _syn = false; - _keyPressedEsc = false; - if (!_anyone) { - if (_uptodatePresence) { - if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { - _controlMenu = 4; - mennor(); - return; - } - } - if (_msg[3] == MENU_MOVE) - fctMove(); - if (_msg[3] == MENU_DISCUSS) - fctDiscuss(); - if (_msg[3] == MENU_INVENTORY) - fctInventoryTake(); - if (_msg[4] == OPCODE_ATTACH) - fctAttach(); - if (_msg[4] == OPCODE_WAIT) - fctWait(); - if (_msg[4] == OPCODE_FORCE) - fctForce(); - if (_msg[4] == OPCODE_SLEEP) - fctSleep(); - if (_msg[4] == OPCODE_LISTEN) - fctListen(); - if (_msg[4] == OPCODE_ENTER) - fctEnter(); - if (_msg[4] == OPCODE_CLOSE) - fctClose(); - if (_msg[4] == OPCODE_SEARCH) - fctSearch(); - if (_msg[4] == OPCODE_KNOCK) - fctKnock(); - if (_msg[4] == OPCODE_SCRATCH) - fctScratch(); - if (_msg[4] == OPCODE_READ) - fctRead(); - if (_msg[4] == OPCODE_EAT) - fctEat(); - if (_msg[4] == OPCODE_PLACE) - fctPlace(); - if (_msg[4] == OPCODE_OPEN) - fctOpen(); - if (_msg[4] == OPCODE_TAKE) - fctTake(); - if (_msg[4] == OPCODE_LOOK) - fctLook(); - if (_msg[4] == OPCODE_SMELL) - fctSmell(); - if (_msg[4] == OPCODE_SOUND) - fctSound(); - if (_msg[4] == OPCODE_LEAVE) - fctLeave(); - if (_msg[4] == OPCODE_LIFT) - fctLift(); - if (_msg[4] == OPCODE_TURN) - fctTurn(); - if (_msg[4] == OPCODE_SSEARCH) - fctSelfSearch(); - if (_msg[4] == OPCODE_SREAD) - fctSelfRead(); - if (_msg[4] == OPCODE_SPUT) - fctSelfPut(); - if (_msg[4] == OPCODE_SLOOK) - fctSelftLook(); - _hiddenHero = false; - - if (_msg[4] == OPCODE_SHIDE) - fctSelfHide(); - } else { - if (_anyone) { - interactNPC(); - _anyone = false; - mennor(); - return; - } - } - int hour, day, minute; - updateHour(day, hour, minute); - if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != DINING_ROOM)) || - ((hour > 0) && (hour < 6) && (_coreVar._currPlace != OWN_ROOM))) - ++_coreVar._faithScore; - if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) - && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { - if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { - _crep = 1501; - loseGame(); - } - if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { - _crep = 1508; - loseGame(); - } - if ((day > 1) && (hour > 8) && (!_loseGame)) { - _crep = 1502; - loseGame(); - } - } - mennor(); -} - -/** - * Engine function - Transform time into a char - * @remarks Originally called 'tmaj3' - */ -void MortevielleEngine::hourToChar() { - int day, hour, minute; - - updateHour(day, hour, minute); - if (minute == 30) - minute = 1; - hour += day * 24; - minute += hour * 2; - _coreVar._fullHour = chr(minute); -} - -/** - * Engine function - extract time from a char - * @remarks Originally called 'theure' - */ -void MortevielleEngine::charToHour() { - int fullHour = ord(_coreVar._fullHour); - int tmpHour = fullHour % 48; - _currDay = fullHour / 48; - _currHalfHour = tmpHour % 2; - _currHour = tmpHour / 2; - _hour = _currHour; - if (_currHalfHour == 1) - _minute = 30; - else - _minute = 0; -} - -/** - * Engine function - Clear upper left part of Screen - Type 1 - * @remarks Originally called 'clsf1' - */ -void MortevielleEngine::clearUpperLeftPart() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - _mouse.showMouse(); -} - -/** - * Engine function - Clear low bar used by description - * @remarks Originally called 'clsf2' - */ -void MortevielleEngine::clearDescriptionBar() { - _mouse.hideMouse(); - if (_largestClearScreen) { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - _screenSurface.drawBox(0, 175, 634, 24, 15); - _largestClearScreen = false; - } else { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - _screenSurface.drawBox(0, 175, 634, 15, 15); - } - _mouse.showMouse(); -} - -/** - * Engine function - Clear lowest bar used by verbs - * @remarks Originally called 'clsf3' - */ -void MortevielleEngine::clearVerbBar() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - _screenSurface.drawBox(0, 191, 634, 8, 15); - _mouse.showMouse(); -} - -/** - * Engine function - Clear upper right part of the screen - * @remarks Originally called 'clsf10' - */ -void MortevielleEngine::clearUpperRightPart() { - int x1, x2; - Common::String st; - - _mouse.hideMouse(); - if (_resolutionScaler == 1) { - x2 = 634; - x1 = 534; - } else { - x2 = 600; - x1 = 544; - } - // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(x1, 93, x2, 98)); - if (_coreVar._faithScore < 33) - st = getEngineString(S_COOL); - else if (_coreVar._faithScore < 66) - st = getEngineString(S_LOURDE); - else if (_coreVar._faithScore > 65) - st = getEngineString(S_MALSAINE); - - x1 = 580 - (_screenSurface.getStringWidth(st) / 2); - _screenSurface.putxy(x1, 92); - _screenSurface.drawString(st, 4); - - // Clear person list - _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - _mouse.showMouse(); -} - -/** - * Engine function - Get a random number between two values - * @remarks Originally called 'get_random_number' and 'hazard' - */ -int MortevielleEngine::getRandomNumber(int minval, int maxval) { - return _randomSource.getRandomNumber(maxval - minval) + minval; -} - -/** - * Engine function - Show alert "use move menu" - * @remarks Originally called 'aldepl' - */ -void MortevielleEngine::showMoveMenuAlert() { - _dialogManager.show(getEngineString(S_USE_DEP_MENU), 1); -} - -/** - * The original engine used this method to display a starting text screen letting the player - * select the graphics mode to use - * @remarks Originally called 'dialpre' - */ -void MortevielleEngine::showConfigScreen() { - _crep = 998; -} - -/** - * Decodes a number of 64 byte blocks - * @param pStart Start of data - * @param count Number of 64 byte blocks - * @remarks Originally called 'zzuul' - */ -void MortevielleEngine::decodeNumber(byte *pStart, int count) { - while (count-- > 0) { - for (int idx = 0; idx < 64; ++pStart, ++idx) { - uint16 v = ((*pStart - 0x80) << 1) + 0x80; - - if (v & 0x8000) - *pStart = 0; - else if (v & 0xff00) - *pStart = 0xff; - else - *pStart = (byte)v; - } - } -} - -void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { - uint16 oct, ocd; - - /* 5-8 */ - oct = _inpBuffer[idx]; - oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); - if (pt < 6) { - ++idx; - oct = oct << (5 - pt); - pt += 11; - oct = oct | ((uint)_inpBuffer[idx] >> pt); - } else { - pt -= 5; - oct = (uint)oct >> pt; - } - - switch (oct) { - case 11: - c = '$'; - the_end = true; - break; - case 30: - case 31: - ocd = _inpBuffer[idx]; - ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); - if (pt < 6) { - ++idx; - ocd = ocd << (5 - pt); - pt += 11; - ocd = ocd | ((uint)_inpBuffer[idx] >> pt); - } else { - pt -= 5; - ocd = (uint)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]); - break; - } -} - -/** - * Decode and extract the line with the given Id - * @remarks Originally called 'deline' - */ -Common::String MortevielleEngine::getString(int num) { - Common::String wrkStr = ""; - - if (num < 0) { - warning("getString(%d): num < 0! Skipping", num); - } else if (!_txxFileFl) { - wrkStr = getGameString(num); - } else { - int hint = _ntpBuffer[num]._hintId; - byte point = _ntpBuffer[num]._point; - int length = 0; - bool endFl = false; - char let; - do { - cinq_huit(let, hint, point, endFl); - wrkStr += let; - ++length; - } while (!endFl); - } - - while (wrkStr.lastChar() == '$') - // Remove trailing '$'s - wrkStr.deleteLastChar(); - - return wrkStr; -} - -void MortevielleEngine::copcha() { - for (int i = kAcha; i < kAcha + 390; i++) - _tabdon[i] = _tabdon[i + 390]; -} - -/** - * Engine function - When restarting the game, reset the main variables used by the engine - * @remarks Originally called 'inzon' - */ -void MortevielleEngine::resetVariables() { - copcha(); - - _coreVar._alreadyEnteredManor = false; - _coreVar._selectedObjectId = 0; - _coreVar._cellarObjectId = 0; - _coreVar._atticBallHoleObjectId = 0; - _coreVar._atticRodHoleObjectId = 0; - _coreVar._wellObjectId = 0; - _coreVar._secretPassageObjectId = 0; - _coreVar._purpleRoomObjectId = 136; - _coreVar._cryptObjectId = 141; - _coreVar._faithScore = getRandomNumber(4, 10); - _coreVar._currPlace = MANOR_FRONT; - - for (int i = 2; i <= 6; ++i) - _coreVar._inventory[i] = 0; - - // Only object in inventory: a gun - _coreVar._inventory[1] = 113; - - _coreVar._fullHour = chr(20); - - for (int i = 1; i <= 10; ++i) - _coreVar._pctHintFound[i] = ' '; - - for (int i = 1; i <= 6; ++i) - _coreVar._availableQuestion[i] = '*'; - - for (int i = 7; i <= 9; ++i) - _coreVar._availableQuestion[i] = ' '; - - for (int i = 10; i <= 28; ++i) - _coreVar._availableQuestion[i] = '*'; - - for (int i = 29; i <= 42; ++i) - _coreVar._availableQuestion[i] = ' '; - - _coreVar._availableQuestion[33] = '*'; - - for (int i = 1; i <= 8; ++i) - _nbrep[i] = 0; - - init_nbrepm(); -} - -/** - * Engine function - Set the palette - * @remarks Originally called 'writepal' - */ -void MortevielleEngine::setPal(int n) { - switch (_currGraphicalDevice) { - case MODE_TANDY: - case MODE_EGA: - case MODE_AMSTRAD1512: - for (int i = 1; i <= 16; ++i) { - _mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; - _mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; - } - break; - case MODE_CGA: { - nhom pal[16]; - for (int i = 0; i < 16; ++i) { - pal[i] = _cgaPal[n]._a[i]; - } - - if (n < 89) - palette(_cgaPal[n]._p); - - for (int i = 0; i <= 15; ++i) - displayCGAPattern(i, _patternArr[pal[i]._id], pal); - } - break; - default: - break; - } -} - -/** - * Engine function - Display a CGA pattern, using a specified palette - * @remarks Originally called 'outbloc' - */ -void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { - int addr = n * 404 + 0xd700; - - WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr], p._tax); - WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr + 2], p._tay); - addr += 4; - for (int i = 0; i < p._tax; ++i) { - for (int j = 0; j < p._tay; ++j) - _mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; - } -} - -/** - * Engine function - Load Palette from File - * @remarks Originally called 'charpal' - */ -void MortevielleEngine::loadPalette() { - Common::File f; - byte b; - - if (!f.open("fxx.mor")) { - if (f.open("mfxx.mor")) - f.seek(7 * 25); - else - error("Missing file - fxx.mor"); - } - - for (int i = 0; i < 108; ++i) - _fxxBuffer[i] = f.readSint16LE(); - f.close(); - - if (!f.open("plxx.mor")) - error("Missing file - plxx.mor"); - for (int i = 0; i <= 90; ++i) { - for (int j = 1; j <= 16; ++j) { - _stdPal[i][j].x = f.readByte(); - _stdPal[i][j].y = f.readByte(); - } - } - f.close(); - - if (!f.open("cxx.mor")) - error("Missing file - cxx.mor"); - - for (int j = 0; j <= 90; ++j) { - _cgaPal[j]._p = f.readByte(); - for (int i = 0; i <= 15; ++i) { - nhom &with = _cgaPal[j]._a[i]; - - b = f.readByte(); - with._id = (uint)b >> 4; - with._hom[0] = ((uint)b >> 2) & 3; - with._hom[1] = b & 3; - } - } - - _cgaPal[10]._a[9] = _cgaPal[10]._a[5]; - for (int j = 0; j <= 14; ++j) { - _patternArr[j]._tax = f.readByte(); - _patternArr[j]._tay = f.readByte(); - for (int i = 1; i <= 20; ++i) { - for (int k = 1; k <= 20; ++k) - _patternArr[j]._des[i][k] = f.readByte(); - } - } - f.close(); -} - -/** - * Engine function - Load Texts from File - * @remarks Originally called 'chartex' - */ -void MortevielleEngine::loadTexts() { - Common::File inpFile; - Common::File ntpFile; - - _txxFileFl = false; - if (getLanguage() == Common::EN_ANY) { - warning("English version expected - Switching to DAT file"); - return; - } - - if (!inpFile.open("TXX.INP")) { - if (!inpFile.open("TXX.MOR")) { - warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; - } - } - if (!ntpFile.open("TXX.NTP")) { - warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; - } - - if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { - warning("TXX file - Unexpected format - Switching to DAT file"); - return; - } - - for (int i = 0; i < inpFile.size() / 2; ++i) - _inpBuffer[i] = inpFile.readUint16LE(); - - inpFile.close(); - _txxFileFl = true; - - for (int i = 0; i < (ntpFile.size() / 3); ++i) { - _ntpBuffer[i]._hintId = ntpFile.readSint16LE(); - _ntpBuffer[i]._point = ntpFile.readByte(); - } - - ntpFile.close(); - -} - -void MortevielleEngine::loadBRUIT5() { - Common::File f; - - if (!f.open("bruit5")) - error("Missing file - bruit5"); - - f.read(&_mem[kAdrNoise5 * 16 + 0], 149 * 128); - f.close(); -} - -void MortevielleEngine::loadCFIEC() { - Common::File f; - - if (!f.open("cfiec.mor")) { - if (!f.open("alcfiec.mor")) - error("Missing file - *cfiec.mor"); - } - - _cfiecBufferSize = ((f.size() / 128) + 1) * 128; - int32 fileSize = f.size(); - - if (!_reloadCFIEC) - _cfiecBuffer = (byte *)malloc(sizeof(byte) * _cfiecBufferSize); - - for (int32 i = 0; i < fileSize; ++i) - _cfiecBuffer[i] = f.readByte(); - - for (int i = fileSize; i < _cfiecBufferSize; i++) - _cfiecBuffer[i] = 0; - - f.close(); - - _reloadCFIEC = false; -} - - -void MortevielleEngine::loadCFIPH() { - Common::File f; - - if (!f.open("cfiph.mor")) { - if (!f.open("alcfiph.mor")) - error("Missing file - *cfiph.mor"); - } - - _speechManager._cfiphBuffer = (int16 *)malloc(sizeof(int16) * (f.size() / 2)); - - for (int i = 0; i < (f.size() / 2); ++i) - _speechManager._cfiphBuffer[i] = f.readSint16LE(); - - f.close(); -} - -/** - * Engine function - Play Music - * @remarks Originally called 'music' - */ -void MortevielleEngine::music() { - if (_soundOff) - return; - - _reloadCFIEC = true; - - Common::File fic; - if (!fic.open("mort.img")) - error("Missing file - mort.img"); - - fic.read(&_mem[0x3800 * 16 + 0], 500); - fic.read(&_mem[0x47a0 * 16 + 0], 123); - fic.close(); - - _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[0x5000 * 16], 623); - _addFix = (float)((kTempoMusic - 8)) / 256; - _speechManager.cctable(_speechManager._tbi); - - bool fin = false; - int k = 0; - do { - fin = keyPressed(); - _soundManager.musyc(_speechManager._tbi, 9958, kTempoMusic); - ++k; - fin = fin | keyPressed() | (k >= 5); - } while (!fin); - while (keyPressed()) - getChar(); -} - -/** - * Engine function - Show title screen - * @remarks Originally called 'suite' - */ -void MortevielleEngine::showTitleScreen() { - hirs(); - handleDescriptionText(7, 2035); - _caff = 51; - _text.taffich(); - testKeyboard(); - if (_newGraphicalDevice != _currGraphicalDevice) - _currGraphicalDevice = _newGraphicalDevice; - hirs(); - draw(kAdrDes, 0, 0); - - Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); - _screenSurface.drawString(cpr, 0); -} - -/** - * Draw picture - * @remarks Originally called 'dessine' - */ -void MortevielleEngine::draw(int ad, int x, int y) { - _mouse.hideMouse(); - setPal(_numpal); - pictout(ad, 0, x, y); - _mouse.showMouse(); -} - -/** - * Draw right frame - * @remarks Originally called 'dessine_rouleau' - */ -void MortevielleEngine::drawRightFrame() { - setPal(89); - if (_currGraphicalDevice == MODE_HERCULES) { - _mem[0x7000 * 16 + 14] = 15; - } - _mouse.hideMouse(); - pictout(0x73a2, 0, 0, 0); - _mouse.showMouse(); -} - -/** - * Read the current system time - */ -int MortevielleEngine::readclock() { - TimeDate dateTime; - g_system->getTimeAndDate(dateTime); - - int m = dateTime.tm_min * 60; - int h = dateTime.tm_hour * 3600; - return h + m + dateTime.tm_sec; -} - -/** - * Engine function - Prepare room and hint string - * @remarks Originally called 'tinke' - */ -void MortevielleEngine::prepareRoom() { - int day, hour, minute; - - _anyone = false; - updateHour(day, hour, minute); - if (day != _day) { - _day = day; - int i = 0; - do { - ++i; - if (_nbrepm[i] != 0) - --_nbrepm[i]; - _nbrep[i] = 0; - } while (i != 8); - } - if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { - _hour = hour; - _minute = 0; - drawClock(); - int hintCount = 0; - for (int i = 1; i <= 10; ++i) { - if (_coreVar._pctHintFound[i] == '*') - ++hintCount; - } - - Common::String pctStr; - if (hintCount == 10) - pctStr = "10"; - else - pctStr = chr(hintCount + 48); - - _hintPctMessage = "[1]["; - _hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED); - _hintPctMessage += pctStr; - _hintPctMessage += '0'; - _hintPctMessage += getEngineString(S_NUMBER_OF_HINTS); - _hintPctMessage += "]["; - _hintPctMessage += getEngineString(S_OK); - _hintPctMessage += ']'; - } - if (minute > _minute) { - _minute = 30; - drawClock(); - } - if (_mouse._pos.y < 12) - return; - - if (!_blo) { - if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) - _inGameHourDuration = kTime2; - else - _inGameHourDuration = kTime1; - if ((_coreVar._faithScore > 33) && (_coreVar._faithScore < 66)) - _inGameHourDuration -= (_inGameHourDuration / 3); - - if (_coreVar._faithScore > 65) - _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); - - int newHour = readclock(); - if ((newHour - _currentDayHour) > _inGameHourDuration) { - bool activeMenu = _menu._menuActive; - _menu.eraseMenu(); - _currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration); - _currentDayHour = newHour; - switch (_place) { - case GREEN_ROOM: - case DARKBLUE_ROOM: - setRandomPresenceGreenRoom(_coreVar._faithScore); - break; - case PURPLE_ROOM: - setRandomPresencePurpleRoom(_coreVar._faithScore); - break; - case BLUE_ROOM: - setRandomPresenceBlueRoom(_coreVar._faithScore); - break; - case RED_ROOM: - case GREEN_ROOM2: - setRandomPresenceRedRoom(_coreVar._faithScore); - break; - case ROOM9: - setRandomPresenceRoom9(_coreVar._faithScore); - break; - case DINING_ROOM: - setRandomPresenceDiningRoom(_coreVar._faithScore); - break; - case BUREAU: - setRandomPresenceBureau(_coreVar._faithScore); - break; - case KITCHEN: - setRandomPresenceKitchen(_coreVar._faithScore); - break; - case ATTIC: - case CELLAR: - setRandomPresenceAttic(_coreVar._faithScore); - break; - case LANDING: - case ROOM26: - setRandomPresenceLanding(_coreVar._faithScore); - break; - case CHAPEL: - setRandomPresenceChapel(_coreVar._faithScore); - break; - } - if ((_savedBitIndex != 0) && (_currBitIndex != 10)) - _savedBitIndex = _currBitIndex; - - if ((_savedBitIndex == 0) && (_currBitIndex > 0)) { - if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) { - initCaveOrCellar(); - } else if (_currBitIndex == 10) { - _currBitIndex = 0; - if (!_uptodatePresence) { - _uptodatePresence = true; - _startHour = readclock(); - if (getRandomNumber(1, 5) < 5) { - clearVerbBar(); - prepareScreenType2(); - displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); - int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(1, rand, 1); - clearVerbBar(); - } - } - } - } - - if (activeMenu) - _menu.drawMenu(); - } - } - _endHour = readclock(); - if ((_uptodatePresence) && ((_endHour - _startHour) > 17)) { - getPresenceBitIndex(_place); - _uptodatePresence = false; - _startHour = 0; - if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) - _anyone = true; - } -} - -/** - * Engine function - Draw Clock - * @remarks Originally called 'pendule' - */ -void MortevielleEngine::drawClock() { - const int cv[2][12] = { - { 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 int x = 580; - const int y = 123; - const int rg = 9; - int hourColor; - - _mouse.hideMouse(); - - _screenSurface.drawRectangle(570, 118, 20, 10); - _screenSurface.drawRectangle(578, 114, 6, 18); - if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) - hourColor = 0; - else - hourColor = 1; - - if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), hourColor); - else - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), hourColor); - - int hour12 = _hour; - if (hour12 > 12) - hour12 -= 12; - if (hour12 == 0) - hour12 = 12; - - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], hourColor); - _mouse.showMouse(); - _screenSurface.putxy(568, 154); - - if (_hour > 11) - _screenSurface.drawString("PM ", 1); - else - _screenSurface.drawString("AM ", 1); - - _screenSurface.putxy(550, 160); - if ((_day >= 0) && (_day <= 8)) { - Common::String tmp = getEngineString(S_DAY); - tmp.insertChar((char)(_day + 49), 0); - _screenSurface.drawString(tmp, 1); - } -} - -void MortevielleEngine::palette(int v1) { - warning("TODO: palette"); -} - -/** - * Returns a substring of the given string - * @param s Source string - * @param idx Starting index (1 based) - * @param size Number of characters to return - */ - -Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) { - // Copy the substring into a temporary buffer - char *tmp = new char[size + 1]; - strncpy(tmp, s.c_str() + idx - 1, size); - tmp[size] = '\0'; - - Common::String result(tmp); - delete[] tmp; - return result; -} - -void MortevielleEngine::hirs() { - // Note: The original used this to set the graphics mode and clear the screen, both at - // the start of the game, and whenever the screen need to be cleared. As such, this - // method is deprecated in favour of clearing the screen - debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); - - if (_currGraphicalDevice == MODE_TANDY) { - _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); - _resolutionScaler = 1; - } else if (_currGraphicalDevice == MODE_CGA) { - palette(1); - _resolutionScaler = 1; - } else - _resolutionScaler = 2; - - _screenSurface.clearScreen(); -} - -/** - * Init room : Cave or Cellar - * @remarks Originally called 'cavegre' - */ -void MortevielleEngine::initCaveOrCellar() { - _coreVar._faithScore += 2; - if (_coreVar._faithScore > 69) - _coreVar._faithScore += (_coreVar._faithScore / 10); - clearVerbBar(); - prepareScreenType2(); - displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); - int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(2, rand, 1); - - // The original was doing here a useless loop. - // It has been removed - - clearVerbBar(); - displayAloneText(); -} - -/** - * Display control menu string - * @remarks Originally called 'tctrm' - */ -void MortevielleEngine::displayControlMenu() { - handleDescriptionText(2, (3000 + _controlMenu)); - _controlMenu = 0; -} - -void MortevielleEngine::pictout(int seg, int dep, int x, int y) { - GfxSurface surface; - surface.decode(&_mem[seg * 16 + dep]); - - if (_currGraphicalDevice == MODE_HERCULES) { - _mem[0x7000 * 16 + 2] = 0; - _mem[0x7000 * 16 + 32] = 15; - } - - if ((_caff != 51) && (READ_LE_UINT16(&_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&_mem[0x7000 * 16 + 0x4138], 0x100); - - _screenSurface.drawPicture(surface, x, y); -} - -void MortevielleEngine::adzon() { - Common::File f; - - if (!f.open("don.mor")) - error("Missing file - don.mor"); - - f.read(_tabdon, 7 * 256); - f.close(); - - if (!f.open("bmor.mor")) - error("Missing file - bmor.mor"); - - f.read(&_tabdon[kFleche], 1 * 1916); - f.close(); - - if (!f.open("dec.mor")) - error("Missing file - dec.mor"); - - f.read(&_mem[0x73a2 * 16 + 0], 1 * 1664); - f.close(); -} - -/** - * Returns the offset within the compressed image data resource of the desired image - */ -int MortevielleEngine::animof(int ouf, int num) { - int nani = _mem[kAdrAni * 16 + 1]; - int aux = num; - if (ouf != 1) - aux += nani; - - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[kAdrAni * 16 + (aux << 1)]); - - return animof_result; -} - -/** - * Display text in description bar - * @remarks Originally called 'text1' - */ -void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { - int co; - - if (_resolutionScaler == 1) - co = 10; - else - co = 6; - Common::String tmpStr = getString(mesgId); - if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) - y = 176; - _text.displayStr(tmpStr, x, y, nb, 20, _textColor); -} - -/** - * Display description text - * @remarks Originally called 'repon' - */ -void MortevielleEngine::handleDescriptionText(int f, int mesgId) { - if ((mesgId > 499) && (mesgId < 563)) { - Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); - - if ((int) tmpStr.size() > ((58 + (_resolutionScaler - 1) * 37) << 1)) - _largestClearScreen = true; - else - _largestClearScreen = false; - - clearDescriptionBar(); - _text.displayStr(tmpStr, 8, 176, 85, 3, 5); - } else { - mapMessageId(mesgId); - switch (f) { - case 2: - case 8: - clearDescriptionBar(); - prepareScreenType2(); - displayTextInDescriptionBar(8, 182, 103, mesgId); - if ((mesgId == 68) || (mesgId == 69)) - _coreVar._availableQuestion[40] = '*'; - if ((mesgId == 104) && (_caff == CELLAR)) { - _coreVar._availableQuestion[36] = '*'; - if (_coreVar._availableQuestion[39] == '*') { - _coreVar._pctHintFound[3] = '*'; - _coreVar._availableQuestion[38] = '*'; - } - } - break; - case 1: - case 6: - case 9: { - int i; - if ((f == 1) || (f == 6)) - i = 4; - else - i = 5; - - Common::String tmpStr = getString(mesgId); - _text.displayStr(tmpStr, 80, 40, 60, 25, i); - - if (mesgId == 180) - _coreVar._pctHintFound[6] = '*'; - else if (mesgId == 179) - _coreVar._pctHintFound[10] = '*'; - } - break; - default: - break; - } - } -} - -/** - * Recompute message Id - * @remarks Originally called 'modif' - */ -void MortevielleEngine::mapMessageId(int &mesgId) { - if (mesgId == 26) - mesgId = 25; - else if ((mesgId > 29) && (mesgId < 36)) - mesgId -= 4; - else if ((mesgId > 69) && (mesgId < 78)) - mesgId -= 37; - else if ((mesgId > 99) && (mesgId < 194)) - mesgId -= 59; - else if ((mesgId > 996) && (mesgId < 1000)) - mesgId -= 862; - else if ((mesgId > 1500) && (mesgId < 1507)) - mesgId -= 1363; - else if ((mesgId > 1507) && (mesgId < 1513)) - mesgId -= 1364; - else if ((mesgId > 1999) && (mesgId < 2002)) - mesgId -= 1851; - else if (mesgId == 2010) - mesgId = 151; - else if ((mesgId > 2011) && (mesgId < 2025)) - mesgId -= 1860; - else if (mesgId == 2026) - mesgId = 165; - else if ((mesgId > 2029) && (mesgId < 2037)) - mesgId -= 1864; - else if ((mesgId > 3000) && (mesgId < 3005)) - mesgId -= 2828; - else if (mesgId == 4100) - mesgId = 177; - else if (mesgId == 4150) - mesgId = 178; - else if ((mesgId > 4151) && (mesgId < 4156)) - mesgId -= 3973; - else if (mesgId == 4157) - mesgId = 183; - else if ((mesgId == 4160) || (mesgId == 4161)) - mesgId -= 3976; -} - -/** - * Initialize open objects array - * @remarks Originally called 'initouv' - */ -void MortevielleEngine::resetOpenObjects() { - for (int cx = 1; cx <= 7; ++cx) - _openObjects[cx] = 0; - _openObjCount = 0; -} - -void MortevielleEngine::ecr2(Common::String text) { - // Some dead code was present in the original: removed - _screenSurface.putxy(8, 177); - int tlig = 59 + (_resolutionScaler - 1) * 36; - - if ((int)text.size() < tlig) - _screenSurface.drawString(text, 5); - else if ((int)text.size() < (tlig << 1)) { - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); - } else { - _largestClearScreen = true; - clearDescriptionBar(); - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); - _screenSurface.putxy(8, 190); - _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); - } -} - -void MortevielleEngine::displayTextInVerbBar(Common::String text) { - clearVerbBar(); - _screenSurface.putxy(8, 192); - _screenSurface.drawString(text, 5); -} - -/** - * Display item in hand - * @remarks Originally called 'modobj' - */ -void MortevielleEngine::displayItemInHand(int objId) { - Common::String strp = Common::String(' '); - - if (objId != 500) - strp = getString(objId - 501 + kInventoryStringIndex); - - _menu.setText(_menu._inventoryMenu[8], strp); - _menu.disableMenuItem(_menu._inventoryMenu[8]); -} - -/** - * Display empty hand - * @remarks Originally called 'maivid' - */ -void MortevielleEngine::displayEmptyHand() { - _coreVar._selectedObjectId = 0; - displayItemInHand(500); -} - -/** - * Set a random presence: Leo or Max - * @remarks Originally called 'chlm' - */ -int MortevielleEngine::checkLeoMaxRandomPresence() { - int retval = getRandomNumber(1, 2); - if (retval == 2) - retval = 128; - - return retval; -} - -/** - * Reset room variables - * @remarks Originally called 'debloc' - */ -void MortevielleEngine::resetRoomVariables(int roomId) { - _num = 0; - _x = 0; - _y = 0; - if ((roomId != ROOM26) && (roomId != LANDING)) - resetPresenceInRooms(roomId); - _savedBitIndex = _currBitIndex; -} - -/** - * Compute presence stats - * @remarks Originally called 'ecfren' - */ -int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { - if (roomId == OWN_ROOM) - displayAloneText(); - int retVal = -500; - rand = 0; - if ( ((roomId == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) - || ((roomId == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) - retVal = getPresenceStatsGreenRoom(); - if ((roomId == PURPLE_ROOM) && (!_purpleRoomPresenceLeo) && (!_room9PresenceLeo)) - retVal = getPresenceStatsPurpleRoom(); - if ( ((roomId == TOILETS) && (!_toiletsPresenceBobMax)) - || ((roomId == BATHROOM) && (!_bathRoomPresenceBobMax)) ) - retVal = getPresenceStatsToilets(); - if ((roomId == BLUE_ROOM) && (!_roomPresenceMax)) - retVal = getPresenceStatsBlueRoom(); - if ( ((roomId == RED_ROOM) && (!_roomPresenceBob)) - || ((roomId == GREEN_ROOM2) && (!_roomPresencePat))) - retVal = getPresenceStatsRedRoom(); - if ((roomId == ROOM9) && (!_room9PresenceLeo) && (!_purpleRoomPresenceLeo)) - retVal = 10; - if ( ((roomId == PURPLE_ROOM) && (_room9PresenceLeo)) - || ((roomId == ROOM9) && (_purpleRoomPresenceLeo))) - retVal = -400; - if (retVal != -500) { - retVal += cf; - rand = getRandomNumber(1, 100); - } - - return retVal; -} - -/** - * Set presence flags - * @remarks Originally called 'becfren' - */ -void MortevielleEngine::setPresenceFlags(int roomId) { - if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { - int rand = getRandomNumber(1, 2); - if (roomId == GREEN_ROOM) { - if (rand == 1) - _roomPresenceLuc = true; - else - _roomPresenceIda = true; - } else { // roomId == DARKBLUE_ROOM - if (rand == 1) - _roomPresenceGuy = true; - else - _roomPresenceEva = true; - } - } else if (roomId == PURPLE_ROOM) - _purpleRoomPresenceLeo = true; - else if (roomId == TOILETS) - _toiletsPresenceBobMax = true; - else if (roomId == BLUE_ROOM) - _roomPresenceMax = true; - else if (roomId == RED_ROOM) - _roomPresenceBob = true; - else if (roomId == BATHROOM) - _bathRoomPresenceBobMax = true; - else if (roomId == GREEN_ROOM2) - _roomPresencePat = true; - else if (roomId == ROOM9) - _room9PresenceLeo = true; -} - -void MortevielleEngine::init_nbrepm() { - static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - - for (int idx = 0; idx < 9; ++idx) - _nbrepm[idx] = ipm[idx]; -} - -void MortevielleEngine::phaz(int &rand, int &p, int cf) { - p += cf; - rand = getRandomNumber(1, 100); -} - -/** - * Get Presence - * @remarks Originally called 't11' - */ -int MortevielleEngine::getPresence(int roomId) { - int retVal = 0; - int rand; - - int p = getPresenceStats(rand, _coreVar._faithScore, roomId); - _place = roomId; - if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { - if (p != -500) { - if (rand > p) { - displayAloneText(); - retVal = 0; - } else { - setPresenceFlags(_place); - retVal = getPresenceBitIndex(_place); - } - } else - retVal = getPresenceBitIndex(_place); - } - - if (roomId > ROOM9) { - if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) - displayAloneText(); - else { - int h = 0; - if (roomId == DINING_ROOM) - p = getPresenceStatsDiningRoom(h); - else if (roomId == BUREAU) - p = getPresenceStatsBureau(h); - else if (roomId == KITCHEN) - p = getPresenceStatsKitchen(); - else if ((roomId == ATTIC) || (roomId == CELLAR)) - p = getPresenceStatsAttic(); - else if ((roomId == LANDING) || (roomId == ROOM26)) - p = getPresenceStatsLanding(); - else if (roomId == CHAPEL) - p = getPresenceStatsChapel(h); - p += _coreVar._faithScore; - rand = getRandomNumber(1, 100); - if (rand > p) { - displayAloneText(); - retVal = 0; - } else { - if (roomId == DINING_ROOM) - p = setPresenceDiningRoom(h); - else if (roomId == BUREAU) - p = setPresenceBureau(h); - else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) - p = setPresenceKitchen(); - else if ((roomId == LANDING) || (roomId == ROOM26)) - p = setPresenceLanding(); - else if (roomId == CHAPEL) - p = setPresenceChapel(h); - retVal = p; - } - } - } - - return retVal; -} - -void MortevielleEngine::writetp(Common::String s, int t) { - if (_resolutionScaler == 2) - _screenSurface.drawString(s, t); - else - _screenSurface.drawString(copy(s, 1, 25), t); -} - -void MortevielleEngine::aniof(int ouf, int num) { - if ((_caff == BATHROOM) && ((num == 4) || (num == 5))) - return; - - if ((_caff == DINING_ROOM) && (num == 7)) - num = 6; - else if (_caff == KITCHEN) { - if (num == 3) - num = 4; - else if (num == 4) - num = 3; - } - - int ad = kAdrAni; - int offset = animof(ouf, num); - - GfxSurface surface; - surface.decode(&_mem[ad * 16 + offset]); - _screenSurface.drawPicture(surface, 0, 12); - - prepareScreenType1(); -} - -/** - * Draw Picture - * @remarks Originally called 'dessin' - */ -void MortevielleEngine::drawPicture() { - clearUpperLeftPart(); - if (_caff > 99) { - draw(kAdrDes, 60, 33); - _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box - } else if (_caff > 69) { - draw(kAdrDes, 112, 48); // Heads - _screenSurface.drawBox(222, 47, 155, 91, 15); - } else { - draw(kAdrDes, 0, 12); - prepareScreenType1(); - if ((_caff < 30) || (_caff > 32)) { - for (int cx = 1; cx <= 6; ++cx) { - if (_openObjects[cx] != 0) - aniof(1, _openObjects[cx]); - } - - if (_caff == ATTIC) { - if (_coreVar._atticBallHoleObjectId == 141) - aniof(1, 7); - - if (_coreVar._atticRodHoleObjectId == 159) - aniof(1, 6); - } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) - aniof(1, 2); - else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) - aniof(1, 1); - else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) - aniof(1, 1); - } - - if (_caff < ROOM26) - startMusicOrSpeech(1); - } -} - -void MortevielleEngine::drawPictureWithText() { - _text.taffich(); - drawPicture(); - _destinationOk = false; -} - -/** - * Engine function - Place - * @remarks Originally called 'tkey1' - */ -void MortevielleEngine::testKey(bool d) { - bool quest = false; - int x, y; - bool click; - - _mouse.hideMouse(); - fenat('K'); - - // Wait for release from any key or mouse button - while (keyPressed()) - _key = testou(); - - do { - _mouse.getMousePosition(x, y, click); - keyPressed(); - } while (click); - - // Event loop - do { - if (d) - prepareRoom(); - quest = keyPressed(); - _mouse.getMousePosition(x, y, click); - if (shouldQuit()) - return; - } while (!(quest || (click) || (d && _anyone))); - if (quest) - testou(); - setMouseClick(false); - _mouse.showMouse(); -} - -void MortevielleEngine::tlu(int af, int ob) { - _caff = 32; - drawPictureWithText(); - handleDescriptionText(6, ob + 4000); - handleDescriptionText(2, 999); - testKey(true); - _caff = af; - _msg[3] = OPCODE_NONE; - _crep = 998; -} - -void MortevielleEngine::affrep() { - _caff = _coreVar._currPlace; - _crep = _coreVar._currPlace; -} - -/** - * Exit room - * @remarks Originally called 'tsort' - */ -void MortevielleEngine::exitRoom() { - if ((_openObjCount > 0) && (_coreVar._currPlace != OWN_ROOM)) { - if (_coreVar._faithScore < 50) - _coreVar._faithScore += 2; - else - _coreVar._faithScore += (_coreVar._faithScore / 10); - } - - resetOpenObjects(); - - _roomDoorId = OWN_ROOM; - _mchai = 0; - resetRoomVariables(_coreVar._currPlace); -} - -/** - * get 'read' description - * @remarks Originally called 'st4' - */ -void MortevielleEngine::getReadDescription(int objId) { - _crep = 997; - - switch (objId) { - case 114 : - _crep = 109; - break; - case 110 : - _crep = 107; - break; - case 158 : - _crep = 113; - break; - case 152: - case 153: - case 154: - case 155: - case 156: - case 150: - case 100: - case 157: - case 160: - case 161 : - tlu(_caff, objId); - break; - default: - break; - } -} - -/** - * get 'search' description - * @remarks Originally called 'st7' - */ -void MortevielleEngine::getSearchDescription(int objId) { - switch (objId) { - case 116: - case 144: - _crep = 104; - break; - case 126: - case 111: - _crep = 108; - break; - case 132: - _crep = 111; - break; - case 142: - _crep = 112; - break; - default: - _crep = 183; - getReadDescription(objId); - } -} - -void MortevielleEngine::mennor() { - _menu.menuUp(_msg[3]); -} - -void MortevielleEngine::premtet() { - draw(kAdrDes, 10, 80); - _screenSurface.drawBox(18, 79, 155, 91, 15); -} - -void MortevielleEngine::ajchai() { - int cy = kAcha + ((_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - } while ((cx <= 9) && (_tabdon[cy + cx] != 0)); - - if (_tabdon[cy + cx] == 0) - _tabdon[cy + cx] = _coreVar._selectedObjectId; - else - _crep = 192; -} - -/** - * Check if inventory is full and, if not, add object in it. - * @remarks Originally called 'ajjer' - */ -void MortevielleEngine::addObjectToInventory(int objectId) { - int i = 0; - do { - ++i; - } while ((i <= 5) && (_coreVar._inventory[i] != 0)); - - if (_coreVar._inventory[i] == 0) { - _coreVar._inventory[i] = objectId; - _menu.setInventoryText(); - } else - // Inventory is full - _crep = 139; -} - -/** - * Interact with NPC - * @remarks Originally called 'quelquun' - */ -void MortevielleEngine::interactNPC() { - if (_menu._menuDisplayed) - _menu.eraseMenu(); - - endSearch(); - _crep = 997; -L1: - if (!_hiddenHero) { - if (_crep == 997) - _crep = 138; - handleDescriptionText(2, _crep); - if (_crep == 138) - _speechManager.startSpeech(5, 2, 1); - else - _speechManager.startSpeech(4, 4, 1); - - if (_openObjCount == 0) - _coreVar._faithScore += 2; - else if (_coreVar._faithScore < 50) - _coreVar._faithScore += 4; - else - _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); - exitRoom(); - _menu.setDestinationText(LANDING); - int cx = convertBitIndexToCharacterIndex(_currBitIndex); - _caff = 69 + cx; - _crep = _caff; - _msg[3] = MENU_DISCUSS; - _msg[4] = _menu._discussMenu[cx]; - _syn = true; - _col = true; - } else { - if (getRandomNumber(1, 3) == 2) { - _hiddenHero = false; - _crep = 137; - goto L1; - } else { - handleDescriptionText(2, 136); - int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(3, rand, 1); - clearDescriptionBar(); - displayAloneText(); - resetRoomVariables(MANOR_FRONT); - affrep(); - } - } - if (_menu._menuDisplayed) - _menu.drawMenu(); -} - -void MortevielleEngine::tsuiv() { - int tbcl; - int cy = kAcha + ((_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - ++_searchCount; - int cl = cy + _searchCount; - tbcl = _tabdon[cl]; - } while ((tbcl == 0) && (_searchCount <= 9)); - - if ((tbcl != 0) && (_searchCount < 11)) { - _caff = tbcl; - _crep = _caff + 400; - if (_currBitIndex != 0) - _coreVar._faithScore += 2; - } else { - affrep(); - endSearch(); - if (cx > 9) - _crep = 131; - } -} - -void MortevielleEngine::tfleche() { - bool qust; - char touch; - - if (_num == 9999) - return; - - fenat(chr(152)); - bool inRect = false; - do { - touch = '\0'; - - do { - _mouse.moveMouse(qust, touch); - if (shouldQuit()) - return; - - if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); - prepareRoom(); - } while (!(qust || inRect || _anyone)); - - if (qust && (touch == '\103')) - _dialogManager.show(_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); - - if (touch == '\73') - _keyPressedEsc = true; - - if (inRect) { - _x = _mouse._pos.x; - _y = _mouse._pos.y; - } -} - -/** - * Set coordinates - * @remarks Originally called 'tcoord' - */ -void MortevielleEngine::setCoordinates(int sx) { - int sy, ix, iy; - int ib; - - - _num = 0; - _crep = 999; - int a = 0; - int atdon = kAmzon + 3; - int cy = 0; - while (cy < _caff) { - a += _tabdon[atdon]; - atdon += 4; - ++cy; - } - - if (_tabdon[atdon] == 0) { - _crep = 997; - return; - } - - a += kFleche; - int cb = 0; - for (cy = 0; cy <= (sx - 2); ++cy) { - ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; - cb += (ib * 4) + 2; - } - ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; - if (ib == 0) { - _crep = 997; - return; - } - - cy = 1; - do { - cb += 2; - sx = _tabdon[a + cb] * _resolutionScaler; - sy = _tabdon[(a + cb + 1)]; - cb += 2; - ix = _tabdon[a + cb] * _resolutionScaler; - iy = _tabdon[(a + cb + 1)]; - ++cy; - } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); - - if ((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) { - _num = cy - 1; - return; - } - - _crep = 997; -} - -void MortevielleEngine::treg(int objId) { - int mdes = _caff; - _caff = objId; - - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_msg[4] == OPCODE_SLOOK)) { - drawPictureWithText(); - if ((_caff > 29) && (_caff < 33)) - handleDescriptionText(2, _caff); - else - handleDescriptionText(2, _caff + 400); - testKey(true); - _caff = mdes; - _msg[3] = 0; - _crep = 998; - } else { - _obpart = true; - _crep = _caff + 400; - _menu.setSearchMenu(); - } -} - -/** - * Engine function - Put in hand - * @remarks Originally called 'avpoing' - */ -void MortevielleEngine::putInHand(int &objId) { - _crep = 999; - if (_coreVar._selectedObjectId != 0) - addObjectToInventory(_coreVar._selectedObjectId); - - // If inventory wasn't full - if (_crep != 139) { - displayItemInHand(objId + 400); - _coreVar._selectedObjectId = objId; - objId = 0; - } -} - -void MortevielleEngine::rechai(int &ch) { - int tmpPlace = _coreVar._currPlace; - - if (_coreVar._currPlace == CRYPT) - tmpPlace = CELLAR; - ch = _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; -} - -/** - * Check before leaving the secret passage - * @remarks Originally called 't23coul' - */ -int MortevielleEngine::checkLeaveSecretPassage() { - if (!checkInventory(143)) { - _crep = 1512; - loseGame(); - } - - return CELLAR; -} - -void MortevielleEngine::fenat(char ans) { - int coul; - - _mouse.hideMouse(); - if (_currGraphicalDevice == MODE_CGA) - coul = 2; - else if (_currGraphicalDevice == MODE_HERCULES) - coul = 1; - else - coul = 12; - - _screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); - _screenSurface.drawBox(300, 191, 16, 8, 15); - _mouse.showMouse(); -} - -/** - * Test Keyboard - * @remarks Originally called 'teskbd' - */ -void MortevielleEngine::testKeyboard() { - if (keyPressed()) - testou(); -} - -int MortevielleEngine::testou() { - char ch = getChar(); - - switch (ch) { - case '\23' : - _soundOff = !_soundOff; - break; - case '\26' : - if ((_x26KeyCount == 1) || (_x26KeyCount == 2)) { - decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - ++_x26KeyCount; - - return 61; - } - break; - case '\33' : - if (keyPressed()) - ch = getChar(); - break; - default: - break; - } - - return ord(ch); -} - -void MortevielleEngine::sauvecr(int y, int dy) { -// _mouse.hideMouse(); -// _mouse.showMouse(); -} - -void MortevielleEngine::charecr(int y, int dy) { -// _mouse.hideMouse(); -// _mouse.showMouse(); -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp new file mode 100644 index 0000000000..f2d0c952dc --- /dev/null +++ b/engines/mortevielle/utils.cpp @@ -0,0 +1,3454 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Mortville Manor DOS source code + * Copyright (c) 1987-1989 Lankhor + */ + +#include "common/scummsys.h" +#include "graphics/cursorman.h" + +#include "mortevielle/dialogs.h" +#include "mortevielle/menu.h" +#include "mortevielle/mortevielle.h" +#include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" +#include "mortevielle/speech.h" + +namespace Mortevielle { + +/** + * Check is a key was pressed + * It also delays the engine and check if the screen has to be updated + * @remarks Originally called 'keypressed' + */ +bool MortevielleEngine::keyPressed() { + // Check for any pending key presses + handleEvents(); + + // Check if it's time to draw the next frame + if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { + _lastGameFrame = g_system->getMillis(); + + _screenSurface.updateScreen(); + + _debugger.onFrame(); + } + + // Delay briefly to keep CPU usage down + g_system->delayMillis(5); + + // Return if there are any pending key presses + return !_keypresses.empty(); +} + +/** + * Wait for a keypress + * @remarks Originally called 'get_ch' + */ +int MortevielleEngine::getChar() { + // If there isn't any pending keypress, wait until there is + while (!shouldQuit() && _keypresses.empty()) { + keyPressed(); + } + + // Return the top keypress + return shouldQuit() ? 0 : _keypresses.pop(); +} + +/** + * Handle pending events + * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, + * the mouse Y position is divided by 2 to keep the game thinking the Y goes from 0 - 199 + */ +bool MortevielleEngine::handleEvents() { + Common::Event event; + if (!g_system->getEventManager()->pollEvent(event)) + return false; + + switch (event.type) { + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_MOUSEMOVE: + _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); + _mouse._pos.x = event.mouse.x; + _mouse._pos.y = event.mouse.y / 2; + + if (event.type == Common::EVENT_LBUTTONDOWN) + _mouseClick = true; + else if (event.type == Common::EVENT_LBUTTONUP) + _mouseClick = false; + + break; + case Common::EVENT_KEYDOWN: + addKeypress(event); + break; + default: + break; + } + + return true; +} + +/** + * Add the specified key to the pending keypress stack + */ +void MortevielleEngine::addKeypress(Common::Event &evt) { + // Character to add + char ch = evt.kbd.ascii; + + // Check for debugger + if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger.attach(); + _debugger.onFrame(); + } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { + // Handle alphabetic keys + if (evt.kbd.hasFlags(Common::KBD_CTRL)) + ch = evt.kbd.keycode - Common::KEYCODE_a + 1; + else + ch = evt.kbd.keycode - Common::KEYCODE_a + 'A'; + } else if ((evt.kbd.keycode >= Common::KEYCODE_F1) && (evt.kbd.keycode <= Common::KEYCODE_F12)) { + // Handle function keys + ch = 59 + evt.kbd.keycode - Common::KEYCODE_F1; + } else { + // Series of special cases + switch (evt.kbd.keycode) { + case Common::KEYCODE_KP4: + case Common::KEYCODE_LEFT: + ch = '4'; + break; + case Common::KEYCODE_KP2: + case Common::KEYCODE_DOWN: + ch = '2'; + break; + case Common::KEYCODE_KP6: + case Common::KEYCODE_RIGHT: + ch = '6'; + break; + case Common::KEYCODE_KP8: + case Common::KEYCODE_UP: + ch = '8'; + break; + case Common::KEYCODE_KP7: + ch = '7'; + break; + case Common::KEYCODE_KP1: + ch = '1'; + break; + case Common::KEYCODE_KP9: + ch = '9'; + break; + case Common::KEYCODE_KP3: + ch = '3'; + break; + case Common::KEYCODE_KP5: + ch = '5'; + break; + case Common::KEYCODE_RETURN: + ch = '\13'; + break; + case Common::KEYCODE_ESCAPE: + ch = '\33'; + break; + default: + break; + } + } + + if (ch != 0) + _keypresses.push(ch); +} + + +static byte CURSOR_ARROW_DATA[16 * 16] = { + 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x0f, 0x0f, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +/** + * Initialize the mouse + */ +void MortevielleEngine::initMouse() { + CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); + CursorMan.showMouse(true); + + _mouse.initMouse(); +} + +/** + * Sets the mouse position + * @remarks Since the ScummVM screen surface is double height to handle 640x200 using 640x400, + * the mouse Y position is doubled to convert from 0-199 to 0-399 + */ +void MortevielleEngine::setMousePos(const Common::Point &pt) { + // Adjust the passed position from simulated 640x200 to 640x400 co-ordinates + Common::Point newPoint(pt.x, (pt.y == 199) ? 399 : pt.y * 2); + + if (newPoint != _mousePos) + // Warp the mouse to the new position + g_system->warpMouse(newPoint.x, newPoint.y); + + // Save the new position + _mousePos = newPoint; +} + +/** + * Delay by a given amount + */ +void MortevielleEngine::delay(int amount) { + uint32 endTime = g_system->getMillis() + amount; + + while (g_system->getMillis() < endTime) { + if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { + _lastGameFrame = g_system->getMillis(); + _screenSurface.updateScreen(); + + _debugger.onFrame(); + } + + g_system->delayMillis(10); + } +} + +/** + * Waits for the user to select an action, and then handles it + * @remarks Originally called tecran + */ +void MortevielleEngine::handleAction() { + const int lim = 20000; + int temps = 0; + char inkey = '\0'; + bool oo, funct = 0; + + clearVerbBar(); + oo = false; + _controlMenu = 0; + if (!_keyPressedEsc) { + _menu.drawMenu(); + _menu._menuDisplayed = true; + temps = 0; + _key = 0; + funct = false; + inkey = '.'; + + _inMainGameLoop = true; + do { + _menu.updateMenu(); + prepareRoom(); + _mouse.moveMouse(funct, inkey); + if (shouldQuit()) + return; + ++temps; + } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); + _inMainGameLoop = false; + + _menu.eraseMenu(); + _menu._menuDisplayed = false; + if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { + changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); + return; + } + if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) { + Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 15); + _savegameManager.saveGame(_msg[4] & 15, saveName); + } + if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) + _savegameManager.loadGame((_msg[4] & 15) - 1); + if (inkey == '\103') { /* F9 */ + temps = _dialogManager.show(_hintPctMessage, 1); + return; + } else if (inkey == '\77') { + if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { + _msg[4] = _menuOpcode; + displayTextInVerbBar(getEngineString(S_IDEM)); + } else + return; + } else if (inkey == '\104') { + if ((_x != 0) && (_y != 0)) + _num = 9999; + return; + } + } + if (inkey == '\73') { + _quitGame = true; + hourToChar(); + } else { + if ((funct) && (inkey != '\77')) + return; + if (temps > lim) { + handleDescriptionText(2, 141); + if (_num == 9999) + _num = 0; + } else { + _menuOpcode = _msg[3]; + if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF)) + _menuOpcode = _msg[4]; + if (!_anyone) { + if ((_heroSearching) || (_obpart)) { + if (_mouse._pos.y < 12) + return; + + if ((_msg[4] == OPCODE_SOUND) || (_msg[4] == OPCODE_LIFT)) { + oo = true; + if ((_msg[4] == OPCODE_LIFT) || (_obpart)) { + endSearch(); + _caff = _coreVar._currPlace; + _crep = 998; + } else + tsuiv(); + mennor(); + } + } + } + do { + if (! oo) + handleOpcode(); + + if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { + _text.taffich(); + if (_destinationOk) { + _destinationOk = false; + drawPicture(); + } + if ((!_syn) || (_col)) + handleDescriptionText(2, _crep); + } + } while (_syn); + if (_controlMenu != 0) + displayControlMenu(); + } + } +} + +/** + * Engine function - Init Places + * @remarks Originally called 'init_lieu' + */ +void MortevielleEngine::loadPlaces() { + Common::File f; + + if (!f.open("MXX.mor")) + if (!f.open("MFXX.mor")) + error("Missing file - MXX.mor"); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 25; ++j) + _destinationArray[i][j] = f.readByte(); + } + + f.close(); +} + +/** + * Set Text Color + * @remarks Originally called 'text_color' + */ +void MortevielleEngine::setTextColor(int col) { + _textColor = col; +} + +/** + * Prepare screen - Type 1! + * @remarks Originally called 'ecrf1' + */ +void MortevielleEngine::prepareScreenType1() { + // Large drawing + _screenSurface.drawBox(0, 11, 512, 163, 15); +} + +/** + * Prepare room - Type 2! + * @remarks Originally called 'ecrf2' + */ +void MortevielleEngine::prepareScreenType2() { + setTextColor(5); +} + +/** + * Prepare room - Type 3! + * @remarks Originally called 'ecrf7' + */ +void MortevielleEngine::prepareScreenType3() { + setTextColor(4); +} + +/** + * Engine function - Update hour + * @remarks Originally called 'calch' + */ +void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { + int newHour = readclock(); + int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration); + minute = ((th % 2) + _currHalfHour) * 30; + hour = ((uint)th >> 1) + _currHour; + if (minute == 60) { + minute = 0; + ++hour; + } + day = (hour / 24) + _currDay; + hour = hour - ((day - _currDay) * 24); +} + +/** + * Engine function - Convert character index to bit index + * @remarks Originally called 'conv' + */ +int MortevielleEngine::convertCharacterIndexToBitIndex(int characterIndex) { + return 128 >> (characterIndex - 1); +} + +/** + * Engine function - Convert bit index to character index + * @remarks Originally called 'tip' + */ +int MortevielleEngine::convertBitIndexToCharacterIndex(int bitIndex) { + int retVal = 0; + + if (bitIndex == 128) + retVal = 1; + else if (bitIndex == 64) + retVal = 2; + else if (bitIndex == 32) + retVal = 3; + else if (bitIndex == 16) + retVal = 4; + else if (bitIndex == 8) + retVal = 5; + else if (bitIndex == 4) + retVal = 6; + else if (bitIndex == 2) + retVal = 7; + else if (bitIndex == 1) + retVal = 8; + + return retVal; +} + +/** + * Engine function - Reset presence in other rooms + * @remarks Originally called 't5' + */ +void MortevielleEngine::resetPresenceInRooms(int roomId) { + if (roomId == DINING_ROOM) + _blo = false; + + if (roomId != GREEN_ROOM) { + _roomPresenceLuc = false; + _roomPresenceIda = false; + } + + if (roomId != PURPLE_ROOM) + _purpleRoomPresenceLeo = false; + + if (roomId != DARKBLUE_ROOM) { + _roomPresenceGuy = false; + _roomPresenceEva = false; + } + + if (roomId != BLUE_ROOM) + _roomPresenceMax = false; + if (roomId != RED_ROOM) + _roomPresenceBob = false; + if (roomId != GREEN_ROOM2) + _roomPresencePat = false; + if (roomId != TOILETS) + _toiletsPresenceBobMax = false; + if (roomId != BATHROOM) + _bathRoomPresenceBobMax = false; + if (roomId != ROOM9) + _room9PresenceLeo = false; +} + +/** + * Engine function - Show the people present in the given room + * @remarks Originally called 'affper' + */ +void MortevielleEngine::showPeoplePresent(int bitIndex) { + int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + + for (int i = 1; i <= 8; ++i) + _menu.disableMenuItem(_menu._discussMenu[i]); + + clearUpperRightPart(); + if ((bitIndex & 128) == 128) { + _screenSurface.putxy(xp, 24); + _screenSurface.drawString("LEO", 4); + _menu.enableMenuItem(_menu._discussMenu[1]); + } + if ((bitIndex & 64) == 64) { + _screenSurface.putxy(xp, 32); + _screenSurface.drawString("PAT", 4); + _menu.enableMenuItem(_menu._discussMenu[2]); + } + if ((bitIndex & 32) == 32) { + _screenSurface.putxy(xp, 40); + _screenSurface.drawString("GUY", 4); + _menu.enableMenuItem(_menu._discussMenu[3]); + } + if ((bitIndex & 16) == 16) { + _screenSurface.putxy(xp, 48); + _screenSurface.drawString("EVA", 4); + _menu.enableMenuItem(_menu._discussMenu[4]); + } + if ((bitIndex & 8) == 8) { + _screenSurface.putxy(xp, 56); + _screenSurface.drawString("BOB", 4); + _menu.enableMenuItem(_menu._discussMenu[5]); + } + if ((bitIndex & 4) == 4) { + _screenSurface.putxy(xp, 64); + _screenSurface.drawString("LUC", 4); + _menu.enableMenuItem(_menu._discussMenu[6]); + } + if ((bitIndex & 2) == 2) { + _screenSurface.putxy(xp, 72); + _screenSurface.drawString("IDA", 4); + _menu.enableMenuItem(_menu._discussMenu[7]); + } + if ((bitIndex & 1) == 1) { + _screenSurface.putxy(xp, 80); + _screenSurface.drawString("MAX", 4); + _menu.enableMenuItem(_menu._discussMenu[8]); + } + _currBitIndex = bitIndex; +} + +/** + * Engine function - Select random characters + * @remarks Originally called 'choix' + */ +int MortevielleEngine::selectCharacters(int min, int max) { + bool invertSelection = false; + int rand = getRandomNumber(min, max); + + if (rand > 4) { + rand = 8 - rand; + invertSelection = true; + } + + int i = 0; + int retVal = 0; + while (i < rand) { + int charIndex = getRandomNumber(1, 8); + int charBitIndex = convertCharacterIndexToBitIndex(charIndex); + if ((retVal & charBitIndex) != charBitIndex) { + ++i; + retVal |= charBitIndex; + } + } + if (invertSelection) + retVal = 255 - retVal; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Green Room + * @remarks Originally called 'cpl1' + */ +int MortevielleEngine::getPresenceStatsGreenRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + // The original uses an || instead of an &&, resulting + // in an always true condition. Based on the other tests, + // and on other scenes, we use an && instead. + if ((hour > 7) && (hour < 11)) + retVal = 25; + else if ((hour > 10) && (hour < 14)) + retVal = 35; + else if ((hour > 13) && (hour < 16)) + retVal = 50; + else if ((hour > 15) && (hour < 18)) + retVal = 5; + else if ((hour > 17) && (hour < 22)) + retVal = 35; + else if ((hour > 21) && (hour < 24)) + retVal = 50; + else if ((hour >= 0) && (hour < 8)) + retVal = 70; + + _menu.updateMenu(); + + return retVal; +} +/** + * Engine function - Get Presence Statistics - Purple Room + * @remarks Originally called 'cpl2' + */ +int MortevielleEngine::getPresenceStatsPurpleRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 11)) + retVal = -2; + else if (hour == 11) + retVal = 100; + else if ((hour > 11) && (hour < 23)) + retVal = 10; + else if (hour == 23) + retVal = 20; + else if ((hour >= 0) && (hour < 8)) + retVal = 50; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Toilets + * @remarks Originally called 'cpl3' + */ +int MortevielleEngine::getPresenceStatsToilets() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 10)) || ((hour > 19) && (hour < 24))) + retVal = 34; + else if (((hour > 9) && (hour < 20)) || ((hour >= 0) && (hour < 9))) + retVal = 0; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Blue Room + * @remarks Originally called 'cpl5' + */ +int MortevielleEngine::getPresenceStatsBlueRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 6) && (hour < 10)) + retVal = 0; + else if (hour == 10) + retVal = 100; + else if ((hour > 10) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 7)) + retVal = 50; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Red Room + * @remarks Originally called 'cpl6' + */ +int MortevielleEngine::getPresenceStatsRedRoom() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 13)) || ((hour > 17) && (hour < 20))) + retVal = -2; + else if (((hour > 12) && (hour < 17)) || ((hour > 19) && (hour < 24))) + retVal = 35; + else if (hour == 17) + retVal = 100; + else if ((hour >= 0) && (hour < 8)) + retVal = 60; + + return retVal; +} + +/** + * Shows the "you are alone" message in the status area + * on the right hand side of the screen + * @remarks Originally called 'person' + */ +void MortevielleEngine::displayAloneText() { + for (int cf = 1; cf <= 8; ++cf) + _menu.disableMenuItem(_menu._discussMenu[cf]); + + Common::String sYou = getEngineString(S_YOU); + Common::String sAre = getEngineString(S_ARE); + Common::String sAlone = getEngineString(S_ALONE); + + clearUpperRightPart(); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); + _screenSurface.drawString(sYou, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); + _screenSurface.drawString(sAre, 4); + _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); + _screenSurface.drawString(sAlone, 4); + + _currBitIndex = 0; +} + +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl10' + */ +int MortevielleEngine::getPresenceStatsDiningRoom(int &hour) { + int day, minute; + + int retVal = 0; + updateHour(day, hour, minute); + if (((hour > 7) && (hour < 11)) || ((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) + retVal = 100; + else if ((hour == 11) || ((hour > 20) && (hour < 24))) + retVal = 45; + else if (((hour > 13) && (hour < 17)) || (hour == 18)) + retVal = 35; + else if (hour == 17) + retVal = 60; + else if ((hour >= 0) && (hour < 8)) + retVal = 5; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Bureau + * @remarks Originally called 'cpl11' + */ +int MortevielleEngine::getPresenceStatsBureau(int &hour) { + int day, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 12)) || ((hour > 20) && (hour < 24))) + retVal = 25; + else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) + retVal = 5; + else if ((hour > 13) && (hour < 17)) + retVal = 55; + else if ((hour > 16) && (hour < 19)) + retVal = 45; + else if ((hour >= 0) && (hour < 9)) + retVal = 0; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Kitchen + * @remarks Originally called 'cpl12' + */ +int MortevielleEngine::getPresenceStatsKitchen() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (((hour > 8) && (hour < 15)) || ((hour > 16) && (hour < 22))) + retVal = 55; + else if (((hour > 14) && (hour < 17)) || ((hour > 21) && (hour < 24))) + retVal = 25; + else if ((hour >= 0) && (hour < 5)) + retVal = 0; + else if ((hour > 4) && (hour < 9)) + retVal = 15; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Attic + * @remarks Originally called 'cpl13' + */ +int MortevielleEngine::getPresenceStatsAttic() { + return 0; +} + +/** + * Engine function - Get Presence Statistics - Room Landing + * @remarks Originally called 'cpl15' + */ +int MortevielleEngine::getPresenceStatsLanding() { + int day, hour, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if ((hour > 7) && (hour < 12)) + retVal = 25; + else if ((hour > 11) && (hour < 14)) + retVal = 0; + else if ((hour > 13) && (hour < 18)) + retVal = 10; + else if ((hour > 17) && (hour < 20)) + retVal = 55; + else if ((hour > 19) && (hour < 22)) + retVal = 5; + else if ((hour > 21) && (hour < 24)) + retVal = 15; + else if ((hour >= 0) && (hour < 8)) + retVal = -15; + + return retVal; +} + +/** + * Engine function - Get Presence Statistics - Room Chapel + * @remarks Originally called 'cpl20' + */ +int MortevielleEngine::getPresenceStatsChapel(int &hour) { + int day, minute; + int retVal = 0; + + updateHour(day, hour, minute); + if (hour == 10) + retVal = 65; + else if ((hour > 10) && (hour < 21)) + retVal = 5; + else if ((hour > 20) && (hour < 24)) + retVal = -15; + else if ((hour >= 0) && (hour < 5)) + retVal = -300; + else if ((hour > 4) && (hour < 10)) + retVal = -5; + + return retVal; +} + +/** + * Engine function - Check who is in the Green Room + * @remarks Originally called 'quelq1' + */ +void MortevielleEngine::setPresenceGreenRoom(int roomId) { + int rand = getRandomNumber(1, 2); + if (roomId == GREEN_ROOM) { + if (rand == 1) + _roomPresenceLuc = true; + else + _roomPresenceIda = true; + } else if (roomId == DARKBLUE_ROOM) { + if (rand == 1) + _roomPresenceGuy = true; + else + _roomPresenceEva = true; + } + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Purple Room + * @remarks Originally called 'quelq2' + */ +void MortevielleEngine::setPresencePurpleRoom() { + if (_place == PURPLE_ROOM) + _purpleRoomPresenceLeo = true; + else + _room9PresenceLeo = true; + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Blue Room + * @remarks Originally called 'quelq5' + */ +void MortevielleEngine::setPresenceBlueRoom() { + _roomPresenceMax = true; + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Red Room + * @remarks Originally called 'quelq6' + */ +void MortevielleEngine::setPresenceRedRoom(int roomId) { + if (roomId == RED_ROOM) + _roomPresenceBob = true; + else if (roomId == GREEN_ROOM2) + _roomPresencePat = true; + + _currBitIndex = 10; +} + +/** + * Engine function - Check who is in the Dining Room + * @remarks Originally called 'quelq10' + */ +int MortevielleEngine::setPresenceDiningRoom(int hour) { + int retVal = 0; + + if ((hour >= 0) && (hour < 8)) + retVal = checkLeoMaxRandomPresence(); + else { + int min = 0, max = 0; + if ((hour > 7) && (hour < 10)) { + min = 5; + max = 7; + } else if ((hour > 9) && (hour < 12)) { + min = 1; + max = 4; + } else if (((hour > 11) && (hour < 15)) || ((hour > 18) && (hour < 21))) { + min = 6; + max = 8; + } else if (((hour > 14) && (hour < 19)) || ((hour > 20) && (hour < 24))) { + min = 1; + max = 5; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Bureau + * @remarks Originally called 'quelq11' + */ +int MortevielleEngine::setPresenceBureau(int hour) { + int retVal = 0; + + if ((hour >= 0) && (hour < 8)) + retVal = checkLeoMaxRandomPresence(); + else { + int min = 0, max = 0; + if (((hour > 7) && (hour < 10)) || ((hour > 20) && (hour < 24))) { + min = 1; + max = 3; + } else if (((hour > 9) && (hour < 12)) || ((hour > 13) && (hour < 19))) { + min = 1; + max = 4; + } else if (((hour > 11) && (hour < 14)) || ((hour > 18) && (hour < 21))) { + min = 1; + max = 2; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Kitchen + * @remarks Originally called 'quelq12' + */ +int MortevielleEngine::setPresenceKitchen() { + int retVal = checkLeoMaxRandomPresence(); + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the Landing + * @remarks Originally called 'quelq15' + */ +int MortevielleEngine::setPresenceLanding() { + bool test = false; + int rand = 0; + do { + rand = getRandomNumber(1, 8); + test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || + ((rand == 2) && _roomPresencePat) || + ((rand == 3) && _roomPresenceGuy) || + ((rand == 4) && _roomPresenceEva) || + ((rand == 5) && _roomPresenceBob) || + ((rand == 6) && _roomPresenceLuc) || + ((rand == 7) && _roomPresenceIda) || + ((rand == 8) && _roomPresenceMax)); + } while (test); + + int retVal = convertCharacterIndexToBitIndex(rand); + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Check who is in the chapel + * @remarks Originally called 'quelq20' + */ +int MortevielleEngine::setPresenceChapel(int hour) { + int retVal = 0; + + if (((hour >= 0) && (hour < 10)) || ((hour > 18) && (hour < 24))) + retVal = checkLeoMaxRandomPresence(); + else { + int min = 0, max = 0; + if ((hour > 9) && (hour < 12)) { + min = 3; + max = 7; + } else if ((hour > 11) && (hour < 18)) { + min = 1; + max = 2; + } else if (hour == 18) { + min = 2; + max = 4; + } + retVal = selectCharacters(min, max); + } + showPeoplePresent(retVal); + + return retVal; +} + +/** + * Engine function - Get the answer after you known a door + * @remarks Originally called 'frap' + */ +void MortevielleEngine::getKnockAnswer() { + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour >= 0) && (hour < 8)) + _crep = 190; + else { + if (getRandomNumber(1, 100) > 70) + _crep = 190; + else + _crep = 147; + } +} + +/** + * Engine function - Get Room Presence Bit Index + * @remarks Originally called 'nouvp' + */ +int MortevielleEngine::getPresenceBitIndex(int roomId) { + int bitIndex = 0; + if (roomId == GREEN_ROOM) { + if (_roomPresenceLuc) + bitIndex = 4; // LUC + if (_roomPresenceIda) + bitIndex = 2; // IDA + } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) + || ((roomId == ROOM9) && (_room9PresenceLeo))) + bitIndex = 128; // LEO + else if (roomId == DARKBLUE_ROOM) { + if (_roomPresenceGuy) + bitIndex = 32; // GUY + if (_roomPresenceEva) + bitIndex = 16; // EVA + } else if ((roomId == BLUE_ROOM) && (_roomPresenceMax)) + bitIndex = 1; // MAX + else if ((roomId == RED_ROOM) && (_roomPresenceBob)) + bitIndex = 8; // BOB + else if ((roomId == GREEN_ROOM2) && (_roomPresencePat)) + bitIndex = 64; // PAT + else if ( ((roomId == TOILETS) && (_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (_bathRoomPresenceBobMax)) ) + bitIndex = 9; // BOB + MAX + + if (bitIndex != 9) + showPeoplePresent(bitIndex); + + return bitIndex; +} + +/** + * Engine function - initGame + * @remarks Originally called 'dprog' + */ +void MortevielleEngine::initGame() { + _place = MANOR_FRONT; + _currentHourCount = 0; + if (!_coreVar._alreadyEnteredManor) + _blo = true; + _inGameHourDuration = kTime1; + _currentDayHour = readclock(); +} + +/** + * Engine function - Set Random Presence - Green Room + * @remarks Originally called 'pl1' + */ +void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { + if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) + || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { + int p = getPresenceStatsGreenRoom(); + int rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceGreenRoom(_place); + } +} + +/** + * Engine function - Set Random Presence - Purple Room + * @remarks Originally called 'pl2' + */ +void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { + if (!_purpleRoomPresenceLeo) { + int p = getPresenceStatsPurpleRoom(); + int rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresencePurpleRoom(); + } +} + +/** + * Engine function - Set Random Presence - Blue Room + * @remarks Originally called 'pl5' + */ +void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { + if (!_roomPresenceMax) { + int p = getPresenceStatsBlueRoom(); + int rand; + + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceBlueRoom(); + } +} + +/** + * Engine function - Set Random Presence - Red Room + * @remarks Originally called 'pl6' + */ +void MortevielleEngine::setRandomPresenceRedRoom(int cf) { + if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) + || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { + int p = getPresenceStatsRedRoom(); + int rand; + + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceRedRoom(_place); + } +} + +/** + * Engine function - Set Random Presence - Room 9 + * @remarks Originally called 'pl9' + */ +void MortevielleEngine::setRandomPresenceRoom9(int cf) { + if (!_room9PresenceLeo) { + cf = -10; + int p, rand; + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresencePurpleRoom(); + } +} + +/** + * Engine function - Set Random Presence - Dining Room + * @remarks Originally called 'pl10' + */ +void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { + int h, rand; + int p = getPresenceStatsDiningRoom(h); + phaz(rand, p, cf); + + if (rand > p) + displayAloneText(); + else + setPresenceDiningRoom(h); +} + +/** + * Engine function - Set Random Presence - Bureau + * @remarks Originally called 'pl11' + */ +void MortevielleEngine::setRandomPresenceBureau(int cf) { + int h, rand; + + int p = getPresenceStatsBureau(h); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceBureau(h); +} + +/** + * Engine function - Set Random Presence - Kitchen + * @remarks Originally called 'pl12' + */ +void MortevielleEngine::setRandomPresenceKitchen(int cf) { + int p, rand; + + p = getPresenceStatsKitchen(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceKitchen(); +} + +/** + * Engine function - Set Random Presence - Attic / Cellar + * @remarks Originally called 'pl13' + */ +void MortevielleEngine::setRandomPresenceAttic(int cf) { + int p, rand; + + p = getPresenceStatsAttic(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceKitchen(); +} + +/** + * Engine function - Set Random Presence - Landing + * @remarks Originally called 'pl15' + */ +void MortevielleEngine::setRandomPresenceLanding(int cf) { + int p, rand; + + p = getPresenceStatsLanding(); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceLanding(); +} + +/** + * Engine function - Set Random Presence - Chapel + * @remarks Originally called 'pl20' + */ +void MortevielleEngine::setRandomPresenceChapel(int cf) { + int h, rand; + + int p = getPresenceStatsChapel(h); + phaz(rand, p, cf); + if (rand > p) + displayAloneText(); + else + setPresenceChapel(h); +} + +/** + * Start music or speech + * @remarks Originally called 'musique' + */ +void MortevielleEngine::startMusicOrSpeech(int so) { + if (so == 0) { + /* musik(0) */ + ; + } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { + // Type 1: Speech + _speechManager.startSpeech(10, 1, 1); + _introSpeechPlayed = true; + } else { + if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) + // Type 1: Speech + _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) + // Type 1: Speech + _speechManager.startSpeech(8, 1, 1); + else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) + // Type 1: Speech + _speechManager.startSpeech(12, 1, 1); + else if (_coreVar._currPlace == INSIDE_WELL) + // Type 1: Speech + _speechManager.startSpeech(13, 1, 1); + else + // Type 2 : music + _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + } +} + +/** + * Engine function - You lose! + * @remarks Originally called 'tperd' + */ +void MortevielleEngine::loseGame() { + resetOpenObjects(); + _roomDoorId = OWN_ROOM; + _mchai = 0; + _menu.unsetSearchMenu(); + if (!_blo) + getPresence(MANOR_FRONT); + + _loseGame = true; + clearUpperLeftPart(); + _screenSurface.drawBox(60, 35, 400, 50, 15); + handleDescriptionText(9, _crep); + clearDescriptionBar(); + clearVerbBar(); + _col = false; + _syn = false; + _destinationOk = false; +} + +/** + * Engine function - Check inventory for a given object + * @remarks Originally called 'cherjer' + */ +bool MortevielleEngine::checkInventory(int objectId) { + bool retVal = false; + for (int i = 1; i <= 6; ++i) + retVal = (retVal || (_coreVar._inventory[i] == objectId)); + + if (_coreVar._selectedObjectId == objectId) + retVal = true; + + return retVal; +} + +/** + * Engine function - Display Dining Room + * @remarks Originally called 'st1sama' + */ +void MortevielleEngine::displayDiningRoom() { + _coreVar._currPlace = DINING_ROOM; + affrep(); +} + +/** + * Engine function - Start non interactive Dialog + * @remarks Originally called 'sparl' + */ +void MortevielleEngine::startDialog(int16 rep) { + const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; + int key; + + assert(rep >= 0); + + _mouse.hideMouse(); + Common::String dialogStr = getString(rep + kDialogStringIndex); + _text.displayStr(dialogStr, 230, 4, 65, 24, 5); + _dialogManager.drawF3F8(); + + key = 0; + do { + _speechManager.startSpeech(rep, haut[_caff - 69], 0); + key = _dialogManager.waitForF3F8(); + if (shouldQuit()) + return; + } while (key != 66); + hirs(); + _mouse.showMouse(); +} + +/** + * Engine function - End of Search: reset globals + * @remarks Originally called 'finfouill' + */ +void MortevielleEngine::endSearch() { + _heroSearching = false; + _obpart = false; + _searchCount = 0; + _menu.unsetSearchMenu(); +} + +/** + * Engine function - Go to Dining room + * @remarks Originally called 't1sama' + */ +void MortevielleEngine::gotoDiningRoom() { + int day, hour, minute; + + updateHour(day, hour, minute); + if ((hour < 5) && (_coreVar._currPlace > ROOM18)) { + if (!checkInventory(137)) { //You don't have the keys, and it's late + _crep = 1511; + loseGame(); + } else + displayDiningRoom(); + } else if (!_coreVar._alreadyEnteredManor) { //Is it your first time? + _currBitIndex = 255; // Everybody is present + showPeoplePresent(_currBitIndex); + _caff = 77; + drawPictureWithText(); + _screenSurface.drawBox(223, 47, 155, 91, 15); + handleDescriptionText(2, 33); + testKey(false); + mennor(); + _mouse.hideMouse(); + hirs(); + premtet(); + startDialog(140); + drawRightFrame(); + drawClock(); + _mouse.showMouse(); + _coreVar._currPlace = OWN_ROOM; + affrep(); + resetPresenceInRooms(DINING_ROOM); + if (!_blo) + getPresence(OWN_ROOM); + _currBitIndex = 0; + _savedBitIndex = 0; + _coreVar._alreadyEnteredManor = true; + } else + displayDiningRoom(); +} + +/** + * Engine function - Check Manor distance (in the mountains) + * @remarks Originally called 't1neig' + */ +void MortevielleEngine::checkManorDistance() { + ++_manorDistance; + if (_manorDistance > 2) { + _crep = 1506; + loseGame(); + } else { + _destinationOk = true; + _coreVar._currPlace = MOUNTAIN; + affrep(); + } +} + +/** + * Engine function - Go to Manor front + * @remarks Originally called 't1deva' + */ +void MortevielleEngine::gotoManorFront() { + _manorDistance = 0; + _coreVar._currPlace = MANOR_FRONT; + affrep(); +} + +/** + * Engine function - Go to Manor back + * @remarks Originally called 't1derr' + */ +void MortevielleEngine::gotoManorBack() { + _coreVar._currPlace = MANOR_BACK; + affrep(); +} + +/** + * Engine function - Dead : Flooded in Well + * @remarks Originally called 't1deau' + */ +void MortevielleEngine::floodedInWell() { + _crep = 1503; + loseGame(); +} + +/** + * Engine function - Change Graphical Device + * @remarks Originally called 'change_gd' + */ +void MortevielleEngine::changeGraphicalDevice(int newDevice) { + _mouse.hideMouse(); + _currGraphicalDevice = newDevice; + hirs(); + _mouse.initMouse(); + _mouse.showMouse(); + drawRightFrame(); + prepareRoom(); + drawClock(); + if (_currBitIndex != 0) + showPeoplePresent(_currBitIndex); + else + displayAloneText(); + clearDescriptionBar(); + clearVerbBar(); + _maff = 68; + drawPictureWithText(); + handleDescriptionText(2, _crep); + _menu.displayMenu(); +} + +/** + * Called when a savegame has been loaded. + * @remarks Originally called 'antegame' + */ +void MortevielleEngine::gameLoaded() { + _mouse.hideMouse(); + _menu._menuDisplayed = false; + _loseGame = true; + _anyone = false; + _destinationOk = true; + _col = false; + _hiddenHero = false; + _uptodatePresence = false; + _maff = 68; + _menuOpcode = OPCODE_NONE; + _introSpeechPlayed = false; + _x = 0; + _y = 0; + _num = 0; + _startHour = 0; + _endHour = 0; + _searchCount = 0; + _roomDoorId = OWN_ROOM; + _syn = true; + _heroSearching = true; + _mchai = 0; + _manorDistance = 0; + resetOpenObjects(); + _takeObjCount = 0; + affrep(); + _hintPctMessage = getString(580); + + _destinationOk = false; + _endGame = true; + _loseGame = false; + _heroSearching = false; + + displayAloneText(); + prepareRoom(); + drawClock(); + drawPictureWithText(); + handleDescriptionText(2, _crep); + clearVerbBar(); + _endGame = false; + _menu.setDestinationText(_coreVar._currPlace); + _menu.setInventoryText(); + if (_coreVar._selectedObjectId != 0) + displayItemInHand(_coreVar._selectedObjectId + 400); + _mouse.showMouse(); +} + +/** + * Engine function - Handle OpCodes + * @remarks Originally called 'tsitu' + */ +void MortevielleEngine::handleOpcode() { + if (!_col) + clearDescriptionBar(); + _syn = false; + _keyPressedEsc = false; + if (!_anyone) { + if (_uptodatePresence) { + if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { + _controlMenu = 4; + mennor(); + return; + } + } + if (_msg[3] == MENU_MOVE) + fctMove(); + if (_msg[3] == MENU_DISCUSS) + fctDiscuss(); + if (_msg[3] == MENU_INVENTORY) + fctInventoryTake(); + if (_msg[4] == OPCODE_ATTACH) + fctAttach(); + if (_msg[4] == OPCODE_WAIT) + fctWait(); + if (_msg[4] == OPCODE_FORCE) + fctForce(); + if (_msg[4] == OPCODE_SLEEP) + fctSleep(); + if (_msg[4] == OPCODE_LISTEN) + fctListen(); + if (_msg[4] == OPCODE_ENTER) + fctEnter(); + if (_msg[4] == OPCODE_CLOSE) + fctClose(); + if (_msg[4] == OPCODE_SEARCH) + fctSearch(); + if (_msg[4] == OPCODE_KNOCK) + fctKnock(); + if (_msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (_msg[4] == OPCODE_READ) + fctRead(); + if (_msg[4] == OPCODE_EAT) + fctEat(); + if (_msg[4] == OPCODE_PLACE) + fctPlace(); + if (_msg[4] == OPCODE_OPEN) + fctOpen(); + if (_msg[4] == OPCODE_TAKE) + fctTake(); + if (_msg[4] == OPCODE_LOOK) + fctLook(); + if (_msg[4] == OPCODE_SMELL) + fctSmell(); + if (_msg[4] == OPCODE_SOUND) + fctSound(); + if (_msg[4] == OPCODE_LEAVE) + fctLeave(); + if (_msg[4] == OPCODE_LIFT) + fctLift(); + if (_msg[4] == OPCODE_TURN) + fctTurn(); + if (_msg[4] == OPCODE_SSEARCH) + fctSelfSearch(); + if (_msg[4] == OPCODE_SREAD) + fctSelfRead(); + if (_msg[4] == OPCODE_SPUT) + fctSelfPut(); + if (_msg[4] == OPCODE_SLOOK) + fctSelftLook(); + _hiddenHero = false; + + if (_msg[4] == OPCODE_SHIDE) + fctSelfHide(); + } else { + if (_anyone) { + interactNPC(); + _anyone = false; + mennor(); + return; + } + } + int hour, day, minute; + updateHour(day, hour, minute); + if ((((hour == 12) || (hour == 13) || (hour == 19)) && (_coreVar._currPlace != DINING_ROOM)) || + ((hour > 0) && (hour < 6) && (_coreVar._currPlace != OWN_ROOM))) + ++_coreVar._faithScore; + if (((_coreVar._currPlace < CRYPT) || (_coreVar._currPlace > MOUNTAIN)) && (_coreVar._currPlace != INSIDE_WELL) + && (_coreVar._currPlace != OWN_ROOM) && (_coreVar._selectedObjectId != 152) && (!_loseGame)) { + if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { + _crep = 1501; + loseGame(); + } + if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { + _crep = 1508; + loseGame(); + } + if ((day > 1) && (hour > 8) && (!_loseGame)) { + _crep = 1502; + loseGame(); + } + } + mennor(); +} + +/** + * Engine function - Transform time into a char + * @remarks Originally called 'tmaj3' + */ +void MortevielleEngine::hourToChar() { + int day, hour, minute; + + updateHour(day, hour, minute); + if (minute == 30) + minute = 1; + hour += day * 24; + minute += hour * 2; + _coreVar._fullHour = chr(minute); +} + +/** + * Engine function - extract time from a char + * @remarks Originally called 'theure' + */ +void MortevielleEngine::charToHour() { + int fullHour = ord(_coreVar._fullHour); + int tmpHour = fullHour % 48; + _currDay = fullHour / 48; + _currHalfHour = tmpHour % 2; + _currHour = tmpHour / 2; + _hour = _currHour; + if (_currHalfHour == 1) + _minute = 30; + else + _minute = 0; +} + +/** + * Engine function - Clear upper left part of Screen - Type 1 + * @remarks Originally called 'clsf1' + */ +void MortevielleEngine::clearUpperLeftPart() { + _mouse.hideMouse(); + _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); + _mouse.showMouse(); +} + +/** + * Engine function - Clear low bar used by description + * @remarks Originally called 'clsf2' + */ +void MortevielleEngine::clearDescriptionBar() { + _mouse.hideMouse(); + if (_largestClearScreen) { + _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); + _screenSurface.drawBox(0, 175, 634, 24, 15); + _largestClearScreen = false; + } else { + _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); + _screenSurface.drawBox(0, 175, 634, 15, 15); + } + _mouse.showMouse(); +} + +/** + * Engine function - Clear lowest bar used by verbs + * @remarks Originally called 'clsf3' + */ +void MortevielleEngine::clearVerbBar() { + _mouse.hideMouse(); + _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); + _screenSurface.drawBox(0, 191, 634, 8, 15); + _mouse.showMouse(); +} + +/** + * Engine function - Clear upper right part of the screen + * @remarks Originally called 'clsf10' + */ +void MortevielleEngine::clearUpperRightPart() { + int x1, x2; + Common::String st; + + _mouse.hideMouse(); + if (_resolutionScaler == 1) { + x2 = 634; + x1 = 534; + } else { + x2 = 600; + x1 = 544; + } + // Clear ambiance description + _screenSurface.fillRect(15, Common::Rect(x1, 93, x2, 98)); + if (_coreVar._faithScore < 33) + st = getEngineString(S_COOL); + else if (_coreVar._faithScore < 66) + st = getEngineString(S_LOURDE); + else if (_coreVar._faithScore > 65) + st = getEngineString(S_MALSAINE); + + x1 = 580 - (_screenSurface.getStringWidth(st) / 2); + _screenSurface.putxy(x1, 92); + _screenSurface.drawString(st, 4); + + // Clear person list + _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); + _mouse.showMouse(); +} + +/** + * Engine function - Get a random number between two values + * @remarks Originally called 'get_random_number' and 'hazard' + */ +int MortevielleEngine::getRandomNumber(int minval, int maxval) { + return _randomSource.getRandomNumber(maxval - minval) + minval; +} + +/** + * Engine function - Show alert "use move menu" + * @remarks Originally called 'aldepl' + */ +void MortevielleEngine::showMoveMenuAlert() { + _dialogManager.show(getEngineString(S_USE_DEP_MENU), 1); +} + +/** + * The original engine used this method to display a starting text screen letting the player + * select the graphics mode to use + * @remarks Originally called 'dialpre' + */ +void MortevielleEngine::showConfigScreen() { + _crep = 998; +} + +/** + * Decodes a number of 64 byte blocks + * @param pStart Start of data + * @param count Number of 64 byte blocks + * @remarks Originally called 'zzuul' + */ +void MortevielleEngine::decodeNumber(byte *pStart, int count) { + while (count-- > 0) { + for (int idx = 0; idx < 64; ++pStart, ++idx) { + uint16 v = ((*pStart - 0x80) << 1) + 0x80; + + if (v & 0x8000) + *pStart = 0; + else if (v & 0xff00) + *pStart = 0xff; + else + *pStart = (byte)v; + } + } +} + +const byte tabdr[32] = { + 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 byte tab30[32] = { + 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 byte tab31[32]= { + 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 MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { + uint16 oct, ocd; + + /* 5-8 */ + oct = _inpBuffer[idx]; + oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); + if (pt < 6) { + ++idx; + oct = oct << (5 - pt); + pt += 11; + oct = oct | ((uint)_inpBuffer[idx] >> pt); + } else { + pt -= 5; + oct = (uint)oct >> pt; + } + + switch (oct) { + case 11: + c = '$'; + the_end = true; + break; + case 30: + case 31: + ocd = _inpBuffer[idx]; + ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); + if (pt < 6) { + ++idx; + ocd = ocd << (5 - pt); + pt += 11; + ocd = ocd | ((uint)_inpBuffer[idx] >> pt); + } else { + pt -= 5; + ocd = (uint)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]); + break; + } +} + +/** + * Decode and extract the line with the given Id + * @remarks Originally called 'deline' + */ +Common::String MortevielleEngine::getString(int num) { + Common::String wrkStr = ""; + + if (num < 0) { + warning("getString(%d): num < 0! Skipping", num); + } else if (!_txxFileFl) { + wrkStr = getGameString(num); + } else { + int hint = _ntpBuffer[num]._hintId; + byte point = _ntpBuffer[num]._point; + int length = 0; + bool endFl = false; + char let; + do { + cinq_huit(let, hint, point, endFl); + wrkStr += let; + ++length; + } while (!endFl); + } + + while (wrkStr.lastChar() == '$') + // Remove trailing '$'s + wrkStr.deleteLastChar(); + + return wrkStr; +} + +void MortevielleEngine::copcha() { + for (int i = kAcha; i < kAcha + 390; i++) + _tabdon[i] = _tabdon[i + 390]; +} + +/** + * Engine function - When restarting the game, reset the main variables used by the engine + * @remarks Originally called 'inzon' + */ +void MortevielleEngine::resetVariables() { + copcha(); + + _coreVar._alreadyEnteredManor = false; + _coreVar._selectedObjectId = 0; + _coreVar._cellarObjectId = 0; + _coreVar._atticBallHoleObjectId = 0; + _coreVar._atticRodHoleObjectId = 0; + _coreVar._wellObjectId = 0; + _coreVar._secretPassageObjectId = 0; + _coreVar._purpleRoomObjectId = 136; + _coreVar._cryptObjectId = 141; + _coreVar._faithScore = getRandomNumber(4, 10); + _coreVar._currPlace = MANOR_FRONT; + + for (int i = 2; i <= 6; ++i) + _coreVar._inventory[i] = 0; + + // Only object in inventory: a gun + _coreVar._inventory[1] = 113; + + _coreVar._fullHour = chr(20); + + for (int i = 1; i <= 10; ++i) + _coreVar._pctHintFound[i] = ' '; + + for (int i = 1; i <= 6; ++i) + _coreVar._availableQuestion[i] = '*'; + + for (int i = 7; i <= 9; ++i) + _coreVar._availableQuestion[i] = ' '; + + for (int i = 10; i <= 28; ++i) + _coreVar._availableQuestion[i] = '*'; + + for (int i = 29; i <= 42; ++i) + _coreVar._availableQuestion[i] = ' '; + + _coreVar._availableQuestion[33] = '*'; + + for (int i = 1; i <= 8; ++i) + _nbrep[i] = 0; + + init_nbrepm(); +} + +/** + * Engine function - Set the palette + * @remarks Originally called 'writepal' + */ +void MortevielleEngine::setPal(int n) { + switch (_currGraphicalDevice) { + case MODE_TANDY: + case MODE_EGA: + case MODE_AMSTRAD1512: + for (int i = 1; i <= 16; ++i) { + _mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; + _mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; + } + break; + case MODE_CGA: { + nhom pal[16]; + for (int i = 0; i < 16; ++i) { + pal[i] = _cgaPal[n]._a[i]; + } + + if (n < 89) + palette(_cgaPal[n]._p); + + for (int i = 0; i <= 15; ++i) + displayCGAPattern(i, _patternArr[pal[i]._id], pal); + } + break; + default: + break; + } +} + +/** + * Engine function - Display a CGA pattern, using a specified palette + * @remarks Originally called 'outbloc' + */ +void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { + int addr = n * 404 + 0xd700; + + WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr], p._tax); + WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr + 2], p._tay); + addr += 4; + for (int i = 0; i < p._tax; ++i) { + for (int j = 0; j < p._tay; ++j) + _mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + } +} + +/** + * Engine function - Load Palette from File + * @remarks Originally called 'charpal' + */ +void MortevielleEngine::loadPalette() { + Common::File f; + byte b; + + if (!f.open("fxx.mor")) { + if (f.open("mfxx.mor")) + f.seek(7 * 25); + else + error("Missing file - fxx.mor"); + } + + for (int i = 0; i < 108; ++i) + _fxxBuffer[i] = f.readSint16LE(); + f.close(); + + if (!f.open("plxx.mor")) + error("Missing file - plxx.mor"); + for (int i = 0; i <= 90; ++i) { + for (int j = 1; j <= 16; ++j) { + _stdPal[i][j].x = f.readByte(); + _stdPal[i][j].y = f.readByte(); + } + } + f.close(); + + if (!f.open("cxx.mor")) + error("Missing file - cxx.mor"); + + for (int j = 0; j <= 90; ++j) { + _cgaPal[j]._p = f.readByte(); + for (int i = 0; i <= 15; ++i) { + nhom &with = _cgaPal[j]._a[i]; + + b = f.readByte(); + with._id = (uint)b >> 4; + with._hom[0] = ((uint)b >> 2) & 3; + with._hom[1] = b & 3; + } + } + + _cgaPal[10]._a[9] = _cgaPal[10]._a[5]; + for (int j = 0; j <= 14; ++j) { + _patternArr[j]._tax = f.readByte(); + _patternArr[j]._tay = f.readByte(); + for (int i = 1; i <= 20; ++i) { + for (int k = 1; k <= 20; ++k) + _patternArr[j]._des[i][k] = f.readByte(); + } + } + f.close(); +} + +/** + * Engine function - Load Texts from File + * @remarks Originally called 'chartex' + */ +void MortevielleEngine::loadTexts() { + Common::File inpFile; + Common::File ntpFile; + + _txxFileFl = false; + if (getLanguage() == Common::EN_ANY) { + warning("English version expected - Switching to DAT file"); + return; + } + + if (!inpFile.open("TXX.INP")) { + if (!inpFile.open("TXX.MOR")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + } + if (!ntpFile.open("TXX.NTP")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + + if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { + warning("TXX file - Unexpected format - Switching to DAT file"); + return; + } + + for (int i = 0; i < inpFile.size() / 2; ++i) + _inpBuffer[i] = inpFile.readUint16LE(); + + inpFile.close(); + _txxFileFl = true; + + for (int i = 0; i < (ntpFile.size() / 3); ++i) { + _ntpBuffer[i]._hintId = ntpFile.readSint16LE(); + _ntpBuffer[i]._point = ntpFile.readByte(); + } + + ntpFile.close(); + +} + +void MortevielleEngine::loadBRUIT5() { + Common::File f; + + if (!f.open("bruit5")) + error("Missing file - bruit5"); + + f.read(&_mem[kAdrNoise5 * 16 + 0], 149 * 128); + f.close(); +} + +void MortevielleEngine::loadCFIEC() { + Common::File f; + + if (!f.open("cfiec.mor")) { + if (!f.open("alcfiec.mor")) + error("Missing file - *cfiec.mor"); + } + + _cfiecBufferSize = ((f.size() / 128) + 1) * 128; + int32 fileSize = f.size(); + + if (!_reloadCFIEC) + _cfiecBuffer = (byte *)malloc(sizeof(byte) * _cfiecBufferSize); + + for (int32 i = 0; i < fileSize; ++i) + _cfiecBuffer[i] = f.readByte(); + + for (int i = fileSize; i < _cfiecBufferSize; i++) + _cfiecBuffer[i] = 0; + + f.close(); + + _reloadCFIEC = false; +} + + +void MortevielleEngine::loadCFIPH() { + Common::File f; + + if (!f.open("cfiph.mor")) { + if (!f.open("alcfiph.mor")) + error("Missing file - *cfiph.mor"); + } + + _speechManager._cfiphBuffer = (int16 *)malloc(sizeof(int16) * (f.size() / 2)); + + for (int i = 0; i < (f.size() / 2); ++i) + _speechManager._cfiphBuffer[i] = f.readSint16LE(); + + f.close(); +} + +/** + * Engine function - Play Music + * @remarks Originally called 'music' + */ +void MortevielleEngine::music() { + if (_soundOff) + return; + + _reloadCFIEC = true; + + Common::File fic; + if (!fic.open("mort.img")) + error("Missing file - mort.img"); + + fic.read(&_mem[0x3800 * 16 + 0], 500); + fic.read(&_mem[0x47a0 * 16 + 0], 123); + fic.close(); + + _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[0x5000 * 16], 623); + _addFix = (float)((kTempoMusic - 8)) / 256; + _speechManager.cctable(_speechManager._tbi); + + bool fin = false; + int k = 0; + do { + fin = keyPressed(); + _soundManager.musyc(_speechManager._tbi, 9958, kTempoMusic); + ++k; + fin = fin | keyPressed() | (k >= 5); + } while (!fin); + while (keyPressed()) + getChar(); +} + +/** + * Engine function - Show title screen + * @remarks Originally called 'suite' + */ +void MortevielleEngine::showTitleScreen() { + hirs(); + handleDescriptionText(7, 2035); + _caff = 51; + _text.taffich(); + testKeyboard(); + if (_newGraphicalDevice != _currGraphicalDevice) + _currGraphicalDevice = _newGraphicalDevice; + hirs(); + draw(kAdrDes, 0, 0); + + Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; + _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); + _screenSurface.drawString(cpr, 0); +} + +/** + * Draw picture + * @remarks Originally called 'dessine' + */ +void MortevielleEngine::draw(int ad, int x, int y) { + _mouse.hideMouse(); + setPal(_numpal); + pictout(ad, 0, x, y); + _mouse.showMouse(); +} + +/** + * Draw right frame + * @remarks Originally called 'dessine_rouleau' + */ +void MortevielleEngine::drawRightFrame() { + setPal(89); + if (_currGraphicalDevice == MODE_HERCULES) { + _mem[0x7000 * 16 + 14] = 15; + } + _mouse.hideMouse(); + pictout(0x73a2, 0, 0, 0); + _mouse.showMouse(); +} + +/** + * Read the current system time + */ +int MortevielleEngine::readclock() { + TimeDate dateTime; + g_system->getTimeAndDate(dateTime); + + int m = dateTime.tm_min * 60; + int h = dateTime.tm_hour * 3600; + return h + m + dateTime.tm_sec; +} + +/** + * Engine function - Prepare room and hint string + * @remarks Originally called 'tinke' + */ +void MortevielleEngine::prepareRoom() { + int day, hour, minute; + + _anyone = false; + updateHour(day, hour, minute); + if (day != _day) { + _day = day; + int i = 0; + do { + ++i; + if (_nbrepm[i] != 0) + --_nbrepm[i]; + _nbrep[i] = 0; + } while (i != 8); + } + if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { + _hour = hour; + _minute = 0; + drawClock(); + int hintCount = 0; + for (int i = 1; i <= 10; ++i) { + if (_coreVar._pctHintFound[i] == '*') + ++hintCount; + } + + Common::String pctStr; + if (hintCount == 10) + pctStr = "10"; + else + pctStr = chr(hintCount + 48); + + _hintPctMessage = "[1]["; + _hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED); + _hintPctMessage += pctStr; + _hintPctMessage += '0'; + _hintPctMessage += getEngineString(S_NUMBER_OF_HINTS); + _hintPctMessage += "]["; + _hintPctMessage += getEngineString(S_OK); + _hintPctMessage += ']'; + } + if (minute > _minute) { + _minute = 30; + drawClock(); + } + if (_mouse._pos.y < 12) + return; + + if (!_blo) { + if ((hour == 12) || ((hour > 18) && (hour < 21)) || ((hour >= 0) && (hour < 7))) + _inGameHourDuration = kTime2; + else + _inGameHourDuration = kTime1; + if ((_coreVar._faithScore > 33) && (_coreVar._faithScore < 66)) + _inGameHourDuration -= (_inGameHourDuration / 3); + + if (_coreVar._faithScore > 65) + _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); + + int newHour = readclock(); + if ((newHour - _currentDayHour) > _inGameHourDuration) { + bool activeMenu = _menu._menuActive; + _menu.eraseMenu(); + _currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration); + _currentDayHour = newHour; + switch (_place) { + case GREEN_ROOM: + case DARKBLUE_ROOM: + setRandomPresenceGreenRoom(_coreVar._faithScore); + break; + case PURPLE_ROOM: + setRandomPresencePurpleRoom(_coreVar._faithScore); + break; + case BLUE_ROOM: + setRandomPresenceBlueRoom(_coreVar._faithScore); + break; + case RED_ROOM: + case GREEN_ROOM2: + setRandomPresenceRedRoom(_coreVar._faithScore); + break; + case ROOM9: + setRandomPresenceRoom9(_coreVar._faithScore); + break; + case DINING_ROOM: + setRandomPresenceDiningRoom(_coreVar._faithScore); + break; + case BUREAU: + setRandomPresenceBureau(_coreVar._faithScore); + break; + case KITCHEN: + setRandomPresenceKitchen(_coreVar._faithScore); + break; + case ATTIC: + case CELLAR: + setRandomPresenceAttic(_coreVar._faithScore); + break; + case LANDING: + case ROOM26: + setRandomPresenceLanding(_coreVar._faithScore); + break; + case CHAPEL: + setRandomPresenceChapel(_coreVar._faithScore); + break; + } + if ((_savedBitIndex != 0) && (_currBitIndex != 10)) + _savedBitIndex = _currBitIndex; + + if ((_savedBitIndex == 0) && (_currBitIndex > 0)) { + if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR)) { + initCaveOrCellar(); + } else if (_currBitIndex == 10) { + _currBitIndex = 0; + if (!_uptodatePresence) { + _uptodatePresence = true; + _startHour = readclock(); + if (getRandomNumber(1, 5) < 5) { + clearVerbBar(); + prepareScreenType2(); + displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(1, rand, 1); + clearVerbBar(); + } + } + } + } + + if (activeMenu) + _menu.drawMenu(); + } + } + _endHour = readclock(); + if ((_uptodatePresence) && ((_endHour - _startHour) > 17)) { + getPresenceBitIndex(_place); + _uptodatePresence = false; + _startHour = 0; + if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) + _anyone = true; + } +} + +/** + * Engine function - Draw Clock + * @remarks Originally called 'pendule' + */ +void MortevielleEngine::drawClock() { + const int cv[2][12] = { + { 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 int x = 580; + const int y = 123; + const int rg = 9; + int hourColor; + + _mouse.hideMouse(); + + _screenSurface.drawRectangle(570, 118, 20, 10); + _screenSurface.drawRectangle(578, 114, 6, 18); + if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) + hourColor = 0; + else + hourColor = 1; + + if (_minute == 0) + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), hourColor); + else + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), hourColor); + + int hour12 = _hour; + if (hour12 > 12) + hour12 -= 12; + if (hour12 == 0) + hour12 = 12; + + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], hourColor); + _mouse.showMouse(); + _screenSurface.putxy(568, 154); + + if (_hour > 11) + _screenSurface.drawString("PM ", 1); + else + _screenSurface.drawString("AM ", 1); + + _screenSurface.putxy(550, 160); + if ((_day >= 0) && (_day <= 8)) { + Common::String tmp = getEngineString(S_DAY); + tmp.insertChar((char)(_day + 49), 0); + _screenSurface.drawString(tmp, 1); + } +} + +void MortevielleEngine::palette(int v1) { + warning("TODO: palette"); +} + +/** + * Returns a substring of the given string + * @param s Source string + * @param idx Starting index (1 based) + * @param size Number of characters to return + */ + +Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) { + // Copy the substring into a temporary buffer + char *tmp = new char[size + 1]; + strncpy(tmp, s.c_str() + idx - 1, size); + tmp[size] = '\0'; + + Common::String result(tmp); + delete[] tmp; + return result; +} + +void MortevielleEngine::hirs() { + // Note: The original used this to set the graphics mode and clear the screen, both at + // the start of the game, and whenever the screen need to be cleared. As such, this + // method is deprecated in favour of clearing the screen + debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); + + if (_currGraphicalDevice == MODE_TANDY) { + _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); + _resolutionScaler = 1; + } else if (_currGraphicalDevice == MODE_CGA) { + palette(1); + _resolutionScaler = 1; + } else + _resolutionScaler = 2; + + _screenSurface.clearScreen(); +} + +/** + * Init room : Cave or Cellar + * @remarks Originally called 'cavegre' + */ +void MortevielleEngine::initCaveOrCellar() { + _coreVar._faithScore += 2; + if (_coreVar._faithScore > 69) + _coreVar._faithScore += (_coreVar._faithScore / 10); + clearVerbBar(); + prepareScreenType2(); + displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(2, rand, 1); + + // The original was doing here a useless loop. + // It has been removed + + clearVerbBar(); + displayAloneText(); +} + +/** + * Display control menu string + * @remarks Originally called 'tctrm' + */ +void MortevielleEngine::displayControlMenu() { + handleDescriptionText(2, (3000 + _controlMenu)); + _controlMenu = 0; +} + +void MortevielleEngine::pictout(int seg, int dep, int x, int y) { + GfxSurface surface; + surface.decode(&_mem[seg * 16 + dep]); + + if (_currGraphicalDevice == MODE_HERCULES) { + _mem[0x7000 * 16 + 2] = 0; + _mem[0x7000 * 16 + 32] = 15; + } + + if ((_caff != 51) && (READ_LE_UINT16(&_mem[0x7000 * 16 + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&_mem[0x7000 * 16 + 0x4138], 0x100); + + _screenSurface.drawPicture(surface, x, y); +} + +void MortevielleEngine::adzon() { + Common::File f; + + if (!f.open("don.mor")) + error("Missing file - don.mor"); + + f.read(_tabdon, 7 * 256); + f.close(); + + if (!f.open("bmor.mor")) + error("Missing file - bmor.mor"); + + f.read(&_tabdon[kFleche], 1 * 1916); + f.close(); + + if (!f.open("dec.mor")) + error("Missing file - dec.mor"); + + f.read(&_mem[0x73a2 * 16 + 0], 1 * 1664); + f.close(); +} + +/** + * Returns the offset within the compressed image data resource of the desired image + */ +int MortevielleEngine::animof(int ouf, int num) { + int nani = _mem[kAdrAni * 16 + 1]; + int aux = num; + if (ouf != 1) + aux += nani; + + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[kAdrAni * 16 + (aux << 1)]); + + return animof_result; +} + +/** + * Display text in description bar + * @remarks Originally called 'text1' + */ +void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { + int co; + + if (_resolutionScaler == 1) + co = 10; + else + co = 6; + Common::String tmpStr = getString(mesgId); + if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) + y = 176; + _text.displayStr(tmpStr, x, y, nb, 20, _textColor); +} + +/** + * Display description text + * @remarks Originally called 'repon' + */ +void MortevielleEngine::handleDescriptionText(int f, int mesgId) { + if ((mesgId > 499) && (mesgId < 563)) { + Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); + + if ((int) tmpStr.size() > ((58 + (_resolutionScaler - 1) * 37) << 1)) + _largestClearScreen = true; + else + _largestClearScreen = false; + + clearDescriptionBar(); + _text.displayStr(tmpStr, 8, 176, 85, 3, 5); + } else { + mapMessageId(mesgId); + switch (f) { + case 2: + case 8: + clearDescriptionBar(); + prepareScreenType2(); + displayTextInDescriptionBar(8, 182, 103, mesgId); + if ((mesgId == 68) || (mesgId == 69)) + _coreVar._availableQuestion[40] = '*'; + if ((mesgId == 104) && (_caff == CELLAR)) { + _coreVar._availableQuestion[36] = '*'; + if (_coreVar._availableQuestion[39] == '*') { + _coreVar._pctHintFound[3] = '*'; + _coreVar._availableQuestion[38] = '*'; + } + } + break; + case 1: + case 6: + case 9: { + int i; + if ((f == 1) || (f == 6)) + i = 4; + else + i = 5; + + Common::String tmpStr = getString(mesgId); + _text.displayStr(tmpStr, 80, 40, 60, 25, i); + + if (mesgId == 180) + _coreVar._pctHintFound[6] = '*'; + else if (mesgId == 179) + _coreVar._pctHintFound[10] = '*'; + } + break; + default: + break; + } + } +} + +/** + * Recompute message Id + * @remarks Originally called 'modif' + */ +void MortevielleEngine::mapMessageId(int &mesgId) { + if (mesgId == 26) + mesgId = 25; + else if ((mesgId > 29) && (mesgId < 36)) + mesgId -= 4; + else if ((mesgId > 69) && (mesgId < 78)) + mesgId -= 37; + else if ((mesgId > 99) && (mesgId < 194)) + mesgId -= 59; + else if ((mesgId > 996) && (mesgId < 1000)) + mesgId -= 862; + else if ((mesgId > 1500) && (mesgId < 1507)) + mesgId -= 1363; + else if ((mesgId > 1507) && (mesgId < 1513)) + mesgId -= 1364; + else if ((mesgId > 1999) && (mesgId < 2002)) + mesgId -= 1851; + else if (mesgId == 2010) + mesgId = 151; + else if ((mesgId > 2011) && (mesgId < 2025)) + mesgId -= 1860; + else if (mesgId == 2026) + mesgId = 165; + else if ((mesgId > 2029) && (mesgId < 2037)) + mesgId -= 1864; + else if ((mesgId > 3000) && (mesgId < 3005)) + mesgId -= 2828; + else if (mesgId == 4100) + mesgId = 177; + else if (mesgId == 4150) + mesgId = 178; + else if ((mesgId > 4151) && (mesgId < 4156)) + mesgId -= 3973; + else if (mesgId == 4157) + mesgId = 183; + else if ((mesgId == 4160) || (mesgId == 4161)) + mesgId -= 3976; +} + +/** + * Initialize open objects array + * @remarks Originally called 'initouv' + */ +void MortevielleEngine::resetOpenObjects() { + for (int cx = 1; cx <= 7; ++cx) + _openObjects[cx] = 0; + _openObjCount = 0; +} + +void MortevielleEngine::ecr2(Common::String text) { + // Some dead code was present in the original: removed + _screenSurface.putxy(8, 177); + int tlig = 59 + (_resolutionScaler - 1) * 36; + + if ((int)text.size() < tlig) + _screenSurface.drawString(text, 5); + else if ((int)text.size() < (tlig << 1)) { + _screenSurface.putxy(8, 176); + _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface.putxy(8, 182); + _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); + } else { + _largestClearScreen = true; + clearDescriptionBar(); + _screenSurface.putxy(8, 176); + _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface.putxy(8, 182); + _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); + _screenSurface.putxy(8, 190); + _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); + } +} + +void MortevielleEngine::displayTextInVerbBar(Common::String text) { + clearVerbBar(); + _screenSurface.putxy(8, 192); + _screenSurface.drawString(text, 5); +} + +/** + * Display item in hand + * @remarks Originally called 'modobj' + */ +void MortevielleEngine::displayItemInHand(int objId) { + Common::String strp = Common::String(' '); + + if (objId != 500) + strp = getString(objId - 501 + kInventoryStringIndex); + + _menu.setText(_menu._inventoryMenu[8], strp); + _menu.disableMenuItem(_menu._inventoryMenu[8]); +} + +/** + * Display empty hand + * @remarks Originally called 'maivid' + */ +void MortevielleEngine::displayEmptyHand() { + _coreVar._selectedObjectId = 0; + displayItemInHand(500); +} + +/** + * Set a random presence: Leo or Max + * @remarks Originally called 'chlm' + */ +int MortevielleEngine::checkLeoMaxRandomPresence() { + int retval = getRandomNumber(1, 2); + if (retval == 2) + retval = 128; + + return retval; +} + +/** + * Reset room variables + * @remarks Originally called 'debloc' + */ +void MortevielleEngine::resetRoomVariables(int roomId) { + _num = 0; + _x = 0; + _y = 0; + if ((roomId != ROOM26) && (roomId != LANDING)) + resetPresenceInRooms(roomId); + _savedBitIndex = _currBitIndex; +} + +/** + * Compute presence stats + * @remarks Originally called 'ecfren' + */ +int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { + if (roomId == OWN_ROOM) + displayAloneText(); + int retVal = -500; + rand = 0; + if ( ((roomId == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) + || ((roomId == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) + retVal = getPresenceStatsGreenRoom(); + if ((roomId == PURPLE_ROOM) && (!_purpleRoomPresenceLeo) && (!_room9PresenceLeo)) + retVal = getPresenceStatsPurpleRoom(); + if ( ((roomId == TOILETS) && (!_toiletsPresenceBobMax)) + || ((roomId == BATHROOM) && (!_bathRoomPresenceBobMax)) ) + retVal = getPresenceStatsToilets(); + if ((roomId == BLUE_ROOM) && (!_roomPresenceMax)) + retVal = getPresenceStatsBlueRoom(); + if ( ((roomId == RED_ROOM) && (!_roomPresenceBob)) + || ((roomId == GREEN_ROOM2) && (!_roomPresencePat))) + retVal = getPresenceStatsRedRoom(); + if ((roomId == ROOM9) && (!_room9PresenceLeo) && (!_purpleRoomPresenceLeo)) + retVal = 10; + if ( ((roomId == PURPLE_ROOM) && (_room9PresenceLeo)) + || ((roomId == ROOM9) && (_purpleRoomPresenceLeo))) + retVal = -400; + if (retVal != -500) { + retVal += cf; + rand = getRandomNumber(1, 100); + } + + return retVal; +} + +/** + * Set presence flags + * @remarks Originally called 'becfren' + */ +void MortevielleEngine::setPresenceFlags(int roomId) { + if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) { + int rand = getRandomNumber(1, 2); + if (roomId == GREEN_ROOM) { + if (rand == 1) + _roomPresenceLuc = true; + else + _roomPresenceIda = true; + } else { // roomId == DARKBLUE_ROOM + if (rand == 1) + _roomPresenceGuy = true; + else + _roomPresenceEva = true; + } + } else if (roomId == PURPLE_ROOM) + _purpleRoomPresenceLeo = true; + else if (roomId == TOILETS) + _toiletsPresenceBobMax = true; + else if (roomId == BLUE_ROOM) + _roomPresenceMax = true; + else if (roomId == RED_ROOM) + _roomPresenceBob = true; + else if (roomId == BATHROOM) + _bathRoomPresenceBobMax = true; + else if (roomId == GREEN_ROOM2) + _roomPresencePat = true; + else if (roomId == ROOM9) + _room9PresenceLeo = true; +} + +void MortevielleEngine::init_nbrepm() { + static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; + + for (int idx = 0; idx < 9; ++idx) + _nbrepm[idx] = ipm[idx]; +} + +void MortevielleEngine::phaz(int &rand, int &p, int cf) { + p += cf; + rand = getRandomNumber(1, 100); +} + +/** + * Get Presence + * @remarks Originally called 't11' + */ +int MortevielleEngine::getPresence(int roomId) { + int retVal = 0; + int rand; + + int p = getPresenceStats(rand, _coreVar._faithScore, roomId); + _place = roomId; + if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { + if (p != -500) { + if (rand > p) { + displayAloneText(); + retVal = 0; + } else { + setPresenceFlags(_place); + retVal = getPresenceBitIndex(_place); + } + } else + retVal = getPresenceBitIndex(_place); + } + + if (roomId > ROOM9) { + if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) + displayAloneText(); + else { + int h = 0; + if (roomId == DINING_ROOM) + p = getPresenceStatsDiningRoom(h); + else if (roomId == BUREAU) + p = getPresenceStatsBureau(h); + else if (roomId == KITCHEN) + p = getPresenceStatsKitchen(); + else if ((roomId == ATTIC) || (roomId == CELLAR)) + p = getPresenceStatsAttic(); + else if ((roomId == LANDING) || (roomId == ROOM26)) + p = getPresenceStatsLanding(); + else if (roomId == CHAPEL) + p = getPresenceStatsChapel(h); + p += _coreVar._faithScore; + rand = getRandomNumber(1, 100); + if (rand > p) { + displayAloneText(); + retVal = 0; + } else { + if (roomId == DINING_ROOM) + p = setPresenceDiningRoom(h); + else if (roomId == BUREAU) + p = setPresenceBureau(h); + else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) + p = setPresenceKitchen(); + else if ((roomId == LANDING) || (roomId == ROOM26)) + p = setPresenceLanding(); + else if (roomId == CHAPEL) + p = setPresenceChapel(h); + retVal = p; + } + } + } + + return retVal; +} + +void MortevielleEngine::writetp(Common::String s, int t) { + if (_resolutionScaler == 2) + _screenSurface.drawString(s, t); + else + _screenSurface.drawString(copy(s, 1, 25), t); +} + +void MortevielleEngine::aniof(int ouf, int num) { + if ((_caff == BATHROOM) && ((num == 4) || (num == 5))) + return; + + if ((_caff == DINING_ROOM) && (num == 7)) + num = 6; + else if (_caff == KITCHEN) { + if (num == 3) + num = 4; + else if (num == 4) + num = 3; + } + + int ad = kAdrAni; + int offset = animof(ouf, num); + + GfxSurface surface; + surface.decode(&_mem[ad * 16 + offset]); + _screenSurface.drawPicture(surface, 0, 12); + + prepareScreenType1(); +} + +/** + * Draw Picture + * @remarks Originally called 'dessin' + */ +void MortevielleEngine::drawPicture() { + clearUpperLeftPart(); + if (_caff > 99) { + draw(kAdrDes, 60, 33); + _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box + } else if (_caff > 69) { + draw(kAdrDes, 112, 48); // Heads + _screenSurface.drawBox(222, 47, 155, 91, 15); + } else { + draw(kAdrDes, 0, 12); + prepareScreenType1(); + if ((_caff < 30) || (_caff > 32)) { + for (int cx = 1; cx <= 6; ++cx) { + if (_openObjects[cx] != 0) + aniof(1, _openObjects[cx]); + } + + if (_caff == ATTIC) { + if (_coreVar._atticBallHoleObjectId == 141) + aniof(1, 7); + + if (_coreVar._atticRodHoleObjectId == 159) + aniof(1, 6); + } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) + aniof(1, 2); + else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) + aniof(1, 1); + else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) + aniof(1, 1); + } + + if (_caff < ROOM26) + startMusicOrSpeech(1); + } +} + +void MortevielleEngine::drawPictureWithText() { + _text.taffich(); + drawPicture(); + _destinationOk = false; +} + +/** + * Engine function - Place + * @remarks Originally called 'tkey1' + */ +void MortevielleEngine::testKey(bool d) { + bool quest = false; + int x, y; + bool click; + + _mouse.hideMouse(); + fenat('K'); + + // Wait for release from any key or mouse button + while (keyPressed()) + _key = testou(); + + do { + _mouse.getMousePosition(x, y, click); + keyPressed(); + } while (click); + + // Event loop + do { + if (d) + prepareRoom(); + quest = keyPressed(); + _mouse.getMousePosition(x, y, click); + if (shouldQuit()) + return; + } while (!(quest || (click) || (d && _anyone))); + if (quest) + testou(); + setMouseClick(false); + _mouse.showMouse(); +} + +void MortevielleEngine::tlu(int af, int ob) { + _caff = 32; + drawPictureWithText(); + handleDescriptionText(6, ob + 4000); + handleDescriptionText(2, 999); + testKey(true); + _caff = af; + _msg[3] = OPCODE_NONE; + _crep = 998; +} + +void MortevielleEngine::affrep() { + _caff = _coreVar._currPlace; + _crep = _coreVar._currPlace; +} + +/** + * Exit room + * @remarks Originally called 'tsort' + */ +void MortevielleEngine::exitRoom() { + if ((_openObjCount > 0) && (_coreVar._currPlace != OWN_ROOM)) { + if (_coreVar._faithScore < 50) + _coreVar._faithScore += 2; + else + _coreVar._faithScore += (_coreVar._faithScore / 10); + } + + resetOpenObjects(); + + _roomDoorId = OWN_ROOM; + _mchai = 0; + resetRoomVariables(_coreVar._currPlace); +} + +/** + * get 'read' description + * @remarks Originally called 'st4' + */ +void MortevielleEngine::getReadDescription(int objId) { + _crep = 997; + + switch (objId) { + case 114 : + _crep = 109; + break; + case 110 : + _crep = 107; + break; + case 158 : + _crep = 113; + break; + case 152: + case 153: + case 154: + case 155: + case 156: + case 150: + case 100: + case 157: + case 160: + case 161 : + tlu(_caff, objId); + break; + default: + break; + } +} + +/** + * get 'search' description + * @remarks Originally called 'st7' + */ +void MortevielleEngine::getSearchDescription(int objId) { + switch (objId) { + case 116: + case 144: + _crep = 104; + break; + case 126: + case 111: + _crep = 108; + break; + case 132: + _crep = 111; + break; + case 142: + _crep = 112; + break; + default: + _crep = 183; + getReadDescription(objId); + } +} + +void MortevielleEngine::mennor() { + _menu.menuUp(_msg[3]); +} + +void MortevielleEngine::premtet() { + draw(kAdrDes, 10, 80); + _screenSurface.drawBox(18, 79, 155, 91, 15); +} + +void MortevielleEngine::ajchai() { + int cy = kAcha + ((_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + } while ((cx <= 9) && (_tabdon[cy + cx] != 0)); + + if (_tabdon[cy + cx] == 0) + _tabdon[cy + cx] = _coreVar._selectedObjectId; + else + _crep = 192; +} + +/** + * Check if inventory is full and, if not, add object in it. + * @remarks Originally called 'ajjer' + */ +void MortevielleEngine::addObjectToInventory(int objectId) { + int i = 0; + do { + ++i; + } while ((i <= 5) && (_coreVar._inventory[i] != 0)); + + if (_coreVar._inventory[i] == 0) { + _coreVar._inventory[i] = objectId; + _menu.setInventoryText(); + } else + // Inventory is full + _crep = 139; +} + +/** + * Interact with NPC + * @remarks Originally called 'quelquun' + */ +void MortevielleEngine::interactNPC() { + if (_menu._menuDisplayed) + _menu.eraseMenu(); + + endSearch(); + _crep = 997; +L1: + if (!_hiddenHero) { + if (_crep == 997) + _crep = 138; + handleDescriptionText(2, _crep); + if (_crep == 138) + _speechManager.startSpeech(5, 2, 1); + else + _speechManager.startSpeech(4, 4, 1); + + if (_openObjCount == 0) + _coreVar._faithScore += 2; + else if (_coreVar._faithScore < 50) + _coreVar._faithScore += 4; + else + _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); + exitRoom(); + _menu.setDestinationText(LANDING); + int cx = convertBitIndexToCharacterIndex(_currBitIndex); + _caff = 69 + cx; + _crep = _caff; + _msg[3] = MENU_DISCUSS; + _msg[4] = _menu._discussMenu[cx]; + _syn = true; + _col = true; + } else { + if (getRandomNumber(1, 3) == 2) { + _hiddenHero = false; + _crep = 137; + goto L1; + } else { + handleDescriptionText(2, 136); + int rand = (getRandomNumber(0, 4)) - 2; + _speechManager.startSpeech(3, rand, 1); + clearDescriptionBar(); + displayAloneText(); + resetRoomVariables(MANOR_FRONT); + affrep(); + } + } + if (_menu._menuDisplayed) + _menu.drawMenu(); +} + +void MortevielleEngine::tsuiv() { + int tbcl; + int cy = kAcha + ((_mchai - 1) * 10) - 1; + int cx = 0; + do { + ++cx; + ++_searchCount; + int cl = cy + _searchCount; + tbcl = _tabdon[cl]; + } while ((tbcl == 0) && (_searchCount <= 9)); + + if ((tbcl != 0) && (_searchCount < 11)) { + _caff = tbcl; + _crep = _caff + 400; + if (_currBitIndex != 0) + _coreVar._faithScore += 2; + } else { + affrep(); + endSearch(); + if (cx > 9) + _crep = 131; + } +} + +void MortevielleEngine::tfleche() { + bool qust; + char touch; + + if (_num == 9999) + return; + + fenat(chr(152)); + bool inRect = false; + do { + touch = '\0'; + + do { + _mouse.moveMouse(qust, touch); + if (shouldQuit()) + return; + + if (getMouseClick()) + inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + prepareRoom(); + } while (!(qust || inRect || _anyone)); + + if (qust && (touch == '\103')) + _dialogManager.show(_hintPctMessage, 1); + } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); + + if (touch == '\73') + _keyPressedEsc = true; + + if (inRect) { + _x = _mouse._pos.x; + _y = _mouse._pos.y; + } +} + +/** + * Set coordinates + * @remarks Originally called 'tcoord' + */ +void MortevielleEngine::setCoordinates(int sx) { + int sy, ix, iy; + int ib; + + + _num = 0; + _crep = 999; + int a = 0; + int atdon = kAmzon + 3; + int cy = 0; + while (cy < _caff) { + a += _tabdon[atdon]; + atdon += 4; + ++cy; + } + + if (_tabdon[atdon] == 0) { + _crep = 997; + return; + } + + a += kFleche; + int cb = 0; + for (cy = 0; cy <= (sx - 2); ++cy) { + ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; + cb += (ib * 4) + 2; + } + ib = (_tabdon[a + cb] << 8) + _tabdon[(a + cb + 1)]; + if (ib == 0) { + _crep = 997; + return; + } + + cy = 1; + do { + cb += 2; + sx = _tabdon[a + cb] * _resolutionScaler; + sy = _tabdon[(a + cb + 1)]; + cb += 2; + ix = _tabdon[a + cb] * _resolutionScaler; + iy = _tabdon[(a + cb + 1)]; + ++cy; + } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); + + if ((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) { + _num = cy - 1; + return; + } + + _crep = 997; +} + +void MortevielleEngine::treg(int objId) { + int mdes = _caff; + _caff = objId; + + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_msg[4] == OPCODE_SLOOK)) { + drawPictureWithText(); + if ((_caff > 29) && (_caff < 33)) + handleDescriptionText(2, _caff); + else + handleDescriptionText(2, _caff + 400); + testKey(true); + _caff = mdes; + _msg[3] = 0; + _crep = 998; + } else { + _obpart = true; + _crep = _caff + 400; + _menu.setSearchMenu(); + } +} + +/** + * Engine function - Put in hand + * @remarks Originally called 'avpoing' + */ +void MortevielleEngine::putInHand(int &objId) { + _crep = 999; + if (_coreVar._selectedObjectId != 0) + addObjectToInventory(_coreVar._selectedObjectId); + + // If inventory wasn't full + if (_crep != 139) { + displayItemInHand(objId + 400); + _coreVar._selectedObjectId = objId; + objId = 0; + } +} + +void MortevielleEngine::rechai(int &ch) { + int tmpPlace = _coreVar._currPlace; + + if (_coreVar._currPlace == CRYPT) + tmpPlace = CELLAR; + ch = _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; +} + +/** + * Check before leaving the secret passage + * @remarks Originally called 't23coul' + */ +int MortevielleEngine::checkLeaveSecretPassage() { + if (!checkInventory(143)) { + _crep = 1512; + loseGame(); + } + + return CELLAR; +} + +void MortevielleEngine::fenat(char ans) { + int coul; + + _mouse.hideMouse(); + if (_currGraphicalDevice == MODE_CGA) + coul = 2; + else if (_currGraphicalDevice == MODE_HERCULES) + coul = 1; + else + coul = 12; + + _screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + _screenSurface.drawBox(300, 191, 16, 8, 15); + _mouse.showMouse(); +} + +/** + * Test Keyboard + * @remarks Originally called 'teskbd' + */ +void MortevielleEngine::testKeyboard() { + if (keyPressed()) + testou(); +} + +int MortevielleEngine::testou() { + char ch = getChar(); + + switch (ch) { + case '\23' : + _soundOff = !_soundOff; + break; + case '\26' : + if ((_x26KeyCount == 1) || (_x26KeyCount == 2)) { + decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); + ++_x26KeyCount; + + return 61; + } + break; + case '\33' : + if (keyPressed()) + ch = getChar(); + break; + default: + break; + } + + return ord(ch); +} + +void MortevielleEngine::sauvecr(int y, int dy) { +// _mouse.hideMouse(); +// _mouse.showMouse(); +} + +void MortevielleEngine::charecr(int y, int dy) { +// _mouse.hideMouse(); +// _mouse.showMouse(); +} + +} // End of namespace Mortevielle -- cgit v1.2.3 From ccdc113fe19eebab0932a63eb308ba0d29e38233 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Jun 2013 21:16:49 -0400 Subject: TSAGE: Added some descriptions to scene switch list --- engines/tsage/ringworld2/ringworld2_logic.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 97042cb621..67af65c08a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -166,7 +166,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Ice Maze: Large empty room return new Scene2400(); case 2425: - // Ice Maze: + // Ice Maze: The Hall of Records return new Scene2425(); case 2430: // Ice Maze: Bedroom @@ -213,7 +213,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 2900: error("Missing scene %d from group 2", sceneNumber); /* Scene group #3 */ - // + // ARM Base Hanager case 3100: return new Scene3100(); case 3125: @@ -258,16 +258,22 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene - Ship landing return new Scene3350(); case 3375: + // Outer walkway return new Scene3375(); case 3385: + // Corridor return new Scene3385(); case 3395: + // Walkway return new Scene3395(); case 3400: + // Confrontation return new Scene3400(); case 3500: + // Maze action scene return new Scene3500(); case 3600: + // Cutscene - walking at gunpoint return new Scene3600(); case 3700: // Cutscene - Teleport outside -- cgit v1.2.3 From 67f08a36866f7455fe39de2514535695bdf2b541 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Jun 2013 08:04:19 +0200 Subject: MORTEVIELLE: Remove 2 useless functions --- engines/mortevielle/dialogs.cpp | 2 -- engines/mortevielle/menu.cpp | 3 --- engines/mortevielle/mortevielle.h | 2 -- engines/mortevielle/utils.cpp | 10 ---------- 4 files changed, 17 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 1fadf1eaab..c53b20fa5a 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -55,7 +55,6 @@ int DialogManager::show(const Common::String &msg, int n) { Common::String caseStr; decodeAlertDetails(msg, caseNumb, lignNumb, colNumb, alertStr, caseStr); - _vm->sauvecr(50, (NUM_LINES + 1) << 4); int i = 0; Common::Point curPos; @@ -175,7 +174,6 @@ int DialogManager::show(const Common::String &msg, int n) { tmp4 += " "; _vm->_screenSurface.drawString(tmp4, 1); } - _vm->charecr(50, (NUM_LINES + 1) * 16); _vm->_mouse.showMouse(); /* Restore the background area */ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 8c9fc038fc..408ea0746d 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -319,7 +319,6 @@ void Menu::menuDown(int ii) { xco = _menuConstants[ii - 1][0]; lignNumb = _menuConstants[ii - 1][3]; _vm->_mouse.hideMouse(); - _vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1); xco = xco << 3; if (_vm->_resolutionScaler == 1) cx = 10; @@ -392,8 +391,6 @@ void Menu::menuDown(int ii) { */ void Menu::menuUp(int msgId) { if (_multiTitle) { - _vm->charecr(10, (_menuConstants[msgId - 1][1] + 1) << 1); - /* Restore the background area */ assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 9facc5ef86..a07af4269a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -528,8 +528,6 @@ public: void handleDescriptionText(int f, int mesgId); int animof(int ouf, int num); void pictout(int seg, int dep, int x, int y); - void sauvecr(int y, int dy); - void charecr(int y, int dy); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index f2d0c952dc..bbafbcad66 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3441,14 +3441,4 @@ int MortevielleEngine::testou() { return ord(ch); } -void MortevielleEngine::sauvecr(int y, int dy) { -// _mouse.hideMouse(); -// _mouse.showMouse(); -} - -void MortevielleEngine::charecr(int y, int dy) { -// _mouse.hideMouse(); -// _mouse.showMouse(); -} - } // End of namespace Mortevielle -- cgit v1.2.3 From 22fada577628806c038371390c21192330f7fdae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Jun 2013 08:21:04 +0200 Subject: MORTEVIELLE: Rename displayStatusInDescriptionBar() --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index a07af4269a..d4d57d84b7 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -448,7 +448,7 @@ private: void tsuiv(); void treg(int objId); void rechai(int &ch); - void fenat(char ans); + void displayStatusInDescriptionBar(char stat); public: Common::Point _prevPos; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index bbafbcad66..a0b7cf3d5e 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3001,7 +3001,7 @@ void MortevielleEngine::testKey(bool d) { bool click; _mouse.hideMouse(); - fenat('K'); + displayStatusInDescriptionBar('K'); // Wait for release from any key or mouse button while (keyPressed()) @@ -3247,7 +3247,7 @@ void MortevielleEngine::tfleche() { if (_num == 9999) return; - fenat(chr(152)); + displayStatusInDescriptionBar(chr(152)); bool inRect = false; do { touch = '\0'; @@ -3390,18 +3390,22 @@ int MortevielleEngine::checkLeaveSecretPassage() { return CELLAR; } -void MortevielleEngine::fenat(char ans) { - int coul; +/** + * Display status character in description bar + * @remarks Originally called 'fenat' + */ +void MortevielleEngine::displayStatusInDescriptionBar(char stat) { + int color; _mouse.hideMouse(); if (_currGraphicalDevice == MODE_CGA) - coul = 2; + color = 2; else if (_currGraphicalDevice == MODE_HERCULES) - coul = 1; + color = 1; else - coul = 12; + color = 12; - _screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul); + _screenSurface.writeCharacter(Common::Point(306, 193), ord(stat), color); _screenSurface.drawBox(300, 191, 16, 8, 15); _mouse.showMouse(); } -- cgit v1.2.3 From 63624f8bfa3f79302317589c9c3adbc852563a6c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 11:19:46 +0300 Subject: NEVERHOOD: Fix scene entrance when restoring in the Aqua (music) house This looks to be a logic error in the constructor of module 2400, since all the other modules do not create scenes with the global entrance number when they are instantiated without an entrance (i.e. when loading). With that logic error, all the code that handled Kleymen's entrance to a scene after restoring was incorrectly skipped --- engines/neverhood/modules/module2400.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 47f842b939..8d3b763f72 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -30,7 +30,7 @@ Module2400::Module2400(NeverhoodEngine *vm, Module *parentModule, int which) _vm->_soundMan->addMusic(0x202D1010, 0xB110382D); if (which < 0) - createScene(_vm->gameState().sceneNum, _vm->gameState().which); + createScene(_vm->gameState().sceneNum, -1); else createScene(0, 0); -- cgit v1.2.3 From 7564be51d76bc77e82c586559f2f79d67238bfb0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 13:23:18 +0300 Subject: NEVERHOOD: Fix graphics glitch when opening the menu --- engines/neverhood/gamemodule.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 96e8cc13a6..b3589837df 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -786,6 +786,7 @@ void GameModule::openMainMenu() { createModule(1000, 0); } _vm->_screen->saveParams(); + _vm->_screen->update(); _mainMenuRequested = false; createMenuModule(); } -- cgit v1.2.3 From 02f11ec76f1ac5e81f95d6f07e7a10fb34567a3d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 13:48:16 +0300 Subject: NEVERHOOD: Add missing music when entering the Hall of Records building The "Everybody Way Oh" theme should be played in both of the first two rooms of the Hall of Records building --- engines/neverhood/modules/module2200.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index 08ed274eb3..04e3f0bfee 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -50,6 +50,7 @@ void Module2200::createScene(int sceneNum, int which) { switch (_sceneNum) { case 0: _vm->gameState().sceneNum = 0; + _vm->_soundMan->startMusic(0x601C908C, 0, 2); _childObject = new Scene2201(_vm, this, which); break; case 1: -- cgit v1.2.3 From 5a8aa67e503c115bc38e14f4b9fac7c334736c9d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 15:33:37 +0300 Subject: NEVERHOOD: Remove superfluous description from a console command --- engines/neverhood/console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 7b5add65c7..a4dd50ce4b 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -79,7 +79,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf(" music - shows the correct index in the radio music puzzle, module 2800, scene 1\n"); DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); - DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n"); + DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10\n"); return true; } -- cgit v1.2.3 From 9f7033120b9715aee7e1ea4233a77e12a0db96a6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 15:37:48 +0300 Subject: NEVERHOOD: Use the ScummVM dialogs for saving/loading An option has been added to use the original ones, if needed --- engines/neverhood/detection.cpp | 16 ++++++++- engines/neverhood/menumodule.cpp | 77 ++++++++++++++++++++++++++++++++++------ engines/neverhood/menumodule.h | 2 ++ engines/neverhood/neverhood.cpp | 3 ++ po/POTFILES | 2 ++ 5 files changed, 89 insertions(+), 11 deletions(-) diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 5f860f8519..3de087051a 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -24,6 +24,7 @@ #include "engines/advancedDetector.h" #include "common/file.h" +#include "common/translation.h" #include "neverhood/neverhood.h" @@ -143,6 +144,13 @@ static const NeverhoodGameDescription gameDescriptions[] = { } // End of namespace Neverhood +static const ExtraGuiOption neverhoodExtraGuiOption = { + _s("Use original save/load screens"), + _s("Use the original save/load screens, instead of the ScummVM ones"), + "originalsaveload", + false +}; + class NeverhoodMetaEngine : public AdvancedMetaEngine { public: NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) { @@ -160,7 +168,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; - + virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; @@ -194,6 +202,12 @@ bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const A return gd != 0; } +const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const { + ExtraGuiOptions options; + options.push_back(neverhoodExtraGuiOption); + return options; +} + SaveStateList NeverhoodMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Neverhood::NeverhoodEngine::SaveHeader header; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index accdaca63f..8814401f5e 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -20,6 +20,11 @@ * */ +#include "common/config-manager.h" +#include "common/translation.h" + +#include "gui/saveload.h" + #include "neverhood/menumodule.h" #include "neverhood/gamemodule.h" @@ -193,24 +198,26 @@ uint32 MenuModule::handleMessage(int messageNum, const MessageParam ¶m, Enti } void MenuModule::createLoadGameMenu() { - _savegameSlot = -1; - _savegameList = new SavegameList(); - loadSavegameList(); + refreshSaveGameList(); _childObject = new LoadGameMenu(_vm, this, _savegameList); } void MenuModule::createSaveGameMenu() { - _savegameSlot = -1; - _savegameList = new SavegameList(); - loadSavegameList(); + refreshSaveGameList(); _childObject = new SaveGameMenu(_vm, this, _savegameList); } void MenuModule::createDeleteGameMenu() { + refreshSaveGameList(); + _childObject = new DeleteGameMenu(_vm, this, _savegameList); +} + +void MenuModule::refreshSaveGameList() { _savegameSlot = -1; + delete _savegameList; + _savegameList = NULL; _savegameList = new SavegameList(); loadSavegameList(); - _childObject = new DeleteGameMenu(_vm, this, _savegameList); } void MenuModule::handleLoadGameMenuAction(bool doLoad) { @@ -848,6 +855,36 @@ void SavegameListBox::pageDown() { } } +int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc) { + const EnginePlugin *plugin = NULL; + EngineMan.findGame(ConfMan.get("gameid"), &plugin); + GUI::SaveLoadChooser *dialog; + Common::String desc; + int slot; + + if (isSave) { + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); + + slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + desc = dialog->getResultString(); + + if (desc.empty()) + desc = dialog->createDefaultSaveDescription(slot); + + if (desc.size() > 29) + desc = Common::String(desc.c_str(), 29); + + saveDesc = desc; + } else { + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + } + + delete dialog; + + return slot; +} + GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList, const uint32 *buttonFileHashes, const NRect *buttonCollisionBounds, uint32 backgroundFileHash, uint32 fontFileHash, @@ -857,8 +894,29 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame uint32 textFileHash1, uint32 textFileHash2) : Scene(vm, parentModule), _currWidget(NULL), _savegameList(savegameList) { + bool isSave = (textEditCursorFileHash != 0); + _fontSurface = new FontSurface(_vm, fontFileHash, 32, 7, 32, 11, 17); - + + if (!ConfMan.getBool("originalsaveload")) { + Common::String saveDesc; + int saveCount = savegameList->size(); + int slot = scummVMSaveLoadDialog(isSave, saveDesc); + + if (slot >= 0) { + if (!isSave) { + ((MenuModule*)_parentModule)->setLoadgameInfo(slot); + } else { + ((MenuModule*)_parentModule)->setSavegameInfo(saveDesc, + slot, slot >= saveCount); + } + leaveScene(0); + } else { + leaveScene(1); + } + return; + } + setBackground(backgroundFileHash); setPalette(backgroundFileHash); insertScreenMouse(mouseFileHash, mouseRect); @@ -871,7 +929,7 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame _textEditWidget = new TextEditWidget(_vm, textEditX, textEditY, this, 29, _fontSurface, textEditBackgroundFileHash, textEditRect); - if (textEditCursorFileHash != 0) + if (isSave) _textEditWidget->setCursor(textEditCursorFileHash, 2, 13); else _textEditWidget->setReadOnly(true); @@ -886,7 +944,6 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame SetUpdateHandler(&Scene::update); SetMessageHandler(&GameStateMenu::handleMessage); - } GameStateMenu::~GameStateMenu() { diff --git a/engines/neverhood/menumodule.h b/engines/neverhood/menumodule.h index 08858ad204..6ee990de67 100644 --- a/engines/neverhood/menumodule.h +++ b/engines/neverhood/menumodule.h @@ -45,6 +45,7 @@ public: void setLoadgameInfo(uint index); void setSavegameInfo(const Common::String &description, uint index, bool newSavegame); void setDeletegameInfo(uint index); + void refreshSaveGameList(); protected: int _sceneNum; byte *_savedPaletteData; @@ -229,6 +230,7 @@ protected: Common::String _savegameDescription; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); virtual void performAction(); + int scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc); }; class SaveGameMenu : public GameStateMenu { diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index d60d8b760f..3769117f7f 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -77,6 +77,9 @@ Common::Error NeverhoodEngine::run() { _gameState.sceneNum = 0; _gameState.which = 0; + // Assign default values to the config manager, in case settings are missing + ConfMan.registerDefault("originalsaveload", "false"); + _staticData = new StaticData(); _staticData->load("neverhood.dat"); _gameVars = new GameVars(); diff --git a/po/POTFILES b/po/POTFILES index c2f67e288b..b812620c25 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -48,6 +48,8 @@ engines/groovie/script.cpp engines/kyra/detection.cpp engines/kyra/lol.cpp engines/kyra/sound_midi.cpp +engines/neverhood/detection.cpp +engines/neverhood/menumodule.cpp engines/queen/queen.cpp engines/sky/compact.cpp engines/sky/detection.cpp -- cgit v1.2.3 From 0658a88737a205b5edacb662a3161e2acd8b7d51 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Jun 2013 18:09:35 +0300 Subject: NEVERHOOD: Fix incorrect checks for the waterfall sounds Some of the "wall broken" checks were inverse, resulting in the waterfall sound being incorrectly heard when the wall was broken. Also, simplified some of the "wall broken" checks --- engines/neverhood/modules/module3000.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index 373bfb57f6..bc6b7790b4 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -49,7 +49,7 @@ Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which) _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0; - if (_isWallBroken) { + if (!_isWallBroken) { _vm->_soundMan->setSoundVolume(0x90F0D1C3, 0); _vm->_soundMan->playSoundLooping(0x90F0D1C3); } @@ -77,11 +77,12 @@ void Module3000::createScene(int sceneNum, int which) { static const byte kNavigationTypes06[] = {5}; debug(1, "Module3000::createScene(%d, %d)", sceneNum, which); _vm->gameState().sceneNum = sceneNum; + _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0; switch (_vm->gameState().sceneNum) { case 1: if (!getGlobalVar(V_BOLT_DOOR_OPEN)) { createNavigationScene(0x004B7C80, which); - } else if (getGlobalVar(V_WALL_BROKEN)) { + } else if (_isWallBroken) { createNavigationScene(0x004B7CE0, which); } else { createNavigationScene(0x004B7CB0, which); @@ -89,11 +90,11 @@ void Module3000::createScene(int sceneNum, int which) { break; case 2: _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); - if (_isWallBroken) { + if (!_isWallBroken) { _soundVolume = 90; _vm->_soundMan->setSoundVolume(0x90F0D1C3, 90); } - if (getGlobalVar(V_WALL_BROKEN)) { + if (_isWallBroken) { createNavigationScene(0x004B7D58, which); } else { createNavigationScene(0x004B7D10, which); @@ -102,7 +103,7 @@ void Module3000::createScene(int sceneNum, int which) { case 3: if (getGlobalVar(V_STAIRS_DOWN)) createNavigationScene(0x004B7E60, which); - else if (getGlobalVar(V_WALL_BROKEN)) + else if (_isWallBroken) createNavigationScene(0x004B7DA0, which); else createNavigationScene(0x004B7E00, which); @@ -150,12 +151,12 @@ void Module3000::createScene(int sceneNum, int which) { // NOTE: Newly introduced sceneNums case 1001: if (!getGlobalVar(V_BOLT_DOOR_OPEN)) - if (getGlobalVar(V_WALL_BROKEN)) + if (_isWallBroken) createSmackerScene(0x00940021, true, true, false); else createSmackerScene(0x01140021, true, true, false); else - if (getGlobalVar(V_WALL_BROKEN)) + if (_isWallBroken) createSmackerScene(0x001011B1, true, true, false); else createSmackerScene(0x001021B1, true, true, false); @@ -299,7 +300,7 @@ void Module3000::updateScene() { } else if (frameNumber == 10) { _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); } - if (_isWallBroken && _soundVolume < 90 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) { if (frameNumber == 0) _soundVolume = 40; else @@ -313,7 +314,7 @@ void Module3000::updateScene() { if (navigationScene()->isWalkingForward()) { uint32 frameNumber = navigationScene()->getFrameNumber(); int navigationIndex = navigationScene()->getNavigationIndex(); - if (_isWallBroken && _soundVolume > 1 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume > 1 && frameNumber % 2) { _soundVolume--; _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume); } @@ -338,7 +339,7 @@ void Module3000::updateScene() { if (frameNumber == 40) { _vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0); } - if (_isWallBroken && _soundVolume < 90 && frameNumber % 2) { + if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) { if (frameNumber == 0) _soundVolume = 40; else -- cgit v1.2.3 From 7c18021c52985aabc4574c633ba6569bbddd648b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 28 Jun 2013 19:32:59 +0200 Subject: NEVERHOOD: Handle invalid save_slot more gracefully on startup If the specificed savegame doesn't exist, start the game from the beginning. Before, it would just hang. The error handling is still quite primitive, though. --- engines/neverhood/neverhood.cpp | 7 ++++--- engines/neverhood/neverhood.h | 4 ++-- engines/neverhood/saveload.cpp | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 3769117f7f..e7c9f32d45 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -123,9 +123,10 @@ Common::Error NeverhoodEngine::run() { (*navigationList)[5].middleFlag = 1; } - if (ConfMan.hasKey("save_slot")) - loadGameState(ConfMan.getInt("save_slot")); - else + if (ConfMan.hasKey("save_slot")) { + if (loadGameState(ConfMan.getInt("save_slot")).getCode() != Common::kNoError) + _gameModule->startup(); + } else _gameModule->startup(); mainLoop(); diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 39bc9cef2c..773e80df7d 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -122,8 +122,8 @@ public: Common::Error loadGameState(int slot); Common::Error saveGameState(int slot, const Common::String &description); Common::Error removeGameState(int slot); - void savegame(const char *filename, const char *description); - void loadgame(const char *filename); + bool savegame(const char *filename, const char *description); + bool loadgame(const char *filename); const char *getSavegameFilename(int num); static Common::String getSavegameFilename(const Common::String &target, int num); static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header); diff --git a/engines/neverhood/saveload.cpp b/engines/neverhood/saveload.cpp index 578d9858ff..ae93a0cea4 100644 --- a/engines/neverhood/saveload.cpp +++ b/engines/neverhood/saveload.cpp @@ -61,12 +61,12 @@ NeverhoodEngine::kReadSaveHeaderError NeverhoodEngine::readSaveHeader(Common::Se return ((in->eos() || in->err()) ? kRSHEIoError : kRSHENoError); } -void NeverhoodEngine::savegame(const char *filename, const char *description) { +bool NeverhoodEngine::savegame(const char *filename, const char *description) { Common::OutSaveFile *out; if (!(out = g_system->getSavefileManager()->openForSaving(filename))) { warning("Can't create file '%s', game not saved", filename); - return; + return false; } TimeDate curTime; @@ -99,13 +99,14 @@ void NeverhoodEngine::savegame(const char *filename, const char *description) { out->finalize(); delete out; + return true; } -void NeverhoodEngine::loadgame(const char *filename) { +bool NeverhoodEngine::loadgame(const char *filename) { Common::InSaveFile *in; if (!(in = g_system->getSavefileManager()->openForLoading(filename))) { warning("Can't open file '%s', game not loaded", filename); - return; + return false; } SaveHeader header; @@ -115,7 +116,7 @@ void NeverhoodEngine::loadgame(const char *filename) { if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); delete in; - return; + return false; } g_engine->setTotalPlayTime(header.playTime * 1000); @@ -128,18 +129,20 @@ void NeverhoodEngine::loadgame(const char *filename) { _gameModule->requestRestoreGame(); delete in; - + return true; } Common::Error NeverhoodEngine::loadGameState(int slot) { const char *fileName = getSavegameFilename(slot); - loadgame(fileName); + if (!loadgame(fileName)) + return Common::kReadingFailed; return Common::kNoError; } Common::Error NeverhoodEngine::saveGameState(int slot, const Common::String &description) { const char *fileName = getSavegameFilename(slot); - savegame(fileName, description.c_str()); + if (!savegame(fileName, description.c_str())) + return Common::kWritingFailed; return Common::kNoError; } -- cgit v1.2.3 From 7be196865b21d2c71787dbe24054edfa13fb4de1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Jun 2013 20:08:24 +0200 Subject: MORTEVIELLE: Rename displayStatusArrow() --- engines/mortevielle/actions.cpp | 36 ++++++++++++++++++------------------ engines/mortevielle/mortevielle.h | 4 ++-- engines/mortevielle/utils.cpp | 6 +++++- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9026df8470..bc811811d0 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -49,7 +49,7 @@ void MortevielleEngine::fctMove() { if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { if (!_syn) displayTextInVerbBar(getEngineString(S_GO_TO)); - tfleche(); + displayStatusArrow(); if (_keyPressedEsc) _destinationOk = false; @@ -218,7 +218,7 @@ void MortevielleEngine::fctTake() { } if (!_syn) displayTextInVerbBar(getEngineString(S_TAKE)); - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; if (_caff == 3) { @@ -324,7 +324,7 @@ void MortevielleEngine::fctInventoryTake() { void MortevielleEngine::fctLift() { if (!_syn) displayTextInVerbBar(getEngineString(S_LIFT)); - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; setCoordinates(3); @@ -361,7 +361,7 @@ void MortevielleEngine::fctRead() { else { if (!_syn) displayTextInVerbBar(getEngineString(S_READ)); - tfleche(); + displayStatusArrow(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(4); if (_num != 0) @@ -394,7 +394,7 @@ void MortevielleEngine::fctLook() { } if (!_syn) displayTextInVerbBar(getEngineString(S_LOOK)); - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; setCoordinates(5); @@ -485,7 +485,7 @@ void MortevielleEngine::fctSearch() { if (!_syn) displayTextInVerbBar(getEngineString(S_SEARCH)); - tfleche(); + displayStatusArrow(); if (_anyone || _keyPressedEsc) return; @@ -595,7 +595,7 @@ void MortevielleEngine::fctOpen() { return; } - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; @@ -659,7 +659,7 @@ void MortevielleEngine::fctPlace() { if (!_syn) displayTextInVerbBar(getEngineString(S_PUT)); - tfleche(); + displayStatusArrow(); if (_keyPressedEsc) _crep = 998; @@ -791,7 +791,7 @@ void MortevielleEngine::fctTurn() { } if (!_syn) displayTextInVerbBar(getEngineString(S_TURN)); - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; setCoordinates(9); @@ -827,7 +827,7 @@ void MortevielleEngine::fctTurn() { void MortevielleEngine::fctSelfHide() { if (!_syn) displayTextInVerbBar(getEngineString(S_HIDE_SELF)); - tfleche(); + displayStatusArrow(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(10); if (_num == 0) @@ -849,7 +849,7 @@ void MortevielleEngine::fctAttach() { else { if (!_syn) displayTextInVerbBar(getEngineString(S_TIE)); - tfleche(); + displayStatusArrow(); if (!(_anyone) && !(_keyPressedEsc)) { setCoordinates(8); _crep = 997; @@ -875,7 +875,7 @@ void MortevielleEngine::fctClose() { displayTextInVerbBar(getEngineString(S_CLOSE)); if (_caff < ROOM26) { - tfleche(); + displayStatusArrow(); if (_keyPressedEsc) _crep = 998; if ((_anyone) || (_keyPressedEsc)) @@ -920,7 +920,7 @@ void MortevielleEngine::fctKnock() { } if (_coreVar._currPlace < DOOR) { - tfleche(); + displayStatusArrow(); if (!(_anyone) && !(_keyPressedEsc)) { if ((_coreVar._currPlace < MOUNTAIN) && (_coreVar._currPlace != LANDING)) _crep = 133; @@ -970,7 +970,7 @@ void MortevielleEngine::fctSelfPut() { displayEmptyHand(); return; } - tfleche(); + displayStatusArrow(); if ((_anyone) || (_keyPressedEsc)) return; setCoordinates(7); @@ -1240,7 +1240,7 @@ void MortevielleEngine::fctForce() { if (!_syn) displayTextInVerbBar(getEngineString(S_SMASH)); if (_caff < DOOR) - tfleche(); + displayStatusArrow(); if ((!_anyone) && (!_keyPressedEsc)) { if (_coreVar._currPlace != ROOM26) @@ -1330,7 +1330,7 @@ void MortevielleEngine::fctSound() { if (!_syn) displayTextInVerbBar(getEngineString(S_PROBE2)); if (_caff < 27) { - tfleche(); + displayStatusArrow(); if (!(_anyone) && (!_keyPressedEsc)) _crep = 145; _num = 0; @@ -1552,7 +1552,7 @@ void MortevielleEngine::fctSmell() { if (_caff < ROOM26) { if (!_syn) displayTextInVerbBar(getEngineString(S_SMELL)); - tfleche(); + displayStatusArrow(); if (!(_anyone) && !(_keyPressedEsc)) if (_caff == CRYPT) _crep = 153; @@ -1570,7 +1570,7 @@ void MortevielleEngine::fctScratch() { if (_caff < 27) { if (!_syn) displayTextInVerbBar(getEngineString(S_SCRATCH)); - tfleche(); + displayStatusArrow(); } _num = 0; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index d4d57d84b7..74c1bc7e4a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -420,6 +420,8 @@ private: void askRestart(); void delay(int amount); void handleOpcode(); + void displayStatusArrow(); + void displayStatusInDescriptionBar(char stat); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void mapMessageId(int &mesgId); @@ -438,7 +440,6 @@ private: void writetp(Common::String s, int t); void premtet(); void ajchai(); - void tfleche(); void ecr2(Common::String text); void init_nbrepm(); void aniof(int ouf, int num); @@ -448,7 +449,6 @@ private: void tsuiv(); void treg(int objId); void rechai(int &ch); - void displayStatusInDescriptionBar(char stat); public: Common::Point _prevPos; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a0b7cf3d5e..bf524b6a39 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3240,7 +3240,11 @@ void MortevielleEngine::tsuiv() { } } -void MortevielleEngine::tfleche() { +/** + * Display Arrow status + * @remarks Originally called 'tfleche' + */ +void MortevielleEngine::displayStatusArrow() { bool qust; char touch; -- cgit v1.2.3 From 554e04535f3815cdf130f1b98cc9aa1dd3b7e0bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Jun 2013 21:13:01 +0200 Subject: MORTEVIELLE: Some more renaming, introduce MENU_NONE constant --- engines/mortevielle/actions.cpp | 18 +++++++++--------- engines/mortevielle/menu.h | 5 +++-- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 24 ++++++++++++++---------- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index bc811811d0..7181d164f7 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -77,7 +77,7 @@ void MortevielleEngine::fctMove() { _roomDoorId = _num - 3; if (_num != 6) - affrep(); + prepareDisplayText(); else showMoveMenuAlert(); return; @@ -164,11 +164,11 @@ void MortevielleEngine::fctMove() { loseGame(); } else { _coreVar._currPlace = INSIDE_WELL; - affrep(); + prepareDisplayText(); } } if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) - affrep(); + prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); } @@ -203,7 +203,7 @@ void MortevielleEngine::fctTake() { _coreVar._wellObjectId = 0; _menu.unsetSearchMenu(); _obpart = false; - affrep(); + prepareDisplayText(); } else { _tabdon[kAcha + ((_mchai - 1) * 10) + _searchCount - 1] = 0; tsuiv(); @@ -735,7 +735,7 @@ void MortevielleEngine::fctPlace() { aniof(2, 1); _crep = 166; } - affrep(); + prepareDisplayText(); } else { aniof(2, 1); _crep = 166; @@ -813,7 +813,7 @@ void MortevielleEngine::fctTurn() { int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { _coreVar._currPlace = CRYPT; - affrep(); + prepareDisplayText(); } else _crep = 176; } @@ -1175,7 +1175,7 @@ void MortevielleEngine::fctEnter() { aniof(1, 1); _coreVar._currPlace = _roomDoorId; - affrep(); + prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); _roomDoorId = OWN_ROOM; @@ -1199,7 +1199,7 @@ void MortevielleEngine::fctSleep() { if (_coreVar._currPlace != OWN_ROOM) { exitRoom(); _coreVar._currPlace = OWN_ROOM; - affrep(); + prepareDisplayText(); drawPictureWithText(); resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); @@ -1537,7 +1537,7 @@ void MortevielleEngine::fctDiscuss() { showPeoplePresent(_currBitIndex); prepareRoom(); drawClock(); - affrep(); + prepareDisplayText(); /* chech;*/ _menu.setDestinationText(_coreVar._currPlace); clearVerbBar(); diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 61430bfdaa..d4538effee 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -35,8 +35,9 @@ namespace Mortevielle { class MortevielleEngine; enum { - MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, MENU_SELF = 4, - MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, MENU_LOAD = 8 + MENU_NONE = 0, MENU_INVENTORY = 1, MENU_MOVE = 2, MENU_ACTION = 3, + MENU_SELF = 4, MENU_DISCUSS = 5, MENU_FILE = 6, MENU_SAVE = 7, + MENU_LOAD = 8 }; class Menu { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 74c1bc7e4a..ac86eb1b71 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -444,7 +444,7 @@ private: void init_nbrepm(); void aniof(int ouf, int num); void tlu(int af, int ob); - void affrep(); + void prepareDisplayText(); void mennor(); void tsuiv(); void treg(int objId); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index bf524b6a39..8eef2783ed 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1338,7 +1338,7 @@ bool MortevielleEngine::checkInventory(int objectId) { */ void MortevielleEngine::displayDiningRoom() { _coreVar._currPlace = DINING_ROOM; - affrep(); + prepareDisplayText(); } /** @@ -1409,7 +1409,7 @@ void MortevielleEngine::gotoDiningRoom() { drawClock(); _mouse.showMouse(); _coreVar._currPlace = OWN_ROOM; - affrep(); + prepareDisplayText(); resetPresenceInRooms(DINING_ROOM); if (!_blo) getPresence(OWN_ROOM); @@ -1432,7 +1432,7 @@ void MortevielleEngine::checkManorDistance() { } else { _destinationOk = true; _coreVar._currPlace = MOUNTAIN; - affrep(); + prepareDisplayText(); } } @@ -1443,7 +1443,7 @@ void MortevielleEngine::checkManorDistance() { void MortevielleEngine::gotoManorFront() { _manorDistance = 0; _coreVar._currPlace = MANOR_FRONT; - affrep(); + prepareDisplayText(); } /** @@ -1452,7 +1452,7 @@ void MortevielleEngine::gotoManorFront() { */ void MortevielleEngine::gotoManorBack() { _coreVar._currPlace = MANOR_BACK; - affrep(); + prepareDisplayText(); } /** @@ -1518,7 +1518,7 @@ void MortevielleEngine::gameLoaded() { _manorDistance = 0; resetOpenObjects(); _takeObjCount = 0; - affrep(); + prepareDisplayText(); _hintPctMessage = getString(580); _destinationOk = false; @@ -3038,7 +3038,11 @@ void MortevielleEngine::tlu(int af, int ob) { _crep = 998; } -void MortevielleEngine::affrep() { +/** + * Prepare Display Text + * @remarks Originally called 'affrep' + */ +void MortevielleEngine::prepareDisplayText() { _caff = _coreVar._currPlace; _crep = _coreVar._currPlace; } @@ -3209,7 +3213,7 @@ L1: clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); - affrep(); + prepareDisplayText(); } } if (_menu._menuDisplayed) @@ -3233,7 +3237,7 @@ void MortevielleEngine::tsuiv() { if (_currBitIndex != 0) _coreVar._faithScore += 2; } else { - affrep(); + prepareDisplayText(); endSearch(); if (cx > 9) _crep = 131; @@ -3347,7 +3351,7 @@ void MortevielleEngine::treg(int objId) { handleDescriptionText(2, _caff + 400); testKey(true); _caff = mdes; - _msg[3] = 0; + _msg[3] = MENU_NONE; _crep = 998; } else { _obpart = true; -- cgit v1.2.3 From fae077d848ddacc083cf37ed02ea8088f52f6f1b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Jun 2013 22:07:53 +0200 Subject: MORTEVIELLE: Get rid of some magic values --- engines/mortevielle/menu.cpp | 20 ++++++++++---------- engines/mortevielle/mortevielle.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 408ea0746d..6035c3ae11 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -239,30 +239,30 @@ void Menu::invert(int indx) { Common::String str; switch (_msg3) { - case 1: + case MENU_INVENTORY: str = _inventoryStringArray[menuIndex]; break; - case 2: + case MENU_MOVE: str = _moveStringArray[menuIndex]; break; - case 3: + case MENU_ACTION: str = _actionStringArray[menuIndex]; break; - case 4: + case MENU_SELF: str = _selfStringArray[menuIndex]; break; - case 5: + case MENU_DISCUSS: str = _discussStringArray[menuIndex]; break; - case 6: + case MENU_FILE: str = _vm->getEngineString(S_SAVE_LOAD + menuIndex); break; - case 7: + case MENU_SAVE: str = _vm->getEngineString(S_SAVE_LOAD + 1); str += ' '; str += (char)(48 + menuIndex); break; - case 8: + case MENU_LOAD: if (menuIndex == 1) { str = _vm->getEngineString(S_RESTART); } else { @@ -470,9 +470,9 @@ void Menu::updateMenu() { _vm->setMouseClick(false); menuUp(_msg3); if (lo(_msg4) == 1) - _msg3 = 7; + _msg3 = MENU_SAVE; else - _msg3 = 8; + _msg3 = MENU_LOAD; menuDown(_msg3); _vm->setMouseClick(false); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index ac86eb1b71..e2d1a5eef2 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -432,6 +432,7 @@ private: void drawPictureWithText(); void addObjectToInventory(int objectId); void putInHand(int &objId); + void prepareDisplayText(); void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); void copcha(); @@ -444,7 +445,6 @@ private: void init_nbrepm(); void aniof(int ouf, int num); void tlu(int af, int ob); - void prepareDisplayText(); void mennor(); void tsuiv(); void treg(int objId); -- cgit v1.2.3 From 8e40527813433fb43f07ea45a02740219a40341b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Jun 2013 10:30:42 +0200 Subject: MORTEVIELLE: More renaming --- engines/mortevielle/actions.cpp | 8 +++----- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/mortevielle.h | 6 +++--- engines/mortevielle/utils.cpp | 17 +++++++++++------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 7181d164f7..38cbb30927 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -509,7 +509,7 @@ void MortevielleEngine::fctSearch() { if (_currBitIndex > 0) _coreVar._faithScore += 3; - rechai(_mchai); + _mchai = rechai(); if (_mchai != 0) { _searchCount = 0; _heroSearching = true; @@ -893,8 +893,7 @@ void MortevielleEngine::fctClose() { --_openObjCount; if (_openObjCount < 0) _openObjCount = 0; - int chai = 9999; - rechai(chai); + int chai = rechai(); if (_mchai == chai) _mchai = 0; } else { @@ -976,8 +975,7 @@ void MortevielleEngine::fctSelfPut() { setCoordinates(7); _crep = 124; if (_num != 0) { - int chai; - rechai(chai); + int chai = rechai(); if (chai == 0) _crep = 997; else { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index c53b20fa5a..69cb81b4ef 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -447,7 +447,7 @@ int DialogManager::waitForF3F8() { int key; do { - key = _vm->testou(); + key = _vm->gettKeyPressed(); if (_vm->shouldQuit()) return key; } while ((key != 61) && (key != 66)); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e2d1a5eef2..e6f8a1f235 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -418,7 +418,6 @@ private: void fctScratch(); void endGame(); void askRestart(); - void delay(int amount); void handleOpcode(); void displayStatusArrow(); void displayStatusInDescriptionBar(char stat); @@ -448,7 +447,7 @@ private: void mennor(); void tsuiv(); void treg(int objId); - void rechai(int &ch); + int rechai(); public: Common::Point _prevPos; @@ -510,6 +509,7 @@ public: Common::String getEngineString(int idx) const { return _engineStrings[idx]; } Common::String getGameString(int idx) const { return _gameStrings[idx]; } + void delay(int amount); void gameLoaded(); void initGame(); void displayAloneText(); @@ -524,7 +524,7 @@ public: void displayEmptyHand(); void hirs(); - int testou(); + int gettKeyPressed(); void handleDescriptionText(int f, int mesgId); int animof(int ouf, int num); void pictout(int seg, int dep, int x, int y); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 8eef2783ed..7756d913e5 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3005,7 +3005,7 @@ void MortevielleEngine::testKey(bool d) { // Wait for release from any key or mouse button while (keyPressed()) - _key = testou(); + _key = gettKeyPressed(); do { _mouse.getMousePosition(x, y, click); @@ -3022,7 +3022,7 @@ void MortevielleEngine::testKey(bool d) { return; } while (!(quest || (click) || (d && _anyone))); if (quest) - testou(); + gettKeyPressed(); setMouseClick(false); _mouse.showMouse(); } @@ -3377,12 +3377,13 @@ void MortevielleEngine::putInHand(int &objId) { } } -void MortevielleEngine::rechai(int &ch) { +int MortevielleEngine::rechai() { int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - ch = _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; + + return _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; } /** @@ -3424,10 +3425,14 @@ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { */ void MortevielleEngine::testKeyboard() { if (keyPressed()) - testou(); + gettKeyPressed(); } -int MortevielleEngine::testou() { +/** + * Test Key Pressed + * @remarks Originally called 'testou' + */ +int MortevielleEngine::gettKeyPressed() { char ch = getChar(); switch (ch) { -- cgit v1.2.3 From c2610d66e1d0ceb0ab29243a0dcddd2b8dadd22e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Jun 2013 10:31:30 +0200 Subject: MORTEVIELLE: Fix compilation of music code --- engines/mortevielle/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 478af41c87..de5c4feba6 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -177,7 +177,7 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::musyc(tablint &tb, int nbseg, int att) { #ifdef DEBUG - const byte *pSrc = &mem[0x5000 * 16]; + const byte *pSrc = &_vm->_mem[0x5000 * 16]; // Convert the countdown amount to a tempo rate, and then to note length in microseconds int tempo = TIMER_FREQUENCY / att; -- cgit v1.2.3 From 5ba9f831a0e7a7f11b1d9b20e6e00bf41d0a7137 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 10:47:37 -0400 Subject: TSAGE: Beginnings of implementing R2R maze UI --- engines/tsage/ringworld2/ringworld2_logic.cpp | 94 +++++++++++++++++++------ engines/tsage/ringworld2/ringworld2_logic.h | 50 +++++++------ engines/tsage/ringworld2/ringworld2_scenes1.cpp | 2 +- engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 12 ++-- engines/tsage/ringworld2/ringworld2_scenes3.h | 2 +- 6 files changed, 110 insertions(+), 52 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 67af65c08a..65030bed31 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -21,6 +21,7 @@ */ #include "common/config-manager.h" +#include "tsage/graphics.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" @@ -270,7 +271,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Confrontation return new Scene3400(); case 3500: - // Maze action scene + // Maze action sequencec return new Scene3500(); case 3600: // Cutscene - walking at gunpoint @@ -1274,14 +1275,19 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i /*****************************************************************************/ -UnkObject1200::UnkObject1200() { +MazeUI::MazeUI() { _field16 = _field3A = NULL; _field12 = _field14 = 0; - _field26 = _field28 = _field2A = _field2C = _field2E = _field30 = 0; - _field32 = _field34 = _field36 = _field38 = _field3E = _field40 = 0; + _field26 = _field28 = _width = _height = _field2E = _field30 = 0; + _resNum = _field34 = _field36 = _field38 = _field3E = _field40 = 0; } -void UnkObject1200::synchronize(Serializer &s) { +MazeUI::~MazeUI() { + DEALLOCATE(_field16); + DEALLOCATE(_field3A); +} + +void MazeUI::synchronize(Serializer &s) { SavedObject::synchronize(s); _rect1.synchronize(s); @@ -1293,11 +1299,11 @@ void UnkObject1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field14); s.syncAsSint16LE(_field26); s.syncAsSint16LE(_field28); - s.syncAsSint16LE(_field2A); - s.syncAsSint16LE(_field2C); + s.syncAsSint16LE(_width); + s.syncAsSint16LE(_height); s.syncAsSint16LE(_field2E); s.syncAsSint16LE(_field30); - s.syncAsSint16LE(_field32); + s.syncAsSint16LE(_resNum); s.syncAsSint16LE(_field34); s.syncAsSint16LE(_field36); s.syncAsSint16LE(_field38); @@ -1305,16 +1311,58 @@ void UnkObject1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field40); } -void UnkObject1200::sub51AE9(int arg1) { - warning("STUB: UnkObject1200::sub51AE9()"); +void MazeUI::load(int resNum) { + clear(); + _resNum = resNum; + + const byte *header = g_resourceManager->getResource(RT17, resNum, 0); + + _field34 = resNum + 1000; + _field26 = READ_LE_UINT16(header + 2); + _field28 = READ_LE_UINT16(header + 4); + _field36 = 10; + _field38 = _field36 << 3; + + Visage visage; + visage.setVisage(_field34, 1); + + GfxSurface frame = visage.getFrame(2); + _width = frame.getBounds().width(); + _height = frame.getBounds().height(); + + _field16 = ALLOCATE(_field26 * _field28 * 2); + const byte *res = g_resourceManager->getResource(RT17, resNum, 1); + Common::copy(res, res + (_field26 * _field28 * 2), _field16); + + _field30 = _field2E = 0; + _field12 = (_rect1.width() + _width - 1) / _width; + _field14 = (_rect1.height() + _height - 1) / _height; + + _field3E = (_field12 + 1) * _width; + _field3A = ALLOCATE(_field3E * _height); + + _rect2 = Rect(0, 0, _width * _field26, _height * _field28); +} + +void MazeUI::clear() { + if (!_resNum) + _resNum = 1; + + if (_field16) + DEALLOCATE(_field16); + _field16 = NULL; + + DEALLOCATE(_field3A); + _field3A = NULL; + } -int UnkObject1200::sub51AF8(Common::Point pt) { +int MazeUI::sub51AF8(Common::Point pt) { if (!_rect1.contains(pt)) return -1; - int tmp1 = (pt.x - _rect1.left + _field2E) / _field2A; - int tmp2 = (pt.y - _rect1.top + _field30) / _field2C; + int tmp1 = (pt.x - _rect1.left + _field2E) / _width; + int tmp2 = (pt.y - _rect1.top + _field30) / _height; if ((tmp1 >= 0) && (tmp2 >= 0) && (_field26 > tmp1) && (_field28 > tmp2)) return _field16[(((_field26 * tmp2) + tmp1)* 2)]; @@ -1322,7 +1370,7 @@ int UnkObject1200::sub51AF8(Common::Point pt) { return -1; } -bool UnkObject1200::sub51AFD(Common::Point pt) { +bool MazeUI::sub51AFD(Common::Point pt) { int retval = false; _field2E = pt.x; @@ -1351,19 +1399,19 @@ bool UnkObject1200::sub51AFD(Common::Point pt) { return retval; } -void UnkObject1200::sub51B02() { - warning("STUB: UnkObject1200::sub51B02()"); +void MazeUI::sub51B02() { + warning("STUB: MazeUI::sub51B02()"); } -void UnkObject1200::sub9EDE8(Rect rect) { +void MazeUI::sub9EDE8(Rect rect) { _rect1 = rect; - warning("FIXME: UnkObject1200::sub9EDE8()"); + warning("FIXME: MazeUI::sub9EDE8()"); // _rect1.clip(g_globals->gfxManager()._bounds); } -int UnkObject1200::sub9EE22(int &arg1, int &arg2) { - arg1 /= _field2A; - arg2 /= _field2C; +int MazeUI::sub9EE22(int &arg1, int &arg2) { + arg1 /= _width; + arg2 /= _height; if ((arg1 >= 0) && (arg2 >= 0) && (_field26 > arg1) && (_field28 > arg2)) { return _field16[(((_field26 * arg2) + arg1) * 2)]; @@ -1372,6 +1420,10 @@ int UnkObject1200::sub9EE22(int &arg1, int &arg2) { return -1; } +/*--------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------*/ + void Scene1200::sub9DAD6(int indx) { _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 0b573bf7f0..3ca1ba863e 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -276,53 +276,57 @@ public: } }; -class SceneAreaObject: public SceneArea { - class Object1: public SceneActor { - public: - }; -public: - Object1 _object1; - int _insetCount; - - virtual void remove(); - virtual void process(Event &event); - void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt); - void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); -}; - -class UnkObject1200 : public SavedObject { +class MazeUI: public SavedObject { +private: + void clear(); public: Rect _rect1; Rect _rect2; - int *_field16; - int *_field3A; + byte *_field16; + byte *_field3A; int _field12; int _field14; int _field26; int _field28; - int _field2A; - int _field2C; + int _width; + int _height; int _field2E; int _field30; - int _field32; + int _resNum; int _field34; int _field36; int _field38; int _field3E; int _field40; +public: + MazeUI(); + ~MazeUI(); + void load(int resNum); - UnkObject1200(); + virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); - void sub51AE9(int arg1); int sub51AF8(Common::Point pt); bool sub51AFD(Common::Point pt); void sub51B02(); void sub9EDE8(Rect rect); int sub9EE22(int &arg1, int &arg2); - virtual Common::String getClassName() { return "UnkObject1200"; } +}; + +class SceneAreaObject: public SceneArea { + class Object1: public SceneActor { + public: + }; +public: + Object1 _object1; + int _insetCount; + + virtual void remove(); + virtual void process(Event &event); + void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt); + void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index af62ab6916..ba12a4b98f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1136,7 +1136,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { tmpRect.set(110, 20, 210, 120); _object1.sub9EDE8(tmpRect); - _object1.sub51AE9(1); + _object1.load(1); _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); _object1.sub51B02(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index f65a89972d..d1e55ef12b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -147,7 +147,7 @@ public: NamedHotspot _item1; SceneActor _actor1; Area1 _area1; - UnkObject1200 _object1; + MazeUI _object1; SequenceManager _sequenceManager; int _field412; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 61711d0a4f..0e444a66bf 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2888,6 +2888,7 @@ void Scene3400::signal() { * Scene 3500 - * *--------------------------------------------------------------------------*/ + Scene3500::Action1::Action1() { _field1E = 0; _field20 = 0; @@ -3046,16 +3047,16 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) { } int Scene3500::UnkObject3500::sub1097C9(int arg1) { - return (_field2A / 2) + arg1 - (arg1 % _field2A); + return (_width / 2) + arg1 - (arg1 % _width); } int Scene3500::UnkObject3500::sub1097EF(int arg1) { - return (_field2C / 2) + arg1 - (arg1 % _field2C); + return (_height / 2) + arg1 - (arg1 % _height); } int Scene3500::UnkObject3500::sub109C09(Common::Point pt) { - int vx = pt.x / _field2A; - int vy = pt.y / _field2C; + int vx = pt.x / _width; + int vy = pt.y / _height; if ((vx >= 0) && (_field26 > vx) && (_field28 > vy)) { return _field16[((_field26 * vy) + vx) * 2]; @@ -3665,7 +3666,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { tmpRect.set(160, 89, 299, 182); _unkObj1.sub9EDE8(tmpRect); - _unkObj1.sub51AE9(2); + _unkObj1.load(2); _unkObj1.sub51AFD(Common::Point(_field127A, _field127C)); _action1._field24 = 0; @@ -3787,6 +3788,7 @@ void Scene3500::process(Event &event) { void Scene3500::dispatch() { Rect tmpRect; Scene::dispatch(); + if (((_actor1._frame % 2) == 0) && (_action1._field24 == 0)) { _actor1.setFrame(_actor1.changeFrame()); _field1276 = _actor1._frame; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 44787b9eef..ffad37d7ce 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -633,7 +633,7 @@ class Scene3500 : public SceneExt { // TODO: double check if nothing specific is present, then remove this class }; - class UnkObject3500 : public UnkObject1200 { + class UnkObject3500 : public MazeUI { public: int sub1097C9(int arg1); int sub1097EF(int arg1); -- cgit v1.2.3 From 61df7e35c98b9d6b0ed8d030faea5e81bb3888f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 12:06:40 -0400 Subject: TSAGE: Further cleanup of existing R2R MazeUI code --- engines/tsage/ringworld2/ringworld2_logic.cpp | 15 +-- engines/tsage/ringworld2/ringworld2_logic.h | 6 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 14 +-- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 160 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes3.h | 9 +- 5 files changed, 100 insertions(+), 104 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 65030bed31..1cd6561d33 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1293,8 +1293,6 @@ void MazeUI::synchronize(Serializer &s) { _rect1.synchronize(s); _rect2.synchronize(s); - // FIXME: syncrhonize _field16 and _field3A - s.syncAsSint16LE(_field12); s.syncAsSint16LE(_field14); s.syncAsSint16LE(_field26); @@ -1370,8 +1368,8 @@ int MazeUI::sub51AF8(Common::Point pt) { return -1; } -bool MazeUI::sub51AFD(Common::Point pt) { - int retval = false; +bool MazeUI::setMazePosition(Common::Point pt) { + bool retval = false; _field2E = pt.x; _field30 = pt.y; @@ -1399,14 +1397,13 @@ bool MazeUI::sub51AFD(Common::Point pt) { return retval; } -void MazeUI::sub51B02() { - warning("STUB: MazeUI::sub51B02()"); +void MazeUI::mazeProc1() { + warning("STUB: MazeUI::mazeProc1()"); } -void MazeUI::sub9EDE8(Rect rect) { +void MazeUI::setUIBounds(Rect rect) { _rect1 = rect; - warning("FIXME: MazeUI::sub9EDE8()"); -// _rect1.clip(g_globals->gfxManager()._bounds); + _rect1.clip(g_globals->gfxManager()._bounds); } int MazeUI::sub9EE22(int &arg1, int &arg2) { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 3ca1ba863e..5a9120f161 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -309,9 +309,9 @@ public: void synchronize(Serializer &s); int sub51AF8(Common::Point pt); - bool sub51AFD(Common::Point pt); - void sub51B02(); - void sub9EDE8(Rect rect); + bool setMazePosition(Common::Point pt); + void mazeProc1(); + void setUIBounds(Rect rect); int sub9EE22(int &arg1, int &arg2); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index ba12a4b98f..70a504aa71 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1134,12 +1134,12 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _actor1.hide(); tmpRect.set(110, 20, 210, 120); - _object1.sub9EDE8(tmpRect); + _object1.setUIBounds(tmpRect); _object1.load(1); - _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.sub51B02(); + _object1.mazeProc1(); warning("set_pane_p(unk);"); R2_GLOBALS._player.enableControl(); @@ -1544,9 +1544,9 @@ void Scene1200::dispatch() { Rect tmpRect; Scene::dispatch(); if (_field41C != 0) { - _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.sub51B02(); + _object1.mazeProc1(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); _field41C = 0; @@ -1571,9 +1571,9 @@ void Scene1200::dispatch() { default: break; } - _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.sub51B02(); + _object1.mazeProc1(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 0e444a66bf..a8d3fd370b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3046,15 +3046,15 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) { setPosition(Pt); } -int Scene3500::UnkObject3500::sub1097C9(int arg1) { +int Scene3500::MazeUI3500::sub1097C9(int arg1) { return (_width / 2) + arg1 - (arg1 % _width); } -int Scene3500::UnkObject3500::sub1097EF(int arg1) { +int Scene3500::MazeUI3500::sub1097EF(int arg1) { return (_height / 2) + arg1 - (arg1 % _height); } -int Scene3500::UnkObject3500::sub109C09(Common::Point pt) { +int Scene3500::MazeUI3500::sub109C09(Common::Point pt) { int vx = pt.x / _width; int vy = pt.y / _height; @@ -3064,10 +3064,10 @@ int Scene3500::UnkObject3500::sub109C09(Common::Point pt) { return -1; } -int Scene3500::UnkObject3500::sub109C5E(int &x, int &y) { - int retVal = sub51AFD(Common::Point(x, y)); - x = _field2E; - y = _field30; +int Scene3500::MazeUI3500::sub109C5E(Common::Point &p) { + int retVal = setMazePosition(p); + p.x = _field2E; + p.y = _field30; return retVal; } @@ -3082,8 +3082,8 @@ Scene3500::Scene3500() { _field1274 = 0; _field1276 = 0; _field1278 = 0; - _field127A = 0; - _field127C = 0; + _position1.x = 0; + _position1.y = 0; _field127E = 0; _field1280 = 0; _field1282 = 0; @@ -3103,8 +3103,8 @@ void Scene3500::synchronize(Serializer &s) { s.syncAsSint16LE(_field1274); s.syncAsSint16LE(_field1276); s.syncAsSint16LE(_field1278); - s.syncAsSint16LE(_field127A); - s.syncAsSint16LE(_field127C); + s.syncAsSint16LE(_position1.x); + s.syncAsSint16LE(_position1.y); s.syncAsSint16LE(_field127E); s.syncAsSint16LE(_field1280); s.syncAsSint16LE(_field1282); @@ -3217,11 +3217,11 @@ void Scene3500::Action1::signal() { setDelay(1); break; case 4: { - int si = scene->_unkObj1.sub109C09(Common::Point(scene->_field127A + 70, scene->_field127C + 46)); - int var2 = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70; - int var4 = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46; - int di = abs(var2 - scene->_field127A); - int var6 = abs(var4 - scene->_field127C); + int si = scene->_mazeUI.sub109C09(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); + int var2 = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; + int var4 = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; + int di = abs(var2 - scene->_position1.x); + int var6 = abs(var4 - scene->_position1.y); if ((scene->_actor1._frame % 2) != 0) { scene->_actor1._frameChange = _field1E; @@ -3354,12 +3354,12 @@ void Scene3500::Action1::signal() { case 0: // No break on purpose case 4: - scene->_field127A = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70; + scene->_position1.x = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; break; case 2: // No break on purpose case 6: - scene->_field127C = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46; + scene->_position1.y = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; break; default: break; @@ -3576,8 +3576,8 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _field1272 = 1; _field1270 = 4; _field126E = 4; - _field127A = 860; - _field127C = 891; + _position1.x = 860; + _position1.y = 891; _rotation = R2_GLOBALS._scenePalette.addRotation(240, 254, -1); _rotation->setDelay(0); _rotation->_idxChange = 1; @@ -3665,13 +3665,13 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _actor3.fixPriority(200); tmpRect.set(160, 89, 299, 182); - _unkObj1.sub9EDE8(tmpRect); - _unkObj1.load(2); - _unkObj1.sub51AFD(Common::Point(_field127A, _field127C)); + _mazeUI.setUIBounds(tmpRect); + _mazeUI.load(2); + _mazeUI.setMazePosition(_position1); _action1._field24 = 0; warning("gfx_set_pane_p()"); - _unkObj1.sub51B02(); + _mazeUI.mazeProc1(); warning("gfx_set_pane_p()"); _field1286 = 1; @@ -3803,7 +3803,7 @@ void Scene3500::dispatch() { if (!_rotation) return; - int var_field127A = 0; + int var127A = 0; int di = 0; int var_4 = 0; int var_6 = 0; @@ -3819,17 +3819,17 @@ void Scene3500::dispatch() { _field1282 = 0; tmpRect.set(160, 89, 299, 182); - var_field127A = _field127A; - di = _field127C; - var_4 = _unkObj1.sub1097C9(70) - 70; - var_6 = _unkObj1.sub1097EF(_field127C + 46) - 46; - var_8 = abs(var_4 - var_field127A); + var127A = _position1.x; + di = _position1.y; + var_4 = _mazeUI.sub1097C9(70) - 70; + var_6 = _mazeUI.sub1097EF(_position1.y + 46) - 46; + var_8 = abs(var_4 - var127A); var_a = abs(var_6 - di); dx = 0; switch (_field1276) { case 0: - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, 46)); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3840,9 +3840,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _unkObj1.sub1097EF(di + 46) - 46; - di = _field127C - _field126E; - dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + var_6 = _mazeUI.sub1097EF(di + 46) - 46; + di = _position1.y - _field126E; + dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) { di = var_6; R2_GLOBALS._sound2.play(339); @@ -3862,11 +3862,11 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _unkObj1.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.sub1097EF(di + 46) - 46; var_a = abs(var_6 - di); - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); - if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_field127C>= var_6)) + if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_position1.y>= var_6)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) { di = var_6; if ((tmpVar != 25) && (tmpVar != 26) && (tmpVar != 5) && (tmpVar != 14) && (tmpVar == 15)) @@ -3877,7 +3877,7 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 11) && (var_6 + 3 >= di) && (_field127C >= var_6 + 3)) { + } else if ((tmpVar == 11) && (var_6 + 3 >= di) && (_position1.y >= var_6 + 3)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -3886,7 +3886,7 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { - var_field127A = var_4; + var127A = var_4; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -3895,7 +3895,7 @@ void Scene3500::dispatch() { } break; case 2: - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3906,11 +3906,11 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; - var_field127A = _field127A + _field126E; - dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var127A = _position1.x + _field126E; + dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) { - var_field127A = var_4; + var127A = var_4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -3919,7 +3919,7 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else if ((tmpVar == 6) && (tmpVar != dx)) { - var_field127A = var_4 - 5; + var127A = var_4 - 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -3928,12 +3928,12 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; - var_8 = abs(var_field127A - var_4); - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, tmpVar + 46)); - if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var_field127A >= var_4) && (_field127A <= var_4)) + var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_8 = abs(var127A - var_4); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, tmpVar + 46)); + if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var127A >= var_4) && (_position1.x <= var_4)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { - var_field127A = var_4; + var127A = var_4; if ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -3942,8 +3942,8 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 6) && (var_4 - 5 <= var_field127A) && (_field127A <= var_4 - 5)) { - var_field127A = var_4 - 5; + } else if ((tmpVar == 6) && (var_4 - 5 <= var127A) && (_position1.x <= var_4 - 5)) { + var127A = var_4 - 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -3961,7 +3961,7 @@ void Scene3500::dispatch() { } break; case 4: - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3972,9 +3972,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _unkObj1.sub1097EF(di + 46) - 46; - di = _field127C + _field126E; - dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + var_6 = _mazeUI.sub1097EF(di + 46) - 46; + di = _position1.y + _field126E; + dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4002,10 +4002,10 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _unkObj1.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.sub1097EF(di + 46) - 46; var_a = abs(di - var_6); - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); - if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_field127C <= var_6)) + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_position1.y <= var_6)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){ if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15)) R2_GLOBALS._sound2.play(339); @@ -4015,7 +4015,7 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 16) && (var_6 - 3 <= di) && (_field127C <= var_6 - 3)) { + } else if ((tmpVar == 16) && (var_6 - 3 <= di) && (_position1.y <= var_6 - 3)) { di = var_6 - 3; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4024,7 +4024,7 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 31) && (var_6 + 4 <= di) && (_field127C <= var_6 + 4)) { + } else if ((tmpVar == 31) && (var_6 + 4 <= di) && (_position1.y <= var_6 + 4)) { di = var_6 + 4; _rotation->_idxChange = 0; _field1270 = 0; @@ -4032,12 +4032,12 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - if ((var_field127A == 660) && (_field126E + 306 <= di) && (di <= 307)) + if ((var127A == 660) && (_field126E + 306 <= di) && (di <= 307)) ++_field1284; else R2_GLOBALS._sound2.play(339); } else if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { - var_field127A = var_4; + var127A = var_4; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -4046,7 +4046,7 @@ void Scene3500::dispatch() { } break; case 6: - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -4057,11 +4057,11 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; - var_field127A = _field127A - _field126E; - dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); + var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var127A = _position1.x - _field126E; + dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) { - var_field127A = var_4; + var127A = var_4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -4070,7 +4070,7 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else if ((tmpVar == 1) && (tmpVar != dx)) { - var_field127A = var_4 + 5; + var127A = var_4 + 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -4079,12 +4079,12 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70; - var_8 = abs(var_4 - var_field127A); - tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46)); - if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var_field127A <= var_4) && (_field127A >= var_4)) + var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_8 = abs(var_4 - var127A); + tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var127A <= var_4) && (_position1.x >= var_4)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { - var_field127A = var_4; + var127A = var_4; if ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4093,8 +4093,8 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 1) && (var_field127A >= var_4 + 5) && (_field127A >= var_4 + 5)) { - var_field127A = var_4 + 5; + } else if ((tmpVar == 1) && (var127A >= var_4 + 5) && (_position1.x >= var_4 + 5)) { + var127A = var_4 + 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -4116,9 +4116,9 @@ void Scene3500::dispatch() { } if (_field1284 < 2) { - _field127A = var_field127A; - _field127C = di; - if (_unkObj1.sub109C5E(_field127A, _field127C) != 0) { + _position1.x = var127A; + _position1.y = di; + if (_mazeUI.sub109C5E(_position1) != 0) { _field1272 = 0; _field126E = 0; _field1270 = 0; @@ -4126,7 +4126,7 @@ void Scene3500::dispatch() { _rotation->_idxChange = 0; } warning("gfx_set_pane_p"); - _unkObj1.sub51B02(); + _mazeUI.mazeProc1(); if (_field1284 != 0) ++_field1284; } diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index ffad37d7ce..60168c790f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -633,12 +633,12 @@ class Scene3500 : public SceneExt { // TODO: double check if nothing specific is present, then remove this class }; - class UnkObject3500 : public MazeUI { + class MazeUI3500 : public MazeUI { public: int sub1097C9(int arg1); int sub1097EF(int arg1); int sub109C09(Common::Point pt); - int sub109C5E(int &x, int &y); + int sub109C5E(Common::Point &p); }; public: Action1 _action1; @@ -660,7 +660,7 @@ public: Actor8 _actor8; Actor8 _actor9; ASoundExt _aSound1; - UnkObject3500 _unkObj1; + MazeUI3500 _mazeUI; SequenceManager _sequenceManager; int _fieldAF8; @@ -672,8 +672,7 @@ public: int _field1274; int _field1276; int _field1278; - int _field127A; - int _field127C; + Common::Point _position1; int _field127E; int _field1280; int _field1282; -- cgit v1.2.3 From 527b1b9b9cc730a87618c22d22fdff3e0a992daf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 18:24:26 -0400 Subject: TSAGE: Implemented R2R MazeUI::draw method --- engines/tsage/graphics.cpp | 7 ++- engines/tsage/graphics.h | 2 + engines/tsage/ringworld2/ringworld2_logic.cpp | 77 +++++++++++++++++++++---- engines/tsage/ringworld2/ringworld2_logic.h | 9 +-- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 6 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 4 +- 6 files changed, 84 insertions(+), 21 deletions(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index fb0b0b0cbb..bcc4d1bbd6 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -234,10 +234,15 @@ GfxSurface::GfxSurface(const GfxSurface &s) { } GfxSurface::~GfxSurface() { + clear(); +} + +void GfxSurface::clear() { if (_customSurface) { _customSurface->free(); delete _customSurface; - } + _customSurface = NULL; + } } /** diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 826f2fef6f..f006ceea53 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -42,6 +42,7 @@ class Rect : public Common::Rect, public Serialisable { public: Rect() : Common::Rect() {} Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} + Rect(const Common::Rect &r) : Common::Rect(r) {} void set(int16 x1, int16 y1, int16 x2, int16 y2); void collapse(int dx, int dy); @@ -100,6 +101,7 @@ public: void unlockSurface(); void synchronize(Serializer &s); void create(int width, int height); + void clear(); void setBounds(const Rect &bounds) { _bounds = bounds; } const Rect &getBounds() const { return _bounds; } diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 1cd6561d33..4ae12c966d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -21,6 +21,7 @@ */ #include "common/config-manager.h" +#include "common/rect.h" #include "tsage/graphics.h" #include "tsage/scenes.h" #include "tsage/tsage.h" @@ -1276,15 +1277,14 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i /*****************************************************************************/ MazeUI::MazeUI() { - _field16 = _field3A = NULL; + _field16 = NULL; _field12 = _field14 = 0; _field26 = _field28 = _width = _height = _field2E = _field30 = 0; - _resNum = _field34 = _field36 = _field38 = _field3E = _field40 = 0; + _resNum = _field34 = _field36 = _field38 = _mapImagePitch = _field40 = 0; } MazeUI::~MazeUI() { DEALLOCATE(_field16); - DEALLOCATE(_field3A); } void MazeUI::synchronize(Serializer &s) { @@ -1305,7 +1305,7 @@ void MazeUI::synchronize(Serializer &s) { s.syncAsSint16LE(_field34); s.syncAsSint16LE(_field36); s.syncAsSint16LE(_field38); - s.syncAsSint16LE(_field3E); + s.syncAsSint16LE(_mapImagePitch); s.syncAsSint16LE(_field40); } @@ -1336,8 +1336,8 @@ void MazeUI::load(int resNum) { _field12 = (_rect1.width() + _width - 1) / _width; _field14 = (_rect1.height() + _height - 1) / _height; - _field3E = (_field12 + 1) * _width; - _field3A = ALLOCATE(_field3E * _height); + _mapImagePitch = (_field12 + 1) * _width; + _mapImage.create(_mapImagePitch, _height); _rect2 = Rect(0, 0, _width * _field26, _height * _field28); } @@ -1350,9 +1350,7 @@ void MazeUI::clear() { DEALLOCATE(_field16); _field16 = NULL; - DEALLOCATE(_field3A); - _field3A = NULL; - + _mapImage.clear(); } int MazeUI::sub51AF8(Common::Point pt) { @@ -1397,8 +1395,65 @@ bool MazeUI::setMazePosition(Common::Point pt) { return retval; } -void MazeUI::mazeProc1() { - warning("STUB: MazeUI::mazeProc1()"); +void MazeUI::draw() { + int xs = _rect1.left; + int yPos = 0; + int yInc; + Visage visage; + + for (int yp = 0; yp < _field14; yp += yInc) { + int y = yp + _field30 / _height; + + for (int idx = 0; idx > _field12; ++idx) { + int x = _field2E / _width + idx; + + int cell = getCellValue(Common::Point(x, y)); + if (cell >= 0) { + int frameNum = (cell % _field36) + 1; + int rlbNum = (cell % _field38) / _field36 + 1; + int resNum = _field34 + (cell / _field38); + + visage.setVisage(resNum, rlbNum); + GfxSurface frame = visage.getFrame(frameNum); + + _mapImage.copyFrom(frame, 0, idx); + } else { + GfxSurface emptyRect; + emptyRect.create(_width, _height); + + _mapImage.copyFrom(emptyRect, 0, idx); + } + } + + if (yPos == 0) { + yPos = _rect1.top; + yInc = _height - (_field30 % _height); + + Rect srcBounds(Common::Rect(_field2E % _width, _field30 % _height, + _rect1.width(), yInc)); + Rect destBounds(Common::Rect(_rect1.left, yPos, _rect1.width(), yInc)); + + R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); + } else { + if ((yPos + _height) < _rect1.bottom) { + yInc = _height; + } else { + yInc = _rect1.bottom - yPos; + } + + Rect srcBounds(Common::Rect(0, _field2E, _rect1.width(), yInc)); + Rect destBounds(Common::Rect(_rect1.left, yPos, _rect1.width(), yInc)); + R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); + } + } +} + +int MazeUI::getCellValue(const Common::Point &p) { + if (p.x < 0 || p.y < 0 || p.x >= _field26 || p.y >= _field28) { + return -1; + } else { + return READ_LE_UINT16(_field16 + (_field26 * p.y + p.x) * 2); + } } void MazeUI::setUIBounds(Rect rect) { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 5a9120f161..93b67a49d4 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -279,12 +279,13 @@ public: class MazeUI: public SavedObject { private: void clear(); + int getCellValue(const Common::Point &p); public: Rect _rect1; Rect _rect2; byte *_field16; - byte *_field3A; + GfxSurface _mapImage; int _field12; int _field14; @@ -298,19 +299,19 @@ public: int _field34; int _field36; int _field38; - int _field3E; + int _mapImagePitch; int _field40; public: MazeUI(); - ~MazeUI(); + virtual ~MazeUI(); void load(int resNum); + void draw(); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); int sub51AF8(Common::Point pt); bool setMazePosition(Common::Point pt); - void mazeProc1(); void setUIBounds(Rect rect); int sub9EE22(int &arg1, int &arg2); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 70a504aa71..1f46c4b6d3 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1139,7 +1139,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _object1.load(1); _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.mazeProc1(); + _object1.draw(); warning("set_pane_p(unk);"); R2_GLOBALS._player.enableControl(); @@ -1546,7 +1546,7 @@ void Scene1200::dispatch() { if (_field41C != 0) { _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.mazeProc1(); + _object1.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); _field41C = 0; @@ -1573,7 +1573,7 @@ void Scene1200::dispatch() { } _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.mazeProc1(); + _object1.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index a8d3fd370b..baf68ed812 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3671,7 +3671,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _action1._field24 = 0; warning("gfx_set_pane_p()"); - _mazeUI.mazeProc1(); + _mazeUI.draw(); warning("gfx_set_pane_p()"); _field1286 = 1; @@ -4126,7 +4126,7 @@ void Scene3500::dispatch() { _rotation->_idxChange = 0; } warning("gfx_set_pane_p"); - _mazeUI.mazeProc1(); + _mazeUI.draw(); if (_field1284 != 0) ++_field1284; } -- cgit v1.2.3 From 114eff979d281341f9a7661a58b0ea2114fcfc7d Mon Sep 17 00:00:00 2001 From: sylvaintv Date: Sun, 30 Jun 2013 01:18:07 +0200 Subject: TOON: Fix bug #3611869 - Drew sometimes ends up stuck walking forever Canceled old character setFacing when a new one is issued during the character rotation. Bug #3611869: "TOON: Drew sometimes ends up stuck walking forever" --- engines/toon/character.cpp | 9 +++++++++ engines/toon/character.h | 1 + 2 files changed, 10 insertions(+) diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 479f4965f3..83c9e3ec70 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -58,6 +58,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) { _animSpecialDefaultId = 0; _currentPathNode = 0; _currentWalkStamp = 0; + _currentFacingStamp = 0; _visible = true; _speed = 150; // 150 = nominal drew speed _lastWalkTime = 0; @@ -99,6 +100,9 @@ void Character::setFacing(int32 facing) { if (_blockingWalk) { _flags |= 2; + _currentFacingStamp++; + int32 localFacingStamp = _currentFacingStamp; + int32 dir = 0; _lastWalkTime = _vm->_system->getMillis(); @@ -127,6 +131,11 @@ void Character::setFacing(int32 facing) { else playWalkAnim(0, 0); _vm->doFrame(); + + if (_currentFacingStamp != localFacingStamp) { + // another setFacing was started in doFrame, we need to cancel this one. + return; + } }; _flags &= ~2; diff --git a/engines/toon/character.h b/engines/toon/character.h index d33c314bf7..b248e7ccf2 100644 --- a/engines/toon/character.h +++ b/engines/toon/character.h @@ -143,6 +143,7 @@ protected: Common::Array _currentPath; uint32 _currentPathNode; int32 _currentWalkStamp; + int32 _currentFacingStamp; }; } // End of namespace Toon -- cgit v1.2.3 From 4dbc1ce5cc15a69b9609b8e0db00f11dd3644964 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 19:38:58 -0400 Subject: TSAGE: Fix for object initialisatioon in R2R scene 3500 --- engines/tsage/graphics.h | 1 - engines/tsage/ringworld2/ringworld2_logic.cpp | 11 +++++------ engines/tsage/ringworld2/ringworld2_scenes3.cpp | 6 ++---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index f006ceea53..71ec5cc2a5 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -42,7 +42,6 @@ class Rect : public Common::Rect, public Serialisable { public: Rect() : Common::Rect() {} Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} - Rect(const Common::Rect &r) : Common::Rect(r) {} void set(int16 x1, int16 y1, int16 x2, int16 y2); void collapse(int dx, int dy); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 4ae12c966d..5aa4a70687 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1396,7 +1396,6 @@ bool MazeUI::setMazePosition(Common::Point pt) { } void MazeUI::draw() { - int xs = _rect1.left; int yPos = 0; int yInc; Visage visage; @@ -1429,9 +1428,9 @@ void MazeUI::draw() { yPos = _rect1.top; yInc = _height - (_field30 % _height); - Rect srcBounds(Common::Rect(_field2E % _width, _field30 % _height, - _rect1.width(), yInc)); - Rect destBounds(Common::Rect(_rect1.left, yPos, _rect1.width(), yInc)); + Rect srcBounds(_field2E % _width, _field30 % _height, + (_field2E % _width) + _rect1.width(), (_field30 % _height) + yInc); + Rect destBounds(_rect1.left, yPos, _rect1.right, yPos + yInc); R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); } else { @@ -1441,8 +1440,8 @@ void MazeUI::draw() { yInc = _rect1.bottom - yPos; } - Rect srcBounds(Common::Rect(0, _field2E, _rect1.width(), yInc)); - Rect destBounds(Common::Rect(_rect1.left, yPos, _rect1.width(), yInc)); + Rect srcBounds(0, _field2E, _rect1.width(), _field2E + yInc); + Rect destBounds(_rect1.left, yPos, _rect1.right, yPos + yInc); R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); } } diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index baf68ed812..3f612bfaa4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3027,7 +3027,7 @@ void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int ar _fieldAC = _fieldAA / _fieldA8; postInit(); - setup(10501, 3, 1); + setup(1050, 3, 1); fixPriority(255); sub109663(arg5); } @@ -3616,7 +3616,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _item7.setDetails(96, 3500, 12, 10, -1); _actor8.postInit(); - _actor8.setup(10501, 1, 1); + _actor8.setup(1050, 1, 1); _actor8.setPosition(Common::Point(160, 73)); _actor8.fixPriority(1); @@ -3670,9 +3670,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _mazeUI.setMazePosition(_position1); _action1._field24 = 0; - warning("gfx_set_pane_p()"); _mazeUI.draw(); - warning("gfx_set_pane_p()"); _field1286 = 1; R2_GLOBALS._player.postInit(); -- cgit v1.2.3 From e74e062bf441cbb7a76b29d68007f2df7ec08590 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 21:21:29 -0400 Subject: TSAGE: Beginnings of renamings of R2R Maze UI --- engines/tsage/graphics.cpp | 6 + engines/tsage/graphics.h | 1 + engines/tsage/ringworld2/ringworld2_logic.cpp | 166 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_logic.h | 23 ++-- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 7 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 29 +++-- 6 files changed, 116 insertions(+), 116 deletions(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index bcc4d1bbd6..af6e6f9b13 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1327,6 +1327,12 @@ void GfxManager::copyFrom(GfxSurface &src, int destX, int destY) { _surface.copyFrom(src, destX, destY); } +void GfxManager::copyFrom(GfxSurface &src, const Rect &srcBounds, const Rect &destBounds) { + _surface.setBounds(_bounds); + + _surface.copyFrom(src, srcBounds, destBounds); +} + /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 71ec5cc2a5..7239a99a68 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -303,6 +303,7 @@ public: } void copyFrom(GfxSurface &src, Rect destBounds, Region *priorityRegion = NULL); void copyFrom(GfxSurface &src, int destX, int destY); + void copyFrom(GfxSurface &src, const Rect &srcBounds, const Rect &destBounds); GfxSurface &getSurface() { _surface.setBounds(_bounds); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 5aa4a70687..67382d83b3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1279,8 +1279,8 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i MazeUI::MazeUI() { _field16 = NULL; _field12 = _field14 = 0; - _field26 = _field28 = _width = _height = _field2E = _field30 = 0; - _resNum = _field34 = _field36 = _field38 = _mapImagePitch = _field40 = 0; + _mapCells.x = _mapCells.y = _cellSize.x = _cellSize.y = _cellOffset.x = _cellOffset.y = 0; + _resNum = _cellsResNum = _field36 = _field38 = _mapImagePitch = _field40 = 0; } MazeUI::~MazeUI() { @@ -1290,22 +1290,16 @@ MazeUI::~MazeUI() { void MazeUI::synchronize(Serializer &s) { SavedObject::synchronize(s); - _rect1.synchronize(s); - _rect2.synchronize(s); + s.syncAsSint16LE(_resNum); + if (s.isLoading()) + load(_resNum); s.syncAsSint16LE(_field12); s.syncAsSint16LE(_field14); - s.syncAsSint16LE(_field26); - s.syncAsSint16LE(_field28); - s.syncAsSint16LE(_width); - s.syncAsSint16LE(_height); - s.syncAsSint16LE(_field2E); - s.syncAsSint16LE(_field30); - s.syncAsSint16LE(_resNum); - s.syncAsSint16LE(_field34); + s.syncAsSint16LE(_cellOffset.x); + s.syncAsSint16LE(_cellOffset.y); s.syncAsSint16LE(_field36); s.syncAsSint16LE(_field38); - s.syncAsSint16LE(_mapImagePitch); s.syncAsSint16LE(_field40); } @@ -1315,31 +1309,31 @@ void MazeUI::load(int resNum) { const byte *header = g_resourceManager->getResource(RT17, resNum, 0); - _field34 = resNum + 1000; - _field26 = READ_LE_UINT16(header + 2); - _field28 = READ_LE_UINT16(header + 4); + _cellsResNum = resNum + 1000; + _mapCells.x = READ_LE_UINT16(header + 2); + _mapCells.y = READ_LE_UINT16(header + 4); _field36 = 10; _field38 = _field36 << 3; Visage visage; - visage.setVisage(_field34, 1); + visage.setVisage(_cellsResNum, 1); GfxSurface frame = visage.getFrame(2); - _width = frame.getBounds().width(); - _height = frame.getBounds().height(); + _cellSize.x = frame.getBounds().width(); + _cellSize.y = frame.getBounds().height(); - _field16 = ALLOCATE(_field26 * _field28 * 2); + _field16 = ALLOCATE(_mapCells.x * _mapCells.y * 2); const byte *res = g_resourceManager->getResource(RT17, resNum, 1); - Common::copy(res, res + (_field26 * _field28 * 2), _field16); + Common::copy(res, res + (_mapCells.x * _mapCells.y * 2), _field16); - _field30 = _field2E = 0; - _field12 = (_rect1.width() + _width - 1) / _width; - _field14 = (_rect1.height() + _height - 1) / _height; + _cellOffset.y = _cellOffset.x = 0; + _field12 = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; + _field14 = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; - _mapImagePitch = (_field12 + 1) * _width; - _mapImage.create(_mapImagePitch, _height); + _mapImagePitch = (_field12 + 1) * _cellSize.x; + _mapImage.create(_mapImagePitch, _cellSize.y); - _rect2 = Rect(0, 0, _width * _field26, _height * _field28); + _mapBounds = Rect(0, 0, _cellSize.x * _mapCells.x, _cellSize.y * _mapCells.y); } void MazeUI::clear() { @@ -1353,42 +1347,29 @@ void MazeUI::clear() { _mapImage.clear(); } -int MazeUI::sub51AF8(Common::Point pt) { - if (!_rect1.contains(pt)) - return -1; - - int tmp1 = (pt.x - _rect1.left + _field2E) / _width; - int tmp2 = (pt.y - _rect1.top + _field30) / _height; - - if ((tmp1 >= 0) && (tmp2 >= 0) && (_field26 > tmp1) && (_field28 > tmp2)) - return _field16[(((_field26 * tmp2) + tmp1)* 2)]; - - return -1; -} - -bool MazeUI::setMazePosition(Common::Point pt) { +bool MazeUI::setMazePosition(const Common::Point &pt) { bool retval = false; - _field2E = pt.x; - _field30 = pt.y; + _cellOffset.x = pt.x; + _cellOffset.y = pt.y; - if (_field2E < _rect2.top) { - _field2E = _rect2.top; + if (_cellOffset.x < _mapBounds.top) { + _cellOffset.x = _mapBounds.top; retval = true; } - if (_field30 < _rect2.left) { - _field30 = _rect2.left; + if (_cellOffset.y < _mapBounds.left) { + _cellOffset.y = _mapBounds.left; retval = true; } - if (_field2E + _rect1.width() > _rect2.right) { - _field2E = _rect2.right - _rect1.width(); + if (_cellOffset.x + _displayBounds.width() > _mapBounds.right) { + _cellOffset.x = _mapBounds.right - _displayBounds.width(); retval = true; } - if (_field30 + _rect1.height() > _rect2.bottom) { - _field30 = _rect2.bottom - _rect1.height(); + if (_cellOffset.y + _displayBounds.height() > _mapBounds.bottom) { + _cellOffset.y = _mapBounds.bottom - _displayBounds.height(); retval = true; } @@ -1401,16 +1382,16 @@ void MazeUI::draw() { Visage visage; for (int yp = 0; yp < _field14; yp += yInc) { - int y = yp + _field30 / _height; + int y = yp + _cellOffset.y / _cellSize.y; for (int idx = 0; idx > _field12; ++idx) { - int x = _field2E / _width + idx; + int x = _cellOffset.x / _cellSize.x + idx; - int cell = getCellValue(Common::Point(x, y)); + int cell = getCellFromCellXY(Common::Point(x, y)); if (cell >= 0) { int frameNum = (cell % _field36) + 1; int rlbNum = (cell % _field38) / _field36 + 1; - int resNum = _field34 + (cell / _field38); + int resNum = _cellsResNum + (cell / _field38); visage.setVisage(resNum, rlbNum); GfxSurface frame = visage.getFrame(frameNum); @@ -1418,54 +1399,67 @@ void MazeUI::draw() { _mapImage.copyFrom(frame, 0, idx); } else { GfxSurface emptyRect; - emptyRect.create(_width, _height); + emptyRect.create(_cellSize.x, _cellSize.y); _mapImage.copyFrom(emptyRect, 0, idx); } } if (yPos == 0) { - yPos = _rect1.top; - yInc = _height - (_field30 % _height); + yPos = _displayBounds.top; + yInc = _cellSize.y - (_cellOffset.y % _cellSize.y); - Rect srcBounds(_field2E % _width, _field30 % _height, - (_field2E % _width) + _rect1.width(), (_field30 % _height) + yInc); - Rect destBounds(_rect1.left, yPos, _rect1.right, yPos + yInc); + Rect srcBounds(_cellOffset.x % _cellSize.x, _cellOffset.y % _cellSize.y, + (_cellOffset.x % _cellSize.x) + _displayBounds.width(), (_cellOffset.y % _cellSize.y) + yInc); + Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + yInc); - R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); + R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } else { - if ((yPos + _height) < _rect1.bottom) { - yInc = _height; + if ((yPos + _cellSize.y) < _displayBounds.bottom) { + yInc = _cellSize.y; } else { - yInc = _rect1.bottom - yPos; + yInc = _displayBounds.bottom - yPos; } - Rect srcBounds(0, _field2E, _rect1.width(), _field2E + yInc); - Rect destBounds(_rect1.left, yPos, _rect1.right, yPos + yInc); - R2_GLOBALS._screenSurface.copyFrom(_mapImage, srcBounds, destBounds); + Rect srcBounds(0, _cellOffset.x, _displayBounds.width(), _cellOffset.x + yInc); + Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + yInc); + R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } } } -int MazeUI::getCellValue(const Common::Point &p) { - if (p.x < 0 || p.y < 0 || p.x >= _field26 || p.y >= _field28) { +int MazeUI::getCellFromPixelXY(const Common::Point &pt) { + if (!_displayBounds.contains(pt)) + return -1; + + int tmp1 = (pt.x - _displayBounds.left + _cellOffset.x) / _cellSize.x; + int tmp2 = (pt.y - _displayBounds.top + _cellOffset.y) / _cellSize.y; + + if ((tmp1 >= 0) && (tmp2 >= 0) && (_mapCells.x > tmp1) && (_mapCells.y > tmp2)) + return _field16[(((_mapCells.x * tmp2) + tmp1)* 2)]; + + return -1; +} + +int MazeUI::getCellFromCellXY(const Common::Point &p) { + if (p.x < 0 || p.y < 0 || p.x >= _mapCells.x || p.y >= _mapCells.y) { return -1; } else { - return READ_LE_UINT16(_field16 + (_field26 * p.y + p.x) * 2); + return READ_LE_UINT16(_field16 + (_mapCells.x * p.y + p.x) * 2); } } -void MazeUI::setUIBounds(Rect rect) { - _rect1 = rect; - _rect1.clip(g_globals->gfxManager()._bounds); +void MazeUI::setDisplayBounds(const Rect &r) { + _displayBounds = r; + _displayBounds.clip(g_globals->gfxManager()._bounds); } int MazeUI::sub9EE22(int &arg1, int &arg2) { - arg1 /= _width; - arg2 /= _height; + arg1 /= _cellSize.x; + arg2 /= _cellSize.y; - if ((arg1 >= 0) && (arg2 >= 0) && (_field26 > arg1) && (_field28 > arg2)) { - return _field16[(((_field26 * arg2) + arg1) * 2)]; + if ((arg1 >= 0) && (arg2 >= 0) && (_mapCells.x > arg1) && (_mapCells.y > arg2)) { + return _field16[(((_mapCells.x * arg2) + arg1) * 2)]; } return -1; @@ -1480,7 +1474,7 @@ void Scene1200::sub9DAD6(int indx) { switch (indx) { case 0: - if ( ((_object1.sub51AF8(Common::Point(200, 50)) > 36) || (_object1.sub51AF8(Common::Point(200, 88)) > 36)) + if ( ((_object1.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(200, 88)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) @@ -1489,7 +1483,7 @@ void Scene1200::sub9DAD6(int indx) { R2_GLOBALS._player.disableControl(); _sceneMode = 1200; setAction(&_sequenceManager, this, 1200, &_actor1, NULL); - } else if (_object1.sub51AF8(Common::Point(200, 69)) == 36) { + } else if (_object1.getCellFromPixelXY(Common::Point(200, 69)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3155) @@ -1524,7 +1518,7 @@ void Scene1200::sub9DAD6(int indx) { } break; case 1: - if ( ((_object1.sub51AF8(Common::Point(120, 50)) > 36) || (_object1.sub51AF8(Common::Point(120, 88)) > 36)) + if ( ((_object1.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(120, 88)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) @@ -1533,7 +1527,7 @@ void Scene1200::sub9DAD6(int indx) { R2_GLOBALS._player.disableControl(); _sceneMode = 1201; setAction(&_sequenceManager, this, 1201, &_actor1, NULL); - } else if (_object1.sub51AF8(Common::Point(120, 69)) == 36) { + } else if (_object1.getCellFromPixelXY(Common::Point(120, 69)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) @@ -1568,14 +1562,14 @@ void Scene1200::sub9DAD6(int indx) { } break; case 2: - if ( ((_object1.sub51AF8(Common::Point(140, 110)) > 36) || (_object1.sub51AF8(Common::Point(178, 110)) > 36)) + if ( ((_object1.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 110)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1203; setAction(&_sequenceManager, this, 1203, &_actor1, NULL); - } else if (_object1.sub51AF8(Common::Point(160, 110)) == 36) { + } else if (_object1.getCellFromPixelXY(Common::Point(160, 110)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) @@ -1610,14 +1604,14 @@ void Scene1200::sub9DAD6(int indx) { } break; case 3: - if ( ((_object1.sub51AF8(Common::Point(140, 30)) > 36) || (_object1.sub51AF8(Common::Point(178, 30)) > 36)) + if ( ((_object1.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 30)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1202; setAction(&_sequenceManager, this, 1202, &_actor1, NULL); - } else if (_object1.sub51AF8(Common::Point(160, 30)) == 36) { + } else if (_object1.getCellFromPixelXY(Common::Point(160, 30)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 93b67a49d4..75347f20fa 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -279,24 +279,20 @@ public: class MazeUI: public SavedObject { private: void clear(); - int getCellValue(const Common::Point &p); public: - Rect _rect1; - Rect _rect2; + Rect _displayBounds; + Rect _mapBounds; byte *_field16; GfxSurface _mapImage; int _field12; int _field14; - int _field26; - int _field28; - int _width; - int _height; - int _field2E; - int _field30; + Common::Point _mapCells; + Common::Point _cellSize; + Common::Point _cellOffset; int _resNum; - int _field34; + int _cellsResNum; int _field36; int _field38; int _mapImagePitch; @@ -304,15 +300,16 @@ public: public: MazeUI(); virtual ~MazeUI(); + void setDisplayBounds(const Rect &r); + bool setMazePosition(const Common::Point &pt); void load(int resNum); void draw(); + int getCellFromPixelXY(const Common::Point &pt); + int getCellFromCellXY(const Common::Point &p); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); - int sub51AF8(Common::Point pt); - bool setMazePosition(Common::Point pt); - void setUIBounds(Rect rect); int sub9EE22(int &arg1, int &arg2); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 1f46c4b6d3..d77a8bd885 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1099,8 +1099,6 @@ void Scene1200::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int } void Scene1200::postInit(SceneObjectList *OwnerList) { - Rect tmpRect; - loadScene(1200); SceneExt::postInit(); @@ -1133,8 +1131,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.hide(); - tmpRect.set(110, 20, 210, 120); - _object1.setUIBounds(tmpRect); + _object1.setDisplayBounds(Rect(110, 20, 210, 120)); _object1.load(1); _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); @@ -1397,7 +1394,7 @@ void Scene1200::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN) { _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); - int unk = _object1.sub51AF8(event.mousePos); + int unk = _object1.getCellFromPixelXY(event.mousePos); switch (R2_GLOBALS._events.getCursor()) { case CURSOR_ARROW: event.handled = true; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 3f612bfaa4..475c743982 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2978,6 +2978,8 @@ void Scene3500::Action1::sub108732(int arg1) { } } +/*--------------------------------------------------------------------------*/ + Scene3500::Action2::Action2() { _field1E = 0; } @@ -2988,6 +2990,8 @@ void Scene3500::Action2::synchronize(Serializer &s) { s.syncAsSint16LE(_field1E); } +/*--------------------------------------------------------------------------*/ + Scene3500::Item4::Item4() { _field34 = 0; } @@ -2998,6 +3002,8 @@ void Scene3500::Item4::synchronize(Serializer &s) { s.syncAsSint16LE(_field34); } +/*--------------------------------------------------------------------------*/ + Scene3500::Actor7::Actor7() { _fieldA4 = 0; _fieldA6 = 0; @@ -3046,28 +3052,29 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) { setPosition(Pt); } +/*--------------------------------------------------------------------------*/ + int Scene3500::MazeUI3500::sub1097C9(int arg1) { - return (_width / 2) + arg1 - (arg1 % _width); + return (_cellSize.x / 2) + arg1 - (arg1 % _cellSize.x); } int Scene3500::MazeUI3500::sub1097EF(int arg1) { - return (_height / 2) + arg1 - (arg1 % _height); + return (_cellSize.y / 2) + arg1 - (arg1 % _cellSize.y); } int Scene3500::MazeUI3500::sub109C09(Common::Point pt) { - int vx = pt.x / _width; - int vy = pt.y / _height; + int vx = pt.x / _cellSize.x; + int vy = pt.y / _cellSize.y; - if ((vx >= 0) && (_field26 > vx) && (_field28 > vy)) { - return _field16[((_field26 * vy) + vx) * 2]; + if ((vx >= 0) && (_mapCells.x > vx) && (_mapCells.y > vy)) { + return _field16[((_mapCells.x * vy) + vx) * 2]; } else return -1; } int Scene3500::MazeUI3500::sub109C5E(Common::Point &p) { int retVal = setMazePosition(p); - p.x = _field2E; - p.y = _field30; + p = _cellOffset; return retVal; } @@ -3560,7 +3567,6 @@ bool Scene3500::Actor7::startAction(CursorType action, Event &event) { void Scene3500::postInit(SceneObjectList *OwnerList) { byte tmpPal[768]; - Rect tmpRect; loadScene(1050); R2_GLOBALS._uiElements._active = false; @@ -3664,8 +3670,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _actor3.setPosition(Common::Point(126, 108)); _actor3.fixPriority(200); - tmpRect.set(160, 89, 299, 182); - _mazeUI.setUIBounds(tmpRect); + _mazeUI.setDisplayBounds(Rect(160, 89, 299, 182)); _mazeUI.load(2); _mazeUI.setMazePosition(_position1); @@ -4123,7 +4128,7 @@ void Scene3500::dispatch() { _rotation->setDelay(0); _rotation->_idxChange = 0; } - warning("gfx_set_pane_p"); + _mazeUI.draw(); if (_field1284 != 0) ++_field1284; -- cgit v1.2.3 From 4bc868c89668d0d7391530928ac1402aafbf1e1b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 21:54:24 -0400 Subject: TSAGE: Further renaming of R2R Maze UI --- engines/tsage/ringworld2/ringworld2_logic.cpp | 227 ++---------------------- engines/tsage/ringworld2/ringworld2_logic.h | 5 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 185 ++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 2 +- 4 files changed, 206 insertions(+), 213 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 67382d83b3..c17fcc9900 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1277,14 +1277,14 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i /*****************************************************************************/ MazeUI::MazeUI() { - _field16 = NULL; + _mapData = NULL; _field12 = _field14 = 0; _mapCells.x = _mapCells.y = _cellSize.x = _cellSize.y = _cellOffset.x = _cellOffset.y = 0; _resNum = _cellsResNum = _field36 = _field38 = _mapImagePitch = _field40 = 0; } MazeUI::~MazeUI() { - DEALLOCATE(_field16); + DEALLOCATE(_mapData); } void MazeUI::synchronize(Serializer &s) { @@ -1322,9 +1322,7 @@ void MazeUI::load(int resNum) { _cellSize.x = frame.getBounds().width(); _cellSize.y = frame.getBounds().height(); - _field16 = ALLOCATE(_mapCells.x * _mapCells.y * 2); - const byte *res = g_resourceManager->getResource(RT17, resNum, 1); - Common::copy(res, res + (_mapCells.x * _mapCells.y * 2), _field16); + _mapData = g_resourceManager->getResource(RT17, resNum, 1); _cellOffset.y = _cellOffset.x = 0; _field12 = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; @@ -1340,9 +1338,9 @@ void MazeUI::clear() { if (!_resNum) _resNum = 1; - if (_field16) - DEALLOCATE(_field16); - _field16 = NULL; + if (_mapData) + DEALLOCATE(_mapData); + _mapData = NULL; _mapImage.clear(); } @@ -1432,11 +1430,11 @@ int MazeUI::getCellFromPixelXY(const Common::Point &pt) { if (!_displayBounds.contains(pt)) return -1; - int tmp1 = (pt.x - _displayBounds.left + _cellOffset.x) / _cellSize.x; - int tmp2 = (pt.y - _displayBounds.top + _cellOffset.y) / _cellSize.y; + int cellX = (pt.x - _displayBounds.left + _cellOffset.x) / _cellSize.x; + int cellY = (pt.y - _displayBounds.top + _cellOffset.y) / _cellSize.y; - if ((tmp1 >= 0) && (tmp2 >= 0) && (_mapCells.x > tmp1) && (_mapCells.y > tmp2)) - return _field16[(((_mapCells.x * tmp2) + tmp1)* 2)]; + if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) + return (int16)READ_LE_UINT16(_mapData + ((_mapCells.x * cellY) + cellX) * 2); return -1; } @@ -1445,211 +1443,24 @@ int MazeUI::getCellFromCellXY(const Common::Point &p) { if (p.x < 0 || p.y < 0 || p.x >= _mapCells.x || p.y >= _mapCells.y) { return -1; } else { - return READ_LE_UINT16(_field16 + (_mapCells.x * p.y + p.x) * 2); + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * p.y + p.x) * 2); } } -void MazeUI::setDisplayBounds(const Rect &r) { - _displayBounds = r; - _displayBounds.clip(g_globals->gfxManager()._bounds); -} +int MazeUI::pixelToCellXY(int &x, int &y) { + x /= _cellSize.x; + y /= _cellSize.y; -int MazeUI::sub9EE22(int &arg1, int &arg2) { - arg1 /= _cellSize.x; - arg2 /= _cellSize.y; - - if ((arg1 >= 0) && (arg2 >= 0) && (_mapCells.x > arg1) && (_mapCells.y > arg2)) { - return _field16[(((_mapCells.x * arg2) + arg1) * 2)]; + if ((x >= 0) && (y >= 0) && (_mapCells.x > x) && (_mapCells.y > y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * y + x) * 2); } return -1; } -/*--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------*/ - -void Scene1200::sub9DAD6(int indx) { - _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); - - switch (indx) { - case 0: - if ( ((_object1.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(200, 88)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) - || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) - || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) ) - ) { - R2_GLOBALS._player.disableControl(); - _sceneMode = 1200; - setAction(&_sequenceManager, this, 1200, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(200, 69)) == 36) { - switch (_field412 - 1) { - case 0: - if (R2_GLOBALS._player._visage == 3155) - _sceneMode = 15; - else - _sceneMode = 10; - break; - case 1: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 76; - else - _sceneMode = 75; - break; - case 2: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 101; - else - _sceneMode = 100; - break; - case 3: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 111; - else - _sceneMode = 110; - break; - default: - break; - } - R2_GLOBALS._player.disableControl(); - _field412 = 1; - signal(); - } - break; - case 1: - if ( ((_object1.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(120, 88)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) - || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) ) - ) { - R2_GLOBALS._player.disableControl(); - _sceneMode = 1201; - setAction(&_sequenceManager, this, 1201, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(120, 69)) == 36) { - switch (_field412 - 1) { - case 0: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 56; - else - _sceneMode = 55; - break; - case 1: - if (R2_GLOBALS._player._visage == 3155) - _sceneMode = 25; - else - _sceneMode = 20; - break; - case 2: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 91; - else - _sceneMode = 90; - break; - case 3: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 121; - else - _sceneMode = 120; - break; - default: - break; - } - R2_GLOBALS._player.disableControl(); - _field412 = 2; - signal(); - } - break; - case 2: - if ( ((_object1.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 110)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) - || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) - ) { - R2_GLOBALS._player.disableControl(); - _sceneMode = 1203; - setAction(&_sequenceManager, this, 1203, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(160, 110)) == 36) { - switch (_field412 - 1) { - case 0: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 51; - else - _sceneMode = 50; - break; - case 1: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 81; - else - _sceneMode = 80; - break; - case 2: - if (R2_GLOBALS._player._visage == 3155) - _sceneMode = 35; - else - _sceneMode = 30; - break; - case 3: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 116; - else - _sceneMode = 115; - break; - default: - break; - } - R2_GLOBALS._player.disableControl(); - _field412 = 3; - signal(); - } - break; - case 3: - if ( ((_object1.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 30)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) - || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) - ) { - R2_GLOBALS._player.disableControl(); - _sceneMode = 1202; - setAction(&_sequenceManager, this, 1202, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(160, 30)) == 36) { - switch (_field412 - 1) { - case 0: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 61; - else - _sceneMode = 60; - break; - case 1: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 71; - else - _sceneMode = 70; - break; - case 2: - if (R2_GLOBALS._player._visage == 3156) - _sceneMode = 96; - else - _sceneMode = 95; - break; - case 3: - if (R2_GLOBALS._player._visage == 3155) - _sceneMode = 45; - else - _sceneMode = 40; - break; - default: - _sceneMode = 1; - R2_GLOBALS._player.setup(3156, 4, 6); - break; - } - R2_GLOBALS._player.disableControl(); - _field412 = 4; - signal(); - } - break; - default: - break; - } +void MazeUI::setDisplayBounds(const Rect &r) { + _displayBounds = r; + _displayBounds.clip(g_globals->gfxManager()._bounds); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 75347f20fa..a40d4fe24e 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -283,7 +283,7 @@ public: Rect _displayBounds; Rect _mapBounds; - byte *_field16; + byte *_mapData; GfxSurface _mapImage; int _field12; @@ -306,11 +306,10 @@ public: void draw(); int getCellFromPixelXY(const Common::Point &pt); int getCellFromCellXY(const Common::Point &p); + int pixelToCellXY(int &arg1, int &arg2); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); - - int sub9EE22(int &arg1, int &arg2); }; class SceneAreaObject: public SceneArea { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index d77a8bd885..fc794873d4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1393,7 +1393,7 @@ void Scene1200::process(Event &event) { return; if (event.eventType == EVENT_BUTTON_DOWN) { - _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + _object1.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); int unk = _object1.getCellFromPixelXY(event.mousePos); switch (R2_GLOBALS._events.getCursor()) { case CURSOR_ARROW: @@ -1605,6 +1605,189 @@ void Scene1200::saveCharacter(int characterIndex) { SceneExt::saveCharacter(characterIndex); } +void Scene1200::sub9DAD6(int indx) { + _object1.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + + switch (indx) { + case 0: + if ( ((_object1.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(200, 88)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) + || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) + || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1200; + setAction(&_sequenceManager, this, 1200, &_actor1, NULL); + } else if (_object1.getCellFromPixelXY(Common::Point(200, 69)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 15; + else + _sceneMode = 10; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 76; + else + _sceneMode = 75; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 101; + else + _sceneMode = 100; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 111; + else + _sceneMode = 110; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 1; + signal(); + } + break; + case 1: + if ( ((_object1.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(120, 88)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) + || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) + || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) + || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1201; + setAction(&_sequenceManager, this, 1201, &_actor1, NULL); + } else if (_object1.getCellFromPixelXY(Common::Point(120, 69)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 56; + else + _sceneMode = 55; + break; + case 1: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 25; + else + _sceneMode = 20; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 91; + else + _sceneMode = 90; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 121; + else + _sceneMode = 120; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 2; + signal(); + } + break; + case 2: + if ( ((_object1.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 110)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) + || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1203; + setAction(&_sequenceManager, this, 1203, &_actor1, NULL); + } else if (_object1.getCellFromPixelXY(Common::Point(160, 110)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 51; + else + _sceneMode = 50; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 81; + else + _sceneMode = 80; + break; + case 2: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 35; + else + _sceneMode = 30; + break; + case 3: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 116; + else + _sceneMode = 115; + break; + default: + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 3; + signal(); + } + break; + case 3: + if ( ((_object1.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 30)) > 36)) + && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) + || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) + ) { + R2_GLOBALS._player.disableControl(); + _sceneMode = 1202; + setAction(&_sequenceManager, this, 1202, &_actor1, NULL); + } else if (_object1.getCellFromPixelXY(Common::Point(160, 30)) == 36) { + switch (_field412 - 1) { + case 0: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 61; + else + _sceneMode = 60; + break; + case 1: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 71; + else + _sceneMode = 70; + break; + case 2: + if (R2_GLOBALS._player._visage == 3156) + _sceneMode = 96; + else + _sceneMode = 95; + break; + case 3: + if (R2_GLOBALS._player._visage == 3155) + _sceneMode = 45; + else + _sceneMode = 40; + break; + default: + _sceneMode = 1; + R2_GLOBALS._player.setup(3156, 4, 6); + break; + } + R2_GLOBALS._player.disableControl(); + _field412 = 4; + signal(); + } + break; + default: + break; + } +} + /*-------------------------------------------------------------------------- * Scene 1337 - Card game * diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 475c743982..2e81bebc04 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3067,7 +3067,7 @@ int Scene3500::MazeUI3500::sub109C09(Common::Point pt) { int vy = pt.y / _cellSize.y; if ((vx >= 0) && (_mapCells.x > vx) && (_mapCells.y > vy)) { - return _field16[((_mapCells.x * vy) + vx) * 2]; + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * vy + vx) * 2); } else return -1; } -- cgit v1.2.3 From 5eaa253732e5caa1def4da8bca4c1916a6919c89 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Jun 2013 23:01:45 -0400 Subject: TSAGE: Renaming of derived R2R scene 3500 Maze UI --- engines/tsage/ringworld2/ringworld2_logic.cpp | 40 ++++++------- engines/tsage/ringworld2/ringworld2_logic.h | 13 +++-- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 78 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes3.h | 8 +-- 4 files changed, 70 insertions(+), 69 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c17fcc9900..9231225487 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1278,9 +1278,12 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i MazeUI::MazeUI() { _mapData = NULL; - _field12 = _field14 = 0; - _mapCells.x = _mapCells.y = _cellSize.x = _cellSize.y = _cellOffset.x = _cellOffset.y = 0; - _resNum = _cellsResNum = _field36 = _field38 = _mapImagePitch = _field40 = 0; + _cellsVisible.x = _cellsVisible.y = 0; + _mapCells.x = _mapCells.y = 0; + _cellSize.x = _cellSize.y = 0; + _cellOffset.x = _cellOffset.y = 0; + _resNum = _cellsResNum = 0; + _frameCount = _resCount = _mapImagePitch = _unused = 0; } MazeUI::~MazeUI() { @@ -1294,13 +1297,9 @@ void MazeUI::synchronize(Serializer &s) { if (s.isLoading()) load(_resNum); - s.syncAsSint16LE(_field12); - s.syncAsSint16LE(_field14); s.syncAsSint16LE(_cellOffset.x); s.syncAsSint16LE(_cellOffset.y); - s.syncAsSint16LE(_field36); - s.syncAsSint16LE(_field38); - s.syncAsSint16LE(_field40); + s.syncAsSint16LE(_unused); } void MazeUI::load(int resNum) { @@ -1312,8 +1311,8 @@ void MazeUI::load(int resNum) { _cellsResNum = resNum + 1000; _mapCells.x = READ_LE_UINT16(header + 2); _mapCells.y = READ_LE_UINT16(header + 4); - _field36 = 10; - _field38 = _field36 << 3; + _frameCount = 10; + _resCount = _frameCount << 3; Visage visage; visage.setVisage(_cellsResNum, 1); @@ -1325,10 +1324,10 @@ void MazeUI::load(int resNum) { _mapData = g_resourceManager->getResource(RT17, resNum, 1); _cellOffset.y = _cellOffset.x = 0; - _field12 = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; - _field14 = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; + _cellsVisible.x = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; + _cellsVisible.y = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; - _mapImagePitch = (_field12 + 1) * _cellSize.x; + _mapImagePitch = (_cellsVisible.x + 1) * _cellSize.x; _mapImage.create(_mapImagePitch, _cellSize.y); _mapBounds = Rect(0, 0, _cellSize.x * _mapCells.x, _cellSize.y * _mapCells.y); @@ -1348,8 +1347,7 @@ void MazeUI::clear() { bool MazeUI::setMazePosition(const Common::Point &pt) { bool retval = false; - _cellOffset.x = pt.x; - _cellOffset.y = pt.y; + _cellOffset = pt; if (_cellOffset.x < _mapBounds.top) { _cellOffset.x = _mapBounds.top; @@ -1379,17 +1377,17 @@ void MazeUI::draw() { int yInc; Visage visage; - for (int yp = 0; yp < _field14; yp += yInc) { + for (int yp = 0; yp < _cellsVisible.y; yp += yInc) { int y = yp + _cellOffset.y / _cellSize.y; - for (int idx = 0; idx > _field12; ++idx) { + for (int idx = 0; idx > _cellsVisible.x; ++idx) { int x = _cellOffset.x / _cellSize.x + idx; int cell = getCellFromCellXY(Common::Point(x, y)); if (cell >= 0) { - int frameNum = (cell % _field36) + 1; - int rlbNum = (cell % _field38) / _field36 + 1; - int resNum = _cellsResNum + (cell / _field38); + int frameNum = (cell % _frameCount) + 1; + int rlbNum = (cell % _resCount) / _frameCount + 1; + int resNum = _cellsResNum + (cell / _resCount); visage.setVisage(resNum, rlbNum); GfxSurface frame = visage.getFrame(frameNum); @@ -1434,7 +1432,7 @@ int MazeUI::getCellFromPixelXY(const Common::Point &pt) { int cellY = (pt.y - _displayBounds.top + _cellOffset.y) / _cellSize.y; if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) - return (int16)READ_LE_UINT16(_mapData + ((_mapCells.x * cellY) + cellX) * 2); + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); return -1; } diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index a40d4fe24e..76bea81065 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -280,23 +280,26 @@ class MazeUI: public SavedObject { private: void clear(); public: + // Position on screen to show map Rect _displayBounds; + // The dimensions (in cells) of the entire maze map Rect _mapBounds; + // Encoded cell map specifying the features of the maze byte *_mapData; + // Image surface used to store a line of the map for rendering GfxSurface _mapImage; - int _field12; - int _field14; + Common::Point _cellsVisible; Common::Point _mapCells; Common::Point _cellSize; Common::Point _cellOffset; int _resNum; int _cellsResNum; - int _field36; - int _field38; + int _frameCount; + int _resCount; int _mapImagePitch; - int _field40; + int _unused; public: MazeUI(); virtual ~MazeUI(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 2e81bebc04..2b42cbd63f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3054,26 +3054,26 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) { /*--------------------------------------------------------------------------*/ -int Scene3500::MazeUI3500::sub1097C9(int arg1) { - return (_cellSize.x / 2) + arg1 - (arg1 % _cellSize.x); +int Scene3500::MazeUI3500::cellFromX(int x) { + return (_cellSize.x / 2) + x - (x % _cellSize.x); } -int Scene3500::MazeUI3500::sub1097EF(int arg1) { - return (_cellSize.y / 2) + arg1 - (arg1 % _cellSize.y); +int Scene3500::MazeUI3500::cellFromY(int y) { + return (_cellSize.y / 2) + y - (y % _cellSize.y); } -int Scene3500::MazeUI3500::sub109C09(Common::Point pt) { - int vx = pt.x / _cellSize.x; - int vy = pt.y / _cellSize.y; +int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { + int cellX = pt.x / _cellSize.x; + int cellY = pt.y / _cellSize.y; - if ((vx >= 0) && (_mapCells.x > vx) && (_mapCells.y > vy)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * vy + vx) * 2); + if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); } else return -1; } -int Scene3500::MazeUI3500::sub109C5E(Common::Point &p) { - int retVal = setMazePosition(p); +bool Scene3500::MazeUI3500::seteMazePosition2(Common::Point &p) { + bool retVal = setMazePosition(p); p = _cellOffset; return retVal; @@ -3224,9 +3224,9 @@ void Scene3500::Action1::signal() { setDelay(1); break; case 4: { - int si = scene->_mazeUI.sub109C09(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); - int var2 = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; - int var4 = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; + int si = scene->_mazeUI.getCellFromMapXY(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); + int var2 = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; + int var4 = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; int di = abs(var2 - scene->_position1.x); int var6 = abs(var4 - scene->_position1.y); @@ -3361,12 +3361,12 @@ void Scene3500::Action1::signal() { case 0: // No break on purpose case 4: - scene->_position1.x = scene->_mazeUI.sub1097C9(scene->_position1.x + 70) - 70; + scene->_position1.x = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; break; case 2: // No break on purpose case 6: - scene->_position1.y = scene->_mazeUI.sub1097EF(scene->_position1.y + 46) - 46; + scene->_position1.y = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; break; default: break; @@ -3824,15 +3824,15 @@ void Scene3500::dispatch() { var127A = _position1.x; di = _position1.y; - var_4 = _mazeUI.sub1097C9(70) - 70; - var_6 = _mazeUI.sub1097EF(_position1.y + 46) - 46; + var_4 = _mazeUI.cellFromX(70) - 70; + var_6 = _mazeUI.cellFromY(_position1.y + 46) - 46; var_8 = abs(var_4 - var127A); var_a = abs(var_6 - di); dx = 0; switch (_field1276) { case 0: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3843,9 +3843,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; di = _position1.y - _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) { di = var_6; R2_GLOBALS._sound2.play(339); @@ -3865,9 +3865,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; var_a = abs(var_6 - di); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_position1.y>= var_6)) || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) { @@ -3898,7 +3898,7 @@ void Scene3500::dispatch() { } break; case 2: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3909,9 +3909,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var127A = _position1.x + _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) { var127A = var_4; R2_GLOBALS._sound2.play(339); @@ -3931,9 +3931,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var_8 = abs(var127A - var_4); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, tmpVar + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, tmpVar + 46)); if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var127A >= var_4) && (_position1.x <= var_4)) || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { var127A = var_4; @@ -3964,7 +3964,7 @@ void Scene3500::dispatch() { } break; case 4: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -3975,9 +3975,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; di = _position1.y + _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4005,9 +4005,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.sub1097EF(di + 46) - 46; + var_6 = _mazeUI.cellFromY(di + 46) - 46; var_a = abs(di - var_6); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_position1.y <= var_6)) || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){ if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15)) @@ -4049,7 +4049,7 @@ void Scene3500::dispatch() { } break; case 6: - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); @@ -4060,9 +4060,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var127A = _position1.x - _field126E; - dx = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) { var127A = var_4; R2_GLOBALS._sound2.play(339); @@ -4082,9 +4082,9 @@ void Scene3500::dispatch() { if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.sub1097C9(var127A + 70) - 70; + var_4 = _mazeUI.cellFromX(var127A + 70) - 70; var_8 = abs(var_4 - var127A); - tmpVar = _mazeUI.sub109C09(Common::Point(var127A + 70, di + 46)); + tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var127A <= var_4) && (_position1.x >= var_4)) || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { var127A = var_4; @@ -4121,7 +4121,7 @@ void Scene3500::dispatch() { if (_field1284 < 2) { _position1.x = var127A; _position1.y = di; - if (_mazeUI.sub109C5E(_position1) != 0) { + if (_mazeUI.seteMazePosition2(_position1) != 0) { _field1272 = 0; _field126E = 0; _field1270 = 0; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 60168c790f..6d7347d6db 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -635,10 +635,10 @@ class Scene3500 : public SceneExt { class MazeUI3500 : public MazeUI { public: - int sub1097C9(int arg1); - int sub1097EF(int arg1); - int sub109C09(Common::Point pt); - int sub109C5E(Common::Point &p); + int cellFromX(int arg1); + int cellFromY(int arg1); + int getCellFromMapXY(Common::Point pt); + bool seteMazePosition2(Common::Point &p); }; public: Action1 _action1; -- cgit v1.2.3 From a075afa48a6acd7e011e8b3e766329eb83f33b7a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 00:00:29 -0400 Subject: TSAGE: R2R Maze UI now partially showing map --- engines/tsage/ringworld2/ringworld2_logic.cpp | 70 ++++++++++++++----------- engines/tsage/ringworld2/ringworld2_logic.h | 2 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 2 +- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 9231225487..ba7ae4e3e5 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1281,7 +1281,7 @@ MazeUI::MazeUI() { _cellsVisible.x = _cellsVisible.y = 0; _mapCells.x = _mapCells.y = 0; _cellSize.x = _cellSize.y = 0; - _cellOffset.x = _cellOffset.y = 0; + _mapOffset.x = _mapOffset.y = 0; _resNum = _cellsResNum = 0; _frameCount = _resCount = _mapImagePitch = _unused = 0; } @@ -1297,8 +1297,8 @@ void MazeUI::synchronize(Serializer &s) { if (s.isLoading()) load(_resNum); - s.syncAsSint16LE(_cellOffset.x); - s.syncAsSint16LE(_cellOffset.y); + s.syncAsSint16LE(_mapOffset.x); + s.syncAsSint16LE(_mapOffset.y); s.syncAsSint16LE(_unused); } @@ -1323,7 +1323,7 @@ void MazeUI::load(int resNum) { _mapData = g_resourceManager->getResource(RT17, resNum, 1); - _cellOffset.y = _cellOffset.x = 0; + _mapOffset.y = _mapOffset.x = 0; _cellsVisible.x = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; _cellsVisible.y = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; @@ -1347,25 +1347,25 @@ void MazeUI::clear() { bool MazeUI::setMazePosition(const Common::Point &pt) { bool retval = false; - _cellOffset = pt; + _mapOffset = pt; - if (_cellOffset.x < _mapBounds.top) { - _cellOffset.x = _mapBounds.top; + if (_mapOffset.x < _mapBounds.top) { + _mapOffset.x = _mapBounds.top; retval = true; } - if (_cellOffset.y < _mapBounds.left) { - _cellOffset.y = _mapBounds.left; + if (_mapOffset.y < _mapBounds.left) { + _mapOffset.y = _mapBounds.left; retval = true; } - if (_cellOffset.x + _displayBounds.width() > _mapBounds.right) { - _cellOffset.x = _mapBounds.right - _displayBounds.width(); + if (_mapOffset.x + _displayBounds.width() > _mapBounds.right) { + _mapOffset.x = _mapBounds.right - _displayBounds.width(); retval = true; } - if (_cellOffset.y + _displayBounds.height() > _mapBounds.bottom) { - _cellOffset.y = _mapBounds.bottom - _displayBounds.height(); + if (_mapOffset.y + _displayBounds.height() > _mapBounds.bottom) { + _mapOffset.y = _mapBounds.bottom - _displayBounds.height(); retval = true; } @@ -1374,16 +1374,20 @@ bool MazeUI::setMazePosition(const Common::Point &pt) { void MazeUI::draw() { int yPos = 0; - int yInc; + int ySize; Visage visage; - for (int yp = 0; yp < _cellsVisible.y; yp += yInc) { - int y = yp + _cellOffset.y / _cellSize.y; + // Loop to handle the cell rows of the visible display area one at a time + for (int yCtr = 0; yCtr < _cellsVisible.y; ++yCtr, yPos += ySize) { + int cellY = _mapOffset.y / _cellSize.y + yCtr; - for (int idx = 0; idx > _cellsVisible.x; ++idx) { - int x = _cellOffset.x / _cellSize.x + idx; + // Loop to iterate through the horizontal visible cells to build up + // an entire cell high horizontal slice of the map + for (int xCtr = 0; xCtr < _cellsVisible.x; ++xCtr) { + int cellX = _mapOffset.x / _cellSize.x + xCtr; - int cell = getCellFromCellXY(Common::Point(x, y)); + // Get the type of content to display in the cell + int cell = getCellFromCellXY(Common::Point(cellX, cellY)); if (cell >= 0) { int frameNum = (cell % _frameCount) + 1; int rlbNum = (cell % _resCount) / _frameCount + 1; @@ -1392,33 +1396,37 @@ void MazeUI::draw() { visage.setVisage(resNum, rlbNum); GfxSurface frame = visage.getFrame(frameNum); - _mapImage.copyFrom(frame, 0, idx); + _mapImage.copyFrom(frame, xCtr * _cellSize.x, 0); } else { GfxSurface emptyRect; emptyRect.create(_cellSize.x, _cellSize.y); - _mapImage.copyFrom(emptyRect, 0, idx); + _mapImage.copyFrom(emptyRect, xCtr * _cellSize.x, 0); } } if (yPos == 0) { + // First line of the map to be displayed - only the bottom portion of that + // first cell row may be visible yPos = _displayBounds.top; - yInc = _cellSize.y - (_cellOffset.y % _cellSize.y); + ySize = _cellSize.y - (_mapOffset.y % _cellSize.y); - Rect srcBounds(_cellOffset.x % _cellSize.x, _cellOffset.y % _cellSize.y, - (_cellOffset.x % _cellSize.x) + _displayBounds.width(), (_cellOffset.y % _cellSize.y) + yInc); - Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + yInc); + Rect srcBounds(_mapOffset.x % _cellSize.x, _mapOffset.y % _cellSize.y, + (_mapOffset.x % _cellSize.x) + _displayBounds.width(), _cellSize.y); + Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize); R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } else { if ((yPos + _cellSize.y) < _displayBounds.bottom) { - yInc = _cellSize.y; + ySize = _cellSize.y; } else { - yInc = _displayBounds.bottom - yPos; + ySize = _displayBounds.bottom - yPos; } - Rect srcBounds(0, _cellOffset.x, _displayBounds.width(), _cellOffset.x + yInc); - Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + yInc); + Rect srcBounds(_mapOffset.x % _cellSize.x, 0, + (_mapOffset.x % _cellSize.x) + _displayBounds.width(), ySize); + Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize); + R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } } @@ -1428,8 +1436,8 @@ int MazeUI::getCellFromPixelXY(const Common::Point &pt) { if (!_displayBounds.contains(pt)) return -1; - int cellX = (pt.x - _displayBounds.left + _cellOffset.x) / _cellSize.x; - int cellY = (pt.y - _displayBounds.top + _cellOffset.y) / _cellSize.y; + int cellX = (pt.x - _displayBounds.left + _mapOffset.x) / _cellSize.x; + int cellY = (pt.y - _displayBounds.top + _mapOffset.y) / _cellSize.y; if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 76bea81065..6829beccc9 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -293,7 +293,7 @@ public: Common::Point _cellsVisible; Common::Point _mapCells; Common::Point _cellSize; - Common::Point _cellOffset; + Common::Point _mapOffset; int _resNum; int _cellsResNum; int _frameCount; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 2b42cbd63f..115fc84587 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3074,7 +3074,7 @@ int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { bool Scene3500::MazeUI3500::seteMazePosition2(Common::Point &p) { bool retVal = setMazePosition(p); - p = _cellOffset; + p = _mapOffset; return retVal; } -- cgit v1.2.3 From ba0e4540b68f32d4f179aecf305e7c71cfadfb26 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sat, 29 Jun 2013 18:33:50 -0400 Subject: TOOLS: Add support for MSVC12 in create_project --- devtools/create_project/create_project.cpp | 8 +- devtools/create_project/msbuild.cpp | 15 +-- devtools/create_project/msvc12/create_project.sln | 20 ++++ .../create_project/msvc12/create_project.vcxproj | 132 +++++++++++++++++++++ .../msvc12/create_project.vcxproj.filters | 71 +++++++++++ dists/msvc12/create_msvc12.bat | 95 +++++++++++++++ dists/msvc12/readme.txt | 6 + 7 files changed, 336 insertions(+), 11 deletions(-) create mode 100644 devtools/create_project/msvc12/create_project.sln create mode 100644 devtools/create_project/msvc12/create_project.vcxproj create mode 100644 devtools/create_project/msvc12/create_project.vcxproj.filters create mode 100644 dists/msvc12/create_msvc12.bat create mode 100644 dists/msvc12/readme.txt diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index a8e09ff5eb..84a6185eda 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) { msvcVersion = atoi(argv[++i]); - if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11) { + if (msvcVersion != 8 && msvcVersion != 9 && msvcVersion != 10 && msvcVersion != 11 && msvcVersion != 12) { std::cerr << "ERROR: Unsupported version: \"" << msvcVersion << "\" passed to \"--msvc-version\"!\n"; return -1; } @@ -609,9 +609,9 @@ void displayHelp(const char *exe) { " (default: false)\n" " --installer Create NSIS installer after the build (implies --build-events)\n" " (default: false)\n" - " --tools Create project files for the devtools\n" - " (ignores --build-events and --installer, as well as engine settings)\n" - " (default: false)\n" + " --tools Create project files for the devtools\n" + " (ignores --build-events and --installer, as well as engine settings)\n" + " (default: false)\n" "\n" "Engines settings:\n" " --list-engines list all available engines and their default state\n" diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 0f77d91852..dd9917e4ee 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -52,6 +52,9 @@ int MSBuildProvider::getVisualStudioVersion() { if (_version == 11) return 2012; + if (_version == 12) + return 2013; + error("Unsupported version passed to getVisualStudioVersion"); } @@ -88,7 +91,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri error("Could not open \"" + projectFile + "\" for writing"); project << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n"; outputConfiguration(project, "Debug", "Win32"); @@ -105,7 +108,7 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri "\t\t{" << uuid << "}\n" "\t\t" << name << "\n" "\t\tWin32Proj\n" - "\t\t$(VCTargetsPath11)\n" + "\t\t$(VCTargetsPath" << _version << ")\n" "\t\n"; // Shared configuration @@ -184,7 +187,7 @@ void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::stri error("Could not open \"" + filtersFile + "\" for writing"); filters << "\n" - "\n"; + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"; // Output the list of filters filters << "\t\n"; @@ -314,9 +317,8 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea definesList += REVISION_DEFINE ";"; properties << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n" - "\t\t<_ProjectFileVersion>10.0.40219.1\n" "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global\n" "\t\t$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)\n" "\t\t$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)\n" @@ -368,12 +370,11 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); properties << "\n" - "\n" + "= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" "\t\n" "\t\t\n" "\t\n" "\t\n" - "\t\t<_ProjectFileVersion>10.0.40219.1\n" "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << outputType << outputBitness << "\n" "\t\t" << (isRelease ? "false" : "true") << "\n" "\t\n" diff --git a/devtools/create_project/msvc12/create_project.sln b/devtools/create_project/msvc12/create_project.sln new file mode 100644 index 0000000000..759d5430f5 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_project", "create_project.vcxproj", "{CF177559-077D-4A08-AABE-BE0FD35F6C63}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.ActiveCfg = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Debug|Win32.Build.0 = Debug|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.ActiveCfg = Release|Win32 + {CF177559-077D-4A08-AABE-BE0FD35F6C63}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/devtools/create_project/msvc12/create_project.vcxproj b/devtools/create_project/msvc12/create_project.vcxproj new file mode 100644 index 0000000000..c26b1e5f45 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {CF177559-077D-4A08-AABE-BE0FD35F6C63} + create_project + $(VCTargetsPath11) + + + + Application + MultiByte + true + v120 + + + Application + MultiByte + v120 + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + true + EnableFastChecks + MultiThreadedDebugDLL + Level4 + EditAndContinue + false + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + MachineX86 + false + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + 4003;4512;4127 + + + Rpcrt4.lib;%(AdditionalDependencies) + true + true + true + MachineX86 + + + @echo off +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc12\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc11\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc10\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc9\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\msvc8\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\codeblocks\" +xcopy /Y "$(TargetPath)" "$(SolutionDir)\..\..\..\dists\iphone\" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/create_project/msvc12/create_project.vcxproj.filters b/devtools/create_project/msvc12/create_project.vcxproj.filters new file mode 100644 index 0000000000..436d1d3436 --- /dev/null +++ b/devtools/create_project/msvc12/create_project.vcxproj.filters @@ -0,0 +1,71 @@ + + + + + {2e3580c8-ec3a-4c81-8351-b668c668db2a} + + + {31aaf58c-d3cb-4ed6-8eca-163b4a9b31a6} + + + {f980f6fb-41b6-4161-b035-58b200c85cad} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + scripts + + + scripts + + + scripts + + + scripts + + + diff --git a/dists/msvc12/create_msvc12.bat b/dists/msvc12/create_msvc12.bat new file mode 100644 index 0000000000..fe12a9b288 --- /dev/null +++ b/dists/msvc12/create_msvc12.bat @@ -0,0 +1,95 @@ +@echo off + +echo. +echo Automatic creation of the MSVC12 project files +echo. + +if "%~1"=="/stable" goto stable +if "%~1"=="/STABLE" goto stable +if "%~1"=="/all" goto all +if "%~1"=="/ALL" goto all +if "%~1"=="/tools" goto tools +if "%~1"=="/TOOLS" goto tools +if "%~1"=="/clean" goto clean_check +if "%~1"=="/CLEAN" goto clean_check +if "%~1"=="/help" goto command_help +if "%~1"=="/HELP" goto command_help +if "%~1"=="/?" goto command_help + +if "%~1"=="" goto check_tool + +echo Invalid command parameter: %~1 +echo. + +:command_help +echo Valid command parameters are: +echo stable Generated stable engines project files +echo all Generate all engines project files +echo tools Generate project files for the devtools +echo clean Clean generated project files +echo help Show help message +goto done + +:check_tool +if not exist create_project.exe goto no_tool + +:question +echo. +set batchanswer=S +set /p batchanswer="Enable stable engines only, or all engines? (S/a)" +if "%batchanswer%"=="s" goto stable +if "%batchanswer%"=="S" goto stable +if "%batchanswer%"=="a" goto all +if "%batchanswer%"=="A" goto all +goto question + +:no_tool +echo create_project.exe not found in the current folder. +echo You need to build it first and copy it in this +echo folder +goto done + +:all +echo. +echo Creating project files with all engines enabled (stable and unstable) +echo. +create_project ..\.. --enable-all-engines --msvc --msvc-version 12 --build-events +goto done + +:stable +echo. +echo Creating normal project files, with only the stable engines enabled +echo. +create_project ..\.. --msvc --msvc-version 12 +goto done + +:tools +echo. +echo Creating tools project files +echo. +create_project ..\.. --tools --msvc --msvc-version 12 +goto done + +:clean_check +echo. +set cleananswer=N +set /p cleananswer="This will remove all project files. Are you sure you want to continue? (N/y)" +if "%cleananswer%"=="n" goto done +if "%cleananswer%"=="N" goto done +if "%cleananswer%"=="y" goto clean +if "%cleananswer%"=="Y" goto clean +goto clean_check + +:clean +echo. +echo Removing all project files +del /Q *.vcxproj* > NUL 2>&1 +del /Q *.props > NUL 2>&1 +del /Q *.sln* > NUL 2>&1 +del /Q scummvm* > NUL 2>&1 +del /Q devtools* > NUL 2>&1 +goto done + +:done +echo. +pause diff --git a/dists/msvc12/readme.txt b/dists/msvc12/readme.txt new file mode 100644 index 0000000000..760f9ff601 --- /dev/null +++ b/dists/msvc12/readme.txt @@ -0,0 +1,6 @@ +The Visual Studio project files can now be created automatically from the GCC +files using the create_project tool inside the /devtools/create_project folder. + +To create the default project files, build create_project.exe, copy it inside +this folder and run the create_msvc12.bat file for a default build. You can run +create_project.exe with no parameters to check the possible command-line options -- cgit v1.2.3 From 1e40570ec0f8b53f8cb3fd579c89f7956840175e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 08:16:40 -0400 Subject: TSAGE: Fix handle leak in resource manager --- engines/tsage/core.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 4a90e23a33..131b70c4bd 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3157,6 +3157,8 @@ void Visage::setVisage(int resNum, int rlbNum) { _flipHoriz = flags & 1; _data = g_resourceManager->getResource(RES_VISAGE, resNum, rlbNum); + + DEALLOCATE(indexData); } } -- cgit v1.2.3 From 8ec07246e605d4be6abc935fd50ff05b1af9035a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 08:39:26 -0400 Subject: TSAGE: Fix to display R2R maze map correctly --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ba7ae4e3e5..3f062d0c6e 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1387,7 +1387,7 @@ void MazeUI::draw() { int cellX = _mapOffset.x / _cellSize.x + xCtr; // Get the type of content to display in the cell - int cell = getCellFromCellXY(Common::Point(cellX, cellY)); + int cell = getCellFromCellXY(Common::Point(cellX, cellY)) - 1; if (cell >= 0) { int frameNum = (cell % _frameCount) + 1; int rlbNum = (cell % _resCount) / _frameCount + 1; -- cgit v1.2.3 From 45ea2e0979d6329e5e978dda6438d3154956c6ac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 09:44:42 -0400 Subject: TSAGE: Starting to move in R2R scene 3500 maze --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 340 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes3.h | 6 +- 2 files changed, 173 insertions(+), 173 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 115fc84587..55303cfa42 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3072,7 +3072,7 @@ int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { return -1; } -bool Scene3500::MazeUI3500::seteMazePosition2(Common::Point &p) { +bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) { bool retVal = setMazePosition(p); p = _mapOffset; @@ -3083,14 +3083,14 @@ Scene3500::Scene3500() { _fieldAF8 = 0; _fieldB9E = 0; _rotation = NULL; - _field126E = 0; + _mazeChangeAmount = 0; _field1270 = 0; _field1272 = 0; _field1274 = 0; _field1276 = 0; _field1278 = 0; - _position1.x = 0; - _position1.y = 0; + _mazePosition.x = 0; + _mazePosition.y = 0; _field127E = 0; _field1280 = 0; _field1282 = 0; @@ -3104,14 +3104,14 @@ void Scene3500::synchronize(Serializer &s) { s.syncAsSint16LE(_fieldAF8); s.syncAsSint16LE(_fieldB9E); - s.syncAsSint16LE(_field126E); + s.syncAsSint16LE(_mazeChangeAmount); s.syncAsSint16LE(_field1270); s.syncAsSint16LE(_field1272); s.syncAsSint16LE(_field1274); s.syncAsSint16LE(_field1276); s.syncAsSint16LE(_field1278); - s.syncAsSint16LE(_position1.x); - s.syncAsSint16LE(_position1.y); + s.syncAsSint16LE(_mazePosition.x); + s.syncAsSint16LE(_mazePosition.y); s.syncAsSint16LE(_field127E); s.syncAsSint16LE(_field1280); s.syncAsSint16LE(_field1282); @@ -3207,7 +3207,7 @@ void Scene3500::Action1::signal() { scene->_field1286 = 0; if (scene->_field1270 != 0) { scene->_field1270 = 0; - scene->_field126E = 0; + scene->_mazeChangeAmount = 0; scene->_field1272 = 0; scene->_rotation->_idxChange = 0; } @@ -3224,11 +3224,11 @@ void Scene3500::Action1::signal() { setDelay(1); break; case 4: { - int si = scene->_mazeUI.getCellFromMapXY(Common::Point(scene->_position1.x + 70, scene->_position1.y + 46)); - int var2 = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; - int var4 = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; - int di = abs(var2 - scene->_position1.x); - int var6 = abs(var4 - scene->_position1.y); + int si = scene->_mazeUI.getCellFromMapXY(Common::Point(scene->_mazePosition.x + 70, scene->_mazePosition.y + 46)); + int var2 = scene->_mazeUI.cellFromX(scene->_mazePosition.x + 70) - 70; + int var4 = scene->_mazeUI.cellFromY(scene->_mazePosition.y + 46) - 46; + int di = abs(var2 - scene->_mazePosition.x); + int var6 = abs(var4 - scene->_mazePosition.y); if ((scene->_actor1._frame % 2) != 0) { scene->_actor1._frameChange = _field1E; @@ -3296,14 +3296,14 @@ void Scene3500::Action1::signal() { // No break on purpose case 2: { scene->_actor8.setPosition(Common::Point(160, 73)); - scene->_actor8._moveDiff.x = 160 - scene->_field126E; + scene->_actor8._moveDiff.x = 160 - scene->_mazeChangeAmount; scene->_fieldAF8 = 160 - ((_field1E * 2) * 160); Common::Point pt(scene->_fieldAF8, 73); NpcMover *mover = new NpcMover(); scene->_actor8.addMover(mover, &pt, this); scene->_actor9.setPosition(Common::Point(160 + ((_field1E * 2) * 160), 73)); - scene->_actor9._moveDiff.x = 160 - scene->_field126E; + scene->_actor9._moveDiff.x = 160 - scene->_mazeChangeAmount; scene->_fieldB9E = 160; Common::Point pt2(scene->_fieldB9E, 73); NpcMover *mover2 = new NpcMover(); @@ -3361,12 +3361,12 @@ void Scene3500::Action1::signal() { case 0: // No break on purpose case 4: - scene->_position1.x = scene->_mazeUI.cellFromX(scene->_position1.x + 70) - 70; + scene->_mazePosition.x = scene->_mazeUI.cellFromX(scene->_mazePosition.x + 70) - 70; break; case 2: // No break on purpose case 6: - scene->_position1.y = scene->_mazeUI.cellFromY(scene->_position1.y + 46) - 46; + scene->_mazePosition.y = scene->_mazeUI.cellFromY(scene->_mazePosition.y + 46) - 46; break; default: break; @@ -3376,7 +3376,7 @@ void Scene3500::Action1::signal() { _field24 = 0; if (_field20 == 0) { scene->_actor7.sub1094ED(); - if (scene->_field126E == scene->_field1270) + if (scene->_mazeChangeAmount == scene->_field1270) scene->_aSound1.play(276); } break; @@ -3424,7 +3424,7 @@ void Scene3500::Action1::dispatch() { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; Action::dispatch(); - if ((_actionIndex == 1) && (scene->_field126E <= 4)) { + if ((_actionIndex == 1) && (scene->_mazeChangeAmount <= 4)) { scene->_rotation->_idxChange = 0; signal(); } @@ -3460,17 +3460,17 @@ void Scene3500::Action2::signal() { di = scene->_fieldB9E; } - scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2); + scene->_actor8._moveDiff.y = 9 - (scene->_mazeChangeAmount / 2); Common::Point pt(si, 73 - (_field1E * 12)); NpcMover *mover = new NpcMover(); scene->_actor8.addMover(mover, &pt, NULL); - scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2); + scene->_actor9._moveDiff.y = 9 - (scene->_mazeChangeAmount / 2); Common::Point pt2(di, 73 - (_field1E * 12)); NpcMover *mover2 = new NpcMover(); scene->_actor9.addMover(mover2, &pt2, NULL); - scene->_field126E = (scene->_field126E / 2) + (scene->_field126E % 2); - setDelay(17 - scene->_field126E); + scene->_mazeChangeAmount = (scene->_mazeChangeAmount / 2) + (scene->_mazeChangeAmount % 2); + setDelay(17 - scene->_mazeChangeAmount); } break; case 1: { @@ -3485,12 +3485,12 @@ void Scene3500::Action2::signal() { scene->_actor7.sub1094ED(); - scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2); + scene->_actor8._moveDiff.y = 9 - (scene->_mazeChangeAmount / 2); Common::Point pt(si, 73); NpcMover *mover = new NpcMover(); scene->_actor8.addMover(mover, &pt, NULL); - scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2); + scene->_actor9._moveDiff.y = 9 - (scene->_mazeChangeAmount / 2); Common::Point pt2(di, 73); NpcMover *mover2 = new NpcMover(); scene->_actor9.addMover(mover2, &pt2, NULL); @@ -3581,9 +3581,9 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _field1278 = 0; _field1272 = 1; _field1270 = 4; - _field126E = 4; - _position1.x = 860; - _position1.y = 891; + _mazeChangeAmount = 4; + _mazePosition.x = 860; + _mazePosition.y = 891; _rotation = R2_GLOBALS._scenePalette.addRotation(240, 254, -1); _rotation->setDelay(0); _rotation->_idxChange = 1; @@ -3661,7 +3661,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _actor6.hide(); _actor2.postInit(); - _actor2.setup(1004, 4, _field126E + 1); + _actor2.setup(1004, 4, _mazeChangeAmount + 1); _actor2.setPosition(Common::Point(126, 137)); _actor2.fixPriority(200); @@ -3672,7 +3672,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _mazeUI.setDisplayBounds(Rect(160, 89, 299, 182)); _mazeUI.load(2); - _mazeUI.setMazePosition(_position1); + _mazeUI.setMazePosition(_mazePosition); _action1._field24 = 0; _mazeUI.draw(); @@ -3806,90 +3806,90 @@ void Scene3500::dispatch() { if (!_rotation) return; - int var127A = 0; - int di = 0; + int newMazeX = 0; + int newMazeY = 0; int var_4 = 0; int var_6 = 0; int var_8 = 0; int var_a = 0; int dx = 0; - int tmpVar = 0; + int cellId = 0; - if ((_field126E == 0) && (_field1282 == 0)) { + if ((_mazeChangeAmount == 0) && (_field1282 == 0)) { if (_field1284 == 2) R2_GLOBALS._sceneManager.changeScene(1000); } else { _field1282 = 0; tmpRect.set(160, 89, 299, 182); - var127A = _position1.x; - di = _position1.y; + newMazeX = _mazePosition.x; + newMazeY = _mazePosition.y; var_4 = _mazeUI.cellFromX(70) - 70; - var_6 = _mazeUI.cellFromY(_position1.y + 46) - 46; - var_8 = abs(var_4 - var127A); - var_a = abs(var_6 - di); + var_6 = _mazeUI.cellFromY(_mazePosition.y + 46) - 46; + var_8 = abs(var_4 - newMazeX); + var_a = abs(var_6 - newMazeY); dx = 0; - switch (_field1276) { + switch (_field1276 - 1) { case 0: - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, 46)); - if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) - || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( ((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) + || (((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.cellFromY(di + 46) - 46; - di = _position1.y - _field126E; - dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) { - di = var_6; + var_6 = _mazeUI.cellFromY(newMazeY + 46) - 46; + newMazeY = _mazePosition.y - _mazeChangeAmount; + dx = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if (((cellId == 23) || (cellId == 24) || (cellId == 4)) && (cellId != dx)) { + newMazeY = var_6; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 11) && (tmpVar != dx)) { - di = var_6 + 3; + } else if ((cellId == 11) && (cellId != dx)) { + newMazeY = var_6 + 3; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.cellFromY(di + 46) - 46; - var_a = abs(var_6 - di); - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - - if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_position1.y>= var_6)) - || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) { - di = var_6; - if ((tmpVar != 25) && (tmpVar != 26) && (tmpVar != 5) && (tmpVar != 14) && (tmpVar == 15)) + var_6 = _mazeUI.cellFromY(newMazeY + 46) - 46; + var_a = abs(var_6 - newMazeY); + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + + if ( (((cellId == 23) || (cellId == 24) || (cellId == 4)) && (newMazeY <= var_6) && (_mazePosition.y>= var_6)) + || (((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15)) && (_mazeChangeAmount >= var_a) && (_mazeChangeAmount > 3) && (_action1._field24 != 0)) ) { + newMazeY = var_6; + if ((cellId != 25) && (cellId != 26) && (cellId != 5) && (cellId != 14) && (cellId == 15)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 11) && (var_6 + 3 >= di) && (_position1.y >= var_6 + 3)) { + } else if ((cellId == 11) && (var_6 + 3 >= newMazeY) && (_mazePosition.y >= var_6 + 3)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { - var127A = var_4; + } else if (((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15)) && (var_8 != 0) && (var_8 <= 3)) { + newMazeX = var_4; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -3898,64 +3898,64 @@ void Scene3500::dispatch() { } break; case 2: - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) - || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( ((cellId == 12) || (cellId == 13) || (cellId == 11) || (cellId == 16) || (cellId == 31)) + || (((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.cellFromX(var127A + 70) - 70; - var127A = _position1.x + _field126E; - dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) { - var127A = var_4; + var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; + newMazeX = _mazePosition.x + _mazeChangeAmount; + dx = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if (((cellId == 26) || (cellId == 24) || (cellId == 15)) && (cellId != dx)) { + newMazeX = var_4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 6) && (tmpVar != dx)) { - var127A = var_4 - 5; + } else if ((cellId == 6) && (cellId != dx)) { + newMazeX = var_4 - 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.cellFromX(var127A + 70) - 70; - var_8 = abs(var127A - var_4); - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, tmpVar + 46)); - if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var127A >= var_4) && (_position1.x <= var_4)) - || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { - var127A = var_4; - if ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) + var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; + var_8 = abs(newMazeX - var_4); + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, cellId + 46)); + if ( (((cellId == 26) || (cellId == 24) || (cellId == 15)) && (newMazeX >= var_4) && (_mazePosition.x <= var_4)) + || (((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) && (_mazeChangeAmount >= var_8) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ) { + newMazeX = var_4; + if ((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 6) && (var_4 - 5 <= var127A) && (_position1.x <= var_4 - 5)) { - var127A = var_4 - 5; + } else if ((cellId == 6) && (var_4 - 5 <= newMazeX) && (_mazePosition.x <= var_4 - 5)) { + newMazeX = var_4 - 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) { - di = var_6; + } else if (((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) && (var_a != 0) && (var_a <= 3)) { + newMazeY = var_6; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -3964,83 +3964,83 @@ void Scene3500::dispatch() { } break; case 4: - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1)) - || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) { + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( ((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) + || (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (var_8 > 3)) ) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.cellFromY(di + 46) - 46; - di = _position1.y + _field126E; - dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) { + var_6 = _mazeUI.cellFromY(newMazeY + 46) - 46; + newMazeY = _mazePosition.y + _mazeChangeAmount; + dx = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (cellId == dx)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 16) && (tmpVar == dx)) { - di = var_6 - 3; + } else if ((cellId == 16) && (cellId == dx)) { + newMazeY = var_6 - 3; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 31) && (tmpVar == dx)) { - di = var_6 + 4; + } else if ((cellId == 31) && (cellId == dx)) { + newMazeY = var_6 + 4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_6 = _mazeUI.cellFromY(di + 46) - 46; - var_a = abs(di - var_6); - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_position1.y <= var_6)) - || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){ - if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15)) + var_6 = _mazeUI.cellFromY(newMazeY + 46) - 46; + var_a = abs(newMazeY - var_6); + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (newMazeY >= var_6) && (_mazePosition.y <= var_6)) + || (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (_mazeChangeAmount >= var_a) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ){ + if ((cellId != 23) && (cellId != 24) && (cellId != 4) && (cellId != 14) && (cellId != 15)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 16) && (var_6 - 3 <= di) && (_position1.y <= var_6 - 3)) { - di = var_6 - 3; + } else if ((cellId == 16) && (var_6 - 3 <= newMazeY) && (_mazePosition.y <= var_6 - 3)) { + newMazeY = var_6 - 3; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 31) && (var_6 + 4 <= di) && (_position1.y <= var_6 + 4)) { - di = var_6 + 4; + } else if ((cellId == 31) && (var_6 + 4 <= newMazeY) && (_mazePosition.y <= var_6 + 4)) { + newMazeY = var_6 + 4; _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - if ((var127A == 660) && (_field126E + 306 <= di) && (di <= 307)) + if ((newMazeX == 660) && (_mazeChangeAmount + 306 <= newMazeY) && (newMazeY <= 307)) ++_field1284; else R2_GLOBALS._sound2.play(339); - } else if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) { - var127A = var_4; + } else if (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (var_8 != 0) && (var_8 <= 3)) { + newMazeX = var_4; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -4049,64 +4049,64 @@ void Scene3500::dispatch() { } break; case 6: - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31)) - || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) { + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( ((cellId == 12) || (cellId == 13) || (cellId == 11) || (cellId == 16) || (cellId == 31)) + || (((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4)) && (var_a > 3)) ) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.cellFromX(var127A + 70) - 70; - var127A = _position1.x - _field126E; - dx = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) { - var127A = var_4; + var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; + newMazeX = _mazePosition.x - _mazeChangeAmount; + dx = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if (((cellId == 25) || (cellId == 23) || (cellId == 14)) && (cellId != dx)) { + newMazeX = var_4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 1) && (tmpVar != dx)) { - var127A = var_4 + 5; + } else if ((cellId == 1) && (cellId != dx)) { + newMazeX = var_4 + 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); } else { - var_4 = _mazeUI.cellFromX(var127A + 70) - 70; - var_8 = abs(var_4 - var127A); - tmpVar = _mazeUI.getCellFromMapXY(Common::Point(var127A + 70, di + 46)); - if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var127A <= var_4) && (_position1.x >= var_4)) - || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) { - var127A = var_4; - if ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) + var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; + var_8 = abs(var_4 - newMazeX); + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); + if ( (((cellId == 25) || (cellId == 23) || (cellId == 14)) && (newMazeX <= var_4) && (_mazePosition.x >= var_4)) + || (((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4)) && (_mazeChangeAmount >= var_8) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ) { + newMazeX = var_4; + if ((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((tmpVar == 1) && (var127A >= var_4 + 5) && (_position1.x >= var_4 + 5)) { - var127A = var_4 + 5; + } else if ((cellId == 1) && (newMazeX >= var_4 + 5) && (_mazePosition.x >= var_4 + 5)) { + newMazeX = var_4 + 5; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) { - di = var_6; + } else if (((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4)) && (var_a != 0) && (var_a <= 3)) { + newMazeY = var_6; R2_GLOBALS._sound2.play(339); } else { // Nothing @@ -4119,11 +4119,11 @@ void Scene3500::dispatch() { } if (_field1284 < 2) { - _position1.x = var127A; - _position1.y = di; - if (_mazeUI.seteMazePosition2(_position1) != 0) { + _mazePosition.x = newMazeX; + _mazePosition.y = newMazeY; + if (_mazeUI.setMazePosition2(_mazePosition) != 0) { _field1272 = 0; - _field126E = 0; + _mazeChangeAmount = 0; _field1270 = 0; _rotation->setDelay(0); _rotation->_idxChange = 0; @@ -4136,32 +4136,32 @@ void Scene3500::dispatch() { } if (_field1272 == 0) { - if (_field126E != _field1270) { - if (_field126E >= _field1270) { - if (_field126E == 1) { + if (_mazeChangeAmount != _field1270) { + if (_mazeChangeAmount >= _field1270) { + if (_mazeChangeAmount == 1) { if (_action1._field24 != 0) { - if ( ((_field1276 == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15))) - || ((_field1276 == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4))) - || ((_field1276 == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15))) - || ((_field1276 == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4))) ){ - _field126E = 1; + if ( ((_field1276 == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15))) + || ((_field1276 == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4))) + || ((_field1276 == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15))) + || ((_field1276 == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4))) ){ + _mazeChangeAmount = 1; } else - _field126E--; + _mazeChangeAmount--; } else - _field126E--; + _mazeChangeAmount--; } else - _field126E--; + _mazeChangeAmount--; } else - ++_field126E; + ++_mazeChangeAmount; _field1272 = 1; } - _actor2.setFrame2(_field126E); + _actor2.setFrame2(_mazeChangeAmount); } if (_field1272 == 1) { - if (_field126E == 0) + if (_mazeChangeAmount == 0) _rotation->_idxChange = 0; - else if (_field126E > 8) + else if (_mazeChangeAmount > 8) _rotation->_idxChange = 2; else _rotation->_idxChange = 1; @@ -4170,9 +4170,9 @@ void Scene3500::dispatch() { if (_field1272 != 0) _field1272--; - if (_field126E != 0) { + if (_mazeChangeAmount != 0) { R2_GLOBALS._player._uiEnabled = false; - if (_field126E != _field1270) + if (_mazeChangeAmount != _field1270) _aSound1.play(276); } else { R2_GLOBALS._player._uiEnabled = true; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 6d7347d6db..ead2d3b019 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -638,7 +638,7 @@ class Scene3500 : public SceneExt { int cellFromX(int arg1); int cellFromY(int arg1); int getCellFromMapXY(Common::Point pt); - bool seteMazePosition2(Common::Point &p); + bool setMazePosition2(Common::Point &p); }; public: Action1 _action1; @@ -666,13 +666,13 @@ public: int _fieldAF8; int _fieldB9E; PaletteRotation *_rotation; - int _field126E; + int _mazeChangeAmount; int _field1270; int _field1272; int _field1274; int _field1276; int _field1278; - Common::Point _position1; + Common::Point _mazePosition; int _field127E; int _field1280; int _field1282; -- cgit v1.2.3 From 755f6c30a26cb3de583fcb917db36f4b4f07aa5c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 10:02:37 -0400 Subject: TSAGE: Fix moving past intersection in R2R scene 3500 maze --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 55303cfa42..4590ad9581 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3824,7 +3824,7 @@ void Scene3500::dispatch() { newMazeX = _mazePosition.x; newMazeY = _mazePosition.y; - var_4 = _mazeUI.cellFromX(70) - 70; + var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; var_6 = _mazeUI.cellFromY(_mazePosition.y + 46) - 46; var_8 = abs(var_4 - newMazeX); var_a = abs(var_6 - newMazeY); @@ -3833,8 +3833,8 @@ void Scene3500::dispatch() { switch (_field1276 - 1) { case 0: cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); - if ( ((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) - || (((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15)) && (var_8 > 3)) ) { + if (((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) || + ((cellId == 25 || cellId == 26 || cellId == 5 || cellId == 14 || cellId == 15) && var_8 > 3)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; -- cgit v1.2.3 From 8e77285bc7646333b1dc3878bee577c87a9edd19 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 10:28:21 -0400 Subject: TSAGE: Set up a maze direction enum for R2R mazes --- engines/tsage/ringworld2/ringworld2_logic.h | 2 ++ engines/tsage/ringworld2/ringworld2_scenes3.cpp | 40 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes3.h | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 6829beccc9..17c85bbdf3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -276,6 +276,8 @@ public: } }; +enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_EAST = 3, MAZEDIR_SOUTH = 5, MAZEDIR_WEST = 7 }; + class MazeUI: public SavedObject { private: void clear(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 4590ad9581..84ec927fc3 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3087,7 +3087,7 @@ Scene3500::Scene3500() { _field1270 = 0; _field1272 = 0; _field1274 = 0; - _field1276 = 0; + _mazeDirection = MAZEDIR_NONE; _field1278 = 0; _mazePosition.x = 0; _mazePosition.y = 0; @@ -3108,7 +3108,7 @@ void Scene3500::synchronize(Serializer &s) { s.syncAsSint16LE(_field1270); s.syncAsSint16LE(_field1272); s.syncAsSint16LE(_field1274); - s.syncAsSint16LE(_field1276); + s.syncAsSint16LE(_mazeDirection); s.syncAsSint16LE(_field1278); s.syncAsSint16LE(_mazePosition.x); s.syncAsSint16LE(_mazePosition.y); @@ -3235,7 +3235,7 @@ void Scene3500::Action1::signal() { scene->_actor1.setFrame(scene->_actor1.changeFrame()); } - int var8 = (scene->_action1._field1E * 2 + scene->_field1276); + int var8 = (scene->_action1._field1E * 2 + scene->_mazeDirection); if (var8 > 7) var8 = 1; else if (var8 < 1) @@ -3312,8 +3312,8 @@ void Scene3500::Action1::signal() { break; case 5: scene->_actor1._frameChange = _field1E; - scene->_field1276 = scene->_actor1.changeFrame(); - scene->_actor1.setFrame(scene->_field1276); + scene->_mazeDirection = scene->_actor1.changeFrame(); + scene->_actor1.setFrame(scene->_mazeDirection); setDelay(1); break; case 6: @@ -3333,8 +3333,8 @@ void Scene3500::Action1::signal() { case 7: if ((scene->_actor1._frame % 2) == 0) { scene->_actor1._frameChange = _field1E; - scene->_field1276 = scene->_actor1.changeFrame(); - scene->_actor1.setFrame(scene->_field1276); + scene->_mazeDirection = scene->_actor1.changeFrame(); + scene->_actor1.setFrame(scene->_mazeDirection); } setDelay(1); break; @@ -3350,7 +3350,7 @@ void Scene3500::Action1::signal() { // but it's clearly a cut and paste error from case 4. // The following code allows the switch to work properly. warning("Checkme: fix for dead code"); - int var_8 = (_field1E * 2 + scene->_field1276); + int var_8 = (_field1E * 2 + scene->_mazeDirection); if (var_8 > 7) var_8 = 1; else if (var_8 < 1) @@ -3637,8 +3637,8 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _item1.setDetails(Rect(0, 0, 320, 200), 3500, 0, -1, 2, 1, NULL); _actor1.postInit(); - _field1276 = 1; - _actor1.setup(1004, 1, _field1276); + _mazeDirection = 1; + _actor1.setup(1004, 1, _mazeDirection); _actor1.setPosition(Common::Point(230, 135)); _actor1.fixPriority(200); _actor1._frameChange = 1; @@ -3794,7 +3794,7 @@ void Scene3500::dispatch() { if (((_actor1._frame % 2) == 0) && (_action1._field24 == 0)) { _actor1.setFrame(_actor1.changeFrame()); - _field1276 = _actor1._frame; + _mazeDirection = _actor1._frame; } int oldField1278; if ((_field1278 != 0) && (_action1._field24 == 0)) { @@ -3830,8 +3830,8 @@ void Scene3500::dispatch() { var_a = abs(var_6 - newMazeY); dx = 0; - switch (_field1276 - 1) { - case 0: + switch (_mazeDirection) { + case MAZEDIR_NORTH: cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if (((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) || ((cellId == 25 || cellId == 26 || cellId == 5 || cellId == 14 || cellId == 15) && var_8 > 3)) { @@ -3897,7 +3897,7 @@ void Scene3500::dispatch() { } } break; - case 2: + case MAZEDIR_EAST: cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if ( ((cellId == 12) || (cellId == 13) || (cellId == 11) || (cellId == 16) || (cellId == 31)) || (((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) && (var_a > 3)) ) { @@ -3963,7 +3963,7 @@ void Scene3500::dispatch() { } } break; - case 4: + case MAZEDIR_SOUTH: cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if ( ((cellId == 2) || (cellId == 3) || (cellId == 6) || (cellId == 1)) || (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (var_8 > 3)) ) { @@ -4048,7 +4048,7 @@ void Scene3500::dispatch() { } } break; - case 6: + case MAZEDIR_WEST: cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if ( ((cellId == 12) || (cellId == 13) || (cellId == 11) || (cellId == 16) || (cellId == 31)) || (((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4)) && (var_a > 3)) ) { @@ -4140,10 +4140,10 @@ void Scene3500::dispatch() { if (_mazeChangeAmount >= _field1270) { if (_mazeChangeAmount == 1) { if (_action1._field24 != 0) { - if ( ((_field1276 == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15))) - || ((_field1276 == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4))) - || ((_field1276 == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15))) - || ((_field1276 == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4))) ){ + if ( ((_mazeDirection == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 25) || (cellId == 26) || (cellId == 5) || (cellId == 14) || (cellId == 15))) + || ((_mazeDirection == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4))) + || ((_mazeDirection == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15))) + || ((_mazeDirection == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((cellId == 26) || (cellId == 24) || (cellId == 15) || (cellId == 5) || (cellId == 4))) ){ _mazeChangeAmount = 1; } else _mazeChangeAmount--; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index ead2d3b019..ec4ea86e45 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -670,7 +670,7 @@ public: int _field1270; int _field1272; int _field1274; - int _field1276; + int _mazeDirection; int _field1278; Common::Point _mazePosition; int _field127E; -- cgit v1.2.3 From 9a88fe848576e63b2fa2ab79e087ae34c21bb5d1 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 30 Jun 2013 18:59:13 +0200 Subject: GOB: Add hypothetical 32bpp support --- engines/gob/surface.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 6b65eb6ab9..839378a412 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -45,7 +45,7 @@ static void plotPixel(int x, int y, int color, void *data) { Pixel::Pixel(byte *vidMem, uint8 bpp, byte *min, byte *max) : _vidMem(vidMem), _bpp(bpp), _min(min), _max(max) { - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); assert(_vidMem >= _min); assert(_vidMem < _max); } @@ -91,6 +91,8 @@ uint32 Pixel::get() const { return *((byte *) _vidMem); if (_bpp == 2) return *((uint16 *) _vidMem); + if (_bpp == 4) + return *((uint32 *) _vidMem); return 0; } @@ -103,6 +105,8 @@ void Pixel::set(uint32 p) { *((byte *) _vidMem) = (byte) p; if (_bpp == 2) *((uint16 *) _vidMem) = (uint16) p; + if (_bpp == 4) + *((uint32 *) _vidMem) = (uint32) p; } bool Pixel::isValid() const { @@ -113,7 +117,7 @@ bool Pixel::isValid() const { ConstPixel::ConstPixel(const byte *vidMem, uint8 bpp, const byte *min, const byte *max) : _vidMem(vidMem), _bpp(bpp), _min(min), _max(max) { - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); assert(_vidMem >= _min); assert(_vidMem < _max); } @@ -159,6 +163,8 @@ uint32 ConstPixel::get() const { return *((const byte *) _vidMem); if (_bpp == 2) return *((const uint16 *) _vidMem); + if (_bpp == 4) + return *((const uint32 *) _vidMem); return 0; } @@ -172,7 +178,7 @@ Surface::Surface(uint16 width, uint16 height, uint8 bpp, byte *vidMem) : _width(width), _height(height), _bpp(bpp), _vidMem(vidMem) { assert((_width > 0) && (_height > 0)); - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); if (!_vidMem) { _vidMem = new byte[_bpp * _width * _height]; @@ -187,7 +193,7 @@ Surface::Surface(uint16 width, uint16 height, uint8 bpp, const byte *vidMem) : _width(width), _height(height), _bpp(bpp), _vidMem(0) { assert((_width > 0) && (_height > 0)); - assert((_bpp == 1) || (_bpp == 2)); + assert((_bpp == 1) || (_bpp == 2) || (_bpp == 4)); _vidMem = new byte[_bpp * _width * _height]; _ownVidMem = true; @@ -504,7 +510,7 @@ void Surface::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uin return; } - assert(_bpp == 2); + assert((_bpp == 2) || (_bpp == 4)); // Otherwise, we have to fill by pixel -- cgit v1.2.3 From 231586d924c03eeb8b9fb825cc87e5dd56aa0500 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 30 Jun 2013 18:59:38 +0200 Subject: VIDEO: Add hypothetical 32bpp support --- video/codecs/indeo3.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp index 7bf7fc8235..65fb6dac62 100644 --- a/video/codecs/indeo3.cpp +++ b/video/codecs/indeo3.cpp @@ -322,6 +322,8 @@ const Graphics::Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream * *((uint8 *)rowDest) = (uint8)color; else if (_surface->format.bytesPerPixel == 2) *((uint16 *)rowDest) = (uint16)color; + else if (_surface->format.bytesPerPixel == 4) + *((uint32 *)rowDest) = (uint32)color; } } -- cgit v1.2.3 From 4b3f5149b522aafe884219284a2bef2ff3adb8ec Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 30 Jun 2013 19:07:04 +0200 Subject: VIDEO: Add hypothetical 32bpp support --- video/coktel_decoder.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index d24a021f3b..4c3b6f8414 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -2426,8 +2426,10 @@ void VMDDecoder::blit16(const Graphics::Surface &srcSurf, Common::Rect &rect) { if ((r == 0) && (g == 0) && (b == 0)) c = 0; - if (_surface.format.bytesPerPixel == 2) + if (_surface.format.bytesPerPixel == 2) *((uint16 *)dstRow) = (uint16) c; + else if (_surface.format.bytesPerPixel == 4) + *((uint32 *)dstRow) = (uint32) c; } src += srcSurf .pitch; @@ -2462,8 +2464,10 @@ void VMDDecoder::blit24(const Graphics::Surface &srcSurf, Common::Rect &rect) { if ((r == 0) && (g == 0) && (b == 0)) c = 0; - if (_surface.format.bytesPerPixel == 2) + if (_surface.format.bytesPerPixel == 2) *((uint16 *)dstRow) = (uint16) c; + else if (_surface.format.bytesPerPixel == 4) + *((uint32 *)dstRow) = (uint32) c; } src += srcSurf .pitch; -- cgit v1.2.3 From 0205c9754d25ff5858a383178176969fde23d8ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 15:23:38 -0400 Subject: TSAGE: Added extra entries for diagonals to MazeDirection enum --- engines/tsage/ringworld2/ringworld2_logic.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 17c85bbdf3..576482b3eb 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -276,7 +276,9 @@ public: } }; -enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_EAST = 3, MAZEDIR_SOUTH = 5, MAZEDIR_WEST = 7 }; +enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_NORTHEAST = 2, MAZEDIR_EAST = 3, + MAZEDIR_SOUTHEAST = 4, MAZEDIR_SOUTH = 5, MAZEDIR_SOUTHWEST = 6, MAZEDIR_WEST = 7, + MAZEDIR_NORTHWEST = 8 }; class MazeUI: public SavedObject { private: -- cgit v1.2.3 From 730a1373d9837c340e6e646aaa4fbdce4574620a Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 30 Jun 2013 13:26:07 -0600 Subject: MORTEVIELLE: Fix access to free'ed memory Two buffers were allocated and then free'ed in initialise(), which caused memory issues when accessed later on throughout the game. They are now free'ed from the MortevielleEngine destructor. --- engines/mortevielle/mortevielle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 6977ab47c0..7220cd6b58 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -101,6 +101,10 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g } MortevielleEngine::~MortevielleEngine() { + // Allocated from run() > initialise() > loadCFIPH() + free(_speechManager._cfiphBuffer); + // Allocated from run() > initialise() > loadCFIEC() + free(_cfiecBuffer); } /** @@ -204,8 +208,6 @@ Common::ErrorCode MortevielleEngine::initialise() { _currGraphicalDevice = _newGraphicalDevice; hirs(); - free(_cfiecBuffer); - free(_speechManager._cfiphBuffer); return Common::kNoError; } -- cgit v1.2.3 From 831c4db6df4c55eac9432819287acc8f903b4542 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 15:26:24 -0400 Subject: TSAGE: Rearranged some of the R2R scene 3500 methods to group them --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 474 ++++++++++++------------ 1 file changed, 234 insertions(+), 240 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 84ec927fc3..74ec706057 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2978,226 +2978,6 @@ void Scene3500::Action1::sub108732(int arg1) { } } -/*--------------------------------------------------------------------------*/ - -Scene3500::Action2::Action2() { - _field1E = 0; -} - -void Scene3500::Action2::synchronize(Serializer &s) { - Action::synchronize(s); - - s.syncAsSint16LE(_field1E); -} - -/*--------------------------------------------------------------------------*/ - -Scene3500::Item4::Item4() { - _field34 = 0; -} - -void Scene3500::Item4::synchronize(Serializer &s) { - NamedHotspot::synchronize(s); - - s.syncAsSint16LE(_field34); -} - -/*--------------------------------------------------------------------------*/ - -Scene3500::Actor7::Actor7() { - _fieldA4 = 0; - _fieldA6 = 0; - _fieldA8 = 0; - _fieldAA = 0; - _fieldAC = 0; - _fieldAE = 0; -} - -void Scene3500::Actor7::synchronize(Serializer &s) { - SceneActor::synchronize(s); - - s.syncAsSint16LE(_fieldA4); - s.syncAsSint16LE(_fieldA6); - s.syncAsSint16LE(_fieldA8); - s.syncAsSint16LE(_fieldAA); - s.syncAsSint16LE(_fieldAC); - s.syncAsSint16LE(_fieldAE); -} - -void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) { - _fieldAE = 0; - _fieldA4 = arg1; - _fieldA6 = arg2; - _fieldA8 = arg3; - _fieldAA = arg4; - _fieldAC = _fieldAA / _fieldA8; - - postInit(); - setup(1050, 3, 1); - fixPriority(255); - sub109663(arg5); -} - -void Scene3500::Actor7::sub1094ED() { - Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; - - scene->_field1270 = _position.x - _fieldA4; -} - -void Scene3500::Actor7::sub109663(int arg1){ - sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1))); -} - -void Scene3500::Actor7::sub109693(Common::Point Pt) { - setPosition(Pt); -} - -/*--------------------------------------------------------------------------*/ - -int Scene3500::MazeUI3500::cellFromX(int x) { - return (_cellSize.x / 2) + x - (x % _cellSize.x); -} - -int Scene3500::MazeUI3500::cellFromY(int y) { - return (_cellSize.y / 2) + y - (y % _cellSize.y); -} - -int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { - int cellX = pt.x / _cellSize.x; - int cellY = pt.y / _cellSize.y; - - if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); - } else - return -1; -} - -bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) { - bool retVal = setMazePosition(p); - p = _mapOffset; - - return retVal; -} - -Scene3500::Scene3500() { - _fieldAF8 = 0; - _fieldB9E = 0; - _rotation = NULL; - _mazeChangeAmount = 0; - _field1270 = 0; - _field1272 = 0; - _field1274 = 0; - _mazeDirection = MAZEDIR_NONE; - _field1278 = 0; - _mazePosition.x = 0; - _mazePosition.y = 0; - _field127E = 0; - _field1280 = 0; - _field1282 = 0; - _field1284 = 0; - _field1286 = 0; -} - -void Scene3500::synchronize(Serializer &s) { - SceneExt::synchronize(s); - SYNC_POINTER(_rotation); - - s.syncAsSint16LE(_fieldAF8); - s.syncAsSint16LE(_fieldB9E); - s.syncAsSint16LE(_mazeChangeAmount); - s.syncAsSint16LE(_field1270); - s.syncAsSint16LE(_field1272); - s.syncAsSint16LE(_field1274); - s.syncAsSint16LE(_mazeDirection); - s.syncAsSint16LE(_field1278); - s.syncAsSint16LE(_mazePosition.x); - s.syncAsSint16LE(_mazePosition.y); - s.syncAsSint16LE(_field127E); - s.syncAsSint16LE(_field1280); - s.syncAsSint16LE(_field1282); - s.syncAsSint16LE(_field1284); - s.syncAsSint16LE(_field1286); -} - -void Scene3500::sub107F71(int arg1) { - switch (arg1) { - case -1: - _actor7.sub1094ED(); - if (_field1270 != 0) { - _field1270--; - _actor7.sub109663(_field1270); - } - if (_action1._field24 != 0) - _field1270 = 0; - break; - case 1: - _actor7.sub1094ED(); - if (_field1270 < 16) { - ++_field1270; - _actor7.sub109663(_field1270); - } - if (_action1._field24 != 0) - _field1270 = 0; - break; - case 88: - if ((_action == 0) || (_action1._field24 == 0)) { - // The original makes a second useless check on action, skipped - _action2.sub10831F(2); - if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) { - _action2.signal(); - } else { - _actor9.setAction(&_action2, &_actor9, NULL); - } - } - break; - case 96: - if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) { - _field1278 = 0; - _action1.sub108732(0); - } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { - _field1278 = arg1; - } else if ((_action) && (_action1._field24 == 0)) { - _action1.sub108670(1); - _action1.signal(); - } else if (_action == 0) { - _action1.sub108670(1); - setAction(&_action1, &_actor1, NULL); - } - break; - case 104: - if ((_action == 0) || (_action1._field24 == 0)) { - _action2.sub10831F(-1); - if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) { - _action2.signal(); - } else { - _actor9.setAction(&_action2, &_actor9, NULL); - } - } - break; - case 112: - if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) { - _field1278 = 0; - _action1.sub108732(0); - } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { - _field1278 = arg1; - } else if ((_action) && (_action1._field24 == 0)) { - _action1.sub108670(-1); - _action1.signal(); - } else if (_action == 0) { - _action1.sub108670(-1); - setAction(&_action1, &_actor1, NULL); - } - break; - default: - _field1270 = arg1; - _actor7.sub109663(arg1); - if (_action1._field24 != 0) { - _field1270 = 0; - } - break; - } -} - void Scene3500::Action1::signal() { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; @@ -3430,6 +3210,226 @@ void Scene3500::Action1::dispatch() { } } +/*--------------------------------------------------------------------------*/ + +Scene3500::Action2::Action2() { + _field1E = 0; +} + +void Scene3500::Action2::synchronize(Serializer &s) { + Action::synchronize(s); + + s.syncAsSint16LE(_field1E); +} + +/*--------------------------------------------------------------------------*/ + +Scene3500::Item4::Item4() { + _field34 = 0; +} + +void Scene3500::Item4::synchronize(Serializer &s) { + NamedHotspot::synchronize(s); + + s.syncAsSint16LE(_field34); +} + +/*--------------------------------------------------------------------------*/ + +Scene3500::Actor7::Actor7() { + _fieldA4 = 0; + _fieldA6 = 0; + _fieldA8 = 0; + _fieldAA = 0; + _fieldAC = 0; + _fieldAE = 0; +} + +void Scene3500::Actor7::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); + s.syncAsSint16LE(_fieldA8); + s.syncAsSint16LE(_fieldAA); + s.syncAsSint16LE(_fieldAC); + s.syncAsSint16LE(_fieldAE); +} + +void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) { + _fieldAE = 0; + _fieldA4 = arg1; + _fieldA6 = arg2; + _fieldA8 = arg3; + _fieldAA = arg4; + _fieldAC = _fieldAA / _fieldA8; + + postInit(); + setup(1050, 3, 1); + fixPriority(255); + sub109663(arg5); +} + +void Scene3500::Actor7::sub1094ED() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + scene->_field1270 = _position.x - _fieldA4; +} + +void Scene3500::Actor7::sub109663(int arg1){ + sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1))); +} + +void Scene3500::Actor7::sub109693(Common::Point Pt) { + setPosition(Pt); +} + +/*--------------------------------------------------------------------------*/ + +int Scene3500::MazeUI3500::cellFromX(int x) { + return (_cellSize.x / 2) + x - (x % _cellSize.x); +} + +int Scene3500::MazeUI3500::cellFromY(int y) { + return (_cellSize.y / 2) + y - (y % _cellSize.y); +} + +int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { + int cellX = pt.x / _cellSize.x; + int cellY = pt.y / _cellSize.y; + + if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); + } else + return -1; +} + +bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) { + bool retVal = setMazePosition(p); + p = _mapOffset; + + return retVal; +} + +Scene3500::Scene3500() { + _fieldAF8 = 0; + _fieldB9E = 0; + _rotation = NULL; + _mazeChangeAmount = 0; + _field1270 = 0; + _field1272 = 0; + _field1274 = 0; + _mazeDirection = MAZEDIR_NONE; + _field1278 = 0; + _mazePosition.x = 0; + _mazePosition.y = 0; + _field127E = 0; + _field1280 = 0; + _field1282 = 0; + _field1284 = 0; + _field1286 = 0; +} + +void Scene3500::synchronize(Serializer &s) { + SceneExt::synchronize(s); + SYNC_POINTER(_rotation); + + s.syncAsSint16LE(_fieldAF8); + s.syncAsSint16LE(_fieldB9E); + s.syncAsSint16LE(_mazeChangeAmount); + s.syncAsSint16LE(_field1270); + s.syncAsSint16LE(_field1272); + s.syncAsSint16LE(_field1274); + s.syncAsSint16LE(_mazeDirection); + s.syncAsSint16LE(_field1278); + s.syncAsSint16LE(_mazePosition.x); + s.syncAsSint16LE(_mazePosition.y); + s.syncAsSint16LE(_field127E); + s.syncAsSint16LE(_field1280); + s.syncAsSint16LE(_field1282); + s.syncAsSint16LE(_field1284); + s.syncAsSint16LE(_field1286); +} + +void Scene3500::sub107F71(int arg1) { + switch (arg1) { + case -1: + _actor7.sub1094ED(); + if (_field1270 != 0) { + _field1270--; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 1: + _actor7.sub1094ED(); + if (_field1270 < 16) { + ++_field1270; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 88: + if ((_action == 0) || (_action1._field24 == 0)) { + // The original makes a second useless check on action, skipped + _action2.sub10831F(2); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 96: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = arg1; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(1); + setAction(&_action1, &_actor1, NULL); + } + break; + case 104: + if ((_action == 0) || (_action1._field24 == 0)) { + _action2.sub10831F(-1); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 112: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = arg1; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(-1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(-1); + setAction(&_action1, &_actor1, NULL); + } + break; + default: + _field1270 = arg1; + _actor7.sub109663(arg1); + if (_action1._field24 != 0) { + _field1270 = 0; + } + break; + } +} + void Scene3500::Action2::sub10831F(int arg1) { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; @@ -3703,64 +3703,58 @@ void Scene3500::process(Event &event) { if (event.eventType == EVENT_KEYPRESS) { switch (event.kbd.keycode) { - case Common::KEYCODE_1: - warning("FIXME: keycode = 0x4700"); + case Common::KEYCODE_KP7: R2_GLOBALS._sound2.play(338); sub107F71(16); event.handled = true; break; - case Common::KEYCODE_2: - warning("FIXME: keycode = 0x4800"); + case Common::KEYCODE_UP: + case Common::KEYCODE_KP8: R2_GLOBALS._sound2.play(14, NULL, 63); sub107F71(88); event.handled = true; break; - case Common::KEYCODE_3: - warning("FIXME: keycode = 0x4900"); + case Common::KEYCODE_KP9: if (_field1270 < 16) R2_GLOBALS._sound2.play(338); sub107F71(1); event.handled = true; break; - case Common::KEYCODE_4: - warning("FIXME: keycode = 0x4B00"); + case Common::KEYCODE_KP4: + case Common::KEYCODE_LEFT: R2_GLOBALS._sound2.play(14, NULL, 63); sub107F71(112); event.handled = true; break; - case Common::KEYCODE_5: - warning("FIXME: keycode = 0x4D00"); + case Common::KEYCODE_KP6: + case Common::KEYCODE_RIGHT: R2_GLOBALS._sound2.play(14, NULL, 63); sub107F71(96); event.handled = true; break; - case Common::KEYCODE_6: - warning("FIXME: keycode = 0x4F00"); + case Common::KEYCODE_KP1: R2_GLOBALS._sound2.play(338); sub107F71(0); event.handled = true; break; - case Common::KEYCODE_7: - warning("FIXME: keycode = 0x5000"); + case Common::KEYCODE_KP2: + case Common::KEYCODE_DOWN: R2_GLOBALS._sound2.play(14, NULL, 63); sub107F71(104); event.handled = true; break; - case Common::KEYCODE_8: - warning("FIXME: keycode = 0x5100"); + case Common::KEYCODE_KP3: if (_field1270 != 0) R2_GLOBALS._sound2.play(338); sub107F71(-1); event.handled = true; break; - case Common::KEYCODE_9: - warning("FIXME: keycode = 0x5200"); + case Common::KEYCODE_KP0: R2_GLOBALS._sound2.play(338); sub107F71(8); event.handled = true; break; - case Common::KEYCODE_0: - warning("FIXME: keycode = 0x5300"); + case Common::KEYCODE_KP_PERIOD: R2_GLOBALS._sound2.play(338); sub107F71(4); event.handled = true; -- cgit v1.2.3 From 8c070963684933f72581cc061f3aaf5c71960af8 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 30 Jun 2013 13:45:43 -0600 Subject: MORTEVIELLE: Fix memory leak with the _screenSurface The _screenSurface was not free'ed after being created. This is now done at the end of run() (the Surface is created at the start of run() when calling initialise()). Also moved a few free() from the destructor to the end of run() in case run() can be called more than once on the same engine. --- engines/mortevielle/mortevielle.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7220cd6b58..46c7c75fa3 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -101,10 +101,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g } MortevielleEngine::~MortevielleEngine() { - // Allocated from run() > initialise() > loadCFIPH() - free(_speechManager._cfiphBuffer); - // Allocated from run() > initialise() > loadCFIEC() - free(_cfiecBuffer); } /** @@ -174,8 +170,10 @@ Common::ErrorCode MortevielleEngine::initialise() { // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); - if (result != Common::kNoError) + if (result != Common::kNoError) { + _screenSurface.free(); return result; + } // Load some error messages (was previously in chartex()) _hintPctMessage = getString(580); // You should have noticed %d hints @@ -341,6 +339,11 @@ Common::Error MortevielleEngine::run() { // Run the main game loop mainGame(); + + // Cleanup (allocated in initialise()) + _screenSurface.free(); + free(_speechManager._cfiphBuffer); + free(_cfiecBuffer); return Common::kNoError; } -- cgit v1.2.3 From fcd53acb0be18bab48d4b9bd34939429a4122223 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 17:29:00 -0400 Subject: TSAGE: Fix for rotating in R2R maze scenes --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 11 ++++++----- engines/tsage/ringworld2/ringworld2_scenes3.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 74ec706057..1812778c27 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2920,9 +2920,10 @@ void Scene3500::Action1::sub108670(int arg1) { else scene->_actor5.show(); - if (scene->_actor1._frame % 2 == 0) - scene->_actor1._frameChange = _field1E; - scene->_actor1.setFrame(scene->_actor1.changeFrame()); + if (scene->_actor1._frame % 2 == 0) { + scene->_actor1._frameChange = _field1E; + scene->_actor1.setFrame(scene->_actor1.changeFrame()); + } setActionIndex(0); } @@ -2993,7 +2994,7 @@ void Scene3500::Action1::signal() { } break; case 1: - if ((scene->_actor1._frame % 2) == 0) { + if ((scene->_actor1._frame % 2) == 1) { setDelay(1); return; } @@ -3637,7 +3638,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _item1.setDetails(Rect(0, 0, 320, 200), 3500, 0, -1, 2, 1, NULL); _actor1.postInit(); - _mazeDirection = 1; + _mazeDirection = MAZEDIR_NORTH; _actor1.setup(1004, 1, _mazeDirection); _actor1.setPosition(Common::Point(230, 135)); _actor1.fixPriority(200); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index ec4ea86e45..85e5674433 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -650,6 +650,7 @@ public: Item4 _item5; Item4 _item6; Item4 _item7; + // Glyph of vessel on top of the maze ui SceneActor _actor1; SceneActor _actor2; SceneActor _actor3; -- cgit v1.2.3 From b1a993ace0de4dad592037cecdc6cf97d581e5c4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 30 Jun 2013 17:53:49 -0400 Subject: VIDEO: Switch Indeo3 decoding to using the common YUV410 conversion code It now runs much faster and looks better too. Thanks to DrMcCoy for testing. --- video/codecs/indeo3.cpp | 121 ++++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 76 deletions(-) diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp index 65fb6dac62..6fbefba9e3 100644 --- a/video/codecs/indeo3.cpp +++ b/video/codecs/indeo3.cpp @@ -32,8 +32,9 @@ #include "common/endian.h" #include "common/stream.h" #include "common/textconsole.h" +#include "common/util.h" -#include "graphics/conversion.h" +#include "graphics/yuv_to_rgb.h" #include "video/codecs/indeo3.h" @@ -260,93 +261,61 @@ const Graphics::Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream * delete[] inData; - // Blit the frame onto the surface const byte *srcY = _cur_frame->Ybuf; const byte *srcU = _cur_frame->Ubuf; const byte *srcV = _cur_frame->Vbuf; - byte *dest = (byte *)_surface->pixels; - - const byte *srcUP = srcU; - const byte *srcVP = srcV; - const byte *srcUN = srcU + chromaWidth; - const byte *srcVN = srcV + chromaWidth; - - uint32 scaleWidth = _surface->w / fWidth; - uint32 scaleHeight = _surface->h / fHeight; - for (uint32 y = 0; y < fHeight; y++) { - byte *rowDest = dest; - - for (uint32 sH = 0; sH < scaleHeight; sH++) { - for (uint32 x = 0; x < fWidth; x++) { - uint32 xP = MAX((x >> 2) - 1, 0); - uint32 xN = MIN((x >> 2) + 1, chromaWidth - 1); - - byte cY = srcY[x]; - byte cU = srcU[x >> 2]; - byte cV = srcV[x >> 2]; - - if (((x % 4) == 0) && ((y % 4) == 0)) { - cU = (((uint32) cU) + ((uint32) srcUP[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[xP])) / 2; - } else if (((x % 4) == 3) && ((y % 4) == 0)) { - cU = (((uint32) cU) + ((uint32) srcUP[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[xN])) / 2; - } else if (((x % 4) == 0) && ((y % 4) == 3)) { - cU = (((uint32) cU) + ((uint32) srcUN[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[xP])) / 2; - } else if (((x % 4) == 3) && ((y % 4) == 3)) { - cU = (((uint32) cU) + ((uint32) srcUN[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[xN])) / 2; - } else if ( (x % 4) == 0) { - cU = (((uint32) cU) + ((uint32) srcU[xP])) / 2; - cV = (((uint32) cV) + ((uint32) srcV[xP])) / 2; - } else if ( (x % 4) == 3) { - cU = (((uint32) cU) + ((uint32) srcU[xN])) / 2; - cV = (((uint32) cV) + ((uint32) srcV[xN])) / 2; - } else if ( (y % 4) == 0) { - cU = (((uint32) cU) + ((uint32) srcUP[x >> 2])) / 2; - cV = (((uint32) cV) + ((uint32) srcVP[x >> 2])) / 2; - } else if ( (y % 4) == 3) { - cU = (((uint32) cU) + ((uint32) srcUN[x >> 2])) / 2; - cV = (((uint32) cV) + ((uint32) srcVN[x >> 2])) / 2; - } + // Create buffers for U/V with an extra row/column copied from the second-to-last + // row/column. + byte *tempU = new byte[(chromaWidth + 1) * (chromaHeight + 1)]; + byte *tempV = new byte[(chromaWidth + 1) * (chromaHeight + 1)]; - byte r = 0, g = 0, b = 0; - Graphics::YUV2RGB(cY, cU, cV, r, g, b); + for (uint i = 0; i < chromaHeight; i++) { + memcpy(tempU + (chromaWidth + 1) * i, srcU + chromaWidth * i, chromaWidth); + memcpy(tempV + (chromaWidth + 1) * i, srcV + chromaWidth * i, chromaWidth); + tempU[(chromaWidth + 1) * i + chromaWidth] = srcU[chromaWidth * (i + 1) - 1]; + tempV[(chromaWidth + 1) * i + chromaWidth] = srcV[chromaWidth * (i + 1) - 1]; + } - const uint32 color = _pixelFormat.RGBToColor(r, g, b); + memcpy(tempU + (chromaWidth + 1) * chromaHeight, tempU + (chromaWidth + 1) * (chromaHeight - 1), + chromaWidth + 1); + memcpy(tempV + (chromaWidth + 1) * chromaHeight, tempV + (chromaWidth + 1) * (chromaHeight - 1), + chromaWidth + 1); - for (uint32 sW = 0; sW < scaleWidth; sW++, rowDest += _surface->format.bytesPerPixel) { - if (_surface->format.bytesPerPixel == 1) - *((uint8 *)rowDest) = (uint8)color; - else if (_surface->format.bytesPerPixel == 2) - *((uint16 *)rowDest) = (uint16)color; - else if (_surface->format.bytesPerPixel == 4) - *((uint32 *)rowDest) = (uint32)color; - } - } + // Blit the frame onto the surface + uint32 scaleWidth = _surface->w / fWidth; + uint32 scaleHeight = _surface->h / fHeight; - dest += _surface->pitch; + if (scaleWidth == 1 && scaleHeight == 1) { + // Shortcut: Don't need to scale so we can decode straight to the surface + YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleFull, srcY, tempU, tempV, + fWidth, fHeight, fWidth, chromaWidth + 1); + } else { + // Need to upscale, so decode to a temp surface first + Graphics::Surface tempSurface; + tempSurface.create(fWidth, fHeight, _surface->format); + + YUVToRGBMan.convert410(&tempSurface, Graphics::YUVToRGBManager::kScaleFull, srcY, tempU, tempV, + fWidth, fHeight, fWidth, chromaWidth + 1); + + // Upscale + for (int y = 0; y < _surface->h; y++) { + for (int x = 0; x < _surface->w; x++) { + if (_surface->format.bytesPerPixel == 1) + *((byte *)_surface->getBasePtr(x, y)) = *((byte *)tempSurface.getBasePtr(x / scaleWidth, y / scaleHeight)); + else if (_surface->format.bytesPerPixel == 2) + *((uint16 *)_surface->getBasePtr(x, y)) = *((uint16 *)tempSurface.getBasePtr(x / scaleWidth, y / scaleHeight)); + else if (_surface->format.bytesPerPixel == 4) + *((uint32 *)_surface->getBasePtr(x, y)) = *((uint32 *)tempSurface.getBasePtr(x / scaleWidth, y / scaleHeight)); + } } - srcY += fWidth; - - if ((y & 3) == 3) { - srcU += chromaWidth; - srcV += chromaWidth; - - if (y > 0) { - srcUP += chromaWidth; - srcVP += chromaWidth; - } - if (y < (fHeight - 4U)) { - srcUN += chromaWidth; - srcVN += chromaWidth; - } - } + tempSurface.free(); } + delete[] tempU; + delete[] tempV; + return _surface; } -- cgit v1.2.3 From 7445459c9dcb249e1c7732ca6217a350b2a965fa Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 30 Jun 2013 17:56:12 -0400 Subject: GRAPHICS: Cleanup the YUV to RGB usage documentation --- graphics/yuv_to_rgb.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/graphics/yuv_to_rgb.h b/graphics/yuv_to_rgb.h index f785422c5a..a1e61ec705 100644 --- a/graphics/yuv_to_rgb.h +++ b/graphics/yuv_to_rgb.h @@ -22,10 +22,17 @@ /** * @file - * YUV to RGB conversion used in engines: - * - mohawk - * - scumm (he) - * - sword25 + * YUV to RGB conversion. + * + * Used in graphics: + * - JPEGDecoder + * + * Used in video: + * - BinkDecoder + * - Indeo3Decoder + * - PSXStreamDecoder + * - TheoraDecoder + * - SVQ1Decoder */ #ifndef GRAPHICS_YUV_TO_RGB_H -- cgit v1.2.3 From 01a36e84316e360e08ec267f0351b032e9a8b7a9 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 30 Jun 2013 17:57:00 -0400 Subject: NEWS: Mention Urban Runner video quality --- NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cf9a07e8cb..c31be14c25 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,8 @@ For a more comprehensive changelog of the latest experimental code, see: https://github.com/scummvm/scummvm/commits/ 1.7.0 (????-??-??) - + Gob: + - Improved video quality in Urban Runner 1.6.0 (2013-05-31) New Games: -- cgit v1.2.3 From 264a52aae683e3e34836afc8cfae6d0d33bb05b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Jun 2013 18:48:52 -0400 Subject: TSAGE: Corrected starting to maze again after rotating in maze --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 1812778c27..b1cd4e7572 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3016,14 +3016,17 @@ void Scene3500::Action1::signal() { scene->_actor1.setFrame(scene->_actor1.changeFrame()); } + // Get the new direction starting on int var8 = (scene->_action1._field1E * 2 + scene->_mazeDirection); - if (var8 > 7) - var8 = 1; - else if (var8 < 1) - var8 = 7; + if (var8 > MAZEDIR_NORTHWEST) + var8 = MAZEDIR_NORTH; + else if (var8 < MAZEDIR_NORTH) + var8 = MAZEDIR_WEST; + // Check whether movement is allowed in that direction. If so, then + // movement is started again switch (var8) { - case 0: + case MAZEDIR_NORTH: if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 23) && (si != 24) && (si != 4) && (si != 11)) || (var6 != 0)) { if ((si != 25) && (si != 26) && (si != 5) && (si != 14) && (si != 15)) @@ -3035,7 +3038,7 @@ void Scene3500::Action1::signal() { } else _field20 = 1; break; - case 2: + case MAZEDIR_EAST: if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 26) && (si != 24) && (si != 15) && (si != 6) && (si != 31)) || (di != 0)) { if ((si != 25) && (si != 23) && (si != 14) && (si != 5) && (si != 4)) @@ -3047,7 +3050,7 @@ void Scene3500::Action1::signal() { } else _field20 = 1; break; - case 4: + case MAZEDIR_SOUTH: if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 25) && (si != 26) && (si != 5) && (si != 16) && (si != 31)) || (var6 != 0)) { if ((si != 23) && (si != 24) && (si != 4) && (si != 14) && (si != 15)) @@ -3059,7 +3062,7 @@ void Scene3500::Action1::signal() { } else _field20 = 1; break; - case 6: + case MAZEDIR_WEST: if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 25) && (si != 23) && (si != 14) && (si != 1) && (si != 31)) || (var6 != 0)) { if ((si != 26) && (si != 24) && (si != 15) && (si != 5) && (si != 4)) -- cgit v1.2.3 From acd64c64e48a441fa3d2c7021a2651d330f1ed1a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 1 Jul 2013 01:18:14 +0200 Subject: MORTEVIELLE: Some renaming GfxSurface --- engines/mortevielle/graphics.cpp | 90 ++++++++++++++++++++-------------------- engines/mortevielle/graphics.h | 5 ++- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 39a38c2580..001c1cc421 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -81,7 +81,7 @@ void PaletteManager::setDefaultPalette() { * of 18 different encoding methods. *-------------------------------------------------------------------------*/ -#define INCR_TAIX { if (_xSize & 1) ++_xSize; } +#define INCR_XSIZE { if (_xSize & 1) ++_xSize; } #define DEFAULT_WIDTH (SCREEN_WIDTH / 2) #define BUFFER_SIZE 40000 @@ -171,7 +171,7 @@ void GfxSurface::decode(const byte *pSrc) { for (int idx = 0; idx < innerCount; ++idx, ++tableOffset) { assert(tableOffset < BUFFER_SIZE); - lookupTable[tableOffset] = suiv(pSrc); + lookupTable[tableOffset] = nextNibble(pSrc); } } while (--outerCount > 0); } while (_lookupIndex < (lookupBytes - 1)); @@ -179,7 +179,7 @@ void GfxSurface::decode(const byte *pSrc) { } else { assert(lookupBytes < BUFFER_SIZE); for (int idx = 0; idx < (lookupBytes * 2); ++idx) - lookupTable[idx] = suiv(pSrc); + lookupTable[idx] = nextNibble(pSrc); } if (_nibbleFlag) { @@ -240,12 +240,12 @@ void GfxSurface::decode(const byte *pSrc) { // Draw rect at pos pDest = &outputBuffer[_yp * DEFAULT_WIDTH + _xp]; pSrcStart = pSrc; - INCR_TAIX; + INCR_XSIZE; for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - *pDestLine++ = suiv(pSrc); + *pDestLine++ = nextNibble(pSrc); } } @@ -254,15 +254,15 @@ void GfxSurface::decode(const byte *pSrc) { case 1: // Draw rect using horizontal lines alternating left to right, then right to left - INCR_TAIX; + INCR_XSIZE; for (int yCtr = 0; yCtr < _ySize; ++yCtr) { if ((yCtr % 2) == 0) { for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - *pDest++ = csuiv(pSrc, pLookup); + *pDest++ = nextByte(pSrc, pLookup); } } else { for (int xCtr = 0; xCtr < _xSize; ++xCtr) { - *--pDest = csuiv(pSrc, pLookup); + *--pDest = nextByte(pSrc, pLookup); } } pDest += DEFAULT_WIDTH; @@ -274,12 +274,12 @@ void GfxSurface::decode(const byte *pSrc) { for (int xCtr = 0; xCtr < _xSize; ++xCtr) { if ((xCtr % 2) == 0) { for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); } } else { for (int yCtr = 0; yCtr < _ySize; ++yCtr) { pDest -= DEFAULT_WIDTH; - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); } } ++pDest; @@ -310,11 +310,11 @@ void GfxSurface::decode(const byte *pSrc) { case 7: // Draw rect using horizontal lines left to right - INCR_TAIX; + INCR_XSIZE; for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDest += DEFAULT_WIDTH) { byte *pDestLine = pDest; for (int xCtr = 0; xCtr < _xSize; ++xCtr) - *pDestLine++ = csuiv(pSrc, pLookup); + *pDestLine++ = nextByte(pSrc, pLookup); } break; @@ -323,7 +323,7 @@ void GfxSurface::decode(const byte *pSrc) { for (int xCtr = 0; xCtr < _xSize; ++xCtr, ++pDest) { byte *pDestLine = pDest; for (int yCtr = 0; yCtr < _ySize; ++yCtr, pDestLine += DEFAULT_WIDTH) - *pDestLine = csuiv(pSrc, pLookup); + *pDestLine = nextByte(pSrc, pLookup); } break; @@ -342,7 +342,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 12: - INCR_TAIX; + INCR_XSIZE; _thickness = _xInc = 1; _yInc = DEFAULT_WIDTH; _yEnd = _ySize; @@ -351,7 +351,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 13: - INCR_TAIX; + INCR_XSIZE; _thickness = _xSize; _yInc = 1; _yEnd = _xSize; @@ -369,7 +369,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 15: - INCR_TAIX; + INCR_XSIZE; _thickness = 2; _yInc = DEFAULT_WIDTH; _yEnd = _ySize; @@ -388,7 +388,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 17: - INCR_TAIX; + INCR_XSIZE; _thickness = 3; _yInc = DEFAULT_WIDTH; _yEnd = _ySize; @@ -398,7 +398,7 @@ void GfxSurface::decode(const byte *pSrc) { break; case 18: - INCR_TAIX; + INCR_XSIZE; _thickness = 5; _yInc = DEFAULT_WIDTH; _yEnd = _ySize; @@ -436,7 +436,7 @@ void GfxSurface::majTtxTty() { _height += _ySize; } -byte GfxSurface::suiv(const byte *&pSrc) { +byte GfxSurface::nextNibble(const byte *&pSrc) { int v = *pSrc; if (_nibbleFlag) { ++pSrc; @@ -449,13 +449,13 @@ byte GfxSurface::suiv(const byte *&pSrc) { } } -byte GfxSurface::csuiv(const byte *&pSrc, const byte *&pLookup) { +byte GfxSurface::nextByte(const byte *&pSrc, const byte *&pLookup) { assert(pLookup); while (!_lookupValue) { int v; do { - v = suiv(pSrc) & 0xff; + v = nextNibble(pSrc) & 0xff; _lookupValue += v; } while (v == 0xf); ++pLookup; @@ -467,16 +467,16 @@ byte GfxSurface::csuiv(const byte *&pSrc, const byte *&pLookup) { int GfxSurface::desanalyse(const byte *&pSrc) { int total = 0; - int v = suiv(pSrc); - if (v == 15) { + int v = nextNibble(pSrc); + if (v == 0xf) { int v2; do { - v2 = suiv(pSrc); + v2 = nextNibble(pSrc); total += v2; - } while (v2 == 15); + } while (v2 == 0xf); total *= 15; - v = suiv(pSrc); + v = nextNibble(pSrc); } total += v; @@ -484,7 +484,7 @@ int GfxSurface::desanalyse(const byte *&pSrc) { } void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { - INCR_TAIX; + INCR_XSIZE; byte *pDestEnd = pDest + (_ySize - 1) * DEFAULT_WIDTH + _xSize; for (;;) { @@ -504,14 +504,14 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku // Write out vertical slice top to bottom for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH) - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); ++pDest; } else { // Write out vertical slice bottom to top for (int yIndex = 0; yIndex < _thickness; ++yIndex) { pDest -= DEFAULT_WIDTH; - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); } } } @@ -538,12 +538,12 @@ void GfxSurface::horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLooku if ((xIndex % 2) == 0) { // Write out vertical slice top to bottom for (int yIndex = 0; yIndex < _thickness; ++yIndex, pDest += DEFAULT_WIDTH) - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); } else { // Write out vertical slice top to bottom for (int yIndex = 0; yIndex < _thickness; ++yIndex) { pDest -= DEFAULT_WIDTH; - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); } } } @@ -591,12 +591,12 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) drawIndex += _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) - *pDest++ = csuiv(pSrc, pLookup); + *pDest++ = nextByte(pSrc, pLookup); } else { pDest += DEFAULT_WIDTH; drawIndex -= _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) - *--pDest = csuiv(pSrc, pLookup); + *--pDest = nextByte(pSrc, pLookup); } } if ((_ySize % 2) == 0) { @@ -618,13 +618,13 @@ void GfxSurface::vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup) drawIndex += _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) - *pDest++ = csuiv(pSrc, pLookup); + *pDest++ = nextByte(pSrc, pLookup); } else { pDest -= DEFAULT_WIDTH; drawIndex -= _thickness; for (int xCtr = 0; xCtr < _thickness; ++xCtr) - *--pDest = csuiv(pSrc, pLookup); + *--pDest = nextByte(pSrc, pLookup); } } if ((_ySize % 2) == 0) { @@ -645,7 +645,7 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) while (areaNum != -1) { switch (areaNum) { case 0: - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); areaNum = 1; break; @@ -663,7 +663,7 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) ++yPos; } - *++pDest = csuiv(pSrc, pLookup); + *++pDest = nextByte(pSrc, pLookup); areaNum = 2; } else if (yPos != _ySize) { ++yPos; @@ -675,7 +675,7 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) increments(pDest); ++drawIndex; - *++pDest = csuiv(pSrc, pLookup); + *++pDest = nextByte(pSrc, pLookup); if (drawIndex == _xSize) { areaNum = -1; @@ -705,7 +705,7 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) ++drawIndex; --yPos; - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); areaNum = 2; } else { pDest += DEFAULT_WIDTH; @@ -714,7 +714,7 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) NIV(); increments(pDest); - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); if (yPos == _ySize) areaNum = -1; @@ -734,7 +734,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { for (;;) { NIH(); for (int idx = 0; idx <= _thickness; ++idx) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); NIH(); increments(pDest); } @@ -743,7 +743,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); NIH(); increments(pDest); } @@ -771,7 +771,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { for (;;) { for (int idx = 0; idx <= _thickness; ++idx) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); NIH(); increments(pDest); } @@ -780,7 +780,7 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); NIH(); increments(pDest); } @@ -842,7 +842,7 @@ void GfxSurface::TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int v += _thickness + 1; for (int idx = 0; idx <= _thickness; ++idx) { - *pDest = csuiv(pSrc, pLookup); + *pDest = nextByte(pSrc, pLookup); pDest += _yInc; } } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 026950e127..116eb222c2 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -58,9 +58,10 @@ private: int _yInc, _yEnd, _xInc, _xEnd; int _width, _height; + byte nextNibble(const byte *&pSrc); + byte nextByte(const byte *&pSrc, const byte *&pLookup); + void majTtxTty(); - byte suiv(const byte *&pSrc); - byte csuiv(const byte *&pSrc, const byte *&pLookup); int desanalyse(const byte *&pSrc); void horizontal(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup); -- cgit v1.2.3 From 04dc01109faa46ab026fbbd0a709fb4cdba9587e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 02:35:02 +0300 Subject: NEVERHOOD: Fix the second tape sprite in the whale room The second tape is now correctly faced to the right --- engines/neverhood/modules/module2100.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module2100.cpp b/engines/neverhood/modules/module2100.cpp index b664e93dde..7f9ca94430 100644 --- a/engines/neverhood/modules/module2100.cpp +++ b/engines/neverhood/modules/module2100.cpp @@ -210,7 +210,7 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) _ssFloorButton = insertSprite(this, 0x72427010, 0x32423010, 200, 0); _asTape1 = insertSprite(this, 18, 1100, 412, 443, 0x9148A011); addCollisionSprite(_asTape1); - _asTape2 = insertSprite(this, 11, 1100, 441, 443, 0x9148A011); + _asTape2 = insertSprite(this, 11, 1100, 441, 443, 0x9048A093); addCollisionSprite(_asTape2); if (which < 0) { -- cgit v1.2.3 From 507e8ec8f38f0ce54bae95776b718efa0dbf159a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 03:04:24 +0300 Subject: NEVERHOOD: Slight cleanup to the navigation scene code --- engines/neverhood/navigationscene.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 33e2a264a8..073d18f47b 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -25,6 +25,11 @@ namespace Neverhood { +enum AreaType { + kAreaCanMoveForward = 0, + kAreaCannotMoveForward = 1 +}; + NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint32 navigationListId, int navigationIndex, const byte *itemsTypes) : Scene(vm, parentModule), _itemsTypes(itemsTypes), _navigationIndex(navigationIndex), _smackerDone(false), _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) { @@ -49,7 +54,6 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); sendMessage(_parentModule, 0x100A, _navigationIndex); - } NavigationScene::~NavigationScene() { @@ -121,34 +125,29 @@ uint32 NavigationScene::handleMessage(int messageNum, const MessageParam ¶m, } void NavigationScene::createMouseCursor() { - const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; uint32 mouseCursorFileHash; int areaType; - if (_mouseCursor) { + if (_mouseCursor) deleteSprite((Sprite**)&_mouseCursor); - } mouseCursorFileHash = navigationItem.mouseCursorFileHash; if (mouseCursorFileHash == 0) mouseCursorFileHash = 0x63A40028; - if (_itemsTypes) { + if (_itemsTypes) areaType = _itemsTypes[_navigationIndex]; - } else if (navigationItem.middleSmackerFileHash != 0 || navigationItem.middleFlag) { - areaType = 0; - } else { - areaType = 1; - } + else if (navigationItem.middleSmackerFileHash != 0 || navigationItem.middleFlag) + areaType = kAreaCanMoveForward; + else + areaType = kAreaCannotMoveForward; insertNavigationMouse(mouseCursorFileHash, areaType); sendPointMessage(_mouseCursor, 0x4002, _vm->getMousePos()); - } void NavigationScene::handleNavigation(const NPoint &mousePos) { - const NavigationItem &navigationItem = (*_navigationList)[_navigationIndex]; bool oldIsWalkingForward = _isWalkingForward; bool oldIsTurning = _isTurning; @@ -210,7 +209,6 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { if (oldIsWalkingForward != _isWalkingForward) _vm->_soundMan->setTwoSoundsPlayFlag(_isWalkingForward); - } } // End of namespace Neverhood -- cgit v1.2.3 From 5de6a876a93fd3a56ca50c26cfa1124a30909574 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 04:42:13 +0300 Subject: NEVERHOOD: Fix display of the dynamites on shelves in the dynamite room --- engines/neverhood/modules/module1200.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module1200.cpp b/engines/neverhood/modules/module1200.cpp index 3e67ddb35a..ae84d59113 100644 --- a/engines/neverhood/modules/module1200.cpp +++ b/engines/neverhood/modules/module1200.cpp @@ -133,7 +133,7 @@ SsScene1201Tnt::SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 poi if (x < 300) loadSprite(kScene1201TntFileHashList1[elemIndex], kSLFDefDrawOffset | kSLFDefPosition, 50); else - loadSprite(kScene1201TntFileHashList2[elemIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 50, x, y); + loadSprite(kScene1201TntFileHashList2[elemIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 50, x, y - 20); setClipRect(0, 0, 640, clipY2); } -- cgit v1.2.3 From 318200cd86b437e388adbb97b75cce3874b3736f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 05:07:14 +0300 Subject: NEVERHOOD: Fix sound effect heard when the castle elevator door opens The condition where the elevator door opening sound is heard is triggered twice. Now, we prevent it being triggered a second time. --- engines/neverhood/modules/module1300.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index cc5c22085c..062434f064 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -800,7 +800,7 @@ void AsScene1306Elevator::update() { if (_isUp && _countdown != 0 && (--_countdown == 0)) stGoingDown(); AnimatedSprite::update(); - if (_currFrameIndex == 7) { + if (_currFrameIndex == 7 && _asElevatorDoor->getVisible()) { playSound(1); _asElevatorDoor->setVisible(false); } -- cgit v1.2.3 From 7da9b342aa4e416cdcf29ed2ded276081fdcb975 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 30 Jun 2013 23:24:54 -0400 Subject: VIDEO: Fix Indeo3 luma scale Now black is really black --- video/codecs/indeo3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp index 6fbefba9e3..28e1a9c620 100644 --- a/video/codecs/indeo3.cpp +++ b/video/codecs/indeo3.cpp @@ -288,14 +288,14 @@ const Graphics::Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream * if (scaleWidth == 1 && scaleHeight == 1) { // Shortcut: Don't need to scale so we can decode straight to the surface - YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleFull, srcY, tempU, tempV, + YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV, fWidth, fHeight, fWidth, chromaWidth + 1); } else { // Need to upscale, so decode to a temp surface first Graphics::Surface tempSurface; tempSurface.create(fWidth, fHeight, _surface->format); - YUVToRGBMan.convert410(&tempSurface, Graphics::YUVToRGBManager::kScaleFull, srcY, tempU, tempV, + YUVToRGBMan.convert410(&tempSurface, Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV, fWidth, fHeight, fWidth, chromaWidth + 1); // Upscale -- cgit v1.2.3 From 51ab7a5b16edd83362107f6936975dbfd156fce9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 1 Jul 2013 08:03:19 +0200 Subject: MORTEVIELLE: Some more renaming in GfxSurface --- engines/mortevielle/graphics.cpp | 95 ++++++++++++++++++++++++---------------- engines/mortevielle/graphics.h | 6 +-- 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 001c1cc421..ff6014585c 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -436,6 +436,10 @@ void GfxSurface::majTtxTty() { _height += _ySize; } +/** + * Decompression Function - get next nibble + * @remarks Originally called 'suiv' + */ byte GfxSurface::nextNibble(const byte *&pSrc) { int v = *pSrc; if (_nibbleFlag) { @@ -449,6 +453,10 @@ byte GfxSurface::nextNibble(const byte *&pSrc) { } } +/** + * Decompression Function - get next byte + * @remarks Originally called 'csuiv' + */ byte GfxSurface::nextByte(const byte *&pSrc, const byte *&pLookup) { assert(pLookup); @@ -650,14 +658,14 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) break; case 1: - increments(pDest); + nextDecompPtr(pDest); if (!drawIndex) { - NIH(); - NIV(); + negXInc(); + negYInc(); if (yPos == _ySize) { - increments(pDest); + nextDecompPtr(pDest); ++drawIndex; } else { ++yPos; @@ -670,9 +678,9 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) --drawIndex; areaNum = 0; } else { - NIH(); - NIV(); - increments(pDest); + negXInc(); + negYInc(); + nextDecompPtr(pDest); ++drawIndex; *++pDest = nextByte(pSrc, pLookup); @@ -686,14 +694,14 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) break; case 2: - increments(pDest); + nextDecompPtr(pDest); if (!yPos) { - NIH(); - NIV(); + negXInc(); + negYInc(); if (drawIndex == _xSize) { - increments(pDest); + nextDecompPtr(pDest); ++yPos; } else { ++drawIndex; @@ -710,9 +718,9 @@ void GfxSurface::decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup) } else { pDest += DEFAULT_WIDTH; ++yPos; - NIH(); - NIV(); - increments(pDest); + negXInc(); + negYInc(); + nextDecompPtr(pDest); *pDest = nextByte(pSrc, pLookup); @@ -732,25 +740,25 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { while (!TFP(diagIndex)) { for (;;) { - NIH(); + negXInc(); for (int idx = 0; idx <= _thickness; ++idx) { *pDest = nextByte(pSrc, pLookup); - NIH(); - increments(pDest); + negXInc(); + nextDecompPtr(pDest); } - NIV(); + negYInc(); pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { *pDest = nextByte(pSrc, pLookup); - NIH(); - increments(pDest); + negXInc(); + nextDecompPtr(pDest); } - NIH(); - NIV(); - increments(pDest); + negXInc(); + negYInc(); + nextDecompPtr(pDest); ++drawIndex; if (_xEnd < (drawIndex + 1)) { @@ -772,52 +780,63 @@ void GfxSurface::diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup) { for (;;) { for (int idx = 0; idx <= _thickness; ++idx) { *pDest = nextByte(pSrc, pLookup); - NIH(); - increments(pDest); + negXInc(); + nextDecompPtr(pDest); } - NIV(); + negYInc(); pDest += _yInc; for (int idx = 0; idx <= _thickness; ++idx) { *pDest = nextByte(pSrc, pLookup); - NIH(); - increments(pDest); + negXInc(); + nextDecompPtr(pDest); } - NIH(); - NIV(); - increments(pDest); + negXInc(); + negYInc(); + nextDecompPtr(pDest); if (--drawIndex == 0) { TF1(pDest, diagIndex); - NIH(); + negXInc(); break; } else { pDest += _xInc; if (--drawIndex == 0) { TF2(pSrc, pDest, pLookup, diagIndex); - NIH(); + negXInc(); break; } } - NIH(); + negXInc(); } } } - -void GfxSurface::increments(byte *&pDest) { +/** + * Decompression Function - Move pDest ptr to next value to uncompress + * @remarks Originally called 'increments' + */ +void GfxSurface::nextDecompPtr(byte *&pDest) { pDest += _xInc + _yInc; } -void GfxSurface::NIH() { +/** + * Decompression Function - set xInc to its opposite value + * @remarks Originally called 'NIH' + */ +void GfxSurface::negXInc() { _xInc = -_xInc; } -void GfxSurface::NIV() { +/** + * Decompression Function - set yInc to its opposite value + * @remarks Originally called 'NIV' + */ +void GfxSurface::negYInc() { _yInc = -_yInc; } diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 116eb222c2..3a54f0c434 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -67,9 +67,9 @@ private: void vertical(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void decom11(const byte *&pSrc, byte *&pDest, const byte *&pLookup); void diag(const byte *&pSrc, byte *&pDest, const byte *&pLookup); - void increments(byte *&pDest); - void NIH(); - void NIV(); + void nextDecompPtr(byte *&pDest); + void negXInc(); + void negYInc(); bool TFP(int v); void TF1(byte *&pDest, int &v); void TF2(const byte *&pSrc, byte *&pDest, const byte *&pLookup, int &v); -- cgit v1.2.3 From 7804c9cc7f0ec3a8259e3876c781a6906d001422 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 12:10:59 +0300 Subject: NEVERHOOD: Fix mouse cursor in the statue screen with the ladder button The mouse cursor resource hash used in that scene was incorrect, resulting in broken palette --- engines/neverhood/modules/module2800.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 3d76d05762..7ab732b4ac 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -3120,7 +3120,7 @@ Scene2822::Scene2822(NeverhoodEngine *vm, Module *parentModule, int which) addBackground(_background); _background->getSurface()->getDrawRect().y = -10; setPalette(0xD542022E); - insertPuzzleMouse(0x0028D089, 20, 620); + insertPuzzleMouse(0x2022AD5C, 20, 620); _ssButton = insertStaticSprite(0x1A4D4120, 1100); _ssButton->setVisible(false); loadSound(2, 0x19044E72); -- cgit v1.2.3 From 1b7681e9e27971872b0459d4afea21a0f45c85df Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 1 Jul 2013 12:46:01 +0300 Subject: NEVERHOOD: Fix cursor glitch before looking down the lowered bridge The navigation scene type used was wrong, resulting in cursor glitches when moving the mouse cursor at the screen edges --- engines/neverhood/modules/module3000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index bc6b7790b4..f483e0c95f 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -73,7 +73,7 @@ Module3000::~Module3000() { } void Module3000::createScene(int sceneNum, int which) { - static const byte kNavigationTypes05[] = {3, 0}; + static const byte kNavigationTypes05[] = {2, 0}; static const byte kNavigationTypes06[] = {5}; debug(1, "Module3000::createScene(%d, %d)", sceneNum, which); _vm->gameState().sceneNum = sceneNum; -- cgit v1.2.3 From b1dcd252b3b3eb4c91ba9b334541bdd97a95ef14 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 1 Jul 2013 15:08:01 +0200 Subject: KYRA: Fix (a few) font checks for systems with unsigend char. Thanks to wjp for reporting those. This only affects games with SJIS font use. --- engines/kyra/kyra_rpg.cpp | 2 +- engines/kyra/screen.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp index f8eb7d00cd..4f7adcc6e5 100644 --- a/engines/kyra/kyra_rpg.cpp +++ b/engines/kyra/kyra_rpg.cpp @@ -213,7 +213,7 @@ void KyraRpgEngine::drawDialogueButtons() { screen()->printText(_dialogueButtonString[i], (x + 37 - (screen()->getTextWidth(_dialogueButtonString[i])) / 2) & ~3, ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2) & ~7, _dialogueHighlightedButton == i ? 0xC1 : 0xE1, 0); } else { - int sjisYOffset = (_flags.lang == Common::JA_JPN && _dialogueButtonString[i][0] < 0) ? 2 : 0; + int sjisYOffset = (_flags.lang == Common::JA_JPN && (_dialogueButtonString[i][0] & 0x80)) ? 2 : 0; gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonWidth, guiSettings()->buttons.height, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill); screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonWidth >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2, (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2 - sjisYOffset, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 419b630714..054397a34a 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1256,7 +1256,7 @@ int Screen::getTextWidth(const char *str) { while (1) { if (_sjisMixedFontMode) - setFont(*str < 0 ? FID_SJIS_FNT : curFont); + setFont((*str & 0x80) ? FID_SJIS_FNT : curFont); uint c = fetchChar(str); @@ -1296,7 +1296,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 while (1) { if (_sjisMixedFontMode) - setFont(*str < 0 ? FID_SJIS_FNT : curFont); + setFont((*str & 0x80) ? FID_SJIS_FNT : curFont); uint8 charHeightFnt = getFontHeight(); -- cgit v1.2.3 From ff0fcf52044e9c643637440fad8057dff811b448 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 1 Jul 2013 16:28:19 +0200 Subject: BUILD: Pass -Wno-nested-anon-types to clang. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 28eaead4b4..1ed1824e2d 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,11 @@ endif ifeq "$(HAVE_CLANG)" "1" CXXFLAGS+= -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants + # We use a anonymous nested type declaration in an anonymous union in + # common/str.h. This is no standard construct and clang warns about it. + # It works for all our target systems though, thus we simply disable that + # warning. + CXXFLAGS+= -Wno-nested-anon-types endif ifeq "$(HAVE_ICC)" "1" -- cgit v1.2.3 From 72a523059f4a3c8c4baa77f504b3adecb87d3359 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 2 Jul 2013 03:32:34 +0300 Subject: SAGA: Fix odd memcmp() conditions, as reported by clang Thanks to LordHoto for pointing those out - they followed the incorrect paradigm of previous code --- engines/saga/sndres.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 49d24753a1..ca843af465 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -249,11 +249,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff if (!memcmp(header, "Creative", 8)) { resourceType = kSoundVOC; - } else if (!memcmp(header, "RIFF", 4) != 0) { + } else if (!memcmp(header, "RIFF", 4)) { resourceType = kSoundWAV; - } else if (!memcmp(header, "FORM", 4) != 0) { + } else if (!memcmp(header, "FORM", 4)) { resourceType = kSoundAIFF; - } else if (!memcmp(header, "ajkg", 4) != 0) { + } else if (!memcmp(header, "ajkg", 4)) { resourceType = kSoundShorten; } -- cgit v1.2.3 From 5f3ddae421c473fc7e1a02f9c068900c12147b2a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 2 Jul 2013 03:48:35 +0300 Subject: MT-32: Sync with the latest changes in munt This syncs our code with munt commits 258cd89 and 17b40a6 --- audio/softsynth/mt32/Part.cpp | 6 +----- audio/softsynth/mt32/Partial.cpp | 1 - audio/softsynth/mt32/Synth.cpp | 17 ++--------------- audio/softsynth/mt32/Synth.h | 8 +++----- audio/softsynth/mt32/TVA.cpp | 6 ------ 5 files changed, 6 insertions(+), 32 deletions(-) diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp index 62ba346c35..88404316eb 100644 --- a/audio/softsynth/mt32/Part.cpp +++ b/audio/softsynth/mt32/Part.cpp @@ -175,6 +175,7 @@ void Part::refresh() { patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0; } memcpy(currentInstr, timbreTemp->common.name, 10); + synth->newTimbreSet(partNum, patchTemp->patch.timbreGroup, currentInstr); updatePitchBenderRange(); } @@ -207,7 +208,6 @@ void RhythmPart::setTimbre(TimbreParam * /*timbre*/) { void Part::setTimbre(TimbreParam *timbre) { *timbreTemp = *timbre; - synth->newTimbreSet(partNum, timbre->common.name); } unsigned int RhythmPart::getAbsTimbreNum() const { @@ -533,7 +533,6 @@ void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhyt #if MT32EMU_MONITOR_PARTIALS > 1 synth->printPartialUsage(); #endif - synth->partStateChanged(partNum, true); synth->polyStateChanged(partNum); } @@ -614,9 +613,6 @@ void Part::partialDeactivated(Poly *poly) { freePolys.prepend(poly); synth->polyStateChanged(partNum); } - if (activePartialCount == 0) { - synth->partStateChanged(partNum, false); - } } //#define POLY_LIST_DEBUG diff --git a/audio/softsynth/mt32/Partial.cpp b/audio/softsynth/mt32/Partial.cpp index a0aec90ec4..b80a028515 100644 --- a/audio/softsynth/mt32/Partial.cpp +++ b/audio/softsynth/mt32/Partial.cpp @@ -87,7 +87,6 @@ void Partial::deactivate() { if (poly != NULL) { poly->partialDeactivated(this); } - synth->partialStateChanged(this, tva->getPhase(), TVA_PHASE_DEAD); #if MT32EMU_MONITOR_PARTIALS > 2 synth->printDebug("[+%lu] [Partial %d] Deactivated", sampleNum, debugPartialNum); synth->printPartialUsage(sampleNum); diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp index b7af992b99..1e1be06bc9 100644 --- a/audio/softsynth/mt32/Synth.cpp +++ b/audio/softsynth/mt32/Synth.cpp @@ -201,25 +201,12 @@ void ReportHandler::printDebug(const char *fmt, va_list list) { printf("\n"); } -void Synth::partStateChanged(int partNum, bool isPartActive) { - reportHandler->onPartStateChanged(partNum, isPartActive); -} - void Synth::polyStateChanged(int partNum) { reportHandler->onPolyStateChanged(partNum); } -void Synth::partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase) { - for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) { - if (getPartial(i) == partial) { - reportHandler->onPartialStateChanged(i, oldPartialPhase, newPartialPhase); - break; - } - } -} - -void Synth::newTimbreSet(int partNum, char patchName[]) { - reportHandler->onProgramChanged(partNum, patchName); +void Synth::newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]) { + reportHandler->onProgramChanged(partNum, timbreGroup, patchName); } void Synth::printDebug(const char *fmt, ...) { diff --git a/audio/softsynth/mt32/Synth.h b/audio/softsynth/mt32/Synth.h index 56e88e6156..b85e7ae507 100644 --- a/audio/softsynth/mt32/Synth.h +++ b/audio/softsynth/mt32/Synth.h @@ -249,10 +249,10 @@ protected: virtual void onNewReverbMode(Bit8u /* mode */) {} virtual void onNewReverbTime(Bit8u /* time */) {} virtual void onNewReverbLevel(Bit8u /* level */) {} - virtual void onPartStateChanged(int /* partNum */, bool /* isActive */) {} + virtual void onPartStateChanged(int /* partNum */, bool /* hasActiveNonReleasingPolys */) {} virtual void onPolyStateChanged(int /* partNum */) {} virtual void onPartialStateChanged(int /* partialNum */, int /* oldPartialPhase */, int /* newPartialPhase */) {} - virtual void onProgramChanged(int /* partNum */, char * /* patchName */) {} + virtual void onProgramChanged(int /* partNum */, int /* bankNum */, const char * /* patchName */) {} }; class Synth { @@ -370,10 +370,8 @@ private: void printPartialUsage(unsigned long sampleOffset = 0); - void partStateChanged(int partNum, bool isPartActive); void polyStateChanged(int partNum); - void partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase); - void newTimbreSet(int partNum, char patchName[]); + void newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]); void printDebug(const char *fmt, ...); public: diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp index 65e5256048..5438471fa4 100644 --- a/audio/softsynth/mt32/TVA.cpp +++ b/audio/softsynth/mt32/TVA.cpp @@ -34,9 +34,6 @@ TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) : } void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) { - if (newPhase != phase) { - partial->getSynth()->partialStateChanged(partial, phase, newPhase); - } target = newTarget; phase = newPhase; ampRamp->startRamp(newTarget, newIncrement); @@ -46,9 +43,6 @@ void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) { } void TVA::end(int newPhase) { - if (newPhase != phase) { - partial->getSynth()->partialStateChanged(partial, phase, newPhase); - } phase = newPhase; playing = false; #if MT32EMU_MONITOR_TVA >= 1 -- cgit v1.2.3 From 4ed1bc3a57e0160eb0b395c2a363151700216d04 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 1 Jul 2013 21:29:59 -0400 Subject: CONFIGURE: Make the libmpeg2 properly require 0.4.0 --- configure | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 41d96fbf72..eedd83eb7b 100755 --- a/configure +++ b/configure @@ -3474,7 +3474,7 @@ echo "$_zlib" # # Check for LibMPEG2 # -echocheck "libmpeg2 >= 0.3.2" +echocheck "libmpeg2 >= 0.4.0" if test "$_mpeg2" = auto ; then _mpeg2=no cat > $TMPC << EOF @@ -3486,16 +3486,19 @@ typedef unsigned $type_1_byte uint8_t; typedef unsigned $type_2_byte uint16_t; typedef unsigned $type_4_byte uint32_t; +extern "C" { #include +} + int main(void) { + #if MPEG2_RELEASE < MPEG2_VERSION(0, 4, 0) + #error libmpeg2 version too low + #endif + /* mpeg2_state_t first appears in 0.4.0 */ mpeg2_state_t state; - #ifdef MPEG2_RELEASE - if (MPEG2_RELEASE >= MPEG2_VERSION(0, 3, 2)) - return 0; - #endif - return 1; + return 0; } EOF -- cgit v1.2.3 From be399188c4ec25463c4a777a5e96fd69a4b0b1e3 Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Tue, 25 Jun 2013 21:08:55 +1000 Subject: TIZEN: bada port updated to tizen --- AUTHORS | 6 +- Makefile | 4 +- backends/graphics/opengl/gltexture.h | 4 +- backends/modular-backend.cpp | 2 +- backends/module.mk | 4 +- backends/platform/bada/README.TXT | 92 ------ backends/platform/bada/application.cpp | 111 ------- backends/platform/bada/application.h | 54 ---- backends/platform/bada/audio.cpp | 260 --------------- backends/platform/bada/audio.h | 73 ----- backends/platform/bada/bada.mk | 5 - backends/platform/bada/form.cpp | 464 --------------------------- backends/platform/bada/form.h | 108 ------- backends/platform/bada/fs.cpp | 435 ------------------------- backends/platform/bada/fs.h | 82 ----- backends/platform/bada/graphics.cpp | 261 --------------- backends/platform/bada/graphics.h | 72 ----- backends/platform/bada/main.cpp | 67 ---- backends/platform/bada/missing.cpp | 113 ------- backends/platform/bada/portdefs.h | 85 ----- backends/platform/bada/sscanf.cpp | 213 ------------- backends/platform/bada/system.cpp | 514 ------------------------------ backends/platform/bada/system.h | 102 ------ backends/platform/tizen/README.TXT | 108 +++++++ backends/platform/tizen/application.cpp | 140 ++++++++ backends/platform/tizen/application.h | 69 ++++ backends/platform/tizen/audio.cpp | 181 +++++++++++ backends/platform/tizen/audio.h | 74 +++++ backends/platform/tizen/form.cpp | 419 ++++++++++++++++++++++++ backends/platform/tizen/form.h | 113 +++++++ backends/platform/tizen/fs.cpp | 441 +++++++++++++++++++++++++ backends/platform/tizen/fs.h | 98 ++++++ backends/platform/tizen/graphics.cpp | 237 ++++++++++++++ backends/platform/tizen/graphics.h | 73 +++++ backends/platform/tizen/main.cpp | 51 +++ backends/platform/tizen/missing.cpp | 82 +++++ backends/platform/tizen/portdefs.h | 85 +++++ backends/platform/tizen/sscanf.cpp | 213 +++++++++++++ backends/platform/tizen/system.cpp | 547 ++++++++++++++++++++++++++++++++ backends/platform/tizen/system.h | 102 ++++++ backends/platform/tizen/tizen.mk | 7 + backends/timer/bada/timer.cpp | 115 ------- backends/timer/bada/timer.h | 62 ---- backends/timer/tizen/timer.cpp | 117 +++++++ backends/timer/tizen/timer.h | 59 ++++ configure | 130 ++++---- devtools/credits.pl | 8 +- gui/credits.h | 6 +- gui/widgets/edittext.cpp | 8 +- 49 files changed, 3295 insertions(+), 3381 deletions(-) delete mode 100644 backends/platform/bada/README.TXT delete mode 100644 backends/platform/bada/application.cpp delete mode 100644 backends/platform/bada/application.h delete mode 100644 backends/platform/bada/audio.cpp delete mode 100644 backends/platform/bada/audio.h delete mode 100644 backends/platform/bada/bada.mk delete mode 100644 backends/platform/bada/form.cpp delete mode 100644 backends/platform/bada/form.h delete mode 100644 backends/platform/bada/fs.cpp delete mode 100644 backends/platform/bada/fs.h delete mode 100644 backends/platform/bada/graphics.cpp delete mode 100644 backends/platform/bada/graphics.h delete mode 100644 backends/platform/bada/main.cpp delete mode 100644 backends/platform/bada/missing.cpp delete mode 100644 backends/platform/bada/portdefs.h delete mode 100644 backends/platform/bada/sscanf.cpp delete mode 100644 backends/platform/bada/system.cpp delete mode 100644 backends/platform/bada/system.h create mode 100644 backends/platform/tizen/README.TXT create mode 100644 backends/platform/tizen/application.cpp create mode 100644 backends/platform/tizen/application.h create mode 100644 backends/platform/tizen/audio.cpp create mode 100644 backends/platform/tizen/audio.h create mode 100644 backends/platform/tizen/form.cpp create mode 100644 backends/platform/tizen/form.h create mode 100644 backends/platform/tizen/fs.cpp create mode 100644 backends/platform/tizen/fs.h create mode 100644 backends/platform/tizen/graphics.cpp create mode 100644 backends/platform/tizen/graphics.h create mode 100644 backends/platform/tizen/main.cpp create mode 100644 backends/platform/tizen/missing.cpp create mode 100644 backends/platform/tizen/portdefs.h create mode 100644 backends/platform/tizen/sscanf.cpp create mode 100644 backends/platform/tizen/system.cpp create mode 100644 backends/platform/tizen/system.h create mode 100644 backends/platform/tizen/tizen.mk delete mode 100644 backends/timer/bada/timer.cpp delete mode 100644 backends/timer/bada/timer.h create mode 100644 backends/timer/tizen/timer.cpp create mode 100644 backends/timer/tizen/timer.h diff --git a/AUTHORS b/AUTHORS index e6a25b5b76..0a2d2c5fe1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -238,9 +238,6 @@ ScummVM Team Andre Heider Angus Lees - BADA: - Chris Warren-Smith - Dreamcast: Marcus Comstedt @@ -288,6 +285,9 @@ ScummVM Team Jurgen Braam Lars Persson + Tizen / BADA: + Chris Warren-Smith + WebOS: Klaus Reimer diff --git a/Makefile b/Makefile index 1ed1824e2d..09c38b2598 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,10 @@ ifeq "$(HAVE_GCC)" "1" # being helpful. #CXXFLAGS+= -Wmissing-format-attribute - # Disable RTTI and exceptions +ifneq "$(BACKEND)" "tizen" + # Disable RTTI and exceptions. These settings cause tizen apps to crash CXXFLAGS+= -fno-rtti -fno-exceptions +endif ifneq "$(HAVE_CLANG)" "1" # enable checking of pointers returned by "new", but only when we do not diff --git a/backends/graphics/opengl/gltexture.h b/backends/graphics/opengl/gltexture.h index 8ff9838ff7..6ef80923ae 100644 --- a/backends/graphics/opengl/gltexture.h +++ b/backends/graphics/opengl/gltexture.h @@ -44,9 +44,9 @@ #define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) #endif -#if defined(BADA) +#if defined(TIZEN) #include -using namespace Osp::Graphics::Opengl; +using namespace Tizen::Graphics::Opengl; #elif defined(USE_GLES) #include #elif defined(SDL_BACKEND) diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index b46f33a2bc..72a6699a06 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -52,7 +52,7 @@ bool ModularBackend::hasFeature(Feature f) { } void ModularBackend::setFeatureState(Feature f, bool enable) { - return _graphicsManager->setFeatureState(f, enable); + _graphicsManager->setFeatureState(f, enable); } bool ModularBackend::getFeatureState(Feature f) { diff --git a/backends/module.mk b/backends/module.mk index a4f525d21d..092b369ab0 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -120,9 +120,9 @@ MODULE_OBJS += \ mixer/sdl13/sdl13-mixer.o endif -ifeq ($(BACKEND),bada) +ifeq ($(BACKEND),tizen) MODULE_OBJS += \ - timer/bada/timer.o + timer/tizen/timer.o endif ifeq ($(BACKEND),ds) diff --git a/backends/platform/bada/README.TXT b/backends/platform/bada/README.TXT deleted file mode 100644 index c4a04d5450..0000000000 --- a/backends/platform/bada/README.TXT +++ /dev/null @@ -1,92 +0,0 @@ -Build instructions: - -1. Install BADA SDK (requires free registration): - - http://developer.bada.com/apis/index.do - -2. Install Cygwin: - - http://www.cygwin.com/ - - Add the following to your cygwin .bash_profile: - - alias mmake=/cygdrive/c/MinGW/bin/mingw32-make.exe - export BADA_SDK=/cygdrive/c/bada/1.2.1 - export ARM_BIN=c:/bada/1.2.1/Tools/Toolchains/ARM/bin - export CPPFLAGS="-fpic -fshort-wchar -mcpu=cortex-a8 -mfpu=vfpv3 \ - -mfloat-abi=hard -mlittle-endian -mthumb-interwork -Wno-psabi \ - -fno-strict-aliasing -fno-short-enums" - export LDFLAGS="-nostdlib -lc-newlib -lm-newlib -LC:/bada/1.2.1/Model/Wave_LP1/Target" - #export PATH=${BADA_SDK}/Tools/Toolchains/Win32/bin:${PATH} - export PATH=${BADA_SDK}/Tools/Toolchains/ARM/bin:~/utils:${PATH} - alias gcc=${ARM_BIN}/arm-samsung-nucleuseabi-gcc.exe - alias ar=${ARM_BIN}/arm-samsung-nucleuseabi-ar.exe - - The following were added to ~/utils for zlib: - - ar: - #!/bin/sh - ${ARM_BIN}/arm-samsung-nucleuseabi-ar.exe $* - - gcc: - #!/bin/sh - ${ARM_BIN}/arm-samsung-nucleuseabi-gcc.exe $* - -3. Build dependencies - - zlib, libogg, libvorbis, libmad, FLAC - - see: "Building the libraries" under: - http://wiki.scummvm.org/index.php/Compiling_ScummVM/MinGW#Building_the_libraries - for instructions on how to obtain these modules - - 3.1 For Target-Release configure ogg and mad with: - - ./configure --host=arm-samsung-nucleuseabi --disable-shared - - when building vorbis and flac: - - ./configure --host=arm-samsung-nucleuseabi --disable-shared --with-ogg=c:/cygwin/usr/local - - 3.2 for each module, after a successful configure, add the following - to the generated config.h (gzguts.h for zlib) - - #undef __MINGW32__ - #undef _WIN32 - #include "c:/src/scummvm/backends/platform/bada/portdefs.h" - - 3.3 Additional post configure edits: - - - removed -fforce-mem from the libMAD Makefile - - in libvorbis/lib/Makefile comment lines with vorbis_selftests - - edit libFLAC/Makefile ... CFLAGS = $(OGG_CFLAGS) - - Note: you can ignore the ranlib errors when doing make install. - -4. Build the ScummVM base library: - - ./configure --host=bada --enable-release - - To target the Win32 simulator: - - ./configure --host=bada --enable-debug - -5. Build the front end application using BADA-Ide: - - Copy the scummvm/dists/bada folder into a clean directory - outside of the scummvm package. Start the BADA IDE then - choose this folder as the eclipse workspace. Click - Project / Build. - -Links: - -A short turorial on implementing OpenGL ES 1.1 in BADA: - http://forums.badadev.com/viewtopic.php?f=7&t=208 - -HelvB14 font files: - http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html - http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts-75dpi100dpi.tar.gz - - Then run the following command: - $ ./ucs2any.pl 100dpi/helvB14.bdf MAPPINGS/8859-1.TXT iso8859-1 \ - MAPPINGS/8859-2.TXT iso8859-2 MAPPINGS/8859-3.TXT iso8859-3 diff --git a/backends/platform/bada/application.cpp b/backends/platform/bada/application.cpp deleted file mode 100644 index e761649245..0000000000 --- a/backends/platform/bada/application.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "engines/engine.h" - -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/system.h" -#include "backends/platform/bada/application.h" - -using namespace Osp::System; -using namespace Osp::Ui::Controls; - -Application *BadaScummVM::createInstance() { - return new BadaScummVM(); -} - -BadaScummVM::BadaScummVM() : _appForm(0) { -} - -BadaScummVM::~BadaScummVM() { - logEntered(); - if (g_system) { - BadaSystem *system = (BadaSystem *)g_system; - system->destroyBackend(); - delete system; - g_system = 0; - } -} - -bool BadaScummVM::OnAppInitializing(AppRegistry &appRegistry) { - _appForm = systemStart(this); - return (_appForm != NULL); -} - -bool BadaScummVM::OnAppTerminating(AppRegistry &appRegistry, - bool forcedTermination) { - logEntered(); - return true; -} - -void BadaScummVM::OnUserEventReceivedN(RequestId requestId, - Osp::Base::Collection::IList *args) { - logEntered(); - - if (requestId == USER_MESSAGE_EXIT) { - // normal program termination - Terminate(); - } else if (requestId == USER_MESSAGE_EXIT_ERR) { - // assertion failure termination - String *message = NULL; - if (args) { - message = (String *)args->GetAt(0); - } - if (!message) { - message = new String("Unknown error"); - } - - MessageBox messageBox; - messageBox.Construct(L"Oops...", *message, MSGBOX_STYLE_OK); - int modalResult; - messageBox.ShowAndWait(modalResult); - Terminate(); - } -} - -void BadaScummVM::OnForeground(void) { - logEntered(); - pauseGame(false); -} - -void BadaScummVM::OnBackground(void) { - logEntered(); - pauseGame(true); -} - -void BadaScummVM::OnBatteryLevelChanged(BatteryLevel batteryLevel) { -} - -void BadaScummVM::OnLowMemory(void) { -} - -void BadaScummVM::pauseGame(bool pause) { - if (_appForm) { - if (pause && g_engine && !g_engine->isPaused()) { - _appForm->pushKey(Common::KEYCODE_SPACE); - } - - if (g_system) { - ((BadaSystem *)g_system)->setMute(pause); - } - } -} diff --git a/backends/platform/bada/application.h b/backends/platform/bada/application.h deleted file mode 100644 index 2b0d37f1ef..0000000000 --- a/backends/platform/bada/application.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_APPLICATION_H -#define BADA_APPLICATION_H - -#include -#include -#include -#include -#include - -#include "backends/platform/bada/system.h" - -class BadaScummVM : public Osp::App::Application { -public: - BadaScummVM(); - ~BadaScummVM(); - - static Osp::App::Application *createInstance(void); - - bool OnAppInitializing(Osp::App::AppRegistry &appRegistry); - bool OnAppTerminating(Osp::App::AppRegistry &appRegistry, bool forcedTermination = false); - void OnForeground(void); - void OnBackground(void); - void OnLowMemory(void); - void OnBatteryLevelChanged(Osp::System::BatteryLevel batteryLevel); - void OnUserEventReceivedN(RequestId requestId, Osp::Base::Collection::IList *pArgs); - -private: - void pauseGame(bool pause); - BadaAppForm *_appForm; -}; - -#endif diff --git a/backends/platform/bada/audio.cpp b/backends/platform/bada/audio.cpp deleted file mode 100644 index 65a5a80fa5..0000000000 --- a/backends/platform/bada/audio.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include - -#include "backends/platform/bada/audio.h" -#include "backends/platform/bada/system.h" - -#define TIMER_INCREMENT 10 -#define TIMER_INTERVAL 40 -#define MIN_TIMER_INTERVAL 10 -#define MAX_TIMER_INTERVAL 160 -#define INIT_LEVEL 3 -#define CONFIG_KEY L"audiovol" - -// sound level pre-sets -const int levels[] = {0, 1, 10, 45, 70, 99}; - -AudioThread::AudioThread() : - _mixer(0), - _timer(0), - _audioOut(0), - _head(0), - _tail(0), - _ready(0), - _interval(TIMER_INTERVAL), - _playing(-1), - _muted(true) { -} - -Audio::MixerImpl *AudioThread::Construct(OSystem *system) { - logEntered(); - - if (IsFailed(Thread::Construct(THREAD_TYPE_EVENT_DRIVEN, - DEFAULT_STACK_SIZE, - THREAD_PRIORITY_HIGH))) { - AppLog("Failed to create AudioThread"); - return NULL; - } - - _mixer = new Audio::MixerImpl(system, 44100); - return _mixer; -} - -AudioThread::~AudioThread() { - logEntered(); -} - -bool AudioThread::isSilentMode() { - bool silentMode; - String key(L"SilentMode"); - Osp::System::SettingInfo::GetValue(key, silentMode); - return silentMode; -} - -void AudioThread::setMute(bool on) { - if (_audioOut && _timer) { - _muted = on; - if (on) { - _timer->Cancel(); - } else { - _timer->Start(_interval); - } - } -} - -int AudioThread::setVolume(bool up, bool minMax) { - int level = -1; - int numLevels = sizeof(levels) / sizeof(levels[0]); - - if (_audioOut) { - int volume = _audioOut->GetVolume(); - if (minMax) { - level = up ? numLevels - 1 : 0; - volume = levels[level]; - } else { - // adjust volume to be one of the preset values - for (int i = 0; i < numLevels && level == -1; i++) { - if (volume == levels[i]) { - level = i; - if (up) { - if (i + 1 < numLevels) { - level = i + 1; - } - } else if (i > 0) { - level = i - 1; - } - } - } - - // default to INIT_LEVEL when current not preset value - if (level == -1) { - level = INIT_LEVEL; - } - volume = levels[level]; - } - - _audioOut->SetVolume(volume); - - // remember the chosen setting - AppRegistry *registry = Application::GetInstance()->GetAppRegistry(); - if (registry) { - registry->Set(CONFIG_KEY, volume); - } - } - return level; -} - -bool AudioThread::OnStart(void) { - logEntered(); - - _audioOut = new Osp::Media::AudioOut(); - if (!_audioOut || - IsFailed(_audioOut->Construct(*this))) { - AppLog("Failed to create AudioOut"); - return false; - } - - int sampleRate = _mixer->getOutputRate(); - - // ideally we would update _mixer with GetOptimizedSampleRate here - if (_audioOut->GetOptimizedSampleRate() != sampleRate) { - AppLog("Non optimal sample rate %d", _audioOut->GetOptimizedSampleRate()); - } - - if (IsFailed(_audioOut->Prepare(AUDIO_TYPE_PCM_S16_LE, - AUDIO_CHANNEL_TYPE_STEREO, - sampleRate))) { - AppLog("Failed to prepare AudioOut %d", sampleRate); - return false; - } - - int bufferSize = _audioOut->GetMinBufferSize(); - for (int i = 0; i < NUM_AUDIO_BUFFERS; i++) { - if (IsFailed(_audioBuffer[i].Construct(bufferSize))) { - AppLog("Failed to create audio buffer"); - return false; - } - } - - _timer = new Timer(); - if (!_timer || IsFailed(_timer->Construct(*this))) { - AppLog("Failed to create audio timer"); - return false; - } - - if (IsFailed(_timer->Start(_interval))) { - AppLog("failed to start audio timer"); - return false; - } - - // get the volume from the app-registry - int volume = levels[INIT_LEVEL]; - AppRegistry *registry = Application::GetInstance()->GetAppRegistry(); - if (registry) { - if (E_KEY_NOT_FOUND == registry->Get(CONFIG_KEY, volume)) { - registry->Add(CONFIG_KEY, volume); - volume = levels[INIT_LEVEL]; - } else { - AppLog("Setting volume: %d", volume); - } - } - - _muted = false; - _mixer->setReady(true); - _audioOut->SetVolume(isSilentMode() ? 0 : volume); - _audioOut->Start(); - return true; -} - -void AudioThread::OnStop(void) { - logEntered(); - - _mixer->setReady(false); - - if (_timer) { - if (!_muted) { - _timer->Cancel(); - } - delete _timer; - } - - if (_audioOut) { - _audioOut->Reset(); - delete _audioOut; - } -} - -void AudioThread::OnAudioOutErrorOccurred(Osp::Media::AudioOut &src, result r) { - logEntered(); -} - -void AudioThread::OnAudioOutInterrupted(Osp::Media::AudioOut &src) { - logEntered(); -} - -void AudioThread::OnAudioOutReleased(Osp::Media::AudioOut &src) { - logEntered(); - _audioOut->Start(); -} - -void AudioThread::OnAudioOutBufferEndReached(Osp::Media::AudioOut &src) { - if (_ready > 0) { - _playing = _tail; - _audioOut->WriteBuffer(_audioBuffer[_tail]); - _tail = (_tail + 1) % NUM_AUDIO_BUFFERS; - _ready--; - } else { - // audio buffer empty: decrease timer inverval - _playing = -1; - _interval -= TIMER_INCREMENT; - if (_interval < MIN_TIMER_INTERVAL) { - _interval = MIN_TIMER_INTERVAL; - } - } -} - -void AudioThread::OnTimerExpired(Timer &timer) { - if (_ready < NUM_AUDIO_BUFFERS) { - uint len = _audioBuffer[_head].GetCapacity(); - int samples = _mixer->mixCallback((byte *)_audioBuffer[_head].GetPointer(), len); - if (samples) { - _head = (_head + 1) % NUM_AUDIO_BUFFERS; - _ready++; - } - } else { - // audio buffer full: increase timer inverval - _interval += TIMER_INCREMENT; - if (_interval > MAX_TIMER_INTERVAL) { - _interval = MAX_TIMER_INTERVAL; - } - } - - if (_ready && _playing == -1) { - OnAudioOutBufferEndReached(*_audioOut); - } - - _timer->Start(_interval); -} - diff --git a/backends/platform/bada/audio.h b/backends/platform/bada/audio.h deleted file mode 100644 index 72c537a942..0000000000 --- a/backends/platform/bada/audio.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_AUDIO_H -#define BADA_AUDIO_H - -#include -#include -#include -#include - -#include "config.h" -#include "common/scummsys.h" -#include "common/system.h" -#include "audio/mixer_intern.h" - -using namespace Osp::Base; -using namespace Osp::Base::Collection; -using namespace Osp::Base::Runtime; -using namespace Osp::Media; -using namespace Osp::Io; - -#define NUM_AUDIO_BUFFERS 2 - -class AudioThread: public Osp::Media::IAudioOutEventListener, - public Osp::Base::Runtime::ITimerEventListener, - public Osp::Base::Runtime::Thread { -public: - AudioThread(void); - ~AudioThread(void); - - Audio::MixerImpl *Construct(OSystem *system); - bool isSilentMode(); - void setMute(bool on); - int setVolume(bool up, bool minMax); - - bool OnStart(void); - void OnStop(void); - void OnAudioOutErrorOccurred(Osp::Media::AudioOut &src, result r); - void OnAudioOutInterrupted(Osp::Media::AudioOut &src); - void OnAudioOutReleased(Osp::Media::AudioOut &src); - void OnAudioOutBufferEndReached(Osp::Media::AudioOut &src); - void OnTimerExpired(Timer &timer); - -private: - Audio::MixerImpl *_mixer; - Osp::Base::Runtime::Timer *_timer; - Osp::Media::AudioOut *_audioOut; - Osp::Base::ByteBuffer _audioBuffer[NUM_AUDIO_BUFFERS]; - int _head, _tail, _ready, _interval, _playing; - bool _muted; -}; - -#endif diff --git a/backends/platform/bada/bada.mk b/backends/platform/bada/bada.mk deleted file mode 100644 index 7c72d7752b..0000000000 --- a/backends/platform/bada/bada.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Bada specific modules are built under eclipse - -$(EXECUTABLE): $(OBJS) - rm -f $@ - ar Tru $@ $(OBJS) diff --git a/backends/platform/bada/form.cpp b/backends/platform/bada/form.cpp deleted file mode 100644 index dfa72bce08..0000000000 --- a/backends/platform/bada/form.cpp +++ /dev/null @@ -1,464 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include - -#include "common/translation.h" -#include "base/main.h" - -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/system.h" - -using namespace Osp::Base::Runtime; -using namespace Osp::Ui; -using namespace Osp::Ui::Controls; - -// number of volume levels -#define LEVEL_RANGE 5 - -// round down small Y touch values to 1 to allow the -// cursor to be positioned at the top of the screen -#define MIN_TOUCH_Y 10 - -// block for up to 2.5 seconds during shutdown to -// allow the game thread to exit gracefully. -#define EXIT_SLEEP_STEP 10 -#define EXIT_SLEEP 250 - -// -// BadaAppForm -// -BadaAppForm::BadaAppForm() : - _gameThread(0), - _state(kInitState), - _buttonState(kLeftButton), - _shortcut(kSetVolume) { - _eventQueueLock = new Mutex(); - _eventQueueLock->Create(); -} - -result BadaAppForm::Construct() { - result r = Form::Construct(Controls::FORM_STYLE_NORMAL); - if (IsFailed(r)) { - return r; - } - - BadaSystem *badaSystem = NULL; - _gameThread = NULL; - - badaSystem = new BadaSystem(this); - r = badaSystem != NULL ? E_SUCCESS : E_OUT_OF_MEMORY; - - if (!IsFailed(r)) { - r = badaSystem->Construct(); - } - - if (!IsFailed(r)) { - _gameThread = new Thread(); - r = _gameThread != NULL ? E_SUCCESS : E_OUT_OF_MEMORY; - } - - if (!IsFailed(r)) { - r = _gameThread->Construct(*this); - } - - if (IsFailed(r)) { - if (badaSystem != NULL) { - delete badaSystem; - } - if (_gameThread != NULL) { - delete _gameThread; - _gameThread = NULL; - } - } else { - g_system = badaSystem; - } - - return r; -} - -BadaAppForm::~BadaAppForm() { - logEntered(); - - if (_gameThread && _state != kErrorState) { - terminate(); - - _gameThread->Stop(); - if (_state != kErrorState) { - _gameThread->Join(); - } - - delete _gameThread; - _gameThread = NULL; - } - - if (_eventQueueLock) { - delete _eventQueueLock; - _eventQueueLock = NULL; - } - - logLeaving(); -} - -// -// abort the game thread -// -void BadaAppForm::terminate() { - if (_state == kActiveState) { - ((BadaSystem *)g_system)->setMute(true); - - _eventQueueLock->Acquire(); - - Common::Event e; - e.type = Common::EVENT_QUIT; - _eventQueue.push(e); - _state = kClosingState; - - _eventQueueLock->Release(); - - // block while thread ends - AppLog("waiting for shutdown"); - for (int i = 0; i < EXIT_SLEEP_STEP && _state == kClosingState; i++) { - Thread::Sleep(EXIT_SLEEP); - } - - if (_state == kClosingState) { - // failed to terminate - Join() will freeze - _state = kErrorState; - } - } -} - -void BadaAppForm::exitSystem() { - _state = kErrorState; - - if (_gameThread) { - _gameThread->Stop(); - delete _gameThread; - _gameThread = NULL; - } -} - -result BadaAppForm::OnInitializing(void) { - logEntered(); - - SetOrientation(ORIENTATION_LANDSCAPE); - AddOrientationEventListener(*this); - AddTouchEventListener(*this); - AddKeyEventListener(*this); - - // set focus to enable receiving key events - SetFocusable(true); - SetFocus(); - - return E_SUCCESS; -} - -result BadaAppForm::OnDraw(void) { - logEntered(); - - if (g_system) { - BadaSystem *system = (BadaSystem *)g_system; - BadaGraphicsManager *graphics = system->getGraphics(); - if (graphics && graphics->isReady()) { - g_system->updateScreen(); - } - } - - return E_SUCCESS; -} - -bool BadaAppForm::pollEvent(Common::Event &event) { - bool result = false; - - _eventQueueLock->Acquire(); - if (!_eventQueue.empty()) { - event = _eventQueue.pop(); - result = true; - } - _eventQueueLock->Release(); - - return result; -} - -void BadaAppForm::pushEvent(Common::EventType type, const Point ¤tPosition) { - BadaSystem *system = (BadaSystem *)g_system; - BadaGraphicsManager *graphics = system->getGraphics(); - if (graphics) { - // graphics could be NULL at startup or when - // displaying the system error screen - Common::Event e; - e.type = type; - e.mouse.x = currentPosition.x; - e.mouse.y = currentPosition.y > MIN_TOUCH_Y ? currentPosition.y : 1; - - bool moved = graphics->moveMouse(e.mouse.x, e.mouse.y); - - _eventQueueLock->Acquire(); - - if (moved && type != Common::EVENT_MOUSEMOVE) { - Common::Event moveEvent; - moveEvent.type = Common::EVENT_MOUSEMOVE; - moveEvent.mouse = e.mouse; - _eventQueue.push(moveEvent); - } - - _eventQueue.push(e); - _eventQueueLock->Release(); - } -} - -void BadaAppForm::pushKey(Common::KeyCode keycode) { - Common::Event e; - e.synthetic = false; - e.kbd.keycode = keycode; - e.kbd.ascii = keycode; - e.kbd.flags = 0; - - _eventQueueLock->Acquire(); - - e.type = Common::EVENT_KEYDOWN; - _eventQueue.push(e); - e.type = Common::EVENT_KEYUP; - _eventQueue.push(e); - - _eventQueueLock->Release(); -} - -void BadaAppForm::OnOrientationChanged(const Control &source, - OrientationStatus orientationStatus) { - logEntered(); - if (_state == kInitState) { - _state = kActiveState; - _gameThread->Start(); - } -} - -Object *BadaAppForm::Run(void) { - scummvm_main(0, 0); - - if (_state == kActiveState) { - Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT, NULL); - } - _state = kDoneState; - return NULL; -} - -void BadaAppForm::setButtonShortcut() { - switch (_buttonState) { - case kLeftButton: - g_system->displayMessageOnOSD(_("Right Click Once")); - _buttonState = kRightButtonOnce; - break; - case kRightButtonOnce: - g_system->displayMessageOnOSD(_("Right Click")); - _buttonState = kRightButton; - break; - case kRightButton: - g_system->displayMessageOnOSD(_("Move Only")); - _buttonState = kMoveOnly; - break; - case kMoveOnly: - g_system->displayMessageOnOSD(_("Left Click")); - _buttonState = kLeftButton; - break; - } -} - -void BadaAppForm::setShortcut() { - // cycle to the next shortcut - switch (_shortcut) { - case kControlMouse: - g_system->displayMessageOnOSD(_("Escape Key")); - _shortcut = kEscapeKey; - break; - - case kEscapeKey: - g_system->displayMessageOnOSD(_("Game Menu")); - _shortcut = kGameMenu; - break; - - case kGameMenu: - g_system->displayMessageOnOSD(_("Show Keypad")); - _shortcut = kShowKeypad; - break; - - case kSetVolume: - // fallthru - - case kShowKeypad: - g_system->displayMessageOnOSD(_("Control Mouse")); - _shortcut = kControlMouse; - break; - } -} - -void BadaAppForm::setVolume(bool up, bool minMax) { - int level = ((BadaSystem *)g_system)->setVolume(up, minMax); - if (level != -1) { - char message[32]; - char ind[LEVEL_RANGE]; // 1..5 (0=off) - int j = LEVEL_RANGE - 1; // 0..4 - for (int i = 1; i <= LEVEL_RANGE; i++) { - ind[j--] = level >= i ? '|' : ' '; - } - snprintf(message, sizeof(message), "Volume: [ %c%c%c%c%c ]", - ind[0], ind[1], ind[2], ind[3], ind[4]); - g_system->displayMessageOnOSD(message); - } -} - -void BadaAppForm::showKeypad() { - // display the soft keyboard - _buttonState = kLeftButton; - pushKey(Common::KEYCODE_F7); -} - -void BadaAppForm::OnTouchDoublePressed(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { - if (_buttonState != kMoveOnly) { - pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, - currentPosition); - pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, - currentPosition); - } -} - -void BadaAppForm::OnTouchFocusIn(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { -} - -void BadaAppForm::OnTouchFocusOut(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { -} - -void BadaAppForm::OnTouchLongPressed(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { - if (_buttonState != kLeftButton) { - pushKey(Common::KEYCODE_RETURN); - } -} - -void BadaAppForm::OnTouchMoved(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { - pushEvent(Common::EVENT_MOUSEMOVE, currentPosition); -} - -void BadaAppForm::OnTouchPressed(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { - if (_buttonState != kMoveOnly) { - pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, - currentPosition); - } -} - -void BadaAppForm::OnTouchReleased(const Control &source, - const Point ¤tPosition, - const TouchEventInfo &touchInfo) { - if (_buttonState != kMoveOnly) { - pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP, - currentPosition); - if (_buttonState == kRightButtonOnce) { - _buttonState = kLeftButton; - } - // flick to skip dialog - if (touchInfo.IsFlicked()) { - pushKey(Common::KEYCODE_PERIOD); - } - } -} - -void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) { - logEntered(); - switch (keyCode) { - case KEY_SIDE_UP: - _shortcut = kSetVolume; - setVolume(true, true); - return; - - case KEY_SIDE_DOWN: - _shortcut = kSetVolume; - setVolume(false, true); - return; - - case KEY_CAMERA: - _shortcut = kShowKeypad; - showKeypad(); - return; - - default: - break; - } -} - -void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) { - switch (keyCode) { - case KEY_SIDE_UP: - if (_shortcut != kSetVolume) { - _shortcut = kSetVolume; - } else { - setVolume(true, false); - } - return; - - case KEY_SIDE_DOWN: - switch (_shortcut) { - case kControlMouse: - setButtonShortcut(); - break; - - case kEscapeKey: - pushKey(Common::KEYCODE_ESCAPE); - break; - - case kGameMenu: - _buttonState = kLeftButton; - pushKey(Common::KEYCODE_F5); - break; - - case kShowKeypad: - showKeypad(); - break; - - default: - setVolume(false, false); - break; - } - break; - - case KEY_CAMERA: - setShortcut(); - break; - - default: - break; - } -} - -void BadaAppForm::OnKeyReleased(const Control &source, KeyCode keyCode) { -} diff --git a/backends/platform/bada/form.h b/backends/platform/bada/form.h deleted file mode 100644 index 3340e2216b..0000000000 --- a/backends/platform/bada/form.h +++ /dev/null @@ -1,108 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_FORM_H -#define BADA_FORM_H - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "common/scummsys.h" -#include "common/events.h" -#include "common/queue.h" -#include "common/mutex.h" - -// -// BadaAppForm -// -class BadaAppForm : public Osp::Ui::Controls::Form, - public Osp::Ui::IOrientationEventListener, - public Osp::Ui::ITouchEventListener, - public Osp::Ui::IKeyEventListener, - public Osp::Base::Runtime::IRunnable { -public: - BadaAppForm(); - ~BadaAppForm(); - - result Construct(); - bool pollEvent(Common::Event &event); - bool isClosing() { return _state == kClosingState; } - void pushKey(Common::KeyCode keycode); - void exitSystem(); - -private: - Object *Run(); - result OnInitializing(void); - result OnDraw(void); - void OnOrientationChanged(const Osp::Ui::Control &source, - Osp::Ui::OrientationStatus orientationStatus); - void OnTouchDoublePressed(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchFocusIn(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchFocusOut(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchLongPressed(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchMoved(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchPressed(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnTouchReleased(const Osp::Ui::Control &source, - const Osp::Graphics::Point ¤tPosition, - const Osp::Ui::TouchEventInfo &touchInfo); - void OnKeyLongPressed(const Osp::Ui::Control &source, - Osp::Ui::KeyCode keyCode); - void OnKeyPressed(const Osp::Ui::Control &source, - Osp::Ui::KeyCode keyCode); - void OnKeyReleased(const Osp::Ui::Control &source, - Osp::Ui::KeyCode keyCode); - - void pushEvent(Common::EventType type, - const Osp::Graphics::Point ¤tPosition); - void terminate(); - void setButtonShortcut(); - void setShortcut(); - void setVolume(bool up, bool minMax); - void showKeypad(); - - // event handling - Osp::Base::Runtime::Thread *_gameThread; - Osp::Base::Runtime::Mutex *_eventQueueLock; - Common::Queue _eventQueue; - enum { kInitState, kActiveState, kClosingState, kDoneState, kErrorState } _state; - enum { kLeftButton, kRightButtonOnce, kRightButton, kMoveOnly } _buttonState; - enum { kControlMouse, kEscapeKey, kGameMenu, kShowKeypad, kSetVolume } _shortcut; -}; - -#endif diff --git a/backends/platform/bada/fs.cpp b/backends/platform/bada/fs.cpp deleted file mode 100644 index 37ca496d18..0000000000 --- a/backends/platform/bada/fs.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "backends/platform/bada/system.h" -#include "backends/platform/bada/fs.h" - -#define BUFFER_SIZE 1024 - -// internal BADA paths -#define PATH_ROOT "/" -#define PATH_HOME "/Home" -#define PATH_HOME_SHARE "/Home/Share" -#define PATH_HOME_SHARE2 "/Home/Share2" -#define PATH_HOME_X "/Home/" -#define PATH_HOME_EXT "/HomeExt" -#define PATH_MEDIA "/Media" -#define PATH_CARD "/Storagecard" -#define PATH_CARD_MEDIA "/Storagecard/Media" - -// -// BadaFileStream -// -class BadaFileStream : public Common::SeekableReadStream, - public Common::WriteStream, - public Common::NonCopyable { -public: - static BadaFileStream *makeFromPath(const String &path, bool writeMode); - - BadaFileStream(File *file, bool writeMode); - ~BadaFileStream(); - - bool err() const; - void clearErr(); - bool eos() const; - - uint32 write(const void *dataPtr, uint32 dataSize); - bool flush(); - - int32 pos() const; - int32 size() const; - bool seek(int32 offs, int whence = SEEK_SET); - uint32 read(void *dataPtr, uint32 dataSize); - -private: - byte buffer[BUFFER_SIZE]; - uint32 bufferIndex; - uint32 bufferLength; - bool writeMode; - File *file; -}; - -BadaFileStream::BadaFileStream(File *ioFile, bool writeMode) : - bufferIndex(0), - bufferLength(0), - writeMode(writeMode), - file(ioFile) { - AppAssert(ioFile != 0); -} - -BadaFileStream::~BadaFileStream() { - if (file) { - if (writeMode) { - flush(); - } - delete file; - } -} - -bool BadaFileStream::err() const { - result r = GetLastResult(); - return (r != E_SUCCESS && r != E_END_OF_FILE); -} - -void BadaFileStream::clearErr() { - SetLastResult(E_SUCCESS); -} - -bool BadaFileStream::eos() const { - return (bufferLength - bufferIndex == 0) && (GetLastResult() == E_END_OF_FILE); -} - -int32 BadaFileStream::pos() const { - return file->Tell() - (bufferLength - bufferIndex); -} - -int32 BadaFileStream::size() const { - int32 oldPos = file->Tell(); - file->Seek(FILESEEKPOSITION_END, 0); - - int32 length = file->Tell(); - SetLastResult(file->Seek(FILESEEKPOSITION_BEGIN, oldPos)); - - return length; -} - -bool BadaFileStream::seek(int32 offs, int whence) { - bool result = false; - switch (whence) { - case SEEK_SET: - // set from start of file - SetLastResult(file->Seek(FILESEEKPOSITION_BEGIN, offs)); - result = (E_SUCCESS == GetLastResult()); - break; - - case SEEK_CUR: - // set relative to offs - if (bufferIndex < bufferLength && bufferIndex > (uint32)-offs) { - // re-position within the buffer - SetLastResult(E_SUCCESS); - bufferIndex += offs; - return true; - } else { - offs -= (bufferLength - bufferIndex); - if (offs < 0 && file->Tell() + offs < 0) { - // avoid negative positioning - offs = 0; - } - if (offs != 0) { - SetLastResult(file->Seek(FILESEEKPOSITION_CURRENT, offs)); - result = (E_SUCCESS == GetLastResult()); - } else { - result = true; - } - } - break; - - case SEEK_END: - // set relative to end - positive will increase the file size - SetLastResult(file->Seek(FILESEEKPOSITION_END, offs)); - result = (E_SUCCESS == GetLastResult()); - break; - - default: - AppLog("Invalid whence %d", whence); - return false; - } - - if (!result) { - AppLog("seek failed"); - } - - bufferIndex = bufferLength = 0; - return result; -} - -uint32 BadaFileStream::read(void *ptr, uint32 len) { - uint32 result = 0; - if (!eos()) { - if (bufferIndex < bufferLength) { - // use existing buffer - uint32 available = bufferLength - bufferIndex; - if (len <= available) { - // use allocation - memcpy((byte *)ptr, &buffer[bufferIndex], len); - bufferIndex += len; - result = len; - } else { - // use remaining allocation - memcpy((byte *)ptr, &buffer[bufferIndex], available); - uint32 remaining = len - available; - result = available; - - if (remaining) { - result += file->Read(((byte *)ptr) + available, remaining); - } - bufferIndex = bufferLength = 0; - } - } else if (len < BUFFER_SIZE) { - // allocate and use buffer - bufferIndex = 0; - bufferLength = file->Read(buffer, BUFFER_SIZE); - if (bufferLength) { - if (bufferLength < len) { - len = bufferLength; - } - memcpy((byte *)ptr, buffer, len); - result = bufferIndex = len; - } - } else { - result = file->Read((byte *)ptr, len); - bufferIndex = bufferLength = 0; - } - } else { - AppLog("Attempted to read past EOS"); - } - return result; -} - -uint32 BadaFileStream::write(const void *ptr, uint32 len) { - result r = file->Write(ptr, len); - SetLastResult(r); - return (r == E_SUCCESS ? len : 0); -} - -bool BadaFileStream::flush() { - logEntered(); - SetLastResult(file->Flush()); - return (E_SUCCESS == GetLastResult()); -} - -BadaFileStream *BadaFileStream::makeFromPath(const String &path, bool writeMode) { - File *ioFile = new File(); - - String filePath = path; - if (writeMode && (path[0] != '.' && path[0] != '/')) { - filePath.Insert(PATH_HOME_X, 0); - } - - AppLog("Open file %S", filePath.GetPointer()); - - result r = ioFile->Construct(filePath, writeMode ? L"w" : L"r", writeMode); - if (r == E_SUCCESS) { - return new BadaFileStream(ioFile, writeMode); - } - - AppLog("Failed to open file"); - delete ioFile; - return 0; -} - -// -// converts a bada (wchar) String into a scummVM (char) string -// -Common::String fromString(const Osp::Base::String &in) { - ByteBuffer *buf = StringUtil::StringToUtf8N(in); - Common::String result((const char*)buf->GetPointer()); - delete buf; - - return result; -} - -// -// BadaFilesystemNode -// -BadaFilesystemNode::BadaFilesystemNode(const Common::String &nodePath) { - AppAssert(nodePath.size() > 0); - init(nodePath); -} - -BadaFilesystemNode::BadaFilesystemNode(const Common::String &root, - const Common::String &nodePath) { - // Make sure the string contains no slashes - AppAssert(!nodePath.contains('/')); - - // We assume here that path is already normalized (hence don't bother to - // call Common::normalizePath on the final path). - Common::String newPath(root); - if (root.lastChar() != '/') { - newPath += '/'; - } - newPath += nodePath; - - init(newPath); -} - -void BadaFilesystemNode::init(const Common::String &nodePath) { - // Normalize the path (that is, remove unneeded slashes etc.) - _path = Common::normalizePath(nodePath, '/'); - _displayName = Common::lastPathComponent(_path, '/'); - - StringUtil::Utf8ToString(_path.c_str(), _unicodePath); - _isVirtualDir = (_path == PATH_ROOT || - _path == PATH_HOME || - _path == PATH_HOME_SHARE || - _path == PATH_HOME_SHARE2 || - _path == PATH_CARD); - _isValid = _isVirtualDir || !IsFailed(File::GetAttributes(_unicodePath, _attr)); -} - -bool BadaFilesystemNode::exists() const { - return _isValid; -} - -bool BadaFilesystemNode::isReadable() const { - return _isVirtualDir || _isValid; -} - -bool BadaFilesystemNode::isDirectory() const { - return _isVirtualDir || (_isValid && _attr.IsDirectory()); -} - -bool BadaFilesystemNode::isWritable() const { - bool result = (_isValid && !_isVirtualDir && !_attr.IsDirectory() && !_attr.IsReadOnly()); - if (_path == PATH_HOME || - _path == PATH_HOME_EXT || - _path == PATH_HOME_SHARE || - _path == PATH_HOME_SHARE2) { - result = true; - } - return result; -} - -AbstractFSNode *BadaFilesystemNode::getChild(const Common::String &n) const { - AppAssert(!_path.empty()); - AppAssert(isDirectory()); - return new BadaFilesystemNode(_path, n); -} - -bool BadaFilesystemNode::getChildren(AbstractFSList &myList, - ListMode mode, bool hidden) const { - AppAssert(isDirectory()); - - bool result = false; - - if (_isVirtualDir && mode != Common::FSNode::kListFilesOnly) { - // present well known BADA file system areas - if (_path == PATH_ROOT) { - myList.push_back(new BadaFilesystemNode(PATH_HOME)); - myList.push_back(new BadaFilesystemNode(PATH_HOME_EXT)); - myList.push_back(new BadaFilesystemNode(PATH_MEDIA)); - myList.push_back(new BadaFilesystemNode(PATH_CARD)); - result = true; // no more entries - } else if (_path == PATH_CARD) { - myList.push_back(new BadaFilesystemNode(PATH_CARD_MEDIA)); - result = true; // no more entries - } else if (_path == PATH_HOME) { - // ensure share path is always included - myList.push_back(new BadaFilesystemNode(PATH_HOME_SHARE)); - myList.push_back(new BadaFilesystemNode(PATH_HOME_SHARE2)); - } - } - - if (!result) { - DirEnumerator *pDirEnum = 0; - Directory *pDir = new Directory(); - - // open directory - if (IsFailed(pDir->Construct(_unicodePath))) { - AppLog("Failed to open directory: %S", _unicodePath.GetPointer()); - } else { - // read all directory entries - pDirEnum = pDir->ReadN(); - if (pDirEnum) { - result = true; - } - - // loop through all directory entries - while (pDirEnum && pDirEnum->MoveNext() == E_SUCCESS) { - DirEntry dirEntry = pDirEnum->GetCurrentDirEntry(); - - // skip 'invisible' files if necessary - Osp::Base::String fileName = dirEntry.GetName(); - - if (fileName[0] == '.' && !hidden) { - continue; - } - - // skip '.' and '..' to avoid cycles - if (fileName == L"." || fileName == L"..") { - continue; - } - - // Honor the chosen mode - if ((mode == Common::FSNode::kListFilesOnly && dirEntry.IsDirectory()) || - (mode == Common::FSNode::kListDirectoriesOnly && !dirEntry.IsDirectory())) { - continue; - } - myList.push_back(new BadaFilesystemNode(_path, fromString(fileName))); - } - } - - // cleanup - if (pDirEnum) { - delete pDirEnum; - } - - // close the opened directory - if (pDir) { - delete pDir; - } - } - - return result; -} - -AbstractFSNode *BadaFilesystemNode::getParent() const { - logEntered(); - if (_path == PATH_ROOT) { - return 0; // The filesystem root has no parent - } - - const char *start = _path.c_str(); - const char *end = start + _path.size(); - - // Strip of the last component. We make use of the fact that at this - // point, path is guaranteed to be normalized - while (end > start && *(end-1) != '/') { - end--; - } - - if (end == start) { - // This only happens if we were called with a relative path, for which - // there simply is no parent. - // TODO: We could also resolve this by assuming that the parent is the - // current working directory, and returning a node referring to that. - return 0; - } - - return new BadaFilesystemNode(Common::String(start, end)); -} - -Common::SeekableReadStream *BadaFilesystemNode::createReadStream() { - Common::SeekableReadStream *result = BadaFileStream::makeFromPath(_unicodePath, false); - if (result != NULL) { - _isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr)); - } - return result; -} - -Common::WriteStream *BadaFilesystemNode::createWriteStream() { - Common::WriteStream *result = BadaFileStream::makeFromPath(_unicodePath, true); - if (result != NULL) { - _isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr)); - } - return result; -} diff --git a/backends/platform/bada/fs.h b/backends/platform/bada/fs.h deleted file mode 100644 index d7d368ac20..0000000000 --- a/backends/platform/bada/fs.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef BADA_FILESYSTEM_H -#define BADA_FILESYSTEM_H - -#include -#include -#include -#include - -#include "config.h" -#include "common/scummsys.h" -#include "common/stream.h" -#include "backends/fs/abstract-fs.h" - -using namespace Osp::Io; -using namespace Osp::Base; -using namespace Osp::Base::Utility; - -/** - * Implementation of the ScummVM file system API based on BADA. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class BadaFilesystemNode : public AbstractFSNode { -public: - /** - * Creates a BadaFilesystemNode for a given path. - * - * @param path the path the new node should point to. - */ - BadaFilesystemNode(const Common::String &path); - - Common::String getDisplayName() const { return _displayName; } - Common::String getName() const { return _displayName; } - Common::String getPath() const { return _path; } - - bool exists() const; - bool isDirectory() const; - bool isReadable() const; - bool isWritable() const; - - AbstractFSNode *getChild(const Common::String &n) const; - bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - AbstractFSNode *getParent() const; - - Common::SeekableReadStream *createReadStream(); - Common::WriteStream *createWriteStream(); - -protected: - BadaFilesystemNode(const Common::String &root, - const Common::String &p); - void init(const Common::String &nodePath); - - Common::String _displayName; - Common::String _path; - String _unicodePath; - bool _isValid; - bool _isVirtualDir; - FileAttributes _attr; -}; - -#endif diff --git a/backends/platform/bada/graphics.cpp b/backends/platform/bada/graphics.cpp deleted file mode 100644 index bd65c597c6..0000000000 --- a/backends/platform/bada/graphics.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "graphics/fontman.h" - -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/system.h" -#include "backends/platform/bada/graphics.h" - -// -// BadaGraphicsManager -// -BadaGraphicsManager::BadaGraphicsManager(BadaAppForm *appForm) : - _appForm(appForm), - _eglDisplay(EGL_DEFAULT_DISPLAY), - _eglSurface(EGL_NO_SURFACE), - _eglConfig(0), - _eglContext(EGL_NO_CONTEXT), - _initState(true) { - assert(appForm != NULL); - _videoMode.fullscreen = true; -} - -const Graphics::Font *BadaGraphicsManager::getFontOSD() { - return FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); -} - -bool BadaGraphicsManager::moveMouse(int16 &x, int16 &y) { - int16 currentX = _cursorState.x; - int16 currentY = _cursorState.y; - - // save the current hardware coordinates - _cursorState.x = x; - _cursorState.y = y; - - // return x/y as game coordinates - adjustMousePosition(x, y); - - // convert current x/y to game coordinates - adjustMousePosition(currentX, currentY); - - // return whether game coordinates have changed - return (currentX != x || currentY != y); -} - -Common::List BadaGraphicsManager::getSupportedFormats() const { - logEntered(); - - Common::List res; - res.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)); - res.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - res.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); - res.push_back(Graphics::PixelFormat::createFormatCLUT8()); - return res; -} - -bool BadaGraphicsManager::hasFeature(OSystem::Feature f) { - bool result = (f == OSystem::kFeatureFullscreenMode || - f == OSystem::kFeatureVirtualKeyboard || - OpenGLGraphicsManager::hasFeature(f)); - return result; -} - -void BadaGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { - OpenGLGraphicsManager::setFeatureState(f, enable); -} - -void BadaGraphicsManager::setReady() { - _initState = false; -} - -void BadaGraphicsManager::updateScreen() { - if (_transactionMode == kTransactionNone) { - internUpdateScreen(); - } -} - -bool BadaGraphicsManager::loadEgl() { - logEntered(); - - EGLint numConfigs = 1; - EGLint eglConfigList[] = { - EGL_RED_SIZE, 5, - EGL_GREEN_SIZE, 6, - EGL_BLUE_SIZE, 5, - EGL_ALPHA_SIZE, 0, - EGL_DEPTH_SIZE, 8, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, - EGL_NONE - }; - - EGLint eglContextList[] = { - EGL_CONTEXT_CLIENT_VERSION, 1, - EGL_NONE - }; - - eglBindAPI(EGL_OPENGL_ES_API); - - if (_eglDisplay) { - unloadGFXMode(); - } - - _eglDisplay = eglGetDisplay((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY); - if (EGL_NO_DISPLAY == _eglDisplay) { - systemError("eglGetDisplay() failed"); - return false; - } - - if (EGL_FALSE == eglInitialize(_eglDisplay, NULL, NULL) || - EGL_SUCCESS != eglGetError()) { - systemError("eglInitialize() failed"); - return false; - } - - if (EGL_FALSE == eglChooseConfig(_eglDisplay, eglConfigList, - &_eglConfig, 1, &numConfigs) || - EGL_SUCCESS != eglGetError()) { - systemError("eglChooseConfig() failed"); - return false; - } - - if (!numConfigs) { - systemError("eglChooseConfig() failed. Matching config does not exist \n"); - return false; - } - - _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, - (EGLNativeWindowType)_appForm, NULL); - if (EGL_NO_SURFACE == _eglSurface || EGL_SUCCESS != eglGetError()) { - systemError("eglCreateWindowSurface() failed. EGL_NO_SURFACE"); - return false; - } - - _eglContext = eglCreateContext(_eglDisplay, _eglConfig, - EGL_NO_CONTEXT, eglContextList); - if (EGL_NO_CONTEXT == _eglContext || - EGL_SUCCESS != eglGetError()) { - systemError("eglCreateContext() failed"); - return false; - } - - if (false == eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext) || - EGL_SUCCESS != eglGetError()) { - systemError("eglMakeCurrent() failed"); - return false; - } - - logLeaving(); - return true; -} - -bool BadaGraphicsManager::loadGFXMode() { - logEntered(); - - if (!loadEgl()) { - unloadGFXMode(); - return false; - } - - int x, y, width, height; - _appForm->GetBounds(x, y, width, height); - _videoMode.overlayWidth = _videoMode.hardwareWidth = width; - _videoMode.overlayHeight = _videoMode.hardwareHeight = height; - _videoMode.scaleFactor = 3; // for proportional sized cursor in the launcher - - AppLog("screen size: %dx%d", _videoMode.hardwareWidth, _videoMode.hardwareHeight); - return OpenGLGraphicsManager::loadGFXMode(); -} - -void BadaGraphicsManager::loadTextures() { - logEntered(); - - OpenGLGraphicsManager::loadTextures(); - - // prevent image skew in some games, see: - // http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); -} - -void BadaGraphicsManager::internUpdateScreen() { - if (!_initState) { - OpenGLGraphicsManager::internUpdateScreen(); - eglSwapBuffers(_eglDisplay, _eglSurface); - } else { - showSplash(); - } -} - -void BadaGraphicsManager::unloadGFXMode() { - logEntered(); - - if (EGL_NO_DISPLAY != _eglDisplay) { - eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); - - if (_eglContext != EGL_NO_CONTEXT) { - eglDestroyContext(_eglDisplay, _eglContext); - _eglContext = EGL_NO_CONTEXT; - } - - if (_eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(_eglDisplay, _eglSurface); - _eglSurface = EGL_NO_SURFACE; - } - - eglTerminate(_eglDisplay); - _eglDisplay = EGL_NO_DISPLAY; - } - - _eglConfig = NULL; - - OpenGLGraphicsManager::unloadGFXMode(); - logLeaving(); -} - -// display a simple splash screen until launcher is ready -void BadaGraphicsManager::showSplash() { - Canvas canvas; - canvas.Construct(); - canvas.SetBackgroundColor(Color::COLOR_BLACK); - canvas.Clear(); - - int x = _videoMode.hardwareWidth / 3; - int y = _videoMode.hardwareHeight / 3; - - Font *pFont = new Font(); - pFont->Construct(FONT_STYLE_ITALIC | FONT_STYLE_BOLD, 55); - canvas.SetFont(*pFont); - canvas.SetForegroundColor(Color::COLOR_GREEN); - canvas.DrawText(Point(x, y), L"ScummVM"); - delete pFont; - - pFont = new Font(); - pFont->Construct(FONT_STYLE_ITALIC | FONT_STYLE_BOLD, 35); - canvas.SetFont(*pFont); - canvas.SetForegroundColor(Color::COLOR_WHITE); - canvas.DrawText(Point(x + 70, y + 50), L"Loading ..."); - delete pFont; - - canvas.Show(); - -} diff --git a/backends/platform/bada/graphics.h b/backends/platform/bada/graphics.h deleted file mode 100644 index b2aaca43bc..0000000000 --- a/backends/platform/bada/graphics.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_GRAPHICS_H -#define BADA_GRAPHICS_H - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "backends/graphics/opengl/opengl-graphics.h" -#include "graphics/font.h" -#include "backends/platform/bada/form.h" - -using namespace Osp::Graphics; -using namespace Osp::Graphics::Opengl; -using namespace Osp::App; - -class BadaGraphicsManager : public OpenGLGraphicsManager { -public: - BadaGraphicsManager(BadaAppForm *appForm); - - Common::List getSupportedFormats() const; - bool hasFeature(OSystem::Feature f); - void updateScreen(); - void setFeatureState(OSystem::Feature f, bool enable); - void setReady(); - bool isReady() { return !_initState; } - const Graphics::Font *getFontOSD(); - bool moveMouse(int16 &x, int16 &y); - -private: - void internUpdateScreen(); - bool loadGFXMode(); - void loadTextures(); - void unloadGFXMode(); - void setInternalMousePosition(int x, int y) {} - void showSplash(); - - bool loadEgl(); - BadaAppForm *_appForm; - EGLDisplay _eglDisplay; - EGLSurface _eglSurface; - EGLConfig _eglConfig; - EGLContext _eglContext; - bool _initState; -}; - -#endif diff --git a/backends/platform/bada/main.cpp b/backends/platform/bada/main.cpp deleted file mode 100644 index 8c40f24dd1..0000000000 --- a/backends/platform/bada/main.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include - -#include "backends/platform/bada/portdefs.h" -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/system.h" -#include "backends/platform/bada/application.h" - -using namespace Osp::Base; -using namespace Osp::Base::Collection; - -C_LINKAGE_BEGIN - -_EXPORT_ int OspMain(int argc, char *pArgv[]); - -/** - * The entry function of bada application called by the operating system. - */ -int OspMain(int argc, char *pArgv[]) { - result r = E_SUCCESS; - - AppLog("Application started."); - ArrayList *pArgs = new ArrayList(); - pArgs->Construct(); - - for (int i = 0; i < argc; i++) { - pArgs->Add(*(new String(pArgv[i]))); - } - - r = Osp::App::Application::Execute(BadaScummVM::createInstance, pArgs); - if (IsFailed(r)) { - r &= 0x0000FFFF; - } - - pArgs->RemoveAll(true); - delete pArgs; - AppLog("Application finished."); - - return static_cast(r); -} - -C_LINKAGE_END - - diff --git a/backends/platform/bada/missing.cpp b/backends/platform/bada/missing.cpp deleted file mode 100644 index 10d45ca4b5..0000000000 --- a/backends/platform/bada/missing.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include - -#include "backends/platform/bada/portdefs.h" - -#include -#include -#include -#include - -#define BUF_SIZE 255 - -void systemError(const char *message); - -C_LINKAGE_BEGIN - -int __errno; // for overridden method in saves/default/default-saves.cpp - -void __assert_func(const char *file, int line, - const char *func, const char *err) { - char buffer[BUF_SIZE]; - snprintf(buffer, sizeof(buffer), "%s %d %s %s", file, line, func, err); - systemError(buffer); -} - -void stderr_fprintf(void*, const char *format, ...) { - va_list ap; - char buffer[BUF_SIZE]; - - va_start(ap, format); - vsnprintf(buffer, sizeof(buffer), format, ap); - va_end(ap); - - AppLog(buffer); -} - -void stderr_vfprintf(void*, const char *format, va_list ap) { - char buffer[BUF_SIZE]; - vsnprintf(buffer, sizeof(buffer), format, ap); - AppLog(buffer); -} - -int printf(const char *format, ...) { - int result = 0; - va_list ap; - char buffer[BUF_SIZE]; - - va_start(ap, format); - result = vsnprintf(buffer, sizeof(buffer), format, ap); - va_end(ap); - - AppLog(buffer); - - return result; -} - -int sprintf(char *str, const char *format, ...) { - va_list ap; - int result; - char buffer[BUF_SIZE]; - - va_start(ap, format); - result = vsnprintf(buffer, sizeof(buffer), format, ap); - va_end(ap); - - strcpy(str, buffer); - - return result; -} - -char *strdup(const char *strSource) { - char *buffer; - int len = strlen(strSource) + 1; - buffer = (char *)malloc(len); - if (buffer) { - memcpy(buffer, strSource, len); - } - return buffer; -} - -int vsprintf(char *str, const char *format, va_list ap) { - char buffer[BUF_SIZE]; - int result = vsnprintf(buffer, sizeof(buffer), format, ap); - strcpy(str, buffer); - return result; -} - -C_LINKAGE_END diff --git a/backends/platform/bada/portdefs.h b/backends/platform/bada/portdefs.h deleted file mode 100644 index 813c5acde3..0000000000 --- a/backends/platform/bada/portdefs.h +++ /dev/null @@ -1,85 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef PORT_DEFS_H -#define PORT_DEFS_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#define M_PI 3.14159265358979323846 - -#ifdef __cplusplus - #include // causes a link error when building c programs - #define C_LINKAGE_BEGIN extern "C" { - #define C_LINKAGE_END } -#else - #define C_LINKAGE_BEGIN - #define C_LINKAGE_END -#endif - -C_LINKAGE_BEGIN - -// for libFLAC -#undef fseeko -#undef ftello -#define fseeko fseek -#define ftello ftell - -// overcome use of fprintf since bada/newlib (1.2) does not -// support stderr/stdout (undefined reference to `_impure_ptr'). - -void stderr_fprintf(void*, const char *format, ...); -void stderr_vfprintf(void*, const char *format, va_list ap); - -#undef fprintf -#undef vfprintf -#undef stderr -#undef stdout -#undef stdin -#undef fputs -#undef fflush - -#define stderr (void *)0 -#define stdout (void *)1 -#define stdin (void *)2 -#define fputs(str, file) -#define fflush(file) -#define sscanf simple_sscanf -#define fprintf stderr_fprintf -#define vfprintf stderr_vfprintf - -int printf(const char *format, ...); -int sprintf(char *str, const char *format, ...); -int simple_sscanf(const char *buffer, const char *format, ...); -char *strdup(const char *s1); -int vsprintf(char *str, const char *format, va_list ap); - -C_LINKAGE_END - -#endif diff --git a/backends/platform/bada/sscanf.cpp b/backends/platform/bada/sscanf.cpp deleted file mode 100644 index aa846698f6..0000000000 --- a/backends/platform/bada/sscanf.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include - -// -// simple sscanf replacement to match scummvm usage patterns -// - -bool scanInt(const char **in, va_list *ap, int max) { - // skip leading space characters - while (**in && **in == ' ') { - (*in)++; - } - - // number optionally preceeded with a + or - sign. - bool negate = false; - if (**in == '-') { - (*in)++; - negate = true; - } - - if (**in == '+') { - (*in)++; - } - - int *arg = va_arg(*ap, int*); - char *end; - long n = strtol(*in, &end, 10); - if (negate) { - n = -n; - } - - bool err = false; - if (end == *in || (max > 0 && (end - *in) > max)) { - err = true; - } else { - *arg = (int)n; - *in = end; - } - return err; -} - -bool scanHex(const char **in, va_list *ap) { - unsigned *arg = va_arg(*ap, unsigned*); - char *end; - long n = strtol(*in, &end, 16); - if (end == *in) { - return true; - } - - *in = end; - *arg = (unsigned) n; - return false; -} - -bool scanString(const char **in, va_list *ap) { - char *arg = va_arg(*ap, char*); - while (**in && **in != ' ' && **in != '\n' && **in != '\t') { - *arg = **in; - arg++; - (*in)++; - } - *arg = '\0'; - (*in)++; - return false; -} - -bool scanStringUntil(const char **in, va_list *ap, char c_end) { - char *arg = va_arg(*ap, char*); - while (**in && **in != c_end) { - *arg = **in; - *arg++; - (*in)++; - } - *arg = 0; - (*in)++; - return false; -} - -bool scanChar(const char **in, va_list *ap) { - char *arg = va_arg(*ap, char*); - if (**in) { - *arg = **in; - (*in)++; - } - return false; -} - -extern "C" int simple_sscanf(const char *input, const char *format, ...) { - va_list ap; - int result = 0; - const char *next = input; - - va_start(ap, format); - - while (*format) { - if (*format == '%') { - format++; - int max = 0; - while (isdigit(*format)) { - max = (max * 10) + (*format - '0'); - format++; - } - - bool err = false; - switch (*format++) { - case 'c': - err = scanChar(&next, &ap); - break; - case 'd': - case 'u': - err = scanInt(&next, &ap, max); - break; - case 'x': - err = scanHex(&next, &ap); - break; - case 's': - err = scanString(&next, &ap); - break; - case '[': - // assume %[^c] - if ('^' != *format) { - err = true; - } else { - format++; - if (*format && *(format+1) == ']') { - err = scanStringUntil(&next, &ap, *format); - format += 2; - } else { - err = true; - } - } - break; - default: - err = true; - break; - } - - if (err) { - break; - } else { - result++; - } - } else if (*format++ != *next++) { - // match input - break; - } - } - - va_end(ap); - return result; -} - -#if defined(TEST) -int main(int argc, char *pArgv[]) { - int x,y,xx,yy,h; - char buffer[100]; - unsigned u; - char c; - strcpy(buffer, "hello"); - char *b = buffer; - - if (simple_sscanf("BBX 00009 -1 +10 000", - "BBX %d %d %d %d", - &x, &y, &xx, &yy) != 4) { - printf("Failed\n"); - } else { - printf("Success %d %d %d %d\n", x, y, xx, yy); - } - - if (simple_sscanf("CAT 123x-10 0x100h 123456.AUD $ ", - "CAT %dx%d %xh %06u.AUD %c", - &x, &y, &h, &u, &c) != 5) { - printf("Failed\n"); - } else { - printf("Success %d %d %d %d '%c' \n", x, y, h, u, c); - } - - if (simple_sscanf("COPYRIGHT \"Copyright (c) 1984, 1987 Foo Systems Incorporated", - "COPYRIGHT \"%[^\"]", - b) != 1) { - printf("Failed\n"); - } else { - printf("Success %s\n", buffer); - } - - return 0; -} -#endif diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp deleted file mode 100644 index 3f862c2571..0000000000 --- a/backends/platform/bada/system.cpp +++ /dev/null @@ -1,514 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include - -#include "common/config-manager.h" -#include "common/file.h" -#include "engines/engine.h" -#include "graphics/font.h" -#include "graphics/fontman.h" -#include "graphics/fonts/bdf.h" -#include "backends/saves/default/default-saves.h" -#include "backends/events/default/default-events.h" -#include "backends/audiocd/default/default-audiocd.h" -#include "backends/mutex/mutex.h" -#include "backends/fs/fs-factory.h" -#include "backends/timer/bada/timer.h" - -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/system.h" -#include "backends/platform/bada/graphics.h" -#include "backends/platform/bada/audio.h" - -using namespace Osp::Base; -using namespace Osp::Base::Runtime; -using namespace Osp::Locales; -using namespace Osp::Ui::Controls; -using namespace Osp::System; - -#define DEFAULT_CONFIG_FILE "/Home/scummvm.ini" -#define RESOURCE_PATH "/Res" -#define MUTEX_BUFFER_SIZE 5 - -// -// BadaFilesystemFactory -// -class BadaFilesystemFactory : public FilesystemFactory { - AbstractFSNode *makeRootFileNode() const; - AbstractFSNode *makeCurrentDirectoryFileNode() const; - AbstractFSNode *makeFileNodePath(const Common::String &path) const; -}; - -AbstractFSNode *BadaFilesystemFactory::makeRootFileNode() const { - return new BadaFilesystemNode("/"); -} - -AbstractFSNode *BadaFilesystemFactory::makeCurrentDirectoryFileNode() const { - return new BadaFilesystemNode("/Home"); -} - -AbstractFSNode *BadaFilesystemFactory::makeFileNodePath(const Common::String &path) const { - AppAssert(!path.empty()); - return new BadaFilesystemNode(path); -} - -// -// BadaSaveFileManager -// -struct BadaSaveFileManager : public DefaultSaveFileManager { - bool removeSavefile(const Common::String &filename); -}; - -bool BadaSaveFileManager::removeSavefile(const Common::String &filename) { - Common::String savePathName = getSavePath(); - - checkPath(Common::FSNode(savePathName)); - if (getError().getCode() != Common::kNoError) { - return false; - } - - // recreate FSNode since checkPath may have changed/created the directory - Common::FSNode savePath(savePathName); - Common::FSNode file = savePath.getChild(filename); - - String unicodeFileName; - StringUtil::Utf8ToString(file.getPath().c_str(), unicodeFileName); - - switch (Osp::Io::File::Remove(unicodeFileName)) { - case E_SUCCESS: - return true; - - case E_ILLEGAL_ACCESS: - setError(Common::kWritePermissionDenied, "Search or write permission denied: " + - file.getName()); - break; - - default: - setError(Common::kPathDoesNotExist, "removeSavefile: '" + file.getName() + - "' does not exist or path is invalid"); - break; - } - - return false; -} - -// -// BadaMutexManager -// -struct BadaMutexManager : public MutexManager { - BadaMutexManager(); - ~BadaMutexManager(); - OSystem::MutexRef createMutex(); - void lockMutex(OSystem::MutexRef mutex); - void unlockMutex(OSystem::MutexRef mutex); - void deleteMutex(OSystem::MutexRef mutex); -private: - Mutex *buffer[MUTEX_BUFFER_SIZE]; -}; - -BadaMutexManager::BadaMutexManager() { - for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { - buffer[i] = NULL; - } -} - -BadaMutexManager::~BadaMutexManager() { - for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { - if (buffer[i] != NULL) { - delete buffer[i]; - } - } -} - -OSystem::MutexRef BadaMutexManager::createMutex() { - Mutex *mutex = new Mutex(); - mutex->Create(); - - for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { - if (buffer[i] == NULL) { - buffer[i] = mutex; - break; - } - } - - return (OSystem::MutexRef) mutex; -} - -void BadaMutexManager::lockMutex(OSystem::MutexRef mutex) { - Mutex *m = (Mutex *)mutex; - m->Acquire(); -} - -void BadaMutexManager::unlockMutex(OSystem::MutexRef mutex) { - Mutex *m = (Mutex *)mutex; - m->Release(); -} - -void BadaMutexManager::deleteMutex(OSystem::MutexRef mutex) { - Mutex *m = (Mutex *)mutex; - - for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { - if (buffer[i] == m) { - buffer[i] = NULL; - } - } - - delete m; -} - -// -// BadaEventManager -// -struct BadaEventManager : public DefaultEventManager { - BadaEventManager(Common::EventSource *boss); - void init(); - int shouldQuit() const; -}; - -BadaEventManager::BadaEventManager(Common::EventSource *boss) : - DefaultEventManager(boss) { -} - -void BadaEventManager::init() { - DefaultEventManager::init(); - - // theme and vkbd should have now loaded - clear the splash screen - BadaSystem *system = (BadaSystem *)g_system; - BadaGraphicsManager *graphics = system->getGraphics(); - if (graphics) { - graphics->setReady(); - graphics->updateScreen(); - } -} - -int BadaEventManager::shouldQuit() const { - BadaSystem *system = (BadaSystem *)g_system; - return DefaultEventManager::shouldQuit() || system->isClosing(); -} - -// -// BadaSystem -// -BadaSystem::BadaSystem(BadaAppForm *appForm) : - _appForm(appForm), - _audioThread(0), - _epoch(0) { -} - -result BadaSystem::Construct(void) { - logEntered(); - - _fsFactory = new BadaFilesystemFactory(); - if (!_fsFactory) { - return E_OUT_OF_MEMORY; - } - - return E_SUCCESS; -} - -BadaSystem::~BadaSystem() { - logEntered(); -} - -result BadaSystem::initModules() { - logEntered(); - - _mutexManager = new BadaMutexManager(); - if (!_mutexManager) { - return E_OUT_OF_MEMORY; - } - - _timerManager = new BadaTimerManager(); - if (!_timerManager) { - return E_OUT_OF_MEMORY; - } - - _savefileManager = new BadaSaveFileManager(); - if (!_savefileManager) { - return E_OUT_OF_MEMORY; - } - - _graphicsManager = (GraphicsManager *)new BadaGraphicsManager(_appForm); - if (!_graphicsManager) { - return E_OUT_OF_MEMORY; - } - - // depends on _graphicsManager when ENABLE_VKEYBD enabled - _eventManager = new BadaEventManager(this); - if (!_eventManager) { - return E_OUT_OF_MEMORY; - } - - _audioThread = new AudioThread(); - if (!_audioThread) { - return E_OUT_OF_MEMORY; - } - - _mixer = _audioThread->Construct(this); - if (!_mixer) { - return E_OUT_OF_MEMORY; - } - - _audiocdManager = (AudioCDManager *)new DefaultAudioCDManager(); - if (!_audiocdManager) { - return E_OUT_OF_MEMORY; - } - - if (IsFailed(_audioThread->Start())) { - AppLog("Failed to start audio thread"); - return E_OUT_OF_MEMORY; - } - - logLeaving(); - return E_SUCCESS; -} - -void BadaSystem::initBackend() { - logEntered(); - - // use the mobile device theme - ConfMan.set("gui_theme", "/Res/scummmobile"); - - // allow bada virtual keypad pack to be found - ConfMan.set("vkeybdpath", "/Res/vkeybd_bada"); - ConfMan.set("vkeybd_pack_name", "vkeybd_bada"); - - // set default save path to writable area - if (!ConfMan.hasKey("savepath")) { - ConfMan.set("savepath", "/Home/Share"); - } - - // default to no auto-save - if (!ConfMan.hasKey("autosave_period")) { - ConfMan.setInt("autosave_period", 0); - } - - ConfMan.registerDefault("fullscreen", true); - ConfMan.registerDefault("aspect_ratio", false); - ConfMan.setBool("confirm_exit", false); - - SystemTime::GetTicks(_epoch); - - if (E_SUCCESS != initModules()) { - AppLog("initModules failed"); - } else { - OSystem::initBackend(); - } - - // replace kBigGUIFont using the large font from the scummmobile theme - Common::File fontFile; - Common::String fileName = "/Res/scummmobile/helvB14-iso-8859-1.fcc"; - BadaFilesystemNode file(fileName); - if (file.exists()) { - Common::SeekableReadStream *stream = file.createReadStream(); - if (stream) { - if (fontFile.open(stream, fileName)) { - Graphics::BdfFont *font = Graphics::BdfFont::loadFromCache(fontFile); - if (font) { - // use this font for the vkbd and on-screen messages - FontMan.setFont(Graphics::FontManager::kBigGUIFont, font); - } - } - } - } - - logLeaving(); -} - -void BadaSystem::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { - // allow translations.dat and game .DAT files to be found - s.addDirectory(RESOURCE_PATH, RESOURCE_PATH, priority); -} - -void BadaSystem::destroyBackend() { - closeAudio(); - - delete _graphicsManager; - _graphicsManager = 0; - - delete _savefileManager; - _savefileManager = 0; - - delete _fsFactory; - _fsFactory = 0; - - delete _mixer; - _mixer = 0; - - delete _audiocdManager; - _audiocdManager = 0; - - delete _timerManager; - _timerManager = 0; - - delete _eventManager; - _eventManager = 0; - - delete _mutexManager; - _mutexManager = 0; -} - -bool BadaSystem::pollEvent(Common::Event &event) { - return _appForm->pollEvent(event); -} - -uint32 BadaSystem::getMillis() { - long long result, ticks = 0; - SystemTime::GetTicks(ticks); - result = ticks - _epoch; - return result; -} - -void BadaSystem::delayMillis(uint msecs) { - if (!_appForm->isClosing()) { - Thread::Sleep(msecs); - } -} - -void BadaSystem::updateScreen() { - if (_graphicsManager != NULL) { - _graphicsManager->updateScreen(); - } -} - -void BadaSystem::getTimeAndDate(TimeDate &td) const { - DateTime currentTime; - - if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) { - td.tm_sec = currentTime.GetSecond(); - td.tm_min = currentTime.GetMinute(); - td.tm_hour = currentTime.GetHour(); - td.tm_mday = currentTime.GetDay(); - td.tm_mon = currentTime.GetMonth(); - td.tm_year = currentTime.GetYear(); - - Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); - calendar->SetTime(currentTime); - td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1; - delete calendar; - } -} - -void BadaSystem::fatalError() { - systemError("ScummVM: Fatal internal error."); -} - -void BadaSystem::exitSystem() { - if (_appForm) { - closeAudio(); - closeGraphics(); - _appForm->exitSystem(); - } -} - -void BadaSystem::logMessage(LogMessageType::Type type, const char *message) { - if (type == LogMessageType::kError) { - systemError(message); - } else { - AppLog(message); - } -} - -Common::SeekableReadStream *BadaSystem::createConfigReadStream() { - BadaFilesystemNode file(DEFAULT_CONFIG_FILE); - return file.createReadStream(); -} - -Common::WriteStream *BadaSystem::createConfigWriteStream() { - BadaFilesystemNode file(DEFAULT_CONFIG_FILE); - return file.createWriteStream(); -} - -void BadaSystem::closeAudio() { - if (_audioThread) { - _audioThread->Stop(); - _audioThread->Join(); - delete _audioThread; - _audioThread = 0; - } -} - -void BadaSystem::closeGraphics() { - if (_graphicsManager) { - delete _graphicsManager; - _graphicsManager = 0; - } -} - -void BadaSystem::setMute(bool on) { - // only change mute after eventManager init() has completed - if (_audioThread) { - BadaGraphicsManager *graphics = getGraphics(); - if (graphics && graphics->isReady()) { - _audioThread->setMute(on); - } - } -} - -int BadaSystem::setVolume(bool up, bool minMax) { - int level = -1; - if (_audioThread) { - level = _audioThread->setVolume(up, minMax); - } - return level; -} - -// -// create the ScummVM system -// -BadaAppForm *systemStart(Osp::App::Application *app) { - logEntered(); - - BadaAppForm *appForm = new BadaAppForm(); - if (!appForm) { - AppLog("Failed to create appForm"); - return NULL; - } - - if (E_SUCCESS != appForm->Construct() || - E_SUCCESS != app->GetAppFrame()->GetFrame()->AddControl(*appForm)) { - delete appForm; - AppLog("Failed to construct appForm"); - return NULL; - } - - return appForm; -} - -// -// display a fatal error notification -// -void systemError(const char *message) { - AppLog("Fatal system error: %s", message); - - ArrayList *args = new ArrayList(); - args->Construct(); - args->Add(*(new String(message))); - Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR, args); - - if (g_system) { - BadaSystem *system = (BadaSystem *)g_system; - system->exitSystem(); - } -} diff --git a/backends/platform/bada/system.h b/backends/platform/bada/system.h deleted file mode 100644 index c28686cb3d..0000000000 --- a/backends/platform/bada/system.h +++ /dev/null @@ -1,102 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_SYSTEM_H -#define BADA_SYSTEM_H - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "common/scummsys.h" -#include "backends/modular-backend.h" - -#include "backends/platform/bada/fs.h" -#include "backends/platform/bada/form.h" -#include "backends/platform/bada/audio.h" -#include "backends/platform/bada/graphics.h" - -#if defined(_DEBUG) -#define logEntered() AppLog("%s entered (%s %d)", \ - __FUNCTION__, __FILE__, __LINE__); -#define logLeaving() AppLog("%s leaving (%s %d)", \ - __FUNCTION__, __FILE__, __LINE__); -#else -#define logEntered() -#define logLeaving() -#endif - -BadaAppForm *systemStart(Osp::App::Application *app); -void systemError(const char *message); - -#define USER_MESSAGE_EXIT 1000 -#define USER_MESSAGE_EXIT_ERR 1001 - -// -// BadaSystem -// -class BadaSystem : public ModularBackend, - Common::EventSource { -public: - BadaSystem(BadaAppForm *appForm); - ~BadaSystem(); - - result Construct(); - void closeAudio(); - void closeGraphics(); - void destroyBackend(); - void setMute(bool on); - int setVolume(bool up, bool minMax); - void exitSystem(); - bool isClosing() { return _appForm->isClosing(); } - - BadaGraphicsManager *getGraphics() { - return (BadaGraphicsManager *)_graphicsManager; - } - -private: - void initBackend(); - result initModules(); - - void updateScreen(); - bool pollEvent(Common::Event &event); - uint32 getMillis(); - void delayMillis(uint msecs); - void getTimeAndDate(TimeDate &t) const; - void fatalError(); - void logMessage(LogMessageType::Type type, const char *message); - void addSysArchivesToSearchSet(Common::SearchSet &s, int priority); - - Common::EventSource *getDefaultEventSource() { return this; } - Common::SeekableReadStream *createConfigReadStream(); - Common::WriteStream *createConfigWriteStream(); - - BadaAppForm *_appForm; - AudioThread *_audioThread; - long long _epoch; -}; - -#endif diff --git a/backends/platform/tizen/README.TXT b/backends/platform/tizen/README.TXT new file mode 100644 index 0000000000..def3da2cce --- /dev/null +++ b/backends/platform/tizen/README.TXT @@ -0,0 +1,108 @@ +Build instructions (using linux) + +1. Install the Tizen SDK + +http://www.tizen.org + +To use an alternative Java SDK to run the Tizen IDE (eclipse), edit ~/.profile + +export JAVA_HOME=/opt/jdk1.6.0_45 +export PATH=${PATH}:${JAVA_HOME}/bin + +2. Add the following to your ~/.bashrc file + +export TIZEN_SDK=${HOME}/tizen-sdk +export TIZEN_ROOTSTRAP=${TIZEN_SDK}/platforms/tizen2.1/rootstraps/tizen-device-2.1.native +export TIZEN_BIN=${TIZEN_SDK}/tools/arm-linux-gnueabi-gcc-4.5/bin +export TIZEN_LIBS=${HOME}/tizen-lib +export PATH=${PATH}:${TIZEN_BIN}:~/bin +export CHOST=arm-linux-gnueabi +export LDFLAGS="--sysroot=${TIZEN_ROOTSTRAP} -L${TIZEN_LIBS}/lib" +export CPPFLAGS="--sysroot=${TIZEN_ROOTSTRAP} -fmessage-length=0 -fPIC\ + -I${TIZEN_ROOTSTRAP}/usr/include -I${TIZEN_LIBS}/include" +export CFLAGS=${CPPFLAGS} + +3. Build dependencies + + See: "Building the libraries" under: + http://wiki.scummvm.org/index.php/Compiling_ScummVM/MinGW#Building_the_libraries + for instructions on how to obtain these modules + + 3.1 zlib + + $ ./configure --static --prefix=${TIZEN_LIBS} + $ make && make install + + 3.2 freetype, libtheora, libogg, libvorbis, libmad, FLAC + + $ ./configure --host=arm-linux-gnueabi --prefix=${TIZEN_LIBS} --disable-shared + $ make && make install + + Note: you can ignore the ranlib errors when doing make install. + + Modify the resulting ~/tizen-lib/bin/freetype-config file to include -lz when printing libs + + 3.3 Linker ordering: scummvm, freetype, theoradec, vorbis, vorbisfile, mad, FLAC, ogg, z + +4. Build the ScummVM base library: + + ./configure --host=tizen --enable-release --with-freetype2-prefix=${TIZEN_LIBS}/bin + + For development: + + ./configure --host=tizen --enable-verbose-build --enable-debug + +5. Build the front end application using Tizen IDE + + Copy the scummvm/dists/bada folder into a clean directory + outside of the scummvm package. Start the BADA IDE then + choose this folder as the eclipse workspace. Click + Project / Build. + +Links: + +A short turorial on implementing OpenGL ES 1.1 in BADA: + http://forums.badadev.com/viewtopic.php?f=7&t=208 + +HelvB14 font files: + http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html + http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts-75dpi100dpi.tar.gz + + Then run the following command: + $ ./ucs2any.pl 100dpi/helvB14.bdf MAPPINGS/8859-1.TXT iso8859-1 \ + MAPPINGS/8859-2.TXT iso8859-2 MAPPINGS/8859-3.TXT iso8859-3 + +===================================================================== +Archived build instruction for BADA/cygwin + +1. Install BADA SDK (requires free registration): + + http://developer.bada.com/apis/index.do + +2. Install Cygwin: + + http://www.cygwin.com/ + + Add the following to your cygwin .bash_profile: + + alias mmake=/cygdrive/c/MinGW/bin/mingw32-make.exe + export BADA_SDK=/cygdrive/c/bada/1.2.1 + export ARM_BIN=c:/bada/1.2.1/Tools/Toolchains/ARM/bin + export CPPFLAGS="-fpic -fshort-wchar -mcpu=cortex-a8 -mfpu=vfpv3 \ + -mfloat-abi=hard -mlittle-endian -mthumb-interwork -Wno-psabi \ + -fno-strict-aliasing -fno-short-enums" + export LDFLAGS="-nostdlib -lc-newlib -lm-newlib -LC:/bada/1.2.1/Model/Wave_LP1/Target" + #export PATH=${BADA_SDK}/Tools/Toolchains/Win32/bin:${PATH} + export PATH=${BADA_SDK}/Tools/Toolchains/ARM/bin:~/utils:${PATH} + alias gcc=${ARM_BIN}/arm-samsung-nucleuseabi-gcc.exe + alias ar=${ARM_BIN}/arm-samsung-nucleuseabi-ar.exe + + The following were added to ~/utils for zlib: + + ar: + #!/bin/sh + ${ARM_BIN}/arm-samsung-nucleuseabi-ar.exe $* + + gcc: + #!/bin/sh + ${ARM_BIN}/arm-samsung-nucleuseabi-gcc.exe $* diff --git a/backends/platform/tizen/application.cpp b/backends/platform/tizen/application.cpp new file mode 100644 index 0000000000..8236ebef67 --- /dev/null +++ b/backends/platform/tizen/application.cpp @@ -0,0 +1,140 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/engine.h" + +#include "backends/platform/tizen/form.h" +#include "backends/platform/tizen/system.h" +#include "backends/platform/tizen/application.h" + +Application *TizenScummVM::createInstance() { + logEntered(); + return new TizenScummVM(); +} + +TizenScummVM::TizenScummVM() : _appForm(0) { + logEntered(); +} + +TizenScummVM::~TizenScummVM() { + logEntered(); + if (g_system) { + TizenSystem *system = (TizenSystem *)g_system; + system->destroyBackend(); + delete system; + g_system = 0; + } +} + +bool TizenScummVM::OnAppInitialized(void) { + logEntered(); + _appForm->SetOrientation(Tizen::Ui::ORIENTATION_LANDSCAPE); + return true; +} + +bool TizenScummVM::OnAppWillTerminate(void) { + logEntered(); + return true; +} + +bool TizenScummVM::OnAppInitializing(AppRegistry &appRegistry) { + logEntered(); + _appForm = systemStart(this); + return (_appForm != NULL); +} + +bool TizenScummVM::OnAppTerminating(AppRegistry &appRegistry, bool forcedTermination) { + logEntered(); + return true; +} + +void TizenScummVM::OnUserEventReceivedN(RequestId requestId, IList *args) { + MessageBox messageBox; + int modalResult; + + logEntered(); + + if (requestId == USER_MESSAGE_EXIT) { + // normal program termination + Terminate(); + } else if (requestId == USER_MESSAGE_EXIT_ERR) { + // assertion failure termination + String *message = NULL; + if (args) { + message = (String *)args->GetAt(0); + } + if (!message) { + message = new String("Unknown error"); + } + messageBox.Construct(L"Oops...", *message, MSGBOX_STYLE_OK); + messageBox.ShowAndWait(modalResult); + Terminate(); + } else if (requestId == USER_MESSAGE_EXIT_ERR_CONFIG) { + // the config file was corrupted + messageBox.Construct(L"Config file corrupted", + L"Settings have been reverted, please restart.", MSGBOX_STYLE_OK); + messageBox.ShowAndWait(modalResult); + Terminate(); + } +} + +void TizenScummVM::OnForeground(void) { + logEntered(); + pauseGame(false); +} + +void TizenScummVM::OnBackground(void) { + logEntered(); + pauseGame(true); +} + +void TizenScummVM::OnBatteryLevelChanged(BatteryLevel batteryLevel) { + logEntered(); +} + +void TizenScummVM::OnLowMemory(void) { + logEntered(); +} + +void TizenScummVM::OnScreenOn(void) { + logEntered(); +} + +void TizenScummVM::OnScreenOff(void) { + logEntered(); +} + +void TizenScummVM::OnScreenBrightnessChanged(int brightness) { + logEntered(); +} + +void TizenScummVM::pauseGame(bool pause) { + if (_appForm) { + if (pause && g_engine && !g_engine->isPaused()) { + _appForm->pushKey(Common::KEYCODE_SPACE); + } + + if (g_system) { + ((TizenSystem *)g_system)->setMute(pause); + } + } +} diff --git a/backends/platform/tizen/application.h b/backends/platform/tizen/application.h new file mode 100644 index 0000000000..f18ccb175b --- /dev/null +++ b/backends/platform/tizen/application.h @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_APPLICATION_H +#define TIZEN_APPLICATION_H + +#include +#include +#include +#include +#include + +#include "backends/platform/tizen/system.h" +#include "backends/platform/tizen/form.h" + +using namespace Tizen::App; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Base::Collection; + +class TizenScummVM : + public UiApp, + public IScreenEventListener { + +public: + TizenScummVM(); + virtual ~TizenScummVM(); + + static UiApp *createInstance(void); + + virtual bool OnAppInitializing(AppRegistry &appRegistry); + virtual bool OnAppInitialized(void); + virtual bool OnAppWillTerminate(void); + virtual bool OnAppTerminating(AppRegistry &appRegistry, bool forcedTermination = false); + virtual void OnLowMemory(void); + virtual void OnBatteryLevelChanged(BatteryLevel batteryLevel); + virtual void OnUserEventReceivedN(RequestId requestId, IList *pArgs); + virtual void OnForeground(void); + virtual void OnBackground(void); + virtual void OnScreenOn(void); + virtual void OnScreenOff(void); + virtual void OnScreenBrightnessChanged(int brightness); + +private: + void pauseGame(bool pause); + TizenAppForm *_appForm; +}; + +#endif diff --git a/backends/platform/tizen/audio.cpp b/backends/platform/tizen/audio.cpp new file mode 100644 index 0000000000..313a10eaa8 --- /dev/null +++ b/backends/platform/tizen/audio.cpp @@ -0,0 +1,181 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include + +#include "backends/platform/tizen/audio.h" +#include "backends/platform/tizen/system.h" + +#define TIMER_INTERVAL 10 +#define VOLUME 99 + +AudioThread::AudioThread() : + _mixer(0), + _timer(0), + _audioOut(0), + _head(0), + _tail(0), + _ready(0), + _interval(TIMER_INTERVAL), + _playing(-1), + _muted(true) { +} + +Audio::MixerImpl *AudioThread::Construct(OSystem *system) { + logEntered(); + + if (IsFailed(EventDrivenThread::Construct(DEFAULT_STACK_SIZE, THREAD_PRIORITY_HIGH))) { + AppLog("Failed to create AudioThread"); + return NULL; + } + + _mixer = new Audio::MixerImpl(system, 44100); + return _mixer; +} + +AudioThread::~AudioThread() { + logEntered(); +} + +bool AudioThread::isSilentMode() { + bool silentMode; + String key(L"SilentMode"); + Tizen::System::SettingInfo::GetValue(key, silentMode); + return silentMode; +} + +void AudioThread::setMute(bool on) { + if (_audioOut && _timer) { + _muted = on; + if (on) { + _timer->Cancel(); + } else { + _timer->StartAsRepeatable(_interval); + } + } +} + +bool AudioThread::OnStart(void) { + logEntered(); + + _audioOut = new Tizen::Media::AudioOut(); + if (!_audioOut || IsFailed(_audioOut->Construct(*this))) { + AppLog("Failed to create AudioOut"); + return false; + } + + int sampleRate = _mixer->getOutputRate(); + + // ideally we would update _mixer with GetOptimizedSampleRate here + if (_audioOut->GetOptimizedSampleRate() != sampleRate) { + AppLog("Non optimal sample rate %d", _audioOut->GetOptimizedSampleRate()); + } + + if (IsFailed(_audioOut->Prepare(AUDIO_TYPE_PCM_S16_LE, + AUDIO_CHANNEL_TYPE_STEREO, sampleRate))) { + AppLog("Failed to prepare AudioOut %d", sampleRate); + return false; + } + + int bufferSize = _audioOut->GetMinBufferSize(); + for (int i = 0; i < NUM_AUDIO_BUFFERS; i++) { + if (IsFailed(_audioBuffer[i].Construct(bufferSize))) { + AppLog("Failed to create audio buffer"); + return false; + } + } + + _timer = new Timer(); + if (!_timer || IsFailed(_timer->Construct(*this))) { + AppLog("Failed to create audio timer"); + return false; + } + + if (IsFailed(_timer->StartAsRepeatable(_interval))) { + AppLog("failed to start audio timer"); + return false; + } + + _muted = false; + _mixer->setReady(true); + _audioOut->SetVolume(isSilentMode() ? 0 : VOLUME); + _audioOut->Start(); + return true; +} + +void AudioThread::OnStop(void) { + logEntered(); + + _mixer->setReady(false); + + if (_timer) { + if (!_muted) { + _timer->Cancel(); + } + delete _timer; + } + + if (_audioOut) { + _audioOut->Reset(); + delete _audioOut; + } +} + +void AudioThread::OnAudioOutErrorOccurred(Tizen::Media::AudioOut &src, result r) { + logEntered(); +} + +void AudioThread::OnAudioOutInterrupted(Tizen::Media::AudioOut &src) { + logEntered(); +} + +void AudioThread::OnAudioOutReleased(Tizen::Media::AudioOut &src) { + logEntered(); + _audioOut->Start(); +} + +void AudioThread::OnAudioOutBufferEndReached(Tizen::Media::AudioOut &src) { + if (_ready > 0) { + _playing = _tail; + _audioOut->WriteBuffer(_audioBuffer[_tail]); + _tail = (_tail + 1) % NUM_AUDIO_BUFFERS; + _ready--; + } else { + // audio buffer empty: decrease timer inverval + _playing = -1; + } +} + +void AudioThread::OnTimerExpired(Timer &timer) { + if (_ready < NUM_AUDIO_BUFFERS) { + uint len = _audioBuffer[_head].GetCapacity(); + int samples = _mixer->mixCallback((byte *)_audioBuffer[_head].GetPointer(), len); + if (samples) { + _head = (_head + 1) % NUM_AUDIO_BUFFERS; + _ready++; + } + } + if (_ready && _playing == -1) { + OnAudioOutBufferEndReached(*_audioOut); + } +} diff --git a/backends/platform/tizen/audio.h b/backends/platform/tizen/audio.h new file mode 100644 index 0000000000..8d7835042d --- /dev/null +++ b/backends/platform/tizen/audio.h @@ -0,0 +1,74 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_AUDIO_H +#define TIZEN_AUDIO_H + +#include +#include +#include +#include + +#include "config.h" +#include "common/scummsys.h" +#include "common/system.h" +#include "audio/mixer_intern.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Media; +using namespace Tizen::Io; + +#define NUM_AUDIO_BUFFERS 2 + +class AudioThread: + public Tizen::Media::IAudioOutEventListener, + public Tizen::Base::Runtime::ITimerEventListener, + public Tizen::Base::Runtime::EventDrivenThread { + +public: + AudioThread(void); + ~AudioThread(void); + + Audio::MixerImpl *Construct(OSystem *system); + bool isSilentMode(); + void setMute(bool on); + + bool OnStart(void); + void OnStop(void); + void OnAudioOutErrorOccurred(Tizen::Media::AudioOut &src, result r); + void OnAudioOutInterrupted(Tizen::Media::AudioOut &src); + void OnAudioOutReleased(Tizen::Media::AudioOut &src); + void OnAudioOutBufferEndReached(Tizen::Media::AudioOut &src); + void OnTimerExpired(Timer &timer); + +private: + Audio::MixerImpl *_mixer; + Tizen::Base::Runtime::Timer *_timer; + Tizen::Media::AudioOut *_audioOut; + Tizen::Base::ByteBuffer _audioBuffer[NUM_AUDIO_BUFFERS]; + int _head, _tail, _ready, _interval, _playing; + bool _muted; +}; + +#endif diff --git a/backends/platform/tizen/form.cpp b/backends/platform/tizen/form.cpp new file mode 100644 index 0000000000..cce4b99557 --- /dev/null +++ b/backends/platform/tizen/form.cpp @@ -0,0 +1,419 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include + +#include "common/translation.h" +#include "base/main.h" + +#include "backends/platform/tizen/form.h" +#include "backends/platform/tizen/system.h" + +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Ui::Controls; + +// round down small Y touch values to 1 to allow the +// cursor to be positioned at the top of the screen +#define MIN_TOUCH_Y 20 + +// block for up to 2.5 seconds during shutdown to +// allow the game thread to exit gracefully. +#define EXIT_SLEEP_STEP 10 +#define EXIT_SLEEP 250 + +// +// TizenAppForm +// +TizenAppForm::TizenAppForm() : + _gestureMode(false), + _osdMessage(NULL), + _gameThread(NULL), + _eventQueueLock(NULL), + _state(kInitState), + _buttonState(kLeftButton), + _shortcut(kShowKeypad) { +} + +result TizenAppForm::Construct() { + TizenSystem *tizenSystem = NULL; + result r = Form::Construct(FORM_STYLE_NORMAL); + if (!IsFailed(r)) { + tizenSystem = new TizenSystem(this); + r = tizenSystem != NULL ? E_SUCCESS : E_OUT_OF_MEMORY; + } + if (!IsFailed(r)) { + r = tizenSystem->Construct(); + } + if (!IsFailed(r)) { + _gameThread = new Thread(); + r = _gameThread != NULL ? E_SUCCESS : E_OUT_OF_MEMORY; + } + if (!IsFailed(r)) { + r = _gameThread->Construct(*this); + } + if (!IsFailed(r)) { + _eventQueueLock = new Mutex(); + r = _eventQueueLock != NULL ? E_SUCCESS : E_OUT_OF_MEMORY; + } + if (!IsFailed(r)) { + r = _eventQueueLock->Create(); + } + + if (!IsFailed(r)) { + g_system = tizenSystem; + } else { + AppLog("Form startup failed"); + delete tizenSystem; + delete _gameThread; + _gameThread = NULL; + } + return r; +} + +TizenAppForm::~TizenAppForm() { + logEntered(); + + if (_gameThread && _state != kErrorState) { + terminate(); + + _gameThread->Stop(); + if (_state != kErrorState) { + _gameThread->Join(); + } + + delete _gameThread; + _gameThread = NULL; + } + + delete _eventQueueLock; + _eventQueueLock = NULL; + + logLeaving(); +} + +// +// abort the game thread +// +void TizenAppForm::terminate() { + if (_state == kActiveState) { + ((TizenSystem *)g_system)->setMute(true); + + _eventQueueLock->Acquire(); + + Common::Event e; + e.type = Common::EVENT_QUIT; + _eventQueue.push(e); + _state = kClosingState; + + _eventQueueLock->Release(); + + // block while thread ends + AppLog("waiting for shutdown"); + for (int i = 0; i < EXIT_SLEEP_STEP && _state == kClosingState; i++) { + Thread::Sleep(EXIT_SLEEP); + } + + if (_state == kClosingState) { + // failed to terminate - Join() will freeze + _state = kErrorState; + } + } +} + +void TizenAppForm::exitSystem() { + _state = kErrorState; + + if (_gameThread) { + _gameThread->Stop(); + delete _gameThread; + _gameThread = NULL; + } +} + +result TizenAppForm::OnInitializing(void) { + logEntered(); + + AddOrientationEventListener(*this); + AddTouchEventListener(*this); + SetMultipointTouchEnabled(true); + + // set focus to enable receiving key events + SetEnabled(true); + SetFocusable(true); + SetFocus(); + + return E_SUCCESS; +} + +result TizenAppForm::OnDraw(void) { + logEntered(); + return E_SUCCESS; +} + +void TizenAppForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus) { + logEntered(); + if (_state == kInitState) { + _state = kActiveState; + _gameThread->Start(); + } +} + +Tizen::Base::Object *TizenAppForm::Run() { + logEntered(); + + scummvm_main(0, 0); + if (_state == kActiveState) { + Tizen::App::Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT, NULL); + } + _state = kDoneState; + return NULL; +} + +bool TizenAppForm::pollEvent(Common::Event &event) { + bool result = false; + + _eventQueueLock->Acquire(); + if (!_eventQueue.empty()) { + event = _eventQueue.pop(); + result = true; + } + if (_osdMessage) { + TizenSystem *system = (TizenSystem *)g_system; + TizenGraphicsManager *graphics = system->getGraphics(); + if (graphics) { + graphics->displayMessageOnOSD(_osdMessage); + _osdMessage = NULL; + } + } + _eventQueueLock->Release(); + + return result; +} + +void TizenAppForm::pushEvent(Common::EventType type, const Point ¤tPosition) { + TizenSystem *system = (TizenSystem *)g_system; + TizenGraphicsManager *graphics = system->getGraphics(); + if (graphics) { + // graphics could be NULL at startup or when + // displaying the system error screen + Common::Event e; + e.type = type; + e.mouse.x = currentPosition.x; + e.mouse.y = currentPosition.y > MIN_TOUCH_Y ? currentPosition.y : 1; + + bool moved = graphics->moveMouse(e.mouse.x, e.mouse.y); + + _eventQueueLock->Acquire(); + + if (moved && type != Common::EVENT_MOUSEMOVE) { + Common::Event moveEvent; + moveEvent.type = Common::EVENT_MOUSEMOVE; + moveEvent.mouse = e.mouse; + _eventQueue.push(moveEvent); + } + + _eventQueue.push(e); + _eventQueueLock->Release(); + } +} + +void TizenAppForm::pushKey(Common::KeyCode keycode) { + if (_eventQueueLock) { + Common::Event e; + e.synthetic = false; + e.kbd.keycode = keycode; + e.kbd.ascii = keycode; + e.kbd.flags = 0; + + _eventQueueLock->Acquire(); + e.type = Common::EVENT_KEYDOWN; + _eventQueue.push(e); + e.type = Common::EVENT_KEYUP; + _eventQueue.push(e); + _eventQueueLock->Release(); + } +} + +void TizenAppForm::setButtonShortcut() { + switch (_buttonState) { + case kLeftButton: + setMessage(_s("Right Click Once")); + _buttonState = kRightButtonOnce; + break; + case kRightButtonOnce: + setMessage(_s("Right Click")); + _buttonState = kRightButton; + break; + case kRightButton: + setMessage(_s("Move Only")); + _buttonState = kMoveOnly; + break; + case kMoveOnly: + setMessage(_s("Left Click")); + _buttonState = kLeftButton; + break; + } +} + +void TizenAppForm::setMessage(const char *message) { + if (_eventQueueLock) { + _eventQueueLock->Acquire(); + _osdMessage = message; + _eventQueueLock->Release(); + } +} + +void TizenAppForm::setShortcut() { + logEntered(); + // cycle to the next shortcut + switch (_shortcut) { + case kControlMouse: + setMessage(_s("Escape Key")); + _shortcut = kEscapeKey; + break; + + case kEscapeKey: + setMessage(_s("Game Menu")); + _shortcut = kGameMenu; + break; + + case kGameMenu: + setMessage(_s("Show Keypad")); + _shortcut = kShowKeypad; + break; + + case kShowKeypad: + setMessage(_s("Control Mouse")); + _shortcut = kControlMouse; + break; + } +} + +void TizenAppForm::invokeShortcut() { + logEntered(); + switch (_shortcut) { + case kControlMouse: + setButtonShortcut(); + break; + + case kEscapeKey: + pushKey(Common::KEYCODE_ESCAPE); + break; + + case kGameMenu: + _buttonState = kLeftButton; + pushKey(Common::KEYCODE_F5); + break; + + case kShowKeypad: + showKeypad(); + break; + } +} + +void TizenAppForm::showKeypad() { + // display the soft keyboard + if (_state == kActiveState) { + _buttonState = kLeftButton; + pushKey(Common::KEYCODE_F7); + } +} + +int TizenAppForm::getTouchCount() { + Tizen::Ui::TouchEventManager *touch = Tizen::Ui::TouchEventManager::GetInstance(); + IListT *touchList = touch->GetTouchInfoListN(); + int touchCount = touchList->GetCount(); + touchList->RemoveAll(); + delete touchList; + return touchCount; +} + +void TizenAppForm::OnTouchDoublePressed(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { + if (_buttonState != kMoveOnly) { + pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, + currentPosition); + pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, + currentPosition); + } +} + +void TizenAppForm::OnTouchFocusIn(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { +} + +void TizenAppForm::OnTouchFocusOut(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { +} + +void TizenAppForm::OnTouchLongPressed(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { + logEntered(); + if (_buttonState != kLeftButton) { + pushKey(Common::KEYCODE_RETURN); + } +} + +void TizenAppForm::OnTouchMoved(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { + if (!_gestureMode) { + pushEvent(Common::EVENT_MOUSEMOVE, currentPosition); + } +} + +void TizenAppForm::OnTouchPressed(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { + if (getTouchCount() > 1) { + _gestureMode = true; + } else if (_buttonState != kMoveOnly) { + pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, + currentPosition); + } +} + +void TizenAppForm::OnTouchReleased(const Control &source, + const Point ¤tPosition, const TouchEventInfo &touchInfo) { + if (_gestureMode) { + int touchCount = getTouchCount(); + if (touchCount == 1) { + setShortcut(); + } else { + if (touchCount == 2) { + invokeShortcut(); + } + _gestureMode = false; + } + } else if (_buttonState != kMoveOnly) { + pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP, + currentPosition); + if (_buttonState == kRightButtonOnce) { + _buttonState = kLeftButton; + } + // flick to skip dialog + if (touchInfo.IsFlicked()) { + pushKey(Common::KEYCODE_PERIOD); + } + } +} + diff --git a/backends/platform/tizen/form.h b/backends/platform/tizen/form.h new file mode 100644 index 0000000000..64c447d409 --- /dev/null +++ b/backends/platform/tizen/form.h @@ -0,0 +1,113 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_FORM_H +#define TIZEN_FORM_H + +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "common/scummsys.h" +#include "common/events.h" +#include "common/queue.h" +#include "common/mutex.h" +#include "engines/engine.h" + +using namespace Tizen::Ui; +using namespace Tizen::Graphics; +using namespace Tizen::Base::Runtime; + +// +// TizenAppForm +// +class TizenAppForm : + public Controls::Form, + public IRunnable, + public IOrientationEventListener, + public ITouchEventListener { + +public: + TizenAppForm(); + virtual ~TizenAppForm(); + + result Construct(); + bool pollEvent(Common::Event &event); + bool isClosing() { return _state == kClosingState; } + bool isStarting() { return _state == kInitState; } + void pushKey(Common::KeyCode keycode); + void exitSystem(); + void showKeypad(); + +private: + Tizen::Base::Object *Run(); + result OnInitializing(void); + result OnDraw(void); + void OnOrientationChanged(const Control &source, + OrientationStatus orientationStatus); + void OnTouchDoublePressed(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchFocusIn(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchFocusOut(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchLongPressed(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchMoved(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchPressed(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + void OnTouchReleased(const Control &source, + const Point ¤tPosition, + const TouchEventInfo &touchInfo); + + void pushEvent(Common::EventType type, const Point ¤tPosition); + void terminate(); + void setButtonShortcut(); + void setMessage(const char *message); + void setShortcut(); + void invokeShortcut(); + int getTouchCount(); + bool gameActive() { return _state == kActiveState && g_engine != NULL && !g_engine->isPaused(); } + + // event handling + bool _gestureMode; + const char *_osdMessage; + Tizen::Base::Runtime::Thread *_gameThread; + Tizen::Base::Runtime::Mutex *_eventQueueLock; + Common::Queue _eventQueue; + enum { kInitState, kActiveState, kClosingState, kDoneState, kErrorState } _state; + enum { kLeftButton, kRightButtonOnce, kRightButton, kMoveOnly } _buttonState; + enum { kControlMouse, kEscapeKey, kGameMenu, kShowKeypad } _shortcut; +}; + +#endif diff --git a/backends/platform/tizen/fs.cpp b/backends/platform/tizen/fs.cpp new file mode 100644 index 0000000000..f8b32f4239 --- /dev/null +++ b/backends/platform/tizen/fs.cpp @@ -0,0 +1,441 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "common/translation.h" +#include "backends/platform/tizen/system.h" +#include "backends/platform/tizen/fs.h" + +#include + +#define BUFFER_SIZE 1024 + +using namespace Tizen::App; + +// +// converts a Tizen (wchar) String into a scummVM (char) string +// +Common::String fromString(const Tizen::Base::String &in) { + ByteBuffer *buf = StringUtil::StringToUtf8N(in); + Common::String result((const char*)buf->GetPointer()); + delete buf; + return result; +} + +// +// TizenFileStream +// +class TizenFileStream : + public Common::SeekableReadStream, + public Common::WriteStream, + public Common::NonCopyable { +public: + static TizenFileStream *makeFromPath(const String &path, bool writeMode); + + TizenFileStream(File *file, bool writeMode); + ~TizenFileStream(); + + bool err() const; + void clearErr(); + bool eos() const; + + uint32 write(const void *dataPtr, uint32 dataSize); + bool flush(); + + int32 pos() const; + int32 size() const; + bool seek(int32 offs, int whence = SEEK_SET); + uint32 read(void *dataPtr, uint32 dataSize); + +private: + byte _buffer[BUFFER_SIZE]; + uint32 _bufferIndex; + uint32 _bufferLength; + bool _writeMode; + File *_file; +}; + +TizenFileStream::TizenFileStream(File *ioFile, bool writeMode) : + _bufferIndex(0), + _bufferLength(0), + _writeMode(writeMode), + _file(ioFile) { + AppAssert(ioFile != 0); +} + +TizenFileStream::~TizenFileStream() { + if (_file) { + if (_writeMode) { + flush(); + } + delete _file; + } +} + +bool TizenFileStream::err() const { + result r = GetLastResult(); + return (r != E_SUCCESS && r != E_END_OF_FILE); +} + +void TizenFileStream::clearErr() { + SetLastResult(E_SUCCESS); +} + +bool TizenFileStream::eos() const { + return (_bufferLength - _bufferIndex == 0) && (GetLastResult() == E_END_OF_FILE); +} + +int32 TizenFileStream::pos() const { + return _file->Tell() - (_bufferLength - _bufferIndex); +} + +int32 TizenFileStream::size() const { + int32 oldPos = _file->Tell(); + _file->Seek(FILESEEKPOSITION_END, 0); + + int32 length = _file->Tell(); + SetLastResult(_file->Seek(FILESEEKPOSITION_BEGIN, oldPos)); + + return length; +} + +bool TizenFileStream::seek(int32 offs, int whence) { + bool result = false; + switch (whence) { + case SEEK_SET: + // set from start of file + SetLastResult(_file->Seek(FILESEEKPOSITION_BEGIN, offs)); + result = (E_SUCCESS == GetLastResult()); + break; + + case SEEK_CUR: + // set relative to offs + if (_bufferIndex < _bufferLength && _bufferIndex > (uint32)-offs) { + // re-position within the buffer + SetLastResult(E_SUCCESS); + _bufferIndex += offs; + return true; + } else { + offs -= (_bufferLength - _bufferIndex); + if (offs < 0 && _file->Tell() + offs < 0) { + // avoid negative positioning + offs = 0; + } + if (offs != 0) { + SetLastResult(_file->Seek(FILESEEKPOSITION_CURRENT, offs)); + result = (E_SUCCESS == GetLastResult()); + } else { + result = true; + } + } + break; + + case SEEK_END: + // set relative to end - positive will increase the file size + SetLastResult(_file->Seek(FILESEEKPOSITION_END, offs)); + result = (E_SUCCESS == GetLastResult()); + break; + + default: + AppLog("Invalid whence %d", whence); + return false; + } + + if (!result) { + AppLog("seek failed"); + } + + _bufferIndex = _bufferLength = 0; + return result; +} + +uint32 TizenFileStream::read(void *ptr, uint32 len) { + uint32 result = 0; + if (!eos()) { + if (_bufferIndex < _bufferLength) { + // use existing buffer + uint32 available = _bufferLength - _bufferIndex; + if (len <= available) { + // use allocation + memcpy((byte *)ptr, &_buffer[_bufferIndex], len); + _bufferIndex += len; + result = len; + } else { + // use remaining allocation + memcpy((byte *)ptr, &_buffer[_bufferIndex], available); + uint32 remaining = len - available; + result = available; + + if (remaining) { + result += _file->Read(((byte *)ptr) + available, remaining); + } + _bufferIndex = _bufferLength = 0; + } + } else if (len < BUFFER_SIZE) { + // allocate and use buffer + _bufferIndex = 0; + _bufferLength = _file->Read(_buffer, BUFFER_SIZE); + if (_bufferLength) { + if (_bufferLength < len) { + len = _bufferLength; + } + memcpy((byte *)ptr, _buffer, len); + result = _bufferIndex = len; + } + } else { + result = _file->Read((byte *)ptr, len); + _bufferIndex = _bufferLength = 0; + } + } else { + AppLog("Attempted to read past EOS"); + } + return result; +} + +uint32 TizenFileStream::write(const void *ptr, uint32 len) { + result r = _file->Write(ptr, len); + SetLastResult(r); + return (r == E_SUCCESS ? len : 0); +} + +bool TizenFileStream::flush() { + logEntered(); + SetLastResult(_file->Flush()); + return (E_SUCCESS == GetLastResult()); +} + +TizenFileStream *TizenFileStream::makeFromPath(const String &path, bool writeMode) { + File *ioFile = new File(); + + String filePath = path; + if (writeMode && (path[0] != '.' && path[0] != '/')) { + filePath.Insert(App::GetInstance()->GetAppDataPath() + L"/", 0); + } + + AppLog("Open file %S", filePath.GetPointer()); + TizenFileStream *stream; + result r = ioFile->Construct(filePath, writeMode ? L"w" : L"r", writeMode); + if (r == E_SUCCESS) { + stream = new TizenFileStream(ioFile, writeMode); + } else { + AppLog("Failed to open file"); + delete ioFile; + stream = NULL; + } + return stream; +} + +// +// TizenFilesystemNode +// +TizenFilesystemNode::TizenFilesystemNode(const Common::String &nodePath) { + AppAssert(nodePath.size() > 0); + init(nodePath); +} + +TizenFilesystemNode::TizenFilesystemNode(SystemPath systemPath) { + switch (systemPath) { + case kData: + _unicodePath = App::GetInstance()->GetAppDataPath(); + _displayName = _s("[ Data ]"); + break; + case kResource: + _unicodePath = App::GetInstance()->GetAppResourcePath(); + _displayName = _s("[ Resources ]"); + break; + case kSdCard: + _unicodePath = Tizen::System::Environment::GetExternalStoragePath(); + _displayName = _s("[ SDCard ]"); + break; + case kMedia: + _unicodePath = Tizen::System::Environment::GetMediaPath(); + _displayName = _s("[ Media ]"); + break; + case kShared: + _unicodePath = App::GetInstance()->GetAppSharedPath(); + _displayName = _s("[ Shared ]"); + break; + } + _path = ::fromString(_unicodePath); + _isValid = _isVirtualDir = !IsFailed(File::GetAttributes(_unicodePath, _attr)); +} + +TizenFilesystemNode::TizenFilesystemNode(const Common::String &root, const Common::String &nodePath) { + AppLog("TizenFilesystemNode '%s' '%s'", root.c_str(), nodePath.c_str()); + + // Make sure the string contains no slashes + AppAssert(!nodePath.contains('/')); + + // We assume here that path is already normalized (hence don't bother to + // call Common::normalizePath on the final path). + Common::String newPath(root); + if (root.lastChar() != '/') { + newPath += '/'; + } + newPath += nodePath; + + init(newPath); +} + +void TizenFilesystemNode::init(const Common::String &nodePath) { + // Normalize the path (that is, remove unneeded slashes etc.) + _path = Common::normalizePath(nodePath, '/'); + _displayName = Common::lastPathComponent(_path, '/'); + + StringUtil::Utf8ToString(_path.c_str(), _unicodePath); + _isVirtualDir = (_path == "/"); + _isValid = _isVirtualDir || !IsFailed(File::GetAttributes(_unicodePath, _attr)); +} + +bool TizenFilesystemNode::exists() const { + return _isValid; +} + +bool TizenFilesystemNode::isReadable() const { + return _isVirtualDir || _isValid; +} + +bool TizenFilesystemNode::isDirectory() const { + return _isVirtualDir || (_isValid && _attr.IsDirectory()); +} + +bool TizenFilesystemNode::isWritable() const { + bool result = (_isValid && !_attr.IsReadOnly()); + if (_unicodePath == App::GetInstance()->GetAppResourcePath()) { + result = false; + } + return result; +} + +AbstractFSNode *TizenFilesystemNode::getChild(const Common::String &n) const { + AppAssert(!_path.empty()); + AppAssert(isDirectory()); + return new TizenFilesystemNode(_path, n); +} + +bool TizenFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { + AppAssert(isDirectory()); + + bool result = false; + + if (_isVirtualDir && mode != Common::FSNode::kListFilesOnly && _path == "/") { + // present well known TIZEN file system areas + myList.push_back(new TizenFilesystemNode(kData)); + myList.push_back(new TizenFilesystemNode(kResource)); + myList.push_back(new TizenFilesystemNode(kSdCard)); + myList.push_back(new TizenFilesystemNode(kMedia)); + myList.push_back(new TizenFilesystemNode(kShared)); + } + + if (!result) { + DirEnumerator *pDirEnum = 0; + Directory *pDir = new Directory(); + + // open directory + if (IsFailed(pDir->Construct(_unicodePath))) { + AppLog("Failed to open directory: %S", _unicodePath.GetPointer()); + } else { + // read all directory entries + pDirEnum = pDir->ReadN(); + if (pDirEnum) { + result = true; + } + + // loop through all directory entries + while (pDirEnum && pDirEnum->MoveNext() == E_SUCCESS) { + DirEntry dirEntry = pDirEnum->GetCurrentDirEntry(); + + // skip 'invisible' files if necessary + Tizen::Base::String fileName = dirEntry.GetName(); + + if (fileName[0] == '.' && !hidden) { + continue; + } + + // skip '.' and '..' to avoid cycles + if (fileName == L"." || fileName == L"..") { + continue; + } + + // Honor the chosen mode + if ((mode == Common::FSNode::kListFilesOnly && dirEntry.IsDirectory()) || + (mode == Common::FSNode::kListDirectoriesOnly && !dirEntry.IsDirectory())) { + continue; + } + myList.push_back(new TizenFilesystemNode(_path, ::fromString(fileName))); + } + } + + // cleanup + if (pDirEnum) { + delete pDirEnum; + } + + // close the opened directory + if (pDir) { + delete pDir; + } + } + + return result; +} + +AbstractFSNode *TizenFilesystemNode::getParent() const { + logEntered(); + if (_path == "/") { + return 0; // The filesystem root has no parent + } + + const char *start = _path.c_str(); + const char *end = start + _path.size(); + + // Strip of the last component. We make use of the fact that at this + // point, path is guaranteed to be normalized + while (end > start && *(end-1) != '/') { + end--; + } + + if (end == start) { + // This only happens if we were called with a relative path, for which + // there simply is no parent. + // TODO: We could also resolve this by assuming that the parent is the + // current working directory, and returning a node referring to that. + return NULL; + } + + return new TizenFilesystemNode(Common::String(start, end)); +} + +Common::SeekableReadStream *TizenFilesystemNode::createReadStream() { + Common::SeekableReadStream *result = TizenFileStream::makeFromPath(_unicodePath, false); + if (result != NULL) { + _isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr)); + } + return result; +} + +Common::WriteStream *TizenFilesystemNode::createWriteStream() { + Common::WriteStream *result = TizenFileStream::makeFromPath(_unicodePath, true); + if (result != NULL) { + _isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr)); + } + return result; +} diff --git a/backends/platform/tizen/fs.h b/backends/platform/tizen/fs.h new file mode 100644 index 0000000000..0356aaad33 --- /dev/null +++ b/backends/platform/tizen/fs.h @@ -0,0 +1,98 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef TIZEN_FILESYSTEM_H +#define TIZEN_FILESYSTEM_H + +#include +#include +#include +#include + +#include "config.h" +#include "common/scummsys.h" +#include "common/stream.h" +#include "backends/fs/abstract-fs.h" + +using namespace Tizen::Io; +using namespace Tizen::Base; +using namespace Tizen::Base::Utility; + +// +// converts a Tizen (wchar) String into a scummVM (char) string +// +Common::String fromString(const Tizen::Base::String &in); + +// +// Enumerates the possible system paths +// +enum SystemPath { kData, kResource, kSdCard, kMedia, kShared }; + +/** + * Implementation of the ScummVM file system API based on TIZEN. + * + * Parts of this class are documented in the base interface class, AbstractFSNode. + */ +class TizenFilesystemNode : public AbstractFSNode { +public: + /** + * Creates a TizenFilesystemNode for a given path. + * + * @param path the path the new node should point to. + */ + TizenFilesystemNode(const Common::String &path); + + /** + * Creates a TizenFilesystemNode from the given Tizen internal path + * + * @param path the path the new node should point to. + */ + TizenFilesystemNode(SystemPath systemPath); + + Common::String getDisplayName() const { return _displayName; } + Common::String getName() const { return _displayName; } + Common::String getPath() const { return _path; } + + bool exists() const; + bool isDirectory() const; + bool isReadable() const; + bool isWritable() const; + + AbstractFSNode *getChild(const Common::String &n) const; + bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; + AbstractFSNode *getParent() const; + + Common::SeekableReadStream *createReadStream(); + Common::WriteStream *createWriteStream(); + +protected: + TizenFilesystemNode(const Common::String &root, const Common::String &p); + void init(const Common::String &nodePath); + + Common::String _displayName; + Common::String _path; + String _unicodePath; + bool _isValid; + bool _isVirtualDir; + FileAttributes _attr; +}; + +#endif diff --git a/backends/platform/tizen/graphics.cpp b/backends/platform/tizen/graphics.cpp new file mode 100644 index 0000000000..bf255cd264 --- /dev/null +++ b/backends/platform/tizen/graphics.cpp @@ -0,0 +1,237 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "graphics/fontman.h" + +#include "backends/platform/tizen/form.h" +#include "backends/platform/tizen/system.h" +#include "backends/platform/tizen/graphics.h" + +// +// TizenGraphicsManager +// +TizenGraphicsManager::TizenGraphicsManager(TizenAppForm *appForm) : + _appForm(appForm), + _eglDisplay(EGL_DEFAULT_DISPLAY), + _eglSurface(EGL_NO_SURFACE), + _eglConfig(NULL), + _eglContext(EGL_NO_CONTEXT), + _initState(true) { + assert(appForm != NULL); + _videoMode.fullscreen = true; +} + +TizenGraphicsManager::~TizenGraphicsManager() { + logEntered(); + + if (_eglDisplay != EGL_NO_DISPLAY) { + eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); + if (_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(_eglDisplay, _eglContext); + } + } +} + +const Graphics::Font *TizenGraphicsManager::getFontOSD() { + return FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); +} + +bool TizenGraphicsManager::moveMouse(int16 &x, int16 &y) { + int16 currentX = _cursorState.x; + int16 currentY = _cursorState.y; + + // save the current hardware coordinates + _cursorState.x = x; + _cursorState.y = y; + + // return x/y as game coordinates + adjustMousePosition(x, y); + + // convert current x/y to game coordinates + adjustMousePosition(currentX, currentY); + + // return whether game coordinates have changed + return (currentX != x || currentY != y); +} + +Common::List TizenGraphicsManager::getSupportedFormats() const { + logEntered(); + + Common::List res; + res.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)); + res.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + res.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); + res.push_back(Graphics::PixelFormat::createFormatCLUT8()); + return res; +} + +bool TizenGraphicsManager::hasFeature(OSystem::Feature f) { + bool result = (f == OSystem::kFeatureFullscreenMode || + f == OSystem::kFeatureVirtualKeyboard || + OpenGLGraphicsManager::hasFeature(f)); + return result; +} + +void TizenGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { + if (f == OSystem::kFeatureVirtualKeyboard && enable) { + _appForm->showKeypad(); + } else { + OpenGLGraphicsManager::setFeatureState(f, enable); + } +} + +void TizenGraphicsManager::setReady() { + _initState = false; +} + +void TizenGraphicsManager::updateScreen() { + if (_transactionMode == kTransactionNone) { + internUpdateScreen(); + } +} + +bool TizenGraphicsManager::loadEgl() { + logEntered(); + + EGLint numConfigs = 1; + EGLint eglConfigList[] = { + EGL_RED_SIZE, 5, + EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, + EGL_ALPHA_SIZE, 0, + EGL_DEPTH_SIZE, 8, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, + EGL_NONE + }; + + EGLint eglContextList[] = { + EGL_CONTEXT_CLIENT_VERSION, 1, + EGL_NONE + }; + + eglBindAPI(EGL_OPENGL_ES_API); + + if (_eglDisplay) { + unloadGFXMode(); + } + + _eglDisplay = eglGetDisplay((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY); + if (EGL_NO_DISPLAY == _eglDisplay) { + systemError("eglGetDisplay() failed"); + return false; + } + + if (EGL_FALSE == eglInitialize(_eglDisplay, NULL, NULL) || + EGL_SUCCESS != eglGetError()) { + systemError("eglInitialize() failed"); + return false; + } + + if (EGL_FALSE == eglChooseConfig(_eglDisplay, eglConfigList, &_eglConfig, 1, &numConfigs) || + EGL_SUCCESS != eglGetError()) { + systemError("eglChooseConfig() failed"); + return false; + } + + if (!numConfigs) { + systemError("eglChooseConfig() failed. Matching config does not exist \n"); + return false; + } + + _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_appForm, NULL); + if (EGL_NO_SURFACE == _eglSurface || EGL_SUCCESS != eglGetError()) { + systemError("eglCreateWindowSurface() failed. EGL_NO_SURFACE"); + return false; + } + + _eglContext = eglCreateContext(_eglDisplay, _eglConfig, EGL_NO_CONTEXT, eglContextList); + if (EGL_NO_CONTEXT == _eglContext || + EGL_SUCCESS != eglGetError()) { + systemError("eglCreateContext() failed"); + return false; + } + + if (false == eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext) || + EGL_SUCCESS != eglGetError()) { + systemError("eglMakeCurrent() failed"); + return false; + } + + logLeaving(); + return true; +} + +bool TizenGraphicsManager::loadGFXMode() { + logEntered(); + + if (!loadEgl()) { + unloadGFXMode(); + return false; + } + + int x, y, width, height; + _appForm->GetBounds(x, y, width, height); + _videoMode.overlayWidth = _videoMode.hardwareWidth = width; + _videoMode.overlayHeight = _videoMode.hardwareHeight = height; + _videoMode.scaleFactor = 4; // for proportional sized cursor in the launcher + + AppLog("screen size: %dx%d", _videoMode.hardwareWidth, _videoMode.hardwareHeight); + return OpenGLGraphicsManager::loadGFXMode(); +} + +void TizenGraphicsManager::loadTextures() { + logEntered(); + OpenGLGraphicsManager::loadTextures(); +} + +void TizenGraphicsManager::internUpdateScreen() { + if (!_initState) { + OpenGLGraphicsManager::internUpdateScreen(); + eglSwapBuffers(_eglDisplay, _eglSurface); + } +} + +void TizenGraphicsManager::unloadGFXMode() { + logEntered(); + + if (_eglDisplay != EGL_NO_DISPLAY) { + eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); + + if (_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(_eglDisplay, _eglContext); + _eglContext = EGL_NO_CONTEXT; + } + + if (_eglSurface != EGL_NO_SURFACE) { + eglDestroySurface(_eglDisplay, _eglSurface); + _eglSurface = EGL_NO_SURFACE; + } + + eglTerminate(_eglDisplay); + _eglDisplay = EGL_NO_DISPLAY; + } + + _eglConfig = NULL; + OpenGLGraphicsManager::unloadGFXMode(); + logLeaving(); +} diff --git a/backends/platform/tizen/graphics.h b/backends/platform/tizen/graphics.h new file mode 100644 index 0000000000..27e5a6aaeb --- /dev/null +++ b/backends/platform/tizen/graphics.h @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_GRAPHICS_H +#define TIZEN_GRAPHICS_H + +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "backends/graphics/opengl/opengl-graphics.h" +#include "graphics/font.h" +#include "backends/platform/tizen/form.h" + +using namespace Tizen::Graphics; +using namespace Tizen::Graphics::Opengl; +using namespace Tizen::App; + +class TizenGraphicsManager : public OpenGLGraphicsManager { +public: + TizenGraphicsManager(TizenAppForm *appForm); + virtual ~TizenGraphicsManager(); + + Common::List getSupportedFormats() const; + bool hasFeature(OSystem::Feature f); + void updateScreen(); + void setFeatureState(OSystem::Feature f, bool enable); + void setReady(); + bool isReady() { return !_initState; } + const Graphics::Font *getFontOSD(); + bool moveMouse(int16 &x, int16 &y); + +private: + void internUpdateScreen(); + bool loadGFXMode(); + void loadTextures(); + void unloadGFXMode(); + void setInternalMousePosition(int x, int y) {} + void showSplash(); + + bool loadEgl(); + TizenAppForm *_appForm; + EGLDisplay _eglDisplay; + EGLSurface _eglSurface; + EGLConfig _eglConfig; + EGLContext _eglContext; + bool _initState; +}; + +#endif diff --git a/backends/platform/tizen/main.cpp b/backends/platform/tizen/main.cpp new file mode 100644 index 0000000000..b12cc3adc9 --- /dev/null +++ b/backends/platform/tizen/main.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include + +#include "backends/platform/tizen/application.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + +/** + * The entry function of tizen application called by the operating system. + */ +extern "C" _EXPORT_ int OspMain(int argc, char *pArgv[]) { + result r = E_SUCCESS; + + AppLog("Application started."); + ArrayList args(SingleObjectDeleter); + args.Construct(); + for (int i = 0; i < argc; i++) { + args.Add(new (std::nothrow) String(pArgv[i])); + } + + r = Tizen::App::UiApp::Execute(TizenScummVM::createInstance, &args); + TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r)); + AppLog("Application finished."); + + return static_cast(r); +} + diff --git a/backends/platform/tizen/missing.cpp b/backends/platform/tizen/missing.cpp new file mode 100644 index 0000000000..5ac55d0f6c --- /dev/null +++ b/backends/platform/tizen/missing.cpp @@ -0,0 +1,82 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include + +#include "backends/platform/tizen/portdefs.h" + +#include +#include +#include +#include + +#define BUF_SIZE 255 + +void systemError(const char *message); + +C_LINKAGE_BEGIN + +int __errno; // for overridden method in saves/default/default-saves.cpp + +void __assert_func(const char *file, int line, + const char *func, const char *err) { + char buffer[BUF_SIZE]; + snprintf(buffer, sizeof(buffer), "%s %d %s %s", file, line, func, err); + systemError(buffer); +} + +void stderr_fprintf(void *, const char *format, ...) { + va_list ap; + char buffer[BUF_SIZE]; + + va_start(ap, format); + vsnprintf(buffer, sizeof(buffer), format, ap); + va_end(ap); + + AppLog(buffer); +} + +void stderr_vfprintf(void *, const char *format, va_list ap) { + char buffer[BUF_SIZE]; + vsnprintf(buffer, sizeof(buffer), format, ap); + AppLog(buffer); +} + +int printf(const char *format, ...) { + int result = 0; + va_list ap; + char buffer[BUF_SIZE]; + + va_start(ap, format); + result = vsnprintf(buffer, sizeof(buffer), format, ap); + va_end(ap); + + AppLog(buffer); + + return result; +} + +C_LINKAGE_END diff --git a/backends/platform/tizen/portdefs.h b/backends/platform/tizen/portdefs.h new file mode 100644 index 0000000000..050ce7d1e0 --- /dev/null +++ b/backends/platform/tizen/portdefs.h @@ -0,0 +1,85 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PORT_DEFS_H +#define PORT_DEFS_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#define M_PI 3.14159265358979323846 + +#ifdef __cplusplus + #include // causes a link error when building c programs + #define C_LINKAGE_BEGIN extern "C" { + #define C_LINKAGE_END } +#else + #define C_LINKAGE_BEGIN + #define C_LINKAGE_END +#endif + +// value missing from osp gl headers +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 + +C_LINKAGE_BEGIN + +// for libFLAC +#undef fseeko +#undef ftello +#define fseeko fseek +#define ftello ftell + +// overcome use of fprintf since newlib (1.2) does not +// support stderr/stdout (undefined reference to `_impure_ptr'). + +void stderr_fprintf(void *, const char *format, ...); +void stderr_vfprintf(void *, const char *format, va_list ap); + +#undef fprintf +#undef vfprintf +#undef stderr +#undef stdout +#undef stdin +#undef fputs +#undef fflush + +#define stderr (void *)0 +#define stdout (void *)1 +#define stdin (void *)2 +#define fputs(str, file) +#define fflush(file) +#define sscanf simple_sscanf +#define fprintf stderr_fprintf +#define vfprintf stderr_vfprintf + +int printf(const char *format, ...); +int simple_sscanf(const char *buffer, const char *format, ...); + +C_LINKAGE_END + +#endif diff --git a/backends/platform/tizen/sscanf.cpp b/backends/platform/tizen/sscanf.cpp new file mode 100644 index 0000000000..aa846698f6 --- /dev/null +++ b/backends/platform/tizen/sscanf.cpp @@ -0,0 +1,213 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include + +// +// simple sscanf replacement to match scummvm usage patterns +// + +bool scanInt(const char **in, va_list *ap, int max) { + // skip leading space characters + while (**in && **in == ' ') { + (*in)++; + } + + // number optionally preceeded with a + or - sign. + bool negate = false; + if (**in == '-') { + (*in)++; + negate = true; + } + + if (**in == '+') { + (*in)++; + } + + int *arg = va_arg(*ap, int*); + char *end; + long n = strtol(*in, &end, 10); + if (negate) { + n = -n; + } + + bool err = false; + if (end == *in || (max > 0 && (end - *in) > max)) { + err = true; + } else { + *arg = (int)n; + *in = end; + } + return err; +} + +bool scanHex(const char **in, va_list *ap) { + unsigned *arg = va_arg(*ap, unsigned*); + char *end; + long n = strtol(*in, &end, 16); + if (end == *in) { + return true; + } + + *in = end; + *arg = (unsigned) n; + return false; +} + +bool scanString(const char **in, va_list *ap) { + char *arg = va_arg(*ap, char*); + while (**in && **in != ' ' && **in != '\n' && **in != '\t') { + *arg = **in; + arg++; + (*in)++; + } + *arg = '\0'; + (*in)++; + return false; +} + +bool scanStringUntil(const char **in, va_list *ap, char c_end) { + char *arg = va_arg(*ap, char*); + while (**in && **in != c_end) { + *arg = **in; + *arg++; + (*in)++; + } + *arg = 0; + (*in)++; + return false; +} + +bool scanChar(const char **in, va_list *ap) { + char *arg = va_arg(*ap, char*); + if (**in) { + *arg = **in; + (*in)++; + } + return false; +} + +extern "C" int simple_sscanf(const char *input, const char *format, ...) { + va_list ap; + int result = 0; + const char *next = input; + + va_start(ap, format); + + while (*format) { + if (*format == '%') { + format++; + int max = 0; + while (isdigit(*format)) { + max = (max * 10) + (*format - '0'); + format++; + } + + bool err = false; + switch (*format++) { + case 'c': + err = scanChar(&next, &ap); + break; + case 'd': + case 'u': + err = scanInt(&next, &ap, max); + break; + case 'x': + err = scanHex(&next, &ap); + break; + case 's': + err = scanString(&next, &ap); + break; + case '[': + // assume %[^c] + if ('^' != *format) { + err = true; + } else { + format++; + if (*format && *(format+1) == ']') { + err = scanStringUntil(&next, &ap, *format); + format += 2; + } else { + err = true; + } + } + break; + default: + err = true; + break; + } + + if (err) { + break; + } else { + result++; + } + } else if (*format++ != *next++) { + // match input + break; + } + } + + va_end(ap); + return result; +} + +#if defined(TEST) +int main(int argc, char *pArgv[]) { + int x,y,xx,yy,h; + char buffer[100]; + unsigned u; + char c; + strcpy(buffer, "hello"); + char *b = buffer; + + if (simple_sscanf("BBX 00009 -1 +10 000", + "BBX %d %d %d %d", + &x, &y, &xx, &yy) != 4) { + printf("Failed\n"); + } else { + printf("Success %d %d %d %d\n", x, y, xx, yy); + } + + if (simple_sscanf("CAT 123x-10 0x100h 123456.AUD $ ", + "CAT %dx%d %xh %06u.AUD %c", + &x, &y, &h, &u, &c) != 5) { + printf("Failed\n"); + } else { + printf("Success %d %d %d %d '%c' \n", x, y, h, u, c); + } + + if (simple_sscanf("COPYRIGHT \"Copyright (c) 1984, 1987 Foo Systems Incorporated", + "COPYRIGHT \"%[^\"]", + b) != 1) { + printf("Failed\n"); + } else { + printf("Success %s\n", buffer); + } + + return 0; +} +#endif diff --git a/backends/platform/tizen/system.cpp b/backends/platform/tizen/system.cpp new file mode 100644 index 0000000000..3d966316c7 --- /dev/null +++ b/backends/platform/tizen/system.cpp @@ -0,0 +1,547 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include + +#include "common/config-manager.h" +#include "common/file.h" +#include "engines/engine.h" +#include "graphics/font.h" +#include "graphics/fontman.h" +#include "graphics/fonts/bdf.h" +#include "backends/saves/default/default-saves.h" +#include "backends/events/default/default-events.h" +#include "backends/audiocd/default/default-audiocd.h" +#include "backends/mutex/mutex.h" +#include "backends/fs/fs-factory.h" +#include "backends/timer/tizen/timer.h" + +#include "backends/platform/tizen/form.h" +#include "backends/platform/tizen/system.h" +#include "backends/platform/tizen/graphics.h" +#include "backends/platform/tizen/audio.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Locales; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::System; + +#define DEFAULT_CONFIG_FILE "scummvm.ini" +#define MUTEX_BUFFER_SIZE 5 + +// +// TizenFilesystemFactory +// +class TizenFilesystemFactory : public FilesystemFactory { + AbstractFSNode *makeRootFileNode() const; + AbstractFSNode *makeCurrentDirectoryFileNode() const; + AbstractFSNode *makeFileNodePath(const Common::String &path) const; +}; + +AbstractFSNode *TizenFilesystemFactory::makeRootFileNode() const { + return new TizenFilesystemNode("/"); +} + +AbstractFSNode *TizenFilesystemFactory::makeCurrentDirectoryFileNode() const { + return new TizenFilesystemNode("/"); +} + +AbstractFSNode *TizenFilesystemFactory::makeFileNodePath(const Common::String &path) const { + AppAssert(!path.empty()); + return new TizenFilesystemNode(path); +} + +// +// TizenSaveFileManager +// +struct TizenSaveFileManager : public DefaultSaveFileManager { + bool removeSavefile(const Common::String &filename); +}; + +bool TizenSaveFileManager::removeSavefile(const Common::String &filename) { + Common::String savePathName = getSavePath(); + + checkPath(Common::FSNode(savePathName)); + if (getError().getCode() != Common::kNoError) { + return false; + } + + // recreate FSNode since checkPath may have changed/created the directory + Common::FSNode savePath(savePathName); + Common::FSNode file = savePath.getChild(filename); + + String unicodeFileName; + StringUtil::Utf8ToString(file.getPath().c_str(), unicodeFileName); + + switch (Tizen::Io::File::Remove(unicodeFileName)) { + case E_SUCCESS: + return true; + + case E_ILLEGAL_ACCESS: + setError(Common::kWritePermissionDenied, "Search or write permission denied: " + + file.getName()); + break; + + default: + setError(Common::kPathDoesNotExist, "removeSavefile: '" + file.getName() + + "' does not exist or path is invalid"); + break; + } + + return false; +} + +// +// TizenMutexManager +// +struct TizenMutexManager : public MutexManager { + TizenMutexManager(); + ~TizenMutexManager(); + OSystem::MutexRef createMutex(); + void lockMutex(OSystem::MutexRef mutex); + void unlockMutex(OSystem::MutexRef mutex); + void deleteMutex(OSystem::MutexRef mutex); +private: + Mutex *_buffer[MUTEX_BUFFER_SIZE]; +}; + +TizenMutexManager::TizenMutexManager() { + for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { + _buffer[i] = NULL; + } +} + +TizenMutexManager::~TizenMutexManager() { + for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { + if (_buffer[i] != NULL) { + delete _buffer[i]; + } + } +} + +OSystem::MutexRef TizenMutexManager::createMutex() { + Mutex *mutex = new Mutex(); + mutex->Create(); + + for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { + if (_buffer[i] == NULL) { + _buffer[i] = mutex; + break; + } + } + + return (OSystem::MutexRef) mutex; +} + +void TizenMutexManager::lockMutex(OSystem::MutexRef mutex) { + Mutex *m = (Mutex *)mutex; + m->Acquire(); +} + +void TizenMutexManager::unlockMutex(OSystem::MutexRef mutex) { + Mutex *m = (Mutex *)mutex; + m->Release(); +} + +void TizenMutexManager::deleteMutex(OSystem::MutexRef mutex) { + Mutex *m = (Mutex *)mutex; + + for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { + if (_buffer[i] == m) { + _buffer[i] = NULL; + } + } + + delete m; +} + +// +// TizenEventManager +// +struct TizenEventManager : public DefaultEventManager { + TizenEventManager(Common::EventSource *boss); + void init(); + int shouldQuit() const; +}; + +TizenEventManager::TizenEventManager(Common::EventSource *boss) : + DefaultEventManager(boss) { +} + +void TizenEventManager::init() { + DefaultEventManager::init(); + + // theme and vkbd should have now loaded - clear the splash screen + TizenSystem *system = (TizenSystem *)g_system; + TizenGraphicsManager *graphics = system->getGraphics(); + if (graphics) { + graphics->setReady(); + } +} + +int TizenEventManager::shouldQuit() const { + TizenSystem *system = (TizenSystem *)g_system; + return DefaultEventManager::shouldQuit() || system->isClosing(); +} + +// +// TizenAppFrame - avoid drawing the misplaced UiTheme at startup +// +struct TizenAppFrame : Frame { + result OnDraw(void) { + logEntered(); + TizenAppForm *form = (TizenAppForm *)GetCurrentForm(); + if (form->isStarting()) { + Canvas *canvas = GetCanvasN(); + canvas->SetBackgroundColor(Color::GetColor(COLOR_ID_BLACK)); + canvas->Clear(); + delete canvas; + } + return E_SUCCESS; + } +}; + +// +// TizenSystem +// +TizenSystem::TizenSystem(TizenAppForm *appForm) : + _appForm(appForm), + _audioThread(0), + _epoch(0) { +} + +result TizenSystem::Construct(void) { + logEntered(); + + _fsFactory = new TizenFilesystemFactory(); + if (!_fsFactory) { + return E_OUT_OF_MEMORY; + } + + _resourcePath = fromString(App::GetInstance()->GetAppResourcePath()); + return E_SUCCESS; +} + +TizenSystem::~TizenSystem() { + logEntered(); +} + +result TizenSystem::initModules() { + logEntered(); + + _mutexManager = new TizenMutexManager(); + if (!_mutexManager) { + return E_OUT_OF_MEMORY; + } + + _timerManager = new TizenTimerManager(); + if (!_timerManager) { + return E_OUT_OF_MEMORY; + } + + _savefileManager = new TizenSaveFileManager(); + if (!_savefileManager) { + return E_OUT_OF_MEMORY; + } + + _graphicsManager = (GraphicsManager *)new TizenGraphicsManager(_appForm); + if (!_graphicsManager) { + return E_OUT_OF_MEMORY; + } + + // depends on _graphicsManager when ENABLE_VKEYBD enabled + _eventManager = new TizenEventManager(this); + if (!_eventManager) { + return E_OUT_OF_MEMORY; + } + + _audioThread = new AudioThread(); + if (!_audioThread) { + return E_OUT_OF_MEMORY; + } + + _mixer = _audioThread->Construct(this); + if (!_mixer) { + return E_OUT_OF_MEMORY; + } + + _audiocdManager = (AudioCDManager *)new DefaultAudioCDManager(); + if (!_audiocdManager) { + return E_OUT_OF_MEMORY; + } + + if (IsFailed(_audioThread->Start())) { + AppLog("Failed to start audio thread"); + return E_OUT_OF_MEMORY; + } + + logLeaving(); + return E_SUCCESS; +} + +void TizenSystem::initBackend() { + logEntered(); + + Common::String dataPath = fromString(App::GetInstance()->GetAppDataPath()); + + // use the mobile device theme + ConfMan.set("gui_theme", _resourcePath + "scummmodern"); + + // allow tizen virtual keypad pack to be found + ConfMan.set("vkeybdpath", _resourcePath + "vkeybd_bada"); + ConfMan.set("vkeybd_pack_name", "vkeybd_bada"); + + // set default save path to writable area + if (!ConfMan.hasKey("savepath")) { + ConfMan.set("savepath", dataPath); + } + + // default to no auto-save + if (!ConfMan.hasKey("autosave_period")) { + ConfMan.setInt("autosave_period", 0); + } + + ConfMan.registerDefault("fullscreen", true); + ConfMan.registerDefault("aspect_ratio", false); + ConfMan.setBool("confirm_exit", false); + + SystemTime::GetTicks(_epoch); + + if (E_SUCCESS != initModules()) { + AppLog("initModules failed"); + } else { + OSystem::initBackend(); + + // replace kBigGUIFont for the vkbd and on-screen messages + Common::String fontCacheFile = dataPath + "helvR24.fcc"; + TizenFilesystemNode file(fontCacheFile); + if (!file.exists()) { + Common::String bdfFile = _resourcePath + "fonts/helvR24.bdf"; + TizenFilesystemNode file(bdfFile); + if (file.exists()) { + Common::SeekableReadStream *stream = file.createReadStream(); + Common::File fontFile; + if (stream && fontFile.open(stream, bdfFile)) { + Graphics::BdfFont *font = Graphics::BdfFont::loadFont(fontFile); + Graphics::BdfFont::cacheFontData(*font, fontCacheFile); + FontMan.setFont(Graphics::FontManager::kBigGUIFont, font); + } + } + } else { + Common::SeekableReadStream *stream = file.createReadStream(); + Common::File fontFile; + if (stream && fontFile.open(stream, fontCacheFile)) { + Graphics::BdfFont *font = Graphics::BdfFont::loadFromCache(fontFile); + if (font) { + FontMan.setFont(Graphics::FontManager::kBigGUIFont, font); + } + } + } + } + logLeaving(); +} + +void TizenSystem::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { + // allow translations.dat and game .DAT files to be found + s.addDirectory(_resourcePath, _resourcePath, priority); +} + +void TizenSystem::destroyBackend() { + closeAudio(); + + delete _graphicsManager; + _graphicsManager = NULL; + + delete _savefileManager; + _savefileManager = NULL; + + delete _fsFactory; + _fsFactory = NULL; + + delete _mixer; + _mixer = NULL; + + delete _audiocdManager; + _audiocdManager = NULL; + + delete _timerManager; + _timerManager = NULL; + + delete _eventManager; + _eventManager = NULL; + + delete _mutexManager; + _mutexManager = NULL; +} + +bool TizenSystem::pollEvent(Common::Event &event) { + return _appForm->pollEvent(event); +} + +uint32 TizenSystem::getMillis() { + long long result, ticks = 0; + SystemTime::GetTicks(ticks); + result = ticks - _epoch; + return result; +} + +void TizenSystem::delayMillis(uint msecs) { + if (!_appForm->isClosing()) { + Thread::Sleep(msecs); + } +} + +void TizenSystem::updateScreen() { + if (_graphicsManager != NULL) { + _graphicsManager->updateScreen(); + } +} + +void TizenSystem::getTimeAndDate(TimeDate &td) const { + DateTime currentTime; + + if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) { + td.tm_sec = currentTime.GetSecond(); + td.tm_min = currentTime.GetMinute(); + td.tm_hour = currentTime.GetHour(); + td.tm_mday = currentTime.GetDay(); + td.tm_mon = currentTime.GetMonth(); + td.tm_year = currentTime.GetYear(); + + Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + calendar->SetTime(currentTime); + td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1; + delete calendar; + } +} + +void TizenSystem::fatalError() { + systemError("ScummVM: Fatal internal error."); +} + +void TizenSystem::exitSystem() { + if (_appForm) { + closeAudio(); + closeGraphics(); + _appForm->exitSystem(); + } +} + +void TizenSystem::logMessage(LogMessageType::Type type, const char *message) { + if (type == LogMessageType::kError) { + systemError(message); + } else { + AppLog(message); + } +} + +Common::SeekableReadStream *TizenSystem::createConfigReadStream() { + TizenFilesystemNode file(fromString(App::GetInstance()->GetAppDataPath()) + DEFAULT_CONFIG_FILE); + return file.createReadStream(); +} + +Common::WriteStream *TizenSystem::createConfigWriteStream() { + TizenFilesystemNode file(fromString(App::GetInstance()->GetAppDataPath()) + DEFAULT_CONFIG_FILE); + return file.createWriteStream(); +} + +void TizenSystem::closeAudio() { + if (_audioThread) { + _audioThread->Quit(); + _audioThread->Join(); + delete _audioThread; + _audioThread = NULL; + } +} + +void TizenSystem::closeGraphics() { + if (_graphicsManager) { + delete _graphicsManager; + _graphicsManager = NULL; + } +} + +void TizenSystem::setMute(bool on) { + // only change mute after eventManager init() has completed + if (_audioThread) { + TizenGraphicsManager *graphics = getGraphics(); + if (graphics && graphics->isReady()) { + _audioThread->setMute(on); + } + } +} + +// +// create the ScummVM system +// +TizenAppForm *systemStart(Tizen::App::Application *app) { + logEntered(); + + Frame *appFrame = new (std::nothrow) TizenAppFrame(); + if (!appFrame || appFrame->Construct() == E_FAILURE) { + AppLog("Failed to create appFrame"); + return NULL; + } + app->AddFrame(*appFrame); + + TizenAppForm *appForm = new TizenAppForm(); + if (!appForm) { + AppLog("Failed to create appForm"); + return NULL; + } + + if (E_SUCCESS != appForm->Construct() || + E_SUCCESS != appFrame->AddControl(*appForm)) { + delete appForm; + AppLog("Failed to construct appForm"); + return NULL; + } + + appFrame->SetCurrentForm(appForm); + logLeaving(); + return appForm; +} + +// +// display a fatal error notification +// +void systemError(const char *message) { + AppLog("Fatal system error: %s", message); + + if (strspn(message, "Config file buggy:") > 0) { + Tizen::Io::File::Remove(DEFAULT_CONFIG_FILE); + Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR_CONFIG, NULL); + } else { + ArrayList *args = new ArrayList(); + args->Construct(); + args->Add(*(new String(message))); + Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR, args); + } + + if (g_system) { + TizenSystem *system = (TizenSystem *)g_system; + system->exitSystem(); + } +} diff --git a/backends/platform/tizen/system.h b/backends/platform/tizen/system.h new file mode 100644 index 0000000000..19394e1c92 --- /dev/null +++ b/backends/platform/tizen/system.h @@ -0,0 +1,102 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_SYSTEM_H +#define TIZEN_SYSTEM_H + +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "common/scummsys.h" +#include "backends/modular-backend.h" + +#include "backends/platform/tizen/fs.h" +#include "backends/platform/tizen/form.h" +#include "backends/platform/tizen/audio.h" +#include "backends/platform/tizen/graphics.h" + +#if defined(_DEBUG) +#define logEntered() AppLog("%s entered (%s %d)", __FUNCTION__, __FILE__, __LINE__); +#define logLeaving() AppLog("%s leaving (%s %d)", __FUNCTION__, __FILE__, __LINE__); +#else +#define logEntered() +#define logLeaving() +#endif + +TizenAppForm *systemStart(Tizen::App::Application *app); +void systemError(const char *message); + +#define USER_MESSAGE_EXIT 1000 +#define USER_MESSAGE_EXIT_ERR 1001 +#define USER_MESSAGE_EXIT_ERR_CONFIG 1002 + +// +// TizenSystem +// +class TizenSystem : + public ModularBackend, + Common::EventSource { +public: + TizenSystem(TizenAppForm *appForm); + ~TizenSystem(); + + result Construct(); + void closeAudio(); + void closeGraphics(); + void destroyBackend(); + void setMute(bool on); + void exitSystem(); + bool isClosing() { return _appForm->isClosing(); } + + TizenGraphicsManager *getGraphics() { + return (TizenGraphicsManager *)_graphicsManager; + } + +private: + void initBackend(); + result initModules(); + + void updateScreen(); + bool pollEvent(Common::Event &event); + uint32 getMillis(); + void delayMillis(uint msecs); + void getTimeAndDate(TimeDate &t) const; + void fatalError(); + void logMessage(LogMessageType::Type type, const char *message); + void addSysArchivesToSearchSet(Common::SearchSet &s, int priority); + + Common::EventSource *getDefaultEventSource() { return this; } + Common::SeekableReadStream *createConfigReadStream(); + Common::WriteStream *createConfigWriteStream(); + + TizenAppForm *_appForm; + AudioThread *_audioThread; + long long _epoch; + Common::String _resourcePath; +}; + +#endif diff --git a/backends/platform/tizen/tizen.mk b/backends/platform/tizen/tizen.mk new file mode 100644 index 0000000000..d8925b62dc --- /dev/null +++ b/backends/platform/tizen/tizen.mk @@ -0,0 +1,7 @@ +# port files built under eclipse + +MODULE := backends/platform/tizen + +$(EXECUTABLE): $(OBJS) + rm -f $@ + arm-linux-gnueabi-ar Tru $@ $(OBJS) diff --git a/backends/timer/bada/timer.cpp b/backends/timer/bada/timer.cpp deleted file mode 100644 index e41ecd4864..0000000000 --- a/backends/timer/bada/timer.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#if defined(BADA) - -#include "backends/timer/bada/timer.h" - -// -// TimerSlot -// -TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback, - uint32 interval, void *refCon) : - _timer(0), - _callback(callback), - _interval(interval), - _refCon(refCon) { -} - -TimerSlot::~TimerSlot() { -} - -bool TimerSlot::OnStart() { - _timer = new Osp::Base::Runtime::Timer(); - if (!_timer || IsFailed(_timer->Construct(*this))) { - AppLog("Failed to create timer"); - return false; - } - - if (IsFailed(_timer->Start(_interval))) { - AppLog("failed to start timer"); - return false; - } - - AppLog("started timer %d", _interval); - return true; -} - -void TimerSlot::OnStop() { - AppLog("timer stopped"); - if (_timer) { - _timer->Cancel(); - delete _timer; - _timer = NULL; - } -} - -void TimerSlot::OnTimerExpired(Timer &timer) { - _callback(_refCon); - timer.Start(_interval); -} - -// -// BadaTimerManager -// -BadaTimerManager::BadaTimerManager() { -} - -BadaTimerManager::~BadaTimerManager() { - for (Common::List::iterator slot = _timers.begin(); - slot != _timers.end(); ) { - slot->Stop(); - slot = _timers.erase(slot); - } -} - -bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon, - const Common::String &id) { - TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon); - - if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) { - AppLog("Failed to create timer thread"); - delete slot; - return false; - } - - if (IsFailed(slot->Start())) { - delete slot; - AppLog("Failed to start timer thread"); - return false; - } - - _timers.push_back(*slot); - return true; -} - -void BadaTimerManager::removeTimerProc(TimerProc proc) { - for (Common::List::iterator slot = _timers.begin(); - slot != _timers.end(); ++slot) { - if (slot->_callback == proc) { - slot->Stop(); - slot = _timers.erase(slot); - } - } -} - -#endif diff --git a/backends/timer/bada/timer.h b/backends/timer/bada/timer.h deleted file mode 100644 index 826064d7ff..0000000000 --- a/backends/timer/bada/timer.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef BADA_TIMER_H -#define BADA_TIMER_H - -#include - -#include "common/timer.h" -#include "common/list.h" - -using namespace Osp::Base::Runtime; - -struct TimerSlot: public ITimerEventListener, public Thread { - TimerSlot(Common::TimerManager::TimerProc callback, - uint32 interval, - void *refCon); - ~TimerSlot(); - - bool OnStart(void); - void OnStop(void); - void OnTimerExpired(Timer &timer); - - Timer *_timer; - Common::TimerManager::TimerProc _callback; - uint32 _interval; // in microseconds - void *_refCon; -}; - -class BadaTimerManager : public Common::TimerManager { -public: - BadaTimerManager(); - ~BadaTimerManager(); - - bool installTimerProc(TimerProc proc, int32 interval, void *refCon, - const Common::String &id); - void removeTimerProc(TimerProc proc); - -private: - Common::List _timers; -}; - -#endif diff --git a/backends/timer/tizen/timer.cpp b/backends/timer/tizen/timer.cpp new file mode 100644 index 0000000000..fa226ce747 --- /dev/null +++ b/backends/timer/tizen/timer.cpp @@ -0,0 +1,117 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#if defined(TIZEN) + +#include "backends/timer/tizen/timer.h" + +// +// TimerSlot - an event driven thread +// +TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback, uint32 interval, void *refCon) : + _timer(0), + _callback(callback), + _interval(interval), + _refCon(refCon) { +} + +TimerSlot::~TimerSlot() { + delete _timer; +} + +bool TimerSlot::OnStart() { + _timer = new Tizen::Base::Runtime::Timer(); + if (!_timer || IsFailed(_timer->Construct(*this))) { + AppLog("Failed to create timer"); + return false; + } + + if (IsFailed(_timer->StartAsRepeatable(_interval))) { + AppLog("failed to start timer"); + return false; + } + + AppLog("started timer %d", _interval); + return true; +} + +void TimerSlot::OnStop() { + AppLog("timer stopped"); + if (_timer) { + _timer->Cancel(); + delete _timer; + _timer = NULL; + } +} + +void TimerSlot::OnTimerExpired(Timer &timer) { + _callback(_refCon); +} + +// +// TizenTimerManager +// +TizenTimerManager::TizenTimerManager() { +} + +TizenTimerManager::~TizenTimerManager() { + for (Common::List::iterator it = _timers.begin(); it != _timers.end(); ) { + TimerSlot *slot = (*it); + slot->Quit(); + slot->Join(); + delete slot; + it = _timers.erase(it); + } +} + +bool TizenTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id) { + TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon); + + if (IsFailed(slot->Construct())) { + AppLog("Failed to create timer thread"); + delete slot; + return false; + } + + if (IsFailed(slot->Start())) { + delete slot; + AppLog("Failed to start timer thread"); + return false; + } + + _timers.push_back(slot); + return true; +} + +void TizenTimerManager::removeTimerProc(TimerProc proc) { + for (Common::List::iterator it = _timers.begin(); it != _timers.end(); ++it) { + TimerSlot *slot = (*it); + if (slot->_callback == proc) { + slot->Quit(); + slot->Join(); + delete slot; + it = _timers.erase(it); + } + } +} + +#endif diff --git a/backends/timer/tizen/timer.h b/backends/timer/tizen/timer.h new file mode 100644 index 0000000000..4b2596401a --- /dev/null +++ b/backends/timer/tizen/timer.h @@ -0,0 +1,59 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TIZEN_TIMER_H +#define TIZEN_TIMER_H + +#include + +#include "common/timer.h" +#include "common/list.h" + +using namespace Tizen::Base::Runtime; + +struct TimerSlot: public EventDrivenThread, public ITimerEventListener { + TimerSlot(Common::TimerManager::TimerProc callback, uint32 interval, void *refCon); + ~TimerSlot(); + + bool OnStart(void); + void OnStop(void); + void OnTimerExpired(Timer &timer); + + Timer *_timer; + Common::TimerManager::TimerProc _callback; + uint32 _interval; // in microseconds + void *_refCon; +}; + +class TizenTimerManager : public Common::TimerManager { +public: + TizenTimerManager(); + ~TizenTimerManager(); + + bool installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id); + void removeTimerProc(TimerProc proc); + +private: + Common::List _timers; +}; + +#endif diff --git a/configure b/configure index dbd78d3f9d..caac3790b2 100755 --- a/configure +++ b/configure @@ -816,7 +816,7 @@ Usage: $0 [OPTIONS]... Configuration: -h, --help display this help and exit - --backend=BACKEND backend to build (android, bada, dc, dingux, ds, gph, + --backend=BACKEND backend to build (android, tizen, dc, dingux, ds, gph, iphone, linuxmoto, maemo, n64, null, openpandora, ps2, psp, samsungtv, sdl, webos, wii, wince) [sdl] @@ -845,7 +845,7 @@ Fine tuning of the installation directories: Special configuration feature: --host=HOST cross-compile to target HOST (arm-linux, ...) special targets: android for Android - bada for Samsung BADA + tizen for Samsung Tizen caanoo for Caanoo dingux for Dingux dreamcast for Sega Dreamcast @@ -1247,16 +1247,6 @@ arm-riscos) _host_os=riscos _host_cpu=arm ;; -bada) - _host_os=bada - if test "$_debug_build" = yes; then - _host_cpu=i686 - _host_alias=i686-mingw32 - else - _host_cpu=arm - _host_alias=arm-samsung-nucleuseabi - fi - ;; caanoo) _host_os=gph-linux _host_cpu=arm @@ -1382,6 +1372,11 @@ samsungtv) _host_cpu=arm _host_alias=arm-linux-gnueabi ;; +tizen) + _host_os=tizen + _host_cpu=arm + _host_alias=arm-linux-gnueabi + ;; webos) _host_os=webos _host_cpu=arm @@ -1491,12 +1486,6 @@ android) exit 1 fi ;; -bada) - if test -z "$BADA_SDK"; then - echo "Please set BADA_SDK in your environment. export BADA_SDK=" - exit 1 - fi - ;; ds | gamecube | wii) if test -z "$DEVKITPRO"; then echo "Please set DEVKITPRO in your environment. export DEVKITPRO=" @@ -1538,6 +1527,12 @@ psp) exit 1 fi ;; +tizen) + if test -z "$TIZEN_ROOTSTRAP"; then + echo "Please set TIZEN_ROOTSTRAP in your environment. export TIZEN_ROOTSTRAP=" + exit 1 + fi + ;; webos) if test -z "$WEBOS_SDK"; then echo "Please set WEBOS_SDK in your environment. export WEBOS_SDK=" @@ -1731,7 +1726,7 @@ if test "$have_gcc" = yes ; then case $_host_os in # newlib-based system include files suppress non-C89 function # declarations under __STRICT_ANSI__ - amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince ) + amigaos* | android | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | tizen | wii | wince ) ;; *) CXXFLAGS="$CXXFLAGS -ansi" @@ -1767,7 +1762,7 @@ echo $_use_cxx11 # However, some platforms use GNU extensions in system header files, so # for these we must not use -pedantic. case $_host_os in -android | gamecube | psp | wii | webos) +android | gamecube | psp | tizen | wii | webos) ;; *) # ICC does not support pedantic, while GCC and clang do. @@ -2051,16 +2046,6 @@ case $_host_os in add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK" _seq_midi=no ;; - bada) - BADA_SDK_ROOT="`cygpath -m ${BADA_SDK}`" - add_line_to_config_mk "BADA_SDK = $BADA_SDK" - add_line_to_config_mk "BADA_SDK_ROOT = $BADA_SDK_ROOT" - - # assume dependencies have been installed in cygwin's /usr/local - CYGWIN_USR_LOCAL="`cygpath -m /usr/local`" - LDFLAGS="$LDFLAGS -L${CYGWIN_USR_LOCAL}/lib" - CXXFLAGS="$CXXFLAGS -I${CYGWIN_USR_LOCAL}/include" - ;; beos*) DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" # Needs -lbind -lsocket for the timidity MIDI driver @@ -2238,6 +2223,12 @@ case $_host_os in # Needs -lbind -lsocket for the timidity MIDI driver LIBS="$LIBS -lnsl -lsocket" ;; + tizen) + add_line_to_config_mk "TIZEN_ROOTSTRAP = $TIZEN_ROOTSTRAP" + LDFLAGS="$LDFLAGS --sysroot=${TIZEN_ROOTSTRAP}" + LDFLAGS="$LDFLAGS -L${TIZEN_LIBS}/lib" + CXXFLAGS="$CXXFLAGS -I${TIZEN_LIBS}/include" + ;; webos) CXXFLAGS="$CXXFLAGS --sysroot=$WEBOS_PDK/arm-gcc/sysroot" CXXFLAGS="$CXXFLAGS -I$WEBOS_PDK/include" @@ -2316,22 +2307,6 @@ if test -n "$_host"; then arm-riscos|linupy) DEFINES="$DEFINES -DLINUPY" ;; - bada) - _unix=yes - _backend="bada" - _port_mk="backends/platform/bada/bada.mk" - if test "$_debug_build" = yes; then - _arm_asm=no - else - _arm_asm=yes - fi - _taskbar=no - _build_scalers=no - _seq_midi=no - _mt32emu=no - _timidity=no - _vkeybd=yes - ;; bfin*) ;; caanoo) @@ -2644,6 +2619,18 @@ if test -n "$_host"; then _mt32emu=no _vkeybd=yes ;; + tizen) + _unix=yes + _backend="tizen" + _port_mk="backends/platform/tizen/tizen.mk" + _arm_asm=yes + _taskbar=no + _build_scalers=no + _seq_midi=no + _mt32emu=no + _timidity=no + _vkeybd=yes + ;; webos) _backend="webos" _port_mk="backends/platform/webos/webos.mk" @@ -2694,34 +2681,6 @@ case $_backend in LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" INCLUDES="$INCLUDES -I$ANDROID_NDK/sources/cxx-stl/system/include" ;; - bada) - # dirent.h not available. NONSTANDARD_PORT==ensure portdefs.h is included - DEFINES="$DEFINES -DBADA -DDISABLE_STDIO_FILESTREAM -DNONSTANDARD_PORT" - DEFINES="$DEFINES -DNO_STDERR_STDOUT" - DEFINES="$DEFINES -DDISABLE_COMMAND_LINE" - INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/bada ' - INCLUDES="$INCLUDES "'-I$(BADA_SDK)/include' - INCLUDES="$INCLUDES "'-I$(BADA_SDK_ROOT)/Include' - if test "$_debug_build" = yes; then - # debug using with the simulator - CXXFLAGS="$CXXFLAGS -D_DEBUG -DSHP -DBUILD_DLL -fmessage-length=0" - else - # created a shared library for inclusion via the eclipse build - CXXFLAGS="$CXXFLAGS -DSHP" - CXXFLAGS="$CXXFLAGS -fpic" - CXXFLAGS="$CXXFLAGS -fshort-wchar" - CXXFLAGS="$CXXFLAGS -mcpu=cortex-a8" - CXXFLAGS="$CXXFLAGS -mfpu=vfpv3" - CXXFLAGS="$CXXFLAGS -mfloat-abi=hard" - CXXFLAGS="$CXXFLAGS -mlittle-endian" - CXXFLAGS="$CXXFLAGS -mthumb-interwork" - CXXFLAGS="$CXXFLAGS -Wno-psabi" - CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" - CXXFLAGS="$CXXFLAGS -fno-short-enums" - fi - HOSTEXEPRE=lib - HOSTEXEEXT=.a - ;; dc) INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/dc' INCLUDES="$INCLUDES "'-isystem $(ronindir)/include' @@ -2804,6 +2763,25 @@ case $_backend in LDFLAGS="$LDFLAGS -shared" LDFLAGS="$LDFLAGS -fpic" ;; + tizen) + # dirent.h not available. NONSTANDARD_PORT==ensure portdefs.h is included + DEFINES="$DEFINES -DTIZEN -DDISABLE_STDIO_FILESTREAM -DNONSTANDARD_PORT" + DEFINES="$DEFINES -DNO_STDERR_STDOUT" + DEFINES="$DEFINES -DDISABLE_COMMAND_LINE" + INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/tizen' + INCLUDES="$INCLUDES "'-I$(TIZEN_ROOTSTRAP)/usr/include' + INCLUDES="$INCLUDES "'-I$(TIZEN_ROOTSTRAP)/usr/include/osp' + if test "$_debug_build" = yes; then + CXXFLAGS="$CXXFLAGS -D_DEBUG -DBUILD_DLL -O0 -g3" + fi + # created a shared library for inclusion via the eclipse build + CXXFLAGS="$CXXFLAGS -Wno-psabi" + CXXFLAGS="$CXXFLAGS --sysroot=${TIZEN_ROOTSTRAP}" + CXXFLAGS="$CXXFLAGS -fmessage-length=0" + CXXFLAGS="$CXXFLAGS -fPIC" + HOSTEXEPRE=lib + HOSTEXEEXT=.a + ;; webos) # There is no sdl-config in the WebOS PDK so we don't use find_sdlconfig here. # The PDL library acts as the WebOS device toolchain, and is required to control the virtual keyboard among other OS-level events. @@ -2869,7 +2847,7 @@ esac # Enable 16bit support only for backends which support it # case $_backend in - android | bada | dingux | dc | gph | iphone | maemo | openpandora | psp | samsungtv | sdl | webos | wii) + android | dingux | dc | gph | iphone | maemo | openpandora | psp | samsungtv | sdl | tizen | webos | wii) if test "$_16bit" = auto ; then _16bit=yes else @@ -3721,7 +3699,7 @@ EOF fi case $_host_os in - bada) + tizen) # components live in non-standard locations so just assume sane SDK _opengl=yes _opengles=yes diff --git a/devtools/credits.pl b/devtools/credits.pl index 06df7fa50e..7d39730c63 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -754,10 +754,6 @@ begin_credits("Credits"); add_person("Angus Lees", "Gus", ""); end_section(); - begin_section("BADA"); - add_person("Chris Warren-Smith", "", ""); - end_section(); - begin_section("Dreamcast"); add_person("Marcus Comstedt", "", ""); end_section(); @@ -818,6 +814,10 @@ begin_credits("Credits"); add_person("Lars Persson", "AnotherGuest", ""); end_section(); + begin_section("Tizen / BADA"); + add_person("Chris Warren-Smith", "", ""); + end_section(); + begin_section("WebOS"); add_person("Klaus Reimer", "kayahr", ""); end_section(); diff --git a/gui/credits.h b/gui/credits.h index 81d46b2b73..70f79ac9a5 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -294,9 +294,6 @@ static const char *credits[] = { "C0""Andre Heider", "C0""Angus Lees", "", -"C1""BADA", -"C0""Chris Warren-Smith", -"", "C1""Dreamcast", "C0""Marcus Comstedt", "", @@ -352,6 +349,9 @@ static const char *credits[] = { "C0""Jurgen Braam", "C0""Lars Persson", "", +"C1""Tizen / BADA", +"C0""Chris Warren-Smith", +"", "C1""WebOS", "C0""Klaus Reimer", "", diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp index 4b266e8194..3677f02e47 100644 --- a/gui/widgets/edittext.cpp +++ b/gui/widgets/edittext.cpp @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "common/system.h" #include "gui/widgets/edittext.h" #include "gui/gui-manager.h" @@ -79,8 +80,13 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) { } if (setCaretPos(i)) draw(); -} +#ifdef TIZEN + // Display the virtual keypad to allow text entry. Samsung app-store testers expected + // the keypad to be displayed when clicking the filter edit control in the laucher gui. + g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); +#endif +} void EditTextWidget::drawWidget() { g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), 0, ThemeEngine::kWidgetBackgroundEditText); -- cgit v1.2.3 From 42e3c18ed3de4b143b10a1652d53061e750d5d8b Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 3 Jul 2013 00:22:27 +0200 Subject: CREATE_PROJECT: Fix a typo in the help-message (--codeblocks) --- devtools/create_project/create_project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 84a6185eda..6b6e86a187 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -588,7 +588,7 @@ void displayHelp(const char *exe) { " Additionally there are the following switches for changing various settings:\n" "\n" "Project specific settings:\n" - " --codeblock build Code::Blocks project files\n" + " --codeblocks build Code::Blocks project files\n" " --msvc build Visual Studio project files\n" " --xcode build XCode project files\n" " --file-prefix prefix allow overwriting of relative file prefix in the\n" -- cgit v1.2.3 From d3351c94601a6adadba0e79963cc2d24dab51d54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 3 Jul 2013 00:38:51 +0200 Subject: MORTEVIELLE: The German version now starts with broken texts --- engines/mortevielle/mortevielle.h | 4 ++-- engines/mortevielle/utils.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e6f8a1f235..486f93f260 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -125,7 +125,7 @@ const int kArep = 1314; const int kAmzon = 1650; const int kArega = 0; -const int kMaxTi = 7975; +const int kMaxTi = 9000; const int kMaxTd = 600; const int kDescriptionStringIndex = 0; // Unused @@ -136,7 +136,7 @@ const int kMenuPlaceStringIndex = 435; const int kMenuActionStringIndex = 476; const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; -const int kSecretPassageQuestionStringIndex = 510; // Unusued? +const int kSecretPassageQuestionStringIndex = 510; // Unused? const int kMaxPatt = 20; const int OPCODE_NONE = 0; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 7756d913e5..8c2d375359 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2082,8 +2082,10 @@ void MortevielleEngine::loadTexts() { } } if (!ntpFile.open("TXX.NTP")) { - warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); - return; + if (!ntpFile.open("TXX.IND")) { + warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); + return; + } } if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { -- cgit v1.2.3 From ad47cf0d718a996b7ea9afdcac48b05022a58608 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 3 Jul 2013 00:45:56 +0200 Subject: MORTEVIELLE: Fix extraction tool to handle German DOS version --- devtools/extract_mort/extract_mort.cpp | 93 ++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index 477ca44631..0d603f78cb 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -114,37 +114,63 @@ public: }; File textFile, txxInp, txxNtp; +int _version; /*-------------------------------------------------------------------------*/ #define BUFFER_SIZE 32768 -const byte tabdr[32] = { - 32, 101, 115, 97, 114, 105, 110, +const byte tabdrFr[32] = { + 32, 101, 115, 97, 114, 105, 110, // ' e♣arinutol 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 byte tab30[32] = { - 69, 67, 74, 138, 133, 120, 77, 122, +const byte tabdrDe[32] = { + 0x20, 0x65, 0x6E, 0x69, 0x73, 0x72, 0x74, // ' e♣arinutol + 0x68, 0x61, 0x75, 0x0D, 0x63, 0x6C, 0x64, + 0x6D, 0x6F, 0x67, 0x2E, 0x62, 0x66, 0x53, + 0x2C, 0x77, 0x45, 0x7A, 0x6B, 0x44, 0x76, + 0x9C, 0x47, 0x1E, 0x1F +}; + +const byte tab30Fr[32] = { + 69, 67, 74, 138, 133, 120, 77, 122, //ECJèà¶M 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 byte tab31[32]= { +const byte tab30De[32] = { + 0x49, 0x4D, 0x21, 0x42, 0x4C, 0x70, 0x41, 0x52, //ECJèà¶M + 0x57, 0x4E, 0x48, 0x3F, 0x46, 0x50, 0x55, 0x4B, + 0x5A, 0x4A, 0x54, 0x31, 0x4F, 0x56, 0x79, 0x3A, + 0x6A, 0x5B, 0x5D, 0x40, 0x22, 0x2F, 0x30, 0x35 +}; + +const byte tab31Fr[32]= { 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 }; +const byte tab31De[32]= { + 0x78, 0x2D, 0x32, 0x82, 0x43, 0x39, 0x33, 0x38, + 0x7C, 0x27, 0x37, 0x3B, 0x25, 0x28, 0x29, 0x36, + 0x51, 0x59, 0x71, 0x81, 0x87, 0x88, 0x93, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +const byte *tabdr, *tab30, *tab31; +uint16 ctrlChar; + /** * Extracts a single character from the game data */ -static void extractCharacter(unsigned char &c, int &idx, int &pt, bool &the_end, const uint16 *strData) { +static void extractCharacter(unsigned char &c, uint &idx, uint &pt, bool &the_end, const uint16 *strData) { uint16 oct, ocd; /* 5-8 */ @@ -161,14 +187,10 @@ static void extractCharacter(unsigned char &c, int &idx, int &pt, bool &the_end, oct = (uint)oct >> pt; } - switch (oct) { - case 11 : { + if (oct == ctrlChar) { c = '$'; the_end = true; - } - break; - case 30: - case 31 : { + } else if (oct == 30 || oct == 31) { ocd = FROM_LE_16(strData[idx]); ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { @@ -185,14 +207,11 @@ static void extractCharacter(unsigned char &c, int &idx, int &pt, bool &the_end, else c = (char)tab31[ocd]; - if (c == '\0') { + if (c == '\0') the_end = true; - } - } - break; - default: + } else { c = (char)tabdr[oct]; - } + } } /** @@ -293,8 +312,8 @@ static void export_strings(const char *textFilename) { // Loop through getting each string for (unsigned int strIndex = 0; strIndex < (txxNtp.size() / 3); ++strIndex) { - int indis = txxNtp.readWord(); - int point = txxNtp.readByte(); + uint indis = txxNtp.readWord(); + uint point = txxNtp.readByte(); // Extract the string int charIndex = 0; @@ -330,8 +349,14 @@ static void export_strings(const char *textFilename) { */ static void import_strings(const char *textFilename) { // Open input and output files - txxInp.open("TXX.INP", kFileWriteMode); - txxNtp.open("TXX.NTP", kFileWriteMode); + if (!txxInp.open("TXX.INP", kFileWriteMode)) { + printf("Missing TXX data file"); + exit(-1); + } + if (!txxNtp.open("TXX.NTP", kFileWriteMode)) { + printf("Missing TXX index file"); + exit(-1); + } textFile.open(textFilename, kFileReadMode); // Set up a buffer for the output compressed strings @@ -371,17 +396,33 @@ static void import_strings(const char *textFilename) { int main(int argc, char *argv[]) { - if (argc != 3) { - printf("Format: %s export|import output_file\n", argv[0]); + if (argc != 4) { + printf("Format: %s export|import v1|v2 output_file\n", argv[0]); + printf("where:\nv1: French DOS version\nv2: German DOS version\n"); printf("The program must be run from the directory with the Mortville Manor game files.\n"); exit(0); } + if (!strcmp(argv[2], "v1")) { + tab30 = tab30Fr; + tab31 = tab31Fr; + tabdr = tabdrFr; + ctrlChar = 11; + } else if (!strcmp(argv[2], "v2")) { + tab30 = tab30De; + tab31 = tab31De; + tabdr = tabdrDe; + ctrlChar = 10; + } else { + printf("Unknown version"); + exit(-1); + } + // Do the processing if (!strcmp(argv[1], "export")) - export_strings(argv[2]); + export_strings(argv[3]); else if (!strcmp(argv[1], "import")) - import_strings(argv[2]); + import_strings(argv[3]); else printf("Unknown operation specified\n"); } -- cgit v1.2.3 From b60b3bbecd45d17f95d45512023f5e33a6e96e0e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 04:41:06 +0300 Subject: NEVERHOOD: Fix save slot selection My initial suggestion to fix the issue was made in 163023a, which broke the save slot selection logic. The actual save slot selection problem was fixed in commit 2ca36ab --- engines/neverhood/menumodule.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 8814401f5e..da7abd41e1 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -766,9 +766,7 @@ void SavegameListBox::onClick() { mousePos.y -= _y + _rect.y1; if (mousePos.x >= 0 && mousePos.x <= _rect.x2 - _rect.x1 && mousePos.y >= 0 && mousePos.y <= _rect.y2 - _rect.y1) { - // We add 1 to the char height to ensure that the correct entry is chosen if the - // user clicks at the bottom the text entry - int newIndex = _firstVisibleItem + mousePos.y / (_fontSurface->getCharHeight() + 1); + int newIndex = _firstVisibleItem + mousePos.y / _fontSurface->getCharHeight(); if (newIndex <= _lastVisibleItem) { _currIndex = newIndex; refresh(); -- cgit v1.2.3 From ce3e765f5fde3696fd6a8f98f74027f88a060ebe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 2 Jul 2013 22:41:05 -0400 Subject: TSAGE: Fixes for moving south in R2R maze scene 3500 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 3 +++ engines/tsage/ringworld2/ringworld2_scenes3.cpp | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 3f062d0c6e..86014fb9c1 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1377,6 +1377,9 @@ void MazeUI::draw() { int ySize; Visage visage; + _cellsVisible.y = ((_mapOffset.y % _cellSize.y) + _displayBounds.height() + + (_cellSize.y - 1)) / _cellSize.y; + // Loop to handle the cell rows of the visible display area one at a time for (int yCtr = 0; yCtr < _cellsVisible.y; ++yCtr, yPos += ySize) { int cellY = _mapOffset.y / _cellSize.y + yCtr; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index b1cd4e7572..c49aca3f97 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3295,7 +3295,7 @@ int Scene3500::MazeUI3500::cellFromX(int x) { } int Scene3500::MazeUI3500::cellFromY(int y) { - return (_cellSize.y / 2) + y - (y % _cellSize.y); + return (_cellSize.y / 2) + y - (y % _cellSize.y) - 1; } int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { @@ -3976,7 +3976,8 @@ void Scene3500::dispatch() { var_6 = _mazeUI.cellFromY(newMazeY + 46) - 46; newMazeY = _mazePosition.y + _mazeChangeAmount; dx = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); - if (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (cellId == dx)) { + + if (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (cellId != dx)) { R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; _field1270 = 0; @@ -3984,7 +3985,7 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((cellId == 16) && (cellId == dx)) { + } else if ((cellId == 16) && (cellId != dx)) { newMazeY = var_6 - 3; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -3993,7 +3994,7 @@ void Scene3500::dispatch() { _field1272 = 0; if (_action1._field24 == 0) _actor8.hide(); - } else if ((cellId == 31) && (cellId == dx)) { + } else if ((cellId == 31) && (cellId != dx)) { newMazeY = var_6 + 4; R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4008,6 +4009,8 @@ void Scene3500::dispatch() { cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if ( (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (newMazeY >= var_6) && (_mazePosition.y <= var_6)) || (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (_mazeChangeAmount >= var_a) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ){ + newMazeY = var_6; + if ((cellId != 23) && (cellId != 24) && (cellId != 4) && (cellId != 14) && (cellId != 15)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; @@ -4153,7 +4156,7 @@ void Scene3500::dispatch() { ++_mazeChangeAmount; _field1272 = 1; } - _actor2.setFrame2(_mazeChangeAmount); + _actor2.setFrame2(_mazeChangeAmount + 1); } if (_field1272 == 1) { @@ -4169,7 +4172,7 @@ void Scene3500::dispatch() { _field1272--; if (_mazeChangeAmount != 0) { - R2_GLOBALS._player._uiEnabled = false; + R2_GLOBALS._player._uiEnabled = false; if (_mazeChangeAmount != _field1270) _aSound1.play(276); } else { -- cgit v1.2.3 From 0146b00148631a36cfe9b89a7edaf88a571946eb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 05:48:55 +0300 Subject: NEVERHOOD: Fix typo in variable name --- engines/neverhood/modules/module2700.cpp | 6 +++--- engines/neverhood/modules/module2700.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index 19655d128b..e9ea10bd16 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -83,7 +83,7 @@ static const uint32 kScene2725StaticSprites[] = { }; Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which) - : Module(vm, parentModule), _soundIndex(0), _raidoMusicInitialized(false) { + : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false) { _vm->_soundMan->addMusic(0x42212411, 0x04020210); _vm->_soundMan->startMusic(0x04020210, 24, 2); @@ -500,7 +500,7 @@ void Module2700::updateScene() { } else { switch (_sceneNum) { case 21: - if (!_raidoMusicInitialized) { + if (!_radioMusicInitialized) { _vm->_soundMan->stopMusic(0x04020210, 0, 1); _vm->gameModule()->initRadioPuzzle(); _musicFileHash = getGlobalVar(V_GOOD_RADIO_MUSIC_NAME); @@ -508,7 +508,7 @@ void Module2700::updateScene() { _vm->_soundMan->startMusic(_musicFileHash, 0, 2); _vm->_soundMan->addSound(0x42212411, 0x44014282); _vm->_soundMan->setSoundParams(0x44014282, true, 120, 360, 72, 0); - _raidoMusicInitialized = true; + _radioMusicInitialized = true; } break; } diff --git a/engines/neverhood/modules/module2700.h b/engines/neverhood/modules/module2700.h index 003666bb7f..158bb609e9 100644 --- a/engines/neverhood/modules/module2700.h +++ b/engines/neverhood/modules/module2700.h @@ -39,7 +39,7 @@ public: protected: int _sceneNum; int _soundIndex; - bool _raidoMusicInitialized; + bool _radioMusicInitialized; uint32 _scene2711StaticSprites[6]; uint32 _musicFileHash; void createScene(int sceneNum, int which); -- cgit v1.2.3 From e457fc2a268be4ef5e32a51ec58f15aeb476ec8a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 3 Jul 2013 05:49:25 +0300 Subject: NEVERHOOD: Add a new console command, "playsound" --- engines/neverhood/console.cpp | 19 +++++++++++++++++++ engines/neverhood/console.h | 1 + 2 files changed, 20 insertions(+) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index a4dd50ce4b..e676da3727 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -25,6 +25,7 @@ #include "neverhood/neverhood.h" #include "neverhood/gamemodule.h" #include "neverhood/scene.h" +#include "neverhood/sound.h" #include "neverhood/modules/module1600.h" namespace Neverhood { @@ -34,6 +35,7 @@ Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("dumpvars", WRAP_METHOD(Console, Cmd_Dumpvars)); DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces)); + DCmd_Register("playsound", WRAP_METHOD(Console, Cmd_PlaySound)); } Console::~Console() { @@ -169,4 +171,21 @@ bool Console::Cmd_Dumpvars(int argc, const char **argv) { return true; } +bool Console::Cmd_PlaySound(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: %s \n", argv[0]); + } else { + uint32 soundHash = strtol(argv[1], NULL, 0); + AudioResourceManSoundItem *soundItem = new AudioResourceManSoundItem(_vm, soundHash); + soundItem->setVolume(100); + soundItem->playSound(false); + while (soundItem->isPlaying()) { + _vm->_system->delayMillis(10); + } + delete soundItem; + } + + return true; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h index 40c11b50e3..62d65bd693 100644 --- a/engines/neverhood/console.h +++ b/engines/neverhood/console.h @@ -41,6 +41,7 @@ private: bool Cmd_Surfaces(int argc, const char **argv); bool Cmd_Cheat(int argc, const char **argv); bool Cmd_Dumpvars(int argc, const char **argv); + bool Cmd_PlaySound(int argc, const char **argv); }; } // End of namespace Neverhood -- cgit v1.2.3 From a116486b777c946f9f4f3181c6d8f155b49f8279 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 3 Jul 2013 07:33:32 +0200 Subject: TOOL: Remove obsolete comments in extract_mort --- devtools/extract_mort/extract_mort.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index 0d603f78cb..0164030769 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -121,35 +121,20 @@ int _version; #define BUFFER_SIZE 32768 const byte tabdrFr[32] = { - 32, 101, 115, 97, 114, 105, 110, // ' e♣arinutol + 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 byte tabdrDe[32] = { - 0x20, 0x65, 0x6E, 0x69, 0x73, 0x72, 0x74, // ' e♣arinutol - 0x68, 0x61, 0x75, 0x0D, 0x63, 0x6C, 0x64, - 0x6D, 0x6F, 0x67, 0x2E, 0x62, 0x66, 0x53, - 0x2C, 0x77, 0x45, 0x7A, 0x6B, 0x44, 0x76, - 0x9C, 0x47, 0x1E, 0x1F -}; - const byte tab30Fr[32] = { - 69, 67, 74, 138, 133, 120, 77, 122, //ECJèà¶M + 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 byte tab30De[32] = { - 0x49, 0x4D, 0x21, 0x42, 0x4C, 0x70, 0x41, 0x52, //ECJèà¶M - 0x57, 0x4E, 0x48, 0x3F, 0x46, 0x50, 0x55, 0x4B, - 0x5A, 0x4A, 0x54, 0x31, 0x4F, 0x56, 0x79, 0x3A, - 0x6A, 0x5B, 0x5D, 0x40, 0x22, 0x2F, 0x30, 0x35 -}; - const byte tab31Fr[32]= { 93, 47, 48, 53, 50, 70, 124, 75, 72, 147, 140, 150, 151, 57, 56, 51, @@ -157,6 +142,21 @@ const byte tab31Fr[32]= { 119, 0, 0, 0, 0, 0, 0, 0 }; +const byte tabdrDe[32] = { + 0x20, 0x65, 0x6E, 0x69, 0x73, 0x72, 0x74, + 0x68, 0x61, 0x75, 0x0D, 0x63, 0x6C, 0x64, + 0x6D, 0x6F, 0x67, 0x2E, 0x62, 0x66, 0x53, + 0x2C, 0x77, 0x45, 0x7A, 0x6B, 0x44, 0x76, + 0x9C, 0x47, 0x1E, 0x1F +}; + +const byte tab30De[32] = { + 0x49, 0x4D, 0x21, 0x42, 0x4C, 0x70, 0x41, 0x52, + 0x57, 0x4E, 0x48, 0x3F, 0x46, 0x50, 0x55, 0x4B, + 0x5A, 0x4A, 0x54, 0x31, 0x4F, 0x56, 0x79, 0x3A, + 0x6A, 0x5B, 0x5D, 0x40, 0x22, 0x2F, 0x30, 0x35 +}; + const byte tab31De[32]= { 0x78, 0x2D, 0x32, 0x82, 0x43, 0x39, 0x33, 0x38, 0x7C, 0x27, 0x37, 0x3B, 0x25, 0x28, 0x29, 0x36, -- cgit v1.2.3 From cabe0ed33d64cee1b8bec5be143733e655c9ab3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 3 Jul 2013 07:59:25 +0200 Subject: MORTEVIELLE: Fix text decryption in German version --- engines/mortevielle/utils.cpp | 60 +++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 8c2d375359..fcf55cbfeb 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1798,7 +1798,7 @@ void MortevielleEngine::decodeNumber(byte *pStart, int count) { } } -const byte tabdr[32] = { +const byte tabdrFr[32] = { 32, 101, 115, 97, 114, 105, 110, 117, 116, 111, 108, 13, 100, 99, 112, 109, 46, 118, 130, 39, 102, @@ -1806,20 +1806,45 @@ const byte tabdr[32] = { 85, 106, 30, 31 }; -const byte tab30[32] = { +const byte tab30Fr[32] = { 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 byte tab31[32]= { +const byte tab31Fr[32]= { 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 }; +const byte tabdrDe[32] = { + 0x20, 0x65, 0x6E, 0x69, 0x73, 0x72, 0x74, + 0x68, 0x61, 0x75, 0x0D, 0x63, 0x6C, 0x64, + 0x6D, 0x6F, 0x67, 0x2E, 0x62, 0x66, 0x53, + 0x2C, 0x77, 0x45, 0x7A, 0x6B, 0x44, 0x76, + 0x9C, 0x47, 0x1E, 0x1F +}; + +const byte tab30De[32] = { + 0x49, 0x4D, 0x21, 0x42, 0x4C, 0x70, 0x41, 0x52, + 0x57, 0x4E, 0x48, 0x3F, 0x46, 0x50, 0x55, 0x4B, + 0x5A, 0x4A, 0x54, 0x31, 0x4F, 0x56, 0x79, 0x3A, + 0x6A, 0x5B, 0x5D, 0x40, 0x22, 0x2F, 0x30, 0x35 +}; + +const byte tab31De[32]= { + 0x78, 0x2D, 0x32, 0x82, 0x43, 0x39, 0x33, 0x38, + 0x7C, 0x27, 0x37, 0x3B, 0x25, 0x28, 0x29, 0x36, + 0x51, 0x59, 0x71, 0x81, 0x87, 0x88, 0x93, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +const byte *tabdr, *tab30, *tab31; +uint16 ctrlChar; + void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { uint16 oct, ocd; @@ -1836,13 +1861,10 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { oct = (uint)oct >> pt; } - switch (oct) { - case 11: + if (oct == ctrlChar) { c = '$'; the_end = true; - break; - case 30: - case 31: + } else if (oct == 30 || oct == 31) { ocd = _inpBuffer[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { @@ -1864,10 +1886,8 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { the_end = true; c = '#'; } - break; - default: + } else { c = chr(tabdr[oct]); - break; } } @@ -2081,11 +2101,19 @@ void MortevielleEngine::loadTexts() { return; } } - if (!ntpFile.open("TXX.NTP")) { - if (!ntpFile.open("TXX.IND")) { - warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); - return; - } + if (ntpFile.open("TXX.NTP")) { + tab30 = tab30Fr; + tab31 = tab31Fr; + tabdr = tabdrFr; + ctrlChar = 11; + } else if (ntpFile.open("TXX.IND")) { + tab30 = tab30De; + tab31 = tab31De; + tabdr = tabdrDe; + ctrlChar = 10; + } else { + warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); + return; } if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { -- cgit v1.2.3 From dd8b8a8dd274af396d414b581c5b94fa5354c76b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 3 Jul 2013 08:30:04 +0200 Subject: MORTEVIELLE: Some renaming in Utils --- engines/mortevielle/utils.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index fcf55cbfeb..9b140fc761 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1798,7 +1798,7 @@ void MortevielleEngine::decodeNumber(byte *pStart, int count) { } } -const byte tabdrFr[32] = { +const byte cryptoArrDefaultFr[32] = { 32, 101, 115, 97, 114, 105, 110, 117, 116, 111, 108, 13, 100, 99, 112, 109, 46, 118, 130, 39, 102, @@ -1806,21 +1806,21 @@ const byte tabdrFr[32] = { 85, 106, 30, 31 }; -const byte tab30Fr[32] = { +const byte cryptoArr30Fr[32] = { 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 byte tab31Fr[32]= { +const byte cryptoArr31Fr[32]= { 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 }; -const byte tabdrDe[32] = { +const byte cryptoArrDefaultDe[32] = { 0x20, 0x65, 0x6E, 0x69, 0x73, 0x72, 0x74, 0x68, 0x61, 0x75, 0x0D, 0x63, 0x6C, 0x64, 0x6D, 0x6F, 0x67, 0x2E, 0x62, 0x66, 0x53, @@ -1828,21 +1828,21 @@ const byte tabdrDe[32] = { 0x9C, 0x47, 0x1E, 0x1F }; -const byte tab30De[32] = { +const byte cryptoArr30De[32] = { 0x49, 0x4D, 0x21, 0x42, 0x4C, 0x70, 0x41, 0x52, 0x57, 0x4E, 0x48, 0x3F, 0x46, 0x50, 0x55, 0x4B, 0x5A, 0x4A, 0x54, 0x31, 0x4F, 0x56, 0x79, 0x3A, 0x6A, 0x5B, 0x5D, 0x40, 0x22, 0x2F, 0x30, 0x35 }; -const byte tab31De[32]= { +const byte cryptoArr31De[32]= { 0x78, 0x2D, 0x32, 0x82, 0x43, 0x39, 0x33, 0x38, 0x7C, 0x27, 0x37, 0x3B, 0x25, 0x28, 0x29, 0x36, 0x51, 0x59, 0x71, 0x81, 0x87, 0x88, 0x93, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const byte *tabdr, *tab30, *tab31; +const byte *cryptoArrDefault, *cryptoArr30, *cryptoArr31; uint16 ctrlChar; void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { @@ -1878,16 +1878,16 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { } if (oct == 30) - c = chr(tab30[ocd]); + c = chr(cryptoArr30[ocd]); else - c = chr(tab31[ocd]); + c = chr(cryptoArr31[ocd]); if (c == '\0') { the_end = true; c = '#'; } } else { - c = chr(tabdr[oct]); + c = chr(cryptoArrDefault[oct]); } } @@ -2102,14 +2102,14 @@ void MortevielleEngine::loadTexts() { } } if (ntpFile.open("TXX.NTP")) { - tab30 = tab30Fr; - tab31 = tab31Fr; - tabdr = tabdrFr; + cryptoArr30 = cryptoArr30Fr; + cryptoArr31 = cryptoArr31Fr; + cryptoArrDefault = cryptoArrDefaultFr; ctrlChar = 11; } else if (ntpFile.open("TXX.IND")) { - tab30 = tab30De; - tab31 = tab31De; - tabdr = tabdrDe; + cryptoArr30 = cryptoArr30De; + cryptoArr31 = cryptoArr31De; + cryptoArrDefault = cryptoArrDefaultDe; ctrlChar = 10; } else { warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); -- cgit v1.2.3 From 97d8f768c2a32de7ea90300ce583068f6bc80a17 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 3 Jul 2013 08:12:30 -0400 Subject: TSAGE: Renaming maze Ui field in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 41 +++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index fc794873d4..85a6095807 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1131,12 +1131,12 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.hide(); - _object1.setDisplayBounds(Rect(110, 20, 210, 120)); + _mazeUI.setDisplayBounds(Rect(110, 20, 210, 120)); - _object1.load(1); - _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _mazeUI.load(1); + _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.draw(); + _mazeUI.draw(); warning("set_pane_p(unk);"); R2_GLOBALS._player.enableControl(); @@ -1393,8 +1393,8 @@ void Scene1200::process(Event &event) { return; if (event.eventType == EVENT_BUTTON_DOWN) { - _object1.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); - int unk = _object1.getCellFromPixelXY(event.mousePos); + _mazeUI.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + int unk = _mazeUI.getCellFromPixelXY(event.mousePos); switch (R2_GLOBALS._events.getCursor()) { case CURSOR_ARROW: event.handled = true; @@ -1541,13 +1541,14 @@ void Scene1200::dispatch() { Rect tmpRect; Scene::dispatch(); if (_field41C != 0) { - _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - warning("int unk = set_pane_p(_paneNumber);"); - _object1.draw(); + _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _mazeUI.draw(); + warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); _field41C = 0; } + _mazeUI.draw(); //**DEBUG** if (_field414 != 0) { tmpRect.set(110, 20, 210, 120); @@ -1568,9 +1569,9 @@ void Scene1200::dispatch() { default: break; } - _object1.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); + _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); - _object1.draw(); + _mazeUI.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); @@ -1606,11 +1607,11 @@ void Scene1200::saveCharacter(int characterIndex) { } void Scene1200::sub9DAD6(int indx) { - _object1.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + _mazeUI.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); switch (indx) { case 0: - if ( ((_object1.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(200, 88)) > 36)) + if ( ((_mazeUI.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(200, 88)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) @@ -1619,7 +1620,7 @@ void Scene1200::sub9DAD6(int indx) { R2_GLOBALS._player.disableControl(); _sceneMode = 1200; setAction(&_sequenceManager, this, 1200, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(200, 69)) == 36) { + } else if (_mazeUI.getCellFromPixelXY(Common::Point(200, 69)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3155) @@ -1654,7 +1655,7 @@ void Scene1200::sub9DAD6(int indx) { } break; case 1: - if ( ((_object1.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_object1.getCellFromPixelXY(Common::Point(120, 88)) > 36)) + if ( ((_mazeUI.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(120, 88)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) @@ -1663,7 +1664,7 @@ void Scene1200::sub9DAD6(int indx) { R2_GLOBALS._player.disableControl(); _sceneMode = 1201; setAction(&_sequenceManager, this, 1201, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(120, 69)) == 36) { + } else if (_mazeUI.getCellFromPixelXY(Common::Point(120, 69)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) @@ -1698,14 +1699,14 @@ void Scene1200::sub9DAD6(int indx) { } break; case 2: - if ( ((_object1.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 110)) > 36)) + if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 110)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1203; setAction(&_sequenceManager, this, 1203, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(160, 110)) == 36) { + } else if (_mazeUI.getCellFromPixelXY(Common::Point(160, 110)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) @@ -1740,14 +1741,14 @@ void Scene1200::sub9DAD6(int indx) { } break; case 3: - if ( ((_object1.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_object1.getCellFromPixelXY(Common::Point(178, 30)) > 36)) + if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 30)) > 36)) && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1202; setAction(&_sequenceManager, this, 1202, &_actor1, NULL); - } else if (_object1.getCellFromPixelXY(Common::Point(160, 30)) == 36) { + } else if (_mazeUI.getCellFromPixelXY(Common::Point(160, 30)) == 36) { switch (_field412 - 1) { case 0: if (R2_GLOBALS._player._visage == 3156) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index d1e55ef12b..619e692f89 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -147,7 +147,7 @@ public: NamedHotspot _item1; SceneActor _actor1; Area1 _area1; - MazeUI _object1; + MazeUI _mazeUI; SequenceManager _sequenceManager; int _field412; -- cgit v1.2.3 From 83f705583681c6157e8ba33d9dd542f434dcb94b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 4 Jul 2013 01:20:13 +0200 Subject: CONFIGURE: Remove POSIXisms in configure. This allows configure to work fine on Solaris 10 again. This fixes bug #3614513 "A few posixisms have crept into configure (w/ patch)". Thanks to lblume for his patch. --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index dbd78d3f9d..91118bd88f 100755 --- a/configure +++ b/configure @@ -2176,7 +2176,7 @@ case $_host_os in # When not cross-compiling, enable large file support, but don't # care if getconf doesn't exist or doesn't recognize LFS_CFLAGS. if test -z "$_host"; then - CXXFLAGS="$CXXFLAGS $(getconf LFS_CFLAGS 2>/dev/null)" + CXXFLAGS="$CXXFLAGS `getconf LFS_CFLAGS 2>/dev/null`" fi ;; maemo) @@ -3563,8 +3563,8 @@ if test "$_libunity" = auto ; then ;; *) # Unity has a lots of dependencies, update the libs and cflags var with them - LIBUNITY_LIBS="$LIBUNITY_LIBS $(pkg-config --libs unity = 3.8.4 2>> "$TMPLOG")" - LIBUNITY_CFLAGS="$LIBUNITY_CFLAGS $(pkg-config --cflags unity = 3.8.4 2>> "$TMPLOG")" + LIBUNITY_LIBS="$LIBUNITY_LIBS `pkg-config --libs unity = 3.8.4 2>> "$TMPLOG"`" + LIBUNITY_CFLAGS="$LIBUNITY_CFLAGS `pkg-config --cflags unity = 3.8.4 2>> "$TMPLOG"`" _libunity=no cat > $TMPC << EOF #include -- cgit v1.2.3 From 86c656a75ba7a6766d1886fb723f8727de4e68a7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 4 Jul 2013 01:23:06 +0200 Subject: SDL: Fix compilation on Solaris 10. This replaces a dummy FILE definition before including the SDL headers with simply using the toolchain's definition on Solaris. This is pretty harmless because we only allow FILE to be used in the SDL headers by this. Fixes bug #3614514 "#define FILE FAKE_FILE doesn't work on Solaris (w/ patch)". Thanks to lblume for his patch! --- backends/platform/sdl/sdl-sys.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h index ca3c586e03..eccf73815d 100644 --- a/backends/platform/sdl/sdl-sys.h +++ b/backends/platform/sdl/sdl-sys.h @@ -35,8 +35,11 @@ // it with an alternate slightly less unfriendly override. #if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE) #undef FILE +// Solaris has typedef __FILE FILE in several places already +#if !defined(__sun) typedef struct { int FAKE; } FAKE_FILE; #define FILE FAKE_FILE +#endif // (__sun) #endif #if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp) -- cgit v1.2.3 From f355d7bfbdc74e23e65b79f34fae2781832b6d0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 3 Jul 2013 22:17:01 -0400 Subject: TSAGE: Bugfix for leaving R2R scene 3500 --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index c49aca3f97..648f82317e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2885,7 +2885,7 @@ void Scene3400::signal() { } /*-------------------------------------------------------------------------- - * Scene 3500 - + * Scene 3500 - Cavern Maze * *--------------------------------------------------------------------------*/ @@ -3586,8 +3586,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _field1272 = 1; _field1270 = 4; _mazeChangeAmount = 4; - _mazePosition.x = 860; - _mazePosition.y = 891; + _mazePosition = Common::Point(860, 891); _rotation = R2_GLOBALS._scenePalette.addRotation(240, 254, -1); _rotation->setDelay(0); _rotation->_idxChange = 1; @@ -3690,7 +3689,6 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { } void Scene3500::remove() { - _rotation->remove(); R2_GLOBALS._sound2.fadeOut2(NULL); SceneExt::remove(); } -- cgit v1.2.3 From a49a7d5ad4f4435ed8cee0934c94155586f2dd99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 3 Jul 2013 22:47:15 -0400 Subject: TSAGE: Fix for moving east in R2R maze scene 3500 --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 648f82317e..d5e7b1b9c1 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3929,7 +3929,7 @@ void Scene3500::dispatch() { } else { var_4 = _mazeUI.cellFromX(newMazeX + 70) - 70; var_8 = abs(newMazeX - var_4); - cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, cellId + 46)); + cellId = _mazeUI.getCellFromMapXY(Common::Point(newMazeX + 70, newMazeY + 46)); if ( (((cellId == 26) || (cellId == 24) || (cellId == 15)) && (newMazeX >= var_4) && (_mazePosition.x <= var_4)) || (((cellId == 25) || (cellId == 23) || (cellId == 14) || (cellId == 5) || (cellId == 4)) && (_mazeChangeAmount >= var_8) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ) { newMazeX = var_4; -- cgit v1.2.3 From 2b980e86e3db2ebc2279761ba29c0be4f24e03dc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 4 Jul 2013 13:28:41 +0300 Subject: NEVERHOOD: Move the TODO into our wiki It can now be found at http://wiki.scummvm.org/index.php/Neverhood/TODO --- engines/neverhood/todo.txt | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 engines/neverhood/todo.txt diff --git a/engines/neverhood/todo.txt b/engines/neverhood/todo.txt deleted file mode 100644 index 9d781e06ec..0000000000 --- a/engines/neverhood/todo.txt +++ /dev/null @@ -1,45 +0,0 @@ -NOTE: -------- -Some of the TODOs should be done AFTER the whole game logic is implemented -else the game disasm and reimplemtation code become even more different -(unless I decide it's ok to do it :) - -TODOs which can be done any time: ------------------------------------ -- Cleanup -- Clean up staticdata structs to look more like the ones in create_neverhood - (e.g. by using template classes etc.) - - Or use a common base class and manage all stuff in one single table and cast stuff accordingly - -TODOs which should be done only after the game logic is finished: -------------------------------------------------------------------- -- Maybe rework organization of files (e.g. put ALL Sprites into one separate file, same with Modules and Scenes) - - This would solve the problem of how to organize stuff which is used several times, and less headers would have to be included - - The move special scenes (SmackerScene) into the scenes file - -DONE: -------- -- Implement game menus -- Rework sound system (I don't like that SoundResources need to be explicitly initialized in Scene constructors) - - Should be just a handle object which initializes itself - - Play routine should fill the handle so it can be stopped/queried later - - Basically like ScummVM own sound handles -- RE and implement yet unknown music/sound stuff -- Implement clever sprite redrawing code (dirty rectangles, microtiles etc.), only redraw what's neccessary -- Rework the resource system - - The current system can be simplified a lot - - Also resource purging needs to be implemented -- Maybe merge CollisionMan with Scene (since it's so far never used independently) -- Give placeholder stuff (e.g. sub?????, _flag??? etc.) better fitting names -- Use CursorMan for the mouse cursor (instead of using it like a normal sprite) - - This whould make it neccessary to call _system->updateScreen more often else - the mouse movement would be choppy - -TODOs which are experimental: -------------------------------- -NOTE: Since they affect the whole game, they really should be only implemented once the full game logic is implemented. -These are nothing more than wild ideas for now, any might never be implemented. -- Use states instead of separate callback methods -- Try to move more stuff to neverhood.dat -- Try to use more template functions instead of manually creating functions - (Can be coupled with the above to move parameters to the dat and only use IDs) -- cgit v1.2.3 From fa61a35acd2cafbf2a0e2752dd15bbcbb9b55463 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 3 Jun 2013 02:24:01 +0200 Subject: CONFIGURE: Remove superflous (and broken) command for eventrec. --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index 08eba6595c..c93f06e63e 100755 --- a/configure +++ b/configure @@ -3819,7 +3819,6 @@ define_in_config_if_yes $_nasm 'USE_NASM' define_in_config_if_yes $_vkeybd 'ENABLE_VKEYBD' define_in_config_if_yes $_keymapper 'ENABLE_KEYMAPPER' define_in_config_if_yes $_eventrec 'ENABLE_EVENTRECORDER' -add_line_to_config_mk_if_yes $_eventrec "ENABLE_EVENTRECORDER = 1" # Check whether to build translation support # -- cgit v1.2.3 From 93fc2608859c9cb64f291eeacb766c53d4b55323 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 3 Jun 2013 02:25:22 +0200 Subject: SDL: Fix compilation by moving getMixerManager out of USE_OPENGL guard. --- backends/platform/sdl/sdl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 77e6f73d48..f55dd277c7 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -501,6 +501,10 @@ SdlMixerManager *OSystem_SDL::getMixerManager() { return g_eventRec.getMixerManager(); } +Common::TimerManager *OSystem_SDL::getTimerManager() { + return g_eventRec.getTimerManager(); +} + #ifdef USE_OPENGL const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const { @@ -656,8 +660,4 @@ void OSystem_SDL::setupGraphicsModes() { } } -Common::TimerManager *OSystem_SDL::getTimerManager() { - return g_eventRec.getTimerManager(); -} - #endif -- cgit v1.2.3 From b286a6d033287dce11dfa4216ad11728b892667d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 4 Jul 2013 14:54:56 +0300 Subject: RECORDER: Fix guard ifdef --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index e174a6e807..f66f43e8bf 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -768,7 +768,7 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { } -#ifdef ENABLE_KEYMAPPER +#ifdef ENABLE_EVENTRECORDER _displayDisabled = ConfMan.getBool("disable_display"); if (_displayDisabled) { -- cgit v1.2.3 From baafae672f3489b0eaf77c22be0c65ba31e6b73d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 4 Jul 2013 15:23:56 +0300 Subject: RECORDER: Fix crash at startup --- gui/themes/scummmodern.zip | Bin 1485585 -> 1485763 bytes gui/themes/scummmodern/scummmodern_layout.stx | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index 3925c67121..0f10003e94 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 4fd6ae6eba..b760e15919 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -114,7 +114,7 @@ size = '60, 25' /> -- cgit v1.2.3 From d7ff665737b3144b00d4808043402e1317ee234c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 4 Jul 2013 14:44:41 +0200 Subject: AUDIO: Fix ReportHandlerScummVM::printDebug in MT32 code. Formerly it tried to pass 'va_list' as '...' to debug. Now it's first creating a String containing the output via String::vformat and then passing it to debug. Found by buildbot (master-dc). The warning message was: audio/softsynth/mt32.cpp:65: warning: cannot pass objects of non-POD type `struct va_list' through `...'; call will abort at runtime --- audio/softsynth/mt32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 00d0469356..3281e3bebf 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -62,7 +62,8 @@ protected: // Callback for debug messages, in vprintf() format void printDebug(const char *fmt, va_list list) { - debug(4, fmt, list); + Common::String out = Common::String::vformat(fmt, list); + debug(4, out.c_str()); } // Callbacks for reporting various errors and information -- cgit v1.2.3 From 8d6aa77769d2d914fc05464435d6558b734bd4c1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 4 Jul 2013 15:41:01 +0200 Subject: GUI: Cleanup EventRecorder::getSurface. Formerly the function created a SDL_Surface by hand. Instead now it uses SDL_CreateRGBSurface (which is used in the SDL backend anyway and yields the same results). This should fix PS3 port compilation. --- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 7 +--- gui/EventRecorder.cpp | 38 ++-------------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index f66f43e8bf..1ebd019488 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -878,12 +878,7 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() { } if (_hwscreen) { - if (_displayDisabled) { - delete _hwscreen; - } else { - SDL_FreeSurface(_hwscreen); - } - + SDL_FreeSurface(_hwscreen); _hwscreen = NULL; } diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 94b955cb22..47358a0b3d 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -599,42 +599,8 @@ void EventRecorder::setFileHeader() { } SDL_Surface *EventRecorder::getSurface(int width, int height) { - SDL_Surface *surface = new SDL_Surface(); - surface->format = new SDL_PixelFormat(); - surface->flags = 0; - surface->format->palette = NULL; - surface->format->BitsPerPixel = 16; - surface->format->BytesPerPixel = 2; - surface->format->Rloss = 3; - surface->format->Gloss = 2; - surface->format->Bloss = 3; - surface->format->Aloss = 8; - surface->format->Rshift = 11; - surface->format->Gshift = 5; - surface->format->Bshift = 0; - surface->format->Ashift = 0; - surface->format->Rmask = 63488; - surface->format->Gmask = 2016; - surface->format->Bmask = 31; - surface->format->Amask = 0; - surface->format->colorkey = 0; - surface->format->alpha = 255; - surface->w = width; - surface->h = height; - surface->pitch = width * 2; - surface->pixels = (char *)malloc(surface->pitch * surface->h); - surface->offset = 0; - surface->hwdata = NULL; - surface->clip_rect.x = 0; - surface->clip_rect.y = 0; - surface->clip_rect.w = width; - surface->clip_rect.h = height; - surface->unused1 = 0; - surface->locked = 0; - surface->map = NULL; - surface->format_version = 4; - surface->refcount = 1; - return surface; + // Create a RGB565 surface of the requested dimensions. + return SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 16, 0xF800, 0x07E0, 0x001F, 0x0000); } bool EventRecorder::switchMode() { -- cgit v1.2.3 From d089658fb84f67652e9569bc03c76bcc65e7b881 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Jul 2013 12:06:22 -0400 Subject: CREATE_PROJECT: Fix compilation for Visual Studio now the built-in theme is more than 64kb --- devtools/create_project/msbuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index dd9917e4ee..6af9323fcd 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -384,7 +384,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b if (isRelease) { properties << "\t\t\ttrue\n" "\t\t\ttrue\n" - "\t\t\tWIN32;RELEASE_BUILD;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tfalse\n" "\t\t\t\n" @@ -396,7 +396,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\ttrue\n"; } else { properties << "\t\t\tDisabled\n" - "\t\t\tWIN32;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tEnableFastChecks\n" "\t\t\tMultiThreadedDebug\n" -- cgit v1.2.3 From 7c23eb7c44ee41ddb466d096c4863701004f5fae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 4 Jul 2013 23:25:26 +0200 Subject: MORTEVIELLE: Add German translation in the DAT file --- devtools/create_mortdat/create_mortdat.h | 3 +- devtools/create_mortdat/gametext.h | 1170 +++++++++++++++--------------- dists/engine-data/mort.dat | Bin 77889 -> 75663 bytes 3 files changed, 587 insertions(+), 586 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h index 0aa6b529df..908cb61951 100644 --- a/devtools/create_mortdat/create_mortdat.h +++ b/devtools/create_mortdat/create_mortdat.h @@ -33,7 +33,8 @@ enum AccessMode { enum DataType { kStaticStrings = 0, - kGameStrings = 1 + kGameStrings = 1, + kEncryptionArrays = 2 }; #define MORT_DAT "mort.dat" diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index ebaa422f2c..6e43258e88 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -1204,591 +1204,591 @@ const char *gameDataFr[] = { }; const char *gameDataDe[] = { - "TBT - Calm within the storm$", - "TBT - Discussed in colours$", - "TBT - Your mauve!$", - "TBT - Be kind enough to leave the room...$", - "TBT - If you're NOT overdrawn...$", - "TBT - If you're feeling blue...$", - "TBT - Read what's on the walls?$", - "TBT - Water sports$", - "TBT - Room for envy?$", - "TBT - A glance at the forbidden$", - "TBT - Smell of a woodfire and tobacco$", - "TBT - Tobacco and old books$", - "TBT - Onions, cinnamon and spirits$", - "TBT - A place seldom visited$", - "TBT - Humidity and decay$", - "TBT - Sorry, no ""door to door""$", - "TBT - Rotting corpse: deady cryptomania$", - "TBT - And what's more, there are disused traps$", - "TBT - It's already open$", - "TBT - Danger: avalanches$", - "TBT - Proper Charlie's place?$", - "TBT - An imposing building$", - "TBT - The other side of the mystery$", - "TBT - Strange horoscope$", - "TBT - Look out... but she wishes well?$", - "TBT - An oak door$", - "TBT - A photograph$", - "TBT - The coat of arms$", - "TBT - $", - "TBT - Max, the servant, welcomes you and shows you to your room$", - "TBT - Mortville 6/2/51@ My dear Jerome@Regarding my telegram, I must tell you the reason for my wor-@ries. A year ago, Murielle, my lady companion, disappeared. The de@part may have had something to do@with the financial success of themanor, or... A silence hard to un@derstand for my son Guy. Not ha@ving been able to see the light of day over this affair, I count @on you to sort things out. If my state of health doesn't improve, @take the decisions that you feel @are apropriate.@ Kind regards, Julia DEFRANCK$", - "TBT - Later, Guy will inform you of Leo's suicide after a@heavy bet at the races$", - "TBT - F3: AGAIN F8: STOP$", - "TBT - The master of the premises$", - "TBT - The future heir$", - "TBT - JULIA's son$", - "TBT - A pretty picture$", - "TBT - Superman!$", - "TBT - Ida's husband$", - "TBT - Interesting remarks?$", - "TBT - Service included!$", - "TBT - Nothing underneath$", - "TBT - You could hear a pin drop$", - "TBT - Half an hour passes: nothing! Wait any longer?$", - "TBT - Admire! Contemplate!$", - "TBT - No! Nothing!$", - "TBT - Impossible$", - "TBT - That stains!$", - "TBT - A treatise on the history of the area$", - "TBT - A few coins...$", - "TBT - First commandment...$", - "TBT - Pleasing to the nostrils!$", - "TBT - Spades, Hearts...$", - "TBT - Just a spoonful of sugar...$", - "TBT - A romantic novel$", - "TBT - Worth more than a penny, (whistle)$", - "TBT - Just needs a little patience$", - "TBT - Watch the sharp bends$", - "TBT - Deep and dark$", - "TBT - Normal sensations$", - "TBT - Sniff!$", - "TBT - Not discreet! Be content to watch!$", - "TBT - Bless you! Dusty!$", - "TBT - The canvas is signed, the wallpaper is not!$", - "TBT - Nothing, Unlucky!$", - "TBT - Be more discreet!$", - "TBT - The shutters are closed$", - "TBT - Snow! And more snow!$", - "TBT - Brilliant! The work of a master!$", - "TBT - No doubt at all! A genuine fake!$", - "TBT - Hmm! A cheap reproduction!$", - "TBT - A rare and valuable piece$", - "TBT - Nothing special$", - "TBT - Linen, personal belongings...$", - "TBT - Not just anywhere!$", - "TBT - It's not time!$", - "TBT - One doesn't speak with ones mouth full! So once the meal is over...$", - "TBT - Someone comes in, messes about then goes out again$", - "TBT - Someone's approaching your hiding-place$", - "TBT - Someone surprises you!$", - "TBT - Impossible! You're too loaded!$", - "TBT - Try again!$", - "TBT - Still puzzled!?$", - "TBT - You leave Mortville.In Paris a message awaits you...$", - "TBT - You hurt yourself$", - "TBT - Nothing more here$", - "TBT - The sound seems normal$", - "TBT - It doesn't move$", - "TBT - You are answered$", - "TBT - Not the right moment!$", - "TBT - The same matter, from another angle!$", - "TBT - The reflection is tarnished, but the frame is gold!$", - "TBT - Bric-a-brac$", - "TBT - Facing failure!$", - "TBT - Smells like something you'd rather not see!$", - "TBT - Cleaning products$", - "TBT - Got an itch?$", - "TBT - It's stuck, frozen. Brrr!$", - "TBT - All the locks are jammed!$", - "TBT - Papers$", - "TBT - No! Father christmas hasn't got himself stuck!$", - "TBT - It leads onto a corridor$", - "TBT - China, silverware...$", - "TBT - No! It's not Julia's remains!$", - "TBT - An old engraving$", - "TBT - You find a deep diamond-shaped opening$", - "TBT - The wall slides open! A passage! Do you follow it?$", - "TBT - The passageway closes$", - "TBT - A secret drawer: a notebook! Do you read it?$", - "TBT - The drawer shuts$", - "TBT - Nothing! Flesh and blood stuck to the stone$", - "TBT - Certain details lead you to believe death was not immediate!$", - "TBT - A rotten affair!$", - "TBT - Did she cling to dear life with just one finger?$", - "TBT - Has the treasure packed its trunk?$", - "TBT - A slot the size of a coin$", - "TBT - Part of the stone wall pivots.A crypt! Do you enter?$", - "TBT - The ring turns, the wall closes$", - "TBT - A stone column behind the altar$", - "TBT - There is a noise!$", - "TBT - Occupied!$", - "TBT - Take another chance?$", - "TBT - Too deep!$", - "TBT - The cellar wall pivots$", - "TBT - Nothing$", - "TBT - The one and only!$", - "TBT - The object slides to the bottom$", - "TBT - You have nothing in hand$", - "TBT - It is not open$", - "TBT - There is already something$", - "TBT - The door is locked$", - "TBT - No reply$", - "TBT - A solid wooden ball$", - "TBT - There's no more space$", - "TBT - A wooden ball pierced through the side$", - "TBT - ? ?$", - "TBT - Your move$", - "TBT - OK !$", - "TBT - Suddenly Max arrives with your suitcase: \"Thank you for your @visit!\".Mister discreet \"private eye\" (in need of a private optici@an!). Thoroughly demoralised, you@leave the manor. You are useless!$", - "TBT - Leo interrupts: \"The storm has died down,I am going into town in@1 hour. Get ready\". You have lost@time...but not your life$", - "TBT - Congestion, the deadly flu... You@are stuck here! Your whole case@sinks slowly beneath the water$", - "TBT - The water is rising fast,freezing your last illusions. Before you@have time to react...you are dead$", - "TBT - As soon as you reach the bottom of the well, a hand cuts the rope@Farewell sweet life!$", - "TBT - The storm covers your footprints.A wall of silence falls heavily@on your shoulders. Slowly you succumb to frosbite...$", - "TBT - You're not completely alone! A cold blade plunges into your backup@In future, be more care!$", - "TBT - You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case,the family problems thatyou have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", - "TBT - $", - "TBT - You don't have the keys to the manor. Your cries rest unheard@You're going to catch... your death!$", - "TBT - With a circular movement, the sword slices across you. Guts and@intestines spill out all over. A sorry state of affairs!$", - "TBT - Home, Sweet home !$", - "TBT - The mystery behind a closed door$", - "TBT - Bewitching charm of these old rooms$", - "TBT - An empty stomach$", - "TBT - Closer to heaven? Not so sure$", - "TBT - Afraid of the dark?$", - "TBT - Old rugs and a glint of gold$", - "TBT - Anguish!$", - "TBT - Safe? Perhaps not!$", - "TBT - A little ill at ease, eh!?$", - "TBT - Always further$", - "TBT - Your way of the cross!$", - "TBT - On the trail of...$", - "TBT - Watch what's hiding$", - "TBT - The road down to hell$", - "TBT - Feeling well? You look a little pale$", - "TBT - What lurks behind...?$", - "TBT - Close-up on:$", - "TBT - You notice, amongst other things$", - "TBT - And...$", - "TBT - That's all!$", - "TBT - A bit of reading$", - "TBT - The adventure awaits, you set off!$", - "TBT - Don't mess up YOUR next ADVENTURE!$", - "TBT - I don't understand$", - "TBT - There is an easier way$", - "TBT - No, not just now$", - "TBT - Too late$", - "TBT - $", - "TBT - Like a deep stony stare, a solitary eye that points towards the@stars; the artery that links hea-ven and hell. You must fathom@these depths keeping hold of that@which is, and will become. Monday, Tuesday, Wednesday, Sunday, from@Monday 1st to Sunday 1st,plunging from one day to the next your@\"IS\" or \"WILL BECOME\". Carrying your burden with love and light,@the smallest oversight will seal your fate.$", - "TBT - 10/1/51: We think we've solved the mystery of the manuscript and@located the crypt. Is it the idea@of success in what seems like a dream that disturbs me so? I feel@I have committed myself rather too much, as far as Leo is concer@ned... No! I should go on. @I should have put Guy in the pic-ture but for a week now, I've had@no news of him$", - "TBT - Take your prayers as you would to the holy place. From the pillar@of wisdom, bring the sun to his@knees. Thus will it show you the place to offer alms of another@kind and like young Arthur, open the way of darkness.White is your@colour, golden your hearth. So@advance with caution Orpheus and light your way unto the sad@virgin. Offer her the circle of the man with three faces. That he@may regain the world and turn with it to its original@inglory!$", - "TBT - The mountains are the fangs in a monstrous mouth opening on the@finity of a celestial orgy, grin-ding the stars as we grind our@teeth into dust. You will drop your chord of stone at your feet.@The laugh of silence at the@highest pitch, and in your right hand, the measure of genius. Thus@will you pass between the two crescents beyond the abyss of the@wall of silence. The key to the melody is within your grasp. It@suffices to find the note that clashes.$", - "TBT - 9/12 INTER. 518 3/13 EXPENS. 23@ 9/12 SALES 1203 7/12 CHEQUE 1598@ TOTAL 1721 TOTAL 1721$", - "TBT - 5/1/51@@ Luc, my love@ Guy knows about us. After an argument I told him everything! I@think only of you. Max keeps pes-tering me, but it's finished with @him. He should stick to his pots and pans! When can you and I be alone together? For you I would@get a divorce.@I love you.@ Eva$", - "TBT - Mortville, 10/2/51@@ Pat@ I recall you owe me 50000 frs that I lent you for your business@I need that money, can you repay me quickly?@ Guy$", - "TBT - Mortville, 15/2/51@ Dear Sir@ I am writing to you on the sub-ject of our business deal. I have@decided to go all the way in the certainty that my partner, Pat@DEFRANCK, has been forging the accounts. @In spite of$", - "TBT - A pipe$", - "TBT - A pen$", - "TBT - A lighter$", - "TBT - A retort$", - "TBT - A shaving brush$", - "TBT - A tin of paint$", - "TBT - A flute$", - "TBT - An expensive ring$", - "TBT - A reel of thread$", - "TBT - An old book$", - "TBT - A wallet$", - "TBT - A dagger$", - "TBT - A pistol$", - "TBT - A bible$", - "TBT - A candle$", - "TBT - A jewellery box$", - "TBT - An iron$", - "TBT - A photo$", - "TBT - A pocket watch$", - "TBT - A rope$", - "TBT - Keys$", - "TBT - A pearl necklace$", - "TBT - A bottle of perfume$", - "TBT - Binoculars$", - "TBT - Glasses$", - "TBT - A leather purse$", - "TBT - A tennis ball$", - "TBT - Ammunition$", - "TBT - A cut-throat razor$", - "TBT - A hairbrush$", - "TBT - A clothes brush$", - "TBT - A pack of cards$", - "TBT - A shoe horn$", - "TBT - A screwdriver$", - "TBT - A hammer$", - "TBT - Keys$", - "TBT - Keys$", - "TBT - An ashtray$", - "TBT - A paintbrush$", - "TBT - A rope$", - "TBT - A wooden object$", - "TBT - Sleeping pills$", - "TBT - A gold ring$", - "TBT - A jewellery box$", - "TBT - An alarm clock$", - "TBT - A coat of armour$", - "TBT - A candlestick$", - "TBT - A pair of gloves$", - "TBT - A engraved goblet$", - "TBT - A parchment$", - "TBT - A dagger$", - "TBT - A dossier$", - "TBT - A parchment$", - "TBT - A parchment$", - "TBT - A dossier$", - "TBT - A dossier$", - "TBT - A letter$", - "TBT - A novel$", - "TBT - A wooden rod$", - "TBT - An envelope$", - "TBT - A letter$", - "TBT - An envelope$", - "TBT - Julia$", - "TBT - Julia's death$", - "TBT - Julia's relationships$", - "TBT - A message from Julia$", - "TBT - Julia's inheritance$", - "TBT - Julia's final actions$", - "TBT - Julia's gifts$", - "TBT - Julia's bedroom$", - "TBT - The photo at Julia's home$", - "TBT - Julia and yourself...$", - "TBT - L‚o's occupations$", - "TBT - Pat's occupations$", - "TBT - Guy's occupations$", - "TBT - Bob's occupations$", - "TBT - Eva's occupations$", - "TBT - Luc's occupations$", - "TBT - Ida's occupations$", - "TBT - Max's occupations$", - "TBT - Your occupations$", - "TBT - L‚o's relationships$", - "TBT - Pat's relationships$", - "TBT - Guy's relationships$", - "TBT - Bob's relationships$", - "TBT - Eva's relationships$", - "TBT - Luc's relationships$", - "TBT - Ida's relationships$", - "TBT - Max's relationships$", - "TBT - Your relationships$", - "TBT - Murielle$", - "TBT - Murielle's relationships$", - "TBT - Murielle and yourself...$", - "TBT - Murielle's disappearance$", - "TBT - The wall of silence$", - "TBT - The manuscripts$", - "TBT - The coat of arms$", - "TBT - Engravings in the cellar$", - "TBT - The well$", - "TBT - The secret passages$", - "TBT - The chapel$", - "TBT - The paintings$", - "TBT - The photo of the attic$", - "TBT - The body in the crypt$", - "TBT - $", - "TBT - $", - "TBT - END OF THE CONVERSATION$", - "TBT - Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "TBT - C'est le massif montagneux que l'on aper‡oit devant le manoir$", - "TBT - Je n'en sais rien !$", - "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", - "TBT - Madame DEFRANCK est morte d'un coup de froid$", - "TBT - Elle est morte d'une embolie pulmonaire$", - "TBT - Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", - "TBT - Ce sont toujours les meilleurs qui partent les premiers$", - "TBT - J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "TBT - C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "TBT - C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", - "TBT - Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir ...$", - "TBT - Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", - "TBT - C'est un homme dynamique qui a r‚ussi dans le parfum$", - "TBT - Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", - "TBT - J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", - "TBT - Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", - "TBT - Ce sont ses affaires ...$", - "TBT - Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "TBT - Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", - "TBT - Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", - "TBT - Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", - "TBT - Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", - "TBT - Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", - "TBT - Mais ! Vous n'avez pas encore d‚couvert son occupation principale ..?$", - "TBT - Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs . Elle est toujours trŠs bien habill‚e$", - "TBT - Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", - "TBT - Les bijoux ...$", - "TBT - Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "TBT - Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", - "TBT - Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "TBT - Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", - "TBT - Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "TBT - Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", - "TBT - Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "TBT - Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", - "TBT - Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", - "TBT - C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "TBT - Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", - "TBT - C'est un homme de caractŠre . Il faut savoir le prendre ..$", - "TBT - Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", - "TBT - Relations ? Relations amicales ? Relations financiŠres sans doute$", - "TBT - Moi je n'ai rien … lui reprocher$", - "TBT - C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", - "TBT - Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", - "TBT - A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", - "TBT - Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", - "TBT - Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", - "TBT - J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "TBT - Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", - "TBT - Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", - "TBT - Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", - "TBT - Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", - "TBT - C'est pour un rendez-vous ?$", - "TBT - Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", - "TBT - Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", - "TBT - La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", - "TBT - C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", - "TBT - Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", - "TBT - C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", - "TBT - Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", - "TBT - Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", - "TBT - C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "TBT - Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", - "TBT - C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", - "TBT - C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", - "TBT - Murielle a ‚t‚ la dame de compagnie de Julia$", - "TBT - Elle aussi, faisait des recherches ...$", - "TBT - C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", - "TBT - Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", - "TBT - Je crois que tout le monde l'aimait bien$", - "TBT - Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", - "TBT - A part L‚o, elle avait de trŠs bon rapport avec Max ...$", - "TBT - Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", - "TBT - A part sa famille, pas grand monde$", - "TBT - Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", - "TBT - Non rien !$", - "TBT - Non ... Pas que le sache$", - "TBT - J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", - "TBT - Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", - "TBT - Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", - "TBT - A part la lettre pour vous que j'ai post‚, rien de bien important !$", - "TBT - J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", - "TBT - Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", - "TBT - Son dernier pr‚sent m'a surpris$", - "TBT - Quel cadeau ?$", - "TBT - Un chandellier ...$", - "TBT - Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", - "TBT - Et bien oui ! Comme tout le monde, je crois$", - "TBT - Un poignard$", - "TBT - Je n'ai jamais ‚t‚ fouiller dans le grenier !$", - "TBT - Vous avez un don de double-vue ou un passe-partout$", - "TBT - Le portrait d'une jeune fille : C'est Murielle ...$", - "TBT - Vous savez, je la connaissais assez peu$", - "TBT - Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", - "TBT - C'est la seule femme vraiment interessante que j'ai rencontr‚$", - "TBT - Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", - "TBT - Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", - "TBT - Si la chambre est ferm‚e, demandez … L‚o$", - "TBT - J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", - "TBT - Vous savez ce que c'est : Des relations familiales$", - "TBT - Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", - "TBT - Je l'aimais autant qu'elle m'aimais, je crois$", - "TBT - De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", - "TBT - C'est sans doute la photo de Murielle avec le filleul de Julia$", - "TBT - Je ne me rappelle pas$", - "TBT - C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", - "TBT - Vous tes bien curieux !... C'est sans valeur$", - "TBT - Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", - "TBT - Dommage que la devise soit manquante ...$", - "TBT - C'est trŠs beau ... Et trŠs vieux ...$", - "TBT - Tiens ! C'est un endroit que je n'ai jamais visit‚$", - "TBT - D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", - "TBT - Mme par ce temps, vous avez d‚nich‚ un soleil ...$", - "TBT - Profond et inqui‚tant : Le progrŠs a du bon$", - "TBT - Ca reste pour moi le plus grand des mystŠres$", - "TBT - Les derniers temps elle parlait d'un voyage . Et puis ...$", - "TBT - Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", - "TBT - De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", - "TBT - Quoi ?! Quel corps ? Quel crypte ?$", - "TBT - Si il y en a, je ne les ai jamais trouv‚ ...$", - "TBT - Bien s–r ! ... Et des fant“mes aussi ...$", - "TBT - C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", - "TBT - Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", - "TBT - Julia aimait beaucoup la peinture$", - "TBT - Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", - "TBT - Que faites-vous l… ?$", - "TBT - Je suis s–r que vous cherchez quelque chose ici$", - "TBT - Je vous ‚coute$", - "TBT - Que d‚sirez-vous ?$", - "TBT - Oui ?$", - "TBT - Je suis … vous ...$", - "TBT - C'est pourquoi ?$", - "TBT - Allez-y$", - "TBT - C'est … quel sujet ?$", - "TBT - Max : … votre service, monsieur$", - "TBT - De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", - "TBT - Vous tes trop curieux !$", - "TBT - J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", - "TBT - En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", - "TBT - F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", - "TBT - Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", - "TBT - to the office$", - "TBT - to the kitchen$", - "TBT - to the cellar$", - "TBT - to the landing$", - "TBT - outside$", - "TBT - to the dining room$", - "TBT - inside the manor$", - "TBT - front of the manor$", - "TBT - to the chapel$", - "TBT - to the well$", - "TBT - north$", - "TBT - behind the manor$", - "TBT - south$", - "TBT - east$", - "TBT - west$", - "TBT - towards the manor$", - "TBT - further$", - "TBT - in the water$", - "TBT - out of the well$", - "TBT - in the well$", - "TBT - choice on screen$", - "TBT - In the MYSTERY series...$", - "TBT - MORTVILLE MANOR$", - "TBT - $", - "TBT - From an original idea of...$", - "TBT - Bernard GRELAUD and Bruno GOURIER$", - "TBT - $", - "TBT - Directed by: KYILKHOR CREATION and LANGLOIS$", - "TBT - $", - "TBT - With the cooperation of...$", - "TBT - B‚atrice et Jean_Luc LANGLOIS$", - "TBT - for the music and the voices,$", - "TBT - Bernard GRELAUD for the graphic conception,$", - "TBT - MARIA-DOLORES for the graphic direction,$", - "TBT - Bruno GOURIER for the technical direction,$", - "TBT - Mick ANDON for the translation. $", - "TBT - $", - "TBT - Publisher: KYILKHOR and B&JL LANGLOIS $", - "TBT - COPYRIGHT 1987: KYILKHOR and B&JL LANGLOIS$", - "TBT - $", - "TBT - YOUR MOVE$", - "TBT - attach$", - "TBT - wait$", - "TBT - force$", - "TBT - sleep$", - "TBT - listen$", - "TBT - enter$", - "TBT - close$", - "TBT - search$", - "TBT - knock$", - "TBT - scratch$", - "TBT - read$", - "TBT - eat$", - "TBT - place$", - "TBT - open$", - "TBT - take$", - "TBT - look$", - "TBT - smell$", - "TBT - sound$", - "TBT - leave$", - "TBT - lift$", - "TBT - turn$", - "TBT - hide yourself$", - "TBT - search$", - "TBT - read$", - "TBT - put$", - "TBT - look$", - "TBT - Leo$", - "TBT - Pat$", - "TBT - Guy$", - "TBT - Eva$", - "TBT - Bob$", - "TBT - Luc$", - "TBT - Ida$", - "TBT - Max$", - "TBT - JULIA...$", - "TBT - - Did she commit suicide?$", - "TBT - - Was she murdered?$", - "TBT - - Did she die by accident?$", - "TBT - - Did she die of natural causes?$", - "TBT - Where did the money used@for the restoration of the manor come from?$", - "TBT - - Blackmail$", - "TBT - - Honest work$", - "TBT - - Inheritance$", - "TBT - - Races$", - "TBT - - Rents$", - "TBT - - Hold-up$", - "TBT - - Other$", - "TBT - What is Leo's hobby?$", - "TBT - - Historical research$", - "TBT - - Politics$", - "TBT - - Painting$", - "TBT - - Drugs$", - "TBT - - Occult sciences$", - "TBT - - Management of a sect$", - "TBT - Julia left several clues that are@represented in one place. Which?$", - "TBT - - Chapel$", - "TBT - - Outside$", - "TBT - - Cellar$", - "TBT - - Attic$", - "TBT - - Kitchen$", - "TBT - - Dining room$", - "TBT - - Julia's room$", - "TBT - - Leo's room$", - "TBT - - Pat's room$", - "TBT - - Bob's room$", - "TBT - - Max's room$", - "TBT - - Luc/Ida's room$", - "TBT - - Guy/Eva's room$", - "TBT - The main clue that leads you@to the underground door is:$", - "TBT - - A dagger$", - "TBT - - A ring$", - "TBT - - A book$", - "TBT - - A parchment$", - "TBT - - A letter$", - "TBT - - A pendulum$", - "TBT - How many parchments were there in the manor?$", - "TBT - - 0$", - "TBT - - 1$", - "TBT - - 2$", - "TBT - - 3$", - "TBT - - 4$", - "TBT - - 5$", - "TBT - How many persons are involved in@this story?@(Julia included, but not yourself)$", - "TBT - - 9$", - "TBT - - 10$", - "TBT - - 11$", - "TBT - What was the first name@of the unknown character?$", - "TBT - - Mireille$", - "TBT - - Fran‡oise$", - "TBT - - Maguy$", - "TBT - - Emilie$", - "TBT - - Murielle$", - "TBT - - Sophie$", - "TBT - Wo did Murielle have an affair with?$", - "TBT - - Bob$", - "TBT - - Luc$", - "TBT - - Guy$", - "TBT - - Leo$", - "TBT - - Max$", - "TBT - Murielle shared an occupation@with one other person. Who?$", - "TBT - [1][You realize that certain elements of|this investigation remain a mystery for you.|Therefore, you decide first to learn|more before undertaking new risks..][ok]$", - "TBT - [3][ | insert disk 1 | in drive A ][ok]$", - "TBT - [1][ | Disk error | All stop... ][ok]$", - "TBT - [1][ | You should have noticed |00% of the clues ][ok]$", - "TBT - [3][ | insert disk 2 | in drive A ][ok]$", - "TBT - [1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", - "TBT - MASTER .$", - "TBT - rorL$", + "Ruhe vor dem Sturm$", + "Geschmacklose Farben$", + "Lila, der letzte Versuch$", + "Diesen Ort bitte sauberhalten...$", + "Beaengstigendes schwarzes Loch$", + "Der blaue Salon$", + "Das blutrote Zimmer$", + "Wassersport$", + "Der gruene Star$", + "Ein Auge aufs Verbotene werfen$", + "Geruch von Kaminfeuer und Tabak$", + "Tabak und alte Buecher$", + "Zwiebeln, Zimt und Spirituosen$", + "Ein wenig besuchter Ort$", + "Feuchtigkeit und Moder$", + "Hausieren verboten!$", + "Ein verwester Koerper: toedliche Kryptomanie!$", + "Da wird einem angst$", + "Es ist schon offen$", + "Achtung: Lawinen$", + "Ein Hauch von \"Heiligkeit\"$", + "Eine grosses eindrucksvolles Gemaeuer...$", + "Die Kehrseite des Geheimnisses!$", + "Ein merkwuerdiges Horoskop!$", + "Der Krug geht so lange...$", + "Eine Eichentuer$", + "Ein Foto$", + "Die Wappen$", + "$", + "Max, der Diener, empfaengt Sie und wird Sie dann in Ihr Zimmer begleiten$", + " Morteville 16/2/51@ Mein lieber Jer“me@Im Anschluss an mein Telegramm teile ich Ihnen die Gruende meiner Unruhe mit: vor 1 Jahr verschwand meine Gesellschafterin Murielle. Eventuell hat das Verschwinden etwas mit dem finanziel len Umschwung auf dem Landsitz zu tun, oder... Eine Stille, die schwer zu verstehen ist fuer mei-nen Sohn Guy. Da ich bis heute nichts bezueglich dieser Sache unternehmen konnte, zaehle ich auf Sie, um die Affaere zu regeln. Falls sich mein Gesundheitszustand nicht bessert, treffen Sie bitte die Entscheidungen, die Sie fuer richtig halten. @ In Freundschaft. JULIA DEFRANCK$", + "Spaeter erzaehlt Ihnen Guy von Leo's Selbstmord nach einer verrueckten Wette beim Rennen!$", + "F3: WIEDERHOLUNG@F8: STOP$", + "Der Hausherr$", + "Der Zukuenftige Erbe$", + "Julias Sohn$", + "Ein niedliches Maedchen!$", + "Superman!$", + "Der Mann von Ida$", + "Interessante Aeusserungen?$", + "Service inbegriffen!$", + "Nichts darunter!$", + "Kein Mucks...$", + "Eine halbe Stunde spaeter: nichts! Warten Sie immer noch?$", + "Bewundern Sie! Denken Sie nach!$", + "Nein! Nichts!$", + "Unmoeglich$", + "Das macht Flecken!$", + "Eine Abhandlung ueber die Geschichte der Gegend$", + "Einige Muenzen$", + "Erstes Gebot...$", + "Das riecht gut!$", + "Pik, Herz...$", + "Es mangelt nicht an Pillen!$", + "Ein Liebesroman$", + "Pusten heisst noch nicht spielen$", + "Kein Erfolg!$", + "Vorsicht vor Ueberraschungen!$", + "Dunkel und tief...$", + "Normale Gefuehle$", + "Sniff!$", + "Unverschaemt! Begnuegen Sie sich mit anschauen!$", + "Gesundheit! St... Staub$", + "Das Bild ist unterzeichnet... aber nicht die Tapeten$", + "Kein Glueck, Nichts!$", + "Seien Sie diskreter!$", + "Die Vorhaenge sind geschlossen$", + "Schnee! Und noch mehr Schnee!$", + "Genial: ein Bild vom Meister!$", + "Kein Zweifel, das ist eine Faelschung!$", + "Hum! Sie stutzen - Antikes oder Schund?$", + "Ein selten wertvolles Stueck!$", + "Nichts Bemerkenswertes$", + "Waesche, persoenliche Objekte...$", + "Nicht irgendwo!$", + "Das ist nicht der Zeitpunkt!$", + "Man spricht nicht mit vollem Mund! Nenn erst einmal das essen beendet ist$", + "Jemand kommt rein, beeilt sich und geht wieder raus$", + "Man naehert sich Ihrem Versteck!$", + "Man ueberrascht Sie!$", + "Unmoeglich! Sie sind ueberlastet!$", + "Versuchen Sie es aufs neue$", + "Sie sind perplex!?$", + "Sie verlassen Morteville. In Paris erwartet Sie eine Nachricht...$", + "Sie tun sich weh!$", + "Nichts weiteres mehr hier$", + "Der Ton erscheint normal$", + "Es bewegt sich nicht$", + "Man antwortet Ihnen$", + "Nicht der Augenblick!$", + "Gleiches Material, andere Seite!$", + "Der Widerschein ist fleckig, aber der Rahmen ist aus Gold$", + "Nippsachen, wertlose Dinge...$", + "Sie erleiden einen Misserfolg!$", + "Hier stinkt es... Besser nicht anschauen!$", + "Haushaltsprodukte$", + "Da juckt Ihnen das Fell?$", + "Das ist esklemmt, zugefroren! Brrrr...$", + "Die Fensterrahmen sind blockiert!$", + "Papiere...$", + "Nein! Der Weihnachtsmann hat keine Schwierigkeiten!$", + "Da geht es auf einen Flur$", + "Geschirr, Silber...$", + "Nein! Das sind nicht die Reste von Julia!$", + "Eine alte Gravur$", + "Sie entdecken eine tiefe rhombenfoermige Oeffnung$", + "Die Mauer gleitet zur Seite! Eine Passage! Benutzen Sie sie?$", + "Der Durchgang schliesst sich$", + "Eine Geheimschublade. Ein Buechlein... Lesen Sie es?$", + "Die Schublade schliesst sich wieder$", + "Nichts! Blut und Haut kleben am Stein!$", + "Die Details lassen Sie darauf schliessen, dass der Tod nicht unmitte lbar eingetreten ist!$", + "Verdorbene Vorhaben?$", + "Hing ihr Leben an einem \"Finger\"?$", + "Ein Schatz sei verschwunden?$", + "Eine Ritze in Groesse einer Muenze!$", + "Einige Steine bewegen sich... Eine Krypta! Gehen Siehinein?$", + "Der Ring dreht sich, die Mauer schliesst sich wieder$", + "Eine Steinsaeule hinter dem Altar$", + "Es war laut...$", + "Besetzt!$", + "Versuchen Sie noch einmal Ihr Glueck?$", + "Zu tief!$", + "Die Mauer am Ende des Ganges dreht sich$", + "Nothing!$", + "Der einzigue!$", + "Das Objekt faellt hinunter...$", + "Sie haben nichts in den Haenden$", + "Es ist nicht offen$", + "Das ist schon etwas$", + "Die Tuer ist zu$", + "Keine Antwort$", + "Eine volle Holzkugel$", + "Es ist kein Platz mehr$", + "Eine, in der Mitte durchbohrte, Holzkugel$", + "? ?$", + "Sie sind dran!$", + "OK!$", + "Ploetzlich erscheint Max mit Ihrem Koffer : \"Danke fuer Ihren Besuch\" Privatdetektiv mit gutem Gespuer und zweifellos diskret. Demoralisiert verlassen Sie den Landsitz. Sie sind UNBEDEUTEND!$", + "Leo unterbricht Sie:\"Das Unwetterhat sich beruhigt. In 1 Stunde gehe ich in die Stadt. Halten Siesich bereit.\" Sie haben Zeit verloren...aber noch nicht das Leben$", + "Hochrotes Gesicht, fatale Grippe.Sie bleiben da. Ihre Nachforschun gen fallen ins Wasser$", + "Das Wasser steigt sehr schnell und daempft Ihre letzten Illusionen ... Bevor Sie Zeit haben, zu reagiren, sind Sie tot!$", + "Sie sind kaum auf dem Grund des Brunnens, als eine Hand das Seil durchschneidet. Leben, adieu!$", + "Der Sturm verwischt Ihre Spuren. Eine Mauer des Schweigens huellt Sie ein. Langsam sterben Sie den Erfrierungstod!$", + "Sie sind nicht so allein wie Sie denken. Eine kalte Klinge bohrt sich in Ihren Ruecken. Seien Sie in Zukunft vorsichtiger!$", + "Sie ignorieren die Schuld von Leoam Tode Murielles. War sie sofort tot? Auf jeden Fall gerechtfertigen die familiaeren Probleme, die waehrend Ihrer Untersuchung aufgedeckt wurden, die Haltung Leos. Sie sind nicht sicher, ob Julia Sie deswegen angerufen hat, aber es genuegt Ihnen. Aus Respekt fuer sie und nach einigen Vorsichtsmassnahmen, fuehren Sie ein aufschlussreiches Gespraech mit Leo.$", + "$", + "Sie haben keinen Schluessel fuer den Landsitz. Ihre Rufe bleiben ohne Antwort. Sie werden sterben.$", + "Mit einem fuerchterlichen Rundschlag spaltet Sie das Schwert entzwei - das Innere kehrt sich nach aussen.$", + "Home, Sweet home!$", + "Geheimnis einer geschlossenen Tuer$", + "Charme verzaubert die alten Zimmer$", + "Leerer Magen$", + "Naeher 'gen Himmel? Nicht sicher!$", + "Angst vorm Dunkeln?$", + "Alte Teppiche und Goldschimmer$", + "Angst!$", + "Gerettet? Nicht sicher!$", + "Man fuehlt sich unwohl, was!$", + "Immer noch weiter!$", + "Ihr Kreuzweg!$", + "Bei der Entdeckung von...$", + "Achtung, auf das was sich versteckt...$", + "Abstieg in die Hoelle!$", + "Na fuehlen Sie sich gut? Sie sehen etwas@ blass aus!$", + "Vor dem Eintreten!$", + "Zoom:$", + "Unter anderem bemerken Sie...$", + "Und noch mal...$", + "Es ist zu Ende!$", + "Ein wenig Lektuere$", + "Das Abenteuer wartet auf Sie: also los!$", + "Verpassen Sie nicht IHR naechstes ABENTEUER!$", + "Ich verstehe nicht$", + "Es gibt Einfacheres$", + "Nein! Nicht Diesmal$", + "Zu spaet$", + "$", + "Wie ein tiefer verschleierter Blick, sein lebloses Auge auf die Sterne gerichtet, ist er wie der Schlund, der Himmel und Hoelle verbindet. Du musst in diese Tiefe vordringen, so wie eine Ratte in die Erde. Montag, Dienstag, Mittwoch, Sonntag, vom 1. Montag bis zum 1. Sonntag -so wird jeder Tag durch das SEIN oder WERDEN bestimmt. Vebersieh nichts, denn sonst ist Dein Schicksal besiegelt.$", + "10/1/50: Wir haben das Mysterium des Manuskriptes geloest und die Krypta lokalisiert. Ist es der Gedanke, in diesem Traum mein Ziel zu erreichen, der mir so angst macht? Ich bedauere, dass ich mich gegenueber Leo so engagiert habe. Nein, ich muss weitermachen Ich haette Guy informieren muessen, aber ich habe seit einer Woche nichts mehr von ihm gehoert$", + "Trag deine Bitte an den heiligen Ort - so wirst Du mehr erfahren! Der Pfeiler der Weisheit und die Sonne an den Knien werden Dir die Stelle zeigen , die Deiner Seele den Weg in eine neue Welt oeffnen Vorwaerts Orpheus, ohne Angst vordem Ungewissen: Weiss ist Deine Farbe, Gold ist Dein Zuhause. Be-leuchte Deinen Weg, bis hin zur traurigen Jungfrau. Gib ihr den Kreis des Mannes mit den drei Gesichtern, auf dass er die Welt wieder erreicht und sich dreht in seinem urspruenglichen Reichtum$", + "Die Berge sind die Zaehne eines gigantischen unendlichen Schlundes, einer himmlischen Orgie, die Sterne verschlingend, so wie uns die Dunkelheit verschlingt. Du laesst das Seil der Steine zu Dei nen Fuessen fallen. Das Lachen der Stille und in Deiner rechten Hand das Werk eines Meisters. Anschliessend wirst Du zwischen den beiden Monden hindurchgehen; jenseits des Abgrundes der Mauer des Schweigens wirst Du den Schluessel zur Melodie findenes fehlt nur noch die passende Note...$", + " DEZEMBER@ 9 ABZUG 518 13 ZINSEN 23@19 VEBERWE. 1203 17 GUTHAB 1598@ TOTAL 1721 TOTAL 1721@$", + " 5/01/51@ Luc, mein Liebling@ Guy weiss von unserer Beziehung.Nach einem Streit habe ich ihm alles gesagt. Ich liebe nur Dich. Max sitzt mir dauernd auf dem Hals, aber ich habe definitiv mitihm gebrochen. Soll er doch bei seinen Toepfen bleiben. Wann koennen wir uns allein sehen? Wegen dir wuerde ich mich scheiden lassen@ Deine Eva$", + " Morteville, 10/2/51@ Pat@ Ich erinnere Dich daran, dass Du mir noch FF 5000,- schuldest, die ich Dir fuer Dein Geschaeft geliehen habe. Ich brauche sie jetzt. Kannst Du sie mir bitte moeglichst schnell wiedergeben?@ Guy$", + " Morteville, 15/2/51@ Lieber Herr@ Ich schreibe Ihnen unser Geschaeft betreffend. Ich bin entschlossen, bis zum Aeusserstenzu gehen, da ich mir sicher bin, dass mein Teilhaber, Pat Defranck ein Rechnungsbuch gefaelscht hat.$", + "Eine Pfeife$", + "Ein Fuellfederhalter$", + "Ein Gasfeuerzeug$", + "Eine Retorte$", + "Ein Rasierpinsel$", + "Ein Farbeimer$", + "Eine Floete$", + "Ein wertvoller Ring$", + "Eine Garnrolle$", + "Ein altes Buch$", + "Ein Portemonnaie$", + "Ein Dolch$", + "Ein Revolver$", + "Eine Bibel$", + "Eine Kerze$", + "Ein Schmuckkoffer$", + "Ein Buegeleisen$", + "Ein Foto$", + "Eine Taschenuhr$", + "Ein Seil$", + "Schluessel$", + "Ein Perlenkollier$", + "Ein Parfumflakon$", + "Ein Fernglas$", + "Eine Brille$", + "Ein Ledergeldbeutel$", + "Ein Tennisball$", + "Munition$", + "Ein Nassrasierer$", + "Eine Haarbuerste$", + "Eine Kleiderbuerste$", + "Ein Kartenspiel$", + "Ein Schuhanzieher$", + "Ein Schraubenzieher$", + "Ein Hammer$", + "Schluessel$", + "Schluessel$", + "Ein Aschenbecher$", + "Ein Pinsel$", + "Ein Seil$", + "Ein Gegenstand aus Holz$", + "Schlafmittel$", + "Ein goldener Ring$", + "Ein Schmuckkoffer$", + "Ein Wecker$", + "Ein Panzerhemd$", + "Ein Kerzenhalter$", + "Ein Paar Handschuhe$", + "Ein Ziselierter Becher$", + "Ein Pergament$", + "Ein Dolch$", + "Ein Dossier$", + "Ein Pergament$", + "Ein Pergament$", + "Ein Dossier$", + "Ein Dossier$", + "Ein Brief$", + "Ein Roman$", + "Ein Holzstock$", + "Ein Umschlag$", + "Ein Brief$", + "Ein Umschlag$", + "Julia$", + "Julias Tod$", + "Julias Beziehungen$", + "eine Nachricht von Julia$", + "Julias Erbschaft$", + "letzte Handlungen Julias$", + "Geschenk von Julia$", + "Julias Zimmer$", + "die Fotos bei Julia$", + "Julia und Sie...$", + "die Geschaefte von Leo$", + "die Geschaefte von Pat$", + "die Geschaefte von Guy$", + "die Geschaefte von Bob$", + "die Geschaefte von Eva$", + "die Geschaefte von Luc$", + "die Geschaefte von Ida$", + "die Geschaefte von Max$", + "Ihre Geschaefte$", + "Leos Beziehungen$", + "Pats Beziehungen$", + "Guys Beziehungen$", + "Bobs Beziehungen$", + "Evas Beziehungen$", + "Lucs Beziehungen$", + "Idas Beziehungen$", + "Maxs Beziehungen$", + "Ihre Beziehungen$", + "Murielle$", + "Murielles Beziehungen$", + "Murielle und Sie...$", + "Murielles Vershwinden$", + "Die Mauer des Schweigens$", + "Die manuskripte$", + "Das Wappen$", + "Die Inschriften im Keller$", + "Der Brunnen$", + "Die Geheimgaenge$", + "Die Kapelle$", + "Die Bilder$", + "Die Fotos vom Dachboden$", + "Koerper in der Krypta$", + "$", + "$", + "ENDE DER UNTERHALTUNG$", + "Die Alten nannten die Bergkette am Fusse des Landsitzes so.$", + "Das ist das Bergmassiv, das man vor dem Landsitz sieht.$", + "Ich weiss nichts davon.$", + "Sie ist an einer Lungenembolie gestorben.$", + "Meine Mutter ist ploetzlich gestorben, obwohl es schien, dass sich ihr Zustand verbesserte.$", + "Frau Defranck ist gestorben.$", + "Sie ist an einer Lungenembolie gestorben.$", + "Verzeihen Sie mir, aber ich ziehe es vor, im Moment Schweigen zu bewahren.$", + "Es sind immer die Guten, die als erste gehen muessen.$", + "Ich habe meine Mutter sehr geliebt; ich bedauere, dass sie auf dem Gut der Defrancks gestorben ist.$", + "Dies ist eine Gegend, die eine sehr bewegte Vergangenheit hat und es gibt genug Dinge, um die ich mich kuemmern kann und ausserdem liebe ich Pferde.$", + "Er interessiert sich sehr fuer Geschichte und er ist ein erfolgloser Spieler. Uebrigens hat er vor einem Jahr eine bedeutende Summe gewonnen.$", + "Er hat schon viel zu tun mit der Buchhaltung und der Verwaltung des Gutes.$", + "Ich bin Direktor einer Parfumfirma. Aber hier... Erholung.$", + "Ein dymamischer Mann, der in der Parfumbranche viel erreicht hat.$", + "Das ist ein uebler Emporkoemmling. Die Parfums muessen seinen gesunden Menschenverstand eingeschlaefert haben. Hier verbringt er seine Abende in seinem Zimmer.$", + "Vorher galt meine Hauptsorge der Gesundheit meiner Mutter. Jetzt finde ich an nichts mehr Gefallen.$", + "Er haette gut daran getan, sich ein bisschen mehr um mich zu kuemmern und etwas weniger um seine Mutter.$", + "Das sind seine Angelegenheiten.$", + "Er hat nicht viel Glueck im Moment, obwohl seine Geschaefte zufriedenstellend sind.$", + "Ich arbeite mit Pat. Es geht nicht besonders gut im Moment.$", + "Ah ja! Hat er Beschaeftigungen? Er taete besser daran, sich ernsthaft zu beschaeftigen.$", + "Er und Pat sind Geschaeftspartner. Ich glaube, es laeuft gar nicht mal schlecht.$", + "Ich kuemmere mich um mich und das ist schon genug. Und Sie?$", + "Oh, ich vetraue ihr. Sie versteht, sich zu beschaeftigen.$", + "Aber haben Sie noch nicht ihre Hauptbeschaeftigung entdeckt?$", + "Sie arbeitet in der Dekoration mit sehr viel Geschmack. Ausserdem ist sie immer sehr gut angezogen.$", + "Interessiert sie der Schmuck. Ich habe ein Geschaeft vorzuschlagen.$", + "Der Schmuck...$", + "Ich weiss nicht, aber ich glaube, ich wuerde es vorziehen, wenn er sich ein bisschen weniger um meine Angelegenheiten kuemmern wuerde.$", + "Eine Hausfrau hat immer zu tun.$", + "Sie koennte auch ohne Arbeit auskommen. Aber nein, sie naeht, sie liest...$", + "Sie hat sicherlich keine sehr erheiternden Taetigkeiten.$", + "Eine aussergewoehnliche Frau. Sie interessiert sich fuer alles.$", + "Zwischen Kueche und Haushalt habe ich nicht viel Zeit fuer sie.$", + "Wie schafft er es nur, alles zu machen? Oh Wunder!$", + "Er taete gut daran, wenn er sich weniger mit Klatsch und der Flasche beschaeftigen wuerde.$", + "Ich bin sehr selbstaendig. Solange man sich nicht um meine Angelegenheiten kuemmert, gibt es keine Probleme.$", + "Er ist ein Egoist. Ich frage mich, ob es fuer ihn noch etwas anderes gibt, als seine Pferde und seine Maerchenbuecher.$", + "Er versteht sich gut mit allen, ausser vielleicht mit Guy.$", + "Er ist ein Mann mit Charakter. Man muss ihn zu nehmen wissen.$", + "Geschaeft ist Geschaeft. Was die Familie anbetrifft...$", + "Beziehungen? Freundschaften? Finanzen zweifellos.$", + "Ich habe ihm nichts vorzuwerfen.$", + "Er ist ein pfiffiger Geschaeftsmann. Manchmal schwimmt er gegen den Strom, aber er weiss sich immer zu helfen.$", + "Sie langweilen mich alle. Nein, obwohl... einige...$", + "Im Gegensatz zur Mutter ist es eine sehr verschlossene Person. Also Frage: Beziehung.$", + "Er muss sich zweifellos sehr anstrengen, um trotz seiner Sorgen freundlich zu bleiben.$", + "Seine Liebesaffairen? Aus und vorbei. Mit mir? Es hat nie richtig angefangen. Was die anderen betrifft... ich bin nicht \"die anderen\".$", + "Ich mag jeden, solange man mich nicht betruegt.$", + "Es reicht nicht, ein bisschen Geld zu haben und ein guter Redner zu sein, um bei allen beliebt zu sein.$", + "Jemand, der nett ist und ausserdem noch Humor hat.$", + "Ueber diese Sache kann ich mich nicht auslassen.$", + "Das ist nicht besonders intelligent. Sprechen Sie mit dem Ehemann darueber.$", + "Ist es wegen eines Rendez-vous?$", + "Sie ist sehr lebhaft. sie laesst sich nicht durch Vorurteile in Verwirrung brignen.$", + "In meinem Beruf ist man vor allem schoenen Frauen und Gaunern sehr nahe.$", + "Sein einziges Vermoegen sind sein Schmuck und seine Frau, aber er ist sich dessen nicht bewusst.$", + "Jemand interessantes, aber nicht immer leicht zu verstehen, der aber die Muehe wert ist.$", + "Ich verachte niemanden, aber ich mag es sehr, wenn alles und alle dort sind, wo sie hingehoeren.$", + "Unter uns.. sehen Sie, wenn ich mit ihr spreche, fuehle ich mich schnell beengt.$", + "Um sich nicht mit ihr zu verstehen, braucht man wirklich viel schlechten Willen.$", + "In meinem Beruf hoert man alles, aber behaelt nichts. Nur der Service zaehlt.$", + "Das ist ein Heuchler, ein Kriecher. Ich persoenlich habe kein Vertrauen zu Ihm.$", + "Ich kenne seine wahren Gedanken nicht, aber er war stets korrekt.$", + "Sie hat vor einem Jahr, vielleicht laenger, auf dem Landsitz gewohnt.$", + "Mehr als eine Freundin fuer meine Mutter. In solchen Augenblicken haette ich gewuenscht, dass sie da ist.$", + "Sie war die Hausdame von Julia.$", + "Sie hat ebenfalls Recherchen angestellt. Aber Guy, der sie besser kennt als jeder andere, kann Ihnen mehr sagen.$", + "Ihre Beziehungen?... Sie war sehr kultiviert. Ihr ploetzliches Verschwinden vor einem Jahr hat mich erstaunt.$", + "Sie teilte mit Leo ihre Leidenschaft fuer Geschichte und fuer die Gegend.$", + "Ich glaube, jeder hatte sie gern.$", + "Sie verstand sich mit allen gut, aber ganz besonders liebte sie ihren Sohn. Was die Beziehungen Schwiegermutter Scwiegertochter anbetrifft...$", + "Ausser zu Leo hatte sie auch gute Beziehungen zu Max.$", + "Obwohl ihre Beziehungen nicht von Dauer waren, lag ihr immer viel an ihnen.$", + "Ausser ihrer Familie, nicht viele.$", + "Aber ja. Sie hat das Weggehen dieser Freundin sehr bedauert. Eh, Mireille, oder Marielle.$", + "Nein, nichts.$", + "Nein, nicht das ich wuesste.$", + "Ich habe Julia kennengelernt, als ich das Landgut kaufte. Es war das einzige, was ihr gehoerte, aber mein Besitz war auch der ihre.$", + "Wenn nicht einige persoenliche Dinge gewesen waeren, ich glaube, dann haette sie nichts eigenes mehr gehabt.$", + "Ich glaube, all ihr Reichtum kam von Leo. Also!$", + "Ausser des Briefes, den ich fuer sie aufgegeben habe, nichts wichtiges.$", + "Ich war gluecklich, als sie mir ihre eingebundene Bibel schenkte.$", + "Es ging schnell und sie hatte nicht die Zeit, um spezielle Entscheidungen zu treffen.$", + "Ihr letztes Geschenk hat mich ueberrascht.$", + "Was fuer ein Geschenk?$", + "Ein Kerzenleuchter.$", + "Ja, ich habe ein Geschenk bekommen. Meine Frau hat sogar eine Bibel bekommen.$", + "Aber ja. wie jeder, glaube ich.$", + "Ein Dolch$", + "Ich habe nie den Dachboden durchwuehlt.$", + "Haben Sie die Gabe eines Hellsehers, oder haben Sie einen Dietrich?$", + "Das Portrait einer jungen Frau? Das ist Murielle.$", + "Ich kannte sie zu wenig.$", + "Sehr charmant. Sie war vor allem die Hausdame von Julia.$", + "Das war die einzige wirklich interessante Frau, die ich getroffen habe.$", + "Sie hatte ein grosses Wissen vorzuweisen. Sie zu besuchen, war stets sehr bereichernd.$", + "Ich habe mich immer gefragt, was manche an ihr fanden.$", + "Das Zimmer ist verschlossen? Fragen Sie Leo.$", + "Ich habe ihr Zimmer nach ihrem Tod abgeschlossen und ich moechte, dass das auch noch eine zeitlang so bleibt.$", + "Wissen Sie, was das sind? Familienbeziehungen.$", + "In all den Jahren habe ich sie niemals gegen meinen Willen bedient.$", + "Ich habe sie so sehr geliebt, wie sie mich, glaube ich.$", + "Mit welchem Recht sind Sie in das Zimmer meiner Frau eingedrungen?$", + "Zweifellos das Foto von Murielle mit dem Patenkind von Julia.$", + "Ich erinnere mich nicht.$", + "Das ist Murielle. Ich war es, der sie fotografiert hat. Uebrigens ist das Foto seitenverkehrt abgezogen.$", + "Sie sind wirklich neugierig. Das ist wertlos.$", + "Maerchen, Pergamente und Manuskripte das ist Leos Spezialitaet.$", + "Schade, dass die Losung fehlt.$", + "Das ist sehr schoen und sehr alt.$", + "Das ist ein Ort, den ich nie gesehen habe.$", + "Leos Meinung nach schien es, als seien die Monde spaeter gemacht worden.$", + "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "Tief und beunruhigend. Der Fortschritt hat gutes an sich.$", + "Der Rest bleibt fuer mich eines der groessten Raetsel.$", + "In letzter Zeit sprach sie oft von einer Reise und dann...$", + "An einem Abend vor mehr als einem Jahr hat sie sich entschieden wegzugehen.$", + "Auf jeden Fall war sie fuer das Leben hier nicht geschaffen.$", + "Welcher Koerper? Welche Krypta?$", + "Wenn es sie ueberhaupt gibt, ich habe sie nie gefunden.$", + "Aber sicher! Und die Fantome auch.$", + "Es ist die aelteste der Stadt. Sie stammt aus dem 11. Jahrhundert.$", + "Nach der Revolution wurde sie leicht restauriert.$", + "Julia liebte die Malerei sehr.$", + "Sie haben verschiedene Stilrichtungen, aber sie haben nicht alle Wert.$", + "Was machen Sie da ?$", + "Ich bin sicher, Sie suchen etwas!$", + "Ich hoere.$", + "Was wuenschen Sie?$", + "Ja ?$", + "Ich stehe zu Ihrer Verfuegung.$", + "Weswegen?$", + "Na los doch!$", + "Wegen was?$", + "Max: Zu Ihren Diensten, Monsieur.$", + "Auf jeden Fall haben Sie hier nichts zu suchen! Gehen Sie raus!$", + "Sie sind zu neugierig!$", + "Jerome, es ist lange her. Wie traurig, Julia ist tot. Ihre Familie ist hier. Guy, ihr Sohn, und Eva, ihre Schwiegertochter. Leo, ihr Mann, sowie ihr Schwiegersohn Pat und die Cousins Bob, Ida und Luc. Das Unwetter verstaerkt sich. Sie muessen noch bleiben. Die Mahlzeiten sind um 12 Uhr und um 19 Uhr und es findet jeden Tag um 10 Uhr eine Andacht in der Kapelle statt.$", + "Als ich Sie sah, habe ich sofort begriffen, dass Sie die Wahrheit aufdecken wuerden, da ich wusste, warum Sie gekommen sind. Ich hatte den Entwurf von Julias Brief gefunden. Aber ich bin ein begeisterter Spieler, also.... Sie haette nicht gewollte, dass ihre Aufgabe zu leicht ausfaellt, zweifellos, um mich zu schuetzen, aber sie konnten nicht sterben mit dieser Ungewissheit.Haben Sie herausgefunden, dass die \"Mauer des Schweigens\" der Name ist, den die Maurer waehrend des Baus des Landsitzes der Mauer gegeben haben, die das Wappen traegt...? Und die Geschenke, die Julia vor ihrem Tod hinterlassen hat waren sowohl falsche Hinweise wie auch ein Mittel, um die Wichtigkeit der Pergamente herauszustellen. Tatsaechlich arbeitete ich vor mehr als einem Jahr mit Murielle an der Entzifferung dieser Pergamente, die ich gefunden hatte. Meine Frau sah einen Zusammenhang zwischen unserer Arbeit und dem Verschwinden Murielles,aber sie hat nie Beweise dafuer gehabt; wenn da nicht dieser Ring gewesen waere, den sie eines Tages unter meinen Sachen wiedergefunden hat. Eines nachts sind wir in dem Geheimgang, den wir entdeckt hatten,auf Erkundung gegangen. Murielle ist durch einen Unfall im \"Jungfrauenzimmer\" ums Leben gekommen. Ich habe ihren Ring schnell an mich genommen, habe den Schatz entdeckt und mich dann aus dem Staub gemacht. Ich dachte nicht daran, dass sie unter Umstaenden noch leben koennte, und ich habe nichts gesagt, da ich Geld brauchte. Ich habe das Geld beim Pferderennen verspielt. Gehen Sie jetzt, da sie ja nicht von der Polizei sind. Lassen Sie mich allein.$", + "Februar '51, Beruf: Privatdetektiv. Die Kaelte laesst Paris und meine Unternehmungen erstarren, als...$", + "Julia, heute eine alte Frau. Nichts als Erinnerungen und Spiele in den alten Zimmern des Landsitzes von Morteville.$", + "im Buero$", + "in der Kueche$", + "im Keller$", + "auf dem Flur$", + "draussen$", + "im Esszimmer$", + "im Landsitz$", + "vor dem Landsitz$", + "in der Kapelle$", + "vor dem Brunnen$", + "im Norden$", + "hinter dem Landsitz$", + "im Sueden$", + "im Osten$", + "im Westen$", + "in Richtung Landsitz$", + "noch weiter$", + "im Wasser$", + "ausser des Brunnens$", + "im Brunnen$", + "Wahl auf dem Bild$", + " In der Reihe RAETSEL...$", + " DER LANDSITZ VON MORTEVILLE$", + "$", + " Nach einer Idee von...$", + " Bernard GRELAUD und Bruno GOURIER$", + "$", + " Realisation: LANKHOR$", + "$", + " in Zusammenarbeit mit...$", + " Beatrice und Jean-Luc LANGLOIS Musik und Stimmen,$", + " Bernard GRELAUD graphische Gestaltung,$", + " Dominique SABLONS graphische Realisation ,$", + " Bruno GOURIER technische Realisation,$", + " Gabi NURGE Uebersetzung,$", + " Clement ROQUES IBM PC Realisation.$", + "$", + " Ausgabe: LANKHOR$", + " COPYRIGHT 1989: LANKHOR$", + "$", + " SIE SIND AM ZUG$", + "abkratzen$", + "anschauen$", + "ausgehen$", + "befestig.$", + "drehen$", + "durchsuch$", + "eindrueck$", + "eintreten$", + "essen$", + "fuehlen$", + "hochheben$", + "klopfen$", + "lesen$", + "nehmen$", + "oeffnen$", + "schlafen$", + "schliess.$", + "setzen$", + "sondieren$", + "warten$", + "zuhoeren$", + "anschauen$", + "durchsuch.$", + "hinlegen$", + "lesen$", + "s. verstec$", + "Leo$", + "Pat$", + "Guy$", + "Eva$", + "Bob$", + "Luc$", + "Ida$", + "Max$", + " JULIA$", + "hat sie Selbstmord begangen ?$", + "ist sie ermordet worden ?$", + "ist sie durch Unfall gestorben ?$", + "ist sie eines natuerlichen Todes gestorben ?$", + " Woher kam das Geld, das die restaurierung des landsitzes erlaubte ?$", + "Erpressung$", + "Arbeit$", + "Erbschaft$", + "Rennen$", + "Renten$", + "Raub$", + "Verschiedenes$", + " Was ist Leos Hobby ?$", + "Historische Recherchen$", + "Politik$", + "Malerei$", + "Drogen$", + "Okkultismus$", + "Fuehrung einer Sekte$", + " Julia Hat verschiedene Indizien hinterlassen. Diese befinden sich an einem einzigen Ort. Welchem ?$", + "Kapelle$", + "Draussen$", + "Keller$", + "Dachboden$", + "Kueche$", + "Esszimmer$", + "Julias Zimmer$", + "Leos Zimmer$", + "Pats Zimmer$", + "Bobs Zimmer$", + "Maxs Zimmer$", + "Luc/Idas Zimmer$", + "Guy/Evas Zimmer$", + " Der entscheidende Hinweis, der es Ihnen ermoeglichte, bis an die Tuer des Souterrains zu gelangen, war :$", + "ein Dolch$", + "ein Ring$", + "ein Buch$", + "ein Pergament$", + "ein Brief$", + "ein Pendel$", + " Wievele Pergamente befinden sich auf dem Landsitz ?$", + "kein$", + "eins$", + "zwei$", + "drei$", + "vier$", + "fnf$", + " Wieviele Personen sind in die Geschichte verwickelt ? (Julia eingeschlossen, ausgenommen Sie)$", + "neun$", + "zehn$", + "elf$", + " Wie war der Name der unbekannten Person ?$", + "Mireille$", + "Fran‡oise$", + "Maguy$", + "Emilie$", + "Murielle$", + "Sophie$", + " Wessen Geliebte war Murielle ?$", + "Bob$", + "Luc$", + "Guy$", + "Leo$", + "Max$", + " Murielle teilte eine Beschaeftigung mit einer anderen Person. Mit wem ?$", + "[1][Allein der Zufall hat es Ihnen ermoeglicht bis hierher zu komen.| Gehen Sie zurueck und forschen Sie noch einmal nach,|damit Sie das Gaze besser verstehen...][ok]$", + "[1][Legen Sie die Diskette 1 ein][ok]$", + "[1][Problem mit der Diskette | Alles abstellen...][OK]$", + "[1][Sie haetten 00% der Hinweise| bemerken muessen][ OK ]$", + "[1][Legen Sie die Diskette 2 ein][ok]$", + "[1][Bevor Sie weitermachen, fassen Sie Ihre Kenntnisse Zusammen][ok]$", + " MASTER .$", + " sgaf", NULL }; #endif diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 125d37fdbb..23e06fe014 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From c10d050eeff2ca69bc6bdd9bc83a972981b77448 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 4 Jul 2013 23:46:52 +0200 Subject: MORTEVIELLE: Update misc files to include mort.dat --- Makefile.common | 3 +++ devtools/README | 7 +++++++ dists/engine-data/README | 5 +++++ dists/scummvm.rc | 3 +++ dists/scummvm.rc.in | 3 +++ 5 files changed, 21 insertions(+) diff --git a/Makefile.common b/Makefile.common index aec033f0c7..02c3408684 100644 --- a/Makefile.common +++ b/Makefile.common @@ -253,6 +253,9 @@ endif ifdef ENABLE_LURE DIST_FILES_ENGINEDATA+=lure.dat endif +ifdef ENABLE_MORTEVIELLE +DIST_FILES_ENGINEDATA+=mort.dat +endif ifdef ENABLE_NEVERHOOD DIST_FILES_ENGINEDATA+=neverhood.dat endif diff --git a/devtools/README b/devtools/README index c7f08d6dfa..482c24edc2 100644 --- a/devtools/README +++ b/devtools/README @@ -63,6 +63,13 @@ create_lure (dreammaster) the lure.dat file. +create_mort (Strangerke) +----------- + Gathers several information found in the original DOS executable: + - Font data + - French, German and fan-made English translation + + create_project (LordHoto, Littleboy) -------------- Creates project files for Visual Studio 2005, 2008, 2010, 2012, Xcode and diff --git a/dists/engine-data/README b/dists/engine-data/README index c9c4bd4817..9bbb006d17 100644 --- a/dists/engine-data/README +++ b/dists/engine-data/README @@ -16,6 +16,11 @@ scripts, from. lure.dat TODO +mort.dat: +File created partially by extracting font data from the French executable. It +also contains the French and German translation, as well as a custom-made +English translation. + queen.tbl: 'queen.tbl' contains a list of filenames, filesizes and offsets for the individual files saved in QUEEN.1. This data was originally included in the diff --git a/dists/scummvm.rc b/dists/scummvm.rc index f3fa14c95a..037db3ef62 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -32,6 +32,9 @@ kyra.dat FILE "dists/engine-data/kyra.dat" #if ENABLE_LURE == STATIC_PLUGIN lure.dat FILE "dists/engine-data/lure.dat" #endif +#if ENABLE_MORTEVIELLE == STATIC_PLUGIN +mort.dat FILE "dists/engine-data/mort.dat" +#endif #if ENABLE_NEVERHOOD == STATIC_PLUGIN neverhood.dat FILE "dists/engine-data/neverhood.dat" #endif diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index b7a87f4e3d..c18c18ef63 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -32,6 +32,9 @@ kyra.dat FILE "dists/engine-data/kyra.dat" #if ENABLE_LURE == STATIC_PLUGIN lure.dat FILE "dists/engine-data/lure.dat" #endif +#if ENABLE_MORTEVIELLE == STATIC_PLUGIN +mort.dat FILE "dists/engine-data/mort.dat" +#endif #if ENABLE_NEVERHOOD == STATIC_PLUGIN neverhood.dat FILE "dists/engine-data/neverhood.dat" #endif -- cgit v1.2.3 From fb4c860e68284fa1251c66a7c3f231544173e765 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Jul 2013 17:57:25 -0400 Subject: TSAGE: Beginnings of proper movement in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 10 +-- engines/tsage/ringworld2/ringworld2_logic.h | 2 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 113 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 4 files changed, 65 insertions(+), 62 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 86014fb9c1..b7034fd49c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1456,12 +1456,12 @@ int MazeUI::getCellFromCellXY(const Common::Point &p) { } } -int MazeUI::pixelToCellXY(int &x, int &y) { - x /= _cellSize.x; - y /= _cellSize.y; +int MazeUI::pixelToCellXY(Common::Point &pt) { + pt.x /= _cellSize.x; + pt.y /= _cellSize.y; - if ((x >= 0) && (y >= 0) && (_mapCells.x > x) && (_mapCells.y > y)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * y + x) * 2); + if ((pt.x >= 0) && (pt.y >= 0) && (pt.x < _mapCells.x) && (pt.y < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * pt.y + pt.x) * 2); } return -1; diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 576482b3eb..5a0eecc56c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -313,7 +313,7 @@ public: void draw(); int getCellFromPixelXY(const Common::Point &pt); int getCellFromCellXY(const Common::Point &p); - int pixelToCellXY(int &arg1, int &arg2); + int pixelToCellXY(Common::Point &pt); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 85a6095807..062badc7f1 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1393,50 +1393,52 @@ void Scene1200::process(Event &event) { return; if (event.eventType == EVENT_BUTTON_DOWN) { - _mazeUI.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); - int unk = _mazeUI.getCellFromPixelXY(event.mousePos); + Common::Point cellPos(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + _mazeUI.pixelToCellXY(cellPos); + + int cellId = _mazeUI.getCellFromPixelXY(event.mousePos); switch (R2_GLOBALS._events.getCursor()) { - case CURSOR_ARROW: + case CURSOR_WALK: event.handled = true; if ((event.mousePos.x > 179) && (event.mousePos.x < 210) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) - sub9DAD6(1); + startCrawling(1); if ((event.mousePos.x > 109) && (event.mousePos.x < 140) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) - sub9DAD6(2); + startCrawling(2); if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 89) && (event.mousePos.y < 120)) - sub9DAD6(3); + startCrawling(3); if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 19) && (event.mousePos.y < 50)) - sub9DAD6(4); + startCrawling(4); break; case CURSOR_USE: - if (unk > 36) { - if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33)) - || ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) - || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) - || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9)) - || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17)) - || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) - || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) { + if (cellId > 36) { + if ( ((cellPos.x == 3) && (cellPos.y == 33)) + || ((cellPos.x == 7) && (cellPos.y == 33)) + || ((cellPos.x == 33) && (cellPos.y == 41)) + || ((cellPos.x == 5) && (cellPos.y == 5)) + || ((cellPos.x == 13) && (cellPos.y == 21)) + || ((cellPos.x == 17) && (cellPos.y == 21)) + || ((cellPos.x == 17) && (cellPos.y == 5)) + || ((cellPos.x == 17) && (cellPos.y == 9)) + || ((cellPos.x == 29) && (cellPos.y == 17)) + || ((cellPos.x == 33) && (cellPos.y == 17)) + || ((cellPos.x == 35) && (cellPos.y == 17)) + || ((cellPos.x == 41) && (cellPos.y == 21)) ) { _area1.postInit(); event.handled = true; } } - if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) { - if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 9)) - || ((R2_GLOBALS._v56AA2 == 11) && (R2_GLOBALS._v56AA4 == 27)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 7)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 27)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 33)) - || (R2_GLOBALS._v56AA2 == 33) ) { - switch (R2_GLOBALS._v56AA2) { + if ((cellId == 1) || (cellId == 4) || (cellId == 11) || (cellId == 14)) { + if ( ((cellPos.x == 3) && (cellPos.y == 9)) + || ((cellPos.x == 11) && (cellPos.y == 27)) + || ((cellPos.x == 17) && (cellPos.y == 7)) + || ((cellPos.x == 17) && (cellPos.y == 27)) + || ((cellPos.x == 17) && (cellPos.y == 33)) + || (cellPos.x == 33) ) { + switch (cellPos.x) { case 3: R2_GLOBALS._sceneManager.changeScene(3150); break; @@ -1455,9 +1457,9 @@ void Scene1200::process(Event &event) { } break; case CURSOR_LOOK: - if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) { + if ((cellId == 1) || (cellId == 4) || (cellId == 11) || (cellId == 14)) { event.handled = true; - switch (R2_GLOBALS._v56AA2) { + switch (cellPos.x) { case 3: SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); break; @@ -1465,13 +1467,13 @@ void Scene1200::process(Event &event) { R2_GLOBALS._sceneManager.changeScene(3240); break; case 11: - if (R2_GLOBALS._v56AA4 == 27) + if (cellPos.y == 27) R2_GLOBALS._sceneManager.changeScene(3210); else SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); break; case 17: - switch (R2_GLOBALS._v56AA4) { + switch (cellPos.y) { case 5: R2_GLOBALS._sceneManager.changeScene(3230); break; @@ -1493,7 +1495,7 @@ void Scene1200::process(Event &event) { break; } } - if (unk > 36) { + if (cellId > 36) { event.handled = true; SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); } @@ -1513,19 +1515,19 @@ void Scene1200::process(Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_1: warning("FIXME: keycode = 0x4800"); - sub9DAD6(4); + startCrawling(4); break; case Common::KEYCODE_2: warning("FIXME: keycode = 0x4B00"); - sub9DAD6(2); + startCrawling(2); break; case Common::KEYCODE_3: warning("FIXME: keycode = 0x4D00"); - sub9DAD6(1); + startCrawling(1); break; case Common::KEYCODE_4: warning("FIXME: keycode = 0x5000"); - sub9DAD6(3); + startCrawling(3); break; default: event.handled = false; @@ -1606,16 +1608,17 @@ void Scene1200::saveCharacter(int characterIndex) { SceneExt::saveCharacter(characterIndex); } -void Scene1200::sub9DAD6(int indx) { - _mazeUI.pixelToCellXY(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); +void Scene1200::startCrawling(int indx) { + Common::Point cellPos = Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); + _mazeUI.pixelToCellXY(cellPos); switch (indx) { - case 0: + case 1: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(200, 88)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) - || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) - || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) ) + && ( ((cellPos.x == 3) && (cellPos.y == 33) && (_field418 != 4)) + || ((cellPos.x == 13) && (cellPos.y == 21) && (_field418 != 2)) + || ((cellPos.x == 29) && (cellPos.y == 17) && (_field418 != 1)) + || ((cellPos.x == 33) && (cellPos.y == 41)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1200; @@ -1654,12 +1657,12 @@ void Scene1200::sub9DAD6(int indx) { signal(); } break; - case 1: + case 2: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(120, 88)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4)) - || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2)) - || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1)) - || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) ) + && ( ((cellPos.x == 7) && (cellPos.y == 33) && (_field418 != 4)) + || ((cellPos.x == 17) && (cellPos.y == 21) && (_field418 != 2)) + || ((cellPos.x == 33) && (cellPos.y == 17) && (_field418 != 1)) + || ((cellPos.x == 5) && (cellPos.y == 5)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1201; @@ -1698,10 +1701,10 @@ void Scene1200::sub9DAD6(int indx) { signal(); } break; - case 2: + case 3: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 110)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3)) - || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) + && ( ((cellPos.x == 17) && (cellPos.y == 5) && (_field418 != 3)) + || ((cellPos.x == 41) && (cellPos.y == 21)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1203; @@ -1740,10 +1743,10 @@ void Scene1200::sub9DAD6(int indx) { signal(); } break; - case 3: + case 4: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 30)) > 36)) - && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3)) - || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) ) + && ( ((cellPos.x == 17) && (cellPos.y == 9) && (_field418 != 3)) + || ((cellPos.x == 35) && (cellPos.y == 17)) ) ) { R2_GLOBALS._player.disableControl(); _sceneMode = 1202; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 619e692f89..4ac518c980 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -160,7 +160,7 @@ public: Scene1200(); void synchronize(Serializer &s); - void sub9DAD6(int indx); + void startCrawling(int indx); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); -- cgit v1.2.3 From 16748f1341ec6c10582288de8bcce5a4837693c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Jul 2013 19:00:18 -0400 Subject: TSAGE: Bugfixes for laser panel in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 56 ++++++++++++++----------- engines/tsage/ringworld2/ringworld2_scenes1.h | 14 +++---- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 062badc7f1..7cd1e92b8b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -858,9 +858,10 @@ void Scene1100::saveCharacter(int characterIndex) { } /*-------------------------------------------------------------------------- - * Scene 1200 - + * Scene 1200 - Air Ducts Maze * *--------------------------------------------------------------------------*/ + Scene1200::Scene1200() { _field412 = 0; _field414 = 0; @@ -881,17 +882,17 @@ void Scene1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field41C); } -Scene1200::Area1::Area1() { +Scene1200::LaserPanel::LaserPanel() { _field20 = 0; } -void Scene1200::Area1::synchronize(Serializer &s) { +void Scene1200::LaserPanel::synchronize(Serializer &s) { SceneArea::synchronize(s); s.syncAsByte(_field20); } -void Scene1200::Area1::Actor3::init(int state) { +void Scene1200::LaserPanel::Jumper::init(int state) { _state = state; SceneActor::postInit(); @@ -912,6 +913,7 @@ void Scene1200::Area1::Actor3::init(int state) { default: break; } + break; case 2: switch (R2_GLOBALS._v56AA7) { case 1: @@ -929,6 +931,7 @@ void Scene1200::Area1::Actor3::init(int state) { default: break; } + break; case 3: switch (R2_GLOBALS._v56AA8) { case 1: @@ -942,6 +945,7 @@ void Scene1200::Area1::Actor3::init(int state) { default: break; } + break; default: break; } @@ -949,7 +953,7 @@ void Scene1200::Area1::Actor3::init(int state) { setDetails(1200, 12, -1, -1, 2, (SceneItem *) NULL); } -bool Scene1200::Area1::Actor3::startAction(CursorType action, Event &event) { +bool Scene1200::LaserPanel::Jumper::startAction(CursorType action, Event &event) { if (action != CURSOR_USE) return SceneActor::startAction(action, event); @@ -1018,7 +1022,7 @@ bool Scene1200::Area1::Actor3::startAction(CursorType action, Event &event) { return true; } -void Scene1200::Area1::postInit(SceneObjectList *OwnerList) { +void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; scene->_field41A = 1; @@ -1026,24 +1030,24 @@ void Scene1200::Area1::postInit(SceneObjectList *OwnerList) { proc12(1003, 1, 1, 100, 40); proc13(1200, 11, -1, -1); R2_GLOBALS._sound2.play(259); - _actor3.init(1); - _actor4.init(2); - _actor5.init(3); + _jumper1.init(1); + _jumper2.init(2); + _jumper3.init(3); R2_GLOBALS._player._canWalk = false; } -void Scene1200::Area1::remove() { +void Scene1200::LaserPanel::remove() { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; scene->_field41A = 0; warning("Unexpected _sceneAreas.remove() call"); -// scene->_sceneAreas.remove(&_actor3); -// scene->_sceneAreas.remove(&_actor4); -// scene->_sceneAreas.remove(&_actor5); - _actor3.remove(); - _actor4.remove(); - _actor5.remove(); +// scene->_sceneAreas.remove(&_jumper1); +// scene->_sceneAreas.remove(&_jumper2); +// scene->_sceneAreas.remove(&_jumper3); + _jumper1.remove(); + _jumper2.remove(); + _jumper3.remove(); // sub201EA R2_GLOBALS._sceneItems.remove((SceneItem *)this); @@ -1055,7 +1059,7 @@ void Scene1200::Area1::remove() { R2_GLOBALS._player._canWalk = true; } -void Scene1200::Area1::process(Event &event) { +void Scene1200::LaserPanel::process(Event &event) { if (_field20 != R2_GLOBALS._insetUp) return; @@ -1081,7 +1085,7 @@ void Scene1200::Area1::process(Event &event) { } } -void Scene1200::Area1::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void Scene1200::LaserPanel::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; _actor2.postInit(); @@ -1094,7 +1098,7 @@ void Scene1200::Area1::proc12(int visage, int stripFrameNum, int frameNum, int p _field20 = R2_GLOBALS._insetUp; } -void Scene1200::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void Scene1200::LaserPanel::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { _actor2.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -1426,7 +1430,7 @@ void Scene1200::process(Event &event) { || ((cellPos.x == 33) && (cellPos.y == 17)) || ((cellPos.x == 35) && (cellPos.y == 17)) || ((cellPos.x == 41) && (cellPos.y == 21)) ) { - _area1.postInit(); + _laserPanel.postInit(); event.handled = true; } } @@ -1461,6 +1465,7 @@ void Scene1200::process(Event &event) { event.handled = true; switch (cellPos.x) { case 3: + // It was your cell. SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); break; case 9: @@ -1470,6 +1475,7 @@ void Scene1200::process(Event &event) { if (cellPos.y == 27) R2_GLOBALS._sceneManager.changeScene(3210); else + // A vent grill SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); break; case 17: @@ -1484,6 +1490,7 @@ void Scene1200::process(Event &event) { R2_GLOBALS._sceneManager.changeScene(3200); break; default: + // A vent grill SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); break; } @@ -1496,6 +1503,7 @@ void Scene1200::process(Event &event) { } } if (cellId > 36) { + // "An anti-pest laser" event.handled = true; SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); } @@ -7108,7 +7116,7 @@ void Scene1550::UnkArea1550::remove() { } void Scene1550::UnkArea1550::process(Event &event) { -// This is a copy of Scene1200::Area1::process +// This is a copy of Scene1200::LaserPanel::process if (_field20 != R2_GLOBALS._insetUp) return; @@ -7172,7 +7180,7 @@ void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, } void Scene1550::UnkArea1550::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { - // Copy of Scene1200::Area1::proc13 + // Copy of Scene1200::LaserPanel::proc13 _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -13131,7 +13139,7 @@ void Scene1950::Area1::remove() { } void Scene1950::Area1::process(Event &event) { -// This is a copy of Scene1200::Area1::process +// This is a copy of Scene1200::LaserPanel::process if (_field20 != R2_GLOBALS._insetUp) return; @@ -13184,7 +13192,7 @@ void Scene1950::Area1::proc12(int visage, int stripFrameNum, int frameNum, int p } void Scene1950::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { - // Copy of Scene1200::Area1::proc13() + // Copy of Scene1200::LaserPanel::proc13() _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 4ac518c980..626e596f0b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -118,22 +118,22 @@ public: }; class Scene1200 : public SceneExt { - class Area1: public SceneArea { + class LaserPanel: public SceneArea { public: - class Actor3 : public SceneActorExt { + class Jumper : public SceneActorExt { public: void init(int state); virtual bool startAction(CursorType action, Event &event); }; SceneActor _actor2; - Actor3 _actor3; - Actor3 _actor4; - Actor3 _actor5; + Jumper _jumper1; + Jumper _jumper2; + Jumper _jumper3; byte _field20; - Area1(); + LaserPanel(); void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -146,7 +146,7 @@ class Scene1200 : public SceneExt { public: NamedHotspot _item1; SceneActor _actor1; - Area1 _area1; + LaserPanel _laserPanel; MazeUI _mazeUI; SequenceManager _sequenceManager; -- cgit v1.2.3 From 71b031be12540dc2e19935d2754191d2267d5e18 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 5 Jul 2013 01:44:15 +0200 Subject: COMMON: Initialize EventDispatcher::_autoFreeMapper. This fixes a branching on uninitialized variable reported by valgrind on startup. --- common/EventDispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index dc123e8f8f..e60c1aa7ff 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -24,7 +24,7 @@ namespace Common { -EventDispatcher::EventDispatcher() : _mapper(0) { +EventDispatcher::EventDispatcher() : _autoFreeMapper(false), _mapper(0) { } EventDispatcher::~EventDispatcher() { -- cgit v1.2.3 From 93987d999c61221bda3da548c8c81f5d6d906a12 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 02:56:12 +0300 Subject: COMMON: Fix crash when the keymapper and the event recorder are enabled DefaultEventManager registers a keymapper that is supposed to be auto-freed. However, the event recorder then sets itself as a new keymapper, but because the autofree flag is already set, registerMapper() ends up deleting the event recorder itself. Setting the autofree flag before actually freeing the mapper fixes the issue and prevents ScummVM from crashing on startup --- common/EventDispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index e60c1aa7ff..20a5b5eaac 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -71,11 +71,11 @@ void EventDispatcher::dispatch() { } void EventDispatcher::registerMapper(EventMapper *mapper, bool autoFree) { + _autoFreeMapper = autoFree; if (_autoFreeMapper) { delete _mapper; } _mapper = mapper; - _autoFreeMapper = autoFree; } -- cgit v1.2.3 From a5e969087b419710276ae08cac0565e144827292 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 02:57:21 +0300 Subject: CREATE_PROJECT: Add the event recorder to the feature flags --- devtools/create_project/create_project.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 6b6e86a187..129e9f2367 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -809,19 +809,20 @@ const Feature s_features[] = { {"freetype", "USE_FREETYPE2", "freetype", true, "FreeType support" }, // Feature flags - { "bink", "USE_BINK", "", true, "Bink video support" }, - { "scalers", "USE_SCALERS", "", true, "Scalers" }, - { "hqscalers", "USE_HQ_SCALERS", "", true, "HQ scalers" }, - { "16bit", "USE_RGB_COLOR", "", true, "16bit color support" }, - { "mt32emu", "USE_MT32EMU", "", true, "integrated MT-32 emulator" }, - { "nasm", "USE_NASM", "", true, "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling. - { "opengl", "USE_OPENGL", "opengl32", true, "OpenGL support" }, - { "taskbar", "USE_TASKBAR", "", true, "Taskbar integration support" }, - { "translation", "USE_TRANSLATION", "", true, "Translation support" }, - { "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"}, - { "keymapper","ENABLE_KEYMAPPER", "", false, "Keymapper support"}, - { "langdetect", "USE_DETECTLANG", "", true, "System language detection support" } // This feature actually depends on "translation", there - // is just no current way of properly detecting this... + { "bink", "USE_BINK", "", true, "Bink video support" }, + { "scalers", "USE_SCALERS", "", true, "Scalers" }, + { "hqscalers", "USE_HQ_SCALERS", "", true, "HQ scalers" }, + { "16bit", "USE_RGB_COLOR", "", true, "16bit color support" }, + { "mt32emu", "USE_MT32EMU", "", true, "integrated MT-32 emulator" }, + { "nasm", "USE_NASM", "", true, "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling. + { "opengl", "USE_OPENGL", "opengl32", true, "OpenGL support" }, + { "taskbar", "USE_TASKBAR", "", true, "Taskbar integration support" }, + { "translation", "USE_TRANSLATION", "", true, "Translation support" }, + { "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"}, + { "keymapper", "ENABLE_KEYMAPPER", "", false, "Keymapper support"}, + { "eventrecorder", "ENABLE_EVENTRECORDER", "", false, "Event recorder support"}, + { "langdetect", "USE_DETECTLANG", "", true, "System language detection support" } // This feature actually depends on "translation", there + // is just no current way of properly detecting this... }; const Tool s_tools[] = { -- cgit v1.2.3 From ecc43c9b92b0454b3a159b69d684c2ad331896fe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 03:05:54 +0300 Subject: Revert "COMMON: Fix crash when the keymapper and the event recorder are enabled" This reverts commit 93987d999c61221bda3da548c8c81f5d6d906a12. --- common/EventDispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp index 20a5b5eaac..e60c1aa7ff 100644 --- a/common/EventDispatcher.cpp +++ b/common/EventDispatcher.cpp @@ -71,11 +71,11 @@ void EventDispatcher::dispatch() { } void EventDispatcher::registerMapper(EventMapper *mapper, bool autoFree) { - _autoFreeMapper = autoFree; if (_autoFreeMapper) { delete _mapper; } _mapper = mapper; + _autoFreeMapper = autoFree; } -- cgit v1.2.3 From 701e6401849207c0dd76e20288a5621026329dd1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 13:09:43 +0300 Subject: CONFIGURE: Don't allow the keymapper and the event recorder to be enabled simultaneously --- configure | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configure b/configure index b8bab15ab9..e59a38b8a5 100755 --- a/configure +++ b/configure @@ -3798,6 +3798,16 @@ define_in_config_if_yes $_vkeybd 'ENABLE_VKEYBD' define_in_config_if_yes $_keymapper 'ENABLE_KEYMAPPER' define_in_config_if_yes $_eventrec 'ENABLE_EVENTRECORDER' +# +# Check if the keymapper and the event recorder are enabled simultaneously +# +if test "$_keymapper" = yes ; then + if test "$_eventrec" = yes ; then + echo "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two" + exit 1 + fi +fi + # Check whether to build translation support # echo_n "Building translation support... " -- cgit v1.2.3 From 4a12c691620de09011fda6f06b3a389566a4823c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Jul 2013 13:10:04 +0300 Subject: CREATE_PROJECT: Don't allow the keymapper and the event recorder to be enabled simultaneously --- devtools/create_project/create_project.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 129e9f2367..480f6a926a 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -310,6 +310,17 @@ int main(int argc, char *argv[]) { cout << " " << i->description << '\n'; } + // Check if the keymapper and the event recorder are enabled simultaneously + bool keymapperEnabled = false; + for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) { + if (i->enable && !strcmp(i->name, "keymapper")) + keymapperEnabled = true; + if (i->enable && !strcmp(i->name, "eventrecorder") && keymapperEnabled) { + std::cerr << "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two\n"; + return -1; + } + } + // Setup defines and libraries setup.defines = getEngineDefines(setup.engines); setup.libraries = getFeatureLibraries(setup.features); -- cgit v1.2.3 From f56d8bfc2ebf51090986897eef94308b0f04c652 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 5 Jul 2013 14:42:36 +0200 Subject: BASE: Fix --help output for --record-file-name. Formerly it claimed the command is --record-file. --- base/commandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 6f173a594d..a39c748adc 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -121,7 +121,7 @@ static const char HELP_STRING[] = #ifdef ENABLE_EVENTRECORDER " --record-mode=MODE Specify record mode for event recorder (record, playback,\n" " passthrough [default])\n" - " --record-file=FILE Specify record file name\n" + " --record-file-name=FILE Specify record file name\n" " --disable-display Disable any gfx output. Used for headless events\n" " playback by Event Recorder\n" #endif -- cgit v1.2.3 From 0c5e482eff7e75d40e29108e08e45f688fccc768 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 5 Jul 2013 20:38:41 -0400 Subject: NEWS: Mention MPEG-2 cutscenes --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index c31be14c25..98757ad9ae 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,12 @@ For a more comprehensive changelog of the latest experimental code, see: Gob: - Improved video quality in Urban Runner + Broken Sword 1: + - Added back support for MPEG-2 videos + + Broken Sword 2: + - Added back support for MPEG-2 videos + 1.6.0 (2013-05-31) New Games: - Added support for 3 Skulls of the Toltecs. -- cgit v1.2.3 From 6ffb969fd84ef5ce2ad1657e40fbbd5ccf037ddb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Jul 2013 21:09:58 -0400 Subject: TSAGE: Added enumeration for crawling direction in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 28 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes1.h | 4 +++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 7cd1e92b8b..1f15d5565a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1405,16 +1405,16 @@ void Scene1200::process(Event &event) { case CURSOR_WALK: event.handled = true; if ((event.mousePos.x > 179) && (event.mousePos.x < 210) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) - startCrawling(1); + startCrawling(CRAWL_EAST); if ((event.mousePos.x > 109) && (event.mousePos.x < 140) && (event.mousePos.y > 50) && (event.mousePos.y < 89)) - startCrawling(2); + startCrawling(CRAWL_WEST); if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 89) && (event.mousePos.y < 120)) - startCrawling(3); + startCrawling(CRAWL_SOUTH); if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 19) && (event.mousePos.y < 50)) - startCrawling(4); + startCrawling(CRAWL_NORTH); break; case CURSOR_USE: if (cellId > 36) { @@ -1523,19 +1523,19 @@ void Scene1200::process(Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_1: warning("FIXME: keycode = 0x4800"); - startCrawling(4); + startCrawling(CRAWL_NORTH); break; case Common::KEYCODE_2: warning("FIXME: keycode = 0x4B00"); - startCrawling(2); + startCrawling(CRAWL_WEST); break; case Common::KEYCODE_3: warning("FIXME: keycode = 0x4D00"); - startCrawling(1); + startCrawling(CRAWL_EAST); break; case Common::KEYCODE_4: warning("FIXME: keycode = 0x5000"); - startCrawling(3); + startCrawling(CRAWL_SOUTH); break; default: event.handled = false; @@ -1616,12 +1616,12 @@ void Scene1200::saveCharacter(int characterIndex) { SceneExt::saveCharacter(characterIndex); } -void Scene1200::startCrawling(int indx) { +void Scene1200::startCrawling(CrawlDirection dir) { Common::Point cellPos = Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4); _mazeUI.pixelToCellXY(cellPos); - switch (indx) { - case 1: + switch (dir) { + case CRAWL_EAST: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(200, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(200, 88)) > 36)) && ( ((cellPos.x == 3) && (cellPos.y == 33) && (_field418 != 4)) || ((cellPos.x == 13) && (cellPos.y == 21) && (_field418 != 2)) @@ -1665,7 +1665,7 @@ void Scene1200::startCrawling(int indx) { signal(); } break; - case 2: + case CRAWL_WEST: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(120, 50)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(120, 88)) > 36)) && ( ((cellPos.x == 7) && (cellPos.y == 33) && (_field418 != 4)) || ((cellPos.x == 17) && (cellPos.y == 21) && (_field418 != 2)) @@ -1709,7 +1709,7 @@ void Scene1200::startCrawling(int indx) { signal(); } break; - case 3: + case CRAWL_SOUTH: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 110)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 110)) > 36)) && ( ((cellPos.x == 17) && (cellPos.y == 5) && (_field418 != 3)) || ((cellPos.x == 41) && (cellPos.y == 21)) ) @@ -1751,7 +1751,7 @@ void Scene1200::startCrawling(int indx) { signal(); } break; - case 4: + case CRAWL_NORTH: if ( ((_mazeUI.getCellFromPixelXY(Common::Point(140, 30)) > 36) || (_mazeUI.getCellFromPixelXY(Common::Point(178, 30)) > 36)) && ( ((cellPos.x == 17) && (cellPos.y == 9) && (_field418 != 3)) || ((cellPos.x == 35) && (cellPos.y == 17)) ) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 626e596f0b..3e75d83333 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -118,6 +118,8 @@ public: }; class Scene1200 : public SceneExt { + enum CrawlDirection { CRAWL_EAST = 1, CRAWL_WEST = 2, CRAWL_SOUTH = 3, CRAWL_NORTH = 4 }; + class LaserPanel: public SceneArea { public: class Jumper : public SceneActorExt { @@ -160,7 +162,7 @@ public: Scene1200(); void synchronize(Serializer &s); - void startCrawling(int indx); + void startCrawling(CrawlDirection dir); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); -- cgit v1.2.3 From 30bd58649031d3174c81cddb45a0ee44652195fd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Jul 2013 21:10:58 -0400 Subject: TSAGE: Bugfix for disappearing player in R2R scene 1200 --- engines/tsage/core.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 131b70c4bd..11063f985e 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2724,7 +2724,9 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i } void SceneObject::setup(int visage, int stripFrameNum, int frameNum) { - postInit(); + if (g_vm->getGameID() != GType_Ringworld2) + postInit(); + setVisage(visage); setStrip(stripFrameNum); setFrame(frameNum); -- cgit v1.2.3 From 9fb96a9256348c3b00b045614ddf9f8d96e833cf Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 6 Jul 2013 04:05:22 +0100 Subject: AUDIO: Further fix to ReportHandlerScummVM::printDebug in MT32 code. --- audio/softsynth/mt32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 3281e3bebf..29f5e3577c 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -63,7 +63,7 @@ protected: // Callback for debug messages, in vprintf() format void printDebug(const char *fmt, va_list list) { Common::String out = Common::String::vformat(fmt, list); - debug(4, out.c_str()); + debug(4, "%s", out.c_str()); } // Callbacks for reporting various errors and information -- cgit v1.2.3 From a0b6046496582a1ce216bf67bd1eb19121eeab58 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 5 Jul 2013 23:08:47 -0400 Subject: BUILD: Fix Mac static build with libmpeg2 --- ports.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports.mk b/ports.mk index 7a3bf0fabd..892d2d57c3 100644 --- a/ports.mk +++ b/ports.mk @@ -139,6 +139,10 @@ ifdef USE_FAAD OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libfaad.a endif +ifdef USE_MPEG2 +OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmpeg2.a +endif + ifdef USE_ZLIB OSX_ZLIB ?= $(STATICLIBPATH)/lib/libz.a endif -- cgit v1.2.3 From 3490091ba2aadc3b812725dd2073f6b9dbbd9254 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 6 Jul 2013 07:31:28 +0300 Subject: RECORDER: Fix tests compilation. Patch by D G Turner --- common/system.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/system.cpp b/common/system.cpp index b40072afad..d86b5b2b81 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -30,7 +30,9 @@ #include "common/taskbar.h" #include "common/updates.h" #include "common/textconsole.h" +#ifdef ENABLE_EVENTRECORDER #include "gui/EventRecorder.h" +#endif #include "backends/audiocd/default/default-audiocd.h" #include "backends/fs/fs-factory.h" @@ -159,5 +161,9 @@ Common::TimerManager *OSystem::getTimerManager() { } Common::SaveFileManager *OSystem::getSavefileManager() { +#ifdef ENABLE_EVENTRECORDER return g_eventRec.getSaveManager(_savefileManager); +#else + return _savefileManager; +#endif } -- cgit v1.2.3 From 1ed1106cb26075ade504e342cfea32a6266c1ea1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 6 Jul 2013 05:39:51 +0100 Subject: CONFIGURE: Add missing help messages for newer feature options.. --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 22f2377167..5a7b310fd4 100755 --- a/configure +++ b/configure @@ -900,6 +900,10 @@ Optional Features: --disable-hq-scalers exclude HQ2x and HQ3x scalers --disable-translation don't build support for translated messages --disable-taskbar don't build support for taskbar and launcher integration + --enable-vkeybd build virtual keyboard support + --enable-keymapper build key mapper support + --enable-eventrecorder enable event recording functionality + --disable-eventrecorder disable event recording functionality --enable-updates build support for updates --enable-text-console use text console instead of graphical console --enable-verbose-build enable regular echoing of commands during build -- cgit v1.2.3 From 29bc36d0708f228f18ed7a75bcadb72fed9fb55a Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 6 Jul 2013 14:03:31 +0200 Subject: SCUMM: Fix initGM() buffer overflow (CID 1032513) We're clearly using 12 bytes, not 11. --- engines/scumm/imuse/imuse.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 12ebfef9b7..7f771a0265 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -1483,7 +1483,7 @@ void IMuseInternal::initMT32(MidiDriver *midi) { } void IMuseInternal::initGM(MidiDriver *midi) { - byte buffer[11]; + byte buffer[12]; int i; // General MIDI System On message @@ -1540,7 +1540,7 @@ void IMuseInternal::initGM(MidiDriver *midi) { // Set Channels 1-16 Reverb to 64, which is the // equivalent of MT-32 default Reverb Level 5 for (i = 0; i < 16; ++i) - midi->send((64 << 16) | (91 << 8) | (0xB0 | i)); + midi->send((64 << 16) | (91 << 8) | (0xB0 | i)); debug(2, "GM Controller 91 Change: Channels 1-16 Reverb Level is 64"); // Set Channels 1-16 Pitch Bend Sensitivity to -- cgit v1.2.3 From 0154c85c6d251b8ad718b6bb9f62d82bc4720020 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Jul 2013 10:34:12 -0400 Subject: TSAGE: Fix for refreshing background and vertical sprite flipping in R2R scene 1200 --- engines/tsage/core.cpp | 24 ++++++++++++++++++++-- engines/tsage/core.h | 4 +++- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 27 +++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes1.h | 3 ++- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 11063f985e..1f3745d085 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3105,6 +3105,7 @@ Visage::Visage() { _rlbNum = -1; _data = NULL; _flipHoriz = false; + _flipVert = false; } Visage::Visage(const Visage &v) { @@ -3114,6 +3115,7 @@ Visage::Visage(const Visage &v) { if (_data) g_vm->_memoryManager.incLocks(_data); _flipHoriz = false; + _flipVert = false; } Visage &Visage::operator=(const Visage &s) { @@ -3157,6 +3159,7 @@ void Visage::setVisage(int resNum, int rlbNum) { rlbNum = (int)(v & 0xff); } _flipHoriz = flags & 1; + _flipVert = flags & 2; _data = g_resourceManager->getResource(RES_VISAGE, resNum, rlbNum); @@ -3183,7 +3186,9 @@ GfxSurface Visage::getFrame(int frameNum) { byte *frameData = _data + offset; GfxSurface result = surfaceFromRes(frameData); - if (_flipHoriz) flip(result); + if (_flipHoriz) flipHorizontal(result); + if (_flipVert) flipVertical(result); + return result; } @@ -3191,7 +3196,7 @@ int Visage::getFrameCount() const { return READ_LE_UINT16(_data); } -void Visage::flip(GfxSurface &gfxSurface) { +void Visage::flipHorizontal(GfxSurface &gfxSurface) { Graphics::Surface s = gfxSurface.lockSurface(); for (int y = 0; y < s.h; ++y) { @@ -3204,6 +3209,21 @@ void Visage::flip(GfxSurface &gfxSurface) { gfxSurface.unlockSurface(); } +void Visage::flipVertical(GfxSurface &gfxSurface) { + Graphics::Surface s = gfxSurface.lockSurface(); + + for (int y = 0; y < s.h / 2; ++y) { + // Flip the lines1 + byte *line1P = (byte *)s.getBasePtr(0, y); + byte *line2P = (byte *)s.getBasePtr(0, s.h - y - 1); + + for (int x = 0; x < s.w; ++x) + SWAP(line1P[x], line2P[x]); + } + + gfxSurface.unlockSurface(); +} + /*--------------------------------------------------------------------------*/ Player::Player(): SceneObject() { diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 296754011e..655bd234e6 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -472,11 +472,13 @@ class Visage { private: byte *_data; - void flip(GfxSurface &s); + void flipHorizontal(GfxSurface &s); + void flipVertical(GfxSurface &s); public: int _resNum; int _rlbNum; bool _flipHoriz; + bool _flipVert; public: Visage(); Visage(const Visage &v); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 1f15d5565a..72000daa54 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -868,7 +868,8 @@ Scene1200::Scene1200() { _field416 = 0; _field418 = 0; _field41A = 0; - _field41C = 1; //CHECKME: Only if fixup_flag == 6?? + _fixupMaze = false; + _drawMaze = true; } void Scene1200::synchronize(Serializer &s) { @@ -879,7 +880,8 @@ void Scene1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field416); s.syncAsSint16LE(_field418); s.syncAsSint16LE(_field41A); - s.syncAsSint16LE(_field41C); + s.syncAsSint16LE(_fixupMaze); + s.syncAsSint16LE(_drawMaze); } Scene1200::LaserPanel::LaserPanel() { @@ -1035,6 +1037,7 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) { _jumper3.init(3); R2_GLOBALS._player._canWalk = false; + scene->_drawMaze = false; } void Scene1200::LaserPanel::remove() { @@ -1057,6 +1060,7 @@ void Scene1200::LaserPanel::remove() { // R2_GLOBALS._player._canWalk = true; + scene->_drawMaze = true; } void Scene1200::LaserPanel::process(Event &event) { @@ -1067,19 +1071,16 @@ void Scene1200::LaserPanel::process(Event &event) { if (_actor2._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { if (cursor == _cursorNum) { - warning("TODO: _cursorState = ???"); - R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + R2_GLOBALS._events.setCursor(_savedCursorNum); } } else if (event.mousePos.y < 168) { if (cursor != _cursorNum) { _savedCursorNum = cursor; - warning("TODO: _cursorState = ???"); R2_GLOBALS._events.setCursor(CURSOR_INVALID); } if (event.eventType == EVENT_BUTTON_DOWN) { event.handled = true; - warning("TODO: _cursorState = ???"); - R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState); + R2_GLOBALS._events.setCursor(_savedCursorNum); remove(); } } @@ -1114,7 +1115,6 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _field416 = 0; _field418 = 0; _field41A = 0; - _field41C = 0; if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1)) _field418 = 1; @@ -1139,9 +1139,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _mazeUI.load(1); _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - warning("int unk = set_pane_p(_paneNumber);"); _mazeUI.draw(); - warning("set_pane_p(unk);"); R2_GLOBALS._player.enableControl(); _item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL); @@ -1550,15 +1548,18 @@ void Scene1200::process(Event &event) { void Scene1200::dispatch() { Rect tmpRect; Scene::dispatch(); - if (_field41C != 0) { + + if (_fixupMaze) { _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); _mazeUI.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); - _field41C = 0; + _fixupMaze = false; } - _mazeUI.draw(); //**DEBUG** + + if (_drawMaze) + _mazeUI.draw(); if (_field414 != 0) { tmpRect.set(110, 20, 210, 120); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 3e75d83333..08fcd69d6f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -157,7 +157,8 @@ public: int _field416; int _field418; int _field41A; - int _field41C; + bool _fixupMaze; + bool _drawMaze; Scene1200(); void synchronize(Serializer &s); -- cgit v1.2.3 From d4435e441a5e908818334cb51116a7e9d67f6916 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Jul 2013 13:28:15 -0400 Subject: TSAGE: Fix for player rotating north to south in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 72000daa54..853638ffd6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1336,7 +1336,7 @@ void Scene1200::signal() { case 111: // No break on purpose case 116: - R2_GLOBALS._player.setup(3157, 3, 1); + R2_GLOBALS._player.setup(3157, 4, 1); R2_GLOBALS._player.animate(ANIM_MODE_5, this); break; case 78: -- cgit v1.2.3 From 4a201ba6cfbe47598bb3676adf08a2b5ac3ca6da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Jul 2013 15:25:34 -0400 Subject: TSAGE: Fix to show player on top of maze correctly in R2R scene 1200 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 42 ++++++++++++++----------- engines/tsage/ringworld2/ringworld2_logic.h | 8 ++--- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 10 ------ engines/tsage/ringworld2/ringworld2_scenes1.h | 1 - 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index b7034fd49c..ebb09a7e08 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1303,6 +1303,7 @@ void MazeUI::synchronize(Serializer &s) { } void MazeUI::load(int resNum) { + postInit(); clear(); _resNum = resNum; @@ -1324,8 +1325,8 @@ void MazeUI::load(int resNum) { _mapData = g_resourceManager->getResource(RT17, resNum, 1); _mapOffset.y = _mapOffset.x = 0; - _cellsVisible.x = (_displayBounds.width() + _cellSize.x - 1) / _cellSize.x; - _cellsVisible.y = (_displayBounds.height() + _cellSize.y - 1) / _cellSize.y; + _cellsVisible.x = (_bounds.width() + _cellSize.x - 1) / _cellSize.x; + _cellsVisible.y = (_bounds.height() + _cellSize.y - 1) / _cellSize.y; _mapImagePitch = (_cellsVisible.x + 1) * _cellSize.x; _mapImage.create(_mapImagePitch, _cellSize.y); @@ -1359,25 +1360,28 @@ bool MazeUI::setMazePosition(const Common::Point &pt) { retval = true; } - if (_mapOffset.x + _displayBounds.width() > _mapBounds.right) { - _mapOffset.x = _mapBounds.right - _displayBounds.width(); + if (_mapOffset.x + _bounds.width() > _mapBounds.right) { + _mapOffset.x = _mapBounds.right - _bounds.width(); retval = true; } - if (_mapOffset.y + _displayBounds.height() > _mapBounds.bottom) { - _mapOffset.y = _mapBounds.bottom - _displayBounds.height(); + if (_mapOffset.y + _bounds.height() > _mapBounds.bottom) { + _mapOffset.y = _mapBounds.bottom - _bounds.height(); retval = true; } return retval; } +void MazeUI::reposition() { +} + void MazeUI::draw() { int yPos = 0; int ySize; Visage visage; - _cellsVisible.y = ((_mapOffset.y % _cellSize.y) + _displayBounds.height() + + _cellsVisible.y = ((_mapOffset.y % _cellSize.y) + _bounds.height() + (_cellSize.y - 1)) / _cellSize.y; // Loop to handle the cell rows of the visible display area one at a time @@ -1411,24 +1415,24 @@ void MazeUI::draw() { if (yPos == 0) { // First line of the map to be displayed - only the bottom portion of that // first cell row may be visible - yPos = _displayBounds.top; + yPos = _bounds.top; ySize = _cellSize.y - (_mapOffset.y % _cellSize.y); Rect srcBounds(_mapOffset.x % _cellSize.x, _mapOffset.y % _cellSize.y, - (_mapOffset.x % _cellSize.x) + _displayBounds.width(), _cellSize.y); - Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize); + (_mapOffset.x % _cellSize.x) + _bounds.width(), _cellSize.y); + Rect destBounds(_bounds.left, yPos, _bounds.right, yPos + ySize); R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } else { - if ((yPos + _cellSize.y) < _displayBounds.bottom) { + if ((yPos + _cellSize.y) < _bounds.bottom) { ySize = _cellSize.y; } else { - ySize = _displayBounds.bottom - yPos; + ySize = _bounds.bottom - yPos; } Rect srcBounds(_mapOffset.x % _cellSize.x, 0, - (_mapOffset.x % _cellSize.x) + _displayBounds.width(), ySize); - Rect destBounds(_displayBounds.left, yPos, _displayBounds.right, yPos + ySize); + (_mapOffset.x % _cellSize.x) + _bounds.width(), ySize); + Rect destBounds(_bounds.left, yPos, _bounds.right, yPos + ySize); R2_GLOBALS.gfxManager().copyFrom(_mapImage, srcBounds, destBounds); } @@ -1436,11 +1440,11 @@ void MazeUI::draw() { } int MazeUI::getCellFromPixelXY(const Common::Point &pt) { - if (!_displayBounds.contains(pt)) + if (!_bounds.contains(pt)) return -1; - int cellX = (pt.x - _displayBounds.left + _mapOffset.x) / _cellSize.x; - int cellY = (pt.y - _displayBounds.top + _mapOffset.y) / _cellSize.y; + int cellX = (pt.x - _bounds.left + _mapOffset.x) / _cellSize.x; + int cellY = (pt.y - _bounds.top + _mapOffset.y) / _cellSize.y; if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); @@ -1468,8 +1472,8 @@ int MazeUI::pixelToCellXY(Common::Point &pt) { } void MazeUI::setDisplayBounds(const Rect &r) { - _displayBounds = r; - _displayBounds.clip(g_globals->gfxManager()._bounds); + _bounds = r; + _bounds.clip(g_globals->gfxManager()._bounds); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 5a0eecc56c..24434568ad 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -280,12 +280,10 @@ enum MazeDirection { MAZEDIR_NONE = 0, MAZEDIR_NORTH = 1, MAZEDIR_NORTHEAST = 2, MAZEDIR_SOUTHEAST = 4, MAZEDIR_SOUTH = 5, MAZEDIR_SOUTHWEST = 6, MAZEDIR_WEST = 7, MAZEDIR_NORTHWEST = 8 }; -class MazeUI: public SavedObject { +class MazeUI: public SceneObject { private: void clear(); public: - // Position on screen to show map - Rect _displayBounds; // The dimensions (in cells) of the entire maze map Rect _mapBounds; @@ -307,16 +305,18 @@ public: public: MazeUI(); virtual ~MazeUI(); + void setDisplayBounds(const Rect &r); bool setMazePosition(const Common::Point &pt); void load(int resNum); - void draw(); int getCellFromPixelXY(const Common::Point &pt); int getCellFromCellXY(const Common::Point &p); int pixelToCellXY(Common::Point &pt); virtual Common::String getClassName() { return "MazeUI"; } void synchronize(Serializer &s); + virtual void reposition(); + virtual void draw(); }; class SceneAreaObject: public SceneArea { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 853638ffd6..59736989ee 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -869,7 +869,6 @@ Scene1200::Scene1200() { _field418 = 0; _field41A = 0; _fixupMaze = false; - _drawMaze = true; } void Scene1200::synchronize(Serializer &s) { @@ -881,7 +880,6 @@ void Scene1200::synchronize(Serializer &s) { s.syncAsSint16LE(_field418); s.syncAsSint16LE(_field41A); s.syncAsSint16LE(_fixupMaze); - s.syncAsSint16LE(_drawMaze); } Scene1200::LaserPanel::LaserPanel() { @@ -1037,7 +1035,6 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) { _jumper3.init(3); R2_GLOBALS._player._canWalk = false; - scene->_drawMaze = false; } void Scene1200::LaserPanel::remove() { @@ -1057,10 +1054,8 @@ void Scene1200::LaserPanel::remove() { _actor2.remove(); SceneArea::remove(); R2_GLOBALS._insetUp--; - // R2_GLOBALS._player._canWalk = true; - scene->_drawMaze = true; } void Scene1200::LaserPanel::process(Event &event) { @@ -1139,7 +1134,6 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _mazeUI.load(1); _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - _mazeUI.draw(); R2_GLOBALS._player.enableControl(); _item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL); @@ -1551,16 +1545,12 @@ void Scene1200::dispatch() { if (_fixupMaze) { _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - _mazeUI.draw(); warning("_gfxManager.sub294AC(unk);"); warning("tmpRect.sub14DF3();"); _fixupMaze = false; } - if (_drawMaze) - _mazeUI.draw(); - if (_field414 != 0) { tmpRect.set(110, 20, 210, 120); _field414--; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 08fcd69d6f..1b6ca768ef 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -158,7 +158,6 @@ public: int _field418; int _field41A; bool _fixupMaze; - bool _drawMaze; Scene1200(); void synchronize(Serializer &s); -- cgit v1.2.3 From bd82ca97c228edb1f526a8a88a9f370daab8de95 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Jul 2013 17:01:49 -0400 Subject: TSAGE: Minor R2R scene bugfixes --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 5 ++++- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 3b7d283e44..0c0376f559 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2708,6 +2708,8 @@ void Scene250::signal() { case 7: _field418 = 1; if ((_field414 + 12) == _field412) + _sceneMode = 9; + else _sceneMode = 8; signal(); break; @@ -3181,8 +3183,9 @@ void Scene300::synchronize(Serializer &s) { } void Scene300::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(300); + SceneExt::postInit(); + _sound1.play(23); setZoomPercents(75, 93, 120, 100); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 59736989ee..dd29488bea 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1571,10 +1571,9 @@ void Scene1200::dispatch() { break; } _mazeUI.setMazePosition(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); - warning("int unk = set_pane_p(_paneNumber);"); - _mazeUI.draw(); - warning("_gfxManager.sub294AC(unk);"); - warning("tmpRect.sub14DF3();"); + + debug("_gfxManager.sub294AC(unk);"); + debug("tmpRect.sub14DF3();"); if (_field416 != 0) { switch(_field412 - 1) { -- cgit v1.2.3 From ba9b17fa35eba38fada396ab98e15f850a21895e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 6 Jul 2013 23:59:47 +0200 Subject: MORTEVIELLE: Remove unused const --- engines/mortevielle/mortevielle.h | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 486f93f260..8f9df4a1e1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -136,7 +136,6 @@ const int kMenuPlaceStringIndex = 435; const int kMenuActionStringIndex = 476; const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; -const int kSecretPassageQuestionStringIndex = 510; // Unused? const int kMaxPatt = 20; const int OPCODE_NONE = 0; -- cgit v1.2.3 From 4a7e4e5b22da3587a9d68978d7be31e4e78a8ccc Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 6 Jul 2013 23:54:45 -0400 Subject: ALL: Don't use EventRecorder at all when not compiled in --- audio/mixer.cpp | 8 +++++++ backends/modular-backend.cpp | 6 +++++ backends/platform/sdl/sdl.cpp | 27 +++++++++++++++++++++ base/main.cpp | 6 +++++ common/random.cpp | 8 +++++-- engines/advancedDetector.cpp | 2 ++ gui/EventRecorder.cpp | 4 ++-- gui/EventRecorder.h | 55 ------------------------------------------- gui/gui-manager.cpp | 4 ++++ 9 files changed, 61 insertions(+), 59 deletions(-) diff --git a/audio/mixer.cpp b/audio/mixer.cpp index ab3ed9eb2d..9e6e4596e2 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -429,7 +429,11 @@ void MixerImpl::pauseHandle(SoundHandle handle, bool paused) { bool MixerImpl::isSoundIDActive(int id) { Common::StackLock lock(_mutex); + +#ifdef ENABLE_EVENTRECORDER g_eventRec.updateSubsystems(); +#endif + for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->getId() == id) return true; @@ -446,7 +450,11 @@ int MixerImpl::getSoundID(SoundHandle handle) { bool MixerImpl::isSoundHandleActive(SoundHandle handle) { Common::StackLock lock(_mutex); + +#ifdef ENABLE_EVENTRECORDER g_eventRec.updateSubsystems(); +#endif + const int index = handle._val % NUM_CHANNELS; return _channels[index] && _channels[index]->getHandle()._val == handle._val; } diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index d84df75439..6afe06aeca 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -142,9 +142,15 @@ void ModularBackend::fillScreen(uint32 col) { } void ModularBackend::updateScreen() { +#ifdef ENABLE_EVENTRECORDER g_eventRec.preDrawOverlayGui(); +#endif + _graphicsManager->updateScreen(); + +#ifdef ENABLE_EVENTRECORDER g_eventRec.postDrawOverlayGui(); +#endif } void ModularBackend::setShakePos(int shakeOffset) { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index f55dd277c7..7ab367d4a4 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -98,7 +98,13 @@ OSystem_SDL::~OSystem_SDL() { delete _mixerManager; _mixerManager = 0; +#ifdef ENABLE_EVENTRECORDER + // HACK HACK HACK + // This is nasty. delete g_eventRec.getTimerManager(); +#else + delete _timerManager; +#endif _timerManager = 0; delete _mutexManager; @@ -193,9 +199,15 @@ void OSystem_SDL::initBackend() { // Setup and start mixer _mixerManager->init(); } + +#ifdef ENABLE_EVENTRECORDER g_eventRec.registerMixerManager(_mixerManager); g_eventRec.registerTimerManager(new SdlTimerManager()); +#else + if (_timerManager == 0) + _timerManager = new SdlTimerManager(); +#endif if (_audiocdManager == 0) { // Audio CD support was removed with SDL 1.3 @@ -470,12 +482,18 @@ void OSystem_SDL::setupIcon() { uint32 OSystem_SDL::getMillis(bool skipRecord) { uint32 millis = SDL_GetTicks(); + +#ifdef ENABLE_EVENTRECORDER g_eventRec.processMillis(millis, skipRecord); +#endif + return millis; } void OSystem_SDL::delayMillis(uint msecs) { +#ifdef ENABLE_EVENTRECORDER if (!g_eventRec.processDelayMillis()) +#endif SDL_Delay(msecs); } @@ -498,11 +516,20 @@ Audio::Mixer *OSystem_SDL::getMixer() { SdlMixerManager *OSystem_SDL::getMixerManager() { assert(_mixerManager); + +#ifdef ENABLE_EVENTRECORDER return g_eventRec.getMixerManager(); +#else + return _mixerManager; +#endif } Common::TimerManager *OSystem_SDL::getTimerManager() { +#ifdef ENABLE_EVENTRECORDER return g_eventRec.getTimerManager(); +#else + return _timerManager; +#endif } #ifdef USE_OPENGL diff --git a/base/main.cpp b/base/main.cpp index 3f51c97949..103d743bbc 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -427,6 +427,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // take place after the backend is initiated and the screen has been setup system.getEventManager()->init(); +#ifdef ENABLE_EVENTRECORDER // Directly after initializing the event manager, we will initialize our // event recorder. // @@ -434,6 +435,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // our event recorder, we might do this at another place. Or even change // the whole API for that ;-). g_eventRec.RegisterEventSource(); +#endif // Now as the event manager is created, setup the keymapper setupKeymapper(system); @@ -471,9 +473,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // Try to run the game Common::Error result = runGame(plugin, system, specialDebug); +#ifdef ENABLE_EVENTRECORDER // Flush Event recorder file. The recorder does not get reinitialized for next game // which is intentional. Only single game per session is allowed. g_eventRec.deinit(); +#endif #if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) // do our best to prevent fragmentation by unloading as soon as we can @@ -526,7 +530,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { GUI::GuiManager::destroy(); Common::ConfigManager::destroy(); Common::DebugManager::destroy(); +#ifdef ENABLE_EVENTRECORDER GUI::EventRecorder::destroy(); +#endif Common::SearchManager::destroy(); #ifdef USE_TRANSLATION Common::TranslationManager::destroy(); diff --git a/common/random.cpp b/common/random.cpp index a74ab831ea..de1269b485 100644 --- a/common/random.cpp +++ b/common/random.cpp @@ -30,8 +30,12 @@ RandomSource::RandomSource(const String &name) { // Use system time as RNG seed. Normally not a good idea, if you are using // a RNG for security purposes, but good enough for our purposes. assert(g_system); - uint32 seed = g_eventRec.getRandomSeed(name); - setSeed(seed); + +#ifdef ENABLE_EVENTRECORDER + setSeed(g_eventRec.getRandomSeed(name)); +#else + setSeed(g_system->getMillis()); +#endif } void RandomSource::setSeed(uint32 seed) { diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 9023548c83..fd0c8dc2da 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -609,7 +609,9 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con } void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const { +#ifdef ENABLE_EVENTRECORDER if (gameDesc) { g_eventRec.processGameDescription(gameDesc); } +#endif } diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 47358a0b3d..d8cb0b8830 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -23,12 +23,12 @@ #include "gui/EventRecorder.h" +#ifdef ENABLE_EVENTRECORDER + namespace Common { DECLARE_SINGLETON(GUI::EventRecorder); } -#ifdef ENABLE_EVENTRECORDER - #include "common/debug-channels.h" #include "backends/timer/sdl/sdl-timer.h" #include "backends/mixer/sdl/sdl-mixer.h" diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h index 3e32d89232..4abefc05f5 100644 --- a/gui/EventRecorder.h +++ b/gui/EventRecorder.h @@ -233,61 +233,6 @@ private: } // End of namespace GUI -#else - -#ifdef SDL_BACKEND -#include "backends/timer/default/default-timer.h" -#include "backends/mixer/sdl/sdl-mixer.h" -#endif - -#define g_eventRec (GUI::EventRecorder::instance()) - -namespace GUI { - -class EventRecorder : private Common::EventSource, public Common::Singleton, private Common::DefaultEventMapper { - friend class Common::Singleton; - - public: - EventRecorder() { -#ifdef SDL_BACKEND - _timerManager = NULL; - _realMixerManager = NULL; -#endif - } - ~EventRecorder() {} - - bool pollEvent(Common::Event &ev) { return false; } - void RegisterEventSource() {} - void deinit() {} - void suspendRecording() {} - void resumeRecording() {} - void preDrawOverlayGui() {} - void postDrawOverlayGui() {} - void processGameDescription(const ADGameDescription *desc) {} - void updateSubsystems() {} - uint32 getRandomSeed(const Common::String &name) { return g_system->getMillis(); } - Common::SaveFileManager *getSaveManager(Common::SaveFileManager *realSaveManager) { return realSaveManager; } - -#ifdef SDL_BACKEND - private: - DefaultTimerManager *_timerManager; - SdlMixerManager *_realMixerManager; - - public: - DefaultTimerManager *getTimerManager() { return _timerManager; } - void registerTimerManager(DefaultTimerManager *timerManager) { _timerManager = timerManager; } - - SdlMixerManager *getMixerManager() { return _realMixerManager; } - void registerMixerManager(SdlMixerManager *mixerManager) { _realMixerManager = mixerManager; } - - void processMillis(uint32 &millis, bool skipRecord) {} - bool processDelayMillis() { return false; } -#endif - -}; - -} // namespace GUI - #endif // ENABLE_EVENTRECORDER #endif diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 78b40a46ce..1505c8c707 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -258,8 +258,10 @@ void GuiManager::runLoop() { if (activeDialog == 0) return; +#ifdef ENABLE_EVENTRECORDER // Suspend recording while GUI is shown g_eventRec.suspendRecording(); +#endif if (!_stateIsSaved) { saveState(); @@ -361,8 +363,10 @@ void GuiManager::runLoop() { _useStdCursor = false; } +#ifdef ENABLE_EVENTRECORDER // Resume recording once GUI is shown g_eventRec.resumeRecording(); +#endif } #pragma mark - -- cgit v1.2.3 From 747863e4f5a2ea7f5988f4ea38fe6dffa4e37854 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 16:48:52 +0300 Subject: CREATE_PROJECT: Add the libfaad and libmpeg2 libraries --- devtools/create_project/create_project.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 480f6a926a..8b8aaef042 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -816,6 +816,8 @@ const Feature s_features[] = { { "vorbis", "USE_VORBIS", "libvorbisfile_static libvorbis_static libogg_static", true, "Ogg Vorbis support" }, { "flac", "USE_FLAC", "libFLAC_static", true, "FLAC support" }, { "png", "USE_PNG", "libpng", true, "libpng support" }, + { "faad", "USE_FAAD", "libfaad", false, "AAC support" }, + { "mpeg2", "USE_MPEG2", "libmpeg2", false, "MPEG-2 support" }, { "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" }, {"freetype", "USE_FREETYPE2", "freetype", true, "FreeType support" }, -- cgit v1.2.3 From 32c62aaf80497b24a141045aba2ceec0fd2eb60b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 7 Jul 2013 16:09:42 +0200 Subject: MORTEVIELLE: Some renaming in Mortevielle.h --- engines/mortevielle/mortevielle.h | 8 ++++---- engines/mortevielle/utils.cpp | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 8f9df4a1e1..dcb61a6057 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -125,8 +125,8 @@ const int kArep = 1314; const int kAmzon = 1650; const int kArega = 0; -const int kMaxTi = 9000; -const int kMaxTd = 600; +const int kMaxDialogIndex = 9000; +const int kMaxDialogHint = 600; const int kDescriptionStringIndex = 0; // Unused const int kInventoryStringIndex = 186; @@ -281,8 +281,8 @@ private: int _openObjects[8]; int _nbrep[9]; int _nbrepm[9]; - uint16 _inpBuffer[kMaxTi + 1]; - Hint _ntpBuffer[kMaxTd + 1]; + uint16 _dialogIndexArray[kMaxDialogIndex + 1]; + Hint _dialogHintArray[kMaxDialogHint + 1]; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 9b140fc761..78a4db8ad2 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1849,13 +1849,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { uint16 oct, ocd; /* 5-8 */ - oct = _inpBuffer[idx]; + oct = _dialogIndexArray[idx]; oct = ((uint16)(oct << (16 - pt))) >> (16 - pt); if (pt < 6) { ++idx; oct = oct << (5 - pt); pt += 11; - oct = oct | ((uint)_inpBuffer[idx] >> pt); + oct = oct | ((uint)_dialogIndexArray[idx] >> pt); } else { pt -= 5; oct = (uint)oct >> pt; @@ -1865,13 +1865,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { c = '$'; the_end = true; } else if (oct == 30 || oct == 31) { - ocd = _inpBuffer[idx]; + ocd = _dialogIndexArray[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); if (pt < 6) { ++idx; ocd = ocd << (5 - pt); pt += 11; - ocd = ocd | ((uint)_inpBuffer[idx] >> pt); + ocd = ocd | ((uint)_dialogIndexArray[idx] >> pt); } else { pt -= 5; ocd = (uint)ocd >> pt; @@ -1903,8 +1903,8 @@ Common::String MortevielleEngine::getString(int num) { } else if (!_txxFileFl) { wrkStr = getGameString(num); } else { - int hint = _ntpBuffer[num]._hintId; - byte point = _ntpBuffer[num]._point; + int hint = _dialogHintArray[num]._hintId; + byte point = _dialogHintArray[num]._point; int length = 0; bool endFl = false; char let; @@ -2116,20 +2116,20 @@ void MortevielleEngine::loadTexts() { return; } - if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) { + if ((inpFile.size() > (kMaxDialogIndex * 2)) || (ntpFile.size() > (kMaxDialogHint * 3))) { warning("TXX file - Unexpected format - Switching to DAT file"); return; } for (int i = 0; i < inpFile.size() / 2; ++i) - _inpBuffer[i] = inpFile.readUint16LE(); + _dialogIndexArray[i] = inpFile.readUint16LE(); inpFile.close(); _txxFileFl = true; for (int i = 0; i < (ntpFile.size() / 3); ++i) { - _ntpBuffer[i]._hintId = ntpFile.readSint16LE(); - _ntpBuffer[i]._point = ntpFile.readByte(); + _dialogHintArray[i]._hintId = ntpFile.readSint16LE(); + _dialogHintArray[i]._point = ntpFile.readByte(); } ntpFile.close(); -- cgit v1.2.3 From 98899c6ce37141e6342ed9a5062ac03e726d0b4f Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 7 Jul 2013 05:42:45 -0400 Subject: CREATE_PROJECT: Add create_neverhood and create_tony to the list of tools --- devtools/create_project/create_project.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 8b8aaef042..0a77a84602 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -843,7 +843,9 @@ const Tool s_tools[] = { { "create_hugo", true}, { "create_kyradat", true}, { "create_lure", true}, + { "create_neverhood", true}, { "create_teenagent", true}, + { "create_tony", true}, { "create_toon", true}, { "create_translations", true}, { "qtable", true} -- cgit v1.2.3 From a949a88220eea86cb15182daccd34a269ff7d6dd Mon Sep 17 00:00:00 2001 From: Littleboy Date: Sun, 7 Jul 2013 11:23:19 -0400 Subject: CREATE_PROJECT: Add support for tests - Added --tests command line switch - Parse test/module.mk to extract the list of test folders - Automatically run tests after a successful build --- .gitignore | 1 + devtools/create_project/create_project.cpp | 191 ++++++++++++++++++++--------- devtools/create_project/create_project.h | 10 +- devtools/create_project/msbuild.cpp | 43 +++++-- devtools/create_project/msvc.cpp | 10 ++ devtools/create_project/msvc.h | 7 ++ devtools/create_project/visualstudio.cpp | 26 +++- dists/msvc10/create_msvc10.bat | 10 ++ dists/msvc11/create_msvc11.bat | 10 ++ dists/msvc12/create_msvc12.bat | 10 ++ dists/msvc8/create_msvc8.bat | 10 ++ dists/msvc9/create_msvc9.bat | 10 ++ 12 files changed, 261 insertions(+), 77 deletions(-) diff --git a/.gitignore b/.gitignore index a046909bbf..a74f45bec0 100644 --- a/.gitignore +++ b/.gitignore @@ -93,6 +93,7 @@ project.xcworkspace /dists/msvc*/*.SAV /dists/msvc*/*.dat /dists/msvc*/*.dll +/dists/msvc*/test_runner.cpp /doc/*.aux /doc/*.dvi diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 0a77a84602..3ee5fc4f97 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -109,7 +109,7 @@ enum ProjectType { int main(int argc, char *argv[]) { #ifndef USE_WIN32_API // Initialize random number generator for UUID creation - std::srand((uint)std::time(0)); + std::srand((unsigned int)std::time(0)); #endif if (argc < 2) { @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) { setup.filePrefix.erase(setup.filePrefix.size() - 1); } else if (!std::strcmp(argv[i], "--output-dir")) { if (i + 1 >= argc) { - std::cerr << "ERROR: Missing \"path\" parameter for \"--output-dirx\"!\n"; + std::cerr << "ERROR: Missing \"path\" parameter for \"--output-dir\"!\n"; return -1; } @@ -279,12 +279,23 @@ int main(int argc, char *argv[]) { setup.createInstaller = true; } else if (!std::strcmp(argv[i], "--tools")) { setup.devTools = true; + } else if (!std::strcmp(argv[i], "--tests")) { + setup.tests = true; } else { std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n"; return -1; } } + // When building tests, disable some features + if (setup.tests) { + setFeatureBuildState("mt32emu", setup.features, false); + setFeatureBuildState("eventrecorder", setup.features, false); + + for (EngineDescList::iterator j = setup.engines.begin(); j != setup.engines.end(); ++j) + j->enable = false; + } + // Print status cout << "Enabled engines:\n\n"; for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) { @@ -321,6 +332,12 @@ int main(int argc, char *argv[]) { } } + // Check if tools and tests are enabled simultaneously + if (setup.devTools && setup.tests) { + std::cerr << "ERROR: The tools and tests projects cannot be created simultaneously\n"; + return -1; + } + // Setup defines and libraries setup.defines = getEngineDefines(setup.engines); setup.libraries = getFeatureLibraries(setup.features); @@ -358,8 +375,8 @@ int main(int argc, char *argv[]) { return -1; case kProjectCodeBlocks: - if (setup.devTools) { - std::cerr << "ERROR: Building tools is not supported for the CodeBlocks project type!\n"; + if (setup.devTools || setup.tests) { + std::cerr << "ERROR: Building tools or tests is not supported for the CodeBlocks project type!\n"; return -1; } @@ -531,8 +548,8 @@ int main(int argc, char *argv[]) { break; case kProjectXcode: - if (setup.devTools) { - std::cerr << "ERROR: Building tools is not supported for the XCode project type!\n"; + if (setup.devTools || setup.tests) { + std::cerr << "ERROR: Building tools or tests is not supported for the XCode project type!\n"; return -1; } @@ -573,6 +590,11 @@ int main(int argc, char *argv[]) { setup.projectDescription += "Tools"; } + if (setup.tests) { + setup.projectName += "-tests"; + setup.projectDescription += "Tests"; + } + provider->createProject(setup); delete provider; @@ -623,6 +645,9 @@ void displayHelp(const char *exe) { " --tools Create project files for the devtools\n" " (ignores --build-events and --installer, as well as engine settings)\n" " (default: false)\n" + " --tests Create project files for the tests\n" + " (ignores --build-events and --installer, as well as engine settings)\n" + " (default: false)\n" "\n" "Engines settings:\n" " --list-engines list all available engines and their default state\n" @@ -1130,69 +1155,66 @@ ProjectProvider::ProjectProvider(StringList &global_warnings, std::mapfirst == setup.projectName) - continue; - - in.clear(); ex.clear(); - const std::string moduleDir = setup.srcDir + "/devtools/" + i->first; - - createModuleList(moduleDir, setup.defines, in, ex); - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); - } - - // Create other misc. build files - createOtherBuildFiles(setup); + // We also need to add the UUID of the main project file. + const std::string svmUUID = _uuidMap[setup.projectName] = createUUID(); - } else { - _uuidMap = createUUIDMap(setup); + createWorkspace(setup); - // We also need to add the UUID of the main project file. - const std::string svmUUID = _uuidMap[setup.projectName] = createUUID(); + StringList in, ex; - // Create Solution/Workspace file - createWorkspace(setup); + // Create project files + for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { + if (i->first == setup.projectName) + continue; - StringList in, ex; + in.clear(); ex.clear(); + const std::string moduleDir = setup.srcDir + targetFolder + i->first; - // Create engine project files - for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { - if (i->first == setup.projectName) - continue; + createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex); + createProjectFile(i->first, i->second, setup, moduleDir, in, ex); + } - in.clear(); ex.clear(); - const std::string moduleDir = setup.srcDir + "/engines/" + i->first; + if (setup.tests) { + // Create the main project file. + in.clear(); ex.clear(); - createModuleList(moduleDir, setup.defines, in, ex); - createProjectFile(i->first, i->second, setup, moduleDir, in, ex); - } + createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/common", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/engines", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/graphics", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/gui", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/test", setup.defines, setup.testDirs, in, ex); + createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); + } else if (!setup.devTools) { // Last but not least create the main project file. in.clear(); ex.clear(); // File list for the Project file - createModuleList(setup.srcDir + "/backends", setup.defines, in, ex); - createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, in, ex); - createModuleList(setup.srcDir + "/base", setup.defines, in, ex); - createModuleList(setup.srcDir + "/common", setup.defines, in, ex); - createModuleList(setup.srcDir + "/engines", setup.defines, in, ex); - createModuleList(setup.srcDir + "/graphics", setup.defines, in, ex); - createModuleList(setup.srcDir + "/gui", setup.defines, in, ex); - createModuleList(setup.srcDir + "/audio", setup.defines, in, ex); - createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex); - createModuleList(setup.srcDir + "/video", setup.defines, in, ex); + createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/common", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/engines", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/graphics", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/gui", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/video", setup.defines, setup.testDirs, in, ex); // Resource files in.push_back(setup.srcDir + "/icons/" + setup.projectName + ".ico"); @@ -1211,10 +1233,10 @@ void ProjectProvider::createProject(const BuildSetup &setup) { // Create the main project file. createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); - - // Create other misc. build files - createOtherBuildFiles(setup); } + + // Create other misc. build files + createOtherBuildFiles(setup); } ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup) const { @@ -1322,7 +1344,7 @@ void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &p delete files; } -void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) const { +void ProjectProvider::createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList) const { const std::string moduleMkFile = moduleDir + "/module.mk"; std::ifstream moduleMk(moduleMkFile.c_str()); if (!moduleMk) @@ -1453,6 +1475,59 @@ void ProjectProvider::createModuleList(const std::string &moduleDir, const Strin ++i; } } + } else if (*i == "TESTS") { + if (tokens.size() < 3) + error("Malformed TESTS definition in " + moduleMkFile); + ++i; + + if (*i != ":=" && *i != "+=" && *i != "=") + error("Malformed TESTS definition in " + moduleMkFile); + ++i; + + while (i != tokens.end()) { + // Read input + std::string folder = unifyPath(*i); + + // Get include folder + const std::string source_dir = "$(srcdir)/"; + const std::string selector = getLastPathComponent(folder); + const std::string module = getLastPathComponent(moduleDir); + + folder.replace(folder.find(source_dir), source_dir.length(), ""); + folder.replace(folder.find(selector), selector.length(), ""); + folder.replace(folder.find(module), module.length(), moduleDir); + + // Scan all files in the include folder + FileList files = listDirectory(folder); + + if (files.empty()) + continue; + + // Add to list of test folders + testDirs.push_back(folder); + + for (FileList::const_iterator f = files.begin(); f != files.end(); ++f) { + if (f->isDirectory) + continue; + + std::string filename = folder + f->name; + + if (shouldInclude.top()) { + // In case we should include a file, we need to make + // sure it is not in the exclude list already. If it + // is we just drop it from the exclude list. + excludeList.remove(filename); + + includeList.push_back(filename); + } else if (std::find(includeList.begin(), includeList.end(), filename) == includeList.end()) { + // We only add the file to the exclude list in case it + // has not yet been added to the include list. + excludeList.push_back(filename); + } + } + + ++i; + } } else if (*i == "ifdef") { if (tokens.size() < 2) error("Malformed ifdef in " + moduleMkFile); diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index de77793ee7..d0f2db364c 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -221,13 +221,16 @@ struct BuildSetup { StringList defines; ///< List of all defines for the build. StringList libraries; ///< List of all external libraries required for the build. + StringList testDirs; ///< List of all folders containing tests bool devTools; ///< Generate project files for the tools + bool tests; ///< Generate project files for the tests bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder bool createInstaller; ///< Create NSIS installer after the build BuildSetup() { devTools = false; + tests = false; runBuildEvents = false; createInstaller = false; } @@ -339,7 +342,7 @@ public: * * @param setup Description of the desired build setup. */ - void createProject(const BuildSetup &setup); + void createProject(BuildSetup &setup); /** * Returns the last path component. @@ -430,10 +433,11 @@ protected: * * @param moduleDir Path to the module. * @param defines List of set defines. + * @param testDirs List of folders containing tests. * @param includeList Reference to a list, where included files should be added. * @param excludeList Reference to a list, where excluded files should be added. */ - void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &includeList, StringList &excludeList) const; + void createModuleList(const std::string &moduleDir, const StringList &defines, StringList &testDirs, StringList &includeList, StringList &excludeList) const; /** * Creates an UUID for every enabled engine of the @@ -448,7 +452,7 @@ protected: * Creates an UUID for every enabled tool of the * passed build description. * - * @return A map, which includes UUIDs for all enabled engines. + * @return A map, which includes UUIDs for all enabled tools. */ UUIDMap createToolsUUIDMap() const; diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 6af9323fcd..23bf1bc28a 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -69,7 +69,7 @@ inline void outputConfiguration(std::ostream &project, const std::string &config inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, int version) { project << "\t\n" - "\t\t" << ((name == setup.projectName || setup.devTools) ? "Application" : "StaticLibrary") << "\n" + "\t\t" << ((name == setup.projectName || setup.devTools || setup.tests) ? "Application" : "StaticLibrary") << "\n" "\t\tv" << version << "0\n" "\t\n"; } @@ -159,10 +159,26 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri if (name == setup.projectName) writeReferences(setup, project); + // Output auto-generated test runner + if (setup.tests) { + project << "\t\n"; + project << "\t\t\n"; + project << "\t\n"; + } + project << "\t\n" "\t\n" - "\t\n" - "\n"; + "\t\n"; + + if (setup.tests) { + // We override the normal target to ignore the exit code (this allows us to have a clean output and not message about the command exit code) + project << "\t\t\n" + << "\t\t\t\n" + << "\t\t\t\n" + << "\t\t\n"; + } + + project << "\n"; // Output filter file if necessary createFiltersFile(setup, name); @@ -248,7 +264,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end(); // Nothing to add here, move along! - if (!setup.devTools && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end()) + if ((!setup.devTools || !setup.tests) && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end()) return; std::string warnings = ""; @@ -260,7 +276,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s "\t\t\n"; // Language Extensions - if (setup.devTools || name == setup.projectName || enableLanguageExtensions) + if (setup.devTools || setup.tests || name == setup.projectName || enableLanguageExtensions) project << "\t\t\tfalse\n"; // Edit and Continue @@ -274,18 +290,18 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s project << "\t\t\n"; // Link configuration for main project - if (name == setup.projectName || setup.devTools) { + if (name == setup.projectName || setup.devTools || setup.tests) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) libraries += *i + ".lib;"; project << "\t\t\n" - "\t\t\t$(OutDir)" << (setup.devTools ? name : setup.projectName) << ".exe\n" + "\t\t\t$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe\n" "\t\t\t" << libraries << "%(AdditionalDependencies)\n" "\t\t\n"; - if (!setup.devTools && setup.runBuildEvents) { + if (!setup.devTools && !setup.tests && setup.runBuildEvents) { project << "\t\t\n" "\t\t\tGenerate revision\n" "\t\t\t" << getPreBuildEvent() << "\n" @@ -296,6 +312,11 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s "\t\t\tCopy data files to the build folder\n" "\t\t\t" << getPostBuildEvent(isWin32, setup.createInstaller) << "\n" "\t\t\n"; + } else if (setup.tests) { + project << "\t\t\n" + "\t\t\tGenerate runner.cpp\n" + "\t\t\t" << getTestPreBuildEvent(setup) << "\n" + "\t\t\n"; } } @@ -330,9 +351,9 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\t\t\n" "\t\t\ttrue\n" "\t\t\t" << warnings << ";%(DisableSpecificWarnings)\n" - "\t\t\t$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)\n" + "\t\t\t$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)\n" "\t\t\t" << definesList << "%(PreprocessorDefinitions)\n" - "\t\t\t" << (setup.devTools ? "Sync" : "") << "\n"; + "\t\t\t" << ((setup.devTools || setup.tests) ? "Sync" : "") << "\n"; #if NEEDS_RTTI properties << "\t\t\ttrue\n"; @@ -348,7 +369,7 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea "\t\t\t%(IgnoreSpecificDefaultLibraries)\n" "\t\t\tConsole\n"; - if (!setup.devTools) + if (!setup.devTools && !setup.tests) properties << "\t\t\tWinMainCRTStartup\n"; properties << "\t\t\n" diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index b8d2401af9..2fedadcba5 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -161,6 +161,16 @@ std::string MSVCProvider::getPreBuildEvent() const { return cmdLine; } +std::string MSVCProvider::getTestPreBuildEvent(const BuildSetup &setup) const { + // Build list of folders containing tests + std::string target = ""; + + for (StringList::const_iterator it = setup.testDirs.begin(); it != setup.testDirs.end(); ++it) + target += " $(SolutionDir)" + *it + "*.h"; + + return ""$(SolutionDir)../../test/cxxtest/cxxtestgen.py" --runner=ParenPrinter --no-std --no-eh -o $(SolutionDir)test_runner.cpp" + target; +} + std::string MSVCProvider::getPostBuildEvent(bool isWin32, bool createInstaller) const { std::string cmdLine = ""; diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h index 5a854b596a..b9b93fe109 100644 --- a/devtools/create_project/msvc.h +++ b/devtools/create_project/msvc.h @@ -87,6 +87,13 @@ protected: */ std::string getPreBuildEvent() const; + /** + * Get the command line for the test generator + * + * @param setup Description of the desired build setup. + */ + std::string getTestPreBuildEvent(const BuildSetup &setup) const; + /** * Get the command line for copying data files to the build directory. * diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index de2df96d78..23225d3435 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -83,7 +83,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: // Check for project-specific warnings: std::map< std::string, std::list >::iterator warningsIterator = _projectWarnings.find(name); - if (setup.devTools || name == setup.projectName) { + if (setup.devTools || setup.tests || name == setup.projectName) { std::string libraries; for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) @@ -140,6 +140,11 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std: else addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix); + // Output auto-generated test runner + if (setup.tests) { + project << "\t\t\n"; + } + project << "\t\n" "\n"; } @@ -161,7 +166,7 @@ void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ost } void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) { - if (!setup.devTools && setup.runBuildEvents) { + if (!setup.devTools && !setup.tests && setup.runBuildEvents) { project << "\t\t\t\n" @@ -169,6 +174,17 @@ void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildS "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup.createInstaller) << "\"\n" "\t\t\t/>\n"; } + + // Generate runner file before build for tests + if (setup.tests) { + project << "\t\t\t\n"; + + project << "\t\t\t\n"; + } } void VisualStudioProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) { @@ -212,9 +228,9 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tName=\"VCCLCompilerTool\"\n" "\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n" "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" - "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(TargetDir)\"\n" + "\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir)\"\n" "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" - "\t\tExceptionHandling=\"" << (setup.devTools ? "1" : "0") << "\"\n"; + "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests) ? "1" : "0") << "\"\n"; #if NEEDS_RTTI properties << "\t\tRuntimeTypeInfo=\"true\"\n"; @@ -235,7 +251,7 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of "\t\tIgnoreDefaultLibraryNames=\"\"\n" "\t\tSubSystem=\"1\"\n"; - if (!setup.devTools) + if (!setup.devTools && !setup.tests) properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"; properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n" diff --git a/dists/msvc10/create_msvc10.bat b/dists/msvc10/create_msvc10.bat index 5616c2cc8b..be0434fc50 100644 --- a/dists/msvc10/create_msvc10.bat +++ b/dists/msvc10/create_msvc10.bat @@ -10,6 +10,8 @@ if "%~1"=="/all" goto all if "%~1"=="/ALL" goto all if "%~1"=="/tools" goto tools if "%~1"=="/TOOLS" goto tools +if "%~1"=="/tests" goto tests +if "%~1"=="/TESTS" goto tests if "%~1"=="/clean" goto clean_check if "%~1"=="/CLEAN" goto clean_check if "%~1"=="/help" goto command_help @@ -70,6 +72,13 @@ echo. create_project ..\.. --tools --msvc --msvc-version 10 goto done +:tests +echo. +echo Creating tests project files +echo. +create_project ..\.. --tests --msvc --msvc-version 10 +goto done + :clean_check echo. set cleananswer=N @@ -88,6 +97,7 @@ del /Q *.props > NUL 2>&1 del /Q *.sln* > NUL 2>&1 del /Q scummvm* > NUL 2>&1 del /Q devtools* > NUL 2>&1 +del /Q test_runner.cpp > NUL 2>&1 goto done :done diff --git a/dists/msvc11/create_msvc11.bat b/dists/msvc11/create_msvc11.bat index b6a5413e3b..fc5471f46f 100644 --- a/dists/msvc11/create_msvc11.bat +++ b/dists/msvc11/create_msvc11.bat @@ -10,6 +10,8 @@ if "%~1"=="/all" goto all if "%~1"=="/ALL" goto all if "%~1"=="/tools" goto tools if "%~1"=="/TOOLS" goto tools +if "%~1"=="/tests" goto tests +if "%~1"=="/TESTS" goto tests if "%~1"=="/clean" goto clean_check if "%~1"=="/CLEAN" goto clean_check if "%~1"=="/help" goto command_help @@ -70,6 +72,13 @@ echo. create_project ..\.. --tools --msvc --msvc-version 11 goto done +:tests +echo. +echo Creating tests project files +echo. +create_project ..\.. --tests --msvc --msvc-version 11 +goto done + :clean_check echo. set cleananswer=N @@ -88,6 +97,7 @@ del /Q *.props > NUL 2>&1 del /Q *.sln* > NUL 2>&1 del /Q scummvm* > NUL 2>&1 del /Q devtools* > NUL 2>&1 +del /Q test_runner.cpp > NUL 2>&1 goto done :done diff --git a/dists/msvc12/create_msvc12.bat b/dists/msvc12/create_msvc12.bat index fe12a9b288..d99001edb1 100644 --- a/dists/msvc12/create_msvc12.bat +++ b/dists/msvc12/create_msvc12.bat @@ -10,6 +10,8 @@ if "%~1"=="/all" goto all if "%~1"=="/ALL" goto all if "%~1"=="/tools" goto tools if "%~1"=="/TOOLS" goto tools +if "%~1"=="/tests" goto tests +if "%~1"=="/TESTS" goto tests if "%~1"=="/clean" goto clean_check if "%~1"=="/CLEAN" goto clean_check if "%~1"=="/help" goto command_help @@ -70,6 +72,13 @@ echo. create_project ..\.. --tools --msvc --msvc-version 12 goto done +:tests +echo. +echo Creating tests project files +echo. +create_project ..\.. --tests --msvc --msvc-version 12 +goto done + :clean_check echo. set cleananswer=N @@ -88,6 +97,7 @@ del /Q *.props > NUL 2>&1 del /Q *.sln* > NUL 2>&1 del /Q scummvm* > NUL 2>&1 del /Q devtools* > NUL 2>&1 +del /Q test_runner.cpp > NUL 2>&1 goto done :done diff --git a/dists/msvc8/create_msvc8.bat b/dists/msvc8/create_msvc8.bat index 2261c9bcec..1e0d339001 100644 --- a/dists/msvc8/create_msvc8.bat +++ b/dists/msvc8/create_msvc8.bat @@ -10,6 +10,8 @@ if "%~1"=="/all" goto all if "%~1"=="/ALL" goto all if "%~1"=="/tools" goto tools if "%~1"=="/TOOLS" goto tools +if "%~1"=="/tests" goto tests +if "%~1"=="/TESTS" goto tests if "%~1"=="/clean" goto clean_check if "%~1"=="/CLEAN" goto clean_check if "%~1"=="/help" goto command_help @@ -70,6 +72,13 @@ echo. create_project ..\.. --tools --msvc --msvc-version 8 goto done +:tests +echo. +echo Creating tests project files +echo. +create_project ..\.. --tests --msvc --msvc-version 8 +goto done + :clean_check echo. set cleananswer=N @@ -88,6 +97,7 @@ del /Q *.vsprops > NUL 2>&1 del /Q *.sln* > NUL 2>&1 del /Q scummvm* > NUL 2>&1 del /Q devtools* > NUL 2>&1 +del /Q test_runner.cpp goto done :done diff --git a/dists/msvc9/create_msvc9.bat b/dists/msvc9/create_msvc9.bat index 1622cd9037..34bcccdd7b 100644 --- a/dists/msvc9/create_msvc9.bat +++ b/dists/msvc9/create_msvc9.bat @@ -10,6 +10,8 @@ if "%~1"=="/all" goto all if "%~1"=="/ALL" goto all if "%~1"=="/tools" goto tools if "%~1"=="/TOOLS" goto tools +if "%~1"=="/tests" goto tests +if "%~1"=="/TESTS" goto tests if "%~1"=="/clean" goto clean_check if "%~1"=="/CLEAN" goto clean_check if "%~1"=="/help" goto command_help @@ -70,6 +72,13 @@ echo. create_project ..\.. --tools --msvc --msvc-version 9 goto done +:tests +echo. +echo Creating tests project files +echo. +create_project ..\.. --tests --msvc --msvc-version 9 +goto done + :clean_check echo. set cleananswer=N @@ -88,6 +97,7 @@ del /Q *.vsprops > NUL 2>&1 del /Q *.sln* > NUL 2>&1 del /Q scummvm* > NUL 2>&1 del /Q devtools* > NUL 2>&1 +del /Q test_runner.cpp goto done :done -- cgit v1.2.3 From 0f30ba2f10df20cbe57f67fcf98b3125c1c57e5f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 7 Jul 2013 19:41:42 +0300 Subject: SCI: Fix bug #3614566 - "LSL6: ScummVM locks up at Electro-Shock room" We now do the jumpToTick() for hold events after waiting for the delta of the current event, like we do for the signal set events. This keeps the fixes for the hold timings in QFG3, while not breaking LSL6. Many thanks to wjp for pinpointing the actual cause of the issue. --- engines/sci/sound/midiparser_sci.cpp | 9 ++++++--- engines/sci/sound/midiparser_sci.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 9546b1503f..00089cd4c3 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -57,6 +57,7 @@ MidiParser_SCI::MidiParser_SCI(SciVersion soundVersion, SciMusic *music) : _signalToSet = 0; _dataincAdd = false; _dataincToAdd = 0; + _jumpToHoldTick = false; _resetOnPause = false; _pSnd = 0; } @@ -452,6 +453,10 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { debugC(4, kDebugLevelSound, "signal %04x", _signalToSet); } + if (_jumpToHoldTick) { + _jumpToHoldTick = false; + jumpToTick(_loopTick, false, false); + } info.start = _position._playPos; info.delta = 0; @@ -532,9 +537,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // marker set for that song by cmdSetSoundHold. // If it is, loop back, but don't stop notes when jumping. if (info.basic.param2 == _pSnd->hold) { - uint32 extraDelta = info.delta; - jumpToTick(_loopTick, false, false); - _nextEvent.delta += extraDelta; + _jumpToHoldTick = true; } break; case kUpdateCue: diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index d3fd337644..7bd68994c8 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -110,6 +110,7 @@ protected: int16 _signalToSet; bool _dataincAdd; int16 _dataincToAdd; + bool _jumpToHoldTick; bool _resetOnPause; bool _channelUsed[16]; -- cgit v1.2.3 From 08e3adcf28444b9709abfdab562ebc16bf19b11c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Jul 2013 14:35:08 -0400 Subject: TSAGE: Fix for visual speakers animation in R2R --- engines/tsage/converse.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index de5ac62425..ef00273dd3 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -843,8 +843,12 @@ void StripManager::signal() { } } - if ((g_vm->getGameID() == GType_Ringworld2) && (_obj44List.size() > 0)) - static_cast(_activeSpeaker)->proc15(); + if (g_vm->getGameID() == GType_Ringworld2) { + Ringworld2::VisualSpeaker *speaker = static_cast(_activeSpeaker); + speaker->_fieldF6 = obj44._field8; + if (_obj44List.size() > 0) + speaker->proc15(); + } _textShown = true; _activeSpeaker->setText(choiceList[strIndex]); -- cgit v1.2.3 From 9999a0e2101292f907d1b5c0cabcee4b05635bee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Jul 2013 21:43:26 -0400 Subject: TSAGE: Fix for crash when saving in R2R scene 300 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 0c0376f559..2c944f209e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3236,7 +3236,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _protocolDisplay.postInit(); _protocolDisplay.setup(300, 6, 1); _protocolDisplay.setPosition(Common::Point(287, 71)); - _protocolDisplay.animate(ANIM_MODE_7, NULL); + _protocolDisplay.animate(ANIM_MODE_7, 0, NULL); _protocolDisplay._numFrames = 5; _object6.postInit(); -- cgit v1.2.3 From 6fa668e32a86c89a88144dbe6862cb917c0d8870 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 8 Jul 2013 12:18:23 +0300 Subject: SCI: Add some comments a possible TODO regarding song looping --- engines/sci/sound/midiparser_sci.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 00089cd4c3..938455c24a 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -536,6 +536,11 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // Check if the hold ID marker is the same as the hold ID // marker set for that song by cmdSetSoundHold. // If it is, loop back, but don't stop notes when jumping. + // We need to wait for the delta of the current event before + // jumping, as in LSL6, this ends up jumping forward one tick + // (the hold marker occurs at playtick 27, with loopTick + // being 15 and the event itself having a tick of 13, + // total = 28) - bug #3614566. if (info.basic.param2 == _pSnd->hold) { _jumpToHoldTick = true; } @@ -640,7 +645,17 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // (e.g. song 110, during the intro). The original interpreter // treats this case as an infinite loop (bug #3311911). if (_pSnd->loop || _pSnd->hold > 0) { - // We need to play it again... + // TODO: this jump is also vulnerable to the same lockup as + // the MIDI hold one above. However, we can't perform the + // jump on the next tick like with the MIDI hold jump above, + // as there aren't any subsequent MIDI events after this one. + // This assert is here to detect cases where the song jumps + // forward, like with the hold jump above (however, this + // scenario sounds less likely to occur with this jump). Note + // that we haven't yet found a scene where this jump might + // lock up, + assert(_loopTick + info.delta < _position._playTick); + uint32 extraDelta = info.delta; jumpToTick(_loopTick); _nextEvent.delta += extraDelta; -- cgit v1.2.3 From fef7d59c54147c47fb18e1a0fc3f1f32494a7042 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 8 Jul 2013 12:32:12 +0300 Subject: SCI: Rewrite the song loop comments in commit 6fa668e to make more sense --- engines/sci/sound/midiparser_sci.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 938455c24a..6a78f494c7 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -537,10 +537,12 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // marker set for that song by cmdSetSoundHold. // If it is, loop back, but don't stop notes when jumping. // We need to wait for the delta of the current event before - // jumping, as in LSL6, this ends up jumping forward one tick - // (the hold marker occurs at playtick 27, with loopTick - // being 15 and the event itself having a tick of 13, - // total = 28) - bug #3614566. + // jumping, thus the jump will be performed on the next + // parseNextEvent() call, like with the signal set events. + // In LSL6, room 360, song 381, this ends up jumping forward + // one tick (the hold marker occurs at playtick 27, with + // _loopTick being 15 and the event itself having a delta of + // 13, total = 28) - bug #3614566. if (info.basic.param2 == _pSnd->hold) { _jumpToHoldTick = true; } @@ -649,11 +651,8 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // the MIDI hold one above. However, we can't perform the // jump on the next tick like with the MIDI hold jump above, // as there aren't any subsequent MIDI events after this one. - // This assert is here to detect cases where the song jumps - // forward, like with the hold jump above (however, this - // scenario sounds less likely to occur with this jump). Note - // that we haven't yet found a scene where this jump might - // lock up, + // This assert is here to detect cases where the song ends + // up jumping forward, like with bug #3614566 (see above). assert(_loopTick + info.delta < _position._playTick); uint32 extraDelta = info.delta; -- cgit v1.2.3 From cd8c702544fe75d333fa4fa7280f891f9fef7ed6 Mon Sep 17 00:00:00 2001 From: Kirben Date: Tue, 9 Jul 2013 11:00:55 +1000 Subject: BUILD: Disable data path in mingw builds, since it was using a hard coded path. All external data files are stored in the Windows executable file anyway. --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 5a7b310fd4..9fa698a2ca 100755 --- a/configure +++ b/configure @@ -3946,7 +3946,14 @@ fi test "x$prefix" = xNONE && prefix=/usr/local test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -DEFINES="$DEFINES -DDATA_PATH=\\\"$datadir\\\"" +case $_host_os in + mingw*) + # Windows stores all the external data files in executable file. + ;; + *) + DEFINES="$DEFINES -DDATA_PATH=\\\"$datadir\\\"" + ;; +esac case $_backend in openpandora) -- cgit v1.2.3 From 395ee92a8578d5e74ff525140ea942e2c7608b92 Mon Sep 17 00:00:00 2001 From: Kirben Date: Tue, 9 Jul 2013 11:45:45 +1000 Subject: SCUMM: Add another French Windows version of Pajama Sam 2. --- devtools/scumm-md5.txt | 1 + engines/scumm/detection_tables.h | 1 + engines/scumm/scumm-md5.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 6e3bae1d7e..450860b587 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -654,6 +654,7 @@ pajama2 Pajama Sam 2: Thunder and Lightning Aren't so Frightening e5563c8358443c4352fcddf7402a5e0a -1 fr Windows HE 98.5 - - gist974 c6907d44f1166941d982864cd42cdc89 -1 de All HE 99 - - nachbarnebenan f8be685007a8b425ba2a455da732f59f -1 fr Mac HE 99 - - alamaz + 7477bc23d0383516c5e310cd8771dcc9 -1 fr Windows HE 99 - - Strangerke 32709cbeeb3044b34129950860a83f14 -1 ru Windows HE 99 - - sev 1af4eb581a33d808707d66d50e084dca -1 he Windows HE 99 - - Matan Bareket diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index cb807997e9..395051d2a5 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -758,6 +758,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "pajama2", "PYJAMADB", kGenHEPC, Common::DE_DEU, UNK, 0 }, { "pajama2", "PyjamaDBMN", kGenHEPC, Common::DE_DEU, UNK, 0 }, { "pajama2", "PyjamaDBMN", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 }, + { "pajama2", "PyjamaHM", kGenHEPC, Common::FR_FRA, UNK, 0 }, { "pajama2", "PyjamaHM", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 }, { "pajama2", "PYJAMA2", kGenHEPC, Common::DE_DEU, UNK, 0 }, { "pajama2", "Pyjama Pit 2", kGenHEMac, Common::DE_DEU, Common::kPlatformMacintosh, 0 }, diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index db8da21bbc..7f0eb41a1e 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Sun Jun 23 22:18:47 2013 + This file was generated by the md5table tool on Tue Jul 09 01:43:38 2013 DO NOT EDIT MANUALLY! */ @@ -328,6 +328,7 @@ static const MD5Table md5table[] = { { "73e5ab7dbb9a8061cc6d25df02dbd1e7", "loom", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformDOS }, { "7410a8ba9795020cd42f171c4320659e", "pajama3", "", "", -1, Common::FR_FRA, Common::kPlatformWindows }, { "746e88c172a5b7a1ae89ac0ee3ee681a", "freddi", "HE 90", "Updated", -1, Common::RU_RUS, Common::kPlatformWindows }, + { "7477bc23d0383516c5e310cd8771dcc9", "pajama2", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformWindows }, { "74da3494fbe1a7d20213b0afe0954755", "catalog", "HE CUP", "Preview", 10841544, Common::FR_FRA, Common::kPlatformUnknown }, { "754feb59d3bf86b8a00840df74fd7b26", "freddi3", "", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "75ba23fff4fd63fa446c02864f2a5a4b", "zak", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformDOS }, -- cgit v1.2.3 From 37ebaa376311c6b033bc6043c09dfd88b3c80726 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 9 Jul 2013 06:28:03 +0300 Subject: NEVERHOOD: Fix incorrect sound heard when pressing the ladder button When the ladder is down, pressing the ladder button shouldn't do anything --- engines/neverhood/modules/module2800.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 7ab732b4ac..a64bdc8b32 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -3140,7 +3140,7 @@ void Scene2822::update() { _ssButton->setVisible(false); _countdownStatus = 1; _countdown = 48; - } else if (_countdownStatus == 1) { + } else if (_countdownStatus == 1 && getGlobalVar(V_LADDER_DOWN_ACTION)) { playSound(0, 0x1384CB60); _countdownStatus = 2; _countdown = 12; -- cgit v1.2.3 From 41748acf85fead543295ea6c11af6aa4fb14d495 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 9 Jul 2013 21:37:16 -0400 Subject: TSAGE: Implemented missing visual speaker methods for R2R --- engines/tsage/converse.cpp | 6 +- engines/tsage/converse.h | 2 +- engines/tsage/ringworld2/ringworld2_speakers.cpp | 275 +++++++++++++++-------- engines/tsage/ringworld2/ringworld2_speakers.h | 10 +- 4 files changed, 190 insertions(+), 103 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index ef00273dd3..bae0249eaa 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -543,7 +543,7 @@ void Obj44::load(const byte *dataP) { _lookupValue = s.readSint16LE(); _lookupIndex = s.readSint16LE(); _field6 = s.readSint16LE(); - _field8 = s.readSint16LE(); + _speakerMode = s.readSint16LE(); } _id = s.readSint16LE(); @@ -579,7 +579,7 @@ void Obj44::synchronize(Serializer &s) { s.syncAsSint16LE(_lookupValue); s.syncAsSint16LE(_lookupIndex); s.syncAsSint16LE(_field6); - s.syncAsSint16LE(_field8); + s.syncAsSint16LE(_speakerMode); s.syncAsSint16LE(_field16); } } @@ -845,7 +845,7 @@ void StripManager::signal() { if (g_vm->getGameID() == GType_Ringworld2) { Ringworld2::VisualSpeaker *speaker = static_cast(_activeSpeaker); - speaker->_fieldF6 = obj44._field8; + speaker->_speakerMode = obj44._speakerMode; if (_obj44List.size() > 0) speaker->proc15(); } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 0c4eb9539d..accd2d49cd 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -190,7 +190,7 @@ public: // Return to Ringworld specific field int _mode; int _lookupValue, _lookupIndex, _field6; - int _field8, _field16; + int _speakerMode, _field16; public: void load(const byte *dataP); virtual void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index da1449efdf..192b6972c5 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -40,7 +40,7 @@ VisualSpeaker::VisualSpeaker(): Speaker() { _color1 = 8; _color2 = 0; _displayMode = 0; - _fieldF6 = 0; + _speakerMode = 0; } void VisualSpeaker::remove() { @@ -49,27 +49,104 @@ void VisualSpeaker::remove() { _fieldF8 = 0; _object1.setStrip(_object1._strip - 1); _object1.setFrame(_object1.getFrameCount()); - _object1.animate(ANIM_MODE_6, (_fieldF6 == 0xff) ? this : NULL); + _object1.animate(ANIM_MODE_6, (_speakerMode == 0xff) ? this : NULL); } else { - _object1.animate(ANIM_MODE_6, (_fieldF6 == 0xff) ? this : NULL); + _object1.animate(ANIM_MODE_6, (_speakerMode == 0xff) ? this : NULL); } } Speaker::remove(); } +void VisualSpeaker::signal() { + // TODO: _action->_field18 = 1; + if (_speakerMode == 0xff) + proc16(); + + _speakerMode = 0; + if (_numFrames) { + if (_object2) { + _object1.setStrip(_object1._strip + 1); + _object1.animate(ANIM_MODE_2, NULL); + _fieldF8 = 1; + } + + if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || _soundId) + _sceneText.show(); + + if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { + // TODO: Check global that is passed + setFrame2(/* word_55F90 */ 0); + } + } else if (_action && _object2) { + _action->setDelay(1); + _sceneText.remove(); + + R2_GLOBALS._playStream.stop(); + } +} + +void VisualSpeaker::dispatch() { + uint32 frameNumber = R2_GLOBALS._events.getFrameNumber(); + + // Delay check for character animation + if (_delayAmount) { + if (frameNumber >= _frameNumber) { + _delayAmount = _delayAmount - (_frameNumber - frameNumber); + _frameNumber = frameNumber; + + if (_delayAmount <= 0) { + _delayAmount = 0; + _object1.animate(ANIM_MODE_NONE, NULL); + _object1.setFrame(1); + } + } + } + + // Delay check for voice + if (_delayAmount2) { + if (frameNumber >= _frameNumber2) { + _delayAmount2 = _delayAmount2 - (_frameNumber2 - frameNumber); + _frameNumber2 = frameNumber; + + if (_delayAmount2 <= 0) { + _delayAmount2 = 0; + if (R2_GLOBALS._playStream.play(0, NULL)) { + _numFrames = 2; + _soundId = 0; + } else { + _sceneText.show(); + } + } + } + } + + if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && (_numFrames == 2) && + !R2_GLOBALS._playStream.isPlaying()) { + _numFrames = 0; + _object1.animate(ANIM_MODE_NONE); + _object1.setFrame(1); + + if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { + _action->setDelay(1); + } + } +} + void VisualSpeaker::synchronize(Serializer &s) { Speaker::synchronize(s); SYNC_POINTER(_object2); - s.syncAsSint16LE(_fieldF6); + s.syncAsSint16LE(_speakerMode); s.syncAsSint16LE(_fieldF8); s.syncAsSint16LE(_displayMode); s.syncAsSint16LE(_soundId); - s.syncAsSint16LE(_delayAmount); s.syncAsByte(_removeObject); - s.syncAsSint32LE(_frameNumber); s.syncAsSint16LE(_numFrames); + s.syncAsSint16LE(_delayAmount); + s.syncAsUint32LE(_frameNumber); + s.syncAsSint16LE(_delayAmount2); + s.syncAsUint32LE(_frameNumber2); } void VisualSpeaker::setText(const Common::String &msg) { @@ -159,8 +236,7 @@ void VisualSpeaker::setText(const Common::String &msg) { if (s.empty()) _numFrames = 0; - - if (_fieldF6) { + if (_speakerMode) { if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId) _sceneText.hide(); } else { @@ -173,7 +249,7 @@ void VisualSpeaker::setText(const Common::String &msg) { void VisualSpeaker::proc16() { R2_GLOBALS._playStream.stop(); - _fieldF6 = 0; + _speakerMode = 0; _object1.remove(); assert(_object2); @@ -187,6 +263,11 @@ void VisualSpeaker::setFrame(int numFrames) { _frameNumber = R2_GLOBALS._events.getFrameNumber(); } +void VisualSpeaker::setFrame2(int numFrames) { + _delayAmount2 = numFrames; + _frameNumber2 = R2_GLOBALS._events.getFrameNumber(); +} + void VisualSpeaker::setDelay(int delay) { _delayAmount = delay; _frameNumber = R2_GLOBALS._events.getFrameNumber(); @@ -211,7 +292,7 @@ SpeakerCaptain3210::SpeakerCaptain3210() { _speakerName = "Captain"; _color1 = 5; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -220,7 +301,7 @@ SpeakerCaptain3210::SpeakerCaptain3210() { } void SpeakerCaptain3210::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -250,7 +331,7 @@ SpeakerCaretaker2450::SpeakerCaretaker2450() { _speakerName = "CARETAKER"; _color1 = 43; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -266,7 +347,7 @@ SpeakerChief1100::SpeakerChief1100() { _speakerName = "CHIEF"; _color1 = 8; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -275,7 +356,7 @@ SpeakerChief1100::SpeakerChief1100() { } void SpeakerChief1100::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -324,7 +405,7 @@ SpeakerGuard::SpeakerGuard() { _speakerName = "GUARD"; _color1 = 5; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -333,7 +414,7 @@ SpeakerGuard::SpeakerGuard() { } void SpeakerGuard2800::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -364,7 +445,7 @@ SpeakerJocko::SpeakerJocko() { _speakerName = "Jocko"; _color1 = 45; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -373,7 +454,7 @@ SpeakerJocko::SpeakerJocko() { } void SpeakerJocko3200::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -396,7 +477,7 @@ void SpeakerJocko3200::proc15() { } void SpeakerJocko3220::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -419,7 +500,7 @@ void SpeakerJocko3220::proc15() { } void SpeakerJocko3230::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -449,7 +530,7 @@ SpeakerMiranda::SpeakerMiranda(): VisualSpeaker() { _speakerName = "MIRANDA"; _color1 = 154; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -458,7 +539,7 @@ SpeakerMiranda::SpeakerMiranda(): VisualSpeaker() { } void SpeakerMiranda300::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) { @@ -498,7 +579,7 @@ void SpeakerMiranda300::proc15() { } void SpeakerMiranda1625::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; @@ -521,7 +602,7 @@ void SpeakerMiranda1625::proc15() { } void SpeakerMiranda3255::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &R2_GLOBALS._player; @@ -544,7 +625,7 @@ void SpeakerMiranda3255::proc15() { void SpeakerMiranda3375::proc15() { Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) @@ -594,7 +675,7 @@ void SpeakerMiranda3375::proc15() { void SpeakerMiranda3385::proc15() { Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) @@ -643,7 +724,7 @@ void SpeakerMiranda3385::proc15() { void SpeakerMiranda3395::proc15() { Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) @@ -693,7 +774,7 @@ void SpeakerMiranda3395::proc15() { void SpeakerMiranda3400::proc15() { Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) @@ -737,7 +818,7 @@ void SpeakerMiranda3400::proc15() { void SpeakerMiranda3600::proc15() { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) @@ -783,7 +864,7 @@ void SpeakerMiranda3600::proc15() { void SpeakerMiranda3700::proc15() { Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor3; @@ -840,7 +921,7 @@ SpeakerNej::SpeakerNej() { _speakerName = "NEJ"; _color1 = 171; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -849,7 +930,7 @@ SpeakerNej::SpeakerNej() { } void SpeakerNej2700::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -884,7 +965,7 @@ void SpeakerNej2700::proc15() { } void SpeakerNej2750::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -916,7 +997,7 @@ void SpeakerNej2750::proc15() { } void SpeakerNej2800::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -948,7 +1029,7 @@ SpeakerPharisha::SpeakerPharisha(): VisualSpeaker() { _speakerName = "PHARISHA"; _color1 = 151; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -957,7 +1038,7 @@ SpeakerPharisha::SpeakerPharisha(): VisualSpeaker() { } void SpeakerPharisha2435::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -984,7 +1065,7 @@ SpeakerPrivate3210::SpeakerPrivate3210() { _speakerName = "Private"; _color1 = 45; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -993,7 +1074,7 @@ SpeakerPrivate3210::SpeakerPrivate3210() { } void SpeakerPrivate3210::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1023,7 +1104,7 @@ SpeakerProtector3600::SpeakerProtector3600() { _speakerName = "Protector"; _color1 = 170; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1032,7 +1113,7 @@ SpeakerProtector3600::SpeakerProtector3600() { } void SpeakerProtector3600::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1084,7 +1165,7 @@ SpeakerQuinn::SpeakerQuinn(): VisualSpeaker() { _speakerName = "QUINN"; _color1 = 60; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1093,7 +1174,7 @@ SpeakerQuinn::SpeakerQuinn(): VisualSpeaker() { } void SpeakerQuinn300::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) { @@ -1140,7 +1221,7 @@ void SpeakerQuinn300::proc15() { } void SpeakerQuinn1100::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (v == 0) @@ -1188,7 +1269,7 @@ void SpeakerQuinn1100::proc15() { } void SpeakerQuinn2435::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) { @@ -1214,7 +1295,7 @@ void SpeakerQuinn2435::proc15() { } void SpeakerQuinn2450::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) { @@ -1242,7 +1323,7 @@ void SpeakerQuinn2450::proc15() { } void SpeakerQuinn2700::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &R2_GLOBALS._player; @@ -1273,7 +1354,7 @@ void SpeakerQuinn2700::proc15() { } void SpeakerQuinn2750::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &R2_GLOBALS._player; @@ -1304,7 +1385,7 @@ void SpeakerQuinn2750::proc15() { } void SpeakerQuinn2800::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &R2_GLOBALS._player; @@ -1345,7 +1426,7 @@ void SpeakerQuinn2800::proc15() { void SpeakerQuinn3255::proc15() { Scene3255 *scene = (Scene3255 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor4; @@ -1368,7 +1449,7 @@ void SpeakerQuinn3255::proc15() { void SpeakerQuinn3375::proc15() { Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) @@ -1419,7 +1500,7 @@ void SpeakerQuinn3375::proc15() { void SpeakerQuinn3385::proc15() { Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) @@ -1474,7 +1555,7 @@ void SpeakerQuinn3385::proc15() { void SpeakerQuinn3395::proc15() { Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) @@ -1529,7 +1610,7 @@ void SpeakerQuinn3395::proc15() { void SpeakerQuinn3400::proc15() { Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) @@ -1578,7 +1659,7 @@ void SpeakerQuinn3400::proc15() { void SpeakerQuinn3600::proc15() { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 1) @@ -1626,7 +1707,7 @@ void SpeakerQuinn3600::proc15() { void SpeakerQuinn3700::setText(const Common::String &msg) { Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; - switch (_fieldF6) { + switch (_speakerMode) { case 2: scene->_actor3.setup(30, 1, 1); R2_GLOBALS._sound2.play(44); @@ -1644,7 +1725,7 @@ void SpeakerQuinn3700::setText(const Common::String &msg) { void SpeakerQuinn3700::proc15() { Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor1; @@ -1701,7 +1782,7 @@ SpeakerQuinnL::SpeakerQuinnL(): VisualSpeaker() { _speakerName = "QUINNL"; _color1 = 35; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1718,7 +1799,7 @@ SpeakerRalf3245::SpeakerRalf3245() { _speakerName = "Ralf"; _color1 = 5; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1727,7 +1808,7 @@ SpeakerRalf3245::SpeakerRalf3245() { } void SpeakerRalf3245::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1770,7 +1851,7 @@ SpeakerRocko::SpeakerRocko() { _speakerName = "Rocko"; _color1 = 5; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1779,7 +1860,7 @@ SpeakerRocko::SpeakerRocko() { } void SpeakerRocko3200::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1802,7 +1883,7 @@ void SpeakerRocko3200::proc15() { } void SpeakerRocko3220::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1825,7 +1906,7 @@ void SpeakerRocko3220::proc15() { } void SpeakerRocko3230::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -1855,7 +1936,7 @@ SpeakerSeeker::SpeakerSeeker(): VisualSpeaker() { _speakerName = "SEEKER"; _color1 = 35; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -1864,7 +1945,7 @@ SpeakerSeeker::SpeakerSeeker(): VisualSpeaker() { } void SpeakerSeeker300::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 3) { @@ -1900,7 +1981,7 @@ void SpeakerSeeker300::proc15() { } void SpeakerSeeker1100::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (v == 0) @@ -1959,7 +2040,7 @@ void SpeakerSeeker1100::proc15() { } void SpeakerSeeker1900::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) { @@ -1989,7 +2070,7 @@ void SpeakerSeeker1900::proc15() { } void SpeakerSeeker2435::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) { @@ -2015,7 +2096,7 @@ void SpeakerSeeker2435::proc15() { } void SpeakerSeeker2450::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) { @@ -2042,7 +2123,7 @@ void SpeakerSeeker2450::proc15() { void SpeakerSeeker3375::proc15() { Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) @@ -2091,7 +2172,7 @@ void SpeakerSeeker3375::proc15() { void SpeakerSeeker3385::proc15() { Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) @@ -2140,7 +2221,7 @@ void SpeakerSeeker3385::proc15() { void SpeakerSeeker3395::proc15() { Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) @@ -2189,7 +2270,7 @@ void SpeakerSeeker3395::proc15() { void SpeakerSeeker3400::proc15() { Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) @@ -2248,7 +2329,7 @@ void SpeakerSeeker3400::proc15() { void SpeakerSeeker3600::proc15() { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { if (R2_GLOBALS._player._characterIndex == 2) @@ -2295,7 +2376,7 @@ void SpeakerSeeker3600::proc15() { void SpeakerSeeker3700::setText(const Common::String &msg) { Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; - if (_fieldF6 == 1) { + if (_speakerMode == 1) { R2_GLOBALS._sound2.play(44); scene->_actor3.setup(30, 8, 1); } else { @@ -2307,7 +2388,7 @@ void SpeakerSeeker3700::setText(const Common::String &msg) { void SpeakerSeeker3700::proc15() { Scene3700 *scene = (Scene3700 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor2; @@ -2359,7 +2440,7 @@ SpeakerSeekerL::SpeakerSeekerL(): VisualSpeaker() { _speakerName = "SEEKERL"; _color1 = 35; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2376,7 +2457,7 @@ SpeakerSocko3200::SpeakerSocko3200() { _speakerName = "Socko"; _color1 = 10; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2385,7 +2466,7 @@ SpeakerSocko3200::SpeakerSocko3200() { } void SpeakerSocko3200::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -2415,7 +2496,7 @@ SpeakerSoldier::SpeakerSoldier(int colour) { _speakerName = "SOLDIER"; _color1 = colour; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2424,7 +2505,7 @@ SpeakerSoldier::SpeakerSoldier(int colour) { } void SpeakerSoldier300::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; @@ -2455,7 +2536,7 @@ SpeakerTeal::SpeakerTeal(): VisualSpeaker() { _speakerName = "TEAL"; _color1 = 22; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2468,7 +2549,7 @@ SpeakerTealMode7::SpeakerTealMode7(): SpeakerTeal() { } void SpeakerTeal300::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; @@ -2492,7 +2573,7 @@ void SpeakerTeal300::proc15() { } void SpeakerTeal1625::proc15() { - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; @@ -2516,7 +2597,7 @@ void SpeakerTeal1625::proc15() { } void SpeakerTeal3240::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -2541,7 +2622,7 @@ void SpeakerTeal3240::proc15() { void SpeakerTeal3400::proc15() { Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor4; @@ -2598,7 +2679,7 @@ void SpeakerTeal3400::proc15() { void SpeakerTeal3600::proc15() { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor5; @@ -2659,7 +2740,7 @@ SpeakerTomko3245::SpeakerTomko3245() { _speakerName = "Tomko"; _color1 = 10; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2668,7 +2749,7 @@ SpeakerTomko3245::SpeakerTomko3245() { } void SpeakerTomko3245::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -2711,7 +2792,7 @@ SpeakerWebbster::SpeakerWebbster(int colour) { _speakerName = "WEBBSTER"; _color1 = colour; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2720,7 +2801,7 @@ SpeakerWebbster::SpeakerWebbster(int colour) { } void SpeakerWebbster3240::proc15() { - int v = _fieldF6; + int v = _speakerMode; Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { @@ -2745,7 +2826,7 @@ void SpeakerWebbster3240::proc15() { void SpeakerWebbster3375::proc15() { Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor3; @@ -2789,7 +2870,7 @@ void SpeakerWebbster3375::proc15() { void SpeakerWebbster3385::proc15() { Scene3385 *scene = (Scene3385 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor3; @@ -2833,7 +2914,7 @@ void SpeakerWebbster3385::proc15() { void SpeakerWebbster3395::proc15() { Scene3395 *scene = (Scene3395 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor3; @@ -2877,7 +2958,7 @@ void SpeakerWebbster3395::proc15() { void SpeakerWebbster3400::proc15() { Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_actor3; @@ -2925,7 +3006,7 @@ SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() { _speakerName = "DUTYOFFICER"; _color1 = 5; _color2 = 0; - _fieldF6 = 0; + _speakerMode = 0; _textWidth = 300; _hideObjects = false; _object2 = NULL; @@ -2936,7 +3017,7 @@ SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() { void SpeakerDutyOfficer::proc15() { Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene; - int v = _fieldF6; + int v = _speakerMode; if (!_object2) { _object2 = &scene->_object2; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index fa2946d56c..532e02576c 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -41,21 +41,27 @@ class VisualSpeaker : public Speaker { public: SceneActor _object1; SceneObject *_object2; - int _fieldF6, _fieldF8; + int _speakerMode; + int _fieldF8; int _displayMode; int _soundId; int _delayAmount; bool _removeObject; - int _frameNumber; + uint32 _frameNumber; int _numFrames; + int _delayAmount2; + uint32 _frameNumber2; private: void setFrame(int numFrames); + void setFrame2(int numFrames); public: VisualSpeaker(); virtual Common::String getClassName() { return "VisualSpeaker"; } virtual void synchronize(Serializer &s); virtual void remove(); + virtual void signal(); + virtual void dispatch(); virtual void setText(const Common::String &msg); virtual void proc15() {} virtual void proc16(); -- cgit v1.2.3 From e6259afc2345e82bbf1f019301b13137b67ffece Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 10 Jul 2013 05:00:25 +0100 Subject: DC: Only enable serial debug output when --enable-debug is passed. After this change, release builds will still have serial debug disabled, but debug builds will now not provide this unless --enable-debug is passed explicitly. This could have been another option or environment variable, but other embedded ports do similar things with _debug_build and this looks like the cleanest way to deal with this. --- configure | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9fa698a2ca..bf991491b0 100755 --- a/configure +++ b/configure @@ -2374,7 +2374,8 @@ if test -n "$_host"; then DEFINES="$DEFINES -DDISABLE_DEFAULT_SAVEFILEMANAGER" DEFINES="$DEFINES -DDISABLE_TEXT_CONSOLE" DEFINES="$DEFINES -DDISABLE_COMMAND_LINE" - if test "$_release_build" = yes; then + # Enable serial debugging output only when --enable-debug is passed + if test "$_debug_build" != yes; then DEFINES="$DEFINES -DNOSERIAL" fi _optimization_level=-O3 @@ -2706,7 +2707,8 @@ case $_backend in LDFLAGS="$LDFLAGS -nostartfiles" LDFLAGS="$LDFLAGS "'$(ronindir)/lib/crt0.o' LDFLAGS="$LDFLAGS "'-L$(ronindir)/lib' - if test "$_release_build" = yes; then + # Enable serial debugging output only when --enable-debug is passed + if test "$_debug_build" != yes; then LIBS="$LIBS -lronin-noserial -lm" else LIBS="$LIBS -lronin -lm" -- cgit v1.2.3 From 4f7d92acb42e54b17e83fa855abcb3bb4e427c7f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 17 Apr 2013 22:57:58 +0200 Subject: TEST: tests for common/huffman.h A few tests for the Huffman decoder. The encoding is the example from Wikipedia. This could be improved by someone more knowledgeable by generating one at runtime or using multiple encodings which would each contain one edge case. --- test/common/huffman.h | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 test/common/huffman.h diff --git a/test/common/huffman.h b/test/common/huffman.h new file mode 100644 index 0000000000..52199a8ffd --- /dev/null +++ b/test/common/huffman.h @@ -0,0 +1,130 @@ +#include +#include "common/huffman.h" +#include "common/bitstream.h" +#include "common/memstream.h" + +class HuffmanTestSuite : public CxxTest::TestSuite +{ + public: + void test_get_with_full_symbols() { + + /* + * Testing the Huffman decoder. + * + * Encoding (arbitrary, for testing purpouses): + * A=010 + * B=011 + * C=11 + * D=00 + * E=10 + */ + + uint32 codeCount = 5; + uint8 maxLength = 3; + const uint8 lengths[] = {3,3,2,2,2}; + const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; + const uint32 symbols[] = {0xA, 0xB, 0xC, 0xD, 0xE}; + + Common::Huffman h (maxLength, codeCount, codes, lengths, symbols); + + byte input[] = {0x4F, 0x20}; + // Provided input... + uint32 expected[] = {0xA, 0xB, 0xC, 0xD, 0xE, 0xD, 0xD}; + // ..and expected output. + + /* + * What should be going on: + * 010 011 11 00 10 00 00 = A B C D E D D + * = 0100 1111 0010 0000 = 0x4F20 + */ + + Common::MemoryReadStream ms(input, sizeof(input)); + Common::BitStream8MSB bs(ms); + + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[0]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[1]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[2]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[3]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[4]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[5]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[6]); + } + + void test_get_without_symbols() { + + /* + * This is basically the same as above, but + * I pass minimal arguments. + * Specifically, I avoid passing the symbols table, so that + * array indices are used instead. + * + * Encoding becomes: + * + * 0=010 + * 1=011 + * 2=11 + * 3=00 + * 4=10 + */ + + uint32 codeCount = 5; + const uint8 lengths[] = {3,3,2,2,2}; + const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; + + Common::Huffman h (0, codeCount, codes, lengths, 0); + + byte input[] = {0x4F, 0x20}; + uint32 expected[] = {0, 1, 2, 3, 4, 3 ,3}; + + Common::MemoryReadStream ms(input, sizeof(input)); + Common::BitStream8MSB bs(ms); + + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[0]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[1]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[2]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[3]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[4]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[5]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[6]); + } + + void test_get_after_set_symbols() { + + /* + * Another variation of the above. + * I use the setSymbols method to define, a posteriori, + * an alphabet to be used in place of array indices + */ + + uint32 codeCount = 5; + const uint8 lengths[] = {3,3,2,2,2}; + const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; + + Common::Huffman h (0, codeCount, codes, lengths, 0); + + const uint32 symbols[] = {0xA, 0xB, 0xC, 0xD, 0xE}; + h.setSymbols(symbols); + + byte input[] = {0x4F, 0x20}; + uint32 expected[] = {0xA, 0xB, 0xC, 0xD, 0xE, 0xD, 0xD}; + + Common::MemoryReadStream ms(input, sizeof(input)); + Common::BitStream8MSB bs(ms); + + /* New symbols: + * A=010 + * B=011 + * C=11 + * D=00 + * E=10 + */ + + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[0]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[1]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[2]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[3]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[4]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[5]); + TS_ASSERT_EQUALS(h.getSymbol(bs), expected[6]); + } +}; -- cgit v1.2.3 From 4a18eab8a55b70dc7d56aa943b9de080bffe7a9c Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Apr 2013 22:08:32 +0200 Subject: TEST: test cases for common/util.cpp --- test/common/util.h | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 test/common/util.h diff --git a/test/common/util.h b/test/common/util.h new file mode 100644 index 0000000000..c11ab740de --- /dev/null +++ b/test/common/util.h @@ -0,0 +1,200 @@ +#include +#include "common/util.h" + +class UtilTestSuite : public CxxTest::TestSuite { +public: + + void test_parsebool_good() { + + // Test the parseBool function + + bool valasbool; + bool success; + + // 'Regular' cases that must work + // (note that the function must be case insensitive): + + Common::String string_1 ("Yes"); + success = Common::parseBool (string_1, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 1); + + Common::String string_2 ("nO"); + success = Common::parseBool (string_2, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 0); + + Common::String string_3 ("tRuE"); + success = Common::parseBool (string_3, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 1); + + Common::String string_4 ("fAlSe"); + success = Common::parseBool (string_4, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 0); + + Common::String string_5 ("1"); + success = Common::parseBool (string_5, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 1); + + Common::String string_6 ("0"); + success = Common::parseBool (string_6, valasbool); + TS_ASSERT_EQUALS(success, 1); + TS_ASSERT_EQUALS(valasbool, 0); + + } + + void test_parsebool_bad() { + + bool valasbool; + bool success; + + // Bad cases that should not return success #1: + // Random string + Common::String string_1 ("u_f1ght_l1k3_a_c0w"); + success = Common::parseBool (string_1, valasbool); + TS_ASSERT_EQUALS(success, 0); + + // Bad cases that should not return success #2, #3: + // The function should NOT accept trailing whitespaces: + Common::String string_2 (" yes"); + success = Common::parseBool (string_2, valasbool); + TS_ASSERT_EQUALS(success, 0); + + Common::String string_3 ("yes "); + success = Common::parseBool (string_3, valasbool); + TS_ASSERT_EQUALS(success, 0); + + } + + void test_is_al_num() { + + // Test the isAlnum function + // Should return true if and only if the input is an alphanumeric char + + TS_ASSERT_EQUALS(Common::isAlnum('a'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('A'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('z'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('Z'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('1'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('0'), 1); + TS_ASSERT_EQUALS(Common::isAlnum('§'), 0); + TS_ASSERT_EQUALS(Common::isAlnum('$'), 0); + TS_ASSERT_EQUALS(Common::isAlnum(' '), 0); + TS_ASSERT_EQUALS(Common::isAlnum('\n'), 0); + TS_ASSERT_EQUALS(Common::isAlnum('\b'), 0); + TS_ASSERT_EQUALS(Common::isAlnum(0), 0); + TS_ASSERT_EQUALS(Common::isAlnum(255), 0); + + } + + void test_is_alpha() { + + // Test the isAlpha function + // Should return true if and only if the input is an alphanumeric char + + TS_ASSERT_EQUALS(Common::isAlpha('a'), 1); + TS_ASSERT_EQUALS(Common::isAlpha('A'), 1); + TS_ASSERT_EQUALS(Common::isAlpha('z'), 1); + TS_ASSERT_EQUALS(Common::isAlpha('Z'), 1); + TS_ASSERT_EQUALS(Common::isAlpha('1'), 0); + TS_ASSERT_EQUALS(Common::isAlpha('0'), 0); + TS_ASSERT_EQUALS(Common::isAlpha('§'), 0); + TS_ASSERT_EQUALS(Common::isAlpha('$'), 0); + TS_ASSERT_EQUALS(Common::isAlpha(' '), 0); + TS_ASSERT_EQUALS(Common::isAlpha('\n'), 0); + TS_ASSERT_EQUALS(Common::isAlpha('\b'), 0); + TS_ASSERT_EQUALS(Common::isAlpha(0), 0); + TS_ASSERT_EQUALS(Common::isAlpha(255), 0); + + } + + void test_is_digit() { + + // Test the isDigit function + // Should return true if and only if the input is a single digit + + TS_ASSERT_EQUALS(Common::isDigit('a'), 0); + TS_ASSERT_EQUALS(Common::isDigit('A'), 0); + TS_ASSERT_EQUALS(Common::isDigit('z'), 0); + TS_ASSERT_EQUALS(Common::isDigit('Z'), 0); + TS_ASSERT_EQUALS(Common::isDigit('1'), 1); + TS_ASSERT_EQUALS(Common::isDigit('0'), 1); + TS_ASSERT_EQUALS(Common::isDigit('§'), 0); + TS_ASSERT_EQUALS(Common::isDigit('$'), 0); + TS_ASSERT_EQUALS(Common::isDigit(' '), 0); + TS_ASSERT_EQUALS(Common::isDigit('\n'), 0); + TS_ASSERT_EQUALS(Common::isDigit('\b'), 0); + TS_ASSERT_EQUALS(Common::isDigit(0), 0); + TS_ASSERT_EQUALS(Common::isDigit(255), 0); + + } + + void test_is_lower() { + + // Test the isLower function + // Should return true if and only if the input is a lowercase char + + TS_ASSERT_EQUALS(Common::isLower('a'), 1); + TS_ASSERT_EQUALS(Common::isLower('A'), 0); + TS_ASSERT_EQUALS(Common::isLower('z'), 1); + TS_ASSERT_EQUALS(Common::isLower('Z'), 0); + TS_ASSERT_EQUALS(Common::isLower('1'), 0); + TS_ASSERT_EQUALS(Common::isLower('0'), 0); + TS_ASSERT_EQUALS(Common::isLower('§'), 0); + TS_ASSERT_EQUALS(Common::isLower('$'), 0); + TS_ASSERT_EQUALS(Common::isLower(' '), 0); + TS_ASSERT_EQUALS(Common::isLower('\n'), 0); + TS_ASSERT_EQUALS(Common::isLower('\b'), 0); + TS_ASSERT_EQUALS(Common::isLower(0), 0); + TS_ASSERT_EQUALS(Common::isLower(255), 0); + + } + + + void test_is_upper() { + + // Test the isUpper function + // Should return true if and only if the input is an uppercase char + + TS_ASSERT_EQUALS(Common::isUpper('a'), 0); + TS_ASSERT_EQUALS(Common::isUpper('A'), 1); + TS_ASSERT_EQUALS(Common::isUpper('z'), 0); + TS_ASSERT_EQUALS(Common::isUpper('Z'), 1); + TS_ASSERT_EQUALS(Common::isUpper('1'), 0); + TS_ASSERT_EQUALS(Common::isUpper('0'), 0); + TS_ASSERT_EQUALS(Common::isUpper('§'), 0); + TS_ASSERT_EQUALS(Common::isUpper('$'), 0); + TS_ASSERT_EQUALS(Common::isUpper(' '), 0); + TS_ASSERT_EQUALS(Common::isUpper('\n'), 0); + TS_ASSERT_EQUALS(Common::isUpper('\b'), 0); + TS_ASSERT_EQUALS(Common::isUpper(0), 0); + TS_ASSERT_EQUALS(Common::isUpper(255), 0); + + } + void test_is_space() { + // isSpace should return true iff the character is some kind of whitespace + // or tab character + for (int c=0; c<255; c++) { + if (c==' ' || c=='\t' || c=='\r' || c=='\n' || c=='\v' || c=='\f') { + TS_ASSERT_EQUALS(Common::isSpace(c), 1); + } else { + TS_ASSERT_EQUALS(Common::isSpace(c), 0); + } + } + } + + void test_is_print() { + // isPrint should return true iff the input is a printable ascii char. + // That is to say, 0x20 to 0x7E. + for (int c=0; c<255; c++) { + if (c>=0x20 && c<=0x7E) { + TS_ASSERT_EQUALS(Common::isPrint(c), 1); + } else { + TS_ASSERT_EQUALS(Common::isPrint(c), 0); + } + } + } +}; -- cgit v1.2.3 From 377789db771d62c2c5aa30612e97caf8f3142016 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Fri, 19 Apr 2013 00:11:16 +0200 Subject: TEST: tests for common/rendermode.h tests for parseRenderMode, renderMode2GUIO and getRenderModeCode. --- test/common/rendermode.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 test/common/rendermode.h diff --git a/test/common/rendermode.h b/test/common/rendermode.h new file mode 100644 index 0000000000..a25c0982ed --- /dev/null +++ b/test/common/rendermode.h @@ -0,0 +1,85 @@ +#include +#include "common/rendermode.h" +#include "common/gui_options.h" +#include "common/str.h" + +class RenderModeTestSuite : public CxxTest::TestSuite +{ + public: + void test_parse_render_mode_good() { + /* + * Tests for parseRenderMode. + * It takes a code (case-insensitive) and spits a RenderMode back at you. + * These cases should work - the inputs are standard, there's just some + * fun with caps being had in here. + */ + TS_ASSERT_EQUALS(Common::parseRenderMode("fMTOwNs"), Common::kRenderFMTowns); + TS_ASSERT_EQUALS(Common::parseRenderMode("hercGrEen"), Common::kRenderHercG); + TS_ASSERT_EQUALS(Common::parseRenderMode("hercAmbeR"), Common::kRenderHercA); + TS_ASSERT_EQUALS(Common::parseRenderMode("CgA"), Common::kRenderCGA); + TS_ASSERT_EQUALS(Common::parseRenderMode("ega"), Common::kRenderEGA); + TS_ASSERT_EQUALS(Common::parseRenderMode("Vga"), Common::kRenderVGA); + TS_ASSERT_EQUALS(Common::parseRenderMode("AmigA"), Common::kRenderAmiga); + TS_ASSERT_EQUALS(Common::parseRenderMode("pc9821"), Common::kRenderPC9821); + TS_ASSERT_EQUALS(Common::parseRenderMode("PC9801"), Common::kRenderPC9801); + TS_ASSERT_EQUALS(Common::parseRenderMode("0"), Common::kRenderDefault); + } + + + void test_parse_render_mode_bad() { + /* + * These cases, according to the specification, should return the default. + * It is only mentioned that the function must be case insensitive. + * Whitespaces, in particular, should not be automatically trimmed. + */ + TS_ASSERT_EQUALS(Common::parseRenderMode("fmtowns "), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode("FM-TOWNS "), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode(" cga"), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode("\tC g A"), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode("\t"), Common::kRenderDefault); + // This is the only interesting bit: if the function was really, really + // broken it could be tempted to test for +-0x20. + TS_ASSERT_EQUALS(Common::parseRenderMode("pc Y8 21 "), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode(" PC\t9801 "), Common::kRenderDefault); + TS_ASSERT_EQUALS(Common::parseRenderMode("0"), Common::kRenderDefault); + } + + void test_get_render_mode_code_back_and_forth() { + /* + * What does getRenderModeCode return? + * Notably, the output should not be in mixed case. + */ + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("FMTOWNS")), "fmtowns", 7); + TS_ASSERT_DIFFERS(Common::getRenderModeCode(Common::parseRenderMode("FMTOWNS")), "fmtowns"); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("CGA")), "cga", 3); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("vga")), "vga", 3); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("Ega")), "ega", 3); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("AmiGa")), "amiga", 5); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("PC9821")), "pc9821", 6); + TS_ASSERT_SAME_DATA(Common::getRenderModeCode(Common::parseRenderMode("PC9801")), "pc9801", 6); + // Slightly more interesting: + // Make sure that we get a null pointer for 0 (and not the "0" string or stuff) + char *null_p = 0; + TS_ASSERT_EQUALS(Common::getRenderModeCode(Common::kRenderDefault), null_p); + } + + void test_render_2_guio () { + /* + * Verify that a rendermode is taken and the corresponding + * GUIO_xxxxx is returned. + */ + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderHercG), GUIO_RENDERHERCGREEN); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderHercA), GUIO_RENDERHERCAMBER); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderCGA), GUIO_RENDERCGA); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderEGA), GUIO_RENDEREGA); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderVGA), GUIO_RENDERVGA); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderAmiga), GUIO_RENDERAMIGA); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderFMTowns), GUIO_RENDERFMTOWNS); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderPC9821), GUIO_RENDERPC9821); + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderPC9801), GUIO_RENDERPC9801); + // renderMode2GUIO is supposed to return an empty string + // if given kRenderDefault as an argument + Common::String empty; + TS_ASSERT_EQUALS(Common::renderMode2GUIO(Common::kRenderDefault), empty); + } +}; -- cgit v1.2.3 From 2e4933dcd5a07f42d130c3cff4d8ebf13c3953d6 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Fri, 19 Apr 2013 00:56:28 +0200 Subject: TEST: reorganize test/common/util.h Split a few test cases in two. The resulting file is now better organized. --- test/common/util.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/common/util.h b/test/common/util.h index c11ab740de..3bd997a38f 100644 --- a/test/common/util.h +++ b/test/common/util.h @@ -4,16 +4,16 @@ class UtilTestSuite : public CxxTest::TestSuite { public: - void test_parsebool_good() { + // Test the parseBool function - // Test the parseBool function + // 'Regular' cases that must work + // (note that the function must be case insensitive): + + void test_parsebool_yesno() { bool valasbool; bool success; - // 'Regular' cases that must work - // (note that the function must be case insensitive): - Common::String string_1 ("Yes"); success = Common::parseBool (string_1, valasbool); TS_ASSERT_EQUALS(success, 1); @@ -23,6 +23,12 @@ public: success = Common::parseBool (string_2, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 0); + } + + void test_parsebool_truefalse() { + + bool valasbool; + bool success; Common::String string_3 ("tRuE"); success = Common::parseBool (string_3, valasbool); @@ -33,6 +39,12 @@ public: success = Common::parseBool (string_4, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 0); + } + + void test_parsebool_onezero() { + + bool valasbool; + bool success; Common::String string_5 ("1"); success = Common::parseBool (string_5, valasbool); -- cgit v1.2.3 From 6245a68632875fb4a58eb5ca9fe2e321c171127b Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Fri, 19 Apr 2013 17:00:12 +0200 Subject: TEST: Thorough testing for common/hash-str.h We test the various equal_to and hash functions therein. --- test/common/hash-str.h | 183 +++++++++++++++++++++++++++++++++++++++++++++++ test/common/huffman.h | 44 ++++++++---- test/common/rendermode.h | 5 +- test/common/util.h | 47 +++++++++--- 4 files changed, 250 insertions(+), 29 deletions(-) create mode 100644 test/common/hash-str.h diff --git a/test/common/hash-str.h b/test/common/hash-str.h new file mode 100644 index 0000000000..b106f66eda --- /dev/null +++ b/test/common/hash-str.h @@ -0,0 +1,183 @@ +#include +#include "common/hash-str.h" + +/** + * Test suite for common/hash-str.h + * We test a number of case sensitive/insensitive hash and compare functions + * using example strings and known hashes, trying to tackle + * as much edge cases as possible. + */ +class HashStrTestSuite : public CxxTest::TestSuite { + + public: + void test_case_sensitive_string_equal_to() { + + // Name says it all. + // This verifies that the function returns true + // for exactly the same string, false for the same + // string in mixed case and false for some edge cases + // with various spacings plus one character replaced + // by itself+128 (if there's some processing done after + // conversion to 7-bit ASCII this might yield funny results). + + const Common::String lower("test"); + const Common::String lower1("test"); + const Common::String mixed("tESt"); + const Common::String spaced("test "); + const Common::String doublespaced("test "); + const Common::String tabbed("test\t"); + const Common::String plus128("t\xE5est"); + // 'e'+128 = 0xE5 + + Common::CaseSensitiveString_EqualTo css_et; + TS_ASSERT_EQUALS(css_et(lower, mixed), false); + TS_ASSERT_EQUALS(css_et(lower, lower1), true); + TS_ASSERT_EQUALS(css_et(lower, lower), true); + + // Different sorts of whitespace are to be treated differently. + TS_ASSERT_EQUALS(css_et(lower, spaced), false); + TS_ASSERT_EQUALS(css_et(lower, tabbed), false); + TS_ASSERT_EQUALS(css_et(spaced, tabbed), false); + TS_ASSERT_EQUALS(css_et(spaced, doublespaced), false); + TS_ASSERT_EQUALS(css_et(lower, plus128), false); + } + + void test_ignore_case_equal_to() { + + // This should be probably called case_insensitive_string_equal_to + // or something,but it's basically the same thing as + // test_case_sensitive_string_equal_to, only it's case + // insensitive. + + const Common::String lower("test"); + const Common::String lower1("test"); + const Common::String mixed("tESt"); + const Common::String spaced("test "); + const Common::String mixedspaced("tESt "); + const Common::String doublespaced("test "); + const Common::String tabbed("test\t"); + const Common::String plus128("t\xE5est"); + + Common::IgnoreCase_EqualTo ic_et; + TS_ASSERT_EQUALS(ic_et(lower, mixed), true); + TS_ASSERT_EQUALS(ic_et(lower, lower1), true); + TS_ASSERT_EQUALS(ic_et(lower, lower), true); + // Edge case: + TS_ASSERT_EQUALS(ic_et(spaced, mixedspaced), true); + + // Different sorts of whitespace are to be treated differently. + TS_ASSERT_EQUALS(ic_et(lower, spaced), false); + TS_ASSERT_EQUALS(ic_et(lower, tabbed), false); + TS_ASSERT_EQUALS(ic_et(spaced, tabbed), false); + TS_ASSERT_EQUALS(ic_et(spaced, doublespaced), false); + TS_ASSERT_EQUALS(ic_et(lower, plus128), false); + } + + void test_case_sensitive_string_hash() { + + // Here we compute string hashes for different + // strings and see that the functor is case sensitive + // and does not ignore spaces. + // The hashes come from Python's hash() function. + + const Common::String lower("test"); + const uint lower_hash = 1308370872; + const Common::String lower1("test"); + const Common::String mixed("tESt"); + const uint mixed_hash = -1217273608; + const Common::String spaced("test "); + const uint spaced_hash = -1086267887; + const Common::String mixedspaced("tESt "); + const Common::String doublespaced("test "); + const Common::String tabbed("test\t"); + const uint tabbed_hash = -1086267848; + + Common::CaseSensitiveString_Hash css_h; + TS_ASSERT_EQUALS(css_h(lower), lower_hash); + TS_ASSERT_EQUALS(css_h(mixed), mixed_hash); + TS_ASSERT_EQUALS(css_h(spaced), spaced_hash); + TS_ASSERT_EQUALS(css_h(tabbed), tabbed_hash); + TS_ASSERT_DIFFERS(css_h(spaced), css_h(doublespaced)); + } + + void test_ignore_case_hash() { + // Same as test_case_sensitive_string_hash, but case insensitive. + const Common::String lower("test"); + const uint lower_hash = 1308370872; + const Common::String lower1("test"); + const Common::String mixed("tESt"); + const Common::String spaced("test "); + const uint spaced_hash = -1086267887; + const Common::String mixedspaced("tESt "); + const Common::String doublespaced("test "); + const Common::String tabbed("test\t"); + const uint tabbed_hash = -1086267848; + + Common::IgnoreCase_Hash ic_h; + TS_ASSERT_EQUALS(ic_h(lower), lower_hash); + TS_ASSERT_EQUALS(ic_h(mixed), lower_hash); + TS_ASSERT_EQUALS(ic_h(spaced), spaced_hash); + TS_ASSERT_EQUALS(ic_h(tabbed), tabbed_hash); + TS_ASSERT_EQUALS(ic_h(mixedspaced), spaced_hash); + TS_ASSERT_DIFFERS(ic_h(spaced), ic_h(doublespaced)); + } + + void test_cpp_string_hash () + { + // We run the same tests with Hash, + // a template specialization of Hash, also a functor. + // It is supposed to be case sensitive. + // Again, hashes come from Python's hash(). + + const Common::String lower("test"); + const uint lower_hash = 1308370872; + const Common::String lower1("test"); + const Common::String mixed("tESt"); + const uint mixed_hash = -1217273608; + const Common::String spaced("test "); + const uint spaced_hash = -1086267887; + const Common::String mixedspaced("tESt "); + const Common::String doublespaced("test "); + const Common::String tabbed("test\t"); + const uint tabbed_hash = -1086267848; + + Common::Hash h; + TS_ASSERT_EQUALS(h(lower), lower_hash); + TS_ASSERT_EQUALS(h(lower), h(lower1)); + TS_ASSERT_EQUALS(h(mixed), mixed_hash); + TS_ASSERT_EQUALS(h(spaced), spaced_hash); + TS_ASSERT_EQUALS(h(tabbed), tabbed_hash); + TS_ASSERT_DIFFERS(h(spaced), h(doublespaced)); + } + + void test_c_style_string_hash () + { + // Same as test_cpp_string_hash but with Hash, + // a template specialization of Hash, also a functor, + // that works with C-Style strings. + // It is supposed to be case sensitive. + + char lower[] = "test"; + const uint lower_hash = 1308370872; // CPython told me so + char lower1[] = "test"; + char mixed[] = "tESt"; + const uint mixed_hash = -1217273608; + char spaced[] = "test "; + const uint spaced_hash = -1086267887; + char mixedspaced[] = "tESt "; + char doublespaced[] = "test "; + char tabbed[] = "test\t"; + const uint tabbed_hash = -1086267848; + + Common::Hash h; + TS_ASSERT_EQUALS(h(lower), lower_hash); + TS_ASSERT_EQUALS(h(lower), h(lower1)); + TS_ASSERT_EQUALS(h(mixed), mixed_hash); + TS_ASSERT_EQUALS(h(spaced), spaced_hash); + TS_ASSERT_DIFFERS(h(spaced), h(mixedspaced)); + TS_ASSERT_EQUALS(h(tabbed), tabbed_hash); + TS_ASSERT_DIFFERS(h(spaced), h(doublespaced)); + } + + +}; diff --git a/test/common/huffman.h b/test/common/huffman.h index 52199a8ffd..53353aaa60 100644 --- a/test/common/huffman.h +++ b/test/common/huffman.h @@ -3,20 +3,27 @@ #include "common/bitstream.h" #include "common/memstream.h" -class HuffmanTestSuite : public CxxTest::TestSuite -{ +/** +* A test suite for the Huffman decoder in common/huffman.h +* The encoding used comes from the example on the Wikipedia page +* for Huffman. +* TODO: It could be improved by generating one at runtime. +*/ +class HuffmanTestSuite : public CxxTest::TestSuite { public: void test_get_with_full_symbols() { /* - * Testing the Huffman decoder. + * The class can be initialized with or without providing + * a max_length and a symbol table. + * We test with a table. * * Encoding (arbitrary, for testing purpouses): - * A=010 - * B=011 - * C=11 - * D=00 - * E=10 + * 0xA=010 + * 0xB=011 + * 0xC=11 + * 0xD=00 + * 0xE=10 */ uint32 codeCount = 5; @@ -25,7 +32,7 @@ class HuffmanTestSuite : public CxxTest::TestSuite const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; const uint32 symbols[] = {0xA, 0xB, 0xC, 0xD, 0xE}; - Common::Huffman h (maxLength, codeCount, codes, lengths, symbols); + Common::Huffman h(maxLength, codeCount, codes, lengths, symbols); byte input[] = {0x4F, 0x20}; // Provided input... @@ -53,8 +60,8 @@ class HuffmanTestSuite : public CxxTest::TestSuite void test_get_without_symbols() { /* - * This is basically the same as above, but - * I pass minimal arguments. + * This is basically the same as test_get_with_full_symbols, but + * I only pass the minimal required arguments. * Specifically, I avoid passing the symbols table, so that * array indices are used instead. * @@ -71,7 +78,7 @@ class HuffmanTestSuite : public CxxTest::TestSuite const uint8 lengths[] = {3,3,2,2,2}; const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; - Common::Huffman h (0, codeCount, codes, lengths, 0); + Common::Huffman h(0, codeCount, codes, lengths, 0); byte input[] = {0x4F, 0x20}; uint32 expected[] = {0, 1, 2, 3, 4, 3 ,3}; @@ -91,16 +98,23 @@ class HuffmanTestSuite : public CxxTest::TestSuite void test_get_after_set_symbols() { /* - * Another variation of the above. + * Another variation of test_get_with_full_symbols. * I use the setSymbols method to define, a posteriori, - * an alphabet to be used in place of array indices + * an alphabet to be used in place of array indices. + * The encoding is, at first, + * 0=010 + * 1=011 + * 2=11 + * 3=00 + * 4=10 + * (=array indices). */ uint32 codeCount = 5; const uint8 lengths[] = {3,3,2,2,2}; const uint32 codes[] = {0x2, 0x3, 0x3, 0x0, 0x2}; - Common::Huffman h (0, codeCount, codes, lengths, 0); + Common::Huffman h(0, codeCount, codes, lengths, 0); const uint32 symbols[] = {0xA, 0xB, 0xC, 0xD, 0xE}; h.setSymbols(symbols); diff --git a/test/common/rendermode.h b/test/common/rendermode.h index a25c0982ed..e5e277f16b 100644 --- a/test/common/rendermode.h +++ b/test/common/rendermode.h @@ -3,8 +3,7 @@ #include "common/gui_options.h" #include "common/str.h" -class RenderModeTestSuite : public CxxTest::TestSuite -{ +class RenderModeTestSuite : public CxxTest::TestSuite { public: void test_parse_render_mode_good() { /* @@ -63,7 +62,7 @@ class RenderModeTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(Common::getRenderModeCode(Common::kRenderDefault), null_p); } - void test_render_2_guio () { + void test_render_2_guio() { /* * Verify that a rendermode is taken and the corresponding * GUIO_xxxxx is returned. diff --git a/test/common/util.h b/test/common/util.h index 3bd997a38f..57688ff30b 100644 --- a/test/common/util.h +++ b/test/common/util.h @@ -1,16 +1,16 @@ #include #include "common/util.h" +/** + * Test suite for the functions in common/util.h + */ class UtilTestSuite : public CxxTest::TestSuite { -public: - - // Test the parseBool function - - // 'Regular' cases that must work - // (note that the function must be case insensitive): - + public: void test_parsebool_yesno() { + // First test for the parseBool function. + // These are the mixed case yes/no cases that must work + bool valasbool; bool success; @@ -27,6 +27,9 @@ public: void test_parsebool_truefalse() { + // First test for the parseBool function. + // These are the mixed case true/false cases that must work + bool valasbool; bool success; @@ -43,6 +46,12 @@ public: void test_parsebool_onezero() { + // Third test for the parseBool function. + // These are the 1/0 cases that must work. + // Note that while 'a-z'+0x20 must work just fine, + // '0-1'+0x20 should NOT; this is addressed in + // parsebool_bad + bool valasbool; bool success; @@ -79,6 +88,20 @@ public: success = Common::parseBool (string_3, valasbool); TS_ASSERT_EQUALS(success, 0); + // While 'a-z'+0x20 must work just fine, + // '0-1'+0x20 should NOT. '2' is not good either. + + Common::String string_4 ("\x50"); + success = Common::parseBool (string_4, valasbool); + TS_ASSERT_EQUALS(success, 0); + + Common::String string_5 ("\x51"); + success = Common::parseBool (string_5, valasbool); + TS_ASSERT_EQUALS(success, 0); + + Common::String string_6 ("2"); + success = Common::parseBool (string_6, valasbool); + TS_ASSERT_EQUALS(success, 0); } void test_is_al_num() { @@ -189,8 +212,10 @@ public: void test_is_space() { // isSpace should return true iff the character is some kind of whitespace // or tab character - for (int c=0; c<255; c++) { - if (c==' ' || c=='\t' || c=='\r' || c=='\n' || c=='\v' || c=='\f') { + for (int c = 0; c < 255; c++) { + if (c == ' ' || c == '\t' || + c == '\r' || c == '\n' || + c == '\v' || c == '\f') { TS_ASSERT_EQUALS(Common::isSpace(c), 1); } else { TS_ASSERT_EQUALS(Common::isSpace(c), 0); @@ -201,8 +226,8 @@ public: void test_is_print() { // isPrint should return true iff the input is a printable ascii char. // That is to say, 0x20 to 0x7E. - for (int c=0; c<255; c++) { - if (c>=0x20 && c<=0x7E) { + for (int c = 0; c < 255; c++) { + if (c >= 0x20 && c <= 0x7E) { TS_ASSERT_EQUALS(Common::isPrint(c), 1); } else { TS_ASSERT_EQUALS(Common::isPrint(c), 0); -- cgit v1.2.3 From e9406fad246efe975ce63dab207be76edf3e0998 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 24 Apr 2013 00:09:10 +0200 Subject: TEST: removed fixed hashes in test/common/hash-str.h The hash function does not necessarily have to conform to one specific algorithm as long as equals/differs is respected. --- test/common/hash-str.h | 59 +++++++++++++++++--------------------------------- test/common/util.h | 46 +++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 62 deletions(-) diff --git a/test/common/hash-str.h b/test/common/hash-str.h index b106f66eda..9eadea5755 100644 --- a/test/common/hash-str.h +++ b/test/common/hash-str.h @@ -26,8 +26,8 @@ class HashStrTestSuite : public CxxTest::TestSuite { const Common::String spaced("test "); const Common::String doublespaced("test "); const Common::String tabbed("test\t"); - const Common::String plus128("t\xE5est"); - // 'e'+128 = 0xE5 + const Common::String plus128("t\345est"); + // 'e'+128 = 0xE5 = 0o345 Common::CaseSensitiveString_EqualTo css_et; TS_ASSERT_EQUALS(css_et(lower, mixed), false); @@ -56,7 +56,7 @@ class HashStrTestSuite : public CxxTest::TestSuite { const Common::String mixedspaced("tESt "); const Common::String doublespaced("test "); const Common::String tabbed("test\t"); - const Common::String plus128("t\xE5est"); + const Common::String plus128("t\345est"); Common::IgnoreCase_EqualTo ic_et; TS_ASSERT_EQUALS(ic_et(lower, mixed), true); @@ -78,79 +78,64 @@ class HashStrTestSuite : public CxxTest::TestSuite { // Here we compute string hashes for different // strings and see that the functor is case sensitive // and does not ignore spaces. - // The hashes come from Python's hash() function. const Common::String lower("test"); - const uint lower_hash = 1308370872; const Common::String lower1("test"); const Common::String mixed("tESt"); - const uint mixed_hash = -1217273608; const Common::String spaced("test "); - const uint spaced_hash = -1086267887; const Common::String mixedspaced("tESt "); const Common::String doublespaced("test "); const Common::String tabbed("test\t"); - const uint tabbed_hash = -1086267848; Common::CaseSensitiveString_Hash css_h; - TS_ASSERT_EQUALS(css_h(lower), lower_hash); - TS_ASSERT_EQUALS(css_h(mixed), mixed_hash); - TS_ASSERT_EQUALS(css_h(spaced), spaced_hash); - TS_ASSERT_EQUALS(css_h(tabbed), tabbed_hash); + TS_ASSERT_EQUALS(css_h(lower), css_h(lower1)); + TS_ASSERT_DIFFERS(css_h(mixed), css_h(lower)); + TS_ASSERT_DIFFERS(css_h(spaced), css_h(lower)); + TS_ASSERT_DIFFERS(css_h(tabbed), css_h(spaced)); TS_ASSERT_DIFFERS(css_h(spaced), css_h(doublespaced)); } void test_ignore_case_hash() { // Same as test_case_sensitive_string_hash, but case insensitive. const Common::String lower("test"); - const uint lower_hash = 1308370872; const Common::String lower1("test"); const Common::String mixed("tESt"); const Common::String spaced("test "); - const uint spaced_hash = -1086267887; const Common::String mixedspaced("tESt "); const Common::String doublespaced("test "); const Common::String tabbed("test\t"); - const uint tabbed_hash = -1086267848; Common::IgnoreCase_Hash ic_h; - TS_ASSERT_EQUALS(ic_h(lower), lower_hash); - TS_ASSERT_EQUALS(ic_h(mixed), lower_hash); - TS_ASSERT_EQUALS(ic_h(spaced), spaced_hash); - TS_ASSERT_EQUALS(ic_h(tabbed), tabbed_hash); - TS_ASSERT_EQUALS(ic_h(mixedspaced), spaced_hash); + TS_ASSERT_EQUALS(ic_h(lower), ic_h(lower1)); + TS_ASSERT_EQUALS(ic_h(mixed), ic_h(lower)); + TS_ASSERT_EQUALS(ic_h(spaced), ic_h(mixedspaced)); + TS_ASSERT_DIFFERS(ic_h(tabbed), ic_h(lower)); TS_ASSERT_DIFFERS(ic_h(spaced), ic_h(doublespaced)); } - void test_cpp_string_hash () + void test_cpp_string_hash() { // We run the same tests with Hash, // a template specialization of Hash, also a functor. // It is supposed to be case sensitive. - // Again, hashes come from Python's hash(). const Common::String lower("test"); - const uint lower_hash = 1308370872; const Common::String lower1("test"); const Common::String mixed("tESt"); - const uint mixed_hash = -1217273608; const Common::String spaced("test "); - const uint spaced_hash = -1086267887; const Common::String mixedspaced("tESt "); const Common::String doublespaced("test "); const Common::String tabbed("test\t"); - const uint tabbed_hash = -1086267848; Common::Hash h; - TS_ASSERT_EQUALS(h(lower), lower_hash); TS_ASSERT_EQUALS(h(lower), h(lower1)); - TS_ASSERT_EQUALS(h(mixed), mixed_hash); - TS_ASSERT_EQUALS(h(spaced), spaced_hash); - TS_ASSERT_EQUALS(h(tabbed), tabbed_hash); + TS_ASSERT_DIFFERS(h(mixed), h(lower)); + TS_ASSERT_DIFFERS(h(spaced), h(lower)); + TS_ASSERT_DIFFERS(h(tabbed), h(spaced)); TS_ASSERT_DIFFERS(h(spaced), h(doublespaced)); } - void test_c_style_string_hash () + void test_c_style_string_hash() { // Same as test_cpp_string_hash but with Hash, // a template specialization of Hash, also a functor, @@ -158,25 +143,21 @@ class HashStrTestSuite : public CxxTest::TestSuite { // It is supposed to be case sensitive. char lower[] = "test"; - const uint lower_hash = 1308370872; // CPython told me so char lower1[] = "test"; char mixed[] = "tESt"; - const uint mixed_hash = -1217273608; char spaced[] = "test "; - const uint spaced_hash = -1086267887; char mixedspaced[] = "tESt "; char doublespaced[] = "test "; char tabbed[] = "test\t"; - const uint tabbed_hash = -1086267848; Common::Hash h; - TS_ASSERT_EQUALS(h(lower), lower_hash); TS_ASSERT_EQUALS(h(lower), h(lower1)); - TS_ASSERT_EQUALS(h(mixed), mixed_hash); - TS_ASSERT_EQUALS(h(spaced), spaced_hash); + TS_ASSERT_DIFFERS(h(mixed), h(lower)); + TS_ASSERT_DIFFERS(h(spaced), h(lower)); TS_ASSERT_DIFFERS(h(spaced), h(mixedspaced)); - TS_ASSERT_EQUALS(h(tabbed), tabbed_hash); + TS_ASSERT_DIFFERS(h(tabbed), h(spaced)); TS_ASSERT_DIFFERS(h(spaced), h(doublespaced)); + } diff --git a/test/common/util.h b/test/common/util.h index 57688ff30b..05e6243885 100644 --- a/test/common/util.h +++ b/test/common/util.h @@ -14,13 +14,13 @@ class UtilTestSuite : public CxxTest::TestSuite { bool valasbool; bool success; - Common::String string_1 ("Yes"); - success = Common::parseBool (string_1, valasbool); + Common::String string_1("Yes"); + success = Common::parseBool(string_1, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 1); - Common::String string_2 ("nO"); - success = Common::parseBool (string_2, valasbool); + Common::String string_2("nO"); + success = Common::parseBool(string_2, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 0); } @@ -33,13 +33,13 @@ class UtilTestSuite : public CxxTest::TestSuite { bool valasbool; bool success; - Common::String string_3 ("tRuE"); - success = Common::parseBool (string_3, valasbool); + Common::String string_3("tRuE"); + success = Common::parseBool(string_3, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 1); - Common::String string_4 ("fAlSe"); - success = Common::parseBool (string_4, valasbool); + Common::String string_4("fAlSe"); + success = Common::parseBool(string_4, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 0); } @@ -56,12 +56,12 @@ class UtilTestSuite : public CxxTest::TestSuite { bool success; Common::String string_5 ("1"); - success = Common::parseBool (string_5, valasbool); + success = Common::parseBool(string_5, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 1); - Common::String string_6 ("0"); - success = Common::parseBool (string_6, valasbool); + Common::String string_6("0"); + success = Common::parseBool(string_6, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 0); @@ -74,33 +74,33 @@ class UtilTestSuite : public CxxTest::TestSuite { // Bad cases that should not return success #1: // Random string - Common::String string_1 ("u_f1ght_l1k3_a_c0w"); - success = Common::parseBool (string_1, valasbool); + Common::String string_1("u_f1ght_l1k3_a_c0w"); + success = Common::parseBool(string_1, valasbool); TS_ASSERT_EQUALS(success, 0); // Bad cases that should not return success #2, #3: // The function should NOT accept trailing whitespaces: - Common::String string_2 (" yes"); - success = Common::parseBool (string_2, valasbool); + Common::String string_2(" yes"); + success = Common::parseBool(string_2, valasbool); TS_ASSERT_EQUALS(success, 0); - Common::String string_3 ("yes "); - success = Common::parseBool (string_3, valasbool); + Common::String string_3("yes "); + success = Common::parseBool(string_3, valasbool); TS_ASSERT_EQUALS(success, 0); // While 'a-z'+0x20 must work just fine, // '0-1'+0x20 should NOT. '2' is not good either. - Common::String string_4 ("\x50"); - success = Common::parseBool (string_4, valasbool); + Common::String string_4("\x50"); + success = Common::parseBool(string_4, valasbool); TS_ASSERT_EQUALS(success, 0); - Common::String string_5 ("\x51"); - success = Common::parseBool (string_5, valasbool); + Common::String string_5("\x51"); + success = Common::parseBool(string_5, valasbool); TS_ASSERT_EQUALS(success, 0); - Common::String string_6 ("2"); - success = Common::parseBool (string_6, valasbool); + Common::String string_6("2"); + success = Common::parseBool(string_6, valasbool); TS_ASSERT_EQUALS(success, 0); } -- cgit v1.2.3 From d2c85e19eb62f2e9a8ba3b1251ee42a1d68e92a5 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Sun, 2 Jun 2013 21:29:15 +0200 Subject: TEST: Whitespaces in test/common/ --- test/common/hash-str.h | 2 +- test/common/util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/common/hash-str.h b/test/common/hash-str.h index 9eadea5755..0391e7167f 100644 --- a/test/common/hash-str.h +++ b/test/common/hash-str.h @@ -150,7 +150,7 @@ class HashStrTestSuite : public CxxTest::TestSuite { char doublespaced[] = "test "; char tabbed[] = "test\t"; - Common::Hash h; + Common::Hash h; TS_ASSERT_EQUALS(h(lower), h(lower1)); TS_ASSERT_DIFFERS(h(mixed), h(lower)); TS_ASSERT_DIFFERS(h(spaced), h(lower)); diff --git a/test/common/util.h b/test/common/util.h index 05e6243885..cd65307612 100644 --- a/test/common/util.h +++ b/test/common/util.h @@ -55,7 +55,7 @@ class UtilTestSuite : public CxxTest::TestSuite { bool valasbool; bool success; - Common::String string_5 ("1"); + Common::String string_5("1"); success = Common::parseBool(string_5, valasbool); TS_ASSERT_EQUALS(success, 1); TS_ASSERT_EQUALS(valasbool, 1); -- cgit v1.2.3 From 1e646c5470514e5b5f159b43d43eec442b3aec38 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 11 Jul 2013 01:53:06 +0100 Subject: DC: Amend tests on serial disable/enable blocks. These now restore the original release build logic to ensure that we don't have issues with releases. Missing something here as _debug_build doesn't seem to work as I expected... --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index bf991491b0..7983f5a1ce 100755 --- a/configure +++ b/configure @@ -2375,7 +2375,7 @@ if test -n "$_host"; then DEFINES="$DEFINES -DDISABLE_TEXT_CONSOLE" DEFINES="$DEFINES -DDISABLE_COMMAND_LINE" # Enable serial debugging output only when --enable-debug is passed - if test "$_debug_build" != yes; then + if test "$_release_build" = yes -o "$_debug_build" != yes; then DEFINES="$DEFINES -DNOSERIAL" fi _optimization_level=-O3 @@ -2708,7 +2708,7 @@ case $_backend in LDFLAGS="$LDFLAGS "'$(ronindir)/lib/crt0.o' LDFLAGS="$LDFLAGS "'-L$(ronindir)/lib' # Enable serial debugging output only when --enable-debug is passed - if test "$_debug_build" != yes; then + if test "$_release_build" = yes -o "$_debug_build" != yes; then LIBS="$LIBS -lronin-noserial -lm" else LIBS="$LIBS -lronin -lm" -- cgit v1.2.3 From dcbc2f23998cefeee3bfb1a998f017fcf073a0c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 10 Jul 2013 22:07:16 -0400 Subject: TSAGE: Fixes for R2R Bridge and Landing bay --- engines/tsage/ringworld2/ringworld2_logic.cpp | 1 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ebb09a7e08..77856c6c1d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -90,6 +90,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 600: return new Scene600(); case 700: + // Lander Bay 2 return new Scene700(); case 800: // Sick bay diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 2c944f209e..288ba6eaf7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2743,7 +2743,7 @@ void Scene250::signal() { R2_GLOBALS._sceneManager.changeScene(300); break; case 139: - R2_GLOBALS._sceneManager.changeScene(139); + R2_GLOBALS._sceneManager.changeScene(700); break; case 91: R2_GLOBALS._sceneManager.changeScene(850); @@ -4989,7 +4989,7 @@ bool Scene500::SonicStunner::startAction(CursorType action, Event &event) { if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 520 : 502; - scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, this, NULL); return true; } else { return SceneActor::startAction(action, event); @@ -5078,7 +5078,7 @@ void Scene500::postInit(SceneObjectList *OwnerList) { } } - if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) != 500) && R2_GLOBALS.getFlag(27)) { + if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) == 500) && R2_GLOBALS.getFlag(27)) { _tanks1.postInit(); _tanks1.setup(502, 7, 1); _tanks1.setPosition(Common::Point(281, 120)); @@ -5233,7 +5233,7 @@ void Scene500::signal() { R2_GLOBALS._sceneManager.changeScene(700); break; case 501: - if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) { + if (R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500) { _stripNumber = 1100; _sceneMode = 523; setAction(&_sequenceManager1, this, 523, &R2_GLOBALS._player, NULL); @@ -5806,7 +5806,7 @@ void Scene600::dispatch() { } /*-------------------------------------------------------------------------- - * Scene 700 - + * Scene 700 - Lander Bay 2 * *--------------------------------------------------------------------------*/ Scene700::Scene700() { -- cgit v1.2.3 From 8b71a631ea392496f618b3f7bddb29963ced3592 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 11 Jul 2013 09:05:50 -0400 Subject: TSAGE: Further fixes for R2R landing bay --- engines/tsage/globals.cpp | 3 +++ engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 4589a926c9..372b9b0e82 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -374,6 +374,9 @@ void Ringworld2Globals::reset() { T2_GLOBALS._uiElements.updateInventory(); T2_GLOBALS._uiElements._active = false; + // Set the screen to track the player + _scrollFollower = &_player; + // Reset fields Common::fill(&_v1000[0], &_v1000[0x1000], 0); _v1000Flag = false; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 288ba6eaf7..41e356e013 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -4911,7 +4911,7 @@ bool Scene500::Doorway::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL); } else { scene->_sceneMode = 500; - scene->setAction(&scene->_sequenceManager1, scene, 500, &R2_GLOBALS._player, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 500, &R2_GLOBALS._player, this, NULL); } return true; -- cgit v1.2.3 From 1f6894ab25e95324e6847f3912812b4f5de8af6f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 11 Jul 2013 20:47:33 -0400 Subject: COMMON: Cleanup the MacResManager a bit --- common/macresman.cpp | 98 +++++++++++++++++++++++++++------------------------- common/macresman.h | 25 ++++++++------ 2 files changed, 65 insertions(+), 58 deletions(-) diff --git a/common/macresman.cpp b/common/macresman.cpp index 00562f746a..ba44caafd9 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -102,18 +102,18 @@ String MacResManager::computeResForkMD5AsString(uint32 length) const { return computeStreamMD5AsString(resForkStream, MIN(length, _resForkSize)); } -bool MacResManager::open(String filename) { +bool MacResManager::open(const String &fileName) { close(); #ifdef MACOSX // Check the actual fork on a Mac computer - String fullPath = ConfMan.get("path") + "/" + filename + "/..namedfork/rsrc"; + String fullPath = ConfMan.get("path") + "/" + fileName + "/..namedfork/rsrc"; FSNode resFsNode = FSNode(fullPath); if (resFsNode.exists()) { SeekableReadStream *macResForkRawStream = resFsNode.createReadStream(); if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { - _baseFileName = filename; + _baseFileName = fileName; return true; } @@ -123,38 +123,39 @@ bool MacResManager::open(String filename) { File *file = new File(); - // First, let's try to see if the Mac converted name exists - if (file->open(constructAppleDoubleName(filename)) && loadFromAppleDouble(*file)) { - _baseFileName = filename; + // Prefer standalone files first, starting with raw forks + if (file->open(fileName + ".rsrc") && loadFromRawFork(*file)) { + _baseFileName = fileName; return true; } file->close(); - // Check .bin too - if (file->open(filename + ".bin") && loadFromMacBinary(*file)) { - _baseFileName = filename; + // Then try for AppleDouble using Apple's naming + if (file->open(constructAppleDoubleName(fileName)) && loadFromAppleDouble(*file)) { + _baseFileName = fileName; return true; } file->close(); - // Maybe we have a dumped fork? - if (file->open(filename + ".rsrc") && loadFromRawFork(*file)) { - _baseFileName = filename; + // Check .bin for MacBinary next + if (file->open(fileName + ".bin") && loadFromMacBinary(*file)) { + _baseFileName = fileName; return true; } file->close(); - // Fine, what about just the data fork? - if (file->open(filename)) { - _baseFileName = filename; + // As a last resort, see if just the data fork exists + if (file->open(fileName)) { + _baseFileName = fileName; + // FIXME: Is this really needed? if (isMacBinary(*file)) { - file->seek(0, SEEK_SET); + file->seek(0); if (loadFromMacBinary(*file)) return true; } - file->seek(0, SEEK_SET); + file->seek(0); _stream = file; return true; } @@ -165,18 +166,18 @@ bool MacResManager::open(String filename) { return false; } -bool MacResManager::open(FSNode path, String filename) { +bool MacResManager::open(const FSNode &path, const String &fileName) { close(); #ifdef MACOSX // Check the actual fork on a Mac computer - String fullPath = path.getPath() + "/" + filename + "/..namedfork/rsrc"; + String fullPath = path.getPath() + "/" + fileName + "/..namedfork/rsrc"; FSNode resFsNode = FSNode(fullPath); if (resFsNode.exists()) { SeekableReadStream *macResForkRawStream = resFsNode.createReadStream(); if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { - _baseFileName = filename; + _baseFileName = fileName; return true; } @@ -184,52 +185,53 @@ bool MacResManager::open(FSNode path, String filename) { } #endif - // First, let's try to see if the Mac converted name exists - FSNode fsNode = path.getChild(constructAppleDoubleName(filename)); + // Prefer standalone files first, starting with raw forks + FSNode fsNode = path.getChild(fileName + ".rsrc"); if (fsNode.exists() && !fsNode.isDirectory()) { SeekableReadStream *stream = fsNode.createReadStream(); - if (loadFromAppleDouble(*stream)) { - _baseFileName = filename; + if (loadFromRawFork(*stream)) { + _baseFileName = fileName; return true; } delete stream; } - // Check .bin too - fsNode = path.getChild(filename + ".bin"); + // Then try for AppleDouble using Apple's naming + fsNode = path.getChild(constructAppleDoubleName(fileName)); if (fsNode.exists() && !fsNode.isDirectory()) { SeekableReadStream *stream = fsNode.createReadStream(); - if (loadFromMacBinary(*stream)) { - _baseFileName = filename; + if (loadFromAppleDouble(*stream)) { + _baseFileName = fileName; return true; } delete stream; } - // Maybe we have a dumped fork? - fsNode = path.getChild(filename + ".rsrc"); + // Check .bin for MacBinary next + fsNode = path.getChild(fileName + ".bin"); if (fsNode.exists() && !fsNode.isDirectory()) { SeekableReadStream *stream = fsNode.createReadStream(); - if (loadFromRawFork(*stream)) { - _baseFileName = filename; + if (loadFromMacBinary(*stream)) { + _baseFileName = fileName; return true; } delete stream; } - // Fine, what about just the data fork? - fsNode = path.getChild(filename); + // As a last resort, see if just the data fork exists + fsNode = path.getChild(fileName); if (fsNode.exists() && !fsNode.isDirectory()) { SeekableReadStream *stream = fsNode.createReadStream(); - _baseFileName = filename; + _baseFileName = fileName; + // FIXME: Is this really needed? if (isMacBinary(*stream)) { - stream->seek(0, SEEK_SET); + stream->seek(0); if (loadFromMacBinary(*stream)) return true; } - stream->seek(0, SEEK_SET); + stream->seek(0); _stream = stream; return true; } @@ -238,22 +240,22 @@ bool MacResManager::open(FSNode path, String filename) { return false; } -bool MacResManager::exists(const String &filename) { +bool MacResManager::exists(const String &fileName) { // Try the file name by itself - if (Common::File::exists(filename)) + if (File::exists(fileName)) return true; // Try the .rsrc extension - if (Common::File::exists(filename + ".rsrc")) + if (File::exists(fileName + ".rsrc")) return true; // Check if we have a MacBinary file - Common::File tempFile; - if (tempFile.open(filename + ".bin") && isMacBinary(tempFile)) + File tempFile; + if (tempFile.open(fileName + ".bin") && isMacBinary(tempFile)) return true; // Check if we have an AppleDouble file - if (tempFile.open(constructAppleDoubleName(filename)) && tempFile.readUint32BE() == 0x00051607) + if (tempFile.open(constructAppleDoubleName(fileName)) && tempFile.readUint32BE() == 0x00051607) return true; return false; @@ -480,10 +482,10 @@ SeekableReadStream *MacResManager::getResource(uint32 typeID, uint16 resID) { return _stream->readStream(len); } -SeekableReadStream *MacResManager::getResource(const String &filename) { +SeekableReadStream *MacResManager::getResource(const String &fileName) { for (uint32 i = 0; i < _resMap.numTypes; i++) { for (uint32 j = 0; j < _resTypes[i].items; j++) { - if (_resLists[i][j].nameOffset != -1 && filename.equalsIgnoreCase(_resLists[i][j].name)) { + if (_resLists[i][j].nameOffset != -1 && fileName.equalsIgnoreCase(_resLists[i][j].name)) { _stream->seek(_dataOffset + _resLists[i][j].dataOffset); uint32 len = _stream->readUint32BE(); @@ -499,13 +501,13 @@ SeekableReadStream *MacResManager::getResource(const String &filename) { return 0; } -SeekableReadStream *MacResManager::getResource(uint32 typeID, const String &filename) { +SeekableReadStream *MacResManager::getResource(uint32 typeID, const String &fileName) { for (uint32 i = 0; i < _resMap.numTypes; i++) { if (_resTypes[i].id != typeID) continue; for (uint32 j = 0; j < _resTypes[i].items; j++) { - if (_resLists[i][j].nameOffset != -1 && filename.equalsIgnoreCase(_resLists[i][j].name)) { + if (_resLists[i][j].nameOffset != -1 && fileName.equalsIgnoreCase(_resLists[i][j].name)) { _stream->seek(_dataOffset + _resLists[i][j].dataOffset); uint32 len = _stream->readUint32BE(); @@ -574,7 +576,7 @@ void MacResManager::readMap() { } } -Common::String MacResManager::constructAppleDoubleName(Common::String name) { +String MacResManager::constructAppleDoubleName(String name) { // Insert "._" before the last portion of a path name for (int i = name.size() - 1; i >= 0; i--) { if (i == 0) { diff --git a/common/macresman.h b/common/macresman.h index ed74da9cc6..cca6592f21 100644 --- a/common/macresman.h +++ b/common/macresman.h @@ -54,27 +54,32 @@ public: /** * Open a Mac data/resource fork pair. + * + * This uses SearchMan to find the data/resource forks. This should only be used + * from inside an engine. + * * @param filename The base file name of the file * @note This will check for the raw resource fork, MacBinary, and AppleDouble formats. * @return True on success */ - bool open(String filename); + bool open(const String &fileName); /** * Open a Mac data/resource fork pair. + * * @param path The path that holds the forks * @param filename The base file name of the file * @note This will check for the raw resource fork, MacBinary, and AppleDouble formats. * @return True on success */ - bool open(FSNode path, String filename); + bool open(const FSNode &path, const String &fileName); /** * See if a Mac data/resource fork pair exists. * @param filename The base file name of the file * @return True if either a data fork or resource fork with this name exists */ - static bool exists(const String &filename); + static bool exists(const String &fileName); /** * Close the Mac data/resource fork pair. @@ -93,12 +98,6 @@ public: */ bool hasResFork() const; - /** - * Check if the given stream is in the MacBinary format. - * @param stream The stream we're checking - */ - static bool isMacBinary(SeekableReadStream &stream); - /** * Read resource from the MacBinary file * @param typeID FourCC of the type @@ -176,7 +175,13 @@ private: bool loadFromMacBinary(SeekableReadStream &stream); bool loadFromAppleDouble(SeekableReadStream &stream); - static Common::String constructAppleDoubleName(Common::String name); + static String constructAppleDoubleName(String name); + + /** + * Check if the given stream is in the MacBinary format. + * @param stream The stream we're checking + */ + static bool isMacBinary(SeekableReadStream &stream); enum { kResForkNone = 0, -- cgit v1.2.3 From 52541fc2579ae58823f31e1eadb2a860f87148de Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 12 Jul 2013 21:16:50 +0200 Subject: TUCKER: Fix palette fades This is a regression from 362b0cd5e4a71a0b2610ff8abb6aeecddc842cf0 and fixes bug #3614686. --- engines/tucker/tucker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 2bd7c47b62..6b538a6fde 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -941,7 +941,7 @@ void TuckerEngine::fadeOutPalette(int colorsCount) { _system->getPaletteManager()->grabPalette(pal, 0, colorsCount); for (int color = 0; color < colorsCount; ++color) { for (int i = 0; i < 3; ++i) { - const int c = int(pal[color * 3 + i]) + kFadePaletteStep * 3; + const int c = int(pal[color * 3 + i]) + kFadePaletteStep * 4; pal[color * 3 + i] = MIN(c, _currentPalette[color * 3 + i]); } } @@ -954,7 +954,7 @@ void TuckerEngine::fadeInPalette(int colorsCount) { _system->getPaletteManager()->grabPalette(pal, 0, colorsCount); for (int color = 0; color < colorsCount; ++color) { for (int i = 0; i < 3; ++i) { - const int c = int(pal[color * 3 + i]) - kFadePaletteStep * 3; + const int c = int(pal[color * 3 + i]) - kFadePaletteStep * 4; pal[color * 3 + i] = MAX(c, 0); } } -- cgit v1.2.3 From e9bb9ddcf5cf2a4aa87ae9705e7ec2d69600becd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 12 Jul 2013 22:44:21 +0200 Subject: GRAPHICS: Be more robust with broken/unsupported thumbnail headers. This fixes future issues like bug #3614654: "ALL: ScummVM 1.5.0 can't read newer saved games". There are a few behavior changes introduced with this commit: - checkThumbnailHeader will now also report the presence of unsupported/broken (but skippable) headers. - skipThumbnail will also try to skip the data for broken/unsupported thumbnail data. - loadThumbnail will skip over broken/unsupported thumbnail data but still return 0 in this case. --- graphics/thumbnail.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp index d04c218624..e3f368dffa 100644 --- a/graphics/thumbnail.cpp +++ b/graphics/thumbnail.cpp @@ -43,7 +43,16 @@ struct ThumbnailHeader { #define ThumbnailHeaderSize (4+4+1+2+2+(1+4+4)) -bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool outputWarnings) { +enum HeaderState { + /// There is no header present + kHeaderNone, + /// The header present only has reliable values for version and size + kHeaderUnsupported, + /// The header is present and the version is supported + kHeaderPresent +}; + +HeaderState loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool outputWarnings) { header.type = in.readUint32BE(); // We also accept the bad 'BMHT' header here, for the sake of compatibility // with some older savegames which were written incorrectly due to a bug in @@ -51,16 +60,28 @@ bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool ou if (header.type != MKTAG('T','H','M','B') && header.type != MKTAG('B','M','H','T')) { if (outputWarnings) warning("couldn't find thumbnail header type"); - return false; + return kHeaderNone; } header.size = in.readUint32BE(); header.version = in.readByte(); + // Do a check whether any read errors had occured. If so we cannot use the + // values obtained for size and version because they might be bad. + if (in.err() || in.eos()) { + // TODO: We fake that there is no header. This is actually not quite + // correct since we found the start of the header and then things + // started to break. Right no we leave detection of this to the client. + // Since this case is caused by broken files, the client code should + // catch it anyway... If there is a nicer solution here, we should + // implement it. + return kHeaderNone; + } + if (header.version > THMB_VERSION) { if (outputWarnings) warning("trying to load a newer thumbnail version: %d instead of %d", header.version, THMB_VERSION); - return false; + return kHeaderUnsupported; } header.width = in.readUint16BE(); @@ -82,7 +103,15 @@ bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool ou header.format = createPixelFormat<565>(); } - return true; + if (in.err() || in.eos()) { + // When we reached this point we know that at least the size and + // version field was loaded successfully, thus we tell this header + // is not supported and silently hope that the client code is + // prepared to handle read errors. + return kHeaderUnsupported; + } else { + return kHeaderPresent; + } } } // end of anonymous namespace @@ -90,7 +119,12 @@ bool checkThumbnailHeader(Common::SeekableReadStream &in) { uint32 position = in.pos(); ThumbnailHeader header; - bool hasHeader = loadHeader(in, header, false); + // TODO: It is not clear whether this is the best semantics. Now + // checkThumbnailHeader will return true even when the thumbnail header + // found is actually not usable. However, most engines seem to use this + // to detect the presence of any header and if there is none it wont even + // try to skip it. Thus, this looks like the best solution for now... + bool hasHeader = (loadHeader(in, header, false) != kHeaderNone); in.seek(position, SEEK_SET); @@ -101,7 +135,9 @@ bool skipThumbnail(Common::SeekableReadStream &in) { uint32 position = in.pos(); ThumbnailHeader header; - if (!loadHeader(in, header, false)) { + // We can skip unsupported and supported headers. So we only seek back + // to the old position in case there is no header at all. + if (loadHeader(in, header, false) == kHeaderNone) { in.seek(position, SEEK_SET); return false; } @@ -111,10 +147,23 @@ bool skipThumbnail(Common::SeekableReadStream &in) { } Graphics::Surface *loadThumbnail(Common::SeekableReadStream &in) { + const uint32 position = in.pos(); ThumbnailHeader header; - - if (!loadHeader(in, header, true)) + HeaderState headerState = loadHeader(in, header, true); + + // Try to handle unsupported/broken headers gracefully. If there is no + // header at all, we seek back and return at this point. If there is an + // unsupported/broken header, we skip the actual data and return. The + // downside is that we might reset the end of stream flag with this and + // the client code would not be able to notice a read past the end of the + // stream at this point then. + if (headerState == kHeaderNone) { + in.seek(position, SEEK_SET); + return 0; + } else if (headerState == kHeaderUnsupported) { + in.seek(header.size - (in.pos() - position), SEEK_CUR); return 0; + } if (header.format.bytesPerPixel != 2 && header.format.bytesPerPixel != 4) { warning("trying to load thumbnail with unsupported bit depth %d", header.format.bytesPerPixel); -- cgit v1.2.3 From adf8cee449b42debbdc6578538a78127ada74cec Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 13 Jul 2013 01:48:30 +0200 Subject: GRAPHICS: Allow arbitrary input sizes for thumbnail scaling. Instead of a fixed 1/2 or 1/4 scaling we do a two step scaling now: 1) Scale image to width < 160*2 && height < [100,120]*2 with 1/4 or 1/2 nearest-neighbor. 2) Use a bilinear scaler to scale aspect preserving to 160x[100,120] This fixes bug #3614568 "GRAPHICS: Odd thumbnail sizes crash". --- graphics/scaler.h | 6 -- graphics/scaler/thumbnail_intern.cpp | 175 +++++++++++++++++++---------------- 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/graphics/scaler.h b/graphics/scaler.h index 54d022d202..1e5b796631 100644 --- a/graphics/scaler.h +++ b/graphics/scaler.h @@ -89,10 +89,4 @@ extern bool createThumbnailFromScreen(Graphics::Surface *surf); */ extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette); -/** - * Downscale screenshot to thumbnale size. - * - */ -extern bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in); - #endif diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 8a98263eee..2756e4026a 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -42,8 +42,10 @@ uint16 quadBlockInterpolate(const uint8 *src, uint32 srcPitch) { template void createThumbnail_2(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { - assert(width % 2 == 0); - assert(height % 2 == 0); + // Make sure the width and height is a multiple of 2. + width &= ~1; + height &= ~1; + for (int y = 0; y < height; y += 2) { for (int x = 0; x < width; x += 2, dstPtr += 2) { *((uint16 *)dstPtr) = quadBlockInterpolate(src + 2 * x, srcPitch); @@ -55,8 +57,10 @@ void createThumbnail_2(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 template void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { - assert(width % 4 == 0); - assert(height % 4 == 0); + // Make sure the width and height is a multiple of 4 + width &= ~3; + height &= ~3; + for (int y = 0; y < height; y += 4) { for (int x = 0; x < width; x += 4, dstPtr += 2) { uint16 upleft = quadBlockInterpolate(src + 2 * x, srcPitch); @@ -71,17 +75,88 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 } } -static void createThumbnail(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { - // only 1/2 and 1/4 downscale supported - if (width != 320 && width != 640) - return; +static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { + while (in.w / out.w >= 4 || in.h / out.h >= 4) { + createThumbnail_4<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); + in.w /= 4; + in.h /= 4; + } + + while (in.w / out.w >= 2 || in.h / out.h >= 2) { + createThumbnail_2<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); + in.w /= 2; + in.h /= 2; + } + + if ((in.w == out.w && in.h < out.h) || (in.w < out.w && in.h == out.h)) { + // In this case we simply center the input surface in the output + uint8 *dst = (uint8 *)out.getBasePtr((out.w - in.w) / 2, (out.h - in.h) / 2); + const uint8 *src = (const uint8 *)in.getBasePtr(0, 0); + + for (int y = 0; y < in.h; ++y) { + memcpy(dst, src, in.w * in.format.bytesPerPixel); + src += in.pitch; + dst += out.pitch; + } + } else { + // Assure the aspect of the scaled image still matches the original. + int targetWidth = out.w, targetHeight = out.h; + + const float inputAspect = (float)in.w / in.h; + const float outputAspect = (float)out.w / out.h; + + if (inputAspect > outputAspect) { + targetHeight = int(targetWidth / inputAspect); + } else if (inputAspect < outputAspect) { + targetWidth = int(targetHeight * inputAspect); + } + + // Make sure we are still in the bounds of the output + assert(targetWidth <= out.w); + assert(targetHeight <= out.h); + + // Center the image on the output surface + byte *dst = (byte *)out.getBasePtr((out.w - targetWidth) / 2, (out.h - targetHeight) / 2); + const uint dstLineIncrease = out.pitch - targetWidth * out.format.bytesPerPixel; + + const float scaleFactorX = (float)targetWidth / in.w; + const float scaleFactorY = (float)targetHeight / in.h; + + for (int y = 0; y < targetHeight; ++y) { + const float yFrac = (y / scaleFactorY); + const int y1 = (int)yFrac; + const int y2 = (y1 + 1 < in.h) ? (y1 + 1) : (in.h - 1); + + for (int x = 0; x < targetWidth; ++x) { + const float xFrac = (x / scaleFactorX); + const int x1 = (int)xFrac; + const int x2 = (x1 + 1 < in.w) ? (x1 + 1) : (in.w - 1); + + // Look up colors at the points + uint8 p1R, p1G, p1B; + Graphics::colorToRGB >(READ_UINT16(in.getBasePtr(x1, y1)), p1R, p1G, p1B); + uint8 p2R, p2G, p2B; + Graphics::colorToRGB >(READ_UINT16(in.getBasePtr(x2, y1)), p2R, p2G, p2B); + uint8 p3R, p3G, p3B; + Graphics::colorToRGB >(READ_UINT16(in.getBasePtr(x1, y2)), p3R, p3G, p3B); + uint8 p4R, p4G, p4B; + Graphics::colorToRGB >(READ_UINT16(in.getBasePtr(x2, y2)), p4R, p4G, p4B); + + const float xDiff = xFrac - x1; + const float yDiff = yFrac - y1; + + uint8 pR = ((1 - yDiff) * ((1 - xDiff) * p1R + xDiff * p2R) + yDiff * ((1 - xDiff) * p3R + xDiff * p4R)); + uint8 pG = ((1 - yDiff) * ((1 - xDiff) * p1G + xDiff * p2G) + yDiff * ((1 - xDiff) * p3G + xDiff * p4G)); + uint8 pB = ((1 - yDiff) * ((1 - xDiff) * p1B + xDiff * p2B) + yDiff * ((1 - xDiff) * p3B + xDiff * p4B)); - int downScaleMode = (width == 320) ? 2 : 4; - if (downScaleMode == 2) { - createThumbnail_2<565>(src, srcPitch, dstPtr, dstPitch, width, height); - } else if (downScaleMode == 4) { - createThumbnail_4<565>(src, srcPitch, dstPtr, dstPitch, width, height); + WRITE_UINT16(dst, Graphics::RGBToColor >(pR, pG, pB)); + dst += 2; + } + + // Move to the next line + dst = (byte *)dst + dstLineIncrease; + } } } @@ -134,75 +209,17 @@ static bool grabScreen565(Graphics::Surface *surf) { return true; } -bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) { - uint16 width = in.w; - uint16 inHeight = in.h; - - if (width < 320) { - // Special case to handle MM NES (uses a screen width of 256) - width = 320; - - // center MM NES screen - Graphics::Surface newscreen; - newscreen.create(width, in.h, in.format); - - uint8 *dst = (uint8 *)newscreen.getBasePtr((320 - in.w) / 2, 0); - const uint8 *src = (const uint8 *)in.getBasePtr(0, 0); - uint16 height = in.h; - - while (height--) { - memcpy(dst, src, in.pitch); - dst += newscreen.pitch; - src += in.pitch; - } - - in.free(); - in = newscreen; - } else if (width == 720) { - // Special case to handle Hercules mode - // - // NOTE: This code is pretty SCUMM specific. - // For other games this code might cut off - // not only the menu, but also other graphics. - width = 640; - inHeight = 400; - - // cut off menu and so on.. - Graphics::Surface newscreen; - newscreen.create(width, 400, in.format); - - uint8 *dst = (uint8 *)newscreen.getBasePtr(0, (400 - 240) / 2); - const uint8 *src = (const uint8 *)in.getBasePtr(41, 28); - - for (int y = 0; y < 240; ++y) { - memcpy(dst, src, 640 * in.format.bytesPerPixel); - dst += newscreen.pitch; - src += in.pitch; - } - - in.free(); - in = newscreen; - } else if (width == 640 && inHeight == 440) { - // Special case to handle KQ6 Windows: resize the screen to 640x480, - // adding a black band in the bottom. - inHeight = 480; - - Graphics::Surface newscreen; - newscreen.create(width, 480, in.format); - - memcpy(newscreen.getBasePtr(0, 0), in.getBasePtr(0, 0), width * 440 * in.format.bytesPerPixel); - - in.free(); - in = newscreen; +static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) { + int height; + if ((in.w == 320 && in.h == 200) || (in.w == 640 && in.h == 400)) { + height = kThumbnailHeight1; + } else { + height = kThumbnailHeight2; } - uint16 newHeight = !(inHeight % 240) ? kThumbnailHeight2 : kThumbnailHeight1; - - out.create(kThumbnailWidth, newHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - createThumbnail((const uint8 *)in.pixels, width * sizeof(uint16), (uint8 *)out.pixels, out.pitch, width, inHeight); - + out.create(kThumbnailWidth, height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); + scaleThumbnail(in, out); in.free(); - return true; } -- cgit v1.2.3 From 5ed7bec4c6605c5a8d81aa896418364de8d32607 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 12 Jul 2013 21:07:08 -0400 Subject: TSAGE: Extra comments for crane control scene --- engines/tsage/ringworld2/ringworld2_logic.cpp | 1 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 77856c6c1d..310a6afef3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -102,6 +102,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Deck #5 - By Lift return new Scene850(); case 900: + // Lander Bay 2 - Crane Controls return new Scene900(); /* Scene group #1 */ // diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 41e356e013..13d336ab71 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -7106,9 +7106,10 @@ void Scene850::signal() { } /*-------------------------------------------------------------------------- - * Scene 900 - + * Scene 900 - Lander Bay 2 - Crane Controls * *--------------------------------------------------------------------------*/ + Scene900::Actor4::Actor4() { _fieldA4 = 0; } -- cgit v1.2.3 From 8a098d75aa967b2361227df4a747b0eec223b098 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 12 Jul 2013 21:28:22 -0400 Subject: MORTEVIELLE: Fixed ifdef header guard naming --- engines/mortevielle/speech.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 4f98c4c3d7..73f8e16067 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -25,8 +25,8 @@ * Copyright (c) 1987-1989 Lankhor */ -#ifndef MORTEVIELLE_PAROLE_H -#define MORTEVIELLE_PAROLE_H +#ifndef MORTEVIELLE_SPEECH_H +#define MORTEVIELLE_SPEECH_H #include "common/scummsys.h" #include "mortevielle/sound.h" @@ -99,4 +99,5 @@ public: }; } // End of namespace Mortevielle + #endif -- cgit v1.2.3 From 23d9d5b509f290c44c6e2280d287da96eeabfe67 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Sat, 13 Jul 2013 01:08:43 +0200 Subject: WINTERMUTE: Remove fixedPath snippet fixedPath is apparently never used anywhere else in the class and this loop can cause the next one to never get to run. --- engines/wintermute/base/file/base_disk_file.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 3c1ecc7a73..5ffb06f854 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -66,12 +66,6 @@ static Common::FSNode getNodeForRelativePath(const Common::String &filename) { const Common::FSNode gameDataDir(ConfMan.get("path")); Common::FSNode curNode = gameDataDir; - Common::String fixedPath = ""; - while (!path.empty()) { - fixedPath += path.nextToken() + "/"; - } - fixedPath.deleteLastChar(); - // Parse all path-elements while (!path.empty()) { // Get the next path-component by slicing on '\\' -- cgit v1.2.3 From 364cfaf9d264045d752280a7b3fe3d3ca3e42aa4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 13 Jul 2013 22:10:21 +0200 Subject: MORTEVIELLE: Fix some typos identified by wjp --- engines/mortevielle/mortevielle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 46c7c75fa3..2734f8cc93 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -210,14 +210,14 @@ Common::ErrorCode MortevielleEngine::initialise() { } /** - * Loads the contents of the Mort.dat data file + * Loads the contents of the mort.dat data file */ Common::ErrorCode MortevielleEngine::loadMortDat() { Common::File f; // Open the mort.dat file if (!f.open(MORT_DAT)) { - GUIErrorMessage("Could not locate Mort.dat file"); + GUIErrorMessage("Could not locate 'mort.dat'."); return Common::kReadingFailed; } @@ -231,7 +231,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Check the version if (f.readByte() < MORT_DAT_REQUIRED_VERSION) { - GUIErrorMessage("The located mort.dat data file is too a version"); + GUIErrorMessage("The located mort.dat data file is too old, please download an updated version on scummvm.org"); return Common::kReadingFailed; } f.readByte(); // Minor version -- cgit v1.2.3 From a5864d992dc1d494c088e779e8300bdd438923f4 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 13 Jul 2013 22:58:27 +0200 Subject: DEVTOOLS: Fix unimportant memory/resource leaks CID 1022283, 1022284, 1022285 --- devtools/create_kyradat/create_kyradat.cpp | 7 ++++++- devtools/create_kyradat/pak.cpp | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp index ca809e0aac..01cde620e7 100644 --- a/devtools/create_kyradat/create_kyradat.cpp +++ b/devtools/create_kyradat/create_kyradat.cpp @@ -2350,8 +2350,10 @@ bool createIDMap(PAKFile &out, const ExtractInformation *eI, const int *needList for (const int *id = needList; *id != -1; ++id) { WRITE_BE_UINT16(dst, *id); dst += 2; const ExtractFilename *fDesc = getFilenameDesc(*id); - if (!fDesc) + if (!fDesc) { + delete[] map; return false; + } *dst++ = getTypeID(fDesc->type); WRITE_BE_UINT32(dst, getFilename(eI, *id)); dst += 4; } @@ -2359,15 +2361,18 @@ bool createIDMap(PAKFile &out, const ExtractInformation *eI, const int *needList char filename[12]; if (!getFilename(filename, eI, 0)) { fprintf(stderr, "ERROR: Could not create ID map for game\n"); + delete[] map; return false; } out.removeFile(filename); if (!out.addFile(filename, map, mapSize)) { fprintf(stderr, "ERROR: Could not add ID map \"%s\" to kyra.dat\n", filename); + delete[] map; return false; } + delete[] map; return true; } diff --git a/devtools/create_kyradat/pak.cpp b/devtools/create_kyradat/pak.cpp index 0203285a8f..0d085f563c 100644 --- a/devtools/create_kyradat/pak.cpp +++ b/devtools/create_kyradat/pak.cpp @@ -142,6 +142,7 @@ bool PAKFile::outputAllFiles() { printf("OK\n"); } else { printf("FAILED\n"); + fclose(file); return false; } fclose(file); @@ -168,6 +169,7 @@ bool PAKFile::outputFileAs(const char *f, const char *fn) { printf("OK\n"); } else { printf("FAILED\n"); + fclose(file); return false; } fclose(file); -- cgit v1.2.3 From d0df423575567c134da6586e50a1c8ec24a09d89 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 13 Jul 2013 23:08:32 +0200 Subject: DEVTOOLS: Fix unimportant memory/resource leaks CID 1022280, 1022281, 1022282 --- devtools/skycpt/cptcompiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devtools/skycpt/cptcompiler.cpp b/devtools/skycpt/cptcompiler.cpp index 2c7d33c73b..657f51b8a0 100644 --- a/devtools/skycpt/cptcompiler.cpp +++ b/devtools/skycpt/cptcompiler.cpp @@ -376,6 +376,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * uint32 asciiSize = (uint32)(asciiPos - asciiBuf); fwrite(&asciiSize, 1, 4, debOutf); fwrite(asciiBuf, 1, asciiSize, debOutf); + free(asciiBuf); // the direct links... fwrite(&dlinkCount, 2, 1, debOutf); @@ -438,6 +439,8 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE * diffNo++; } } + fclose(dif); + free(resCpts); assert(diffDest <= 8192); fwrite(&diffNo, 1, 2, debOutf); fwrite(&diffDest, 1, 2, debOutf); -- cgit v1.2.3 From a986df44e8a75885e2891be750bb486188c7f6c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Jul 2013 17:11:11 -0400 Subject: TSAGE: Fixes for R2R Crane Controls --- engines/tsage/core.cpp | 4 +- engines/tsage/globals.cpp | 8 +- engines/tsage/globals.h | 4 +- engines/tsage/graphics.cpp | 7 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 8 + engines/tsage/ringworld2/ringworld2_logic.h | 1 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 233 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes0.h | 27 ++- 8 files changed, 152 insertions(+), 140 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 1f3745d085..b359e16f52 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2468,10 +2468,10 @@ void SceneObject::postInit(SceneObjectList *OwnerList) { if (!OwnerList) OwnerList = g_globals->_sceneObjects; - if (!OwnerList->contains(this)) { + if (!OwnerList->contains(this) || ((_flags & OBJFLAG_REMOVE) != 0)) { _percent = 100; _priority = 255; - _flags = 4; + _flags = OBJFLAG_ZOOMED; _visage = 0; _strip = 1; _frame = 1; diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 372b9b0e82..86ac8985d5 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -385,8 +385,8 @@ void Ringworld2Globals::reset() { _v558C2 = 0; _animationCtr = 0; _v5657C = 0; - _v565E1 = 0; - _v565E3 = 0; + _electromagnetChangeAmount = 0; + _electromagnetZoom = 0; _v565E5 = 0; _v565E7 = 0; _v565E9 = -5; @@ -499,8 +499,8 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v558C2); s.syncAsSint16LE(_animationCtr); s.syncAsSint16LE(_v5657C); - s.syncAsSint16LE(_v565E1); - s.syncAsSint16LE(_v565E3); + s.syncAsSint16LE(_electromagnetChangeAmount); + s.syncAsSint16LE(_electromagnetZoom); s.syncAsSint16LE(_v565E5); s.syncAsSint16LE(_v565E7); s.syncAsSint16LE(_v565E9); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index d190b6a2a4..6eca937fda 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -261,8 +261,8 @@ public: Rect _v558B6; int _v558C2; int _animationCtr; - int _v565E1; - int _v565E3; + int _electromagnetChangeAmount; + int _electromagnetZoom; int _v565E5; int _v565E7; int _v565E9; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index af6e6f9b13..dc73408b0e 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -294,8 +294,11 @@ void GfxSurface::addDirtyRect(const Rect &r) { r2.translate(_bounds.left, _bounds.top); // Add to the dirty rect list - _dirtyRects.push_back(Rect(r2.left, r2.top, - MIN(r2.right + 1, SCREEN_WIDTH), MIN(r2.bottom + 1, SCREEN_HEIGHT))); + r2.right = MIN(r2.right + 1, SCREEN_WIDTH); + r2.bottom = MIN(r2.bottom + 1, SCREEN_HEIGHT); + + if (r2.isValidRect()) + _dirtyRects.push_back(r2); } } diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 310a6afef3..fa9a94209a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1093,6 +1093,14 @@ void SceneActor::postInit(SceneObjectList *OwnerList) { SceneObject::postInit(); } +void SceneActor::remove() { + R2_GLOBALS._sceneItems.remove(this); + _field9C = NULL; + _linkedActor = NULL; + + SceneObject::remove(); +} + bool SceneActor::startAction(CursorType action, Event &event) { bool handled = true; diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 24434568ad..fc25340785 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -260,6 +260,7 @@ class SceneActor: public SceneObject { public: virtual Common::String getClassName() { return "SceneActor"; } virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); virtual bool startAction(CursorType action, Event &event); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 13d336ab71..9b76617f2e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5997,7 +5997,7 @@ void Scene700::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.setup(700, 4, 1); - _actor1.setPosition(Common::Point(355 - ((R2_GLOBALS._v565E3 * 8) / 5), ((R2_GLOBALS._v565E1 + 20 ) / 5) - 12)); + _actor1.setPosition(Common::Point(355 - ((R2_GLOBALS._electromagnetZoom * 8) / 5), ((R2_GLOBALS._electromagnetChangeAmount + 20 ) / 5) - 12)); _actor1.fixPriority(10); _actor1.setDetails(700, 12, -1, 14, 1, (SceneItem *) NULL); @@ -6044,7 +6044,7 @@ void Scene700::postInit(SceneObjectList *OwnerList) { case 700: switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) { case 0: - if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70)) _actor5.setup(701, 2, 1); else _actor5.setup(701, 2, 8); @@ -6209,7 +6209,7 @@ void Scene700::signal() { _sceneMode = 17; _actor5.setup(701, 1, 8); _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL); - if ((R2_GLOBALS._v565E5 != 0) && (_actor5._position.x == _actor1._position.x + 1) && (_actor5._position.x == 148 - (((R2_GLOBALS._v565E1 + 10) / 5) * 4))) { + if ((R2_GLOBALS._v565E5 != 0) && (_actor5._position.x == _actor1._position.x + 1) && (_actor5._position.x == 148 - (((R2_GLOBALS._electromagnetChangeAmount + 10) / 5) * 4))) { _actor5.animate(ANIM_MODE_6, NULL); Common::Point pt(_actor5._position.x, _actor1._position.y + 120); NpcMover *mover = new NpcMover(); @@ -6234,7 +6234,7 @@ void Scene700::signal() { break; case 21: _actor5.fixPriority(77); - if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70)) _actor5.animate(ANIM_MODE_6, NULL); R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700); @@ -6252,7 +6252,7 @@ void Scene700::signal() { case 706: _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL); _actor5.fixPriority(77); - if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) + if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70)) _actor5.animate(ANIM_MODE_6, NULL); R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0); R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700); @@ -7110,41 +7110,43 @@ void Scene850::signal() { * *--------------------------------------------------------------------------*/ -Scene900::Actor4::Actor4() { - _fieldA4 = 0; +Scene900::Button::Button() { + _buttonId = 0; } -void Scene900::Actor4::synchronize(Serializer &s) { +void Scene900::Button::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_buttonId); } -void Scene900::Actor4::sub96135(int arg1) { - _fieldA4 = arg1; + +void Scene900::Button::initButton(int buttonId) { + _buttonId = buttonId; + postInit(); setDetails(900, -1, -1, -1, 2, (SceneItem *) NULL); } Scene900::Scene900() { _field412 = 0; - _field414 = 0; - _field416 = 0; + _magnetChangeAmount.x = 0; + _magnetChangeAmount.y = 0; } void Scene900::synchronize(Serializer &s) { SceneExt::synchronize(s); s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); - s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_magnetChangeAmount.x); + s.syncAsSint16LE(_magnetChangeAmount.y); } -bool Scene900::Actor4::startAction(CursorType action, Event &event) { +bool Scene900::Button::startAction(CursorType action, Event &event) { Scene900 *scene = (Scene900 *)R2_GLOBALS._sceneManager._scene; if (action == CURSOR_USE) { R2_GLOBALS._sound2.play(14); - switch (_fieldA4) { + switch (_buttonId) { case 2: if (scene->_field412 == 1) { scene->_sceneMode = 2; @@ -7154,15 +7156,15 @@ bool Scene900::Actor4::startAction(CursorType action, Event &event) { scene->_aSound1.play(30); setup(900, 3, 11); R2_GLOBALS._v565E5 = 1; - if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS == 700)) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70) && (scene->_actor2._animateMode != ANIM_MODE_6)) { + if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS == 700)) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70) && (scene->_actor2._animateMode != ANIM_MODE_6)) { scene->_actor2.animate(ANIM_MODE_6, NULL); } else { - if (((scene->_actor3._percent * 49) / 100) + scene->_actor3._position.x == scene->_actor2._position.x) { - if (scene->_actor2._position.x == 166 - (R2_GLOBALS._v565E3 / 15)) { + if (((scene->_electromagnet._percent * 49) / 100) + scene->_electromagnet._position.x == scene->_actor2._position.x) { + if (scene->_actor2._position.x == 166 - (R2_GLOBALS._electromagnetZoom / 15)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 4; - scene->_actor2._moveDiff.y = (scene->_actor2._position.y - (scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2)) / 9; - Common::Point pt(scene->_actor3._position.x + ((scene->_actor3._percent * 49) / 100), scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2); + scene->_actor2._moveDiff.y = (scene->_actor2._position.y - (scene->_electromagnet._position.y + ((scene->_electromagnet._percent * 3) / 10) - 2)) / 9; + Common::Point pt(scene->_electromagnet._position.x + ((scene->_electromagnet._percent * 49) / 100), scene->_electromagnet._position.y + ((scene->_electromagnet._percent * 3) / 10) - 2); NpcMover *mover = new NpcMover(); scene->_actor2.addMover(mover, &pt, this); scene->_actor2.animate(ANIM_MODE_6, NULL); @@ -7183,7 +7185,7 @@ bool Scene900::Actor4::startAction(CursorType action, Event &event) { scene->_sceneMode = 5; scene->_actor2.animate(ANIM_MODE_5, NULL); scene->_actor2._moveDiff.y = (166 - scene->_actor2._position.y) / 9; - Common::Point pt(scene->_actor2._position.x, 166 - (R2_GLOBALS._v565E3 / 15)); + Common::Point pt(scene->_actor2._position.x, 166 - (R2_GLOBALS._electromagnetZoom / 15)); NpcMover *mover = new NpcMover(); scene->_actor2.addMover(mover, &pt, this); } @@ -7200,30 +7202,30 @@ bool Scene900::Actor4::startAction(CursorType action, Event &event) { return true; break; case 4: - if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 != 0)) { + if ((scene->_magnetChangeAmount.y == 0) && (scene->_magnetChangeAmount.x == 0) && (R2_GLOBALS._electromagnetZoom != 0)) { scene->_aSound1.play(38); - scene->_field416 = -5; + scene->_magnetChangeAmount.y = -5; } return true; break; case 5: - if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 < 135)) { + if ((scene->_magnetChangeAmount.y == 0) && (scene->_magnetChangeAmount.x == 0) && (R2_GLOBALS._electromagnetZoom < 135)) { scene->_aSound1.play(38); - scene->_field416 = 5; + scene->_magnetChangeAmount.y = 5; } return true; break; case 6: - if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 > -10)) { + if ((scene->_magnetChangeAmount.y == 0) && (scene->_magnetChangeAmount.x == 0) && (R2_GLOBALS._electromagnetChangeAmount > -10)) { scene->_aSound1.play(38); - scene->_field414 = -5; + scene->_magnetChangeAmount.x = -5; } return true; break; case 7: - if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 < 20)) { + if ((scene->_magnetChangeAmount.y == 0) && (scene->_magnetChangeAmount.x == 0) && (R2_GLOBALS._electromagnetChangeAmount < 20)) { scene->_aSound1.play(38); - scene->_field414 = 5; + scene->_magnetChangeAmount.x = 5; } return true; break; @@ -7238,12 +7240,12 @@ bool Scene900::Actor4::startAction(CursorType action, Event &event) { default: if (scene->_field412 == 1) { R2_GLOBALS._player.disableControl(); - scene->_actor5.remove(); - scene->_actor6.remove(); - scene->_actor7.remove(); - scene->_actor8.remove(); - scene->_actor9.remove(); - scene->_actor10.remove(); + scene->_button2.remove(); + scene->_button3.remove(); + scene->_button4.remove(); + scene->_button5.remove(); + scene->_button6.remove(); + scene->_button7.remove(); R2_GLOBALS._sound2.play(37); scene->_sceneMode = 901; scene->setAction(&scene->_sequenceManager1, scene, 901, &scene->_actor1, this ,NULL); @@ -7256,10 +7258,8 @@ bool Scene900::Actor4::startAction(CursorType action, Event &event) { break; } } else if (action == CURSOR_LOOK) { - if ((_fieldA4 == 2) && (scene->_field412 == 2)) - SceneItem::display(900, 21, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); - else - SceneItem::display(900, _fieldA4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(900, ((_buttonId == 2) && (scene->_field412 == 2)) ? 21 : _buttonId + 11, + SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, -999); return true; } else { return SceneActor::startAction(action, event); @@ -7279,16 +7279,15 @@ void Scene900::postInit(SceneObjectList *OwnerList) { _actor1.postInit(); _actor1.setDetails(900, 3, -1, -1, 1, (SceneItem *) NULL); - _field414 = 0; - _field416 = 0; + _magnetChangeAmount.x = 0; + _magnetChangeAmount.y = 0; - _actor3.postInit(); - _actor3.fixPriority(1); - // useless, the original use it for debugging purposes: strcpy(_actor3._actorName, "Crane"); - _actor3.setup(900, 1, 2); - _actor3.setPosition(Common::Point(89, 0)); - _actor3._effect = 1; - _actor3.setDetails(900, 6, -1, 8, 1, (SceneItem *) NULL); + _electromagnet.postInit(); + _electromagnet.fixPriority(1); + _electromagnet.setup(900, 1, 2); + _electromagnet.setPosition(Common::Point(89, 0)); + _electromagnet._effect = 1; + _electromagnet.setDetails(900, 6, -1, 8, 1, (SceneItem *) NULL); if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) != 1) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 1)) { _actor2.postInit(); @@ -7298,7 +7297,7 @@ void Scene900::postInit(SceneObjectList *OwnerList) { if (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) { if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 700) { _actor2.setup(901, 3, 2); - } else if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) { + } else if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70)) { _actor2.setup(901, 2, 1); } else { _actor2.setup(901, 2, 8); @@ -7310,7 +7309,7 @@ void Scene900::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._v565E7 == 0) { _actor2.setup(901, 1, 8); // Original set two times the same values: skipped - _actor2.setPosition(Common::Point((((100 - ((R2_GLOBALS._v565EB * 350) / 100)) * 49) / 100) + ((R2_GLOBALS._v565E9 * _actor3._percent * 6) / 100) + 89, 166 - (R2_GLOBALS._v565EB / 3))); + _actor2.setPosition(Common::Point((((100 - ((R2_GLOBALS._v565EB * 350) / 100)) * 49) / 100) + ((R2_GLOBALS._v565E9 * _electromagnet._percent * 6) / 100) + 89, 166 - (R2_GLOBALS._v565EB / 3))); _actor2.changeZoom(((100 - ((R2_GLOBALS._v565EB * 350) / 100) + 52) / 10) * 10); } } @@ -7333,68 +7332,68 @@ void Scene900::signal() { _field412 = 1; R2_GLOBALS._sound2.play(37); - _actor5.remove(); - _actor6.remove(); - _actor7.remove(); - _actor8.remove(); - _actor9.remove(); - _actor10.remove(); + _button2.remove(); + _button3.remove(); + _button4.remove(); + _button5.remove(); + _button6.remove(); + _button7.remove(); - _actor5.sub96135(2); - _actor5.setup(900, 2, 1); - _actor5.setPosition(Common::Point(36, 166)); + _button2.initButton(2); + _button2.setup(900, 2, 1); + _button2.setPosition(Common::Point(36, 166)); - _actor6.sub96135(3); - _actor6.setup(900, 2, 5); - _actor6.setPosition(Common::Point(117, 166)); + _button3.initButton(3); + _button3.setup(900, 2, 5); + _button3.setPosition(Common::Point(117, 166)); break; case 2: _field412 = 2; - _actor5.remove(); - _actor6.remove(); + _button2.remove(); + _button3.remove(); - _actor5.sub96135(2); + _button2.initButton(2); if (R2_GLOBALS._v565E5 == 0) - _actor5.setup(900, 3, 9); + _button2.setup(900, 3, 9); else - _actor5.setup(900, 3, 11); - _actor5.setPosition(Common::Point(36, 166)); + _button2.setup(900, 3, 11); + _button2.setPosition(Common::Point(36, 166)); - _actor7.sub96135(5); - _actor7.setup(900, 3, 3); - _actor7.setPosition(Common::Point(76, 134)); + _button4.initButton(5); + _button4.setup(900, 3, 3); + _button4.setPosition(Common::Point(76, 134)); - _actor8.sub96135(4); - _actor8.setup(900, 3, 7); - _actor8.setPosition(Common::Point(76, 156)); + _button5.initButton(4); + _button5.setup(900, 3, 7); + _button5.setPosition(Common::Point(76, 156)); - _actor9.sub96135(6); - _actor9.setup(900, 3, 1); - _actor9.setPosition(Common::Point(55, 144)); + _button6.initButton(6); + _button6.setup(900, 3, 1); + _button6.setPosition(Common::Point(55, 144)); - _actor10.sub96135(7); - _actor10.setup(900, 3, 5); - _actor10.setPosition(Common::Point(99, 144)); + _button7.initButton(7); + _button7.setup(900, 3, 5); + _button7.setPosition(Common::Point(99, 144)); break; case 3: _field412 = 3; - _actor5.remove(); - _actor6.remove(); - _actor7.remove(); - _actor8.remove(); - _actor9.remove(); - _actor10.remove(); + _button2.remove(); + _button3.remove(); + _button4.remove(); + _button5.remove(); + _button6.remove(); + _button7.remove(); - _actor5.sub96135(8); - _actor5.setup(900, 4, 1); - _actor5.setPosition(Common::Point(36, 166)); + _button2.initButton(8); + _button2.setup(900, 4, 1); + _button2.setPosition(Common::Point(36, 166)); - _actor6.sub96135(9); - _actor6.setup(900, 4, 5); - _actor6.setPosition(Common::Point(117, 166)); + _button3.initButton(9); + _button3.setup(900, 4, 5); + _button3.setPosition(Common::Point(117, 166)); break; case 4: _sceneMode = 0; @@ -7408,9 +7407,9 @@ void Scene900::signal() { _actor1.setup(900, 1, 1); - _actor4.sub96135(1); - _actor4.setup(900, 1, 3); - _actor4.setPosition(Common::Point(77, 168)); + _button1.initButton(1); + _button1.setup(900, 1, 3); + _button1.setPosition(Common::Point(77, 168)); _sceneMode = 1; signal(); @@ -7429,26 +7428,28 @@ void Scene900::signal() { } void Scene900::dispatch() { - if (_field416 != 0) { - if (_field416 < 0) { - R2_GLOBALS._v565E3--; - ++_field416; + if (_magnetChangeAmount.y != 0) { + if (_magnetChangeAmount.y < 0) { + R2_GLOBALS._electromagnetZoom--; + ++_magnetChangeAmount.y; } else { - ++R2_GLOBALS._v565E3; - _field416--; + ++R2_GLOBALS._electromagnetZoom; + _magnetChangeAmount.y--; } } - if (_field414 != 0) { - R2_GLOBALS._v565E1--; - ++_field414; - } else { - ++R2_GLOBALS._v565E1; - _field414++; + if (_magnetChangeAmount.x != 0) { + if (_magnetChangeAmount.x < 0) { + R2_GLOBALS._electromagnetChangeAmount--; + ++_magnetChangeAmount.x; + } else { + ++R2_GLOBALS._electromagnetChangeAmount; + _magnetChangeAmount.x--; + } } if (R2_GLOBALS._sceneObjects->contains(&_actor2)) { - if ((R2_GLOBALS._v565E5 != 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) { + if ((R2_GLOBALS._v565E5 != 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (R2_GLOBALS._electromagnetChangeAmount == 20) && (R2_GLOBALS._electromagnetZoom == 70)) { if ((_actor2._frame > 1) && (_actor2._animateMode != ANIM_MODE_6)) _actor2.animate(ANIM_MODE_6, NULL); } else { @@ -7457,17 +7458,17 @@ void Scene900::dispatch() { } } - _actor3.changeZoom(100 - ((R2_GLOBALS._v565E3 * 70) / 100)); - _actor3.setPosition(Common::Point(((_actor3._percent * R2_GLOBALS._v565E1 * 6) / 100) + 89, R2_GLOBALS._v565E3)); + _electromagnet.changeZoom(100 - ((R2_GLOBALS._electromagnetZoom * 70) / 100)); + _electromagnet.setPosition(Common::Point(((_electromagnet._percent * R2_GLOBALS._electromagnetChangeAmount * 6) / 100) + 89, R2_GLOBALS._electromagnetZoom)); if ((R2_GLOBALS._sceneObjects->contains(&_actor2)) && (R2_GLOBALS._v565E7 != 0) && (!_actor2._mover) && (_actor2._animateMode == ANIM_MODE_NONE)) { - _actor2.setPosition(Common::Point(_actor3._position.x + ((_actor3._percent * 49) / 100), _actor3._position.y + ((_actor3._percent * 3) / 10))); - if (R2_GLOBALS._v565E3 >= 75) { + _actor2.setPosition(Common::Point(_electromagnet._position.x + ((_electromagnet._percent * 49) / 100), _electromagnet._position.y + ((_electromagnet._percent * 3) / 10))); + if (R2_GLOBALS._electromagnetZoom >= 75) { _actor2.setup(901, 1, 1); - _actor2.changeZoom(((_actor3._percent + 52) / 10) * 10); + _actor2.changeZoom(((_electromagnet._percent + 52) / 10) * 10); } else { _actor2.setup(901, 5, 1); - _actor2.changeZoom(((_actor3._percent / 10) * 10) + 30); + _actor2.changeZoom(((_electromagnet._percent / 10) * 10) + 30); } } Scene::dispatch(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 2f52f9578f..b229fd494b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -865,30 +865,29 @@ public: }; class Scene900 : public SceneExt { - class Actor4 : public SceneActor { + class Button : public SceneActor { public: - int _fieldA4; + int _buttonId; - Actor4(); - void sub96135(int arg1); + Button(); + void initButton(int buttonId); virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); }; public: int _field412; - int _field414; - int _field416; + Common::Point _magnetChangeAmount; NamedHotspot _item1; SceneActor _actor1; SceneActor _actor2; - SceneActor _actor3; - Actor4 _actor4; - Actor4 _actor5; - Actor4 _actor6; - Actor4 _actor7; - Actor4 _actor8; - Actor4 _actor9; - Actor4 _actor10; + SceneActor _electromagnet; + Button _button1; + Button _button2; + Button _button3; + Button _button4; + Button _button5; + Button _button6; + Button _button7; ASoundExt _aSound1; SequenceManager _sequenceManager1; -- cgit v1.2.3 From 7ca31f66d85d88cbd6c3ec951571b59e4875001d Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 13 Jul 2013 22:40:49 +0100 Subject: MORTEVIELLE: Add missing eol character in devtool usage message --- devtools/create_mortdat/create_mortdat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 6fe115d5c4..2dff398de2 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -149,7 +149,7 @@ void process() { */ int main(int argc, char *argv[]) { if (argc != 2) { - printf("Usage:\n%s input_filename\nWhere input_filename is the name of the Mortevielle DOS executable", argv[0]); + printf("Usage:\n%s input_filename\nWhere input_filename is the name of the Mortevielle DOS executable.\n", argv[0]); exit(0); } -- cgit v1.2.3 From 79886597e77672dd58a453a627144eae3926b07e Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 13 Jul 2013 22:41:25 +0100 Subject: MORTEVIELLE: Convert non-ASCII characters to their octal value --- devtools/create_mortdat/enginetext.h | 10 +- devtools/create_mortdat/gametext.h | 488 +++++++++++++++++------------------ 2 files changed, 249 insertions(+), 249 deletions(-) diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index c4929141d3..f785c4d974 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -82,19 +82,19 @@ const char *engineDataEn[] = { const char *engineDataFr[] = { "[2][ ][OUI][NON]", "aller", - "quelqu'un entre, parait ‚tonn‚ mais ne dit rien", + "quelqu'un entre, parait \202tonn\202 mais ne dit rien", "Cool", " Lourde ", "Malsaine", "Idem", "Vous", - "tes", + "\210tes", "SEUL", "Mince! Vous entendez du bruit...", - " | Vous devriez avoir remarqu‚| ", + " | Vous devriez avoir remarqu\202| ", "% des indices...", - "D‚sirez-vous vous r‚veiller?", + "D\202sirez-vous vous r\202veiller?", "OK", "", " Sauvegarde", @@ -123,7 +123,7 @@ const char *engineDataFr[] = { "fermer", "frapper", "poser", - "d‚foncer", + "d\202foncer", "sentir", "gratter", diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index 6e43258e88..f8fe070bf0 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -285,7 +285,7 @@ const char *gameDataEn[] = { "Julia's bedroom$", "The photo at Julia's home$", "Julia and yourself...$", - "L‚o's occupations$", + "L\202o's occupations$", "Pat's occupations$", "Guy's occupations$", "Bob's occupations$", @@ -294,7 +294,7 @@ const char *gameDataEn[] = { "Ida's occupations$", "Max's occupations$", "Your occupations$", - "L‚o's relationships$", + "L\202o's relationships$", "Pat's relationships$", "Guy's relationships$", "Bob's relationships$", @@ -324,7 +324,7 @@ const char *gameDataEn[] = { "These are the mountains one can see in front of the manor$", "I don't know!$", "She died from pulmonary embolism$", - "Mother died suddenly. And yet her health had seemed to improve‚$", + "Mother died suddenly. And yet her health had seemed to improve\202$", "Miss DEFRANCK died from a cold$", "She died from pulmonary embolism$", "Excuse me but I prefer to say nothing for now$", @@ -493,7 +493,7 @@ const char *gameDataEn[] = { "Directed by: KYILKHOR CREATION and LANGLOIS$", "$", "With the cooperation of...$", - "B‚atrice et Jean_Luc LANGLOIS$", + "B\202atrice et Jean_Luc LANGLOIS$", "for the music and the voices,$", "Bernard GRELAUD for the graphic conception,$", "MARIA-DOLORES for the graphic direction,$", @@ -592,7 +592,7 @@ const char *gameDataEn[] = { "- Eleven$", "What was the first name@of the unknown character?$", "- Mireille$", - "- Fran‡oise$", + "- Fran\207oise$", "- Maguy$", "- Emilie$", "- Murielle$", @@ -617,9 +617,9 @@ const char *gameDataEn[] = { const char *gameDataFr[] = { "Le calme dans la tourmente$", - "Des go—ts et des couleurs!$", + "Des go\227ts et des couleurs!$", "Mauve qui peut!$", - "PriŠre de laisser en sortant...$", + "Pri\212re de laisser en sortant...$", "Trou noir troublant$", "Bleu... comme \"peur bleue\"!$", "Chambre de \"Saigneur\"!$", @@ -629,33 +629,33 @@ const char *gameDataFr[] = { "Odeur de feux de bois et de tabac$", "Tabac et vieux bouquins$", "Oignons, cannelle et spiritueux$", - "Un endroit bien peu visit‚$", - "Humidit‚ et moisissure$", + "Un endroit bien peu visit\202$", + "Humidit\202 et moisissure$", "Avis aux colporteurs...$", - "Corps putr‚fi‚ : cryptomanie mortelle!$", - "Et en plus... des piŠges d‚samorc‚s!$", - "C'est d‚j… ouvert$", + "Corps putr\202fi\202 : cryptomanie mortelle!$", + "Et en plus... des pi\212ges d\202samorc\202s!$", + "C'est d\202j\205 ouvert$", "Danger : avalanches$", - "Une odeur de saintet‚!$", - "Une btisse imposante$", - "L'envers du mystŠre!$", - "Dr“le d'horoscope!$", + "Une odeur de saintet\202!$", + "Une b\203tisse imposante$", + "L'envers du myst\212re!$", + "Dr\223le d'horoscope!$", "Tant va la cruche...$", - "Une porte en chŠne$", + "Une porte en ch\212ne$", "Une photo$", "Les armoiries$", "$", - "Max, le domestique, vous accueille puis vous conduit … votre chambre$", - "Mortevielle, le 16/2/51@ Mon cher J‚r“me,@ Suite … mon t‚l‚gramme, je vous fais part des raisons de mon inqui‚tude :il y a un an, Murielle, ma dame de compagnie, disparaissait . D‚part ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile … comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'… pr‚sent, faire le jour sur cette affaire, je compte sur vous pour la mener … bien . Si mon ‚tat de sant‚ ne s'am‚liorait pas, prenez les d‚cisions qui vous sembleront le plus appropri‚es...@ Amiti‚s. JULIA DEFRANCK$", - "Plus tard, Guy vous apprendra le suicide de L‚o... aprŠs un pari insens‚ aux courses!$", + "Max, le domestique, vous accueille puis vous conduit \205 votre chambre$", + "Mortevielle, le 16/2/51@ Mon cher J\202r\223me,@ Suite \205 mon t\202l\202gramme, je vous fais part des raisons de mon inqui\202tude :il y a un an, Murielle, ma dame de compagnie, disparaissait . D\202part ayant rapport avec le renouveau financier du Manoir, ou... Silence difficile \205 comprendre, surtout pour mon fils Guy . N'ayant pu jusqu'\205 pr\202sent, faire le jour sur cette affaire, je compte sur vous pour la mener \205 bien . Si mon \202tat de sant\202 ne s'am\202liorait pas, prenez les d\202cisions qui vous sembleront le plus appropri\202es...@ Amiti\202s. JULIA DEFRANCK$", + "Plus tard, Guy vous apprendra le suicide de L\202o... apr\212s un pari insens\202 aux courses!$", "F3: encore@F8: suite$", - "Le maŚtre des lieux$", - "Le futur h‚ritier$", + "Le ma\214tre des lieux$", + "Le futur h\202ritier$", "Le fils de JULIA$", "Joli brin!!!$", "Superman!$", "Le mari d'Ida$", - "Propos int‚ressants?$", + "Propos int\202ressants?$", "Service compris...$", "Rien dessous!$", "Un ange passe...$", @@ -663,61 +663,61 @@ const char *gameDataFr[] = { "Admirez! Contemplez!$", "Non ! Rien !$", "Impossible$", - "‡a tache !$", - "Un trait‚ sur l'histoire de la r‚gion$", - "Quelques piŠces$", + "\207a tache !$", + "Un trait\202 sur l'histoire de la r\202gion$", + "Quelques pi\212ces$", "Premier commandement...$", - "Des p‚tales plein les narines !$", + "Des p\202tales plein les narines !$", "Pique, Coeur...$", - "‡a ne manque pas de cachets !$", + "\207a ne manque pas de cachets !$", "Un roman d'amour$", "Souffler n'est pas jouer$", - "Pas une r‚ussite!$", + "Pas une r\202ussite!$", "Gare aux rebondissements !$", "Sombre et profond...$", "Sensations normales$", "Sniff!$", "Pas discret ! Contentez-vous de regarder !$", - "Atchoum! De la p... poussiŠre$", - "La toile est sign‚e... pas le papier peint !$", + "Atchoum! De la p... poussi\212re$", + "La toile est sign\202e... pas le papier peint !$", "Pas de chance, rien !$", "Soyez plus discret !$", "Les volets sont clos$", "De la neige, encore de la neige !$", - "G‚nial : une toile de maŚtre !$", - "Aucun doute : une v‚ritable imitation$", + "G\202nial : une toile de ma\214tre !$", + "Aucun doute : une v\202ritable imitation$", "Hum ! Vous tiquez : de l'antique en toc !$", - "Une piŠce rare de valeur !$", + "Une pi\212ce rare de valeur !$", "Rien de remarquable$", "Linge, objets personnels...$", - "Pas n'importe o— !$", + "Pas n'importe o\227 !$", "Ce n'est pas l'heure !$", - "On ne parle pas la bouche pleine ! Donc, une fois le repas termin‚...$", + "On ne parle pas la bouche pleine ! Donc, une fois le repas termin\202...$", "Quelqu'un entre, s'affaire, ressort...$", "On s'approche de votre cachette !$", "On vous surprend !$", - "Non : vous tes trop charg‚ !$", + "Non : vous \210tes trop charg\202 !$", "Essayez de nouveau$", "Vous restez perplexe !?$", "Vous quittez le Manoir. A Paris, un message vous attend...$", - "A‹e, a‹e, a‹e !$", + "A\213e, a\213e, a\213e !$", "Rien de plus$", - "Le son paraŚt normal$", + "Le son para\214t normal$", "Ca ne bouge pas$", - "On vous r‚pond$", + "On vous r\202pond$", "Pas le moment !$", - "Mme matiŠre, autre face !$", - "Le reflet est piqu‚, mais le cadre est d'or$", + "M\210me mati\212re, autre face !$", + "Le reflet est piqu\202, mais le cadre est d'or$", "Bibelots, babioles...$", - "Vous essuyez un ‚chec !$", + "Vous essuyez un \202chec !$", "Il est des odeurs... qu'il vaut mieux ne pas voir !$", - "Des produits m‚nagers$", - "‡a vous d‚mange ?$", - "C'est coinc‚, gel‚ ! Brrrr...$", - "Les huisseries sont bloqu‚es !$", + "Des produits m\202nagers$", + "\207a vous d\202mange ?$", + "C'est coinc\202, gel\202 ! Brrrr...$", + "Les huisseries sont bloqu\202es !$", "Des papiers...$", - "Non ! Le pŠre Nol n'est pas coinc‚ !$", - "‡a donne sur un couloir$", + "Non ! Le p\212re No\210l n'est pas coinc\202 !$", + "\207a donne sur un couloir$", "Vaisselle, argenterie...$", "Non ! Ce ne sont pas les restes de Julia !$", "Une gravure ancienne$", @@ -726,17 +726,17 @@ const char *gameDataFr[] = { "Le passage se ferme$", "Un tiroir secret... Un livret ! Le lisez-vous ?$", "Le tiroir se referme$", - "Rien ! Sang et chairs collent … la pierre !$", - "Des d‚tails vous font supposer que... la mort ne fut pas imm‚diate !$", - "Des projets v‚reux ?$", - "Sa vie n'aurait-elle tenu qu'… un doigt ?$", - "Un tr‚sor se serait-il fait la malle ?$", - "Une fente de la taille d'une piŠce !$", - "Quelques pierres pivotent... Une crypte ! Y p‚n‚trez-vous ?$", + "Rien ! Sang et chairs collent \205 la pierre !$", + "Des d\202tails vous font supposer que... la mort ne fut pas imm\202diate !$", + "Des projets v\202reux ?$", + "Sa vie n'aurait-elle tenu qu'\205 un doigt ?$", + "Un tr\202sor se serait-il fait la malle ?$", + "Une fente de la taille d'une pi\212ce !$", + "Quelques pierres pivotent... Une crypte ! Y p\202n\202trez-vous ?$", "La bague tourne, le mur se referme...$", - "Une colonne de pierres derriŠre l'autel$", + "Une colonne de pierres derri\212re l'autel$", "Il y a du bruit...$", - "Occup‚ !$", + "Occup\202 !$", "Retentez-vous votre chance ?$", "Trop profond !$", "Le mur de la cave pivote$", @@ -745,45 +745,45 @@ const char *gameDataFr[] = { "L'objet glisse au fond...$", "Vous n'avez rien en main$", "Ce n'est pas ouvert$", - "Il y a d‚j… quelque chose$", - "La porte est ferm‚e$", - "Pas de r‚ponse$", + "Il y a d\202j\205 quelque chose$", + "La porte est ferm\202e$", + "Pas de r\202ponse$", "Une boule de bois pleine$", "Il n'y a plus de place$", - "Une boule de bois perc‚e par le travers$", + "Une boule de bois perc\202e par le travers$", "? ?$", "A vous de jouer$", "OK !$", - "Soudain Max survient avec votre valise : \"Merci de votre visite ! D‚tective \"priv‚\"... de bon sens et de discr‚tion sans doute\" . D‚‡u d‚moralis‚, vous quittez le manoir@Vous Štes NUL !$", - "L‚o vous interrompt : \"la tempŠte est calm‚e. Je pars en ville dans 1 heure. Tenez-vous prt!\"... Bon... Vous avez perdu du temps... mais pas la vie$", - "Congestion, grippe fatale : vous y restez ! Votre enquŠte tombe … l'eau$", - "L'eau monte trŠs vite et refroidit vos derniŠres illusions... Avant que vous n'ayez eu le temps de r‚agir, vous Štes mort!$", - "A peine Štes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", - "La tempŠte recouvre vos traces . Un mur de silence s'abat sur vos ‚paules . Lentement vous succombez … la morsure du froid !$", - "Pas si seul que ‡a ! Une lame glac‚e s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", - "Vous ignorez la responsabilit‚ exacte de L‚o dans la mort de Murielle... Est-elle morte sur le coup ? De toutes fa‡ons les problŠmes familiaux d‚couverts lors de votre enquŠte justifient l'attitude de L‚o... Vous n'Štes pas s—r que Julia vous ait appel‚ pour ‡a mais c'est suffisant pour vous ! Par respect pour elle, et aprŠs certaines pr‚cautions, vous avez une entrevue r‚v‚latrice avec L‚o$", + "Soudain Max survient avec votre valise : \"Merci de votre visite ! D\202tective \"priv\202\"... de bon sens et de discr\202tion sans doute\" . D\202\207u d\202moralis\202, vous quittez le manoir@Vous \212tes NUL !$", + "L\202o vous interrompt : \"la temp\212te est calm\202e. Je pars en ville dans 1 heure. Tenez-vous pr\210t!\"... Bon... Vous avez perdu du temps... mais pas la vie$", + "Congestion, grippe fatale : vous y restez ! Votre enqu\212te tombe \205 l'eau$", + "L'eau monte tr\212s vite et refroidit vos derni\212res illusions... Avant que vous n'ayez eu le temps de r\202agir, vous \212tes mort!$", + "A peine \212tes-vous au fond du puits qu'une main tranche la corde... Adieu la vie!$", + "La temp\212te recouvre vos traces . Un mur de silence s'abat sur vos \202paules . Lentement vous succombez \205 la morsure du froid !$", + "Pas si seul que \207a ! Une lame glac\202e s'enfonce dans votre dos. A l'avenir, soyez plus prudent!$", + "Vous ignorez la responsabilit\202 exacte de L\202o dans la mort de Murielle... Est-elle morte sur le coup ? De toutes fa\207ons les probl\212mes familiaux d\202couverts lors de votre enqu\212te justifient l'attitude de L\202o... Vous n'\212tes pas s\227r que Julia vous ait appel\202 pour \207a mais c'est suffisant pour vous ! Par respect pour elle, et apr\212s certaines pr\202cautions, vous avez une entrevue r\202v\202latrice avec L\202o$", "$", - "Vous n'avez pas les clefs du Manoir . Vos appels restent sans r‚ponse . Vous allez attraper... la mort !$", - "D'un mouvement circulaire, l'‚p‚e vous fend par le travers : tripes et boyaux … l'air, bonjour les vers!$", + "Vous n'avez pas les clefs du Manoir . Vos appels restent sans r\202ponse . Vous allez attraper... la mort !$", + "D'un mouvement circulaire, l'\202p\202e vous fend par le travers : tripes et boyaux \205 l'air, bonjour les vers!$", "Home, Sweet home !$", - "MystŠre d'une porte close$", - "Charme envo—tant de vieilles piŠces$", + "Myst\212re d'une porte close$", + "Charme envo\227tant de vieilles pi\212ces$", "La faim au ventre$", - "Plus prŠs du ciel? Pas s—r !$", + "Plus pr\212s du ciel? Pas s\227r !$", "Peur du noir?$", "Vieux tapis et reflets d'or$", "Angoisse !$", - "Sauv‚ ? Pas certain !$", - "Mal … l'aise, hein !$", + "Sauv\202 ? Pas certain !$", + "Mal \205 l'aise, hein !$", "Toujours plus loin !$", "Votre chemin de croix !$", - "A la d‚couverte de...$", - "Attention … ce que cache...$", + "A la d\202couverte de...$", + "Attention \205 ce que cache...$", "Une descente aux Enfers !$", "Si ce n'est pas dans vos cordes :@ ne soyez pas sot!$", - "Avant la mise en piŠce !$", + "Avant la mise en pi\212ce !$", "Gros plan sur :$", - "Vous remarquez particuliŠrement...$", + "Vous remarquez particuli\212rement...$", "Et encore...$", "C'est fini !$", "Un peu de lecture$", @@ -794,17 +794,17 @@ const char *gameDataFr[] = { "Non ! Pas ce coup-ci$", "Trop tard$", "$", - "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumiŠre, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette artŠre comme un rat au coeur mme de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", - "10/1/50: Nous avons r‚solu le mystŠre du manuscrit et localis‚ la crypte . Est-ce l'id‚e d'aboutir dans ce qui n'‚tait qu'un \"rŠve\" qui me rend si anxieuse ?@Je regrette de m'tre engag‚e vis … vis de L‚o . Non! je dois continuer ! J'aurais d— mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", - "Porte ta priŠre au lieu saint qui se doit, changes-en l'air, tu auras la matiŠre !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton …me s'ouvrira un chemin et gagnera son Šre . Avance comme un Orph‚e peu soucieux des t‚nŠbres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'… la myst‚rieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premiŠre.$", - "Les montagnes sont les crocs d'une gueule dantesque ouverte … l'infini de quelqu' orgie c‚leste, mastiquant des ‚toiles comme nous broyons du noir .@Tu d‚poseras l'accord de pierre … tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un mŠtre . Tu passeras ainsi entre les deux croissants, par del… les abŚmes du Mur du Silence . La Cl‚ des champs est … ta port‚e, tu n'as qu'… retrouver la note qui d‚note.$", + "Comme un regard profond tout couvert de peaux-pierres, pointant son oeil obscur aux astres de lumi\212re, il est la gorge reliant le ciel et les enfers . Il faut aller au fond de cette art\212re comme un rat au coeur m\210me de la terre !@Lundi, Mardi, Mercredi, Dimanche du 1e lundi au 1e dimanche, tu installeras \"ce rat\" entre chacun des jours . N'omets rien car ta venue serait ta retenue !@Porte ton fardeau comme un oeuf nouveau et donne lui le jour avec force et amour.$", + "10/1/50: Nous avons r\202solu le myst\212re du manuscrit et localis\202 la crypte . Est-ce l'id\202e d'aboutir dans ce qui n'\202tait qu'un \"r\212ve\" qui me rend si anxieuse ?@Je regrette de m'\210tre engag\202e vis \205 vis de L\202o . Non! je dois continuer ! J'aurais d\227 mettre Guy au courant... mais, depuis une semaine, je n'ai aucune nouvelle .$", + "Porte ta pri\212re au lieu saint qui se doit, changes-en l'air, tu auras la mati\212re !@Du pilier de la haute sagesse, le soleil aux genoux te montrera l'espace par lequel ton \205me s'ouvrira un chemin et gagnera son \212re . Avance comme un Orph\202e peu soucieux des t\202n\212bres : le blanc est ta couleur, l'or ta demeure . Eclaire ton chemin jusqu'\205 la myst\202rieuse . Offre-lui le cercle de l'homme aux trois facettes . Qu'il regagne le monde et qu'il tourne avec lui dans la richesse premi\212re.$", + "Les montagnes sont les crocs d'une gueule dantesque ouverte \205 l'infini de quelqu' orgie c\202leste, mastiquant des \202toiles comme nous broyons du noir .@Tu d\202poseras l'accord de pierre \205 tes pieds, le rire du silence sur la gamme d'en haut et dans ta main droite, une toile d'un m\212tre . Tu passeras ainsi entre les deux croissants, par del\205 les ab\214mes du Mur du Silence . La Cl\202 des champs est \205 ta port\202e, tu n'as qu'\205 retrouver la note qui d\202note.$", " DECEMBRE@ 9 REMISE 518 13 AGIOS 23@ 19 VIREMENT 1203 17 TRESOR 1598@ TOTAL 1721 TOTAL 1721$", - " Le 5/01/51@@ Luc, mon amour@ Guy connaŚt notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'… toi ! Max me relance mais j'ai d‚finitivement rompu avec lui . Qu'il reste … ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", - " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr‚t‚s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", - " Mortevielle, le 15/2/51@ MaŚtre,@ Je vous ‚cris au sujet de notre affaire. Je suis d‚cid‚ … aller jusqu'au bout, certain que mon associ‚, Pat DEFRANCK, a falsifi‚ un livre de comptes . Malgr‚$", + " Le 5/01/51@@ Luc, mon amour@ Guy conna\214t notre liaison . A la suite d'une dispute, je lui ai tout dit . Je ne pense qu'\205 toi ! Max me relance mais j'ai d\202finitivement rompu avec lui . Qu'il reste \205 ses gamelles . Quand pourrons-nous nous voir seuls ? Pour toi je divorcerai... Je t'aime .@ ton Eva$", + " Mortevielle, le 10/2/51@@ Pat,@ Je te rappelle que tu me dois 50000 F que je t'ai pr\202t\202s pour ton affaire . J'en ai besoin, peux-tu me les rendre assez vite?@ Guy$", + " Mortevielle, le 15/2/51@ Ma\214tre,@ Je vous \202cris au sujet de notre affaire. Je suis d\202cid\202 \205 aller jusqu'au bout, certain que mon associ\202, Pat DEFRANCK, a falsifi\202 un livre de comptes . Malgr\202$", " Une pipe$", - " Un stylo … plume$", - " Un briquet … essence$", + " Un stylo \205 plume$", + " Un briquet \205 essence$", " Une cornue$", " Un blaireau$", " Un pot de peinture$", @@ -814,13 +814,13 @@ const char *gameDataFr[] = { " Un vieux bouquin$", " Un porte-monnaie$", " Un poignard$", - " Un r‚volver$", + " Un r\202volver$", " Une bible$", " Une bougie$", - " Un coffret … bijoux$", - " Un fer … repasser$", + " Un coffret \205 bijoux$", + " Un fer \205 repasser$", " Une photo$", - " Une montre … gousset$", + " Une montre \205 gousset$", " Une corde$", " Des clefs$", " Un collier de perles$", @@ -830,9 +830,9 @@ const char *gameDataFr[] = { " Une bourse en cuir$", " Une balle de tennis$", " Des munitions$", - " Un rasoir … main$", - " Une brosse … cheveux$", - " Une brosse … linge$", + " Un rasoir \205 main$", + " Une brosse \205 cheveux$", + " Une brosse \205 linge$", " Un jeu de cartes$", " Un chausse pied$", " Un tournevis$", @@ -843,14 +843,14 @@ const char *gameDataFr[] = { " Un pinceau$", " Une corde$", " Un objet en bois$", - " Des somnifŠres$", + " Des somnif\212res$", " Une bague en or$", - " Un coffret … bijoux$", - " Un r‚veil matin$", + " Un coffret \205 bijoux$", + " Un r\202veil matin$", " Une cotte de mailles$", " Un chandellier$", " Une paire de gants$", - " Une coupe cisel‚e$", + " Une coupe cisel\202e$", " Un parchemin$", " Un poignard$", " Un dossier$", @@ -868,13 +868,13 @@ const char *gameDataFr[] = { "La mort de Julia$", "Les relations de Julia$", "Un message de Julia$", - "L'h‚ritage de Julia$", + "L'h\202ritage de Julia$", "Derniers actes de Julia$", "Les cadeaux de Julia$", "La chambre de Julia$", "La photo chez Julia$", "Julia et vous...$", - "Les occupations de L‚o$", + "Les occupations de L\202o$", "Les occupations de Pat$", "Les occupations de Guy$", "Les occupations de Bob$", @@ -883,7 +883,7 @@ const char *gameDataFr[] = { "Les occupations d'Ida$", "Les occupations de Max$", "Vos occupations$", - "Les relations de L‚o$", + "Les relations de L\202o$", "Les relations de Pat$", "Les relations de Guy$", "Les relations de Bob$", @@ -910,169 +910,169 @@ const char *gameDataFr[] = { "$", "FIN DE LA CONVERSATION$", "Les vieux appelaient ainsi la chaine de montagne qui se dresse au pied du manoir !$", - "C'est le massif montagneux que l'on aper‡oit devant le manoir$", + "C'est le massif montagneux que l'on aper\207oit devant le manoir$", "Je n'en sais rien !$", "Elle est morte d'une embolie pulmonaire$", - "Ma m‚re est morte soudainement . Son ‚tat semblait pourtant s'tre am‚lior‚$", + "Ma m\202re est morte soudainement . Son \202tat semblait pourtant s'\210tre am\202lior\202$", "Madame DEFRANCK est morte d'un coup de froid$", "Elle est morte d'une embolie pulmonaire$", - "Pardonnez moi mais je pr‚fŠre, actuellement garder le silence$", + "Pardonnez moi mais je pr\202f\212re, actuellement garder le silence$", "Ce sont toujours les meilleurs qui partent les premiers$", - "J'aimais beaucoup ma mŠre . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", - "C'est une r‚gion qui a un pass‚ charg‚ et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", - "C'est un passionn‚ d'histoire et un joueur inv‚t‚r‚ . D'ailleurs, voici un an il a gagn‚ une grosse somme$", - "Il a d‚j… beaucoup a faire avec la gestion et l'entretien du manoir...$", - "Je suis PDG d'une petite soci‚t‚ de parfums . Mais quand je suis ici, je me repose$", - "C'est un homme dynamique qui a r‚ussi dans le parfum$", - "Lui ! C'est un arriviste v‚reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir‚es dans sa chambre$", - "J'ai ‚t‚ trŠs pr‚occup‚ par la sant‚ de ma mŠre, et maintenant je n'ai plus go–t … rien$", - "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa mŠre$", + "J'aimais beaucoup ma m\212re . Je regrette seulement qu'elle soit morte dans le manoir des DEFRANCK$", + "C'est une r\202gion qui a un pass\202 charg\202 et j'ai largement de quoi m'occuper . Et puis j'aime beaucoup les chevaux..$", + "C'est un passionn\202 d'histoire et un joueur inv\202t\202r\202 . D'ailleurs, voici un an il a gagn\202 une grosse somme$", + "Il a d\202j\205 beaucoup a faire avec la gestion et l'entretien du manoir...$", + "Je suis PDG d'une petite soci\202t\202 de parfums . Mais quand je suis ici, je me repose$", + "C'est un homme dynamique qui a r\202ussi dans le parfum$", + "Lui ! C'est un arriviste v\202reux ! Les parfums ont du endormir son bon sens . D'ailleurs ici il passe ses soir\202es dans sa chambre$", + "J'ai \202t\202 tr\212s pr\202occup\202 par la sant\202 de ma m\212re, et maintenant je n'ai plus go\226t \205 rien$", + "Il aurait mieux fait de s'occuper un peu plus de moi et un peu moins de sa m\212re$", "Ce sont ses affaires...$", "Il n'a pas trop de chance en ce moment bien que ses affaires soient satisfaisantes$", - "Je travaille avec Pat mais ‡a ne va pas trŠs fort en ce moment$", - "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s‚rieusement alors$", - "Lui et Pat sont associ‚s . Je crois que ‡a ne va pas trop mal$", - "Je m'occupe de moi et c'est d‚j… beaucoup . Et vous ?$", - "Oh ‡a ! Je lui fais confiance . Elle sait s'occuper$", - "Mais ! Vous n'avez pas encore d‚couvert son occupation principale..?$", - "Elle fait dans la d‚coration avec beaucoup dego–t d'ailleurs. Elle est toujours trŠs bien habill‚e$", - "Si les bijoux vous interessent, j'ai quelques affaires interessantes … saisir rapidement$", + "Je travaille avec Pat mais \207a ne va pas tr\212s fort en ce moment$", + "Ah oui ?! Il a des occupations ? Il ferait bien de s'en occuper s\202rieusement alors$", + "Lui et Pat sont associ\202s . Je crois que \207a ne va pas trop mal$", + "Je m'occupe de moi et c'est d\202j\205 beaucoup . Et vous ?$", + "Oh \207a ! Je lui fais confiance . Elle sait s'occuper$", + "Mais ! Vous n'avez pas encore d\202couvert son occupation principale..?$", + "Elle fait dans la d\202coration avec beaucoup dego\226t d'ailleurs. Elle est toujours tr\212s bien habill\202e$", + "Si les bijoux vous interessent, j'ai quelques affaires interessantes \205 saisir rapidement$", "Les bijoux...$", "Je ne sais pas, mais j'aimerais bien qu'il s'occupe un peu moins de mes affaires !$", - "Quand on est une femme d'int‚rieur on trouve toujours de quoi s'occuper...$", + "Quand on est une femme d'int\202rieur on trouve toujours de quoi s'occuper...$", "Elle pourrait rester sans rien faire, mais non ! Elle coud, elle lit ...$", - "Elle n'a s–rement pas des occupations trŠs ‚panouissantes ...$", + "Elle n'a s\226rement pas des occupations tr\212s \202panouissantes ...$", "Une femme comme il n'y en a plus : Elle s'interesse a tout !$", - "Entre la cuisine et le m‚nage, je n'ai pas beaucoup de temps … vous accorder$", + "Entre la cuisine et le m\202nage, je n'ai pas beaucoup de temps \205 vous accorder$", "Je ne sais pas comment il s'y prend pour tout faire . C'est merveilleux !$", - "Il en ferait plus si il s'occupait moins des rag“ts et de la bouteille$", - "Je suis trŠs ind‚pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de problŠme$", - "C'est un ‚go‹ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", - "Je crois qu'il s'entend bien avec tout le monde, mis … part, peut tre, avec Guy$", - "C'est un homme de caractŠre . Il faut savoir le prendre ..$", - "Les affaires sont les affaires . Quant … la famille, je la laisse pour ce qu'elle est ...$", - "Relations ? Relations amicales ? Relations financiŠres sans doute$", - "Moi je n'ai rien … lui reprocher$", - "C'est un homme d'affaire d‚brouillard . Il nage parfois … contre-courant mais ... il s'en sortira toujours$", - "Ils m'ennuient tous .. Non ! Ce n'est mme pas ‡a .. Quoique .. certains ..$", - "A l'inverse de sa mŠre, c'est une personne trŠs renferm‚e ! Alors question relations ..$", - "Il doit sans doute faire beaucoup d'effort pour rester agr‚able malgr‚ tous ses ennuis$", - "Ses relations amoureuses : C'est termin‚ . Ses relations avec moi : Pas vraiment commenc‚es . Quant aux autres : Je ne suis pas les \"autres\"$", + "Il en ferait plus si il s'occupait moins des rag\223ts et de la bouteille$", + "Je suis tr\212s ind\202pendant . Tant qu'on ne s'occupe pas de mes affaires : Pas de probl\212me$", + "C'est un \202go\213ste . Je me demande si il aime autre chose que ses chevaux et ses grimoires$", + "Je crois qu'il s'entend bien avec tout le monde, mis \205 part, peut \210tre, avec Guy$", + "C'est un homme de caract\212re . Il faut savoir le prendre ..$", + "Les affaires sont les affaires . Quant \205 la famille, je la laisse pour ce qu'elle est ...$", + "Relations ? Relations amicales ? Relations financi\212res sans doute$", + "Moi je n'ai rien \205 lui reprocher$", + "C'est un homme d'affaire d\202brouillard . Il nage parfois \205 contre-courant mais ... il s'en sortira toujours$", + "Ils m'ennuient tous .. Non ! Ce n'est m\210me pas \207a .. Quoique .. certains ..$", + "A l'inverse de sa m\212re, c'est une personne tr\212s renferm\202e ! Alors question relations ..$", + "Il doit sans doute faire beaucoup d'effort pour rester agr\202able malgr\202 tous ses ennuis$", + "Ses relations amoureuses : C'est termin\202 . Ses relations avec moi : Pas vraiment commenc\202es . Quant aux autres : Je ne suis pas les \"autres\"$", "J'aime bien tout le monde, tant qu'on ne m'escroque pas$", - "Il ne suffit pas d'avoir un peu d'argent et d'tre beau parleur pour plaire … tout le monde$", - "Sans histoire .. C'est quelqu'un d'agr‚able et g‚n‚reux . De plus, il ne manque pas d'humour$", - "Actuellement je m'entends plut“t bien avec tout le monde . Mais, ici, je ne vais pas m'‚tendre sur le sujet$", - "Beau plumage, mais ‡a ne vole pas haut ... Parlez en … son mari$", + "Il ne suffit pas d'avoir un peu d'argent et d'\210tre beau parleur pour plaire \205 tout le monde$", + "Sans histoire .. C'est quelqu'un d'agr\202able et g\202n\202reux . De plus, il ne manque pas d'humour$", + "Actuellement je m'entends plut\223t bien avec tout le monde . Mais, ici, je ne vais pas m'\202tendre sur le sujet$", + "Beau plumage, mais \207a ne vole pas haut ... Parlez en \205 son mari$", "C'est pour un rendez-vous ?$", - "Elle est trŠs vivante ! Elle ne s'embarrasse pas de pr‚jug‚s stupides$", - "Dans mon m‚tier, on c“toit surtout des belles femmes et des truands$", - "La seule valeur s–re chez lui, c'est ses bijoux .. Et sa femme, mais ‡a il ne s'en rend pas compte$", - "C'est quelqu'un d'interessant . De pas toujours facile … comprendre, mais qui m‚rite le d‚tour$", - "Je ne d‚teste personne, mais j'aime les choses et les gens quand ils sont … leur place$", - "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite … l'‚troit !$", - "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont‚$", - "Vous savez dans mon m‚tier on entend tout mais on ne retient rien, et le service est bien fait$", + "Elle est tr\212s vivante ! Elle ne s'embarrasse pas de pr\202jug\202s stupides$", + "Dans mon m\202tier, on c\223toit surtout des belles femmes et des truands$", + "La seule valeur s\226re chez lui, c'est ses bijoux .. Et sa femme, mais \207a il ne s'en rend pas compte$", + "C'est quelqu'un d'interessant . De pas toujours facile \205 comprendre, mais qui m\202rite le d\202tour$", + "Je ne d\202teste personne, mais j'aime les choses et les gens quand ils sont \205 leur place$", + "C'est entre nous . Mais voyez : quand je parle avec elle, je me sens vite \205 l'\202troit !$", + "Pour ne pas s'entendre avec elle, faut y mettre de la mauvaise volont\202$", + "Vous savez dans mon m\202tier on entend tout mais on ne retient rien, et le service est bien fait$", "C'est un hypocrite, un larbin ! Personnellement je ne lui fais pas confiance$", - "Je ne connait pas le fond de sa pens‚e mais c'est quelqu'un de toujours trŠs correct et impeccable$", - "C'‚tait une personne qui a v‚cu au manoir, il y a un an .. peut tre plus$", - "C'‚tait plus qu'une amie pour ma mŠre . En ces moments, j'aurais aim‚ qu'elle soit … mes cot‚s$", - "Murielle a ‚t‚ la dame de compagnie de Julia$", + "Je ne connait pas le fond de sa pens\202e mais c'est quelqu'un de toujours tr\212s correct et impeccable$", + "C'\202tait une personne qui a v\202cu au manoir, il y a un an .. peut \210tre plus$", + "C'\202tait plus qu'une amie pour ma m\212re . En ces moments, j'aurais aim\202 qu'elle soit \205 mes cot\202s$", + "Murielle a \202t\202 la dame de compagnie de Julia$", "Elle aussi, faisait des recherches ...$", - "C'‚tait une femme trŠs cultiv‚e . Son brusque d‚part, il y a un an, m'a surpris et beaucoup chagrin‚$", - "Elle partageait avec L‚o sa passion de l'histoire et de la r‚gion$", + "C'\202tait une femme tr\212s cultiv\202e . Son brusque d\202part, il y a un an, m'a surpris et beaucoup chagrin\202$", + "Elle partageait avec L\202o sa passion de l'histoire et de la r\202gion$", "Je crois que tout le monde l'aimait bien$", - "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-mŠre, belle-fille ..$", - "A part L‚o, elle avait de trŠs bon rapport avec Max ...$", - "Bien que vos relations furent peu soutenues, J‚r“me, elle vous portait toujours dans son coeur ...$", + "Elle s'entendait bien avec tout le monde . Elle aimait beaucoup son fils . Quant aux relations belle-m\212re, belle-fille ..$", + "A part L\202o, elle avait de tr\212s bon rapport avec Max ...$", + "Bien que vos relations furent peu soutenues, J\202r\223me, elle vous portait toujours dans son coeur ...$", "A part sa famille, pas grand monde$", - "Ah oui ! Je crois qu'elle a beaucoup regrett‚ le d‚part de cette amie .. euh ! Marielle .. ou Mireille ...$", + "Ah oui ! Je crois qu'elle a beaucoup regrett\202 le d\202part de cette amie .. euh ! Marielle .. ou Mireille ...$", "Non rien !$", "Non ... Pas que le sache$", - "J'ai connu Julia en achetant le manoir . C'‚tait son seul bien . Mais toute ma fortune ‚tait la sienne ...$", - "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien … elle$", - "Je crois que toute sa fortune venait de L‚o . Alors, Pfuuut !$", - "A part la lettre pour vous que j'ai post‚, rien de bien important !$", - "J'ai ‚t‚ trŠs heureuse qu'elle m'offre sa bible reli‚e$", - "Ca a ‚t‚ rapide et elle n'a pas eu le temps de prendre des dispositions particuliŠres$", - "Son dernier pr‚sent m'a surpris$", + "J'ai connu Julia en achetant le manoir . C'\202tait son seul bien . Mais toute ma fortune \202tait la sienne ...$", + "Si ce n'est quelques objets personnels, je crois qu'elle n'avait plus rien \205 elle$", + "Je crois que toute sa fortune venait de L\202o . Alors, Pfuuut !$", + "A part la lettre pour vous que j'ai post\202, rien de bien important !$", + "J'ai \202t\202 tr\212s heureuse qu'elle m'offre sa bible reli\202e$", + "Ca a \202t\202 rapide et elle n'a pas eu le temps de prendre des dispositions particuli\212res$", + "Son dernier pr\202sent m'a surpris$", "Quel cadeau ?$", "Un chandellier ...$", - "Oui, j'ai eu un cadeau . Ma femme a mme eu une bible$", + "Oui, j'ai eu un cadeau . Ma femme a m\210me eu une bible$", "Et bien oui ! Comme tout le monde, je crois$", "Un poignard$", - "Je n'ai jamais ‚t‚ fouiller dans le grenier !$", + "Je n'ai jamais \202t\202 fouiller dans le grenier !$", "Vous avez un don de double-vue ou un passe-partout$", "Le portrait d'une jeune fille : C'est Murielle ...$", "Vous savez, je la connaissais assez peu$", - "Elle ‚tait trŠs charmante, mais c'‚tait surtout la dame de compagnie de Julia$", - "C'est la seule femme vraiment interessante que j'ai rencontr‚$", - "Elle avait de grandes connaissances historiques, et la consulter ‚tait trŠs enrichissant$", - "Je me suis toujours demand‚ ce que certains pouvaient lui trouver !$", - "Si la chambre est ferm‚e, demandez … L‚o$", - "J'ai ferm‚ sa chambre aprŠs sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", + "Elle \202tait tr\212s charmante, mais c'\202tait surtout la dame de compagnie de Julia$", + "C'est la seule femme vraiment interessante que j'ai rencontr\202$", + "Elle avait de grandes connaissances historiques, et la consulter \202tait tr\212s enrichissant$", + "Je me suis toujours demand\202 ce que certains pouvaient lui trouver !$", + "Si la chambre est ferm\202e, demandez \205 L\202o$", + "J'ai ferm\202 sa chambre apr\212s sa mort et j'aimerais qu'il en soit ainsi encore un certain temps$", "Vous savez ce que c'est : Des relations familiales$", - "Durant toutes ces ann‚es, je ne l'ai jamais servie … contre-coeur$", + "Durant toutes ces ann\202es, je ne l'ai jamais servie \205 contre-coeur$", "Je l'aimais autant qu'elle m'aimais, je crois$", - "De quel droit avez-vous p‚n‚tr‚ dans la chambre de ma femme ?!!$", + "De quel droit avez-vous p\202n\202tr\202 dans la chambre de ma femme ?!!$", "C'est sans doute la photo de Murielle avec le filleul de Julia$", "Je ne me rappelle pas$", - "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir‚e … l'envers$", - "Vous tes bien curieux !... C'est sans valeur$", - "Grimoires, parchemins et manuscrits : C'est le domaine de L‚o$", + "C'est Murielle . C'est moi qui l'ai prise. et d'ailleurs elle est tir\202e \205 l'envers$", + "Vous \210tes bien curieux !... C'est sans valeur$", + "Grimoires, parchemins et manuscrits : C'est le domaine de L\202o$", "Dommage que la devise soit manquante ...$", - "C'est trŠs beau ... Et trŠs vieux ...$", - "Tiens ! C'est un endroit que je n'ai jamais visit‚$", - "D'apr‚s L‚o, il semblerait que les Lunes soient plus r‚centes$", - "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", - "Profond et inqui‚tant : Le progrŠs a du bon$", - "Ca reste pour moi le plus grand des mystŠres$", + "C'est tr\212s beau ... Et tr\212s vieux ...$", + "Tiens ! C'est un endroit que je n'ai jamais visit\202$", + "D'apr\202s L\202o, il semblerait que les Lunes soient plus r\202centes$", + "M\210me par ce temps, vous avez d\202nich\202 un soleil ...$", + "Profond et inqui\202tant : Le progr\212s a du bon$", + "Ca reste pour moi le plus grand des myst\212res$", "Les derniers temps elle parlait d'un voyage . Et puis ...$", - "Il y a un peu plus d'un an, un soir, elle a d‚cid‚ de partir ...$", - "De toutes fa‡ons elle n'‚tait pas faite pour vivre ici$", + "Il y a un peu plus d'un an, un soir, elle a d\202cid\202 de partir ...$", + "De toutes fa\207ons elle n'\202tait pas faite pour vivre ici$", "Quoi ?! Quel corps ? Quel crypte ?$", - "Si il y en a, je ne les ai jamais trouv‚ ...$", - "Bien s–r ! ... Et des fant“mes aussi ...$", - "C'est la plus vielle de la r‚gion : Elle date du XI eme siŠcle$", - "Elle fut l‚gŠrement restaur‚e aprŠs la r‚volution$", + "Si il y en a, je ne les ai jamais trouv\202 ...$", + "Bien s\226r ! ... Et des fant\223mes aussi ...$", + "C'est la plus vielle de la r\202gion : Elle date du XI eme si\212cle$", + "Elle fut l\202g\212rement restaur\202e apr\212s la r\202volution$", "Julia aimait beaucoup la peinture$", - "Ils ont diff‚rents styles, mais n'ont pas tous une trŠs grande valeur$", - "Que faites-vous l… ?$", - "Je suis s–r que vous cherchez quelque chose ici$", - "Je vous ‚coute$", - "Que d‚sirez-vous ?$", + "Ils ont diff\202rents styles, mais n'ont pas tous une tr\212s grande valeur$", + "Que faites-vous l\205 ?$", + "Je suis s\226r que vous cherchez quelque chose ici$", + "Je vous \202coute$", + "Que d\202sirez-vous ?$", "Oui ?$", - "Je suis … vous ...$", + "Je suis \205 vous ...$", "C'est pourquoi ?$", "Allez-y$", - "C'est … quel sujet ?$", - "Max : … votre service, monsieur$", - "De toutes fa‡ons vous n'avez rien … faire ici ! Sortez !!$", - "Vous tes trop curieux !$", - "J‚r“me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L‚o, son mari bien s–r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La tempŠte redouble, il vous faut rester . Les repas sont … 12h et 19h et il y a un recueillement … la chapelle tous les jours … 10h$", - "En vous voyant j'ai compris que vous decouvririez la v‚rit‚ ... Car je savais pourquoi vous veniez : J'avais retrouv‚ le brouillon de la lettre de Julia . Mais je suis trŠs joueur, alors ... Elle n'avait pas voulu que votre tche soit trop facile, pour me prot‚ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d‚couvert que le mur du silence est le nom que les ma‡ons ont donn‚ au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss‚ avant de mourir ‚taient autant de faux indices qui ne servaient qu'… faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d‚cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv‚ un jour dans mes affaires . Une nuit, nous nous sommes aventur‚s dans le passage secret que nous avions d‚couvert . Murielle est morte par accident dans la piŠce de la vierge . J'ai r‚cup‚r‚ la bague rapidement, trouv‚ le tr‚sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'tes pas de la police . Laissez moi seul !$", - "F‚vrier 1951 ... Profession : detective priv‚ . Le froid figeait Paris et mes affaires lorsque ...$", - "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les piŠces d‚labr‚es du manoir de Mortevielle . Julia, une vieille femme a pr‚sent .$", + "C'est \205 quel sujet ?$", + "Max : \205 votre service, monsieur$", + "De toutes fa\207ons vous n'avez rien \205 faire ici ! Sortez !!$", + "Vous \210tes trop curieux !$", + "J\202r\223me ! Il y a longtemps ... Quelle tristesse, Julia est morte . Sa famille est ici : Guy, son fils . Eva, sa brue . L\202o, son mari bien s\226r . Son beau fils, Pat . Des cousins : Bob, Ida, Luc . La temp\212te redouble, il vous faut rester . Les repas sont \205 12h et 19h et il y a un recueillement \205 la chapelle tous les jours \205 10h$", + "En vous voyant j'ai compris que vous decouvririez la v\202rit\202 ... Car je savais pourquoi vous veniez : J'avais retrouv\202 le brouillon de la lettre de Julia . Mais je suis tr\212s joueur, alors ... Elle n'avait pas voulu que votre t\203che soit trop facile, pour me prot\202ger, sans doute, mais elle n'a pu mourir avec cette incertitude sur la conscience . Avez vous d\202couvert que le mur du silence est le nom que les ma\207ons ont donn\202 au mur qui porte ce blason, lors de la construction du manoir ? .. Et ces cadeaux que Julia a laiss\202 avant de mourir \202taient autant de faux indices qui ne servaient qu'\205 faire ressortir l'importance des parchemins ... Effectivement, il y a plus d'un an, je travailais avec Murielle au d\202cryptage de ces manuscrits que je venais de trouver . Ma femme a fait la relation entre notre travail et la disparition de Murielle mais elle n'a jamais eu de preuves . Si ce n'est cette bague qu'elle a retrouv\202 un jour dans mes affaires . Une nuit, nous nous sommes aventur\202s dans le passage secret que nous avions d\202couvert . Murielle est morte par accident dans la pi\212ce de la vierge . J'ai r\202cup\202r\202 la bague rapidement, trouv\202 le tr\202sor et me suis enfuis . Je ne pensais pas qu'elle vivait encore, et je n'ai rien dit car j'avais besoin d'argent . J'ai fait passer cette somme sur le compte des courses de chevaux ...Partez maintenant, puisque vous n'\210tes pas de la police . Laissez moi seul !$", + "F\202vrier 1951 ... Profession : detective priv\202 . Le froid figeait Paris et mes affaires lorsque ...$", + "Une lettre, un appel, des souvenirs d'une enfance encore proche . Que de jeux dans les pi\212ces d\202labr\202es du manoir de Mortevielle . Julia, une vieille femme a pr\202sent .$", " au bureau$", - " … la cuisine$", - " … la cave$", + " \205 la cuisine$", + " \205 la cave$", " dans le couloir$", " dehors$", - " la salle … manger$", + " la salle \205 manger$", " dans le manoir$", " devant le manoir$", - " … la chapelle$", + " \205 la chapelle$", " devant le puits$", " au nord$", - " derriŠre le manoir$", + " derri\212re le manoir$", " au sud$", - " … l'est$", - " … l'ouest$", + " \205 l'est$", + " \205 l'ouest$", " vers le manoir$", " plus loin$", " dans l'eau$", " hors du puits$", " dans le puits$", - " choix sur ‚cran$", + " choix sur \202cran$", " Dans la serie MYSTERE...$", " LE MANOIR DE MORTEVIELLE$", "$", @@ -1095,9 +1095,9 @@ const char *gameDataFr[] = { " A VOUS DE JOUER$", " attacher$", " attendre$", - " d‚foncer$", + " d\202foncer$", " dormir$", - " ‚couter$", + " \202couter$", " entrer$", " fermer$", " fouiller$", @@ -1119,7 +1119,7 @@ const char *gameDataFr[] = { " lire$", " poser$", " regarder$", - " L‚o$", + " L\202o$", " Pat$", " Guy$", " Eva$", @@ -1128,40 +1128,40 @@ const char *gameDataFr[] = { " Ida$", " Max$", "Comment Julia est-elle morte ?$", - "Elle s'est suicid‚e$", - "Elle est morte assassin‚e$", + "Elle s'est suicid\202e$", + "Elle est morte assassin\202e$", "Elle est morte accidentellement$", "Elle est morte naturellement$", - "D'o— provenait l'argent qui a permis la restauration du manoir ?$", + "D'o\227 provenait l'argent qui a permis la restauration du manoir ?$", "chantage$", "travail$", - "h‚ritage$", + "h\202ritage$", "courses$", "rentes$", "hold-up$", - "d‚couverte$", - "Quel est le hobby de L‚o ?$", + "d\202couverte$", + "Quel est le hobby de L\202o ?$", "recherches historiques$", "politique$", "peinture$", "drogue$", "sciences occultes$", "direction d'une secte$", - "Julia a laiss‚ une s‚rie d'indices . Ceux-ci sont repr‚sent‚s en un seul lieu . Lequel ?$", + "Julia a laiss\202 une s\202rie d'indices . Ceux-ci sont repr\202sent\202s en un seul lieu . Lequel ?$", "Chapelle$", - "Ext‚rieur$", + "Ext\202rieur$", "Cave$", "Grenier$", "Cuisine$", - "Salle … manger$", + "Salle \205 manger$", "Chambre Julia$", - "Chambre L‚o$", + "Chambre L\202o$", "Chambre Pat$", "Chambre Bob$", "Chambre Max$", "Chambre Luc/Ida$", "Chambre Guy/Eva$", - "L'indice principal qui vous a permis d'arriver … la porte du souterrain est :$", + "L'indice principal qui vous a permis d'arriver \205 la porte du souterrain est :$", "Un poignard$", "Une bague$", "Un livre$", @@ -1175,30 +1175,30 @@ const char *gameDataFr[] = { "Trois$", "Quatre$", "Cinq$", - "Combien de personnes sont m‚l‚es … cette histoire - Julia y comprise, vous except‚ - ?$", + "Combien de personnes sont m\202l\202es \205 cette histoire - Julia y comprise, vous except\202 - ?$", "Neuf$", "Dix$", "Onze$", - "Quel ‚tait le pr‚nom de la personne inconnue ?$", + "Quel \202tait le pr\202nom de la personne inconnue ?$", "Mireille$", - "Fran‡oise$", + "Fran\207oise$", "Maguy$", "Emilie$", "Murielle$", "Sophie$", - "De qui Murielle ‚tait-elle la maŚtresse ?$", + "De qui Murielle \202tait-elle la ma\214tresse ?$", "Bob$", "Luc$", "Guy$", - "L‚o$", + "L\202o$", "Max$", "Murielle partageait une occupation avec une autre personne . Qui ?$", - "[1][ |Seul le hazard vous a permis d'arriver ici . Vous pr‚f‚rez|retourner enqu‚ter afin de mieux comprendre ...][ok]$", - "[1][ |Ins‚rez la disquette 1 dans le lecteur A][ok]$", + "[1][ |Seul le hazard vous a permis d'arriver ici . Vous pr\202f\202rez|retourner enqu\202ter afin de mieux comprendre ...][ok]$", + "[1][ |Ins\202rez la disquette 1 dans le lecteur A][ok]$", "[1][ |! ERREUR DISQUETTE !|On arrete tout][ok]$", - "[1][ |Vous devriez avoir remarqu‚|00% des indices][ok]$", - "[1][ |Ins‚rez la disquette 2 dans le lecteur A][ok]$", - "[1][ |Avant d'aller plus loin, vous faites|un point sur l'‚tat de vos connaissances][ok]$", + "[1][ |Vous devriez avoir remarqu\202|00% des indices][ok]$", + "[1][ |Ins\202rez la disquette 2 dans le lecteur A][ok]$", + "[1][ |Avant d'aller plus loin, vous faites|un point sur l'\202tat de vos connaissances][ok]$", " MASTER .$", " rorL$", }; @@ -1234,7 +1234,7 @@ const char *gameDataDe[] = { "Die Wappen$", "$", "Max, der Diener, empfaengt Sie und wird Sie dann in Ihr Zimmer begleiten$", - " Morteville 16/2/51@ Mein lieber Jer“me@Im Anschluss an mein Telegramm teile ich Ihnen die Gruende meiner Unruhe mit: vor 1 Jahr verschwand meine Gesellschafterin Murielle. Eventuell hat das Verschwinden etwas mit dem finanziel len Umschwung auf dem Landsitz zu tun, oder... Eine Stille, die schwer zu verstehen ist fuer mei-nen Sohn Guy. Da ich bis heute nichts bezueglich dieser Sache unternehmen konnte, zaehle ich auf Sie, um die Affaere zu regeln. Falls sich mein Gesundheitszustand nicht bessert, treffen Sie bitte die Entscheidungen, die Sie fuer richtig halten. @ In Freundschaft. JULIA DEFRANCK$", + " Morteville 16/2/51@ Mein lieber Jer\223me@Im Anschluss an mein Telegramm teile ich Ihnen die Gruende meiner Unruhe mit: vor 1 Jahr verschwand meine Gesellschafterin Murielle. Eventuell hat das Verschwinden etwas mit dem finanziel len Umschwung auf dem Landsitz zu tun, oder... Eine Stille, die schwer zu verstehen ist fuer mei-nen Sohn Guy. Da ich bis heute nichts bezueglich dieser Sache unternehmen konnte, zaehle ich auf Sie, um die Affaere zu regeln. Falls sich mein Gesundheitszustand nicht bessert, treffen Sie bitte die Entscheidungen, die Sie fuer richtig halten. @ In Freundschaft. JULIA DEFRANCK$", "Spaeter erzaehlt Ihnen Guy von Leo's Selbstmord nach einer verrueckten Wette beim Rennen!$", "F3: WIEDERHOLUNG@F8: STOP$", "Der Hausherr$", @@ -1611,7 +1611,7 @@ const char *gameDataDe[] = { "Das ist sehr schoen und sehr alt.$", "Das ist ein Ort, den ich nie gesehen habe.$", "Leos Meinung nach schien es, als seien die Monde spaeter gemacht worden.$", - "Mme par ce temps, vous avez d‚nich‚ un soleil ...$", + "M\210me par ce temps, vous avez d\202nich\202 un soleil ...$", "Tief und beunruhigend. Der Fortschritt hat gutes an sich.$", "Der Rest bleibt fuer mich eines der groessten Raetsel.$", "In letzter Zeit sprach sie oft von einer Reise und dann...$", @@ -1762,14 +1762,14 @@ const char *gameDataDe[] = { "zwei$", "drei$", "vier$", - "fnf$", + "f\201nf$", " Wieviele Personen sind in die Geschichte verwickelt ? (Julia eingeschlossen, ausgenommen Sie)$", "neun$", "zehn$", "elf$", " Wie war der Name der unbekannten Person ?$", "Mireille$", - "Fran‡oise$", + "Fran\207oise$", "Maguy$", "Emilie$", "Murielle$", -- cgit v1.2.3 From c16d414e9bba20f9154f6e7873bc35e1dbe2fdde Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 13 Jul 2013 22:44:07 +0100 Subject: MORTEVIELLE: Fix typo in English text --- devtools/create_mortdat/enginetext.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index f785c4d974..6095f09360 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -29,7 +29,7 @@ const char *engineDataEn[] = { "[2][ ][YES][NO]", "Go to", - "Someone enters, looks surised, but says nothing", + "Someone enters, looks surprised, but says nothing", " Cool ", "Oppressive", " Tense ", @@ -136,7 +136,7 @@ const char *engineDataFr[] = { const char *engineDataDe[] = { "[2][ ][JA][NEIN]", "Go to", - "Someone enters, looks surised, but says nothing", + "Someone enters, looks surprised, but says nothing", "Cool", "Schwer", "Ungesund", -- cgit v1.2.3 From e14278eb583253504e85c3f4db9d56d3b3d945fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Jul 2013 19:10:03 -0400 Subject: MORTEVIELLE: Changed savegames to use the game target to generate filenames --- engines/mortevielle/detection.cpp | 3 ++- engines/mortevielle/mortevielle.cpp | 15 ++++++++++++- engines/mortevielle/mortevielle.h | 2 ++ engines/mortevielle/saveload.cpp | 42 +++++++++++++++++++++++-------------- engines/mortevielle/saveload.h | 15 ++++++++----- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 9fe0927706..28cbc77b8b 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -89,7 +89,8 @@ SaveStateList MortevielleMetaEngine::listSaves(const char *target) const { } SaveStateDescriptor MortevielleMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - return Mortevielle::SavegameManager::querySaveMetaInfos(slot); + Common::String filename = Mortevielle::MortevielleEngine::generateSaveFilename(target, slot); + return Mortevielle::SavegameManager::querySaveMetaInfos(filename); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 2734f8cc93..8ed6751b50 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -55,6 +55,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _text.setParent(this); _soundManager.setParent(this); _speechManager.setParent(this); + _savegameManager.setParent(this); _lastGameFrame = 0; _mouseClick = false; @@ -146,6 +147,18 @@ Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &d return _savegameManager.saveGame(slot, desc); } +/** + * Support method that generates a savegame name + * @param slot Slot number + */ +Common::String MortevielleEngine::generateSaveFilename(const Common::String &target, int slot) { + if (slot == 0) + // Initial game state loaded when the game starts + return "sav0.mor"; + + return Common::String::format("%s.%03d", target.c_str(), slot); +} + /** * Initialise the game state */ @@ -335,7 +348,7 @@ Common::Error MortevielleEngine::run() { // Either load the initial game state savegame, or the specified savegame number adzon(); - _savegameManager.loadSavegame(loadSlot); + _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); // Run the main game loop mainGame(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index dcb61a6057..5255865cc5 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -498,6 +498,8 @@ public: virtual Common::Error run(); uint32 getGameFlags() const; Common::Language getLanguage() const; + static Common::String generateSaveFilename(const Common::String &target, int slot); + Common::String generateSaveFilename(int slot) { return generateSaveFilename(_targetName, slot); } int getChar(); bool keyPressed(); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 093f22e9cf..382fd14277 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -36,8 +36,8 @@ namespace Mortevielle { static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; -Common::String SavegameManager::generateSaveName(int slotNumber) { - return Common::String::format("sav%d.mor", slotNumber); +void SavegameManager::setParent(MortevielleEngine *vm) { + _vm = vm; } /** @@ -71,14 +71,10 @@ void SavegameManager::sync_save(Common::Serializer &sz) { * Inner code for loading a saved game * @remarks Originally called 'takesav' */ -void SavegameManager::loadSavegame(int n) { - // -- Load the file - Common::String filename = generateSaveName(n); - +void SavegameManager::loadSavegame(const Common::String &filename) { // Try loading first from the save area Common::SeekableReadStream *stream = g_system->getSavefileManager()->openForLoading(filename); - // If not present, try loading from the program folder Common::File f; if (stream == NULL) { if (!f.open(filename)) @@ -115,10 +111,10 @@ void SavegameManager::loadSavegame(int n) { /** * Load a saved game */ -Common::Error SavegameManager::loadGame(int n) { +Common::Error SavegameManager::loadGame(const Common::String &filename) { g_vm->_mouse.hideMouse(); g_vm->displayEmptyHand(); - loadSavegame(n); + loadSavegame(filename); /* Initialization */ g_vm->charToHour(); @@ -144,7 +140,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { if (g_vm->_saveStruct._currPlace == ROOM26) g_vm->_saveStruct._currPlace = LANDING; - Common::String filename = generateSaveName(n); + Common::String filename = _vm->generateSaveFilename(n); f = g_system->getSavefileManager()->openForSaving(filename); // Write out the savegame header @@ -168,6 +164,14 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { return Common::kNoError; } +Common::Error SavegameManager::loadGame(int slot) { + return loadGame(_vm->generateSaveFilename(slot)); +} + +Common::Error SavegameManager::saveGame(int slot) { + return saveGame(slot, _vm->generateSaveFilename(slot)); +} + void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName) { // Write out a savegame header out->writeByte(SAVEGAME_VERSION); @@ -226,8 +230,10 @@ bool SavegameManager::readSavegameHeader(Common::InSaveFile *in, SavegameHeader return true; } -SaveStateList SavegameManager::listSaves(const char *target) { - Common::String pattern = "sav*.mor"; +SaveStateList SavegameManager::listSaves(const Common::String &target) { + Common::String pattern = target; + pattern += ".???"; + Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern); sort(files.begin(), files.end()); // Sort (hopefully ensuring we are sorted numerically..) @@ -235,7 +241,7 @@ SaveStateList SavegameManager::listSaves(const char *target) { for (Common::StringArray::const_iterator file = files.begin(); file != files.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot const Common::String &fname = *file; - int slotNumber = atoi(fname.c_str() + 3); + int slotNumber = atoi(fname.c_str() + fname.size() - 3); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname); if (in) { @@ -274,11 +280,15 @@ SaveStateList SavegameManager::listSaves(const char *target) { return saveList; } -SaveStateDescriptor SavegameManager::querySaveMetaInfos(int slot) { - Common::String fileName = Mortevielle::SavegameManager::generateSaveName(slot); +SaveStateDescriptor SavegameManager::querySaveMetaInfos(const Common::String &fileName) { Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); if (f) { + // Get the slot number + int slot = 1; + if (fileName.size() > 4 && fileName[fileName.size() - 4] == '.') + slot = atoi(fileName.c_str() + fileName.size() - 3); + // Check to see if it's a ScummVM savegame or not char buffer[4]; f->read(buffer, 4); @@ -289,7 +299,7 @@ SaveStateDescriptor SavegameManager::querySaveMetaInfos(int slot) { // Original savegame perhaps? delete f; - SaveStateDescriptor desc(slot, Common::String::format("Savegame #%d", slot)); + SaveStateDescriptor desc(slot, Common::String::format("Savegame - %s", slot)); desc.setDeletableFlag(slot != 0); desc.setWriteProtectedFlag(slot == 0); return desc; diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 140b039b51..6613b62ac7 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -47,21 +47,26 @@ struct SavegameHeader { int totalFrames; }; +class MortevielleEngine; + class SavegameManager { private: + MortevielleEngine *_vm; byte _tabdonSaveBuffer[391]; void sync_save(Common::Serializer &sz); public: - void loadSavegame(int n); - Common::Error loadGame(int n); + void setParent(MortevielleEngine *vm); + void loadSavegame(const Common::String &filename); + Common::Error loadGame(const Common::String &filename); Common::Error saveGame(int n, const Common::String &saveName); + Common::Error loadGame(int slot); + Common::Error saveGame(int slot); void writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName); static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header); - static Common::String generateSaveName(int slotNumber); - static SaveStateList listSaves(const char *target); - static SaveStateDescriptor querySaveMetaInfos(int slot); + static SaveStateList listSaves(const Common::String &target); + static SaveStateDescriptor querySaveMetaInfos(const Common::String &fileName); }; } // End of namespace Mortevielle -- cgit v1.2.3 From 1946dead77378bbf16cb1ed65c9937226c749a5e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 14 Jul 2013 05:04:02 +0100 Subject: TUCKER: Fix for bug #3614697 - "Spanish version uncompletable..." This add support for the unhandled "mof" instruction present in the Spanish version. This effectively skips it as a NOP/invalid, which prevents it locking up the game at the end of the 2nd part. --- engines/tucker/tucker.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 6b538a6fde..e3fd928e6c 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -2991,6 +2991,7 @@ enum TableInstructionCode { kCode_gfg, kCode_gv, kCode_loc, + kCode_mof, kCode_opt, kCode_opf, kCode_ofg, @@ -3041,6 +3042,7 @@ static const struct { { "gfg", kCode_gfg }, { "gv", kCode_gv }, { "loc", kCode_loc }, + { "mof", kCode_mof }, { "opt", kCode_opt }, { "opf", kCode_opf }, { "ofg", kCode_ofg }, @@ -3232,6 +3234,9 @@ int TuckerEngine::executeTableInstruction() { case kCode_loc: _nextLocationNum = readTableInstructionParam(2); return 1; + case kCode_mof: + // TODO: Unknown opcode in Spanish version. Identify if this has any function. + return 2; case kCode_opt: _conversationOptionsCount = readTableInstructionParam(2); for (i = 0; i < _conversationOptionsCount; ++i) { -- cgit v1.2.3 From 485118ecd9640538337672e3a00bb312803da666 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 14 Jul 2013 05:07:11 +0100 Subject: TUCKER: Add support for skipping unhandled/invalid instructions. This ensures that if any unhandled/invalid instructions are present, they are skipped, rather than locking up engine execution. This is a secondary fix for bug #3614697 - "Spanish version uncompletable at end of 2nd part" and any other future bugs of this type. --- engines/tucker/tucker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index e3fd928e6c..122be958ff 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -3064,8 +3064,9 @@ static const struct { int TuckerEngine::readTableInstructionCode(int *index) { bool match = false; + int nameLen = 0; for (int i = 0; _instructions[i].name; ++i) { - const int nameLen = strlen(_instructions[i].name); + nameLen = strlen(_instructions[i].name); if (_instructions[i].name[1] == '0') { if (_instructions[i].name[0] == _tableInstructionsPtr[0] && _instructions[i].name[2] == _tableInstructionsPtr[2]) { const char digit = _tableInstructionsPtr[1]; @@ -3085,6 +3086,7 @@ int TuckerEngine::readTableInstructionCode(int *index) { } } warning("Unhandled instruction '%c%c%c'", _tableInstructionsPtr[0], _tableInstructionsPtr[1], _tableInstructionsPtr[2]); + _tableInstructionsPtr += nameLen + 1; return kCode_invalid; } -- cgit v1.2.3 From cddf49994236a8dc9ad985b10a663af3f2dc1657 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Jul 2013 11:39:32 -0400 Subject: TSAGE: Fix for returning to landing bay from crane controls --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 9b76617f2e..adeeab1c64 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5972,10 +5972,10 @@ bool Scene700::Actor6::startAction(CursorType action, Event &event) { } void Scene700::postInit(SceneObjectList *OwnerList) { + loadScene(700); if (R2_GLOBALS._sceneManager._previousScene == 900) - g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + _sceneBounds = Rect(160, 0, 480, 200); - loadScene(700); R2_GLOBALS._v558B6.set(60, 0, 260, 200); SceneExt::postInit(); -- cgit v1.2.3 From aaaf466c7122f6c595d86a0145b1f0472c8b6d31 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 18:55:38 +0300 Subject: RECORDER: Fix CID 1046886. Uninit class variables. --- common/recorderfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp index 60c47e11ce..e6838ed02e 100644 --- a/common/recorderfile.cpp +++ b/common/recorderfile.cpp @@ -39,6 +39,12 @@ PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmp _writeStream = NULL; _screenshotsFile = NULL; _mode = kClosed; + + _recordFile = 0; + _headerDumped = false; + _recordCount = 0; + _eventsSize = 0; + memset(_tmpBuffer, kRecordBuffSize, 1); } PlaybackFile::~PlaybackFile() { -- cgit v1.2.3 From c1397788f240bb029ece9d0a551f702eb08e043a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:14:00 +0300 Subject: RECORDER: Fix CID 1046884. Uninitialized class variables. --- gui/EventRecorder.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 47358a0b3d..8917eac2d7 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -77,6 +77,19 @@ EventRecorder::EventRecorder() { _initialized = false; _needRedraw = false; _fastPlayback = false; + + _fakeTimer = 0; + _savedState = false; + _needcontinueGame = false; + _temporarySlot = 0; + _realSaveManager = 0; + _realMixerManager = 0; + controlPanel = 0; + _lastMillis = 0; + _lastScreenshotTime = 0; + _screenshotPeriod = 0; + _playbackFile = 0; + DebugMan.addDebugChannel(kDebugLevelEventRec, "EventRec", "Event recorder debug level"); } -- cgit v1.2.3 From 977038e847f9e08280e9accae2db28b3f5d40abc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:16:01 +0300 Subject: RECORDER: Rename class variable in accoudance with our code style. --- gui/EventRecorder.cpp | 28 ++++++++++++++-------------- gui/EventRecorder.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 8917eac2d7..b62399d799 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -84,7 +84,7 @@ EventRecorder::EventRecorder() { _temporarySlot = 0; _realSaveManager = 0; _realMixerManager = 0; - controlPanel = 0; + _controlPanel = 0; _lastMillis = 0; _lastScreenshotTime = 0; _screenshotPeriod = 0; @@ -109,8 +109,8 @@ void EventRecorder::deinit() { _recordMode = kPassthrough; delete _fakeMixerManager; _fakeMixerManager = NULL; - controlPanel->close(); - delete controlPanel; + _controlPanel->close(); + delete _controlPanel; debugC(1, kDebugLevelEventRec, "playback:action=stopplayback"); g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); _recordMode = kPassthrough; @@ -140,7 +140,7 @@ void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { millisDelay = millis - _lastMillis; _lastMillis = millis; _fakeTimer += millisDelay; - controlPanel->setReplayedTime(_fakeTimer); + _controlPanel->setReplayedTime(_fakeTimer); timerEvent.recordedtype = Common::kRecorderEventTypeTimer; timerEvent.time = _fakeTimer; _playbackFile->writeEvent(timerEvent); @@ -163,7 +163,7 @@ void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { } } millis = _fakeTimer; - controlPanel->setReplayedTime(_fakeTimer); + _controlPanel->setReplayedTime(_fakeTimer); break; case kRecorderPlaybackPause: millis = _fakeTimer; @@ -222,12 +222,12 @@ void EventRecorder::togglePause() { case kRecorderRecord: oldState = _recordMode; _recordMode = kRecorderPlaybackPause; - controlPanel->runModal(); + _controlPanel->runModal(); _recordMode = oldState; _initialized = true; break; case kRecorderPlaybackPause: - controlPanel->close(); + _controlPanel->close(); break; default: break; @@ -290,7 +290,7 @@ void EventRecorder::init(Common::String recordFileName, RecordMode mode) { return; } if (_recordMode != kPassthrough) { - controlPanel = new GUI::OnScreenDialog(_recordMode == kRecorderRecord); + _controlPanel = new GUI::OnScreenDialog(_recordMode == kRecorderRecord); } if (_recordMode == kRecorderPlayback) { applyPlaybackSettings(); @@ -452,8 +452,8 @@ Common::List EventRecorder::mapEvent(const Common::Event &ev, Com return Common::DefaultEventMapper::mapEvent(ev, source); break; case kRecorderRecord: - g_gui.processEvent(evt, controlPanel); - if (((evt.type == Common::EVENT_LBUTTONDOWN) || (evt.type == Common::EVENT_LBUTTONUP) || (evt.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + g_gui.processEvent(evt, _controlPanel); + if (((evt.type == Common::EVENT_LBUTTONDOWN) || (evt.type == Common::EVENT_LBUTTONUP) || (evt.type == Common::EVENT_MOUSEMOVE)) && _controlPanel->isMouseOver()) { return Common::List(); } else { Common::RecorderEvent e; @@ -466,13 +466,13 @@ Common::List EventRecorder::mapEvent(const Common::Event &ev, Com break; case kRecorderPlaybackPause: { Common::Event dialogEvent; - if (controlPanel->isEditDlgVisible()) { + if (_controlPanel->isEditDlgVisible()) { dialogEvent = ev; } else { dialogEvent = evt; } - g_gui.processEvent(dialogEvent, controlPanel->getActiveDlg()); - if (((dialogEvent.type == Common::EVENT_LBUTTONDOWN) || (dialogEvent.type == Common::EVENT_LBUTTONUP) || (dialogEvent.type == Common::EVENT_MOUSEMOVE)) && controlPanel->isMouseOver()) { + g_gui.processEvent(dialogEvent, _controlPanel->getActiveDlg()); + if (((dialogEvent.type == Common::EVENT_LBUTTONDOWN) || (dialogEvent.type == Common::EVENT_LBUTTONUP) || (dialogEvent.type == Common::EVENT_MOUSEMOVE)) && _controlPanel->isMouseOver()) { return Common::List(); } return Common::DefaultEventMapper::mapEvent(dialogEvent, source); @@ -562,7 +562,7 @@ void EventRecorder::preDrawOverlayGui() { g_system->showOverlay(); g_gui.theme()->clearAll(); g_gui.theme()->openDialog(true, GUI::ThemeEngine::kShadingNone); - controlPanel->drawDialog(); + _controlPanel->drawDialog(); g_gui.theme()->finishBuffering(); g_gui.theme()->updateScreen(); _recordMode = oldMode; diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h index 3e32d89232..60fe07fafc 100644 --- a/gui/EventRecorder.h +++ b/gui/EventRecorder.h @@ -193,7 +193,7 @@ private: DefaultTimerManager *_timerManager; RecorderSaveFileManager _fakeSaveManager; NullSdlMixerManager *_fakeMixerManager; - GUI::OnScreenDialog *controlPanel; + GUI::OnScreenDialog *_controlPanel; Common::RecorderEvent _nextEvent; void setFileHeader(); -- cgit v1.2.3 From e3a11085a9c07082dfebb8b4bcf4031ac0569df5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:20:06 +0300 Subject: RECORDER: Fix CID 1046888. Wrong check. --- gui/EventRecorder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index b62399d799..f2df146804 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -331,7 +331,7 @@ bool EventRecorder::openRecordFile(const Common::String &fileName) { } bool EventRecorder::checkGameHash(const ADGameDescription *gameDesc) { - if ((gameDesc == NULL) && (_playbackFile->getHeader().hashRecords.size() != 0)) { + if (_playbackFile->getHeader().hashRecords.size() != 0) { warning("Engine doesn't contain description table"); return false; } -- cgit v1.2.3 From 51046d0ce722309a0a347849e0a60176e0b9069c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:22:53 +0300 Subject: RECORDER: Fix CID 1046881. Unused value --- gui/onscreendialog.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp index efe8038e68..84b84f0192 100644 --- a/gui/onscreendialog.cpp +++ b/gui/onscreendialog.cpp @@ -97,18 +97,17 @@ OnScreenDialog::OnScreenDialog(bool isRecord) : Dialog("OnScreenDialog") { } else #endif { - GUI::ButtonWidget *btn; if (g_system->getOverlayWidth() > 320) - btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[ ]", _("Stop"), kStopCmd); + new ButtonWidget(this, "OnScreenDialog.StopButton", "[ ]", _("Stop"), kStopCmd); else - btn = new ButtonWidget(this, "OnScreenDialog.StopButton", "[]", _("Stop"), kStopCmd); + new ButtonWidget(this, "OnScreenDialog.StopButton", "[]", _("Stop"), kStopCmd); if (isRecord) { - btn = new ButtonWidget(this, "OnScreenDialog.EditButton", "E", _("Edit record description"), kEditCmd); + new ButtonWidget(this, "OnScreenDialog.EditButton", "E", _("Edit record description"), kEditCmd); } else { - btn = new ButtonWidget(this, "OnScreenDialog.SwitchModeButton", "G", _("Switch to Game"), kSwitchModeCmd); + new ButtonWidget(this, "OnScreenDialog.SwitchModeButton", "G", _("Switch to Game"), kSwitchModeCmd); - btn = new ButtonWidget(this, "OnScreenDialog.FastReplayButton", ">>", _("Fast replay"), kFastModeCmd); + new ButtonWidget(this, "OnScreenDialog.FastReplayButton", ">>", _("Fast replay"), kFastModeCmd); } } -- cgit v1.2.3 From 6751a385a81902e03ad2d205133560b57bacaa21 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:24:47 +0300 Subject: RECORDER: Fix CID 1046883. Uninitialized variables --- gui/onscreendialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp index 84b84f0192..e508c64290 100644 --- a/gui/onscreendialog.cpp +++ b/gui/onscreendialog.cpp @@ -116,6 +116,9 @@ OnScreenDialog::OnScreenDialog(bool isRecord) : Dialog("OnScreenDialog") { _enableDrag = false; _mouseOver = false; _editDlgShown = false; + + lastTime = 0; + dlg = 0; } void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { -- cgit v1.2.3 From 9efff8f35012a6dc42d330b8155b1ed8918f8529 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:27:13 +0300 Subject: RECORDER: Rename class variables in accoudance with our code style --- gui/onscreendialog.cpp | 26 +++++++++++++------------- gui/onscreendialog.h | 10 ++++++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp index e508c64290..03a6f26ec0 100644 --- a/gui/onscreendialog.cpp +++ b/gui/onscreendialog.cpp @@ -112,13 +112,13 @@ OnScreenDialog::OnScreenDialog(bool isRecord) : Dialog("OnScreenDialog") { } - text = new GUI::StaticTextWidget(this, "OnScreenDialog.TimeLabel", "00:00:00"); + _text = new GUI::StaticTextWidget(this, "OnScreenDialog.TimeLabel", "00:00:00"); _enableDrag = false; _mouseOver = false; _editDlgShown = false; - lastTime = 0; - dlg = 0; + _lastTime = 0; + _dlg = 0; } void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { @@ -130,20 +130,20 @@ void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat close(); break; case kEditCmd: - dlg = new EditRecordDialog(g_eventRec.getAuthor(), g_eventRec.getName(), g_eventRec.getNotes()); + _dlg = new EditRecordDialog(g_eventRec.getAuthor(), g_eventRec.getName(), g_eventRec.getNotes()); CursorMan.lock(false); g_eventRec.setRedraw(false); g_system->showOverlay(); _editDlgShown = true; - dlg->runModal(); + _dlg->runModal(); _editDlgShown = false; g_system->hideOverlay(); g_eventRec.setRedraw(true); CursorMan.lock(true); - g_eventRec.setAuthor(((EditRecordDialog *)dlg)->getAuthor()); - g_eventRec.setName(((EditRecordDialog *)dlg)->getName()); - g_eventRec.setNotes(((EditRecordDialog *)dlg)->getNotes()); - delete dlg; + g_eventRec.setAuthor(((EditRecordDialog *)_dlg)->getAuthor()); + g_eventRec.setName(((EditRecordDialog *)_dlg)->getName()); + g_eventRec.setNotes(((EditRecordDialog *)_dlg)->getNotes()); + delete _dlg; break; case kSwitchModeCmd: if (g_eventRec.switchMode()) { @@ -157,10 +157,10 @@ void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } void OnScreenDialog::setReplayedTime(uint32 newTime) { - if (newTime - lastTime > 1000) { + if (newTime - _lastTime > 1000) { uint32 seconds = newTime / 1000; - text->setLabel(Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60)); - lastTime = newTime; + _text->setLabel(Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60)); + _lastTime = newTime; } } @@ -220,7 +220,7 @@ void OnScreenDialog::close() { Dialog *OnScreenDialog::getActiveDlg() { if (_editDlgShown) { - return dlg; + return _dlg; } else { return this; } diff --git a/gui/onscreendialog.h b/gui/onscreendialog.h index 4f3839acb6..2fae14cbc6 100644 --- a/gui/onscreendialog.h +++ b/gui/onscreendialog.h @@ -30,14 +30,16 @@ namespace GUI { class OnScreenDialog : public Dialog { private: - uint32 lastTime; + uint32 _lastTime; bool _enableDrag; bool _mouseOver; bool _editDlgShown; Common::Point _dragPoint; - GUI::StaticTextWidget *text; - Dialog *dlg; + GUI::StaticTextWidget *_text; + Dialog *_dlg; + bool isMouseOver(int x, int y); + public: OnScreenDialog(bool recordingMode); ~OnScreenDialog(); @@ -56,7 +58,7 @@ public: bool isEditDlgVisible(); Dialog *getActiveDlg(); protected: - virtual void releaseFocus(); + virtual void releaseFocus(); }; } // End of namespace GUI -- cgit v1.2.3 From 54d0eef6f23046376674c95bc7467216dc0d2766 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:30:35 +0300 Subject: RECORDER: Fix CID 1046882. Uninitalized variables --- gui/recorderdialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index 55f342d4a1..e2e73a4845 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -52,6 +52,12 @@ enum { }; RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentScreenshot(0) { + _firstScreenshotUpdate = false; + _screenShotsCount = 0; + _currentScreenshotText = 0; + _authorText = 0; + _notesText = 0; + _backgroundType = ThemeEngine::kDialogBackgroundSpecial; new StaticTextWidget(this, "SaveLoadChooser.Title", _("Recorder or Playback Gameplay")); -- cgit v1.2.3 From 6e4217e1ba1df9fd2ee4cd0d61151ed7dfc53021 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Jul 2013 19:35:17 +0300 Subject: RECORDER: Fix CID 1046887. Missing break in switch --- gui/recorderdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index e2e73a4845..59fd83362e 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -191,6 +191,7 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; case kCloseCmd: setResult(kRecordDialogClose); + break; default: Dialog::handleCommand(sender, cmd, data); } -- cgit v1.2.3 From 989ea7cb56245ce1918ddf54c2e06973ebcd6239 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 14 Jul 2013 19:01:47 +0200 Subject: JANITORIAL: Remove trailing whitespace --- audio/softsynth/fluidsynth.cpp | 2 +- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 2 +- backends/platform/tizen/form.cpp | 6 +- common/winexe_ne.cpp | 2 +- devtools/create_neverhood/create_neverhood.cpp | 74 ++-- devtools/create_neverhood/tables.h | 2 +- devtools/create_teenagent/static_tables.h | 2 +- engines/agi/agi.cpp | 4 +- engines/cge/detection.cpp | 2 +- engines/cge/snail.cpp | 2 +- engines/drascula/drascula.h | 2 +- engines/dreamweb/monitor.cpp | 10 +- engines/dreamweb/print.cpp | 2 +- engines/groovie/stuffit.cpp | 2 +- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/globals.cpp | 2 +- engines/hopkins/graphics.cpp | 6 +- engines/hopkins/graphics.h | 2 +- engines/hopkins/hopkins.cpp | 2 +- engines/hugo/hugo.cpp | 2 +- engines/neverhood/background.cpp | 4 +- engines/neverhood/blbarchive.cpp | 16 +- engines/neverhood/console.cpp | 2 +- engines/neverhood/diskplayerscene.cpp | 32 +- engines/neverhood/diskplayerscene.h | 6 +- engines/neverhood/entity.cpp | 18 +- engines/neverhood/entity.h | 2 +- engines/neverhood/gamemodule.cpp | 20 +- engines/neverhood/gamemodule.h | 2 +- engines/neverhood/gamevars.cpp | 2 +- engines/neverhood/gamevars.h | 2 +- engines/neverhood/graphics.cpp | 20 +- engines/neverhood/graphics.h | 4 +- engines/neverhood/klaymen.cpp | 400 ++++++++++----------- engines/neverhood/klaymen.h | 30 +- engines/neverhood/menumodule.cpp | 52 +-- engines/neverhood/menumodule.h | 8 +- engines/neverhood/module.cpp | 4 +- engines/neverhood/modules/module1000.cpp | 104 +++--- engines/neverhood/modules/module1000.h | 2 +- engines/neverhood/modules/module1100.cpp | 34 +- engines/neverhood/modules/module1200.cpp | 62 ++-- engines/neverhood/modules/module1300.cpp | 86 ++--- engines/neverhood/modules/module1400.cpp | 54 +-- engines/neverhood/modules/module1500.cpp | 6 +- engines/neverhood/modules/module1600.cpp | 48 +-- engines/neverhood/modules/module1700.cpp | 12 +- engines/neverhood/modules/module1700.h | 2 +- engines/neverhood/modules/module1800.cpp | 4 +- engines/neverhood/modules/module1900.cpp | 40 +-- engines/neverhood/modules/module2000.cpp | 8 +- engines/neverhood/modules/module2100.cpp | 20 +- engines/neverhood/modules/module2100.h | 2 +- engines/neverhood/modules/module2200.cpp | 114 +++--- engines/neverhood/modules/module2200.h | 4 +- engines/neverhood/modules/module2300.cpp | 10 +- engines/neverhood/modules/module2400.cpp | 36 +- engines/neverhood/modules/module2500.cpp | 22 +- engines/neverhood/modules/module2600.cpp | 10 +- engines/neverhood/modules/module2700.cpp | 96 ++--- engines/neverhood/modules/module2800.cpp | 164 ++++----- engines/neverhood/modules/module2800.h | 6 +- engines/neverhood/modules/module2900.cpp | 20 +- engines/neverhood/modules/module2900.h | 4 +- engines/neverhood/modules/module3000.cpp | 42 +-- engines/neverhood/modules/module3000.h | 2 +- engines/neverhood/mouse.cpp | 50 +-- engines/neverhood/mouse.h | 2 +- engines/neverhood/navigationscene.cpp | 20 +- engines/neverhood/neverhood.cpp | 12 +- engines/neverhood/neverhood.h | 4 +- engines/neverhood/palette.cpp | 14 +- engines/neverhood/resource.cpp | 58 +-- engines/neverhood/resource.h | 4 +- engines/neverhood/resourceman.cpp | 2 +- engines/neverhood/saveload.cpp | 10 +- engines/neverhood/scene.cpp | 48 +-- engines/neverhood/scene.h | 42 +-- engines/neverhood/screen.cpp | 52 +-- engines/neverhood/smackerplayer.cpp | 18 +- engines/neverhood/smackerplayer.h | 2 +- engines/neverhood/smackerscene.cpp | 8 +- engines/neverhood/sound.cpp | 26 +- engines/neverhood/sound.h | 30 +- engines/neverhood/sprite.cpp | 24 +- engines/neverhood/staticdata.cpp | 10 +- engines/saga/music.cpp | 2 +- engines/sci/engine/kpathing.cpp | 2 +- engines/sci/engine/kstring.cpp | 2 +- engines/sci/graphics/frameout.cpp | 2 +- engines/scumm/imuse/imuse.cpp | 2 +- engines/scumm/player_v3m.cpp | 2 +- engines/sword25/gfx/dynamicbitmap.cpp | 4 +- engines/sword25/gfx/image/image.h | 2 +- engines/sword25/gfx/image/renderedimage.cpp | 24 +- engines/sword25/gfx/panel.cpp | 2 +- engines/sword25/gfx/renderobject.cpp | 2 +- engines/sword25/gfx/renderobject.h | 16 +- engines/sword25/gfx/renderobjectmanager.cpp | 6 +- engines/sword25/gfx/staticbitmap.cpp | 2 +- engines/teenagent/callbacks.cpp | 6 +- engines/teenagent/dialog.cpp | 2 +- engines/tinsel/handle.cpp | 2 +- engines/tinsel/scene.cpp | 2 +- engines/tsage/core.cpp | 2 +- engines/tsage/graphics.cpp | 2 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 8 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 +- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 4 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 2 +- engines/tsage/ringworld2/ringworld2_speakers.cpp | 2 +- engines/wintermute/ad/ad_response.cpp | 2 +- engines/wintermute/base/base_game.cpp | 4 +- engines/wintermute/base/base_game.h | 4 +- engines/wintermute/base/base_game_music.cpp | 108 +++--- engines/wintermute/base/base_game_music.h | 6 +- engines/wintermute/base/base_game_settings.cpp | 50 +-- engines/wintermute/base/base_game_settings.h | 4 +- engines/wintermute/base/base_keyboard_state.h | 2 +- .../wintermute/base/base_persistence_manager.cpp | 2 +- .../base/gfx/osystem/base_render_osystem.cpp | 2 +- .../base/gfx/osystem/base_surface_osystem.cpp | 2 +- .../wintermute/base/gfx/osystem/render_ticket.cpp | 4 +- .../wintermute/base/gfx/osystem/render_ticket.h | 4 +- engines/wintermute/base/save_thumb_helper.cpp | 12 +- engines/wintermute/base/timer.cpp | 4 +- engines/wintermute/base/timer.h | 6 +- engines/wintermute/debugger.cpp | 4 +- engines/wintermute/debugger.h | 6 +- engines/wintermute/video/video_theora_player.cpp | 4 +- engines/wintermute/video/video_theora_player.h | 2 +- gui/EventRecorder.cpp | 4 +- gui/about.cpp | 4 +- gui/editrecorddialog.cpp | 2 +- gui/recorderdialog.cpp | 4 +- video/codecs/codec.h | 2 +- video/codecs/mpeg.cpp | 2 +- 137 files changed, 1279 insertions(+), 1279 deletions(-) diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 518e260175..efcf1be615 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -163,7 +163,7 @@ int MidiDriver_FluidSynth::open() { Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation"); int interpMethod = FLUID_INTERP_4THORDER; - + if (interpolation == "none") { interpMethod = FLUID_INTERP_NONE; } else if (interpolation == "linear") { diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 1ebd019488..a2e1981e79 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -773,7 +773,7 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { if (_displayDisabled) { _hwscreen = g_eventRec.getSurface(_videoMode.hardwareWidth, _videoMode.hardwareHeight); - } else + } else #endif { _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, diff --git a/backends/platform/tizen/form.cpp b/backends/platform/tizen/form.cpp index cce4b99557..5050699ca9 100644 --- a/backends/platform/tizen/form.cpp +++ b/backends/platform/tizen/form.cpp @@ -316,16 +316,16 @@ void TizenAppForm::invokeShortcut() { case kControlMouse: setButtonShortcut(); break; - + case kEscapeKey: pushKey(Common::KEYCODE_ESCAPE); break; - + case kGameMenu: _buttonState = kLeftButton; pushKey(Common::KEYCODE_F5); break; - + case kShowKeypad: showKeypad(); break; diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp index 6bb40e0980..c3698d5fce 100644 --- a/common/winexe_ne.cpp +++ b/common/winexe_ne.cpp @@ -231,7 +231,7 @@ bool NEResources::readResourceTable(uint32 offset) { if (id & 0x8000) res.id = id & 0x7FFF; else - res.id = getResourceString(*_exe, offset + id); + res.id = getResourceString(*_exe, offset + id); if (typeID & 0x8000 && ((typeID & 0x7FFF) < ARRAYSIZE(s_resTypeNames)) && s_resTypeNames[typeID & 0x7FFF][0] != 0) debug(2, "Found resource %s %s", s_resTypeNames[typeID & 0x7FFF], res.id.toString().c_str()); diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp index f34f20882c..446ee5ec3b 100644 --- a/devtools/create_neverhood/create_neverhood.cpp +++ b/devtools/create_neverhood/create_neverhood.cpp @@ -69,13 +69,13 @@ bool loadExe(const char *filename) { bool validateMd5() { uint8 digest[16]; - + md5_buffer(data, dataSize, digest); - + printf("MD5 of nhc.exe is %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", - digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], + digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); - + if (memcmp(kNhcExeMd5, digest, 16)) { printf("MD5 hash of nhc.exe doesn't match the expected value! Quitting...\n"); return false; @@ -112,7 +112,7 @@ uint32 calcHash(const char *value) { struct HitRect { int16 x1, y1, x2, y2; uint16 messageNum; - + void load(uint32 offset) { byte *item = getData(offset); x1 = READ_LE_UINT16(item + 0); @@ -120,7 +120,7 @@ struct HitRect { x2 = READ_LE_UINT16(item + 4); y2 = READ_LE_UINT16(item + 6); messageNum = READ_LE_UINT16(item + 8); - } + } void save(FILE *fd) { writeUint16LE(fd, x1); @@ -129,11 +129,11 @@ struct HitRect { writeUint16LE(fd, y2); writeUint16LE(fd, messageNum); } - + int getItemSize() const { return 10; } - + }; struct MessageItem { @@ -141,22 +141,22 @@ struct MessageItem { uint32 messageParam; MessageItem() {} MessageItem(uint16 msgNum, uint32 msgParam) : messageNum(msgNum), messageParam(msgParam) {} - + void load(uint32 offset) { byte *item = getData(offset); messageNum = READ_LE_UINT16(item + 0); messageParam = READ_LE_UINT32(item + 4); - } + } void save(FILE *fd) { writeUint16LE(fd, messageNum); writeUint32LE(fd, messageParam); } - + int getItemSize() const { return 8; } - + }; struct SubRectItem { @@ -175,7 +175,7 @@ struct SubRectItem { // Add the message to the message list addMessageList(messageListCount, messageListOffset); } - + void save(FILE *fd) { writeUint16LE(fd, x1); writeUint16LE(fd, y1); @@ -183,11 +183,11 @@ struct SubRectItem { writeUint16LE(fd, y2); writeUint32LE(fd, messageListOffset); } - + int getItemSize() const { return 16; } - + }; struct RectItem { @@ -212,7 +212,7 @@ struct RectItem { subItemOffset += 16; subRectItems.push_back(subRectItem); } - } + } void save(FILE *fd) { writeUint16LE(fd, x1); @@ -223,11 +223,11 @@ struct RectItem { for (uint32 j = 0; j < subRectItems.size(); j++) subRectItems[j].save(fd); } - + int getItemSize() const { return 16; } - + }; struct NavigationItem { @@ -238,10 +238,10 @@ struct NavigationItem { byte interactive; byte middleFlag; uint32 mouseCursorFileHash; - + void load(uint32 offset) { byte *item = getData(offset); - fileHash = READ_LE_UINT32(item + 0); + fileHash = READ_LE_UINT32(item + 0); leftSmackerFileHash = READ_LE_UINT32(item + 4); rightSmackerFileHash = READ_LE_UINT32(item + 8); middleSmackerFileHash = READ_LE_UINT32(item + 12); @@ -263,7 +263,7 @@ struct NavigationItem { int getItemSize() const { return 24; } - + }; struct SceneInfo140Item { @@ -347,24 +347,24 @@ struct SceneInfo2700Item { template class StaticDataList { public: - uint32 id; + uint32 id; std::vector items; - + virtual ~StaticDataList() { } - + void add(ITEMCLASS item) { items.push_back(item); } - + int getCount() const { return items.size(); } - + ITEMCLASS *getListItem(int index) { return &items[index]; } - + virtual bool specialLoadList(uint32 count, uint32 offset) { return false; } @@ -398,7 +398,7 @@ class RectList : public StaticDataList { }; class MessageList : public StaticDataList { -public: +public: virtual bool specialLoadList(uint32 count, uint32 offset) { // Special code for message lists which are set at runtime (but otherwise constant) @@ -455,7 +455,7 @@ public: } return false; } - + }; class NavigationList : public StaticDataList { @@ -465,11 +465,11 @@ template class StaticDataListVector { public: std::vector lists; - + void add(LISTCLASS *list) { lists.push_back(list); } - + void loadListVector(const uint32 *offsets) { for (int i = 0; offsets[i] != 0; i += 2) { LISTCLASS *list = new LISTCLASS(); @@ -486,7 +486,7 @@ public: lists.push_back(list); } } - + void saveListVector(FILE *fd) { writeUint32LE(fd, lists.size()); for (typename std::vector::iterator it = lists.begin(); it != lists.end(); it++) { @@ -500,7 +500,7 @@ template class StaticDataVector { public: std::vector items; - + void loadVector(const uint32 *offsets) { for (int i = 0; offsets[i] != 0; i++) { ITEMCLASS item; @@ -508,7 +508,7 @@ public: items.push_back(item); } } - + void saveVector(FILE *fd) { writeUint32LE(fd, items.size()); for (typename std::vector::iterator it = items.begin(); it != items.end(); it++) { @@ -522,8 +522,8 @@ StaticDataListVector hitRectLists; StaticDataListVector rectLists; StaticDataListVector messageLists; StaticDataListVector navigationLists; -StaticDataVector sceneInfo140Items; -StaticDataVector sceneInfo2700Items; +StaticDataVector sceneInfo140Items; +StaticDataVector sceneInfo2700Items; void addMessageList(uint32 messageListCount, uint32 messageListOffset) { MessageList *messageList = new MessageList(); @@ -550,7 +550,7 @@ int main(int argc, char *argv[]) { writeUint32LE(datFile, 0x11223344); // Some magic writeUint32LE(datFile, DAT_VERSION); - + messageLists.saveListVector(datFile); rectLists.saveListVector(datFile); hitRectLists.saveListVector(datFile); diff --git a/devtools/create_neverhood/tables.h b/devtools/create_neverhood/tables.h index ea39aa807d..eb136491db 100644 --- a/devtools/create_neverhood/tables.h +++ b/devtools/create_neverhood/tables.h @@ -122,7 +122,7 @@ static const uint32 rectListOffsets[] = { // Scene2406 1, 0x004B78C8, 1, 0x004B78D8, - // Scene2501 + // Scene2501 1, 0x004B2608, // Scene2732 1, 0x004AE360, diff --git a/devtools/create_teenagent/static_tables.h b/devtools/create_teenagent/static_tables.h index 6e7fdfe91c..5c9b5b3d21 100644 --- a/devtools/create_teenagent/static_tables.h +++ b/devtools/create_teenagent/static_tables.h @@ -15148,7 +15148,7 @@ const static char* dialog_162[] = { }; // Note: -// The usage of this in the engine overlaps the previous dialog i.e. the +// The usage of this in the engine overlaps the previous dialog i.e. the // starting offset used is two bytes early, thus implicitly changing the // first command of this dialog from NEW_LINE to CHANGE_CHARACTER. const static char* dialog_163[] = { diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 1c342183cd..57561c00ee 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -598,8 +598,8 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas _console = NULL; _egoHoldKey = false; - - + + } void AgiEngine::initialize() { diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index d29c1224fd..3b01421903 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -121,7 +121,7 @@ static const CgeGameDescription gameDescriptions[] = { "sfinx", "Sfinx Freeware", { {"vol.cat", 0, "21197b287d397c53261b6616bf0dd880", 129024}, - {"vol.dat", 0, "de14291869a8eb7c2732ab783c7542ef", 34180844}, + {"vol.dat", 0, "de14291869a8eb7c2732ab783c7542ef", 34180844}, AD_LISTEND }, Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index edb8972040..b9030efb4d 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -494,7 +494,7 @@ void CGEEngine::snGame(Sprite *spr, int num) { _sprK3->step(newRandom(6)); // check the ALT key as it's the solution of the puzzle - // the test has been restricted to some specific OSes + // the test has been restricted to some specific OSes // in order to avoid some obvious issues (like Android, iOS, NDS, N64...) // Not perfect, but at least better than nothing. #if defined(WIN32) || defined(UNIX) || defined(MACOSX) || defined(MOTOEZX) || defined(LINUPY) || defined(LINUXMOTO_SDL) diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index e547503bee..c4d1c4c761 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -661,7 +661,7 @@ public: void animation_3_1(); // John talks with the bartender to book a room void animation_4_1(); // John talks with the pianist // - void animation_2_2(); // John enters the chapel via the window + void animation_2_2(); // John enters the chapel via the window void animation_4_2(); // John talks with the blind man (closeup) void animation_5_2(); // John breaks the chapel window with the pike void animation_6_2(); // The blind man (closeup) thanks John for giving him money and hands him the sickle diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 1f9fa8d24f..108f9d2b60 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -104,7 +104,7 @@ void DreamWebEngine::useMon() { redrawMainScrn(); workToScreenM(); } - + int DreamWebEngine::findCommand(const char *const cmdList[]) { // Loop over all commands in the list and see if we get a match int cmd = 0; @@ -135,7 +135,7 @@ bool DreamWebEngine::execCommand() { "KEYS", NULL }; - + static const char *const comlistFR[] = { "SORTIR", "AIDE", @@ -145,7 +145,7 @@ bool DreamWebEngine::execCommand() { "TOUCHES", // should be CLES but it is translated as TOUCHES in the game... NULL }; - + static const char *const comlistDE[] = { "ENDE", "HILF", @@ -155,7 +155,7 @@ bool DreamWebEngine::execCommand() { "DATEN", NULL }; - + static const char *const comlistIT[] = { "ESCI", "AIUTO", @@ -165,7 +165,7 @@ bool DreamWebEngine::execCommand() { "CHIAVI", NULL }; - + static const char *const comlistES[] = { "SALIR", "AYUDA", diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index bc75b97e71..bec58322d5 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -67,7 +67,7 @@ void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, // characters (0 - 31). if (c < 32 || c == 255) return; - + uint8 dummyWidth, dummyHeight; if (width == NULL) width = &dummyWidth; diff --git a/engines/groovie/stuffit.cpp b/engines/groovie/stuffit.cpp index 37f12585e7..60a57a0129 100644 --- a/engines/groovie/stuffit.cpp +++ b/engines/groovie/stuffit.cpp @@ -249,7 +249,7 @@ void StuffItArchive::update14(uint16 first, uint16 last, byte *code, uint16 *fre do { while (++i < last && code[first] > code[i]) ; - + while (--j > first && code[first] < code[j]) ; diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 6cdfbf47d1..ab672d4c48 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -505,7 +505,7 @@ void DialogsManager::inventAnim() { return; if (_vm->_objectsMan->_eraseVisibleCounter && !_vm->_objectsMan->_visibleFl) { - _vm->_graphicsMan->copySurface(_vm->_graphicsMan->_backBuffer, _oldInventX, 27, 48, 38, + _vm->_graphicsMan->copySurface(_vm->_graphicsMan->_backBuffer, _oldInventX, 27, 48, 38, _vm->_graphicsMan->_frontBuffer, _oldInventX, 27); _vm->_graphicsMan->addDirtyRect(_oldInventX, 27, _oldInventX + 48, 65); --_vm->_objectsMan->_eraseVisibleCounter; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 28f22ed99e..a9a0a81f08 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -134,7 +134,7 @@ Globals::~Globals() { void Globals::setConfig() { // CHECKME: Should be in Globals() but it doesn't work // The Polish version is a translation of the English version. The filenames are the same. - // The Russian version looks like a translation of the English version, based on the filenames. + // The Russian version looks like a translation of the English version, based on the filenames. switch (_vm->getLanguage()) { case Common::EN_ANY: case Common::PL_POL: diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index ebc5cfa8da..b83371d65f 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1179,7 +1179,7 @@ void GraphicsManager::displayZones() { Common::Rect r(_vm->_objectsMan->_bob[bobId]._oldX, _vm->_objectsMan->_bob[bobId]._oldY, _vm->_objectsMan->_bob[bobId]._oldX + _vm->_objectsMan->_bob[bobId]._oldWidth, _vm->_objectsMan->_bob[bobId]._oldY + _vm->_objectsMan->_bob[bobId]._oldHeight); - + displayDebugRect(screenSurface, r, 0xff0000); } } @@ -1204,7 +1204,7 @@ void GraphicsManager::displayLines() { uint16* pixels = (uint16*)screenSurface->pixels; - for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { + for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { int i = 0; do { int x = _vm->_linesMan->_lineItem[lineIndex]._lineData[i] - _scrollPosX; @@ -1230,7 +1230,7 @@ void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common: r.top = MAX(r.top, (int16)0); r.right = MIN(r.right, (int16)SCREEN_WIDTH); r.bottom = MIN(r.bottom, (int16)SCREEN_HEIGHT); - + // If there's an on-screen portion, display it if (r.isValidRect()) surface->frameRect(r, color); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 268db7fc2b..8767f5ec4d 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -125,7 +125,7 @@ public: public: GraphicsManager(HopkinsEngine *vm); ~GraphicsManager(); - + void clearPalette(); void clearScreen(); void clearVesaScreen(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index b773808c50..6d93019faa 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -92,7 +92,7 @@ bool HopkinsEngine::canLoadGameStateCurrently() { * Returns true if it is currently okay to save the game */ bool HopkinsEngine::canSaveGameStateCurrently() { - return !_globals->_exitId && !_globals->_cityMapEnabledFl && _events->_mouseFl + return !_globals->_exitId && !_globals->_cityMapEnabledFl && _events->_mouseFl && _globals->_curRoomNum != 0 && !isUnderwaterSubScene(); } diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index bcf06055f8..b140cfdba2 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -66,7 +66,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy _console = new HugoConsole(this); _rnd = 0; - + _screen = NULL; _mouse = NULL; _inventory = NULL; diff --git a/engines/neverhood/background.cpp b/engines/neverhood/background.cpp index e9e5325e77..d6a9900d38 100644 --- a/engines/neverhood/background.cpp +++ b/engines/neverhood/background.cpp @@ -33,11 +33,11 @@ Background::Background(NeverhoodEngine *vm, int objectPriority) Background::Background(NeverhoodEngine *vm, uint32 fileHash, int objectPriority, int surfacePriority) : Entity(vm, objectPriority), _surface(NULL), _spriteResource(vm) { - + _spriteResource.load(fileHash); createSurface(surfacePriority, _spriteResource.getDimensions().width, _spriteResource.getDimensions().height); _surface->drawSpriteResource(_spriteResource); - + } Background::~Background() { diff --git a/engines/neverhood/blbarchive.cpp b/engines/neverhood/blbarchive.cpp index 9f5f46487c..d730d75718 100644 --- a/engines/neverhood/blbarchive.cpp +++ b/engines/neverhood/blbarchive.cpp @@ -58,8 +58,8 @@ BlbArchive::~BlbArchive() { void BlbArchive::open(const Common::String &filename) { BlbHeader header; uint16 *extDataOffsets; - - _entries.clear(); + + _entries.clear(); if (!_fd.open(filename)) error("BlbArchive::open() Could not open %s", filename.c_str()); @@ -83,16 +83,16 @@ void BlbArchive::open(const Common::String &filename) { entry.fileHash = _fd.readUint32LE(); _entries.push_back(entry); } - + extDataOffsets = new uint16[header.fileCount]; - + // Load file records for (uint i = 0; i < header.fileCount; i++) { BlbArchiveEntry &entry = _entries[i]; entry.type = _fd.readByte(); entry.comprType = _fd.readByte(); entry.extData = NULL; - extDataOffsets[i] = _fd.readUint16LE(); + extDataOffsets[i] = _fd.readUint16LE(); entry.timeStamp = _fd.readUint32LE(); entry.offset = _fd.readUint32LE(); entry.diskSize = _fd.readUint32LE(); @@ -101,7 +101,7 @@ void BlbArchive::open(const Common::String &filename) { entry.fileHash, entry.type, entry.comprType, extDataOffsets[i], entry.timeStamp, entry.offset, entry.diskSize, entry.size); } - + // Load ext data if (header.extDataSize > 0) { _extData = new byte[header.extDataSize]; @@ -120,9 +120,9 @@ void BlbArchive::load(uint index, byte *buffer, uint32 size) { void BlbArchive::load(BlbArchiveEntry *entry, byte *buffer, uint32 size) { Common::StackLock lock(_mutex); - + _fd.seek(entry->offset); - + switch (entry->comprType) { case 1: // Uncompressed if (size == 0) diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index e676da3727..733d7dd8a4 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -81,7 +81,7 @@ bool Console::Cmd_Cheat(int argc, const char **argv) { DebugPrintf(" music - shows the correct index in the radio music puzzle, module 2800, scene 1\n"); DebugPrintf(" radio - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n"); DebugPrintf(" symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n"); - DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10\n"); + DebugPrintf(" tubes - shows the correct test tube combination in module 2800, scenes 7 and 10\n"); return true; } diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index 94a68a7526..ef2b856b2f 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -61,7 +61,7 @@ static const uint32 kDiskplayerSmackerFileHashes[] = { 0x04002810 }; -static const uint32 kDiskplayerSlotFileHashes1[] = { +static const uint32 kDiskplayerSlotFileHashes1[] = { 0x81312280, 0x01312281, 0x01312282, @@ -84,7 +84,7 @@ static const uint32 kDiskplayerSlotFileHashes1[] = { 0x04312281 }; -static const uint32 kDiskplayerSlotFileHashes2[] = { +static const uint32 kDiskplayerSlotFileHashes2[] = { 0x90443A00, 0x90443A18, 0x90443A28, @@ -107,8 +107,8 @@ static const uint32 kDiskplayerSlotFileHashes2[] = { 0xC0443A18 }; -static const uint32 kDiskplayerSlotFileHashes3[] = { - 0x10357320, +static const uint32 kDiskplayerSlotFileHashes3[] = { + 0x10357320, 0x10557320, 0x10957320, 0x11157320, @@ -130,7 +130,7 @@ static const uint32 kDiskplayerSlotFileHashes3[] = { 0x10543320 }; -static const uint32 kDiskplayerSlotFileHashes4[] = { +static const uint32 kDiskplayerSlotFileHashes4[] = { 0xDC8020E4, 0xDC802164, 0xDC802264, @@ -155,7 +155,7 @@ static const uint32 kDiskplayerSlotFileHashes4[] = { AsDiskplayerSceneKey::AsDiskplayerSceneKey(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { - + createSurface1(0x100B90B4, 1200); _x = 211; _y = 195; @@ -193,7 +193,7 @@ void AsDiskplayerSceneKey::stDropKeyDone() { DiskplayerPlayButton::DiskplayerPlayButton(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene) : StaticSprite(vm, 1400), _diskplayerScene(diskplayerScene), _isPlaying(false) { - + loadSprite(0x24A4A664, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44043000); @@ -317,10 +317,10 @@ void DiskplayerSlot::stop() { DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int paletteIndex) : Scene(vm, parentModule), _diskIndex(0), _appearCountdown(0), _tuneInCountdown(0), - _hasAllDisks(false), _dropKey(false), _inputDisabled(true), _updateStatus(kUSStopped) { + _hasAllDisks(false), _dropKey(false), _inputDisabled(true), _updateStatus(kUSStopped) { int availableDisksCount = 0; - + setBackground(0x8A000044); setPalette(kDiskplayerPaletteFileHashes[paletteIndex]); @@ -344,7 +344,7 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int } _hasAllDisks = availableDisksCount == 20; - + if (_hasAllDisks && !getGlobalVar(V_HAS_FINAL_KEY)) _dropKey = true; @@ -360,8 +360,8 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int _palette->usePalette(); - SetMessageHandler(&DiskplayerScene::handleMessage); - SetUpdateHandler(&DiskplayerScene::update); + SetMessageHandler(&DiskplayerScene::handleMessage); + SetUpdateHandler(&DiskplayerScene::update); _appearCountdown = 6; } @@ -417,7 +417,7 @@ void DiskplayerScene::update() { } _diskIndex++; while (!_diskAvailable[_diskIndex] && _diskIndex < 19) - _diskIndex++; + _diskIndex++; if (_diskIndex < 20) { _appearCountdown = 1; } else { @@ -448,7 +448,7 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, } else if (!_dropKey && param.asPoint().x > 38 && param.asPoint().x < 598 && param.asPoint().y > 400 && param.asPoint().y < 460) { - + _diskSlots[_diskIndex]->stop(); _diskIndex = (param.asPoint().x - 38) / 28; _diskSlots[_diskIndex]->activate(); @@ -462,10 +462,10 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, break; case 0x2000: tuneIn(); - break; + break; case 0x2001: stop(); - break; + break; } } return 0; diff --git a/engines/neverhood/diskplayerscene.h b/engines/neverhood/diskplayerscene.h index 4afaf8af9f..150d5c58ed 100644 --- a/engines/neverhood/diskplayerscene.h +++ b/engines/neverhood/diskplayerscene.h @@ -36,7 +36,7 @@ class AsDiskplayerSceneKey : public AnimatedSprite { public: AsDiskplayerSceneKey(NeverhoodEngine *vm); void stDropKey(); -protected: +protected: uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); void stDropKeyDone(); }; @@ -47,7 +47,7 @@ public: void press(); void release(); protected: - DiskplayerScene *_diskplayerScene; + DiskplayerScene *_diskplayerScene; bool _isPlaying; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -69,7 +69,7 @@ protected: int _blinkCountdown; bool _isLocked; bool _isBlinking; - void update(); + void update(); }; enum { diff --git a/engines/neverhood/entity.cpp b/engines/neverhood/entity.cpp index 8b1298916c..af65cfd025 100644 --- a/engines/neverhood/entity.cpp +++ b/engines/neverhood/entity.cpp @@ -25,25 +25,25 @@ namespace Neverhood { -uint32 MessageParam::asInteger() const { - assert(_type == mptInteger); - return _integer; +uint32 MessageParam::asInteger() const { + assert(_type == mptInteger); + return _integer; } -NPoint MessageParam::asPoint() const { +NPoint MessageParam::asPoint() const { assert(_type == mptInteger || _type == mptPoint); if (_type == mptInteger) { NPoint pt; pt.x = _integer & 0xFFFF; - pt.y = (_integer >> 16) & 0xFFFF; + pt.y = (_integer >> 16) & 0xFFFF; return pt; - } - return _point; + } + return _point; } Entity *MessageParam::asEntity() const { - assert(_type == mptEntity); - return _entity; + assert(_type == mptEntity); + return _entity; } Entity::Entity(NeverhoodEngine *vm, int priority) diff --git a/engines/neverhood/entity.h b/engines/neverhood/entity.h index cba1bb9a7f..0d5cf3fd50 100644 --- a/engines/neverhood/entity.h +++ b/engines/neverhood/entity.h @@ -98,7 +98,7 @@ public: void incGlobalVar(uint32 nameHash, int incrValue); void incSubVar(uint32 nameHash, uint32 subNameHash, int incrValue); int getPriority() const { return _priority; } - bool hasMessageHandler() const { return _messageHandlerCb != NULL; } + bool hasMessageHandler() const { return _messageHandlerCb != NULL; } protected: void (Entity::*_updateHandlerCb)(); uint32 (Entity::*_messageHandlerCb)(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index b3589837df..47cc818fea 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -77,7 +77,7 @@ GameModule::GameModule(NeverhoodEngine *vm) : Module(vm, NULL), _moduleNum(-1), _prevChildObject(NULL), _prevModuleNum(-1), _restoreGameRequested(false), _restartGameRequested(false), _canRequestMainMenu(true), _mainMenuRequested(false) { - + // Other initializations moved to actual engine class _vm->_soundMan->playSoundThree(0x002D0031, 0x8861079); SetMessageHandler(&GameModule::handleMessage); @@ -96,7 +96,7 @@ void GameModule::handleMouseMove(int16 x, int16 y) { mousePos.y = y; debug(2, "GameModule::handleMouseMove(%d, %d)", x, y); sendPointMessage(_childObject, 0, mousePos); - } + } } void GameModule::handleMouseDown(int16 x, int16 y) { @@ -106,7 +106,7 @@ void GameModule::handleMouseDown(int16 x, int16 y) { mousePos.y = y; debug(2, "GameModule::handleMouseDown(%d, %d)", x, y); sendPointMessage(_childObject, 0x0001, mousePos); - } + } } void GameModule::handleMouseUp(int16 x, int16 y) { @@ -116,21 +116,21 @@ void GameModule::handleMouseUp(int16 x, int16 y) { mousePos.y = y; debug(2, "GameModule::handleMouseUp(%d, %d)", x, y); sendPointMessage(_childObject, 0x0002, mousePos); - } + } } void GameModule::handleSpaceKey() { if (_childObject) { debug(2, "GameModule::handleSpaceKey()"); sendMessage(_childObject, 0x0009, 0); - } + } } void GameModule::handleAsciiKey(char key) { if (_childObject) { debug(2, "GameModule::handleAsciiKey()"); sendMessage(_childObject, 0x000A, (uint32)key); - } + } } void GameModule::handleKeyDown(Common::KeyCode keyCode) { @@ -141,7 +141,7 @@ void GameModule::handleKeyDown(Common::KeyCode keyCode) { handleSpaceKey(); debug(2, "GameModule::handleKeyDown()"); sendMessage(_childObject, 0x000B, keyCode); - } + } } void GameModule::handleEscapeKey() { @@ -166,7 +166,7 @@ void GameModule::initKeySlotsPuzzle() { void GameModule::initMemoryPuzzle() { if (!getSubVar(VA_IS_PUZZLE_INIT, 0xC8606803)) { - NonRepeatingRandomNumbers diceIndices(_vm->_rnd, 3); + NonRepeatingRandomNumbers diceIndices(_vm->_rnd, 3); NonRepeatingRandomNumbers availableTiles(_vm->_rnd, 48); NonRepeatingRandomNumbers tileSymbols(_vm->_rnd, 10); for (uint32 i = 0; i < 3; i++) @@ -320,11 +320,11 @@ uint32 GameModule::handleMessage(int messageNum, const MessageParam ¶m, Enti switch (messageNum) { case 0x0800: _canRequestMainMenu = true; - break; + break; case 0x1009: _moduleResult = param.asInteger(); _done = true; - break; + break; } return messageResult; } diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 1fb3557b81..2f2fecf463 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -49,7 +49,7 @@ public: void initWaterPipesPuzzle(); void initRadioPuzzle(); void initTestTubes1Puzzle(); - void initTestTubes2Puzzle(); + void initTestTubes2Puzzle(); void initCannonSymbolsPuzzle(); void initCodeSymbolsPuzzle(); void initCubeSymbolsPuzzle(); diff --git a/engines/neverhood/gamevars.cpp b/engines/neverhood/gamevars.cpp index dc25f74e56..9c080fea24 100644 --- a/engines/neverhood/gamevars.cpp +++ b/engines/neverhood/gamevars.cpp @@ -75,7 +75,7 @@ uint32 GameVars::getSubVar(uint32 nameHash, uint32 subNameHash) { int16 subVarIndex = findSubVarIndex(varIndex, subNameHash); if (subVarIndex != -1) value = _vars[subVarIndex].value; - } + } return value; } diff --git a/engines/neverhood/gamevars.h b/engines/neverhood/gamevars.h index de9ffb8ec5..3aec4d1da4 100644 --- a/engines/neverhood/gamevars.h +++ b/engines/neverhood/gamevars.h @@ -160,7 +160,7 @@ enum { VA_HAS_KEY = 0x0090EA95, VA_IS_KEY_INSERTED = 0x08D0AB11, VA_LOCKS_DISABLED = 0x14800353, - V_END_ + V_END_ }; struct GameVar { diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 66a7999e59..490959020f 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -29,7 +29,7 @@ namespace Neverhood { BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, Common::String name) : _vm(vm), _priority(priority), _visible(true), _transparent(true), _clipRects(NULL), _clipRectsCount(0), _version(0), _name(name) { - + _drawRect.x = 0; _drawRect.y = 0; _drawRect.width = width; @@ -68,7 +68,7 @@ void BaseSurface::clear() { } void BaseSurface::drawSpriteResource(SpriteResource &spriteResource) { - if (spriteResource.getDimensions().width <= _drawRect.width && + if (spriteResource.getDimensions().width <= _drawRect.width && spriteResource.getDimensions().height <= _drawRect.height) { clear(); spriteResource.draw(_surface, false, false); @@ -77,7 +77,7 @@ void BaseSurface::drawSpriteResource(SpriteResource &spriteResource) { } void BaseSurface::drawSpriteResourceEx(SpriteResource &spriteResource, bool flipX, bool flipY, int16 width, int16 height) { - if (spriteResource.getDimensions().width <= _sysRect.width && + if (spriteResource.getDimensions().width <= _sysRect.width && spriteResource.getDimensions().height <= _sysRect.height) { if (width > 0 && width <= _sysRect.width) _drawRect.width = width; @@ -145,7 +145,7 @@ void ShadowSurface::draw() { FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) { - + _tracking = new NPointArray(); *_tracking = *tracking; @@ -154,7 +154,7 @@ FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsP FontSurface::FontSurface(NeverhoodEngine *vm, uint32 fileHash, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) { - + SpriteResource fontSpriteResource(_vm); fontSpriteResource.load(fileHash, true); drawSpriteResourceEx(fontSpriteResource, false, false, 0, 0); @@ -182,7 +182,7 @@ void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const b for (; stringLen > 0; --stringLen, ++string) { drawChar(destSurface, x, y, *string); x += _tracking ? (*_tracking)[*string - _firstChar].x : _charWidth; - } + } } @@ -201,7 +201,7 @@ FontSurface *FontSurface::createFontSurface(NeverhoodEngine *vm, uint32 fileHash uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x; NPointArray *tracking = fontData.getPointArray(calcHash("meTracking")); fontSprite.load(fileHash, true); - fontSurface = new FontSurface(vm, tracking, 16, numRows, firstChar, charWidth, charHeight); + fontSurface = new FontSurface(vm, tracking, 16, numRows, firstChar, charWidth, charHeight); fontSurface->drawSpriteResourceEx(fontSprite, false, false, 0, 0); return fontSurface; } @@ -219,7 +219,7 @@ enum BitmapFlags { void parseBitmapResource(const byte *sprite, bool *rle, NDimensions *dimensions, NPoint *position, const byte **palette, const byte **pixels) { uint16 flags; - + flags = READ_LE_UINT16(sprite); sprite += 2; @@ -278,7 +278,7 @@ void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int rows = READ_LE_UINT16(source); chunks = READ_LE_UINT16(source + 2); source += 4; - + do { if (chunks == 0) { dest += rows * destPitch; @@ -316,7 +316,7 @@ void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int void unpackSpriteNormal(const byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY) { const int sourcePitch = (width + 3) & 0xFFFC; - + if (flipY) { dest += destPitch * (height - 1); destPitch = -destPitch; diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h index 9ab0d87ab9..703e274576 100644 --- a/engines/neverhood/graphics.h +++ b/engines/neverhood/graphics.h @@ -62,12 +62,12 @@ struct NRect { typedef Common::Array NRectArray; -// TODO: Use Common::Rect +// TODO: Use Common::Rect struct NDrawRect { int16 x, y, width, height; NDrawRect() : x(0), y(0), width(0), height(0) {} NDrawRect(int16 x0, int16 y0, int16 width0, int16 height0) : x(x0), y(y0), width(width0), height(height0) {} - int16 x2() { return x + width; } + int16 x2() { return x + width; } int16 y2() { return y + height; } void set(int16 x0, int16 y0, int16 width0, int16 height0) { x = x0; diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index 70567806fa..8ed27c825a 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -33,19 +33,19 @@ static const KlaymenIdleTableItem klaymenIdleTable1[] = { {1, kIdleArms}, {1, kIdleChest}, {1, kIdleHeadOff} -}; +}; static const KlaymenIdleTableItem klaymenIdleTable2[] = { {1, kIdlePickEar}, {1, kIdleSpinHead}, {1, kIdleChest}, {1, kIdleHeadOff} -}; +}; static const KlaymenIdleTableItem klaymenIdleTable3[] = { {1, kIdleTeleporterHands}, {1, kIdleTeleporterHands2} -}; +}; static const KlaymenIdleTableItem klaymenIdleTable4[] = { {1, kIdleSpinHead}, @@ -56,7 +56,7 @@ static const KlaymenIdleTableItem klaymenIdleTable4[] = { static const KlaymenIdleTableItem klaymenIdleTable1002[] = { {1, kIdlePickEar}, {2, kIdleWonderAbout} -}; +}; // Klaymen @@ -66,7 +66,7 @@ Klaymen::Klaymen(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRec _attachedSprite(NULL), _isWalking(false), _actionStatus(1), _parentScene(parentScene), _isSneaking(false), _isLargeStep(false), _doYHitIncr(false), _isLeverDown(false), _isSittingInTeleporter(false), _actionStatusChanged(false), _ladderStatus(0), _pathPoints(NULL), _soundFlag(false), _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _readyToSpit(false), _walkResumeFrameIncr(0) { - + createSurface(1000, 320, 200); _x = x; _y = y; @@ -447,7 +447,7 @@ void Klaymen::upIdleAnimation() { bool Klaymen::stStartActionFromIdle(AnimationCb callback) { if (_busyStatus == 2) { _busyStatus = 1; - _acceptInput = false; + _acceptInput = false; startAnimation(0x9A7020B8, 0, -1); SetUpdateHandler(&Klaymen::update); SetMessageHandler(&Klaymen::hmStartAction); @@ -684,35 +684,35 @@ void Klaymen::suAction() { _x += _deltaX; } _deltaX = 0; - + if (_doDeltaY) { _y -= _deltaY; } else { _y += _deltaY; } _deltaY = 0; - + if (_frameChanged) { if (xdiff > 6) _x += 6; else if (xdiff < -6) _x -= 6; else - _x = _destX; + _x = _destX; } - + updateBounds(); - + } void Klaymen::suSneaking() { - + int16 xdiff = _destX - _x; - + if (_currFrameIndex == 9) { if (xdiff > 26) _deltaX += xdiff - 26; - else if (xdiff < -26) + else if (xdiff < -26) _deltaX -= xdiff + 26; } @@ -720,7 +720,7 @@ void Klaymen::suSneaking() { xdiff = _deltaX; else if (xdiff < -_deltaX) xdiff = -_deltaX; - _deltaX = 0; + _deltaX = 0; if (_destX != _x) { HitRect *hitRectPrev = _parentScene->findHitRectAtPos(_x, _y); @@ -749,7 +749,7 @@ void Klaymen::suSneaking() { } updateBounds(); } - + } void Klaymen::stSneak() { @@ -761,7 +761,7 @@ void Klaymen::stSneak() { SetUpdateHandler(&Klaymen::update); SetMessageHandler(&Klaymen::hmSneaking); SetSpriteUpdate(&Klaymen::suSneaking); - FinalizeState(&Klaymen::evSneakingDone); + FinalizeState(&Klaymen::evSneakingDone); } void Klaymen::evSneakingDone() { @@ -801,7 +801,7 @@ void Klaymen::stStartWalking() { SetMessageHandler(&Klaymen::hmStartWalking); SetSpriteUpdate(&Klaymen::suWalkingTestExit); NextState(&Klaymen::stWalkingFirst); - FinalizeState(&Klaymen::evStartWalkingDone); + FinalizeState(&Klaymen::evStartWalkingDone); } } @@ -832,7 +832,7 @@ void Klaymen::stWalkingFirst() { SetMessageHandler(&Klaymen::hmWalking); SetSpriteUpdate(&Klaymen::suWalkingFirst); NextState(&Klaymen::stUpdateWalkingFirst); - FinalizeState(&Klaymen::evStartWalkingDone); + FinalizeState(&Klaymen::evStartWalkingDone); } void Klaymen::suWalkingFirst() { @@ -882,20 +882,20 @@ void Klaymen::stUpdateWalkingFirst() { SetUpdateHandler(&Klaymen::update); SetMessageHandler(&Klaymen::hmSneaking); SetSpriteUpdate(&Klaymen::suSneaking); - FinalizeState(&Klaymen::evSneakingDone); + FinalizeState(&Klaymen::evSneakingDone); } } void Klaymen::suWalkingTestExit() { int16 xdiff = ABS(_destX - _x); int16 xdelta = _destX - _x; - + if (xdelta > _deltaX) xdelta = _deltaX; else if (xdelta < -_deltaX) xdelta = -_deltaX; - - _deltaX = 0; + + _deltaX = 0; if (xdiff == 0 || (_actionStatus != 2 && _actionStatus != 3 && xdiff <= 42 && _currFrameIndex >= 5 && _currFrameIndex <= 11) || @@ -928,7 +928,7 @@ void Klaymen::suWalkingTestExit() { } updateBounds(); } - + } uint32 Klaymen::hmLever(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1363,7 +1363,7 @@ void Klaymen::stLargeStep() { SetUpdateHandler(&Klaymen::update); SetMessageHandler(&Klaymen::hmLargeStep); SetSpriteUpdate(&Klaymen::suLargeStep); - FinalizeState(&Klaymen::evLargeStepDone); + FinalizeState(&Klaymen::evLargeStepDone); } void Klaymen::evLargeStepDone() { @@ -1372,11 +1372,11 @@ void Klaymen::evLargeStepDone() { void Klaymen::suLargeStep() { int16 xdiff = _destX - _x; - + if (_doDeltaX) { _deltaX = -_deltaX; } - + if (_currFrameIndex == 7) { _deltaX = xdiff; } @@ -1385,7 +1385,7 @@ void Klaymen::suLargeStep() { xdiff = _deltaX; _deltaX = 0; - + if (_x != _destX) { HitRect *hitRectPrev = _parentScene->findHitRectAtPos(_x, _y); _x += xdiff; @@ -1420,7 +1420,7 @@ uint32 Klaymen::hmLargeStep(int messageNum, const MessageParam ¶m, Entity *s case 0x3002: _x = _destX; gotoNextStateExt(); - break; + break; } return messageResult; } @@ -1681,7 +1681,7 @@ void Klaymen::stStartClimbLadderDown() { _ladderStatus = 2; _acceptInput = true; startAnimation(0x122D1505, 29 - _currFrameIndex, -1); - } + } } } @@ -1979,7 +1979,7 @@ uint32 Klaymen::hmMoveObjectTurn(int messageNum, const MessageParam ¶m, Enti break; case 0x480A: _isMoveObjectRequested = true; - return 0; + return 0; } return hmLowLevelAnimation(messageNum, param, sender); } @@ -2521,7 +2521,7 @@ void Klaymen::stInsertKey() { more = true; } while (more); _keysToInsert++; - } + } } if (_keysToInsert == 0) { GotoState(NULL); @@ -3049,7 +3049,7 @@ void Klaymen::stFallSkipJump() { void Klaymen::upMoveObject() { if (_x >= 380) gotoNextStateExt(); - Klaymen::update(); + Klaymen::update(); } uint32 Klaymen::hmMatch(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -3165,7 +3165,7 @@ void Klaymen::stTumbleHeadless() { void Klaymen::stCloseEyes() { if (!stStartActionFromIdle(AnimationCallback(&Klaymen::stCloseEyes))) { _busyStatus = 1; - _acceptInput = false; + _acceptInput = false; startAnimation(0x5420E254, 0, -1); SetUpdateHandler(&Klaymen::update); SetMessageHandler(&Klaymen::hmLowLevel); @@ -3358,7 +3358,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4004: GotoState(&Klaymen::stTryStandIdle); - break; + break; case 0x4804: if (param.asInteger() == 2) GotoState(&Klaymen::stSleeping); @@ -3380,7 +3380,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -3408,10 +3408,10 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2002, 0); GotoState(&Klaymen::stWakeUp); } - break; + break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -3423,7 +3423,7 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1002::KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + setKlaymenIdleTable1(); } @@ -3438,7 +3438,7 @@ void KmScene1002::xUpdate() { _idleTableNum = 0; } } - + uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2001: @@ -3451,7 +3451,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4800: startWalkToX(param.asPoint().x, false); break; - case 0x4004: + case 0x4004: GotoState(&Klaymen::stTryStandIdle); break; case 0x4803: @@ -3479,42 +3479,42 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { break; } break; - case 0x480A: + case 0x480A: GotoState(&Klaymen::stMoveVenusFlyTrap); break; - case 0x480D: + case 0x480D: GotoState(&Klaymen::stJumpToRingVenusFlyTrap); break; - case 0x4816: + case 0x4816: if (param.asInteger() == 0) GotoState(&Klaymen::stPressDoorButton); break; - case 0x4817: + case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); break; - case 0x481B: + case 0x481B: startWalkToAttachedSpriteXDistance(param.asInteger()); break; - case 0x4820: + case 0x4820: sendMessage(_parentScene, 0x2005, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); + GotoState(&Klaymen::stContinueClimbLadderUp); break; - case 0x4821: + case 0x4821: sendMessage(_parentScene, 0x2005, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); + GotoState(&Klaymen::stStartClimbLadderDown); break; - case 0x4822: + case 0x4822: sendMessage(_parentScene, 0x2005, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); + GotoState(&Klaymen::stStartClimbLadderUp); break; case 0x4823: sendMessage(_parentScene, 0x2006, 0); - GotoState(&Klaymen::stClimbLadderHalf); + GotoState(&Klaymen::stClimbLadderHalf); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -3529,7 +3529,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x483F: startSpecialWalkRight(param.asInteger()); break; - case 0x4840: + case 0x4840: startSpecialWalkLeft(param.asInteger()); break; } @@ -3540,8 +3540,8 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1004::KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - - _dataResource.load(0x01900A04); + + _dataResource.load(0x01900A04); } uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3606,7 +3606,7 @@ uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1109::KmScene1109(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + // Empty } @@ -3615,7 +3615,7 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2000: _isSittingInTeleporter = param.asInteger() != 0; - messageResult = 1; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -3653,7 +3653,7 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -3673,7 +3673,7 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1201::KmScene1201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + setKlaymenIdleTable(klaymenIdleTable4, ARRAYSIZE(klaymenIdleTable4)); _doYHitIncr = true; } @@ -3741,7 +3741,7 @@ uint32 KmScene1201::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1303::KmScene1303(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + // Empty } @@ -3762,8 +3762,8 @@ uint32 KmScene1303::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1304::KmScene1304(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - - // Empty + + // Empty } uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3774,7 +3774,7 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4004: GotoState(&Klaymen::stTryStandIdle); - break; + break; case 0x4812: if (param.asInteger() == 2) GotoState(&Klaymen::stPickUpNeedle); @@ -3792,7 +3792,7 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { startWalkToXDistance(param.asPoint().y, param.asPoint().x); else startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; + break; case 0x481F: if (param.asInteger() == 1) GotoState(&Klaymen::stTurnAwayFromUse); @@ -3803,7 +3803,7 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -3814,7 +3814,7 @@ uint32 KmScene1304::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1305::KmScene1305(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3825,10 +3825,10 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4004: GotoState(&Klaymen::stTryStandIdle); - break; + break; case 0x4804: GotoState(&Klaymen::stCrashDown); - break; + break; case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); @@ -3839,7 +3839,7 @@ uint32 KmScene1305::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1306::KmScene1306(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + // Empty } @@ -3879,9 +3879,9 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481A: - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -3936,7 +3936,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -3944,13 +3944,13 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483D: teleporterAppear(0xEE084A04); - break; + break; case 0x483E: teleporterDisappear(0xB86A4274); - break; + break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -3961,7 +3961,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1308::KmScene1308(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -3978,7 +3978,7 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); else GotoState(&Klaymen::stMoveObjectFaceObject); - break; + break; case 0x480D: GotoState(&Klaymen::stUseLever); break; @@ -3993,12 +3993,12 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481A: if (param.asInteger() == 1) - GotoState(&Klaymen::stInsertKey); + GotoState(&Klaymen::stInsertKey); else - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -4020,7 +4020,7 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4032,8 +4032,8 @@ uint32 KmScene1308::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1401::KmScene1401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - - // Empty + + // Empty } uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4044,13 +4044,13 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4004: GotoState(&Klaymen::stTryStandIdle); - break; + break; case 0x480A: if (param.asInteger() == 1) GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); else GotoState(&Klaymen::stMoveObjectFaceObject); - break; + break; case 0x4816: if (param.asInteger() == 1) GotoState(&Klaymen::stPressButton); @@ -4068,7 +4068,7 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { startWalkToXDistance(param.asPoint().y, param.asPoint().x); else startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; + break; case 0x481F: if (param.asInteger() == 1) GotoState(&Klaymen::stTurnAwayFromUse); @@ -4101,8 +4101,8 @@ uint32 KmScene1401::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1402::KmScene1402(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - - SetFilterY(&Sprite::defFilterY); + + SetFilterY(&Sprite::defFilterY); } uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4113,13 +4113,13 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4004: GotoState(&Klaymen::stTryStandIdle); - break; + break; case 0x480A: if (param.asInteger() == 1) GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); else GotoState(&Klaymen::stMoveObjectFaceObject); - break; + break; case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); @@ -4129,7 +4129,7 @@ uint32 KmScene1402::xHandleMessage(int messageNum, const MessageParam ¶m) { startWalkToXDistance(param.asPoint().y, param.asPoint().x); else startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; + break; case 0x481D: GotoState(&Klaymen::stTurnToUse); break; @@ -4162,7 +4162,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); else GotoState(&Klaymen::stMoveObjectFaceObject); - break; + break; case 0x480D: GotoState(&Klaymen::stUseLever); break; @@ -4177,7 +4177,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -4189,7 +4189,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4202,7 +4202,7 @@ uint32 KmScene1403::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1404::KmScene1404(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4219,7 +4219,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stMoveObjectSkipTurnFaceObject); else GotoState(&Klaymen::stMoveObjectFaceObject); - break; + break; case 0x4812: if (param.asInteger() == 2) GotoState(&Klaymen::stPickUpNeedle); @@ -4233,7 +4233,7 @@ uint32 KmScene1404::xHandleMessage(int messageNum, const MessageParam ¶m) { gotoNextStateExt(); break; case 0x481A: - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -4307,7 +4307,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -4345,7 +4345,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2032, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2032, 0); _isSittingInTeleporter = false; @@ -4353,7 +4353,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4366,7 +4366,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1705::KmScene1705(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4388,7 +4388,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4803: GotoState(&Klaymen::stFallSkipJump); - break; + break; case 0x4812: if (param.asInteger() == 2) GotoState(&Klaymen::stPickUpNeedle); @@ -4435,7 +4435,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -4443,10 +4443,10 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483D: teleporterAppear(0x5E0A4905); - break; + break; case 0x483E: teleporterDisappear(0xD86E4477); - break; + break; } return messageResult; } @@ -4454,7 +4454,7 @@ uint32 KmScene1705::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene1901::KmScene1901(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4469,7 +4469,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481D: GotoState(&Klaymen::stTurnToUse); break; @@ -4482,7 +4482,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4493,7 +4493,7 @@ uint32 KmScene1901::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene2001::KmScene2001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - // Empty + // Empty } uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { @@ -4557,7 +4557,7 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene2101::KmScene2101(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + // Empty } @@ -4600,7 +4600,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -4622,7 +4622,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -4635,7 +4635,7 @@ uint32 KmScene2101::xHandleMessage(int messageNum, const MessageParam ¶m) { teleporterDisappear(0x9A28CA1C); break; } - return messageResult; + return messageResult; } KmScene2201::KmScene2201(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) @@ -4684,7 +4684,7 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); gotoNextStateExt(); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -4698,12 +4698,12 @@ uint32 KmScene2201::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; } - return 0; + return 0; } KmScene2203::KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) @@ -4711,7 +4711,7 @@ KmScene2203::KmScene2203(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 // Empty } - + uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x4001: @@ -4740,7 +4740,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; @@ -4748,7 +4748,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { GotoState(&Klaymen::stClayDoorOpen); break; case 0x481A: - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -4768,7 +4768,7 @@ uint32 KmScene2203::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4785,7 +4785,7 @@ KmScene2205::KmScene2205(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 void KmScene2205::xUpdate() { setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); } - + uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x4001: @@ -4809,13 +4809,13 @@ uint32 KmScene2205::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4837,7 +4837,7 @@ KmScene2206::~KmScene2206() { void KmScene2206::xUpdate() { setGlobalVar(V_KLAYMEN_FRAMEINDEX, _currFrameIndex); } - + uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x4001: @@ -4874,7 +4874,7 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -4897,7 +4897,7 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); gotoNextStateExt(); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -4914,7 +4914,7 @@ uint32 KmScene2206::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -4927,7 +4927,7 @@ KmScene2207::KmScene2207(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 // Empty } - + uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2001: @@ -4961,7 +4961,7 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -4977,7 +4977,7 @@ uint32 KmScene2207::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -5022,7 +5022,7 @@ uint32 KmScene2242::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -5080,7 +5080,7 @@ uint32 KmHallOfRecords::xHandleMessage(int messageNum, const MessageParam ¶m case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481F: if (param.asInteger() == 0) GotoState(&Klaymen::stWonderAboutHalf); @@ -5133,7 +5133,7 @@ uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481F: if (param.asInteger() == 0) GotoState(&Klaymen::stWonderAboutHalf); @@ -5156,13 +5156,13 @@ uint32 KmScene2247::xHandleMessage(int messageNum, const MessageParam ¶m) { } return 0; } - + KmScene2401::KmScene2401(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { // Empty } - + uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { @@ -5184,7 +5184,7 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); @@ -5203,7 +5203,7 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); gotoNextStateExt(); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -5228,7 +5228,7 @@ uint32 KmScene2401::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x483F: startSpecialWalkRight(param.asInteger()); - break; + break; case 0x4840: startSpecialWalkLeft(param.asInteger()); break; @@ -5357,23 +5357,23 @@ uint32 KmScene2403::xHandleMessage(int messageNum, const MessageParam ¶m) { else GotoState(&Klaymen::stWonderAbout); break; - case 0x4820: + case 0x4820: sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); + GotoState(&Klaymen::stContinueClimbLadderUp); break; - case 0x4821: + case 0x4821: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); + GotoState(&Klaymen::stStartClimbLadderDown); break; - case 0x4822: + case 0x4822: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); + GotoState(&Klaymen::stStartClimbLadderUp); break; case 0x4823: sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); + GotoState(&Klaymen::stClimbLadderHalf); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); @@ -5382,16 +5382,16 @@ uint32 KmScene2403::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x483F: startSpecialWalkRight(param.asInteger()); break; - case 0x4840: + case 0x4840: startSpecialWalkLeft(param.asInteger()); break; } return messageResult; } - + KmScene2406::KmScene2406(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) : Klaymen(vm, parentScene, x, y) { - + _surface->setClipRects(clipRects, clipRectsCount); } @@ -5425,7 +5425,7 @@ uint32 KmScene2406::xHandleMessage(int messageNum, const MessageParam ¶m) { gotoNextStateExt(); break; case 0x481A: - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -5451,40 +5451,40 @@ uint32 KmScene2406::xHandleMessage(int messageNum, const MessageParam ¶m) { else GotoState(&Klaymen::stWonderAbout); break; - case 0x4820: + case 0x4820: sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); + GotoState(&Klaymen::stContinueClimbLadderUp); break; - case 0x4821: + case 0x4821: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); + GotoState(&Klaymen::stStartClimbLadderDown); break; - case 0x4822: + case 0x4822: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); + GotoState(&Klaymen::stStartClimbLadderUp); break; case 0x4823: sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); + GotoState(&Klaymen::stClimbLadderHalf); break; case 0x483F: startSpecialWalkRight(param.asInteger()); break; - case 0x4840: + case 0x4840: startSpecialWalkLeft(param.asInteger()); break; } return messageResult; } - + KmScene2501::KmScene2501(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { // Empty } - + uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam ¶m) { uint32 messageResult = 0; switch (messageNum) { @@ -5505,7 +5505,7 @@ uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481D: if (_isSittingInTeleporter) GotoState(&Klaymen::stTurnToUseInTeleporter); @@ -5521,7 +5521,7 @@ uint32 KmScene2501::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -5536,7 +5536,7 @@ KmScene2732::KmScene2732(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 // Empty } - + uint32 KmScene2732::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x4804: @@ -5570,13 +5570,13 @@ uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481B: if (param.asPoint().y != 0) startWalkToXDistance(param.asPoint().y, param.asPoint().x); else startWalkToAttachedSpriteXDistance(param.asPoint().x); - break; + break; case 0x481D: GotoState(&Klaymen::stTurnToUse); break; @@ -5599,7 +5599,7 @@ uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) { setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); gotoNextStateExt(); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -5620,7 +5620,7 @@ uint32 KmScene2801::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene2803::KmScene2803(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, NRect *clipRects, int clipRectsCount) : Klaymen(vm, parentScene, x, y) { - + _surface->setClipRects(clipRects, clipRectsCount); _dataResource.load(0x00900849); } @@ -5648,7 +5648,7 @@ uint32 KmScene2803::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; @@ -5664,7 +5664,7 @@ uint32 KmScene2803::xHandleMessage(int messageNum, const MessageParam ¶m) { else GotoState(&Klaymen::stWonderAboutHalf); break; - case 0x482E: + case 0x482E: GotoState(&Klaymen::stWalkToFront); break; case 0x482F: @@ -5682,7 +5682,7 @@ uint32 KmScene2803::xHandleMessage(int messageNum, const MessageParam ¶m) { KmScene2803Small::KmScene2803Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { - + _dataResource.load(0x81120132); } @@ -5759,7 +5759,7 @@ uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x481D: if (_isSittingInTeleporter) GotoState(&Klaymen::stTurnToUseInTeleporter); @@ -5775,7 +5775,7 @@ uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { sendMessage(_parentScene, 0x2000, 1); _isSittingInTeleporter = true; GotoState(&Klaymen::stSitInTeleporter); - break; + break; case 0x4836: sendMessage(_parentScene, 0x2000, 0); _isSittingInTeleporter = false; @@ -5805,7 +5805,7 @@ KmScene2806::KmScene2806(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 loadSound(6, 0x166FC6E0); loadSound(7, 0x00018040); } - + _dataResource.load(0x98182003); _surface->setClipRects(clipRects, clipRectsCount); } @@ -5827,12 +5827,12 @@ uint32 KmScene2806::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4816: if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); + GotoState(&Klaymen::stPressButtonSide); break; case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; @@ -5885,12 +5885,12 @@ uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) { break; case 0x4816: if (param.asInteger() == 0) - GotoState(&Klaymen::stPressButtonSide); + GotoState(&Klaymen::stPressButtonSide); break; case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; @@ -5907,7 +5907,7 @@ uint32 KmScene2809::xHandleMessage(int messageNum, const MessageParam ¶m) { return 0; } -KmScene2810Small::KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) +KmScene2810Small::KmScene2810Small(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : Klaymen(vm, parentScene, x, y) { // Empty @@ -5925,7 +5925,7 @@ uint32 KmScene2810Small::xHandleMessage(int messageNum, const MessageParam ¶ case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToXSmall(_dataResource.getPoint(param.asInteger()).x); break; @@ -5937,7 +5937,7 @@ uint32 KmScene2810Small::xHandleMessage(int messageNum, const MessageParam ¶ else GotoState(&Klaymen::stWonderAboutSmall); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStepSmall); else @@ -5961,7 +5961,7 @@ KmScene2810::KmScene2810(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 _surface->setClipRects(clipRects, clipRectsCount); } - + uint32 KmScene2810::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x4001: @@ -5985,7 +5985,7 @@ uint32 KmScene2810::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x4817: setDoDeltaX(param.asInteger()); gotoNextStateExt(); - break; + break; case 0x4818: startWalkToX(_dataResource.getPoint(param.asInteger()).x, false); break; @@ -6009,23 +6009,23 @@ uint32 KmScene2810::xHandleMessage(int messageNum, const MessageParam ¶m) { else GotoState(&Klaymen::stWonderAbout); break; - case 0x4820: + case 0x4820: sendMessage(_parentScene, 0x2000, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); + GotoState(&Klaymen::stContinueClimbLadderUp); break; - case 0x4821: + case 0x4821: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); + GotoState(&Klaymen::stStartClimbLadderDown); break; - case 0x4822: + case 0x4822: sendMessage(_parentScene, 0x2000, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); + GotoState(&Klaymen::stStartClimbLadderUp); break; case 0x4823: sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stClimbLadderHalf); + GotoState(&Klaymen::stClimbLadderHalf); break; case 0x4824: sendMessage(_parentScene, 0x2000, 0); @@ -6080,7 +6080,7 @@ uint32 KmScene2812::xHandleMessage(int messageNum, const MessageParam ¶m) { gotoNextStateExt(); break; case 0x481A: - GotoState(&Klaymen::stInsertDisk); + GotoState(&Klaymen::stInsertDisk); break; case 0x481B: if (param.asPoint().y != 0) @@ -6094,29 +6094,29 @@ uint32 KmScene2812::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x481E: GotoState(&Klaymen::stReturnFromUse); break; - case 0x4820: + case 0x4820: sendMessage(_parentScene, 0x2001, 0); - GotoState(&Klaymen::stContinueClimbLadderUp); + GotoState(&Klaymen::stContinueClimbLadderUp); break; - case 0x4821: + case 0x4821: sendMessage(_parentScene, 0x2001, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderDown); + GotoState(&Klaymen::stStartClimbLadderDown); break; - case 0x4822: + case 0x4822: sendMessage(_parentScene, 0x2001, 0); _destY = param.asInteger(); - GotoState(&Klaymen::stStartClimbLadderUp); + GotoState(&Klaymen::stStartClimbLadderUp); break; case 0x4823: sendMessage(_parentScene, 0x2002, 0); - GotoState(&Klaymen::stClimbLadderHalf); + GotoState(&Klaymen::stClimbLadderHalf); break; case 0x482D: setDoDeltaX(_x > (int16)param.asInteger() ? 1 : 0); gotoNextStateExt(); break; - case 0x482E: + case 0x482E: if (param.asInteger() == 1) GotoState(&Klaymen::stWalkToFrontNoStep); else @@ -6131,7 +6131,7 @@ uint32 KmScene2812::xHandleMessage(int messageNum, const MessageParam ¶m) { case 0x483F: startSpecialWalkRight(param.asInteger()); break; - case 0x4840: + case 0x4840: startSpecialWalkLeft(param.asInteger()); break; } diff --git a/engines/neverhood/klaymen.h b/engines/neverhood/klaymen.h index 25443b5a35..9e461a9c9c 100644 --- a/engines/neverhood/klaymen.h +++ b/engines/neverhood/klaymen.h @@ -77,24 +77,24 @@ public: void stIdleArms(); void evIdleArmsDone(); uint32 hmIdleArms(int messageNum, const MessageParam ¶m, Entity *sender); - + void stIdleChest(); uint32 hmIdleChest(int messageNum, const MessageParam ¶m, Entity *sender); - + void stIdleHeadOff(); uint32 hmIdleHeadOff(int messageNum, const MessageParam ¶m, Entity *sender); void stIdleWonderAbout(); void stIdleTeleporterHands(); - + void stIdleTeleporterHands2(); void stTryStandIdle(); void stStandAround(); void upStandIdle(); void stIdleBlink(); - + bool stStartAction(AnimationCb callback3); bool stStartActionFromIdle(AnimationCb callback); uint32 hmStartAction(int messageNum, const MessageParam ¶m, Entity *sender); @@ -134,7 +134,7 @@ public: void stPickUpTube(); uint32 hmPickUpTube(int messageNum, const MessageParam ¶m, Entity *sender); - + void stTurnToUse(); void stTurnToUseHalf(); void stTurnAwayFromUse(); @@ -263,10 +263,10 @@ public: void stJumpToGrabFall(); uint32 hmJumpToGrab(int messageNum, const MessageParam ¶m, Entity *sender); void suJumpToGrab(); - + void stJumpToGrabRelease(); uint32 hmJumpToGrabRelease(int messageNum, const MessageParam ¶m, Entity *sender); - + void stSitInTeleporter(); uint32 hmSitInTeleporter(int messageNum, const MessageParam ¶m, Entity *sender); @@ -326,7 +326,7 @@ public: void stFinishGrow(); uint32 hmFinishGrow(int messageNum, const MessageParam ¶m, Entity *sender); - + void stJumpToRingVenusFlyTrap(); uint32 hmJumpToRingVenusFlyTrap(int messageNum, const MessageParam ¶m, Entity *sender); @@ -363,7 +363,7 @@ public: //////////////////////////////////////////////////////////////////////////// void stopWalking(); - + void suAction(); void suUpdateDestX(); void suWalkingTestExit(); @@ -375,7 +375,7 @@ public: void setKlaymenIdleTable1(); void setKlaymenIdleTable2(); void setKlaymenIdleTable3(); - + void setSoundFlag(bool value) { _soundFlag = value; } void spitIntoPipe(); @@ -416,7 +416,7 @@ protected: NPointArray *_pathPoints; bool _soundFlag; - + int16 _spitOutCountdown; bool _isSittingInTeleporter; @@ -456,16 +456,16 @@ protected: void stStartWalkingSmall(); uint32 hmWalkingSmall(int messageNum, const MessageParam ¶m, Entity *sender); - + void enterIdleAnimation(uint idleAnimation); void walkAlongPathPoints(); - + }; class KmScene1001 : public Klaymen { public: KmScene1001(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); -protected: +protected: uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; @@ -473,7 +473,7 @@ class KmScene1002 : public Klaymen { public: KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y); protected: - void xUpdate(); + void xUpdate(); uint32 xHandleMessage(int messageNum, const MessageParam ¶m); }; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index da7abd41e1..d59afa4ba5 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -73,9 +73,9 @@ static const uint32 kMakingOfSmackerFileHashList[] = { MenuModule::MenuModule(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _savegameList(NULL) { - + SetMessageHandler(&MenuModule::handleMessage); - + _savedPaletteData = _vm->_screen->getPaletteData(); _vm->_mixer->pauseAll(true); _vm->toggleSoundUpdate(false); @@ -266,7 +266,7 @@ void MenuModule::loadSavegameList() { Neverhood::NeverhoodEngine::SaveHeader header; Common::String pattern = _vm->getTargetName(); pattern += ".???"; - + Common::StringArray filenames; filenames = saveFileMan->listSavefiles(pattern.c_str()); Common::sort(filenames.begin(), filenames.end()); @@ -324,7 +324,7 @@ uint32 MenuButton::handleMessage(int messageNum, const MessageParam ¶m, Enti MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule) { - + static const uint32 kMenuButtonFileHashes[] = { 0x36C62120, 0x56C62120, @@ -336,7 +336,7 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) 0x16C62130, 0x16C62100 }; - + static const NRect kMenuButtonCollisionBounds[] = { NRect(52, 121, 110, 156), NRect(52, 192, 109, 222), @@ -348,14 +348,14 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) NRect(527, 384, 580, 412), NRect(522, 255, 580, 289) }; - + setBackground(0x08C0020C); setPalette(0x08C0020C); insertScreenMouse(0x00208084); - + insertStaticSprite(0x41137051, 100); insertStaticSprite(0xC10B2015, 100); - + // TODO Only if music is enabled _musicOnButton = insertStaticSprite(0x0C24C0EE, 100); @@ -364,9 +364,9 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) kMenuButtonFileHashes[buttonIndex], kMenuButtonCollisionBounds[buttonIndex]); addCollisionSprite(menuButton); } - - SetUpdateHandler(&Scene::update); - SetMessageHandler(&MainMenu::handleMessage); + + SetUpdateHandler(&Scene::update); + SetMessageHandler(&MainMenu::handleMessage); } @@ -396,18 +396,18 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb : Scene(vm, parentModule), _canAbort(canAbort), _screenIndex(0), _ticksDuration(0), _countdown(216) { - SetUpdateHandler(&CreditsScene::update); + SetUpdateHandler(&CreditsScene::update); SetMessageHandler(&CreditsScene::handleMessage); - + setBackground(0x6081128C); setPalette(0x6081128C); _ticksTime = _vm->_system->getMillis() + 202100; - + _musicResource = new MusicResource(_vm); _musicResource->load(0x30812225); _musicResource->play(0); - + } CreditsScene::~CreditsScene() { @@ -469,7 +469,7 @@ Widget::Widget(NeverhoodEngine *vm, int16 x, int16 y, GameStateMenu *parentScene SetUpdateHandler(&Widget::update); SetMessageHandler(&Widget::handleMessage); - + setPosition(x, y); } @@ -532,7 +532,7 @@ TextLabelWidget::TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, GameStat const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface) : Widget(vm, x, y, parentScene, baseObjectPriority, baseSurfacePriority), _string(string), _stringLen(stringLen), _drawSurface(drawSurface), _tx(tx), _ty(ty), _fontSurface(fontSurface) { - + } void TextLabelWidget::initialize() { @@ -573,7 +573,7 @@ TextEditWidget::TextEditWidget(NeverhoodEngine *vm, int16 x, int16 y, GameStateM _maxVisibleChars = (_rect.x2 - _rect.x1) / _fontSurface->getCharWidth(); _cursorPos = 0; - + SetUpdateHandler(&TextEditWidget::update); SetMessageHandler(&TextEditWidget::handleMessage); } @@ -804,7 +804,7 @@ void SavegameListBox::buildItems() { void SavegameListBox::drawItems() { for (int i = 0; i < (int)_textLabelItems.size(); ++i) { - TextLabelWidget *label = _textLabelItems[i]; + TextLabelWidget *label = _textLabelItems[i]; if (i >= _firstVisibleItem && i <= _lastVisibleItem) { label->setY(_rect.y1 + (i - _firstVisibleItem) * _fontSurface->getCharHeight()); label->updateBounds(); @@ -886,12 +886,12 @@ int GameStateMenu::scummVMSaveLoadDialog(bool isSave, Common::String &saveDesc) GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList, const uint32 *buttonFileHashes, const NRect *buttonCollisionBounds, uint32 backgroundFileHash, uint32 fontFileHash, - uint32 mouseFileHash, const NRect *mouseRect, + uint32 mouseFileHash, const NRect *mouseRect, uint32 listBoxBackgroundFileHash, int16 listBoxX, int16 listBoxY, const NRect &listBoxRect, uint32 textEditBackgroundFileHash, uint32 textEditCursorFileHash, int16 textEditX, int16 textEditY, const NRect &textEditRect, - uint32 textFileHash1, uint32 textFileHash2) + uint32 textFileHash1, uint32 textFileHash2) : Scene(vm, parentModule), _currWidget(NULL), _savegameList(savegameList) { - + bool isSave = (textEditCursorFileHash != 0); _fontSurface = new FontSurface(_vm, fontFileHash, 32, 7, 32, 11, 17); @@ -933,7 +933,7 @@ GameStateMenu::GameStateMenu(NeverhoodEngine *vm, Module *parentModule, Savegame _textEditWidget->setReadOnly(true); _textEditWidget->initialize(); setCurrWidget(_textEditWidget); - + for (uint buttonIndex = 0; buttonIndex < 6; ++buttonIndex) { Sprite *menuButton = insertSprite(this, buttonIndex, buttonFileHashes[buttonIndex], buttonCollisionBounds[buttonIndex]); @@ -1107,7 +1107,7 @@ static const NRect kDeleteGameMenuTextEditRect(0, 0, 320, 17); DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kDeleteGameMenuButtonFileHashes, kDeleteGameMenuButtonCollisionBounds, 0x4080E01C, 0x728523ED, - 0x0E018400, NULL, + 0x0E018400, NULL, 0xA5584211, 61, 64, kDeleteGameMenuListBoxRect, 0x250A3060, 0, 49, 414, kDeleteGameMenuTextEditRect, 0x80083C01, 0x84181E81) { @@ -1131,7 +1131,7 @@ QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule NRect(145, 334, 260, 385), NRect(365, 340, 477, 388) }; - + setBackground(0x043692C4); setPalette(0x043692C4); insertScreenMouse(0x692C004B); @@ -1154,7 +1154,7 @@ QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule fontSurface->drawString(_background->getSurface(), 106 + (423 - textLines[i].size() * 11) / 2, 127 + 31 + i * 17, (const byte*)textLines[i].c_str()); delete fontSurface; - + SetUpdateHandler(&Scene::update); SetMessageHandler(&QueryOverwriteMenu::handleMessage); } diff --git a/engines/neverhood/menumodule.h b/engines/neverhood/menumodule.h index 6ee990de67..f201654ceb 100644 --- a/engines/neverhood/menumodule.h +++ b/engines/neverhood/menumodule.h @@ -124,8 +124,8 @@ protected: class TextLabelWidget : public Widget { public: TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, GameStateMenu *parentScene, - int baseObjectPriority, int baseSurfacePriority, - const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface); + int baseObjectPriority, int baseSurfacePriority, + const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface); virtual void initialize(); virtual int16 getWidth(); virtual int16 getHeight(); @@ -206,13 +206,13 @@ protected: uint _currIndex; int _maxVisibleItemsCount; }; - + class GameStateMenu : public Scene { public: GameStateMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList, const uint32 *buttonFileHashes, const NRect *buttonCollisionBounds, uint32 backgroundFileHash, uint32 fontFileHash, - uint32 mouseFileHash, const NRect *mouseRect, + uint32 mouseFileHash, const NRect *mouseRect, uint32 listBoxBackgroundFileHash, int16 listBoxX, int16 listBoxY, const NRect &listBoxRect, uint32 textEditBackgroundFileHash, uint32 textEditCursorFileHash, int16 textEditX, int16 textEditY, const NRect &textEditRect, uint32 textFileHash1, uint32 textFileHash2); diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp index e384b5a4d2..d1578e680c 100644 --- a/engines/neverhood/module.cpp +++ b/engines/neverhood/module.cpp @@ -31,9 +31,9 @@ namespace Neverhood { Module::Module(NeverhoodEngine *vm, Module *parentModule) : Entity(vm, 0), _parentModule(parentModule), _childObject(NULL), _done(false), _sceneType(kSceneTypeNormal) { - + SetMessageHandler(&Module::handleMessage); - + } Module::~Module() { diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index a28d934cf6..f65b89899d 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -26,8 +26,8 @@ namespace Neverhood { Module1000::Module1000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - - _musicFileHash = getGlobalVar(V_ENTRANCE_OPEN) ? 0x81106480 : 0x00103144; + + _musicFileHash = getGlobalVar(V_ENTRANCE_OPEN) ? 0x81106480 : 0x00103144; _vm->_soundMan->addMusic(0x03294419, 0x061880C6); _vm->_soundMan->addMusic(0x03294419, _musicFileHash); @@ -118,11 +118,11 @@ void Module1000::updateScene() { } } -// Scene1001 +// Scene1001 AsScene1001Door::AsScene1001Door(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { - + createSurface(800, 137, 242); _x = 726; _y = 440; @@ -151,16 +151,16 @@ void AsScene1001Door::hammerHitsDoor() { case 1: playSound(0, 0x65482F03); startAnimation(0x624C0498, 1, 3); - NextState(&AsScene1001Door::stShowIdleDoor); + NextState(&AsScene1001Door::stShowIdleDoor); break; case 2: playSound(1); startAnimation(0x624C0498, 6, 6); - NextState(&AsScene1001Door::stBustedDoorMove); + NextState(&AsScene1001Door::stBustedDoorMove); break; default: // Nothing - break; + break; } incGlobalVar(V_DOOR_STATUS, 1); } @@ -196,9 +196,9 @@ void AsScene1001Door::stBustedDoorMove() { void AsScene1001Door::stBustedDoorGone() { playSound(0); stopAnimation(); - setVisible(false); + setVisible(false); } - + AsScene1001Hammer::AsScene1001Hammer(NeverhoodEngine *vm, Sprite *asDoor) : AnimatedSprite(vm, 1100), _asDoor(asDoor) { @@ -262,7 +262,7 @@ uint32 AsScene1001Window::handleMessage(int messageNum, const MessageParam ¶ AsScene1001Lever::AsScene1001Lever(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, int deltaXType) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + createSurface(1010, 71, 73); setDoDeltaX(deltaXType); startAnimation(0x04A98C36, 0, -1); @@ -302,22 +302,22 @@ uint32 AsScene1001Lever::handleMessage(int messageNum, const MessageParam ¶m } return messageResult; } - + SsCommonButtonSprite::SsCommonButtonSprite(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash, int surfacePriority, uint32 soundFileHash) : StaticSprite(vm, fileHash, surfacePriority), _parentScene(parentScene), _countdown(0) { _priority = 1100; - _soundFileHash = soundFileHash ? soundFileHash : 0x44141000; + _soundFileHash = soundFileHash ? soundFileHash : 0x44141000; setVisible(false); SetUpdateHandler(&SsCommonButtonSprite::update); SetMessageHandler(&SsCommonButtonSprite::handleMessage); } - + void SsCommonButtonSprite::update() { if (_countdown != 0 && (--_countdown) == 0) setVisible(false); } - + uint32 SsCommonButtonSprite::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -330,19 +330,19 @@ uint32 SsCommonButtonSprite::handleMessage(int messageNum, const MessageParam &p } return messageResult; } - + Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asDoor(NULL), _asWindow(NULL) { Sprite *tempSprite; SetMessageHandler(&Scene1001::handleMessage); - + setHitRects(0x004B4860); setBackground(0x4086520E); setPalette(0x4086520E); insertScreenMouse(0x6520A400); - + if (which < 0) { // Restoring game setRectList(0x004B49F0); @@ -373,7 +373,7 @@ Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x2080A3A8, 1300); _klaymen->setClipRect(0, 0, tempSprite->getDrawRect().x2(), 480); - + if (!getGlobalVar(V_DOOR_BUSTED)) { _asDoor = insertSprite(); _asDoor->setClipRect(0, 0, tempSprite->getDrawRect().x2(), 480); @@ -445,7 +445,7 @@ AsScene1002Ring::AsScene1002Ring(NeverhoodEngine *vm, Scene *parentScene, bool i : AnimatedSprite(vm, 1100), _parentScene(parentScene), _isSpecial(isSpecial) { SetUpdateHandler(&AsScene1002Ring::update); - + if (_isSpecial) { createSurface(990, 68, 314); if (isRingLow) { @@ -581,7 +581,7 @@ uint32 AsScene1002Ring::hmRingReleased(int messageNum, const MessageParam ¶m AsScene1002Door::AsScene1002Door(NeverhoodEngine *vm, NRect &clipRect) : StaticSprite(vm, 1200) { - + loadSprite(0x1052370F, kSLFDefDrawOffset | kSLFSetPosition, 800, 526, getGlobalVar(V_FLYTRAP_RING_DOOR) ? 49 : 239); setClipRect(clipRect); SetUpdateHandler(&AsScene1002Door::update); @@ -637,7 +637,7 @@ AsScene1002BoxingGloveHitEffect::AsScene1002BoxingGloveHitEffect(NeverhoodEngine createSurface(1025, 88, 165); setVisible(false); SetUpdateHandler(&AnimatedSprite::update); - SetMessageHandler(&AsScene1002BoxingGloveHitEffect::handleMessage); + SetMessageHandler(&AsScene1002BoxingGloveHitEffect::handleMessage); } uint32 AsScene1002BoxingGloveHitEffect::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -716,7 +716,7 @@ void AsScene1002DoorSpy::stDoorSpyBoxingGlove() { NextState(&AsScene1002DoorSpy::stDoorSpyIdle); } -SsCommonPressButton::SsCommonPressButton(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int surfacePriority, uint32 soundFileHash) +SsCommonPressButton::SsCommonPressButton(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash1, uint32 fileHash2, int surfacePriority, uint32 soundFileHash) : StaticSprite(vm, 1100), _parentScene(parentScene), _status(0), _countdown(0) { _soundFileHash = soundFileHash != 0 ? soundFileHash : 0x44141000; @@ -788,7 +788,7 @@ AsScene1002VenusFlyTrap::AsScene1002VenusFlyTrap(NeverhoodEngine *vm, Scene *par stRingGrabbed(); } else { stIdle(); - } + } } _flags = 4; SetUpdateHandler(&AsScene1002VenusFlyTrap::update); @@ -850,12 +850,12 @@ uint32 AsScene1002VenusFlyTrap::handleMessage(int messageNum, const MessageParam if (_isSecond) { if (_x >= 154 && _x <= 346) messageResult = 1; - else + else messageResult = 0; } else { if (_x >= 174 && _x <= 430) messageResult = 1; - else + else messageResult = 0; } break; @@ -1023,7 +1023,7 @@ AsScene1002OutsideDoorBackground::AsScene1002OutsideDoorBackground(NeverhoodEngi } else setVisible(false); SetUpdateHandler(&AsScene1002OutsideDoorBackground::update); - SetMessageHandler(&AsScene1002OutsideDoorBackground::handleMessage); + SetMessageHandler(&AsScene1002OutsideDoorBackground::handleMessage); } void AsScene1002OutsideDoorBackground::update() { @@ -1083,7 +1083,7 @@ void AsScene1002OutsideDoorBackground::stDoorClosed() { AsScene1002KlaymenLadderHands::AsScene1002KlaymenLadderHands(NeverhoodEngine *vm, Klaymen *klaymen) : AnimatedSprite(vm, 1200), _klaymen(klaymen) { - + createSurface(1200, 40, 163); setVisible(false); SetUpdateHandler(&AsScene1002KlaymenLadderHands::update); @@ -1095,15 +1095,15 @@ void AsScene1002KlaymenLadderHands::update() { startAnimation(0xBA280522, _klaymen->getFrameIndex(), -1); _newStickFrameIndex = _klaymen->getFrameIndex(); setVisible(true); - _x = _klaymen->getX(); - _y = _klaymen->getY(); + _x = _klaymen->getX(); + _y = _klaymen->getY(); setDoDeltaX(_klaymen->isDoDeltaX() ? 1 : 0); } else if (_klaymen->getCurrAnimFileHash() == 0x122D1505) { startAnimation(0x1319150C, _klaymen->getFrameIndex(), -1); _newStickFrameIndex = _klaymen->getFrameIndex(); setVisible(true); - _x = _klaymen->getX(); - _y = _klaymen->getY(); + _x = _klaymen->getX(); + _y = _klaymen->getY(); setDoDeltaX(_klaymen->isDoDeltaX() ? 1 : 0); } else setVisible(false); @@ -1113,7 +1113,7 @@ void AsScene1002KlaymenLadderHands::update() { AsScene1002KlaymenPeekHand::AsScene1002KlaymenPeekHand(NeverhoodEngine *vm, Scene *parentScene, Klaymen *klaymen) : AnimatedSprite(vm, 1200), _parentScene(parentScene), _klaymen(klaymen), _isClipRectSaved(false) { - + createSurface(1000, 33, 41); setVisible(false); SetUpdateHandler(&AsScene1002KlaymenPeekHand::update); @@ -1245,7 +1245,7 @@ Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which) sendEntityMessage(_klaymen, 0x2007, _asVenusFlyTrap); _asOutsideDoorBackground = insertSprite(); - + setRectList(0x004B43A0); loadSound(1, 0x60755842); @@ -1322,11 +1322,11 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x2002: _messageList = NULL; - break; + break; case 0x2005: _isClimbingLadder = true; setRectList(0x004B4418); - break; + break; case 0x2006: _isClimbingLadder = false; setRectList(0x004B43A0); @@ -1360,11 +1360,11 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit if (getGlobalVar(V_FLYTRAP_RING_DOOR)) { sendMessage(_asRing3, 0x4807, 0); } - } + } break; case 0x480B: sendEntityMessage(_klaymen, 0x1014, _asDoorSpy); - break; + break; case 0x480F: setGlobalVar(V_RADIO_ENABLED, 0); playSound(1); @@ -1379,7 +1379,7 @@ uint32 Scene1002::handleMessage(int messageNum, const MessageParam ¶m, Entit setSpriteSurfacePriority(_ssCeiling, 1015); setSpriteSurfacePriority(_ssLadderArch, 1015); break; - } + } return messageResult; } @@ -1389,7 +1389,7 @@ StaticScene::StaticScene(NeverhoodEngine *vm, Module *parentModule, uint32 backg : Scene(vm, parentModule) { SetMessageHandler(&StaticScene::handleMessage); - + setBackground(backgroundFileHash); setPalette(backgroundFileHash); insertPuzzleMouse(cursorFileHash, 20, 620); @@ -1442,7 +1442,7 @@ Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _paletteAreaStatus(-1) { Sprite *tempSprite; - + SetUpdateHandler(&Scene1004::update); SetMessageHandler(&Scene1004::handleMessage); @@ -1475,16 +1475,16 @@ Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) insertKlaymen(_dataResource.getPoint(0x80052A29).x, 27); setMessageList(0x004B7BF0); } - + updatePaletteArea(); - + _asKlaymenLadderHands = insertSprite(_klaymen); insertStaticSprite(0x800034A0, 1100); insertStaticSprite(0x64402020, 1100); insertStaticSprite(0x3060222E, 1300); tempSprite = insertStaticSprite(0x0E002004, 1300); - + _klaymen->setClipRect(0, tempSprite->getDrawRect().y, 640, 480); _asKlaymenLadderHands->setClipRect(_klaymen->getClipRect()); @@ -1518,7 +1518,7 @@ uint32 Scene1004::handleMessage(int messageNum, const MessageParam ¶m, Entit break; } return messageResult; -} +} void Scene1004::updatePaletteArea() { if (_klaymen->getY() < 150) { @@ -1557,7 +1557,7 @@ Scene1005::Scene1005(NeverhoodEngine *vm, Module *parentModule, int which) } drawTextToBackground(); - + } uint32 Scene1005::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1565,7 +1565,7 @@ uint32 Scene1005::handleMessage(int messageNum, const MessageParam ¶m, Entit switch (messageNum) { case 0x0001: if (param.asPoint().x <= 20 || param.asPoint().x >= 620) - leaveScene(0); + leaveScene(0); break; } return 0; @@ -1614,19 +1614,19 @@ uint32 Scene1005::getTextIndex1() { textIndex = 23; else if (!getSubVar(VA_HAS_KEY, 0) && !getSubVar(VA_IS_KEY_INSERTED, 0)) textIndex = 24; - else if (!getGlobalVar(V_HAS_FINAL_KEY)) + else if (!getGlobalVar(V_HAS_FINAL_KEY)) textIndex = 26; else if (!getSubVar(VA_HAS_KEY, 1) && !getSubVar(VA_IS_KEY_INSERTED, 1)) textIndex = 27; - else if (!getGlobalVar(V_HAS_FINAL_KEY)) + else if (!getGlobalVar(V_HAS_FINAL_KEY)) textIndex = 28; - else + else textIndex = 29; } else if (!getGlobalVar(V_FELL_DOWN_HOLE)) textIndex = 20; else if (!getGlobalVar(V_SEEN_SYMBOLS_NO_LIGHT)) textIndex = 21; - else + else textIndex = 22; } else if (getGlobalVar(V_BOLT_DOOR_UNLOCKED)) { if (!getGlobalVar(V_WALL_BROKEN)) @@ -1641,7 +1641,7 @@ uint32 Scene1005::getTextIndex1() { textIndex = 15; else if (!getGlobalVar(V_BEEN_STATUE_ROOM)) textIndex = 16; - else + else textIndex = 17; } else if (!getGlobalVar(V_FLYTRAP_RING_EATEN)) { textIndex = 0; @@ -1660,7 +1660,7 @@ uint32 Scene1005::getTextIndex1() { textIndex = 9; else if (!getSubVar(VA_LOCKS_DISABLED, 0x01180951)) textIndex = 10; - else + else textIndex = 11; } else if (!getGlobalVar(V_CREATURE_ANGRY)) { textIndex = 1; diff --git a/engines/neverhood/modules/module1000.h b/engines/neverhood/modules/module1000.h index 9977590a6a..8461ecfc6f 100644 --- a/engines/neverhood/modules/module1000.h +++ b/engines/neverhood/modules/module1000.h @@ -85,7 +85,7 @@ protected: Scene *_parentScene; uint32 _soundFileHash; int16 _countdown; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index dbd8c60210..03810915dd 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -40,7 +40,7 @@ static const uint32 kModule1100SoundList[] = { Module1100::Module1100(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + if (which < 0) { createScene(_vm->gameState().sceneNum, -1); } else if (which == 1) { @@ -271,7 +271,7 @@ static const uint32 kSsScene1105SymbolDieFileHashes[] = { SsScene1105Button::SsScene1105Button(NeverhoodEngine *vm, Scene *parentScene, uint32 fileHash, NRect &collisionBounds) : StaticSprite(vm, fileHash, 200), _parentScene(parentScene), _countdown(0) { - + _collisionBounds = collisionBounds; SetMessageHandler(&SsScene1105Button::handleMessage); SetUpdateHandler(&SsScene1105Button::update); @@ -347,7 +347,7 @@ void SsScene1105SymbolDie::hide() { AsScene1105TeddyBear::AsScene1105TeddyBear(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + createSurface(100, 556, 328); _x = 320; _y = 240; @@ -396,7 +396,7 @@ void AsScene1105TeddyBear::hide() { SsScene1105OpenButton::SsScene1105OpenButton(NeverhoodEngine *vm, Scene *parentScene) : StaticSprite(vm, 900), _parentScene(parentScene), _countdown(0), _isClicked(false) { - + loadSprite(0x8228A46C, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44045140); @@ -432,26 +432,26 @@ uint32 SsScene1105OpenButton::handleMessage(int messageNum, const MessageParam & Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule), _countdown(0), _isPanelOpen(false), _isActionButtonClicked(false), _doMoveTeddy(false), _isClosePanelDone(false), _leaveResult(0), _backgroundIndex(0) { - + Sprite *ssOpenButton; - + _vm->gameModule()->initMemoryPuzzle(); - + SetUpdateHandler(&Scene1105::update); SetMessageHandler(&Scene1105::handleMessage); - + setBackground(0x20010002); setPalette(0x20010002); - + _asTeddyBear = insertSprite(this); ssOpenButton = insertSprite(this); addCollisionSprite(ssOpenButton); insertPuzzleMouse(0x10006208, 20, 620); - + loadSound(0, 0x48442057); loadSound(1, 0xC025014F); loadSound(2, 0x68E25540); - + } uint32 Scene1105::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -569,13 +569,13 @@ void Scene1105::createObjects() { addCollisionSprite(_ssSymbol3DownButton); _ssActionButton = insertSprite(this, 0x8248AD35, NRect(280, 170, 354, 245)); addCollisionSprite(_ssActionButton); - + _isPanelOpen = true; - + _asTeddyBear->show(); insertPuzzleMouse(0x18666208, 20, 620); - + } void Scene1105::upOpenPanel() { @@ -639,13 +639,13 @@ void Scene1105::update() { Scene1109::Scene1109(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + SetMessageHandler(&Scene1109::handleMessage); - + setBackground(0x8449E02F); setPalette(0x8449E02F); insertScreenMouse(0x9E02B84C); - + _sprite1 = insertStaticSprite(0x600CEF01, 1100); if (which < 0) { diff --git a/engines/neverhood/modules/module1200.cpp b/engines/neverhood/modules/module1200.cpp index ae84d59113..e7766419f9 100644 --- a/engines/neverhood/modules/module1200.cpp +++ b/engines/neverhood/modules/module1200.cpp @@ -26,7 +26,7 @@ namespace Neverhood { Module1200::Module1200(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + SetMessageHandler(&Module1200::handleMessage); if (which < 0) @@ -124,7 +124,7 @@ static const uint32 kScene1201TntFileHashList2[] = { 0xB140A1E6, 0x5088A068, 0x5088A068, 0x74C4C866, 0x3192C059, 0x3192C059 }; - + SsScene1201Tnt::SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 pointIndex, int16 clipY2) : StaticSprite(vm, 900) { @@ -136,10 +136,10 @@ SsScene1201Tnt::SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 poi loadSprite(kScene1201TntFileHashList2[elemIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 50, x, y - 20); setClipRect(0, 0, 640, clipY2); } - + AsScene1201Tape::AsScene1201Tape(NeverhoodEngine *vm, Scene *parentScene, uint32 nameHash, int surfacePriority, int16 x, int16 y, uint32 fileHash) : AnimatedSprite(vm, fileHash, surfacePriority, x, y), _parentScene(parentScene), _nameHash(nameHash) { - + if (!getSubVar(VA_HAS_TAPE, _nameHash) && !getSubVar(VA_IS_TAPE_INSERTED, _nameHash)) { SetMessageHandler(&AsScene1201Tape::handleMessage); } else { @@ -253,10 +253,10 @@ void AsScene1201RightDoor::stCloseDoorDone() { stopAnimation(); setVisible(false); } - + AsScene1201KlaymenHead::AsScene1201KlaymenHead(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200) { - + createSurface(1200, 69, 98); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1201KlaymenHead::handleMessage); @@ -301,7 +301,7 @@ AsScene1201TntMan::AsScene1201TntMan(NeverhoodEngine *vm, Scene *parentScene, Sp AsScene1201TntMan::~AsScene1201TntMan() { _vm->_soundMan->deleteSoundGroup(0x01D00560); -} +} uint32 AsScene1201TntMan::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); @@ -396,7 +396,7 @@ void AsScene1201TntManFlame::suUpdate() { AsScene1201Match::AsScene1201Match(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _parentScene(parentScene), _countdown(0) { - + createSurface(1100, 57, 60); SetUpdateHandler(&AsScene1201Match::update); SetMessageHandler(&AsScene1201Match::hmOnDoorFrameAboutToMove); @@ -518,7 +518,7 @@ AsScene1201Creature::AsScene1201Creature(NeverhoodEngine *vm, Scene *parentScene : AnimatedSprite(vm, 900), _parentScene(parentScene), _klaymen(klaymen), _klaymenTooClose(false) { // NOTE: _countdown2 and _countdown3 were unused/without effect and thus removed - + createSurface(1100, 203, 199); SetUpdateHandler(&AsScene1201Creature::update); SetMessageHandler(&AsScene1201Creature::hmWaiting); @@ -664,7 +664,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene1201::handleMessage); setHitRects(0x004AEBD0); - + if (!getSubVar(VA_IS_PUZZLE_INIT, 0xE8058B52)) { setSubVar(VA_IS_PUZZLE_INIT, 0xE8058B52, 1); for (uint32 index = 0; index < 18; index++) @@ -672,25 +672,25 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) } insertScreenMouse(0x9A2C0409); - + _asTape = insertSprite(this, 3, 1100, 243, 340, 0x9148A011); addCollisionSprite(_asTape); - + tempSprite = insertStaticSprite(0x03C82530, 100); - topY1 = tempSprite->getY() + tempSprite->getDrawRect().height; + topY1 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x88182069, 200); - topY2 = tempSprite->getY() + tempSprite->getDrawRect().height; + topY2 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x476014E0, 300); - topY3 = tempSprite->getY() + tempSprite->getDrawRect().height; + topY3 = tempSprite->getY() + tempSprite->getDrawRect().height; tempSprite = insertStaticSprite(0x04063110, 500); - topY4 = tempSprite->getY() + 1; + topY4 = tempSprite->getY() + 1; _asTntManRope = insertSprite(getGlobalVar(V_TNT_DUMMY_BUILT) && which != 1); _asTntManRope->setClipRect(0, topY4, 640, 480); - + insertStaticSprite(0x400B04B0, 1200); tempSprite = insertStaticSprite(0x40295462, 1200); @@ -735,7 +735,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(x1, 0, x2, 480); _klaymen->setRepl(64, 0); - + if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) { setBackground(0x4019A2C4); setPalette(0x4019A2C4); @@ -756,8 +756,8 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertSprite(_asTntMan); tempSprite->setClipRect(x1, 0, x2, 480); } - - uint32 tntIndex = 1; + + uint32 tntIndex = 1; while (tntIndex < 18) { uint32 elemIndex = getSubVar(VA_TNT_POSITIONS, tntIndex); int16 clipY2; @@ -783,10 +783,10 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) setRectList(0x004AEE58); } else { setRectList(0x004AEDC8); - } - + } + } else { - + insertStaticSprite(0x8E8A1981, 900); uint32 tntIndex = 0; @@ -795,7 +795,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) int16 clipY2; if (kScene1201PointArray[elemIndex].x < 300) { clipY2 = 480; - } else { + } else { if (kScene1201PointArray[elemIndex].y < 175) clipY2 = topY1; else if (kScene1201PointArray[elemIndex].y < 230) @@ -811,7 +811,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) setRectList(0x004AEE18); else setRectList(0x004AED88); - + } tempSprite = insertStaticSprite(0x63D400BC, 900); @@ -875,7 +875,7 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit setMessageList2(0x004AECC0); } break; - case 0x2002: + case 0x2002: if (getGlobalVar(V_TNT_DUMMY_FUSE_LIT)) { // Move the TNT dummy if the fuse is burning sendEntityMessage(_klaymen, 0x1014, _asTntMan); @@ -903,7 +903,7 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit break; case 0x8000: sendMessage(_asKlaymenHead, 0x2006, 0); - break; + break; } return messageResult; } @@ -956,7 +956,7 @@ uint32 AsScene1202TntItem::hmShowIdle(int messageNum, const MessageParam ¶m, case 0x2001: _newPosition = (int)param.asInteger(); stChangePositionFadeOut(); - break; + break; } return messageResult; } @@ -998,7 +998,7 @@ void AsScene1202TntItem::stChangePositionDone() { } Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule), _paletteResource(vm), + : Scene(vm, parentModule), _paletteResource(vm), _soundToggle(true), _isPuzzleSolved(false), _counter(0), _clickedIndex(-1) { SetMessageHandler(&Scene1202::handleMessage); @@ -1093,8 +1093,8 @@ uint32 Scene1202::hmSolved(int messageNum, const MessageParam ¶m, Entity *se } bool Scene1202::isSolved() { - return - getSubVar(VA_TNT_POSITIONS, 0) == 0 && getSubVar(VA_TNT_POSITIONS, 3) == 3 && + return + getSubVar(VA_TNT_POSITIONS, 0) == 0 && getSubVar(VA_TNT_POSITIONS, 3) == 3 && getSubVar(VA_TNT_POSITIONS, 6) == 6 && getSubVar(VA_TNT_POSITIONS, 9) == 9 && getSubVar(VA_TNT_POSITIONS, 12) == 12 && getSubVar(VA_TNT_POSITIONS, 15) == 15; } diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index 062434f064..c8a561af76 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -45,7 +45,7 @@ static const uint32 kModule1300SoundList[] = { Module1300::Module1300(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + _vm->_soundMan->addMusic(0x61C090, 0x00203197); _vm->_soundMan->addSoundList(0x61C090, kModule1300SoundList); _vm->_soundMan->setSoundListParams(kModule1300SoundList, false, 50, 600, 20, 150); @@ -56,7 +56,7 @@ Module1300::Module1300(NeverhoodEngine *vm, Module *parentModule, int which) if (which < 0) { if (_vm->gameState().sceneNum >= 1 && _vm->gameState().sceneNum <= 17) createScene(_vm->gameState().sceneNum, -1); - else + else createScene(11, 0); } else { switch (which) { @@ -101,7 +101,7 @@ Module1300::Module1300(NeverhoodEngine *vm, Module *parentModule, int which) break; } } - + } Module1300::~Module1300() { @@ -218,7 +218,7 @@ void Module1300::createScene(int sceneNum, int which) { SetUpdateHandler(&Module1300::updateScene); _childObject->handleUpdate(); } - + void Module1300::updateScene() { if (!updateChild()) { switch (_sceneNum) { @@ -274,7 +274,7 @@ void Module1300::updateScene() { createScene(11, 1); break; case 12: - if (_moduleResult == 0) + if (_moduleResult == 0) createScene(14, 1); else if (_moduleResult == 1) createScene(15, 1); @@ -367,7 +367,7 @@ void AsScene1302Bridge::cbLowerBridgeEvent() { SsScene1302Fence::SsScene1302Fence(NeverhoodEngine *vm) : StaticSprite(vm, 0x11122122, 200) { - + _firstY = _y; if (getGlobalVar(V_FLYTRAP_RING_FENCE)) _y += 152; @@ -459,7 +459,7 @@ Scene1302::Scene1302(NeverhoodEngine *vm, Module *parentModule, int which) addCollisionSprite(_asVenusFlyTrap); sendEntityMessage(_klaymen, 0x2007, _asVenusFlyTrap); - + } uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -513,7 +513,7 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit case 0x2000: if (_klaymen->getY() > 360) { sendEntityMessage(_klaymen, 0x1014, _asVenusFlyTrap); - setMessageList2(0x004B08F0); + setMessageList2(0x004B08F0); } else setMessageList2(0x004B0920); break; @@ -583,7 +583,7 @@ uint32 Scene1302::handleMessage(int messageNum, const MessageParam ¶m, Entit AsScene1303Balloon::AsScene1303Balloon(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + createSurface(200, 128, 315); _x = 289; _y = 390; @@ -643,7 +643,7 @@ Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule) _asBalloon = insertSprite(this); addCollisionSprite(_asBalloon); } - + _sprite1 = insertStaticSprite(0xA014216B, 1100); insertKlaymen(207, 332); @@ -671,7 +671,7 @@ uint32 Scene1303::handleMessage(int messageNum, const MessageParam ¶m, Entit AsScene1304Needle::AsScene1304Needle(NeverhoodEngine *vm, Scene *parentScene, int surfacePriority, int16 x, int16 y) : AnimatedSprite(vm, 0x548E9411, surfacePriority, x, y), _parentScene(parentScene) { - // NOTE: Skipped check if Klaymen already has the needle since that's done in the scene itself + // NOTE: Skipped check if Klaymen already has the needle since that's done in the scene itself SetMessageHandler(&AsScene1304Needle::handleMessage); } @@ -693,14 +693,14 @@ uint32 AsScene1304Needle::handleMessage(int messageNum, const MessageParam ¶ Scene1304::Scene1304(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asNeedle(NULL) { - + SetMessageHandler(&Scene1304::handleMessage); setRectList(0x004B91A8); setBackground(0x062C0214); setPalette(0x062C0214); insertScreenMouse(0xC021006A); - + if (getGlobalVar(V_BALLOON_POPPED)) { _asKey = insertSprite(this, 0, 1100, 278, 347); addCollisionSprite(_asKey); @@ -774,7 +774,7 @@ Scene1305::Scene1305(NeverhoodEngine *vm, Module *parentModule, int which) insertKlaymen(212, 441); setMessageList(0x004B6E48); } - + } uint32 Scene1305::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -868,10 +868,10 @@ void AsScene1306Elevator::cbGoingDownEvent() { Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 4); - + SetMessageHandler(&Scene1306::handleMessage); setBackground(0x05303114); @@ -949,7 +949,7 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which) } } - + Scene1306::~Scene1306() { setGlobalVar(V_KLAYMEN_IS_DELTA_X, _klaymen->isDoDeltaX() ? 1 : 0); } @@ -1073,7 +1073,7 @@ static const NPoint kAsScene1307KeyPoints[] = { const uint kAsScene1307KeyFrameIndicesCount = 20; static const int16 kAsScene1307KeyFrameIndices[] = { - 1, 4, 8, 11, 15, 16, 17, 17, 17, 16, + 1, 4, 8, 11, 15, 16, 17, 17, 17, 16, 15, 14, 12, 10, 9, 7, 5, 3, 2, 1 }; @@ -1084,10 +1084,10 @@ const int16 kAsScene1307KeyYDelta = -12; AsScene1307Key::AsScene1307Key(NeverhoodEngine *vm, Scene *parentScene, uint keyIndex, NRect *clipRects) : AnimatedSprite(vm, 1100), _parentScene(parentScene), _keyIndex(keyIndex), _clipRects(clipRects), _isClickable(true) { - + NPoint pt; - const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; - + const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; + _dataResource.load(0x22102142); _pointList = _dataResource.getPointArray(0xAC849240); pt = (*_pointList)[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _keyIndex)]; @@ -1173,7 +1173,7 @@ void AsScene1307Key::suMoveKey() { } void AsScene1307Key::stRemoveKey() { - const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; + const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; _pointIndex = 0; startAnimation(fileHashes[0], 0, -1); playSound(1); @@ -1199,7 +1199,7 @@ void AsScene1307Key::stMoveKey() { if (newX == _x && newY == _y) { stInsertKey(); } else { - const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; + const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; _pointIndex = 0; _frameIndex = 0; _deltaX = newX - _x; @@ -1210,13 +1210,13 @@ void AsScene1307Key::stMoveKey() { } void AsScene1307Key::stUnlock() { - const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; + const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; startAnimation(fileHashes[1], 0, -1); _newStickFrameIndex = STICK_LAST_FRAME; } void AsScene1307Key::stInsert() { - const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; + const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex]; startAnimation(fileHashes[2], 0, -1); _newStickFrameIndex = STICK_LAST_FRAME; } @@ -1226,9 +1226,9 @@ Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule) _isInsertingKey(false), _doLeaveScene(false), _isPuzzleSolved(false) { Sprite *tempSprite; - + _vm->gameModule()->initKeySlotsPuzzle(); - + _dataResource.load(0x22102142); _keyHolePoints = _dataResource.getPointArray(0xAC849240); @@ -1279,7 +1279,7 @@ void Scene1307::update() { if (_doLeaveScene && !isSoundPlaying(0)) { leaveScene(1); setGlobalVar(V_KEYDOOR_UNLOCKED, 1); - } + } } uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1294,7 +1294,7 @@ uint32 Scene1307::handleMessage(int messageNum, const MessageParam ¶m, Entit int16 mouseY = param.asPoint().y; uint clickedKeyHoleIndex; for (clickedKeyHoleIndex = 0; clickedKeyHoleIndex < 16; clickedKeyHoleIndex++) { - if (mouseX >= _keyHoleRects[clickedKeyHoleIndex].x1 && mouseX <= _keyHoleRects[clickedKeyHoleIndex].x2 && + if (mouseX >= _keyHoleRects[clickedKeyHoleIndex].x1 && mouseX <= _keyHoleRects[clickedKeyHoleIndex].x2 && mouseY >= _keyHoleRects[clickedKeyHoleIndex].y1 && mouseY <= _keyHoleRects[clickedKeyHoleIndex].y2) break; } @@ -1362,7 +1362,7 @@ static const uint32 kScene1308NumberFileHashes[] = { AsScene1308JaggyDoor::AsScene1308JaggyDoor(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 0xBA0AE050, 1100, 320, 240), _parentScene(parentScene) { - + setVisible(false); stopAnimation(); SetMessageHandler(&AsScene1308JaggyDoor::handleMessage); @@ -1412,12 +1412,12 @@ void AsScene1308JaggyDoor::stCloseDoorDone() { AsScene1308KeyboardDoor::AsScene1308KeyboardDoor(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 0xA08A0851, 1100, 320, 240), _parentScene(parentScene) { - + playSound(0, 0x51456049); SetMessageHandler(&AsScene1308KeyboardDoor::handleMessage); NextState(&AsScene1308KeyboardDoor::stFallingKeys); } - + uint32 AsScene1308KeyboardDoor::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -1443,7 +1443,7 @@ void AsScene1308KeyboardDoor::stFallingKeysDone() { AsScene1308LightWallSymbols::AsScene1308LightWallSymbols(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 0x80180A10, 100, 320, 240), _parentScene(parentScene) { - + setVisible(false); stopAnimation(); Entity::_priority = 1200; @@ -1486,7 +1486,7 @@ void AsScene1308LightWallSymbols::stFadeOutDone() { SsScene1308Number::SsScene1308Number(NeverhoodEngine *vm, uint32 fileHash, int index) : StaticSprite(vm, fileHash, 100) { - + setVisible(false); _x = _spriteResource.getPosition().x + index * 20; updatePosition(); @@ -1520,11 +1520,11 @@ uint32 AsScene1308Mouse::handleMessage(int messageNum, const MessageParam ¶m Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _isProjecting(false), _asProjector(NULL) { - + _vm->gameModule()->initKeySlotsPuzzle(); SetMessageHandler(&Scene1308::handleMessage); - + setBackground(0x41024202); setPalette(0x41024202); insertScreenMouse(0x24206418); @@ -1536,7 +1536,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) insertSprite(); insertSprite(0x461A1490, 200, 235, 429); } - + _sprite1 = insertStaticSprite(0x0A042060, 1100); _asJaggyDoor = insertSprite(this); _asLightWallSymbols = insertSprite(this); @@ -1546,7 +1546,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which) _sprite2 = insertStaticSprite(0x40043120, 995); _sprite3 = insertStaticSprite(0x43003100, 995); _sprite4 = NULL; - + if (which < 0) { // Restoring game insertKlaymen(380, 440); @@ -1698,7 +1698,7 @@ uint32 Scene1308::handleMessage(int messageNum, const MessageParam ¶m, Entit Scene1317::Scene1317(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule) { - + SetMessageHandler(&Scene1317::handleMessage); _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08982841, true, false)); _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); @@ -1720,7 +1720,7 @@ void Scene1317::update() { void Scene1317::upChooseKing() { if (!_klaymenBlinks && _klaymenBlinkCountdown != 0 && (--_klaymenBlinkCountdown == 0)) _klaymenBlinks = true; - + if (!_klaymenBlinks && _smackerPlayer->getFrameNumber() + 1 >= 2) { _smackerPlayer->rewind(); } else if (_klaymenBlinks && _smackerPlayer->getFrameNumber() + 1 >= 6) { @@ -1731,7 +1731,7 @@ void Scene1317::upChooseKing() { if (!_klaymenBlinks && _decisionCountdown != 0 && (--_decisionCountdown == 0)) stNoDecisionYet(); - + if (_smackerFileHash) { _smackerPlayer->open(_smackerFileHash, _keepLastSmackerFrame); _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); @@ -1739,7 +1739,7 @@ void Scene1317::upChooseKing() { } Scene::update(); - + } uint32 Scene1317::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1751,7 +1751,7 @@ uint32 Scene1317::handleMessage(int messageNum, const MessageParam ¶m, Entit } return messageResult; } - + uint32 Scene1317::hmChooseKing(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { diff --git a/engines/neverhood/modules/module1400.cpp b/engines/neverhood/modules/module1400.cpp index 56c6ca5f13..0a029632b6 100644 --- a/engines/neverhood/modules/module1400.cpp +++ b/engines/neverhood/modules/module1400.cpp @@ -31,7 +31,7 @@ namespace Neverhood { Module1400::Module1400(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + _vm->_soundMan->addMusic(0x00AD0012, 0x06333232); _vm->_soundMan->addMusic(0x00AD0012, 0x624A220E); @@ -139,7 +139,7 @@ void Module1400::updateScene() { AsScene1401Pipe::AsScene1401Pipe(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100), _countdown1(0), _countdown2(0) { - + createSurface(900, 152, 147); _x = 454; _y = 217; @@ -179,10 +179,10 @@ uint32 AsScene1401Pipe::handleMessage(int messageNum, const MessageParam ¶m, _countdown1 = 70; _countdown2 = 8; stStartSucking(); - break; + break; case 0x483A: stSuckInProjector(); - break; + break; } return messageResult; } @@ -221,7 +221,7 @@ void AsScene1401Pipe::stSuckInProjector() { AsScene1401Mouse::AsScene1401Mouse(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { - + createSurface(100, 71, 41); _x = 478; _y = 433; @@ -243,7 +243,7 @@ uint32 AsScene1401Mouse::handleMessage(int messageNum, const MessageParam ¶m break; case 0x4839: stSuckedIn(); - break; + break; } return messageResult; } @@ -280,7 +280,7 @@ uint32 AsScene1401Cheese::handleMessage(int messageNum, const MessageParam ¶ switch (messageNum) { case 0x4839: stSuckedIn(); - break; + break; } return messageResult; } @@ -332,7 +332,7 @@ uint32 AsScene1401BackDoor::handleMessage(int messageNum, const MessageParam &pa case 0x2001: if (_isOpen) _countdown = 168; - messageResult = _isOpen ? 1 : 0; + messageResult = _isOpen ? 1 : 0; break; case 0x3002: gotoNextState(); @@ -341,7 +341,7 @@ uint32 AsScene1401BackDoor::handleMessage(int messageNum, const MessageParam &pa _countdown = 168; if (!_isOpen) stOpenDoor(); - break; + break; } return messageResult; } @@ -540,7 +540,7 @@ void AsCommonProjector::moveProjector() { playSound(1, 0x5440E474); _lockedInSlot = true; } - + } void AsCommonProjector::stSuckedIn() { @@ -627,8 +627,8 @@ void AsCommonProjector::stStartSuckedIn() { } Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule), _projectorBorderFlag(false), _ssFloorButton(NULL), _asProjector(NULL), - _asPipe(NULL), _asMouse(NULL), _asCheese(NULL), _asBackDoor(NULL), + : Scene(vm, parentModule), _projectorBorderFlag(false), _ssFloorButton(NULL), _asProjector(NULL), + _asPipe(NULL), _asMouse(NULL), _asCheese(NULL), _asBackDoor(NULL), _sprite1(NULL), _sprite2(NULL), _sprite3(NULL), _ssButton(NULL) { SetMessageHandler(&Scene1401::handleMessage); @@ -638,7 +638,7 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x08221FA5); setPalette(0x08221FA5); insertScreenMouse(0x21FA108A); - + _ssFloorButton = insertSprite(this, 0x980F3124, 0x12192892, 100, 0); _asPipe = insertSprite(); @@ -692,7 +692,7 @@ Scene1401::Scene1401(NeverhoodEngine *vm, Module *parentModule, int which) } _asProjector->setClipRect(_sprite3->getDrawRect().x, _sprite2->getDrawRect().y, 640, 480); } - + _klaymen->setClipRect(_sprite3->getDrawRect().x, 0, 640, 480); if (which == 0 && _asProjector) @@ -752,7 +752,7 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit setMessageList2(0x004B6658); } else setMessageList2(0x004B65F0); - } + } break; case 0x482A: _sprite1->setVisible(true); @@ -772,7 +772,7 @@ uint32 Scene1401::handleMessage(int messageNum, const MessageParam ¶m, Entit SsScene1402BridgePart::SsScene1402BridgePart(NeverhoodEngine *vm, uint32 fileHash, int surfacePriority) : StaticSprite(vm, fileHash, surfacePriority) { - + SetFilterY(&Sprite::defFilterY); SetUpdateHandler(&StaticSprite::updatePosition); } @@ -892,7 +892,7 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) startShaking(); } } - + if (_asPuzzleBox) _asPuzzleBox->setClipRect(0, 0, 640, _ssBridgePart3->getDrawRect().y2()); @@ -914,7 +914,7 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which) } _klaymen->setClipRect(_ssBridgePart1->getDrawRect().x, 0, _ssBridgePart2->getDrawRect().x2(), _ssBridgePart3->getDrawRect().y2()); - + } void Scene1402::upShaking() { @@ -1082,7 +1082,7 @@ static const struct { AsScene1407Mouse::AsScene1407Mouse(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _parentScene(parentScene), _currSectionIndex(0) { - + createSurface(100, 117, 45); _x = 108; _y = 106; @@ -1096,7 +1096,7 @@ void AsScene1407Mouse::suWalkTo() { xdelta = _deltaX; else if (xdelta < -_deltaX) xdelta = -_deltaX; - _deltaX = 0; + _deltaX = 0; if (_walkDestX == _x) sendMessage(this, 0x1019, 0); else { @@ -1231,7 +1231,7 @@ Scene1407::Scene1407(NeverhoodEngine *vm, Module *parentModule) _asMouse = insertSprite(this); _ssResetButton = insertStaticSprite(0x12006600, 100); - _ssResetButton->setVisible(false); + _ssResetButton->setVisible(false); } @@ -1279,9 +1279,9 @@ uint32 Scene1407::handleMessage(int messageNum, const MessageParam ¶m, Entit Scene1403::Scene1403(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asProjector(NULL), _isProjecting(false) { - + SetMessageHandler(&Scene1403::handleMessage); - + setRectList(0x004B1FF8); setBackground(0x2110A234); setPalette(0x2110A234); @@ -1383,10 +1383,10 @@ uint32 Scene1403::handleMessage(int messageNum, const MessageParam ¶m, Entit Scene1404::Scene1404(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asProjector(NULL), _asKey(NULL) { - + if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 5); - + SetMessageHandler(&Scene1404::handleMessage); setRectList(0x004B8D80); @@ -1555,14 +1555,14 @@ Scene1405::Scene1405(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule), _selectFirstTile(true), _tilesLeft(48), _countdown(0) { _vm->gameModule()->initMemoryPuzzle(); - + SetUpdateHandler(&Scene1405::update); SetMessageHandler(&Scene1405::handleMessage); setBackground(0x0C0C007D); setPalette(0x0C0C007D); insertPuzzleMouse(0xC00790C8, 20, 620); - + for (uint32 tileIndex = 0; tileIndex < 48; tileIndex++) { _tiles[tileIndex] = insertSprite(this, tileIndex); addCollisionSprite(_tiles[tileIndex]); diff --git a/engines/neverhood/modules/module1500.cpp b/engines/neverhood/modules/module1500.cpp index 00d64a8c2d..3ce9783b69 100644 --- a/engines/neverhood/modules/module1500.cpp +++ b/engines/neverhood/modules/module1500.cpp @@ -26,7 +26,7 @@ namespace Neverhood { Module1500::Module1500(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else @@ -86,7 +86,7 @@ Scene1501::Scene1501(NeverhoodEngine *vm, Module *parentModule, uint32 backgroun SetUpdateHandler(&Scene1501::update); SetMessageHandler(&Scene1501::handleMessage); - + setBackground(backgroundFileHash); setPalette(); addEntity(_palette); @@ -118,7 +118,7 @@ void Scene1501::update() { _countdown1 = 12; _palette->startFadeToBlack(11); } - + } uint32 Scene1501::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { diff --git a/engines/neverhood/modules/module1600.cpp b/engines/neverhood/modules/module1600.cpp index 40faa1e82d..a5a785e130 100644 --- a/engines/neverhood/modules/module1600.cpp +++ b/engines/neverhood/modules/module1600.cpp @@ -34,7 +34,7 @@ static const uint32 kModule1600SoundList[] = { Module1600::Module1600(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else if (which == 1) @@ -109,7 +109,7 @@ void Module1600::createScene(int sceneNum, int which) { if (getGlobalVar(V_TALK_COUNTING_INDEX) >= 2) setGlobalVar(V_TALK_COUNTING_INDEX, 0); else - incGlobalVar(V_TALK_COUNTING_INDEX, +1); + incGlobalVar(V_TALK_COUNTING_INDEX, +1); break; } SetUpdateHandler(&Module1600::updateScene); @@ -185,11 +185,11 @@ void Module1600::updateScene() { AsCommonCar::AsCommonCar(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y) : AnimatedSprite(vm, 1000), _parentScene(parentScene) { - + createSurface(200, 556, 328); _x = x; _y = y; - + _inMainArea = false; _exitDirection = 0; _currPointIndex = 0; @@ -207,7 +207,7 @@ AsCommonCar::AsCommonCar(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 _soundCounter = 0; _pathPoints = NULL; _currMoveDirection = 0; - + startAnimation(0xD4220027, 0, -1); setDoDeltaX(getGlobalVar(V_CAR_DELTA_X)); @@ -517,7 +517,7 @@ void AsCommonCar::moveToNextPoint() { if (ABS(nextPt.y - currPt.y) <= ABS(nextPt.x - currPt.x) && ((_currMoveDirection == 2 && nextPt.x < currPt.x) || (_currMoveDirection == 4 && nextPt.x >= currPt.x))) { - if (_currMoveDirection == 2) + if (_currMoveDirection == 2) _currMoveDirection = 4; else if (_currMoveDirection == 4) _currMoveDirection = 2; @@ -605,7 +605,7 @@ void AsCommonCar::moveToPrevPoint() { if (ABS(prevPt.y - currPt.y) <= ABS(prevPt.x - currPt.x) && ((_currMoveDirection == 2 && prevPt.x < currPt.x) || (_currMoveDirection == 4 && prevPt.x >= currPt.x))) { - if (_currMoveDirection == 2) + if (_currMoveDirection == 2) _currMoveDirection = 4; else if (_currMoveDirection == 4) _currMoveDirection = 2; @@ -668,7 +668,7 @@ void AsCommonCar::suMoveToNextPoint() { bool firstTime = true; _ySteps = _steps; int stepsCtr = _steps; - + while (stepsCtr > 0) { NPoint pt1; NPoint pt2 = pathPoint(_currPointIndex); @@ -739,7 +739,7 @@ void AsCommonCar::suMoveToNextPoint() { stepsCtr = 0; } } - firstTime = false; + firstTime = false; } if (_yMoveTotalSteps != 0) { @@ -811,7 +811,7 @@ void AsCommonCar::suMoveToPrevPoint() { bool firstTime = true; _ySteps = _steps; int stepsCtr = _steps; - + while (stepsCtr > 0) { if (_stepError == 0) _currPointIndex--; @@ -884,7 +884,7 @@ void AsCommonCar::suMoveToPrevPoint() { stepsCtr = 0; } } - firstTime = false; + firstTime = false; } if (_yMoveTotalSteps != 0) { @@ -971,7 +971,7 @@ AsCommonIdleCarFull::AsCommonIdleCarFull(NeverhoodEngine *vm, int16 x, int16 y) AsCommonCarConnector::AsCommonCarConnector(NeverhoodEngine *vm, AsCommonCar *asCar) : AnimatedSprite(vm, 1100), _asCar(asCar) { - + createSurface1(0x60281C10, 150); startAnimation(0x60281C10, -1, -1); _newStickFrameIndex = STICK_LAST_FRAME; @@ -1006,9 +1006,9 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _asCar(NULL), _countdown1(0) { setGlobalVar(V_CAR_DELTA_X, 1); - + SetMessageHandler(&Scene1608::hmLowerFloor); - + _asKey = insertSprite(this, 1, 1100, 198, 220); addCollisionSprite(_asKey); @@ -1092,9 +1092,9 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _carClipFlag = false; _carStatus = 0; setRectList(0x004B4810); - } + } - // NOTE: Not in the else because 'which' is set to 1 in the true branch + // NOTE: Not in the else because 'which' is set to 1 in the true branch if (which == 1) { // Klaymen riding the car _vm->gameState().which = 1; @@ -1134,9 +1134,9 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _carClipFlag = true; _carStatus = 0; } - + _palette->addPalette("paKlayRed", 0, 64, 0); - + } Scene1608::~Scene1608() { @@ -1308,7 +1308,7 @@ uint32 Scene1608::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity } return 0; } - + void Scene1608::updateKlaymenCliprect() { if (_kmScene1608->getX() <= 375) _kmScene1608->setClipRect(_clipRect1); @@ -1321,17 +1321,17 @@ Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule) _vm->gameModule()->initCodeSymbolsPuzzle(); _noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX); - + SetMessageHandler(&Scene1609::handleMessage); SetUpdateHandler(&Scene1609::update); - + setBackground(0x92124A14); setPalette(0x92124A14); insertPuzzleMouse(0x24A10929, 20, 620); - + for (int symbolPosition = 0; symbolPosition < 12; symbolPosition++) _asSymbols[symbolPosition] = insertSprite(symbolPosition, false); - + _ssButton = insertSprite(this, true); addCollisionSprite(_ssButton); loadSound(0, 0x68E25540); @@ -1408,5 +1408,5 @@ bool Scene1609::testVars() { return true; } - + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1700.cpp b/engines/neverhood/modules/module1700.cpp index 38ed561d51..2aeae466ff 100644 --- a/engines/neverhood/modules/module1700.cpp +++ b/engines/neverhood/modules/module1700.cpp @@ -36,7 +36,7 @@ static const uint32 kModule1700SoundList[] = { Module1700::Module1700(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + _vm->_soundMan->addMusic(0x04212331, 0x31114225); _vm->_soundMan->addSoundList(0x04212331, kModule1700SoundList); _vm->_soundMan->setSoundListParams(kModule1700SoundList, true, 50, 600, 5, 150); @@ -125,7 +125,7 @@ void Module1700::updateScene() { } } } - + // Scene1705 static const uint32 kScene1705FileHashes[] = { @@ -137,7 +137,7 @@ static const uint32 kScene1705FileHashes[] = { SsScene1705WallSymbol::SsScene1705WallSymbol(NeverhoodEngine *vm, uint32 fileHash, int symbolIndex) : StaticSprite(vm, fileHash, 100) { - + _x = _spriteResource.getPosition().x + symbolIndex * 30; _y = _spriteResource.getPosition().y + 160; updatePosition(); @@ -171,7 +171,7 @@ uint32 SsScene1705Tape::handleMessage(int messageNum, const MessageParam ¶m, setSubVar(VA_HAS_TAPE, _tapeIndex, 1); setVisible(false); SetMessageHandler(NULL); - break; + break; } return messageResult; } @@ -180,7 +180,7 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _paletteArea(1) { Sprite *tempSprite; - + setGlobalVar(V_FELL_DOWN_HOLE, 1); _vm->gameModule()->initCannonSymbolsPuzzle(); @@ -271,7 +271,7 @@ uint32 Scene1705::handleMessage(int messageNum, const MessageParam ¶m, Entit sendEntityMessage(_klaymen, 0x1014, sender); setMessageList(0x004B6AC0); } - break; + break; } return 0; } diff --git a/engines/neverhood/modules/module1700.h b/engines/neverhood/modules/module1700.h index f57c411a18..deb5573f2b 100644 --- a/engines/neverhood/modules/module1700.h +++ b/engines/neverhood/modules/module1700.h @@ -50,7 +50,7 @@ public: class SsScene1705Tape : public StaticSprite { public: SsScene1705Tape(NeverhoodEngine *vm, Scene *parentScene, uint32 tapeIndex, int surfacePriority, int16 x, int16 y, uint32 fileHash); -protected: +protected: Scene *_parentScene; uint32 _tapeIndex; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/modules/module1800.cpp b/engines/neverhood/modules/module1800.cpp index b7371c9a4a..b312678467 100644 --- a/engines/neverhood/modules/module1800.cpp +++ b/engines/neverhood/modules/module1800.cpp @@ -38,7 +38,7 @@ static const uint32 kModule1800SoundList[] = { Module1800::Module1800(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + _vm->_soundMan->addSoundList(0x04A14718, kModule1800SoundList); _vm->_soundMan->setSoundListParams(kModule1800SoundList, true, 50, 600, 10, 150); _vm->_soundMan->playTwoSounds(0x04A14718, 0x8A382B55, 0x0C242F1D, 0); @@ -177,5 +177,5 @@ void Module1800::updateScene() { } } } - + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module1900.cpp b/engines/neverhood/modules/module1900.cpp index 7f08b01d3f..29c20083f9 100644 --- a/engines/neverhood/modules/module1900.cpp +++ b/engines/neverhood/modules/module1900.cpp @@ -35,8 +35,8 @@ static const uint32 kModule1900SoundList[] = { Module1900::Module1900(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - // NOTE: The original has a Scene1908 here as well but it's not used here but in another module... - + // NOTE: The original has a Scene1908 here as well but it's not used here but in another module... + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else @@ -88,7 +88,7 @@ void Module1900::updateScene() { Scene1901::Scene1901(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + Sprite *tempSprite; setRectList(0x004B34C8); @@ -98,7 +98,7 @@ Scene1901::Scene1901(NeverhoodEngine *vm, Module *parentModule, int which) insertScreenMouse(0x0322301B); insertStaticSprite(0x42213133, 1100); - + if (!getGlobalVar(V_STAIRS_PUZZLE_SOLVED)) insertStaticSprite(0x40A40168, 100); else if (getGlobalVar(V_STAIRS_DOWN)) { @@ -132,16 +132,16 @@ static const NPoint kAsScene1907SymbolGroundPositions[] = { {400, 375}, {370, 435}, {475, 415} }; -static const NPoint kAsScene1907SymbolPluggedInPositions[] = { +static const NPoint kAsScene1907SymbolPluggedInPositions[] = { {275, 125}, {244, 125}, {238, 131}, {221, 135}, {199, 136}, {168, 149}, {145, 152}, {123, 154}, {103, 157} }; static const NPoint kAsScene1907SymbolGroundHitPositions[] = { - {275, 299}, {244, 299}, {238, 305}, - {221, 309}, {199, 310}, {168, 323}, - {145, 326}, {123, 328}, {103, 331} + {275, 299}, {244, 299}, {238, 305}, + {221, 309}, {199, 310}, {168, 323}, + {145, 326}, {123, 328}, {103, 331} }; static const NPoint kAsScene1907SymbolPluggedInDownPositions[] = { @@ -164,7 +164,7 @@ AsScene1907Symbol::AsScene1907Symbol(NeverhoodEngine *vm, Scene1907 *parentScene _plugInFailed = false; _plugInTryCount = 0; - + if (getGlobalVar(V_STAIRS_PUZZLE_SOLVED)) { _isPluggedIn = true; _currPositionIndex = elementIndex; @@ -289,7 +289,7 @@ void AsScene1907Symbol::suMoveDown() { _y = kAsScene1907SymbolPluggedInDownPositions[_elementIndex].y; _isMoving = false; SetSpriteUpdate(NULL); - } + } } void AsScene1907Symbol::suMoveUp() { @@ -423,7 +423,7 @@ void AsScene1907Symbol::moveDown() { SsScene1907UpDownButton::SsScene1907UpDownButton(NeverhoodEngine *vm, Scene1907 *parentScene, AsScene1907Symbol *asScene1907Symbol) : StaticSprite(vm, 1400), _parentScene(parentScene), _asScene1907Symbol(asScene1907Symbol), _countdown1(0) { - + loadSprite(0x64516424, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 1400); setVisible(false); loadSound(0, 0x44061000); @@ -474,7 +474,7 @@ void SsScene1907UpDownButton::setToDownPosition() { AsScene1907WaterHint::AsScene1907WaterHint(NeverhoodEngine *vm) : AnimatedSprite(vm, 1400) { - + createSurface1(0x110A1061, 1500); _x = 320; _y = 240; @@ -515,10 +515,10 @@ void AsScene1907WaterHint::hide() { SetMessageHandler(&Sprite::handleMessage); } -Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule), _currMovingSymbolIndex(0), _pluggedInCount(0), +Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) + : Scene(vm, parentModule), _currMovingSymbolIndex(0), _pluggedInCount(0), _moveDownCountdown(0), _moveUpCountdown(0), _countdown3(0), _hasPlugInFailed(false) { - + setBackground(0x20628E05); setPalette(0x20628E05); @@ -529,12 +529,12 @@ Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) _asSymbols[i] = insertSprite(this, i, getRandomPositionIndex()); addCollisionSprite(_asSymbols[i]); } - + _ssUpDownButton = insertSprite(this, _asSymbols[8]); addCollisionSprite(_ssUpDownButton); _asWaterHint = insertSprite(); - + insertPuzzleMouse(0x28E0120E, 20, 620); SetMessageHandler(&Scene1907::handleMessage); @@ -542,7 +542,7 @@ Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) if (getGlobalVar(V_STAIRS_PUZZLE_SOLVED)) _pluggedInCount = 9; - + loadSound(0, 0x72004A10); loadSound(1, 0x22082A12); loadSound(2, 0x21100A10); @@ -552,7 +552,7 @@ Scene1907::Scene1907(NeverhoodEngine *vm, Module *parentModule) void Scene1907::update() { Scene::update(); - + if (_hasPlugInFailed) { int fallOffDelay = 0; _hasPlugInFailed = false; @@ -619,7 +619,7 @@ uint32 Scene1907::handleMessage(int messageNum, const MessageParam ¶m, Entit playSound(3); setGlobalVar(V_STAIRS_PUZZLE_SOLVED, 1); break; - } + } return 0; } diff --git a/engines/neverhood/modules/module2000.cpp b/engines/neverhood/modules/module2000.cpp index 644b7c479a..fcccdefbdd 100644 --- a/engines/neverhood/modules/module2000.cpp +++ b/engines/neverhood/modules/module2000.cpp @@ -28,7 +28,7 @@ namespace Neverhood { Module2000::Module2000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else if (which == 0) @@ -137,9 +137,9 @@ Scene2001::Scene2001(NeverhoodEngine *vm, Module *parentModule, int which) sendMessage(this, 0x2000, 0); _klaymen->setDoDeltaX(1); } - + _klaymen->setClipRect(tempSprite->getDrawRect().x, 0, 640, 480); - + } uint32 Scene2001::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -153,7 +153,7 @@ uint32 Scene2001::handleMessage(int messageNum, const MessageParam ¶m, Entit setRectList(0x004B3670); _klaymen->setKlaymenIdleTable1(); } - } + } return 0; } diff --git a/engines/neverhood/modules/module2100.cpp b/engines/neverhood/modules/module2100.cpp index 7f9ca94430..bcff9d9d1b 100644 --- a/engines/neverhood/modules/module2100.cpp +++ b/engines/neverhood/modules/module2100.cpp @@ -30,7 +30,7 @@ Module2100::Module2100(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { _vm->_soundMan->addMusic(0x10A10C14, 0x11482B95); - + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else if (which == 1) @@ -129,7 +129,7 @@ void AsScene2101Door::stCloseDoorDone() { AsScene2101HitByDoorEffect::AsScene2101HitByDoorEffect(NeverhoodEngine *vm, Sprite *klaymen) : AnimatedSprite(vm, 1400), _klaymen(klaymen) { - + SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2101HitByDoorEffect::handleMessage); createSurface(1200, 88, 165); @@ -176,8 +176,8 @@ void SsCommonFloorButton::update() { else setVisible(false); } -} - +} + uint32 SsCommonFloorButton::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -195,12 +195,12 @@ uint32 SsCommonFloorButton::handleMessage(int messageNum, const MessageParam &pa Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + Sprite *tempSprite; - + SetMessageHandler(&Scene2101::handleMessage); SetUpdateHandler(&Scene2101::update); - + setBackground(0x44242305); setPalette(0x44242305); insertScreenMouse(0x4230144A); @@ -212,7 +212,7 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) addCollisionSprite(_asTape1); _asTape2 = insertSprite(this, 11, 1100, 441, 443, 0x9048A093); addCollisionSprite(_asTape2); - + if (which < 0) { insertKlaymen(380, 438); setMessageList(0x004B8E48); @@ -256,10 +256,10 @@ Scene2101::Scene2101(NeverhoodEngine *vm, Module *parentModule, int which) _doorStatus = 1; _countdown1 = 0; } - + _asHitByDoorEffect = insertSprite(_klaymen); _klaymen->setClipRect(0, 0, tempSprite->getDrawRect().x2(), 480); - + } void Scene2101::update() { diff --git a/engines/neverhood/modules/module2100.h b/engines/neverhood/modules/module2100.h index 369f5ac0cc..d76bed0780 100644 --- a/engines/neverhood/modules/module2100.h +++ b/engines/neverhood/modules/module2100.h @@ -68,7 +68,7 @@ protected: uint32 _soundFileHash; uint32 _fileHash1, _fileHash2; int16 _countdown; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp index 04e3f0bfee..99f21cad74 100644 --- a/engines/neverhood/modules/module2200.cpp +++ b/engines/neverhood/modules/module2200.cpp @@ -30,8 +30,8 @@ namespace Neverhood { Module2200::Module2200(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - - _vm->_soundMan->addMusic(0x11391412, 0x601C908C); + + _vm->_soundMan->addMusic(0x11391412, 0x601C908C); if (which < 0) createScene(_vm->gameState().sceneNum, -1); @@ -440,7 +440,7 @@ void Module2200::updateScene() { } #undef HallOfRecordsSceneLink - + void Module2200::createHallOfRecordsScene(int which, uint32 hallOfRecordsInfoId) { _childObject = new HallOfRecordsScene(_vm, this, which, hallOfRecordsInfoId); } @@ -461,7 +461,7 @@ AsScene2201Door::AsScene2201Door(NeverhoodEngine *vm, Klaymen *klaymen, Sprite * : AnimatedSprite(vm, 1100), _klaymen(klaymen), _ssDoorLight(ssDoorLight), _countdown(0), _isOpen(isOpen) { _x = 408; - _y = 290; + _y = 290; createSurface(900, 63, 266); SetUpdateHandler(&AsScene2201Door::update); SetMessageHandler(&AsScene2201Door::handleMessage); @@ -528,7 +528,7 @@ void AsScene2201Door::stCloseDoor() { SsScene2201PuzzleCube::SsScene2201PuzzleCube(NeverhoodEngine *vm, uint32 positionIndex, uint32 cubeIndex) : StaticSprite(vm, 900) { - + createSurface(100, 16, 16); loadSprite(kSsScene2201PuzzleCubeFileHashes[cubeIndex], kSLFCenteredDrawOffset | kSLFSetPosition, 0, kSsScene2201PuzzleCubePoints[positionIndex].x, kSsScene2201PuzzleCubePoints[positionIndex].y); @@ -543,7 +543,7 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene2201::handleMessage); SetUpdateHandler(&Scene2201::update); - + loadDataResource(0x04104242); loadHitRectList(); setBackground(0x40008208); @@ -551,9 +551,9 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) insertScreenMouse(0x0820C408); _asTape = insertSprite(this, 7, 1100, 459, 432, 0x9148A011); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _ssDoorButton = insertSprite(this, 0xE4A43E29, 0xE4A43E29, 100, 0); - + for (uint32 cubeIndex = 0; cubeIndex < 9; cubeIndex++) if ((int16)getSubVar(VA_CUBE_POSITIONS, cubeIndex) >= 0) insertSprite(cubeIndex, (int16)getSubVar(VA_CUBE_POSITIONS, cubeIndex)); @@ -562,10 +562,10 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) _clipRects[0].x2 = 640; _clipRects[1].x2 = 640; _clipRects[1].y2 = 480; - + if (!getGlobalVar(V_TILE_PUZZLE_SOLVED)) insertStaticSprite(0x00026027, 900); - + tempSprite = insertStaticSprite(0x030326A0, 1100); _clipRects[0].x1 = tempSprite->getDrawRect().x; insertStaticSprite(0x811DA061, 1100); @@ -602,7 +602,7 @@ Scene2201::Scene2201(NeverhoodEngine *vm, Module *parentModule, int which) setMessageList(0x004B8120); _asDoor = insertSprite(_klaymen, _ssDoorLight, true); } - + insertSprite(); _vm->_soundMan->addSound(0x04106220, 0x81212040); @@ -719,7 +719,7 @@ uint32 SsScene2202PuzzleCube::handleMessage(int messageNum, const MessageParam & } return messageResult; } - + void SsScene2202PuzzleCube::suMoveCubeX() { bool done = false; @@ -746,9 +746,9 @@ void SsScene2202PuzzleCube::suMoveCubeX() { if (_x == _xFlagPos) _counterDirection = true; } - + if (done) - stopMoving(); + stopMoving(); updateBounds(); @@ -780,9 +780,9 @@ void SsScene2202PuzzleCube::suMoveCubeY() { if (_x == _xFlagPos) _counterDirection = true; } - + if (done) - stopMoving(); + stopMoving(); updateBounds(); @@ -794,7 +794,7 @@ void SsScene2202PuzzleCube::moveCube(int16 newCubePosition) { setSubVar(VA_CUBE_POSITIONS, _cubePosition, (uint32)-1); setSubVar(VA_CUBE_POSITIONS, newCubePosition, (uint32)_cubeSymbol); - + _cubePosition = newCubePosition; _errValue = 0; _counterDirection = false; @@ -837,7 +837,7 @@ void SsScene2202PuzzleCube::moveCube(int16 newCubePosition) { if (_newX - _x >= 180) _xFlagPos = _newX - 90; else - _xFlagPos = _x + _newX / 2; + _xFlagPos = _x + _newX / 2; } else { if (_x - _newX >= 180) _xFlagPos = _x + 90; @@ -851,7 +851,7 @@ void SsScene2202PuzzleCube::moveCube(int16 newCubePosition) { if (_newY - _y >= 180) _xFlagPos = _newY - 90; else - _xFlagPos = _y + _newY / 2; + _xFlagPos = _y + _newY / 2; } else { if (_y - _newY >= 180) _xFlagPos = _y + 90; @@ -860,7 +860,7 @@ void SsScene2202PuzzleCube::moveCube(int16 newCubePosition) { } playSound(1); } - + } void SsScene2202PuzzleCube::stopMoving() { @@ -939,7 +939,7 @@ void Scene2202::update() { _isSolved = true; } } - + } uint32 Scene2202::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -981,7 +981,7 @@ int16 Scene2202::getFreeCubePosition(int16 cubePosition) { } bool Scene2202::testIsSolved() { - return + return getSubVar(VA_CUBE_POSITIONS, 0) == 0 && getSubVar(VA_CUBE_POSITIONS, 2) == 2 && getSubVar(VA_CUBE_POSITIONS, 3) == 3 && @@ -1146,7 +1146,7 @@ Scene2203::Scene2203(NeverhoodEngine *vm, Module *parentModule, int which) _ssSmallRightDoor->setVisible(false); _klaymen->setClipRect(_leftDoorClipRect); } - + } Scene2203::~Scene2203() { @@ -1220,7 +1220,7 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene2205::handleMessage); SetUpdateHandler(&Scene2205::update); - + setHitRects(0x004B0620); if (getGlobalVar(V_LIGHTS_ON)) { _isLightOn = true; @@ -1263,11 +1263,11 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(_ssDoorFrame->getDrawRect().x, 0, 640, 480); _klaymen->setSoundFlag(true); - + loadDataResource(0x00144822); - + } - + void Scene2205::update() { Scene::update(); if (!_isLightOn && getGlobalVar(V_LIGHTS_ON)) { @@ -1343,7 +1343,7 @@ static const int16 kAsScene2206DoorSpikesXDeltasClose[] = { AsScene2206DoorSpikes::AsScene2206DoorSpikes(NeverhoodEngine *vm, uint32 fileHash) : StaticSprite(vm, fileHash, 200) { - + if (getGlobalVar(V_SPIKES_RETRACTED)) _x -= 63; SetUpdateHandler(&AsScene2206DoorSpikes::update); @@ -1457,10 +1457,10 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { uint32 fileHash; - + SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene2206::handleMessage); - + if (getGlobalVar(V_LIGHTS_ON)) { fileHash = 0x41983216; _sprite1 = insertStaticSprite(0x2201266A, 100); @@ -1495,7 +1495,7 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) if (!getGlobalVar(V_LIGHTS_ON)) _palette->addPalette(0x0263D144, 0, 65, 0); addCollisionSprite(_ssTestTube); - + if (which < 0) { // Restoring game insertKlaymen(200, 430); @@ -1644,7 +1644,7 @@ void AsScene2207Elevator::update() { if (_destPointIndex + _destPointIndexDelta > _pointIndex) { _pointIndex++; startAnimation(getGlobalVar(V_LIGHTS_ON) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); - _newStickFrameIndex = _pointIndex; + _newStickFrameIndex = _pointIndex; if (_destPointIndex + _destPointIndexDelta == _pointIndex) { if (_destPointIndexDelta != 0) _destPointIndexDelta = 0; @@ -1660,7 +1660,7 @@ void AsScene2207Elevator::update() { if (_pointIndex == 0) sendMessage(_parentScene, 0x2003, 0); startAnimation(getGlobalVar(V_LIGHTS_ON) ? 0xC858CC19 : 0x294B3377, _pointIndex, _pointIndex); - _newStickFrameIndex = _pointIndex; + _newStickFrameIndex = _pointIndex; if (_destPointIndex + _destPointIndexDelta == _pointIndex) { if (_destPointIndexDelta != 0) _destPointIndexDelta = 0; @@ -1675,14 +1675,14 @@ void AsScene2207Elevator::update() { sendMessage(_parentScene, 0x2002, 900); else if (_pointIndex < 20 && _surface->getPriority() != 1100) sendMessage(_parentScene, 0x2002, 1100); - + AnimatedSprite::update(); - + if (_destPointIndex + _destPointIndexDelta == _pointIndex && _isMoving) { sendMessage(_parentScene, 0x2004, 0); _isMoving = false; } - + } void AsScene2207Elevator::suSetPosition() { @@ -1706,14 +1706,14 @@ void AsScene2207Elevator::moveToY(int16 y) { if (!_pointArray || _pointArray->size() == 0) return; - + for (uint i = 0; i < _pointArray->size(); i++) { int16 distance = ABS(y - (*_pointArray)[i].y); if (distance < minDistance) { minDistance = distance; _destPointIndex = i; } - } + } if (_destPointIndex != _pointIndex) { if (_destPointIndex == 0 || _destPointIndex == (int)_pointArray->size() - 1) @@ -1732,7 +1732,7 @@ void AsScene2207Elevator::moveToY(int16 y) { AsScene2207Lever::AsScene2207Lever(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y, int doDeltaX) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + _x = x; _y = y; createSurface(1010, 71, 73); @@ -1793,7 +1793,7 @@ void AsScene2207Lever::stLeverUpEvent() { AsScene2207WallRobotAnimation::AsScene2207WallRobotAnimation(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1200), _idle(true) { - + _x = 309; _y = 320; createSurface1(0xCCFD6090, 100); @@ -1874,7 +1874,7 @@ void AsScene2207WallRobotAnimation::cbStopAnimation() { AsScene2207WallCannonAnimation::AsScene2207WallCannonAnimation(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200), _idle(true) { - + _x = 309; _y = 320; createSurface1(0x8CAA0099, 100); @@ -1925,7 +1925,7 @@ SsScene2207Symbol::SsScene2207Symbol(NeverhoodEngine *vm, uint32 fileHash, int i _x = 330; _y = 246 + index * 50; - updatePosition(); + updatePosition(); } Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule) @@ -1943,7 +1943,7 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule) _klaymen->setRepl(64, 0); setMessageList(0x004B38E8); _asElevator = insertSprite(this); - + if (getGlobalVar(V_LIGHTS_ON)) { setBackground(0x88C00241); setPalette(0x88C00241); @@ -1952,7 +1952,7 @@ Scene2207::Scene2207(NeverhoodEngine *vm, Module *parentModule) _ssMaskPart2 = insertStaticSprite(0x688F62A5, 1100); _ssMaskPart3 = insertStaticSprite(0x0043B038, 1100); _asTape = insertSprite(this, 4, 1100, 277, 428, 0x9148A011); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); _asLever = insertSprite(this, 527, 333, 0); addCollisionSprite(_asLever); _asWallRobotAnimation = insertSprite(this); @@ -2106,7 +2106,7 @@ static const uint32 kScene2208FileHashes1[] = { 0x041023CB, 0x041020CB, 0x041026CB, 0x04102ACB, 0x041032CB, 0x041002CB }; - + static const uint32 kScene2208FileHashes2[] = { 0x091206C9, 0x091406C9, 0x091806C9, 0x090006C9, 0x093006C9, 0x095006C9 @@ -2122,13 +2122,13 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which) setGlobalVar(V_COLUMN_TEXT_NAME, calcHash("stLineagex")); _textResource.load(getGlobalVar(V_COLUMN_TEXT_NAME)); - + textStart = _textResource.getString(getGlobalVar(V_CLICKED_COLUMN_INDEX), textEnd); while (textStart < textEnd) { _strings.push_back(textStart); textStart += strlen(textStart) + 1; } - + _maxRowIndex = 8 + 10 * (3 - (getGlobalVar(V_COLUMN_TEXT_NAME) == calcHash("stLineagex") ? 1 : 0)); _background = new Background(_vm, 0); @@ -2154,7 +2154,7 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which) _bottomBackgroundSurface = new BaseSurface(_vm, 0, 640, 192, "bottom background"); spriteResource.load(kScene2208FileHashes2[getGlobalVar(V_CLICKED_COLUMN_INDEX) % 6], true); _bottomBackgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0); - + SetUpdateHandler(&Scene2208::update); SetMessageHandler(&Scene2208::handleMessage); @@ -2165,7 +2165,7 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which) if (_newRowIndex < 6) _newRowIndex = 0; _rowScrollY = 0; - _backgroundScrollY = 48 * _newRowIndex; + _backgroundScrollY = 48 * _newRowIndex; _currRowIndex = _newRowIndex; for (int16 rowIndex = 0; rowIndex < _visibleRowsCount; rowIndex++) @@ -2185,7 +2185,7 @@ Scene2208::~Scene2208() { void Scene2208::update() { int16 mouseY = _vm->getMouseY(); - + if (mouseY < 48) { if (_currRowIndex > 0) _newRowIndex = _currRowIndex - 1; @@ -2235,7 +2235,7 @@ uint32 Scene2208::handleMessage(int messageNum, const MessageParam ¶m, Entit } void Scene2208::drawRow(int16 rowIndex) { - NDrawRect sourceRect; + NDrawRect sourceRect; int16 y = (rowIndex * 48) % 528; if (rowIndex < 4) { sourceRect.x = 0; @@ -2280,7 +2280,7 @@ Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene2242::handleMessage); SetUpdateHandler(&Scene2242::update); - + if (getGlobalVar(V_LIGHTS_ON)) { setBackground(0x11840E24); setPalette(0x11840E24); @@ -2297,7 +2297,7 @@ Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) } _asTape = insertSprite(this, 10, 1100, 464, 435, 0x9148A011); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); if (which < 0) { // Restoring game @@ -2380,7 +2380,7 @@ void Scene2242::readClickedColumn() { } static const int16 kHallOfRecordsKlaymenXPos[] = { - 68, 157, 246, 335, + 68, 157, 246, 335, 424, 513, 602 }; @@ -2396,7 +2396,7 @@ static const uint32 kHallOfRecordsSceneMessageListIds1[] = { HallOfRecordsScene::HallOfRecordsScene(NeverhoodEngine *vm, Module *parentModule, int which, uint32 hallOfRecordsInfoId) : Scene(vm, parentModule) { - + _hallOfRecordsInfo = _vm->_staticData->getHallOfRecordsInfoItem(hallOfRecordsInfoId); SetMessageHandler(&HallOfRecordsScene::handleMessage); @@ -2487,7 +2487,7 @@ static const uint32 kScene2247MessageListIds1[] = { Scene2247::Scene2247(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + SetMessageHandler(&Scene2247::handleMessage); SetUpdateHandler(&Scene::update); @@ -2524,7 +2524,7 @@ Scene2247::Scene2247(NeverhoodEngine *vm, Module *parentModule, int which) } _klaymen->setSoundFlag(true); - + } Scene2247::~Scene2247() { diff --git a/engines/neverhood/modules/module2200.h b/engines/neverhood/modules/module2200.h index af7171dd53..5c19f2a818 100644 --- a/engines/neverhood/modules/module2200.h +++ b/engines/neverhood/modules/module2200.h @@ -100,7 +100,7 @@ class SsScene2202PuzzleCube : public StaticSprite { public: SsScene2202PuzzleCube(NeverhoodEngine *vm, Scene *parentScene, int16 cubePosition, int16 cubeSymbol); protected: - Scene *_parentScene; + Scene *_parentScene; int16 _cubeSymbol; int16 _cubePosition; int16 _newX, _newY; @@ -135,7 +135,7 @@ protected: void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); int16 getFreeCubePosition(int16 index); - bool testIsSolved(); + bool testIsSolved(); }; class AsCommonKey : public AnimatedSprite { diff --git a/engines/neverhood/modules/module2300.cpp b/engines/neverhood/modules/module2300.cpp index b434fb98c0..2a46df1ee2 100644 --- a/engines/neverhood/modules/module2300.cpp +++ b/engines/neverhood/modules/module2300.cpp @@ -32,12 +32,12 @@ static const uint32 kModule2300SoundList[] = { Module2300::Module2300(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundVolume(0) { - + _vm->_soundMan->addSoundList(0x1A214010, kModule2300SoundList); _vm->_soundMan->setSoundListParams(kModule2300SoundList, true, 50, 600, 10, 150); _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0; - + if (_isWallBroken) { _vm->_soundMan->setSoundVolume(0x90F0D1C3, 0); _vm->_soundMan->playSoundLooping(0x90F0D1C3); @@ -161,12 +161,12 @@ void Module2300::updateScene() { } else { switch (_sceneNum) { case 1: - if (_isWallBroken && navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 4 && + if (_isWallBroken && navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 4 && navigationScene()->getFrameNumber() % 2) { _soundVolume++; _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume); } - if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 0 && + if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 0 && navigationScene()->getFrameNumber() == 50) { _vm->_soundMan->playTwoSounds(0x1A214010, 0x48498E46, 0x50399F64, 0); _vm->_soundMan->setSoundVolume(0x48498E46, 70); @@ -182,5 +182,5 @@ void Module2300::updateScene() { } } } - + } // End of namespace Neverhood diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 8d3b763f72..3a152543cf 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -26,7 +26,7 @@ namespace Neverhood { Module2400::Module2400(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + _vm->_soundMan->addMusic(0x202D1010, 0xB110382D); if (which < 0) @@ -187,7 +187,7 @@ static const uint32 kAsScene2401WaterSpitFileHashes1[] = { AsScene2401WaterSpit::AsScene2401WaterSpit(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200) { - + _x = 240; _y = 447; createSurface(100, 146, 74); @@ -222,7 +222,7 @@ uint32 AsScene2401WaterSpit::handleMessage(int messageNum, const MessageParam &p AsScene2401FlowingWater::AsScene2401FlowingWater(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200), _isWaterFlowing(false) { - + _x = 88; _y = 421; createSurface1(0x10203116, 100); @@ -262,10 +262,10 @@ uint32 AsScene2401FlowingWater::handleMessage(int messageNum, const MessageParam } return messageResult; } - + AsScene2401WaterFlushing::AsScene2401WaterFlushing(NeverhoodEngine *vm, int16 x, int16 y) : AnimatedSprite(vm, 1200), _countdown(0), _flushLoopCount(0) { - + _x = x; _y = y; createSurface1(0xB8596884, 100); @@ -308,7 +308,7 @@ uint32 AsScene2401WaterFlushing::handleMessage(int messageNum, const MessagePara AsScene2401Door::AsScene2401Door(NeverhoodEngine *vm, bool isOpen) : AnimatedSprite(vm, 1100), _countdown(0), _isOpen(isOpen) { - + _x = 320; _y = 240; createSurface1(0x44687810, 100); @@ -398,7 +398,7 @@ Scene2401::Scene2401(NeverhoodEngine *vm, Module *parentModule, int which) _ssWaterPipes[i] = insertStaticSprite(kScene2401FileHashes1[i], 300); _ssWaterPipes[i]->setVisible(false); } - + _asWaterSpit[0] = insertSprite(); _asWaterSpit[1] = insertSprite(); @@ -461,7 +461,7 @@ void Scene2401::update() { if (_countdown2 != 0 && (--_countdown2) == 0) sendMessage(_asFlowingWater, 0x2003, 0); - + Scene::update(); } @@ -559,7 +559,7 @@ AsScene2402Door::AsScene2402Door(NeverhoodEngine *vm, Scene *parentScene, bool i } else { stopAnimation(); setVisible(false); - } + } SetUpdateHandler(&AsScene2402Door::update); SetMessageHandler(&AsScene2402Door::handleMessage); } @@ -654,7 +654,7 @@ void AsScene2402TV::upFocusKlaymen() { _newStickFrameIndex = _currFrameIndex; if (_countdown2 == 0) { _vm->_soundMan->addSound(0x01520123, 0xC42D4528); - _vm->_soundMan->playSoundLooping(0xC42D4528); + _vm->_soundMan->playSoundLooping(0xC42D4528); } _countdown2 = 5; } else if (_countdown2 != 0 && (--_countdown2 == 0)) @@ -698,7 +698,7 @@ Scene2402::Scene2402(NeverhoodEngine *vm, Module *parentModule, int which) _asTape = insertSprite(this, 9, 1100, 286, 409, 0x9148A011); addCollisionSprite(_asTape); _ssButton = insertSprite(this, 0x15288120, 100, 0); - + if (which < 0) { // Restoring game insertKlaymen(198, 404); @@ -779,7 +779,7 @@ uint32 Scene2402::handleMessage(int messageNum, const MessageParam ¶m, Entit } return messageResult; } - + void Scene2402::playPipeSound(uint32 fileHash) { playSound(_soundToggle ? 0 : 1, fileHash); _soundToggle = !_soundToggle; @@ -787,7 +787,7 @@ void Scene2402::playPipeSound(uint32 fileHash) { Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + Sprite *tempSprite1, *tempSprite2, *tempSprite3; SetMessageHandler(&Scene2403::handleMessage); @@ -799,7 +799,7 @@ Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which) addCollisionSprite(_asTape); _asLightCord = insertSprite(this, 0xA1095A10, 0x836D3813, 368, 200); _asLightCord->setClipRect(0, 25, 640, 480); - + if (which < 0) { // Restoring game _isClimbingLadder = false; @@ -828,11 +828,11 @@ Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which) } _ssButton = insertSprite(this, 0x3130B0EB, 100, 0); - tempSprite1 = insertStaticSprite(0x20C24220, 1100); + tempSprite1 = insertStaticSprite(0x20C24220, 1100); tempSprite2 = insertStaticSprite(0x03080900, 1300); tempSprite3 = insertSprite(_klaymen); tempSprite3->setClipRect(tempSprite1->getDrawRect().x, 0, 640, tempSprite2->getDrawRect().y2()); - _klaymen->setClipRect(tempSprite1->getDrawRect().x, 0, 640, tempSprite2->getDrawRect().y2()); + _klaymen->setClipRect(tempSprite1->getDrawRect().x, 0, 640, tempSprite2->getDrawRect().y2()); loadSound(1, calcHash("fxFogHornSoft")); } @@ -887,7 +887,7 @@ Scene2406::Scene2406(NeverhoodEngine *vm, Module *parentModule, int which) setGlobalVar(V_KEY3_LOCATION, 2); SetMessageHandler(&Scene2406::handleMessage); - + setRectList(0x004B78C8); insertScreenMouse(0xB03001A8); @@ -913,7 +913,7 @@ Scene2406::Scene2406(NeverhoodEngine *vm, Module *parentModule, int which) setPalette(0x0A038595); tempSprite1 = insertStaticSprite(0x1712112A, 1100); } - + tempSprite2 = insertStaticSprite(0x22300924, 1300); _clipRects[1].x1 = tempSprite1->getDrawRect().x; _clipRects[1].y1 = tempSprite2->getDrawRect().y; diff --git a/engines/neverhood/modules/module2500.cpp b/engines/neverhood/modules/module2500.cpp index e3a3b74280..1b525f12af 100644 --- a/engines/neverhood/modules/module2500.cpp +++ b/engines/neverhood/modules/module2500.cpp @@ -51,7 +51,7 @@ static const NRect kScene2508ClipRect2 = NRect(0, 0, 594, 448); Module2500::Module2500(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundIndex(0) { - + _vm->_soundMan->addMusic(0x29220120, 0x05343184); _vm->_soundMan->startMusic(0x05343184, 0, 0); SetMessageHandler(&Module2500::handleMessage); @@ -212,14 +212,14 @@ uint32 Module2500::handleMessage(int messageNum, const MessageParam ¶m, Enti } return messageResult; } - + void Module2500::createScene2704(int which, uint32 sceneInfoId, int16 value, const uint32 *staticSprites, const NRect *clipRect) { _childObject = new Scene2704(_vm, this, which, sceneInfoId, value, staticSprites, clipRect); } Scene2501::Scene2501(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B2628)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B264C)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B2670)); @@ -282,7 +282,7 @@ Scene2501::Scene2501(NeverhoodEngine *vm, Module *parentModule, int which) _asCarTrackShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); _asCarConnectorShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); insertSprite(_asCar); - + _newTrackIndex = -1; _dataResource.load(calcHash("Ashooded")); @@ -300,9 +300,9 @@ Scene2501::Scene2501(NeverhoodEngine *vm, Module *parentModule, int which) if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480) sendMessage(_asCar, 0x2008, 150); } - + _carStatus = 0; - + } Scene2501::~Scene2501() { @@ -391,7 +391,7 @@ uint32 Scene2501::handleMessage(int messageNum, const MessageParam ¶m, Entit } return messageResult; } - + uint32 Scene2501::hmRidingCar(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Scene::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -434,7 +434,7 @@ uint32 Scene2501::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity } return messageResult; } - + void Scene2501::moveCarToPoint(NPoint &pt) { int minMatchTrackIndex, minMatchDistance; _tracks.findTrackPoint(pt, minMatchTrackIndex, minMatchDistance, _dataResource); @@ -472,7 +472,7 @@ void Scene2501::updateKlaymenClipRect() { SsScene2504Button::SsScene2504Button(NeverhoodEngine *vm) : StaticSprite(vm, 1400), _countdown(0), _isSoundPlaying(false) { - + loadSprite(0x070220D9, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x4600204C); @@ -520,9 +520,9 @@ uint32 SsScene2504Button::handleMessage(int messageNum, const MessageParam ¶ Scene2504::Scene2504(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + Sprite *ssButton; - + setBackground(0x90791B80); setPalette(0x90791B80); ssButton = insertSprite(); diff --git a/engines/neverhood/modules/module2600.cpp b/engines/neverhood/modules/module2600.cpp index 56b4c65f8d..2fce82b777 100644 --- a/engines/neverhood/modules/module2600.cpp +++ b/engines/neverhood/modules/module2600.cpp @@ -35,7 +35,7 @@ static const uint32 kModule2600SoundList[] = { Module2600::Module2600(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule) { - + if (which < 0) createScene(_vm->gameState().sceneNum, -1); else if (which == 1) @@ -218,10 +218,10 @@ void Module2600::updateScene() { } } } - + SsScene2609Button::SsScene2609Button(NeverhoodEngine *vm, Scene *parentScene) : StaticSprite(vm, 1400), _parentScene(parentScene), _countdown(0) { - + SetUpdateHandler(&SsScene2609Button::update); SetMessageHandler(&SsScene2609Button::handleMessage); @@ -273,7 +273,7 @@ uint32 SsScene2609Button::handleMessage(int messageNum, const MessageParam ¶ AsScene2609Water::AsScene2609Water(NeverhoodEngine *vm) : AnimatedSprite(vm, 1000) { - + _x = 240; _y = 420; setDoDeltaX(1); @@ -309,7 +309,7 @@ uint32 AsScene2609Water::handleMessage(int messageNum, const MessageParam ¶m Scene2609::Scene2609(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _isBusy(false) { - + SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene2609::handleMessage); diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index e9ea10bd16..f8f3c71042 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -84,7 +84,7 @@ static const uint32 kScene2725StaticSprites[] = { Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false) { - + _vm->_soundMan->addMusic(0x42212411, 0x04020210); _vm->_soundMan->startMusic(0x04020210, 24, 2); SetMessageHandler(&Module2700::handleMessage); @@ -527,7 +527,7 @@ uint32 Module2700::handleMessage(int messageNum, const MessageParam ¶m, Enti } return messageResult; } - + void Module2700::createScene2703(int which, uint32 trackInfoId) { _childObject = new Scene2703(_vm, this, which, trackInfoId); } @@ -545,7 +545,7 @@ static const NPoint kCarShadowOffsets[] = { SsCommonTrackShadowBackground::SsCommonTrackShadowBackground(NeverhoodEngine *vm, uint32 fileHash) : StaticSprite(vm, 0) { - + loadSprite(fileHash, kSLFDefDrawOffset | kSLFDefPosition, 0); } @@ -555,7 +555,7 @@ AsCommonCarShadow::AsCommonCarShadow(NeverhoodEngine *vm, AnimatedSprite *asCar, SetUpdateHandler(&AsCommonCarShadow::update); createShadowSurface(shadowSurface, 211, 147, 100); updateShadow(); -} +} void AsCommonCarShadow::update() { updateShadow(); @@ -589,8 +589,8 @@ AsCommonCarConnectorShadow::AsCommonCarConnectorShadow(NeverhoodEngine *vm, Spri SetUpdateHandler(&AsCommonCarConnectorShadow::update); createShadowSurface1(shadowSurface, 0x60281C10, 150); startAnimation(0x60281C10, -1, -1); - _newStickFrameIndex = STICK_LAST_FRAME; -} + _newStickFrameIndex = STICK_LAST_FRAME; +} void AsCommonCarConnectorShadow::update() { _x = _asCar->getX() + kCarShadowOffsets[_index].x; @@ -605,7 +605,7 @@ AsCommonCarTrackShadow::AsCommonCarTrackShadow(NeverhoodEngine *vm, Sprite *asCa createShadowSurface1(shadowSurface, 0x0759129C, 100); startAnimation(0x0759129C, frameIndex, -1); _newStickFrameIndex = frameIndex; -} +} void AsCommonCarTrackShadow::update() { _x = _asCar->getX(); @@ -615,19 +615,19 @@ void AsCommonCarTrackShadow::update() { Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + Sprite *tempSprite; - + NRect clipRect; TrackInfo *tracks = _vm->_staticData->getTrackInfo(0x004B2240); setGlobalVar(V_CAR_DELTA_X, 1); - + setBackground(tracks->bgFilename); setPalette(tracks->bgFilename); _palette->addPalette(calcHash("paPodFloor"), 65, 31, 65); _palette->addPalette(calcHash("paKlayFloor"), 0, 65, 0); insertScreenMouse(0x08B08180); - + tempSprite = insertStaticSprite(0x1E086325, 1200); clipRect.set(0, 0, 640, tempSprite->getDrawRect().y2()); @@ -661,7 +661,7 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) if (testPoint.x < 0 || testPoint.x >= 640 || testPoint.y < 0 || testPoint.y >= 480) sendMessage(_asCar, 0x2008, 150); } - + _asCar->setClipRect(clipRect); _asCarConnector->setClipRect(clipRect); @@ -715,10 +715,10 @@ uint32 Scene2701::hmCarAtHome(int messageNum, const MessageParam ¶m, Entity Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _isInLight(true), _newTrackIndex(-1) { - + SetMessageHandler(&Scene2702::handleMessage); SetUpdateHandler(&Scene2702::update); - + setBackground(0x18808B00); setPalette(0x18808B00); _palette->addPalette(calcHash("paPodFloor"), 65, 31, 65); @@ -734,7 +734,7 @@ Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which) _asCarTrackShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); _asCarConnectorShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); _dataResource.load(0x04310014); - + if (which == 1) { _isUpperTrack = false; _currTrackIndex = 1; @@ -765,11 +765,11 @@ Scene2702::Scene2702(NeverhoodEngine *vm, Module *parentModule, int which) } if (_isUpperTrack) { - _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5F68)); + _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5F68)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5F8C)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FB0)); } else { - _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FD8)); + _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FD8)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B5FFC)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B6020)); } @@ -873,19 +873,19 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 : Scene(vm, parentModule) { TrackInfo *tracks = _vm->_staticData->getTrackInfo(trackInfoId); - + SetMessageHandler(&Scene2703::handleMessage); SetUpdateHandler(&Scene2703::update); - + setBackground(tracks->bgFilename); setPalette(tracks->bgFilename); _palette->addPalette(calcHash("paPodShade"), 65, 31, 65); _palette->addPalette(calcHash("paKlayShade"), 0, 65, 0); addEntity(_palette); insertScreenMouse(tracks->mouseCursorFilename); - + _palStatus = 2; - + if (tracks->bgShadowFilename) { _ssTrackShadowBackground = createSprite(tracks->bgShadowFilename); addEntity(_ssTrackShadowBackground); @@ -905,7 +905,7 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 _dataResource.load(tracks->dataResourceFilename); _trackPoints = _dataResource.getPointArray(tracks->trackPointsName); _asCar->setPathPoints(_trackPoints); - + if (which == _which2) { NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1]; sendMessage(_asCar, 0x2002, _trackPoints->size() - 1); @@ -921,7 +921,7 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 else sendMessage(_asCar, 0x2008, 150); } - + if (which == 0) { _palette->addPalette(calcHash("paPodShade"), 65, 31, 65); _palette->addPalette(calcHash("paKlayShade"), 0, 65, 0); @@ -931,9 +931,9 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 _palette->addPalette(calcHash("paKlayBlack"), 0, 65, 0); _palStatus = 0; } - + _palette->copyBasePalette(0, 256, 0); - + } void Scene2703::update() { @@ -981,16 +981,16 @@ uint32 Scene2703::handleMessage(int messageNum, const MessageParam ¶m, Entit } return 0; } - + Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint32 trackInfoId, int16 value, const uint32 *staticSprites, const NRect *clipRect) : Scene(vm, parentModule) { TrackInfo *tracks = _vm->_staticData->getTrackInfo(trackInfoId); - + SetMessageHandler(&Scene2704::handleMessage); SetUpdateHandler(&Scene2704::update); - + setBackground(tracks->bgFilename); setPalette(tracks->bgFilename); @@ -999,12 +999,12 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 if (tracks->exPaletteFilename2) _palette->addPalette(tracks->exPaletteFilename2, 65, 31, 65); - + while (staticSprites && *staticSprites) insertStaticSprite(*staticSprites++, 1100); insertScreenMouse(tracks->mouseCursorFilename); - + if (tracks->bgShadowFilename) { _ssTrackShadowBackground = createSprite(tracks->bgShadowFilename); addEntity(_ssTrackShadowBackground); @@ -1024,7 +1024,7 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 _dataResource.load(tracks->dataResourceFilename); _trackPoints = _dataResource.getPointArray(tracks->trackPointsName); _asCar->setPathPoints(_trackPoints); - + if (which == _which2) { NPoint testPoint = (*_trackPoints)[_trackPoints->size() - 1]; sendMessage(_asCar, 0x2002, _trackPoints->size() - 1); @@ -1040,21 +1040,21 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 else sendMessage(_asCar, 0x2008, 0); } - + if (clipRect) { _asCar->getClipRect() = *clipRect; if (_asCarShadow) - _asCarShadow->getClipRect() = *clipRect; + _asCarShadow->getClipRect() = *clipRect; if (_asCarTrackShadow) - _asCarTrackShadow->getClipRect() = *clipRect; + _asCarTrackShadow->getClipRect() = *clipRect; if (_asCarConnectorShadow) - _asCarConnectorShadow->getClipRect() = *clipRect; + _asCarConnectorShadow->getClipRect() = *clipRect; if (_asCarConnector) _asCarConnector->getClipRect() = *clipRect; } } - + void Scene2704::update() { Scene::update(); if (_mouseClicked) { @@ -1083,24 +1083,24 @@ uint32 Scene2704::handleMessage(int messageNum, const MessageParam ¶m, Entit Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _newTrackIndex(-1) { - + SetMessageHandler(&Scene2706::handleMessage); - _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22A0)); + _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22A0)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22C4)); _tracks.push_back(_vm->_staticData->getTrackInfo(0x004B22E8)); - + setBackground(0x18808B88); setPalette(0x18808B88); - + _palette->addPalette(calcHash("paPodShade"), 65, 31, 65); _palette->addPalette(calcHash("paKlayShade"), 0, 65, 0); - + insertScreenMouse(0x08B8C180); _ssTrackShadowBackground = createSprite(0x18808B88); addEntity(_ssTrackShadowBackground); - + _asCar = insertSprite(this, 320, 240); _asCarShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); _asCarConnector = insertSprite(_asCar); @@ -1108,10 +1108,10 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) _asCarConnectorShadow = insertSprite(_asCar, _ssTrackShadowBackground->getSurface(), 4); _dataResource.load(0x06000162); - + if (which == 5) _currTrackIndex = 2; - else if (which == 6) + else if (which == 6) _currTrackIndex = 1; else _currTrackIndex = 0; @@ -1123,16 +1123,16 @@ Scene2706::Scene2706(NeverhoodEngine *vm, Module *parentModule, int which) sendMessage(_asCar, 0x2002, _trackPoints->size() - 1); if (which == 5) sendMessage(_asCar, 0x2007, 50); - else + else sendMessage(_asCar, 0x2007, 150); } else { sendMessage(_asCar, 0x2002, 0); if (which == 5) sendMessage(_asCar, 0x2008, 50); - else + else sendMessage(_asCar, 0x2008, 150); } - + } uint32 Scene2706::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -1192,7 +1192,7 @@ void Scene2706::changeTrack() { Scene2732::Scene2732(NeverhoodEngine *vm, Module *parentModule) : Scene(vm, parentModule) { - + Sprite *tempSprite; setBackground(0x0220C041); diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index a64bdc8b32..1c0f9fc9fb 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -36,7 +36,7 @@ Module2800::Module2800(NeverhoodEngine *vm, Module *parentModule, int which) _currentMusicFileHash = 0; _vm->_soundMan->addMusic(0x64210814, 0xD2FA4D14); setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 1); - + if (which < 0) { createScene(_vm->gameState().sceneNum, which); } else if (which == 2) { @@ -224,7 +224,7 @@ void Module2800::updateScene() { _musicResource = NULL; } _currentMusicFileHash = 0; - } + } if (_moduleResult == 1) { createScene(2, 0); } else if (_moduleResult == 2) { @@ -251,7 +251,7 @@ void Module2800::updateScene() { createScene(9, 0); else if (_moduleResult == 5) createScene(25, 0); - else + else createScene(0, 1); break; case 3: @@ -318,7 +318,7 @@ void Module2800::updateScene() { createScene(22, 0); else if (_moduleResult == 22) createScene(23, 0); - else + else createScene(2, 4); break; case 10: @@ -331,7 +331,7 @@ void Module2800::updateScene() { createScene(26, 0); else if (_moduleResult == 3) createScene(9, 5); - else + else createScene(9, 1); break; case 12: @@ -401,7 +401,7 @@ void Module2800::updateMusic(bool halfVolume) { if (!_musicResource) _musicResource = new MusicResource(_vm); - + if (newMusicFileHash != _currentMusicFileHash) { _currentMusicFileHash = newMusicFileHash; if (_currentMusicFileHash != 0) { @@ -469,7 +469,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(_sprite1->getDrawRect().x, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x0066201C); _asTape = insertSprite(this, 8, 1100, 302, 437, 0x9148A011); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else if (getGlobalVar(V_RADIO_ROOM_RIGHT_DOOR)) { setRectList(0x004B6CD0); setBackground(0x11E00684); @@ -480,7 +480,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x00680116); _asTape = insertSprite(this, 8, 1100, 302, 437, 0x01142428); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } else { setRectList(0x004B6CF0); setBackground(0x030006E6); @@ -491,9 +491,9 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _klaymen->setClipRect(0, 0, _sprite2->getDrawRect().x2(), 480); insertScreenMouse(0x006E2038); _asTape = insertSprite(this, 8, 1100, 302, 437, 0x9148A011); - addCollisionSprite(_asTape); + addCollisionSprite(_asTape); } - + addEntity(_palette); if (which == 1) { @@ -503,7 +503,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which) _palette->addPalette(_paletteHash, 0, 65, 0); _palette->addBasePalette(_paletteHash, 0, 65, 0); } - + } Scene2801::~Scene2801() { @@ -565,7 +565,7 @@ Scene2802::~Scene2802() { } setGlobalVar(V_CURR_RADIO_MUSIC_INDEX, _currRadioMusicIndex); } - + void Scene2802::update() { int prevTuneStatus = _currTuneStatus; uint prevRadioMusicIndex = _currRadioMusicIndex; @@ -577,7 +577,7 @@ void Scene2802::update() { _currTuneStatus = 3; else if (_currTuneStatus == 4) _currTuneStatus = 6; - + switch (_currTuneStatus) { case 2: if (_currRadioMusicIndex < 90) @@ -607,20 +607,20 @@ void Scene2802::update() { } else _currTuneStatus = 0; break; - + } if (prevRadioMusicIndex != _currRadioMusicIndex) _smackerPlayer->gotoFrame(_currRadioMusicIndex); - + if (prevTuneStatus != _currTuneStatus) changeTuneStatus(prevTuneStatus, _currTuneStatus); - + if (getGlobalVar(V_RADIO_MOVE_DISH_VIDEO) && prevTuneStatus != _currTuneStatus && _currRadioMusicIndex != 0) { setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 0); leaveScene(1); } - + } uint32 Scene2802::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -758,7 +758,7 @@ void AsScene2803LightCord::setFileHashes(uint32 fileHash1, uint32 fileHash2) { AsScene2803TestTubeOne::AsScene2803TestTubeOne(NeverhoodEngine *vm, uint32 fileHash1, uint32 fileHash2) : AnimatedSprite(vm, 1200), _fileHash1(fileHash1), _fileHash2(fileHash2) { - + createSurface1(fileHash1, 100); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2803TestTubeOne::handleMessage); @@ -781,7 +781,7 @@ uint32 AsScene2803TestTubeOne::handleMessage(int messageNum, const MessageParam AsScene2803Rope::AsScene2803Rope(NeverhoodEngine *vm, Scene *parentScene, int16 x) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + createSurface(990, 68, 476); SetUpdateHandler(&AnimatedSprite::update); SetSpriteUpdate(&AnimatedSprite::updateDeltaXY); @@ -837,7 +837,7 @@ void AsScene2803Rope::stHide() { Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _paletteArea(0) { - + static const uint32 kScene2803FileHashes1[] = { 0, 0x081000F1, @@ -854,20 +854,20 @@ Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) setGlobalVar(V_BEEN_SHRINKING_ROOM, 1); _vm->gameModule()->initTestTubes1Puzzle(); - + SetMessageHandler(&Scene2803::handleMessage); - + loadDataResource(0x00900849); - + _background = new Background(_vm, 0); _background->createSurface(0, 640, 480); addBackground(_background); - + setPalette(0x412A423E); addEntity(_palette); - + insertScreenMouse(0xA423A41A); - + if (getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0) == 0) { _asTestTubeOne = (StaticSprite*)insertStaticSprite(0x66121222, 100); } else { @@ -875,13 +875,13 @@ Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) kScene2803FileHashes1[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0)], kScene2803FileHashes2[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0)]); } - + if (getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 1) == 3) _asTestTubeTwo = (StaticSprite*)insertStaticSprite(0x64330236, 100); if (getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2) == 3) _asTestTubeThree = (StaticSprite*)insertStaticSprite(0x2E4A22A2, 100); - + _asLightCord = insertSprite(this, 0x8FAD5932, 0x276E1A3D, 578, 200); _sprite3 = (StaticSprite*)insertStaticSprite(0xA40EF2FB, 1100); _sprite4 = (StaticSprite*)insertStaticSprite(0x0C03AA23, 1100); @@ -896,7 +896,7 @@ Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) _clipRectsFloor[0].y1 = 0; _clipRectsFloor[0].x2 = 640; _clipRectsFloor[0].y2 = _sprite8->getDrawRect().y2(); - + _clipRectsFloor[1].x1 = _sprite8->getDrawRect().x2(); _clipRectsFloor[1].y1 = _sprite8->getDrawRect().y2(); _clipRectsFloor[1].x2 = 640; @@ -906,12 +906,12 @@ Scene2803::Scene2803(NeverhoodEngine *vm, Module *parentModule, int which) _clipRectsStairs[0].y1 = 0; _clipRectsStairs[0].x2 = _sprite5->getDrawRect().x2(); _clipRectsStairs[0].y2 = _sprite5->getDrawRect().y2(); - + _clipRectsStairs[1].x1 = _sprite6->getDrawRect().x; _clipRectsStairs[1].y1 = 0; _clipRectsStairs[1].x2 = _sprite3->getDrawRect().x; _clipRectsStairs[1].y2 = _sprite6->getDrawRect().y2(); - + _clipRectsStairs[2].x1 = _sprite3->getDrawRect().x; _clipRectsStairs[2].y1 = 0; _clipRectsStairs[2].x2 = _sprite4->getDrawRect().x2(); @@ -1112,7 +1112,7 @@ Scene2803Small::Scene2803Small(NeverhoodEngine *vm, Module *parentModule, int wh static const uint32 kScene2803SmallFileHashes2[] = { 0, 0x286800D4, 0x286806D4, 0x28680AD4 }; - + SetMessageHandler(&Scene2803Small::handleMessage); loadDataResource(0x81120132); @@ -1160,7 +1160,7 @@ Scene2803Small::Scene2803Small(NeverhoodEngine *vm, Module *parentModule, int wh if (getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2) == 3) insertStaticSprite(0x30022689, 100); } - + _sprite6->setVisible(false); _sprite7->setVisible(false); @@ -1352,7 +1352,7 @@ void Scene2803Small::updatePaletteArea(bool instantly) { SsScene2804RedButton::SsScene2804RedButton(NeverhoodEngine *vm, Scene2804 *parentScene) : StaticSprite(vm, 900), _countdown(0), _parentScene(parentScene) { - + loadSprite(getGlobalVar(V_SHRINK_LIGHTS_ON) ? 0x51A10202 : 0x11814A21, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); SetUpdateHandler(&SsScene2804RedButton::update); @@ -1385,7 +1385,7 @@ uint32 SsScene2804RedButton::handleMessage(int messageNum, const MessageParam &p SsScene2804LightCoil::SsScene2804LightCoil(NeverhoodEngine *vm) : StaticSprite(vm, 900) { - + loadSprite(0x8889B008, kSLFDefDrawOffset | kSLFDefPosition, 400); setVisible(false); SetMessageHandler(&SsScene2804LightCoil::handleMessage); @@ -1410,7 +1410,7 @@ uint32 SsScene2804LightCoil::handleMessage(int messageNum, const MessageParam &p SsScene2804LightTarget::SsScene2804LightTarget(NeverhoodEngine *vm) : StaticSprite(vm, 900) { - + loadSprite(0x06092132, kSLFDefDrawOffset | kSLFDefPosition, 400); setVisible(false); SetMessageHandler(&SsScene2804LightTarget::handleMessage); @@ -1435,7 +1435,7 @@ uint32 SsScene2804LightTarget::handleMessage(int messageNum, const MessageParam SsScene2804Flash::SsScene2804Flash(NeverhoodEngine *vm) : StaticSprite(vm, 900) { - + loadSprite(0x211003A0, kSLFDefDrawOffset | kSLFDefPosition, 400); setVisible(false); loadSound(0, 0xCB36BA54); @@ -1449,7 +1449,7 @@ void SsScene2804Flash::show() { SsScene2804BeamCoilBody::SsScene2804BeamCoilBody(NeverhoodEngine *vm) : StaticSprite(vm, 900) { - + loadSprite(0x9A816000, kSLFDefDrawOffset | kSLFDefPosition, 400); setVisible(false); } @@ -1585,7 +1585,7 @@ SsScene2804CrystalButton::SsScene2804CrystalButton(NeverhoodEngine *vm, Scene280 0xA8042525, 0x5008292B }; - + loadSprite(getGlobalVar(V_SHRINK_LIGHTS_ON) ? kSsScene2804CrystalButtonFileHashes1[crystalIndex] : kSsScene2804CrystalButtonFileHashes2[crystalIndex], kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); @@ -1619,7 +1619,7 @@ uint32 SsScene2804CrystalButton::handleMessage(int messageNum, const MessagePara AsScene2804BeamCoil::AsScene2804BeamCoil(NeverhoodEngine *vm, Scene *parentScene, SsScene2804BeamCoilBody *ssBeamCoilBody) : AnimatedSprite(vm, 1400), _parentScene(parentScene), _ssBeamCoilBody(ssBeamCoilBody), _countdown(0) { - + createSurface1(0x00494891, 1000); _x = 125; _y = 184; @@ -1659,7 +1659,7 @@ uint32 AsScene2804BeamCoil::handleMessage(int messageNum, const MessageParam &pa } return messageResult; } - + void AsScene2804BeamCoil::show() { _ssBeamCoilBody->setVisible(true); setVisible(true); @@ -1695,7 +1695,7 @@ uint32 AsScene2804BeamCoil::hmBeaming(int messageNum, const MessageParam ¶m, AsScene2804BeamTarget::AsScene2804BeamTarget(NeverhoodEngine *vm) : AnimatedSprite(vm, 1400) { - + createSurface1(0x03842000, 1000); _x = 475; _y = 278; @@ -1750,7 +1750,7 @@ Scene2804::Scene2804(NeverhoodEngine *vm, Module *parentModule, int which) _asTarget = insertSprite(); _ssFlash = insertSprite(); } - + _ssRedButton = insertSprite(this); addCollisionSprite(_ssRedButton); @@ -1797,7 +1797,7 @@ uint32 Scene2804::handleMessage(int messageNum, const MessageParam ¶m, Entit void Scene2804::update() { Scene::update(); - + if (_countdown1 != 0 && (--_countdown1) == 0) { leaveScene(0); } @@ -1836,7 +1836,7 @@ void Scene2804::update() { Scene2805::Scene2805(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + SetMessageHandler(&Scene2805::handleMessage); setBackground(0x08021E04); @@ -1894,7 +1894,7 @@ uint32 Scene2805::handleMessage(int messageNum, const MessageParam ¶m, Entit AsScene2806Spew::AsScene2806Spew(NeverhoodEngine *vm) : AnimatedSprite(vm, 1200) { - + createSurface1(0x04211490, 1200); _x = 378; _y = 423; @@ -1919,7 +1919,7 @@ uint32 AsScene2806Spew::handleMessage(int messageNum, const MessageParam ¶m, } return messageResult; } - + Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { @@ -1927,16 +1927,16 @@ Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene2806::handleMessage); SetUpdateHandler(&Scene2806::update); - + loadDataResource(0x98182003); loadHitRectList(); - + _pointList = _dataResource.getPointArray(0x3606A422); - insertScreenMouse(0x22114C13); + insertScreenMouse(0x22114C13); setBackground(0xC1B22110); setPalette(0xC1B22110); - + _sprite1 = insertStaticSprite(0xA21F82CB, 1100); _clipRects[0].x1 = _sprite1->getDrawRect().x; _clipRects[0].y1 = _sprite1->getDrawRect().y; @@ -1951,7 +1951,7 @@ Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which) _sprite4 = insertStaticSprite(0x72090342, 1100); _clipRects[1].x1 = _sprite4->getDrawRect().x; _clipRects[1].y1 = _sprite4->getDrawRect().y; - + tempSprite = insertStaticSprite(0xD2012C02, 1100); _clipRects[2].x1 = tempSprite->getDrawRect().x; _clipRects[2].y2 = tempSprite->getDrawRect().y2(); @@ -2027,7 +2027,7 @@ void Scene2806::findClosestPoint() { int16 x = MIN(_klaymen->getX(), 639); int index = 1; - + while (index < (int)_pointList->size() && (*_pointList)[index].x < x) ++index; --index; @@ -2036,12 +2036,12 @@ void Scene2806::findClosestPoint() { _pointIndex = index; _palette->addPalette(kScene2806PaletteFileHashes[index], 0, 64, 0); } - + } Scene2807::Scene2807(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { - + SetMessageHandler(&Scene2807::handleMessage); if (getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0) == 1) { @@ -2136,7 +2136,7 @@ static const int16 kClass490FrameIndices2[] = { SsScene2808Dispenser::SsScene2808Dispenser(NeverhoodEngine *vm, Scene *parentScene, int testTubeSetNum, int testTubeIndex) : StaticSprite(vm, 900), _parentScene(parentScene), _countdown(0), _testTubeSetNum(testTubeSetNum), _testTubeIndex(testTubeIndex) { - + loadSprite(kClass428FileHashes[testTubeSetNum * 3 + testTubeIndex], kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 1500); setVisible(false); SetUpdateHandler(&SsScene2808Dispenser::update); @@ -2149,7 +2149,7 @@ void SsScene2808Dispenser::update() { setVisible(false); } } - + uint32 SsScene2808Dispenser::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -2197,16 +2197,16 @@ AsScene2808TestTube::AsScene2808TestTube(NeverhoodEngine *vm, int testTubeSetNum loadSound(7, 0x70A43D2D); loadSound(8, 0xF0601E2D); } - + startAnimation(kClass490FileHashes[testTubeIndex], 0, -1); _newStickFrameIndex = 0; - + SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2808TestTube::handleMessage); - + if (_fillLevel == 0) setVisible(false); - + } uint32 AsScene2808TestTube::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -2253,7 +2253,7 @@ void AsScene2808TestTube::flush() { AsScene2808Handle::AsScene2808Handle(NeverhoodEngine *vm, Scene *parentScene, int testTubeSetNum) : AnimatedSprite(vm, 1300), _parentScene(parentScene), _testTubeSetNum(testTubeSetNum), _isActivated(false) { - + loadSound(0, 0xE18D1F30); _x = 320; _y = 240; @@ -2325,7 +2325,7 @@ AsScene2808Flow::AsScene2808Flow(NeverhoodEngine *vm, Scene *parentScene, int te SetUpdateHandler(&AnimatedSprite::update); AnimatedSprite::updatePosition(); } - + uint32 AsScene2808Flow::hmFlowing(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -2351,7 +2351,7 @@ void AsScene2808Flow::stKeepFlowing() { AsScene2808LightEffect::AsScene2808LightEffect(NeverhoodEngine *vm, int testTubeSetNum) : AnimatedSprite(vm, 800), _countdown(1) { - + _x = 320; _y = 240; if (testTubeSetNum == 1) @@ -2381,7 +2381,7 @@ Scene2808::Scene2808(NeverhoodEngine *vm, Module *parentModule, int which) _vm->gameModule()->initTestTubes1Puzzle(); else _vm->gameModule()->initTestTubes2Puzzle(); - + SetMessageHandler(&Scene2808::handleMessage); SetUpdateHandler(&Scene2808::update); @@ -2400,7 +2400,7 @@ Scene2808::Scene2808(NeverhoodEngine *vm, Module *parentModule, int which) _asTestTubes[testTubeIndex] = insertSprite(which, testTubeIndex, ssDispenser); addCollisionSprite(_asTestTubes[testTubeIndex]); } - + insertScreenMouse(kScene2808FileHashes2[which]); } @@ -2498,13 +2498,13 @@ Scene2809::Scene2809(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule) { Sprite *tempSprite; - + SetMessageHandler(&Scene2809::handleMessage); SetUpdateHandler(&Scene2809::update); - + loadDataResource(0x1830009A); loadHitRectList(); - + _pointList = _dataResource.getPointArray(0x064A310E); setBackground(0xB22116C5); @@ -2535,7 +2535,7 @@ Scene2809::Scene2809(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x877F6252, 1100); _clipRects[3].x2 = tempSprite->getDrawRect().x2(); - + insertStaticSprite(0x01612A22, 1100); insertStaticSprite(0x877F6252, 1100); @@ -2610,7 +2610,7 @@ void Scene2809::findClosestPoint() { _pointIndex = index; _palette->addPalette(kScene2809PaletteFileHashes[index], 0, 64, 0); } - + } AsScene2810Rope::AsScene2810Rope(NeverhoodEngine *vm, Scene *parentScene, int16 x) @@ -2647,7 +2647,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) Sprite *tempSprite; SetMessageHandler(&Scene2810::handleMessage); - + setBackground(0x26508804); setPalette(0x26508804); insertScreenMouse(0x0880026D); @@ -2683,7 +2683,7 @@ Scene2810::Scene2810(NeverhoodEngine *vm, Module *parentModule, int which) } _sprite4->setClipRect(0, _sprite1->getDrawRect().y, 640, 480); } - + if (which < 0) { if (getGlobalVar(V_KLAYMEN_SMALL)) { insertKlaymen(240, 448); @@ -2864,7 +2864,7 @@ uint32 Scene2810::handleMessage(int messageNum, const MessageParam ¶m, Entit AsScene2812Winch::AsScene2812Winch(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { - + createSurface1(0x20DA08A0, 1200); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2812Winch::handleMessage); @@ -2895,7 +2895,7 @@ uint32 AsScene2812Winch::handleMessage(int messageNum, const MessageParam ¶m AsScene2812Rope::AsScene2812Rope(NeverhoodEngine *vm, Scene *parentScene) : AnimatedSprite(vm, 1100), _parentScene(parentScene) { - + createSurface(990, 68, 476); SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene2812Rope::handleMessage); @@ -2940,7 +2940,7 @@ void AsScene2812Rope::stRopingDown() { AsScene2812TrapDoor::AsScene2812TrapDoor(NeverhoodEngine *vm) : AnimatedSprite(vm, 0x805D0029, 100, 320, 240) { - + SetMessageHandler(&AsScene2812TrapDoor::handleMessage); _newStickFrameIndex = 0; } @@ -2959,15 +2959,15 @@ uint32 AsScene2812TrapDoor::handleMessage(int messageNum, const MessageParam &pa Scene2812::Scene2812(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _paletteArea(0) { - + if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0) setGlobalVar(V_KEY3_LOCATION, 3); SetMessageHandler(&Scene2812::handleMessage); SetUpdateHandler(&Scene2812::update); - + setRectList(0x004AF700); - + setBackground(0x03600606); setPalette(0x03600606); addEntity(_palette); @@ -2983,7 +2983,7 @@ Scene2812::Scene2812(NeverhoodEngine *vm, Module *parentModule, int which) _ssTape = insertSprite(this, 6, 1100, 513, 437, 0xA1361863); addCollisionSprite(_ssTape); - + _asWinch = insertSprite(); _asTrapDoor = insertSprite(); _asRope = insertSprite(this); @@ -3023,9 +3023,9 @@ Scene2812::Scene2812(NeverhoodEngine *vm, Module *parentModule, int which) _sprite1->setVisible(false); _klaymen->setClipRect(_sprite4->getDrawRect().x, 0, 640, _sprite3->getDrawRect().y2()); } - + _asRope->setClipRect(0, _sprite2->getDrawRect().y, 640, _sprite3->getDrawRect().y2()); - + } void Scene2812::update() { diff --git a/engines/neverhood/modules/module2800.h b/engines/neverhood/modules/module2800.h index fe62f11307..54a9daeb16 100644 --- a/engines/neverhood/modules/module2800.h +++ b/engines/neverhood/modules/module2800.h @@ -79,7 +79,7 @@ public: protected: Scene *_parentScene; uint32 _fileHash1, _fileHash2; - bool _isPulled, _isBusy; + bool _isPulled, _isBusy; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); uint32 hmPulled(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -323,7 +323,7 @@ protected: Scene *_parentScene; int _countdown; int _testTubeSetNum, _testTubeIndex; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -408,7 +408,7 @@ protected: Sprite *_sprite3; Sprite *_sprite4; Sprite *_asSpew; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); void findClosestPoint(); }; diff --git a/engines/neverhood/modules/module2900.cpp b/engines/neverhood/modules/module2900.cpp index 248fb81bdc..9e51001a2e 100644 --- a/engines/neverhood/modules/module2900.cpp +++ b/engines/neverhood/modules/module2900.cpp @@ -36,7 +36,7 @@ Module2900::Module2900(NeverhoodEngine *vm, Module *parentModule, int which) if (which >= 0) setGlobalVar(V_TELEPORTER_WHICH, which); - + createScene(0, 0); } @@ -255,7 +255,7 @@ SsScene2901LocationButton::SsScene2901LocationButton(NeverhoodEngine *vm, Scene : StaticSprite(vm, 900), _parentScene(parentScene), _index(index), _countdown1(0) { const NPoint &pt = kSsScene2901LocationButtonPoints[_index]; - + loadSprite(kSsScene2901LocationButtonFileHashes[which * 6 + index], kSLFDefDrawOffset | kSLFDefPosition, 800); _collisionBounds.set(pt.x - 25, pt.y - 25, pt.x + 25, pt.y + 25); setVisible(false); @@ -263,7 +263,7 @@ SsScene2901LocationButton::SsScene2901LocationButton(NeverhoodEngine *vm, Scene SetUpdateHandler(&SsScene2901LocationButton::update); SetMessageHandler(&SsScene2901LocationButton::handleMessage); } - + void SsScene2901LocationButton::update() { updatePosition(); if (_countdown1 != 0 && (--_countdown1) == 0) { @@ -289,7 +289,7 @@ uint32 SsScene2901LocationButton::handleMessage(int messageNum, const MessagePar SsScene2901LocationButtonLight::SsScene2901LocationButtonLight(NeverhoodEngine *vm, int which, uint index) : StaticSprite(vm, 900), _index(index) { - + loadSprite(kSsScene2901LocationButtonLightFileHashes1[which * 6 + index], kSLFDefDrawOffset | kSLFDefPosition, 900); setVisible(false); loadSound(0, kSsScene2901LocationButtonLightFileHashes2[_index]); @@ -315,7 +315,7 @@ SsScene2901BrokenButton::SsScene2901BrokenButton(NeverhoodEngine *vm, int which) SsScene2901BigButton::SsScene2901BigButton(NeverhoodEngine *vm, Scene *parentScene, int which) : StaticSprite(vm, 900), _parentScene(parentScene), _which(which), _countdown1(0) { - loadSprite(kSsScene2901BigButtonFileHashes[which], kSLFDefDrawOffset | kSLFDefPosition, 400); + loadSprite(kSsScene2901BigButtonFileHashes[which], kSLFDefDrawOffset | kSLFDefPosition, 400); _collisionBounds.set(62, 94, 322, 350); setVisible(false); loadSound(0, 0xF3D420C8); @@ -330,7 +330,7 @@ void SsScene2901BigButton::update() { sendMessage(_parentScene, 0x2000, 0); } } - + uint32 SsScene2901BigButton::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { uint32 messageResult = Sprite::handleMessage(messageNum, param, sender); switch (messageNum) { @@ -361,7 +361,7 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(kScene2901FileHashes1[_currLocationButtonNum]); setPalette(kScene2901FileHashes1[_currLocationButtonNum]); - + for (uint i = 0; i < 6; ++i) { if (i != 2 || !_isButton2Broken) { _ssLocationButtons[i] = insertSprite(this, _currLocationButtonNum, i); @@ -369,7 +369,7 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) _ssLocationButtonLights[i] = insertSprite(_currLocationButtonNum, i); } } - + if (_isButton2Broken) insertSprite(_currLocationButtonNum); @@ -377,10 +377,10 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which) addCollisionSprite(_ssBigButton); insertPuzzleMouse(kScene2901FileHashes2[_currLocationButtonNum], 20, 620); - + SetUpdateHandler(&Scene2901::update); SetMessageHandler(&Scene2901::handleMessage); - + } void Scene2901::update() { diff --git a/engines/neverhood/modules/module2900.h b/engines/neverhood/modules/module2900.h index 75b29567f6..142f39a35c 100644 --- a/engines/neverhood/modules/module2900.h +++ b/engines/neverhood/modules/module2900.h @@ -49,7 +49,7 @@ protected: Scene *_parentScene; uint _index; int _countdown1; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; @@ -74,7 +74,7 @@ protected: Scene *_parentScene; int _which; int _countdown1; - void update(); + void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); }; diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp index f483e0c95f..ab3c18d1f4 100644 --- a/engines/neverhood/modules/module3000.cpp +++ b/engines/neverhood/modules/module3000.cpp @@ -39,7 +39,7 @@ static const uint32 kModule3000SoundList[] = { Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundVolume(0) { - + _vm->_soundMan->addSoundList(0x81293110, kModule3000SoundList); _vm->_soundMan->setSoundListParams(kModule3000SoundList, true, 50, 600, 5, 150); _vm->_soundMan->setSoundParams(0x90F0D1C3, false, 20000, 30000, 20000, 30000); @@ -440,7 +440,7 @@ static const uint32 kAsScene3009SymbolFileHashes[] = { }; static const uint32 kSsScene3009SymbolArrowFileHashes1[] = { - 0x24016060, + 0x24016060, 0x21216221, 0x486160A0, 0x42216422, @@ -455,7 +455,7 @@ static const uint32 kSsScene3009SymbolArrowFileHashes1[] = { }; static const uint32 kSsScene3009SymbolArrowFileHashes2[] = { - 0x40092024, + 0x40092024, 0x01636002, 0x8071E028, 0x02A56064, @@ -471,7 +471,7 @@ static const uint32 kSsScene3009SymbolArrowFileHashes2[] = { SsScene3009FireCannonButton::SsScene3009FireCannonButton(NeverhoodEngine *vm, Scene3009 *parentScene) : StaticSprite(vm, 1400), _parentScene(parentScene), _isClicked(false) { - + loadSprite(0x120B24B0, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); SetUpdateHandler(&SsScene3009FireCannonButton::update); @@ -637,7 +637,7 @@ uint32 AsScene3009VerticalIndicator::handleMessage(int messageNum, const Message AsScene3009HorizontalIndicator::AsScene3009HorizontalIndicator(NeverhoodEngine *vm, Scene3009 *parentScene, uint32 cannonTargetStatus) : AnimatedSprite(vm, 1000), _parentScene(parentScene), _enabled(false) { - + _x = getGlobalVar(V_CANNON_TURNED) ? 533 : 92; _y = 150; createSurface1(0xC0C12954, 1200); @@ -702,7 +702,7 @@ AsScene3009Symbol::AsScene3009Symbol(NeverhoodEngine *vm, Scene3009 *parentScene : AnimatedSprite(vm, 1100), _parentScene(parentScene), _symbolPosition(symbolPosition) { _symbolIndex = getSubVar(VA_CURR_CANNON_SYMBOLS, _symbolPosition); - + _x = kAsScene3009SymbolPoints[_symbolPosition].x; _y = kAsScene3009SymbolPoints[_symbolPosition].y; createSurface1(kAsScene3009SymbolFileHashes[_symbolPosition / 3], 1200); @@ -753,17 +753,17 @@ void AsScene3009Symbol::hide() { } Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which) - : Scene(vm, parentModule), _keepVideo(false), _moveCannonLeftFirst(false), + : Scene(vm, parentModule), _keepVideo(false), _moveCannonLeftFirst(false), _isTurning(false), _lockSymbolsPart1Countdown(1), _lockSymbolsPart2Countdown(1) { _cannonTargetStatus = getGlobalVar(V_CANNON_TARGET_STATUS); - + _vm->gameModule()->initCannonSymbolsPuzzle(); - + setGlobalVar(V_CANNON_SMACKER_NAME, 0); - + _vm->_screen->clear(); - + setBackground(0xD000420C); setPalette(0xD000420C); insertPuzzleMouse(0x04208D08, 20, 620); @@ -821,7 +821,7 @@ void Scene3009::openSmacker(uint32 fileHash, bool keepLastFrame) { void Scene3009::update() { Scene::update(); - + if (!_keepVideo && _cannonSmackerPlayer->isDone() && _cannonTargetStatus <= kCTSCount) { switch (_cannonTargetStatus) { case kCTSNull: @@ -850,9 +850,9 @@ void Scene3009::update() { if (_moveCannonLeftFirst) { if (_cannonTargetStatus == kCTSLeftRobotNoTarget) openSmacker(0x110A000F, false); - else if (_cannonTargetStatus == kCTSLeftRobotIsTarget) + else if (_cannonTargetStatus == kCTSLeftRobotIsTarget) openSmacker(0x500B004F, false); - else if (_cannonTargetStatus == kCTSLeftNoRobot) + else if (_cannonTargetStatus == kCTSLeftNoRobot) openSmacker(0x100B010E, false); _moveCannonLeftFirst = false; _asHorizontalIndicator->stMoveLeft(); @@ -1119,7 +1119,7 @@ AsScene3010DeadBolt::AsScene3010DeadBolt(NeverhoodEngine *vm, Scene *parentScene loadSound(0, 0x420073DC); loadSound(1, 0x420073DC); } - + setVisible(false); stIdle(); if (initUnlocked) @@ -1127,7 +1127,7 @@ AsScene3010DeadBolt::AsScene3010DeadBolt(NeverhoodEngine *vm, Scene *parentScene _needRefresh = true; AnimatedSprite::updatePosition(); - + } void AsScene3010DeadBolt::update() { @@ -1217,7 +1217,7 @@ void AsScene3010DeadBolt::stDisabledMessage() { Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule), _countdown(0), _doorUnlocked(false), _checkUnlocked(false) { - + int initCountdown = 0; setBackground(0x80802626); @@ -1348,7 +1348,7 @@ static const uint32 kAsScene3011SymbolFileHashes[] = { SsScene3011Button::SsScene3011Button(NeverhoodEngine *vm, Scene *parentScene, bool flag) : StaticSprite(vm, 1400), _parentScene(parentScene), _countdown(0) { - + loadSprite(flag ? 0x11282020 : 0x994D0433, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44061000); @@ -1446,7 +1446,7 @@ Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) SetMessageHandler(&Scene3011::handleMessage); SetUpdateHandler(&Scene3011::update); - + setBackground(0x92124A04); setPalette(0xA4070114); addEntity(_palette); @@ -1458,12 +1458,12 @@ Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) _ssButton = insertSprite(this, true); addCollisionSprite(_ssButton); - + } void Scene3011::update() { Scene::update(); - + if (_countdown != 0 && (--_countdown == 0)) { switch (_updateStatus) { case 0: diff --git a/engines/neverhood/modules/module3000.h b/engines/neverhood/modules/module3000.h index 797be1885f..a6cecb227e 100644 --- a/engines/neverhood/modules/module3000.h +++ b/engines/neverhood/modules/module3000.h @@ -244,7 +244,7 @@ protected: bool _buttonClicked; int _countdown; int _noisySymbolIndex; - int _currentSymbolIndex; + int _currentSymbolIndex; int _noisyRandomSymbolIndex; void update(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/mouse.cpp b/engines/neverhood/mouse.cpp index 632f56fb74..13fba41e92 100644 --- a/engines/neverhood/mouse.cpp +++ b/engines/neverhood/mouse.cpp @@ -26,9 +26,9 @@ namespace Neverhood { Mouse::Mouse(NeverhoodEngine *vm, uint32 fileHash, const NRect &mouseRect) - : StaticSprite(vm, 2000), _mouseType(kMouseType433), + : StaticSprite(vm, 2000), _mouseType(kMouseType433), _mouseCursorResource(vm), _frameNum(0) { - + _mouseRect = mouseRect; init(fileHash); if (_x >= _mouseRect.x1 && _x <= _mouseRect.x2 && @@ -43,7 +43,7 @@ Mouse::Mouse(NeverhoodEngine *vm, uint32 fileHash, const NRect &mouseRect) Mouse::Mouse(NeverhoodEngine *vm, uint32 fileHash, int16 x1, int16 x2) : StaticSprite(vm, 2000), _mouseType(kMouseType435), _mouseCursorResource(vm), _frameNum(0), _x1(x1), _x2(x2) { - + init(fileHash); if (_x <= _x1) { _mouseCursorResource.setCursorNum(6); @@ -69,8 +69,8 @@ Mouse::~Mouse() { void Mouse::init(uint32 fileHash) { _mouseCursorResource.load(fileHash); - _x = _vm->getMouseX(); - _y = _vm->getMouseY(); + _x = _vm->getMouseX(); + _y = _vm->getMouseY(); createSurface(2000, 32, 32); SetUpdateHandler(&Mouse::update); SetMessageHandler(&Mouse::handleMessage); @@ -99,7 +99,7 @@ void Mouse::update() { _frameNum++; if (_frameNum >= 6) _frameNum = 0; - _needRefresh = _frameNum % 2 == 0; + _needRefresh = _frameNum % 2 == 0; } uint32 Mouse::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -113,40 +113,40 @@ uint32 Mouse::handleMessage(int messageNum, const MessageParam ¶m, Entity *s case 1: if (_x >= 320) messageResult = 1; - else + else messageResult = 0; break; case 2: default: if (_x < 100) messageResult = 0; - else if (_x > 540) + else if (_x > 540) messageResult = 1; - else + else messageResult = 2; break; case 3: if (_x < 100) messageResult = 0; - else if (_x > 540) + else if (_x > 540) messageResult = 1; - else + else messageResult = 4; break; case 4: if (_x < 100) messageResult = 0; - else if (_x > 540) + else if (_x > 540) messageResult = 1; - else if (_y >= 150) + else if (_y >= 150) messageResult = 2; - else + else messageResult = 3; break; case 5: if (_y >= 240) messageResult = 4; - else + else messageResult = 3; break; } @@ -162,7 +162,7 @@ uint32 Mouse::handleMessage(int messageNum, const MessageParam ¶m, Entity *s } void Mouse::updateCursor() { - + if (!_surface) return; @@ -213,44 +213,44 @@ void Mouse::updateCursorNum() { case 1: if (_x >= 320) _mouseCursorResource.setCursorNum(5); - else + else _mouseCursorResource.setCursorNum(6); break; case 2: default: if (_x < 100) _mouseCursorResource.setCursorNum(6); - else if (_x > 540) + else if (_x > 540) _mouseCursorResource.setCursorNum(5); - else + else _mouseCursorResource.setCursorNum(0); break; case 3: if (_x < 100) _mouseCursorResource.setCursorNum(1); - else if (_x > 540) + else if (_x > 540) _mouseCursorResource.setCursorNum(1); break; case 4: if (_x < 100) _mouseCursorResource.setCursorNum(6); - else if (_x > 540) + else if (_x > 540) _mouseCursorResource.setCursorNum(5); - else if (_y >= 150) + else if (_y >= 150) _mouseCursorResource.setCursorNum(0); - else + else _mouseCursorResource.setCursorNum(3); break; case 5: if (_y >= 240) _mouseCursorResource.setCursorNum(2); - else + else _mouseCursorResource.setCursorNum(3); break; } break; } - + } } // End of namespace Neverhood diff --git a/engines/neverhood/mouse.h b/engines/neverhood/mouse.h index 0b927de4df..d6f42b4071 100644 --- a/engines/neverhood/mouse.h +++ b/engines/neverhood/mouse.h @@ -52,7 +52,7 @@ protected: int16 _x1; int16 _x2; int _type; - void init(uint32 fileHash); + void init(uint32 fileHash); void update(); void updateCursorNum(); uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 073d18f47b..51ab96ef37 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -35,19 +35,19 @@ NavigationScene::NavigationScene(NeverhoodEngine *vm, Module *parentModule, uint _isWalkingForward(false), _isTurning(false), _smackerFileHash(0), _interactive(true), _leaveSceneAfter(false) { _navigationList = _vm->_staticData->getNavigationList(navigationListId); - + if (_navigationIndex < 0) { _navigationIndex = (int)getGlobalVar(V_NAVIGATION_INDEX); if (_navigationIndex >= (int)_navigationList->size()) - _navigationIndex = 0; + _navigationIndex = 0; } setGlobalVar(V_NAVIGATION_INDEX, _navigationIndex); - + SetUpdateHandler(&NavigationScene::update); SetMessageHandler(&NavigationScene::handleMessage); - - _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true)); - + + _smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, (*_navigationList)[_navigationIndex].fileHash, true, true)); + createMouseCursor(); _vm->_screen->clear(); @@ -99,7 +99,7 @@ void NavigationScene::update() { _vm->_screen->setSmackerDecoder(_smackerPlayer->getSmackerDecoder()); sendMessage(_parentModule, 0x100A, _navigationIndex); } - } + } Scene::update(); } @@ -135,7 +135,7 @@ void NavigationScene::createMouseCursor() { mouseCursorFileHash = navigationItem.mouseCursorFileHash; if (mouseCursorFileHash == 0) mouseCursorFileHash = 0x63A40028; - + if (_itemsTypes) areaType = _itemsTypes[_navigationIndex]; else if (navigationItem.middleSmackerFileHash != 0 || navigationItem.middleFlag) @@ -152,7 +152,7 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { bool oldIsWalkingForward = _isWalkingForward; bool oldIsTurning = _isTurning; uint32 direction = sendPointMessage(_mouseCursor, 0x2064, mousePos); - + switch (direction) { case 0: if (navigationItem.leftSmackerFileHash != 0) { @@ -203,7 +203,7 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { } break; } - + if (oldIsTurning != _isTurning) _vm->_soundMan->setSoundThreePlayFlag(_isTurning); diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index e7c9f32d45..061e6d1279 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -104,9 +104,9 @@ Common::Error NeverhoodEngine::run() { _soundMan = new SoundMan(this); _audioResourceMan = new AudioResourceMan(this); - + _gameModule = new GameModule(this); - + _isSaveAllowed = true; _updateSound = true; @@ -122,15 +122,15 @@ Common::Error NeverhoodEngine::run() { (*navigationList)[5].middleSmackerFileHash = 0; (*navigationList)[5].middleFlag = 1; } - + if (ConfMan.hasKey("save_slot")) { if (loadGameState(ConfMan.getInt("save_slot")).getCode() != Common::kNoError) _gameModule->startup(); } else _gameModule->startup(); - + mainLoop(); - + delete _gameModule; delete _soundMan; delete _audioResourceMan; @@ -141,7 +141,7 @@ Common::Error NeverhoodEngine::run() { delete _gameVars; delete _staticData; - + return Common::kNoError; } diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 773e80df7d..5643e345ad 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -93,7 +93,7 @@ public: AudioResourceMan *_audioResourceMan; public: - + /* Save/load */ enum kReadSaveHeaderError { @@ -118,7 +118,7 @@ public: bool canLoadGameStateCurrently() { return _isSaveAllowed; } bool canSaveGameStateCurrently() { return _isSaveAllowed; } - + Common::Error loadGameState(int slot); Common::Error saveGameState(int slot, const Common::String &description); Common::Error removeGameState(int slot); diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index d4b9b67f53..c381f46671 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -81,7 +81,7 @@ void Palette::addPalette(uint32 fileHash, int toIndex, int count, int fromIndex) if (toIndex + count > 256) count = 256 - toIndex; paletteResource.load(fileHash); - memcpy(_palette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); + memcpy(_palette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); _vm->_screen->testPalette(_palette); } @@ -90,20 +90,20 @@ void Palette::addBasePalette(uint32 fileHash, int toIndex, int count, int fromIn if (toIndex + count > 256) count = 256 - toIndex; paletteResource.load(fileHash); - memcpy(_basePalette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); + memcpy(_basePalette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); } void Palette::copyPalette(const byte *palette, int toIndex, int count, int fromIndex) { if (toIndex + count > 256) count = 256 - toIndex; - memcpy(_palette + toIndex * 4, palette + fromIndex * 4, count * 4); + memcpy(_palette + toIndex * 4, palette + fromIndex * 4, count * 4); _vm->_screen->testPalette(_palette); } void Palette::copyBasePalette(int toIndex, int count, int fromIndex) { if (toIndex + count > 256) count = 256 - toIndex; - memcpy(_basePalette + toIndex * 4, _palette + fromIndex * 4, count * 4); + memcpy(_basePalette + toIndex * 4, _palette + fromIndex * 4, count * 4); } void Palette::startFadeToBlack(int counter) { @@ -115,7 +115,7 @@ void Palette::startFadeToBlack(int counter) { _fadeToB = 0; _palCounter = counter; _fadeStep = 255 / counter; - _status = 1; + _status = 1; } void Palette::startFadeToWhite(int counter) { @@ -127,7 +127,7 @@ void Palette::startFadeToWhite(int counter) { _fadeToB = 255; _palCounter = counter; _fadeStep = 255 / counter; - _status = 1; + _status = 1; } void Palette::startFadeToPalette(int counter) { @@ -136,7 +136,7 @@ void Palette::startFadeToPalette(int counter) { counter = 1; _palCounter = counter; _fadeStep = 255 / counter; - _status = 2; + _status = 2; } void Palette::fillBaseWhite(int index, int count) { diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index 442713196e..5f7aea86f4 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -57,7 +57,7 @@ bool SpriteResource::load(uint32 fileHash, bool doLoadPosition) { const byte *spriteData = _resourceHandle.data(); NPoint *position = doLoadPosition ? &_position : NULL; parseBitmapResource(spriteData, &_rle, &_dimensions, position, NULL, &_pixels); - } + } return _pixels != NULL; } @@ -134,11 +134,11 @@ bool AnimResource::load(uint32 fileHash) { return true; unload(); - + _vm->_res->queryResource(fileHash, _resourceHandle); if (!_resourceHandle.isValid() || _resourceHandle.type() != kResTypeAnimation) return false; - + const byte *resourceData, *animList, *frameList; uint16 animInfoStartOfs, animListIndex, animListCount; uint16 frameListStartOfs, frameCount; @@ -146,20 +146,20 @@ bool AnimResource::load(uint32 fileHash) { _vm->_res->loadResource(_resourceHandle); resourceData = _resourceHandle.data(); - + animListCount = READ_LE_UINT16(resourceData); animInfoStartOfs = READ_LE_UINT16(resourceData + 2); spriteDataOfs = READ_LE_UINT32(resourceData + 4); paletteDataOfs = READ_LE_UINT32(resourceData + 8); - + animList = resourceData + 12; for (animListIndex = 0; animListIndex < animListCount; animListIndex++) { debug(8, "hash: %08X", READ_LE_UINT32(animList)); if (READ_LE_UINT32(animList) == fileHash) break; - animList += 8; + animList += 8; } - + if (animListIndex >= animListCount) { _vm->_res->unloadResource(_resourceHandle); return false; @@ -168,12 +168,12 @@ bool AnimResource::load(uint32 fileHash) { _spriteData = resourceData + spriteDataOfs; if (paletteDataOfs > 0) _paletteData = resourceData + paletteDataOfs; - + frameCount = READ_LE_UINT16(animList + 4); frameListStartOfs = READ_LE_UINT16(animList + 6); - + debug(8, "frameCount = %d; frameListStartOfs = %04X; animInfoStartOfs = %04X", frameCount, frameListStartOfs, animInfoStartOfs); - + frameList = resourceData + animInfoStartOfs + frameListStartOfs; _frames.clear(); @@ -189,13 +189,13 @@ bool AnimResource::load(uint32 fileHash) { frameInfo.drawOffset.height = READ_LE_UINT16(frameList + 12); frameInfo.deltaX = READ_LE_UINT16(frameList + 14); frameInfo.deltaY = READ_LE_UINT16(frameList + 16); - frameInfo.collisionBoundsOffset.x = READ_LE_UINT16(frameList + 18); - frameInfo.collisionBoundsOffset.y = READ_LE_UINT16(frameList + 20); - frameInfo.collisionBoundsOffset.width = READ_LE_UINT16(frameList + 22); + frameInfo.collisionBoundsOffset.x = READ_LE_UINT16(frameList + 18); + frameInfo.collisionBoundsOffset.y = READ_LE_UINT16(frameList + 20); + frameInfo.collisionBoundsOffset.width = READ_LE_UINT16(frameList + 22); frameInfo.collisionBoundsOffset.height = READ_LE_UINT16(frameList + 24); frameInfo.spriteDataOffs = READ_LE_UINT32(frameList + 28); - debug(8, "frameHash = %08X; counter = %d; rect = (%d,%d,%d,%d); deltaX = %d; deltaY = %d; collisionBoundsOffset = (%d,%d,%d,%d); spriteDataOffs = %08X", - frameInfo.frameHash, frameInfo.counter, + debug(8, "frameHash = %08X; counter = %d; rect = (%d,%d,%d,%d); deltaX = %d; deltaY = %d; collisionBoundsOffset = (%d,%d,%d,%d); spriteDataOffs = %08X", + frameInfo.frameHash, frameInfo.counter, frameInfo.drawOffset.x, frameInfo.drawOffset.y, frameInfo.drawOffset.width, frameInfo.drawOffset.height, frameInfo.deltaX, frameInfo.deltaY, frameInfo.collisionBoundsOffset.x, frameInfo.collisionBoundsOffset.y, frameInfo.collisionBoundsOffset.width, frameInfo.collisionBoundsOffset.height, @@ -203,11 +203,11 @@ bool AnimResource::load(uint32 fileHash) { frameList += 32; _frames.push_back(frameInfo); } - + _fileHash = fileHash; return true; - + } void AnimResource::unload() { @@ -229,7 +229,7 @@ int16 AnimResource::getFrameIndex(uint32 frameHash) { break; } debug(2, "AnimResource::getFrameIndex(%08X) -> %d", frameHash, frameIndex); - return frameIndex; + return frameIndex; } void AnimResource::setRepl(byte oldColor, byte newColor) { @@ -254,7 +254,7 @@ NDimensions AnimResource::loadSpriteDimensions(uint32 fileHash) { // MouseCursorResource -MouseCursorResource::MouseCursorResource(NeverhoodEngine *vm) +MouseCursorResource::MouseCursorResource(NeverhoodEngine *vm) : _cursorSprite(vm), _cursorNum(4), _currFileHash(0) { _rect.width = 32; @@ -265,7 +265,7 @@ void MouseCursorResource::load(uint32 fileHash) { if (_currFileHash != fileHash) { if (_cursorSprite.load(fileHash) && !_cursorSprite.isRle() && _cursorSprite.getDimensions().width == 96 && _cursorSprite.getDimensions().height == 224) { - _currFileHash = fileHash; + _currFileHash = fileHash; } else { unload(); } @@ -296,14 +296,14 @@ NDrawRect& MouseCursorResource::getRect() { void MouseCursorResource::draw(int frameNum, Graphics::Surface *destSurface) { if (_cursorSprite.getPixels()) { const int sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment - const int destPitch = destSurface->pitch; + const int destPitch = destSurface->pitch; const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; byte *dest = (byte*)destSurface->pixels; for (int16 yc = 0; yc < 32; yc++) { memcpy(dest, source, 32); source += sourcePitch; dest += destPitch; - } + } } } @@ -311,7 +311,7 @@ void MouseCursorResource::draw(int frameNum, Graphics::Surface *destSurface) { TextResource::TextResource(NeverhoodEngine *vm) : _vm(vm), _textData(NULL), _count(0) { - + } TextResource::~TextResource() { @@ -372,7 +372,7 @@ void DataResource::load(uint32 fileHash) { dataS.seek(2 + i * 8); DRDirectoryItem drDirectoryItem; drDirectoryItem.nameHash = dataS.readUint32LE(); - drDirectoryItem.offset = dataS.readUint16LE(); + drDirectoryItem.offset = dataS.readUint16LE(); drDirectoryItem.type = dataS.readUint16LE(); debug(2, "%03d nameHash = %08X; offset = %04X; type = %d", i, drDirectoryItem.nameHash, drDirectoryItem.offset, drDirectoryItem.type); dataS.seek(itemStartOffs + drDirectoryItem.offset); @@ -415,7 +415,7 @@ void DataResource::load(uint32 fileHash) { hitRect.rect.y1 = dataS.readUint16LE(); hitRect.rect.x2 = dataS.readUint16LE(); hitRect.rect.y2 = dataS.readUint16LE(); - hitRect.type = dataS.readUint16LE() + 0x5001; + hitRect.type = dataS.readUint16LE() + 0x5001; debug(3, "(%d, %d, %d, %d) -> %04d", hitRect.rect.x1, hitRect.rect.y1, hitRect.rect.x2, hitRect.rect.y2, hitRect.type); hitRectList->push_back(hitRect); } @@ -491,7 +491,7 @@ void DataResource::load(uint32 fileHash) { break; } } - _directory.push_back(drDirectoryItem); + _directory.push_back(drDirectoryItem); } } } @@ -540,12 +540,12 @@ HitRectList *DataResource::getHitRectList() { MessageList *DataResource::getMessageListAtPos(int16 klaymenX, int16 klaymenY, int16 mouseX, int16 mouseY) { for (uint i = 0; i < _drRects.size(); i++) { - if (klaymenX >= _drRects[i].rect.x1 && klaymenX <= _drRects[i].rect.x2 && + if (klaymenX >= _drRects[i].rect.x1 && klaymenX <= _drRects[i].rect.x2 && klaymenY >= _drRects[i].rect.y1 && klaymenY <= _drRects[i].rect.y2) { - DRSubRectList *drSubRectList = _drSubRectLists[_drRects[i].subRectIndex]; + DRSubRectList *drSubRectList = _drSubRectLists[_drRects[i].subRectIndex]; for (uint j = 0; j < drSubRectList->size(); j++) { DRSubRect &subRect = (*drSubRectList)[j]; - if (mouseX >= subRect.rect.x1 && mouseX <= subRect.rect.x2 && + if (mouseX >= subRect.rect.x1 && mouseX <= subRect.rect.x2 && mouseY >= subRect.rect.y1 && mouseY <= subRect.rect.y2) { return _messageLists[subRect.messageListItemIndex]; } diff --git a/engines/neverhood/resource.h b/engines/neverhood/resource.h index 6a84a69ecd..40236d9d22 100644 --- a/engines/neverhood/resource.h +++ b/engines/neverhood/resource.h @@ -168,7 +168,7 @@ protected: struct DRDirectoryItem { uint32 nameHash; - uint16 offset; + uint16 offset; uint16 type; }; @@ -195,7 +195,7 @@ protected: Common::Array _messageLists; Common::Array _drRects; Common::Array _drSubRectLists; - DataResource::DRDirectoryItem *findDRDirectoryItem(uint32 nameHash, uint16 type); + DataResource::DRDirectoryItem *findDRDirectoryItem(uint32 nameHash, uint16 type); }; uint32 calcHash(const char *value); diff --git a/engines/neverhood/resourceman.cpp b/engines/neverhood/resourceman.cpp index d5e7786c17..37089a5bd6 100644 --- a/engines/neverhood/resourceman.cpp +++ b/engines/neverhood/resourceman.cpp @@ -49,7 +49,7 @@ void ResourceMan::addArchive(const Common::String &filename) { if (archiveEntry->timeStamp > entry->archiveEntry->timeStamp) { entry->archive = archive; entry->archiveEntry = archiveEntry; - } + } } else { ResourceFileEntry newEntry; newEntry.resourceHandle = -1; diff --git a/engines/neverhood/saveload.cpp b/engines/neverhood/saveload.cpp index ae93a0cea4..01988769e6 100644 --- a/engines/neverhood/saveload.cpp +++ b/engines/neverhood/saveload.cpp @@ -78,7 +78,7 @@ bool NeverhoodEngine::savegame(const char *filename, const char *description) { byte descriptionLen = strlen(description); out->writeByte(descriptionLen); out->write(description, descriptionLen); - + Graphics::saveThumbnail(*out); // Not used yet, reserved for future usage @@ -96,7 +96,7 @@ bool NeverhoodEngine::savegame(const char *filename, const char *description) { _gameVars->setGlobalVar(V_CURRENT_SCENE_WHICH, _gameState.which); _gameVars->saveState(out); - + out->finalize(); delete out; return true; @@ -112,17 +112,17 @@ bool NeverhoodEngine::loadgame(const char *filename) { SaveHeader header; kReadSaveHeaderError errorCode = readSaveHeader(in, false, header); - + if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); delete in; return false; } - + g_engine->setTotalPlayTime(header.playTime * 1000); _gameVars->loadState(in); - + _gameState.sceneNum = _gameVars->getGlobalVar(V_CURRENT_SCENE); _gameState.which = _gameVars->getGlobalVar(V_CURRENT_SCENE_WHICH); diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index 80a2b69169..e76a9ca521 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -28,7 +28,7 @@ namespace Neverhood { Scene::Scene(NeverhoodEngine *vm, Module *parentModule) : Entity(vm, 0), _parentModule(parentModule), _dataResource(vm), _hitRects(NULL), _mouseCursorWasVisible(true) { - + _isKlaymenBusy = false; _doConvertMessages = false; _messageList = NULL; @@ -50,10 +50,10 @@ Scene::Scene(NeverhoodEngine *vm, Module *parentModule) _smackerPlayer = NULL; _isMessageListBusy = false; _messageValue = -1; - + SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene::handleMessage); - + _vm->_screen->clearRenderQueue(); } @@ -71,7 +71,7 @@ Scene::~Scene() { delete *iter; // Don't delete surfaces since they always belong to an entity - + // Purge the resources after each scene _vm->_res->purgeResources(); @@ -84,7 +84,7 @@ void Scene::draw() { } else { for (Common::Array::iterator iter = _surfaces.begin(); iter != _surfaces.end(); iter++) (*iter)->draw(); - } + } } void Scene::addEntity(Entity *entity) { @@ -99,7 +99,7 @@ void Scene::addEntity(Entity *entity) { if (insertIndex >= 0) _entities.insert_at(insertIndex, entity); else - _entities.push_back(entity); + _entities.push_back(entity); } bool Scene::removeEntity(Entity *entity) { @@ -108,7 +108,7 @@ bool Scene::removeEntity(Entity *entity) { _entities.remove_at(index); return true; } - return false; + return false; } void Scene::addSurface(BaseSurface *surface) { @@ -124,7 +124,7 @@ void Scene::addSurface(BaseSurface *surface) { if (insertIndex >= 0) _surfaces.insert_at(insertIndex, surface); else - _surfaces.push_back(surface); + _surfaces.push_back(surface); } } @@ -135,7 +135,7 @@ bool Scene::removeSurface(BaseSurface *surface) { return true; } } - return false; + return false; } void Scene::printSurfaces(Console *con) { @@ -246,12 +246,12 @@ void Scene::update() { if (_mouseClicked) { if (_klaymen) { if (_canAcceptInput && - _klaymen->hasMessageHandler() && + _klaymen->hasMessageHandler() && sendMessage(_klaymen, 0x1008, 0) != 0 && queryPositionSprite(_mouseClickPos.x, _mouseClickPos.y)) { _mouseClicked = false; } else if (_canAcceptInput && - _klaymen->hasMessageHandler() && + _klaymen->hasMessageHandler() && sendMessage(_klaymen, 0x1008, 0) != 0) { _mouseClicked = !queryPositionRectList(_mouseClickPos.x, _mouseClickPos.y); } @@ -262,7 +262,7 @@ void Scene::update() { processMessageList(); - // Update all entities + // Update all entities for (Common::Array::iterator iter = _entities.begin(); iter != _entities.end(); iter++) (*iter)->handleUpdate(); @@ -283,7 +283,7 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s _mouseClickPos = param.asPoint(); break; case 0x0006: - sendMessage(_parentModule, 0x1009, param); + sendMessage(_parentModule, 0x1009, param); break; case 0x1006: // Sent by Klaymen when its animation sequence has finished @@ -332,7 +332,7 @@ uint32 Scene::handleMessage(int messageNum, const MessageParam ¶m, Entity *s bool Scene::queryPositionSprite(int16 mouseX, int16 mouseY) { for (uint i = 0; i < _collisionSprites.size(); i++) { Sprite *sprite = _collisionSprites[i]; - if (sprite->hasMessageHandler() && sprite->isPointInside(mouseX, mouseY) && + if (sprite->hasMessageHandler() && sprite->isPointInside(mouseX, mouseY) && sendPointMessage(sprite, 0x1011, _mouseClickPos) != 0) { return true; } @@ -412,8 +412,8 @@ void Scene::processMessageList() { _messageList2 = NULL; _messageListStatus = 0; } - - if (_messageList && _klaymen) { + + if (_messageList && _klaymen) { #if 0 debug("MessageList: %p, %d", (void*)_messageList, _messageList->size()); @@ -423,11 +423,11 @@ void Scene::processMessageList() { } debug("--------------------------------"); #endif - + while (_messageList && _messageListIndex < _messageListCount && !_isKlaymenBusy) { uint32 messageNum = (*_messageList)[_messageListIndex].messageNum; uint32 messageParam = (*_messageList)[_messageListIndex].messageValue; - + ++_messageListIndex; if (_messageListIndex == _messageListCount) sendMessage(_klaymen, 0x1021, 0); @@ -460,7 +460,7 @@ void Scene::processMessageList() { if (_klaymen->hasMessageHandler() && sendMessage(_klaymen, messageNum, messageParam) != 0) { _isKlaymenBusy = false; } - } + } if (_messageListIndex == _messageListCount) { _canAcceptInput = true; _messageList = NULL; @@ -469,7 +469,7 @@ void Scene::processMessageList() { } _isMessageListBusy = false; - + } void Scene::cancelMessageList() { @@ -531,7 +531,7 @@ uint16 Scene::convertMessageNum(uint32 messageNum) { case 0x42002200: return 0x4004; case 0x428D4894: - return 0x101A; + return 0x101A; } return 0x1000; } @@ -546,7 +546,7 @@ HitRect *Scene::findHitRectAtPos(int16 x, int16 y) { for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++) if ((*it).rect.contains(x, y)) return &(*it); - return &kDefaultHitRect; + return &kDefaultHitRect; } void Scene::addCollisionSprite(Sprite *sprite) { @@ -561,7 +561,7 @@ void Scene::addCollisionSprite(Sprite *sprite) { if (insertIndex >= 0) _collisionSprites.insert_at(insertIndex, sprite); else - _collisionSprites.push_back(sprite); + _collisionSprites.push_back(sprite); } void Scene::removeCollisionSprite(Sprite *sprite) { @@ -583,7 +583,7 @@ void Scene::checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 if ((sprite->getFlags() & flags) && collSprite->checkCollision(sprite->getCollisionBounds())) { sprite->sendMessage(collSprite, messageNum, messageParam); } - } + } } void Scene::insertMouse(Mouse *mouseCursor) { diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h index 813ffba0bb..5e42e34418 100644 --- a/engines/neverhood/scene.h +++ b/engines/neverhood/scene.h @@ -76,89 +76,89 @@ public: void checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32 messageParam); // Some crazy templated functions to make the logic code smaller/simpler (imo!) // insertKlaymen - template + template void insertKlaymen() { _klaymen = (T*)addSprite(new T(_vm, this)); } - template + template void insertKlaymen(Arg1 arg1) { _klaymen = (T*)addSprite(new T(_vm, this, arg1)); } - template + template void insertKlaymen(Arg1 arg1, Arg2 arg2) { _klaymen = (T*)addSprite(new T(_vm, this, arg1, arg2)); } - template + template void insertKlaymen(Arg1 arg1, Arg2 arg2, Arg3 arg3) { _klaymen = (T*)addSprite(new T(_vm, this, arg1, arg2, arg3)); } - template + template void insertKlaymen(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) { _klaymen = (T*)addSprite(new T(_vm, this, arg1, arg2, arg3, arg4)); } - template + template void insertKlaymen(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) { _klaymen = (T*)addSprite(new T(_vm, this, arg1, arg2, arg3, arg4, arg5)); } - template + template void insertKlaymen(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6) { _klaymen = (T*)addSprite(new T(_vm, this, arg1, arg2, arg3, arg4, arg5, arg6)); } // insertSprite - template + template T* insertSprite() { return (T*)addSprite(new T(_vm)); } - template + template T* insertSprite(Arg1 arg1) { return (T*)addSprite(new T(_vm, arg1)); } - template + template T* insertSprite(Arg1 arg1, Arg2 arg2) { return (T*)addSprite(new T(_vm, arg1, arg2)); } - template + template T* insertSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3) { return (T*)addSprite(new T(_vm, arg1, arg2, arg3)); } - template + template T* insertSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) { return (T*)addSprite(new T(_vm, arg1, arg2, arg3, arg4)); } - template + template T* insertSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) { return (T*)addSprite(new T(_vm, arg1, arg2, arg3, arg4, arg5)); } - template + template T* insertSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6) { return (T*)addSprite(new T(_vm, arg1, arg2, arg3, arg4, arg5, arg6)); } // createSprite - template + template T* createSprite() { return new T(_vm); } - template + template T* createSprite(Arg1 arg1) { return new T(_vm, arg1); } - template + template T* createSprite(Arg1 arg1, Arg2 arg2) { return new T(_vm, arg1, arg2); } - template + template T* createSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3) { return new T(_vm, arg1, arg2, arg3); } - template + template T* createSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4) { return new T(_vm, arg1, arg2, arg3, arg4); } - template + template T* createSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5) { return new T(_vm, arg1, arg2, arg3, arg4, arg5); } - template + template T* createSprite(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6) { return new T(_vm, arg1, arg2, arg3, arg4, arg5, arg6); } diff --git a/engines/neverhood/screen.cpp b/engines/neverhood/screen.cpp index 5a748cfab4..4a5bfb92ce 100644 --- a/engines/neverhood/screen.cpp +++ b/engines/neverhood/screen.cpp @@ -28,16 +28,16 @@ namespace Neverhood { Screen::Screen(NeverhoodEngine *vm) : _vm(vm), _paletteData(NULL), _paletteChanged(false), _smackerDecoder(NULL), _yOffset(0), _fullRefresh(false) { - + _ticks = _vm->_system->getMillis(); - + _backScreen = new Graphics::Surface(); _backScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); - + _renderQueue = new RenderQueue(); _prevRenderQueue = new RenderQueue(); _microTiles = new MicroTileArray(640, 480); - + } Screen::~Screen() { @@ -72,13 +72,13 @@ void Screen::update() { } } } - + for (RenderQueue::iterator jt = _prevRenderQueue->begin(); jt != _prevRenderQueue->end(); ++jt) { RenderItem &prevRenderItem = (*jt); if (prevRenderItem._refresh) _microTiles->addRect(Common::Rect(prevRenderItem._destX, prevRenderItem._destY, prevRenderItem._destX + prevRenderItem._width, prevRenderItem._destY + prevRenderItem._height)); } - + for (RenderQueue::iterator it = _renderQueue->begin(); it != _renderQueue->end(); ++it) { RenderItem &renderItem = (*it); if (renderItem._refresh) @@ -93,7 +93,7 @@ void Screen::update() { for (RectangleList::iterator ri = updateRects->begin(); ri != updateRects->end(); ++ri) blitRenderItem(renderItem, *ri); } - + SWAP(_renderQueue, _prevRenderQueue); _renderQueue->clear(); @@ -202,12 +202,12 @@ void Screen::drawSurface2(const Graphics::Surface *surface, NDrawRect &drawRect, destX = drawRect.x; ddRect.x1 = 0; } - + if (drawRect.y + drawRect.height >= clipRect.y2) ddRect.y2 = clipRect.y2 - drawRect.y; else ddRect.y2 = drawRect.height; - + if (drawRect.y < clipRect.y1) { destY = clipRect.y1; ddRect.y1 = clipRect.y1 - drawRect.y; @@ -215,7 +215,7 @@ void Screen::drawSurface2(const Graphics::Surface *surface, NDrawRect &drawRect, destY = drawRect.y; ddRect.y1 = 0; } - + queueBlit(surface, destX, destY, ddRect, transparent, version, shadowSurface); } @@ -224,12 +224,12 @@ void Screen::drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, ND int16 destX, destY; NRect ddRect; - + if (x + drawRect.width >= clipRect.x2) ddRect.x2 = clipRect.x2 - drawRect.x - x; else ddRect.x2 = drawRect.x + drawRect.width; - + if (x < clipRect.x1) { destX = clipRect.x1; ddRect.x1 = clipRect.x1 + drawRect.x - x; @@ -242,7 +242,7 @@ void Screen::drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, ND ddRect.y2 = clipRect.y2 + drawRect.y - y; else ddRect.y2 = drawRect.y + drawRect.height; - + if (y < clipRect.y1) { destY = clipRect.y1; ddRect.y1 = clipRect.y1 + drawRect.y - y; @@ -250,7 +250,7 @@ void Screen::drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, ND destY = y; ddRect.y1 = drawRect.y; } - + queueBlit(surface, destX, destY, ddRect, transparent, version); } @@ -270,13 +270,13 @@ void Screen::drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &dra dest += _backScreen->pitch; dest += _backScreen->pitch; } - + _fullRefresh = true; // See Screen::update } void Screen::drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDrawRect &sysRect, NRect &clipRect, bool transparent, byte version) { - + int16 x, y; bool xflag, yflag; NDrawRect newDrawRect; @@ -292,26 +292,26 @@ void Screen::drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDra y = y % sysRect.height; if (y < 0) y += sysRect.height; - + xflag = x <= 0; yflag = y <= 0; - + newDrawRect.x = x; newDrawRect.width = sysRect.width - x; if (drawRect.width < newDrawRect.width) { xflag = true; newDrawRect.width = drawRect.width; } - + newDrawRect.y = y; newDrawRect.height = sysRect.height - y; if (drawRect.height < newDrawRect.height) { yflag = true; newDrawRect.height = drawRect.height; } - + drawSurface3(surface, drawRect.x, drawRect.y, newDrawRect, clipRect, transparent, version); - + if (!xflag) { newDrawRect.x = 0; newDrawRect.y = y; @@ -321,7 +321,7 @@ void Screen::drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDra newDrawRect.height = drawRect.height; drawSurface3(surface, sysRect.width + drawRect.x - x, drawRect.y, newDrawRect, clipRect, transparent, version); } - + if (!yflag) { newDrawRect.x = x; newDrawRect.y = 0; @@ -331,7 +331,7 @@ void Screen::drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDra newDrawRect.width = drawRect.width; drawSurface3(surface, drawRect.x, sysRect.height + drawRect.y - y, newDrawRect, clipRect, transparent, version); } - + if (!xflag && !yflag) { newDrawRect.x = 0; newDrawRect.y = 0; @@ -350,13 +350,13 @@ void Screen::drawSurfaceClipRects(const Graphics::Surface *surface, NDrawRect &d void Screen::queueBlit(const Graphics::Surface *surface, int16 destX, int16 destY, NRect &ddRect, bool transparent, byte version, const Graphics::Surface *shadowSurface) { - + const int width = ddRect.x2 - ddRect.x1; const int height = ddRect.y2 - ddRect.y1; if (width <= 0 || height <= 0) return; - + RenderItem renderItem; renderItem._surface = surface; renderItem._shadowSurface = shadowSurface; @@ -369,7 +369,7 @@ void Screen::queueBlit(const Graphics::Surface *surface, int16 destX, int16 dest renderItem._transparent = transparent; renderItem._version = version; _renderQueue->push_back(renderItem); - + } void Screen::blitRenderItem(const RenderItem &renderItem, const Common::Rect &clipRect) { diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 21d8851f48..187939faee 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -79,22 +79,22 @@ void SmackerDoubleSurface::draw() { void NeverhoodSmackerDecoder::forceSeekToFrame(uint frame) { if (!isVideoLoaded()) return; - + if (frame >= getFrameCount()) error("Can't force Smacker seek to invalid frame %d", frame); - + if (_header.audioInfo[0].hasAudio) error("Can't force Smacker frame seek with audio"); if (!rewind()) error("Failed to rewind"); - + SmackerVideoTrack *videoTrack = (SmackerVideoTrack *)getTrack(0); uint32 offset = 0; for (uint32 i = 0; i < frame; i++) { videoTrack->increaseCurFrame(); offset += _frameSizes[i] & ~3; } - + _fileStream->seek(offset, SEEK_CUR); } @@ -124,7 +124,7 @@ SmackerPlayer::~SmackerPlayer() { void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) { debug(0, "SmackerPlayer::open(%08X)", fileHash); - + _fileHash = fileHash; _keepLastFrame = keepLastFrame; @@ -136,13 +136,13 @@ void SmackerPlayer::open(uint32 fileHash, bool keepLastFrame) { _smackerDecoder = new NeverhoodSmackerDecoder(); _smackerDecoder->loadStream(_stream); - + _palette = new Palette(_vm); _palette->usePalette(); if (!_paused) _smackerDecoder->start(); - + } void SmackerPlayer::close() { @@ -212,7 +212,7 @@ void SmackerPlayer::update() { _videoDone = false; } } - + } void SmackerPlayer::updateFrame() { @@ -240,7 +240,7 @@ void SmackerPlayer::updateFrame() { if (_smackerDecoder->hasDirtyPalette()) updatePalette(); - + } void SmackerPlayer::updatePalette() { diff --git a/engines/neverhood/smackerplayer.h b/engines/neverhood/smackerplayer.h index f13b653757..dd7199dd6d 100644 --- a/engines/neverhood/smackerplayer.h +++ b/engines/neverhood/smackerplayer.h @@ -62,7 +62,7 @@ public: void close(); void gotoFrame(int frameNumber); uint32 getFrameCount(); - uint32 getFrameNumber(); + uint32 getFrameNumber(); uint getStatus(); void setDrawPos(int16 x, int16 y); void rewind(); diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index 115aafe5be..d9d032a3b5 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -31,16 +31,16 @@ SmackerScene::SmackerScene(NeverhoodEngine *vm, Module *parentModule, bool doubl debug(0, "SmackerScene::SmackerScene(%d, %d, %d)", doubleSurface, canSkip, canAbort); // NOTE: Merged from SmackerScene::init, maybe split again if needed (incl. parameter flags) - + if (getGlobalVar(V_SMACKER_CAN_ABORT)) { _canSkip = true; _canAbort = true; } - + if (!_doubleSurface) _vm->_screen->clear(); - _fileHash[0] = 0; + _fileHash[0] = 0; _fileHash[1] = 0; SetUpdateHandler(&SmackerScene::update); @@ -67,7 +67,7 @@ void SmackerScene::nextVideo() { debug(0, "SmackerScene::nextVideo()"); _fileHashListIndex++; - + if (_fileHashList && _fileHashList[_fileHashListIndex] != 0) { uint32 smackerFileHash = _fileHashList[_fileHashListIndex]; ResourceHandle resourceHandle; diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 46ec8007b0..c3bc3501b5 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -35,7 +35,7 @@ SoundResource::~SoundResource() { unload(); } -bool SoundResource::isPlaying() { +bool SoundResource::isPlaying() { AudioResourceManSoundItem *soundItem = getSoundItem(); return soundItem ? soundItem->isPlaying() : false; } @@ -94,7 +94,7 @@ MusicResource::MusicResource(NeverhoodEngine *vm) bool MusicResource::isPlaying() { AudioResourceManMusicItem *musicItem = getMusicItem(); - return musicItem && musicItem->isPlaying(); + return musicItem && musicItem->isPlaying(); } void MusicResource::load(uint32 fileHash) { @@ -134,7 +134,7 @@ AudioResourceManMusicItem *MusicResource::getMusicItem() { MusicItem::MusicItem(NeverhoodEngine *vm, uint32 groupNameHash, uint32 musicFileHash) : _vm(vm), _musicResource(NULL) { - + _groupNameHash = groupNameHash; _fileHash = musicFileHash; _play = false; @@ -187,7 +187,7 @@ SoundItem::SoundItem(NeverhoodEngine *vm, uint32 groupNameHash, uint32 soundFile _playOnceAfterRandomCountdown(false), _minCountdown(0), _maxCountdown(0), _playOnceAfterCountdown(playOnceAfterCountdown), _initialCountdown(initialCountdown), _playLooping(false), _currCountdown(currCountdown) { - + _soundResource = new SoundResource(vm); _soundResource->load(soundFileHash); } @@ -200,7 +200,7 @@ SoundItem::~SoundItem() { void SoundItem::setSoundParams(bool playOnceAfterRandomCountdown, int16 minCountdown, int16 maxCountdown, int16 firstMinCountdown, int16 firstMaxCountdown) { - + _playOnceAfterCountdown = false; _playLooping = false; _playOnceAfterRandomCountdown = playOnceAfterRandomCountdown; @@ -361,7 +361,7 @@ void SoundMan::setSoundVolume(uint32 soundFileHash, int volume) { } void SoundMan::update() { - + for (uint i = 0; i < _soundItems.size(); ++i) { SoundItem *soundItem = _soundItems[i]; if (soundItem) @@ -456,7 +456,7 @@ void SoundMan::playSoundThree(uint32 groupNameHash, uint32 soundFileHash) { SoundItem *soundItem = new SoundItem(_vm, groupNameHash, soundFileHash, false, 0, 0, false, _initialCountdown3, false, 0); _soundIndex3 = addSoundItem(soundItem); } - + } void SoundMan::setTwoSoundsPlayFlag(bool playOnceAfterCountdown) { @@ -530,16 +530,16 @@ NeverhoodAudioStream::~NeverhoodAudioStream() { int NeverhoodAudioStream::readBuffer(int16 *buffer, const int numSamples) { int samplesLeft = numSamples; - + while (samplesLeft > 0 && !_endOfData) { const int maxSamples = MIN(kSampleBufferLength, samplesLeft); const int bytesToRead = maxSamples * (_isCompressed ? 1 : 2); int bytesRead = _stream->read(_buffer, bytesToRead); int samplesRead = bytesRead / (_isCompressed ? 1 : 2); - + samplesLeft -= samplesRead; - + const byte *src = _buffer; if (_isCompressed) { while (samplesRead--) { @@ -694,7 +694,7 @@ void AudioResourceManMusicItem::update() { _start = false; _isPlaying = true; } - + if (_vm->_mixer->isSoundHandleActive(_soundHandle)) { if (_isFadingIn) { _fadeVolume += _fadeVolumeStep; @@ -787,11 +787,11 @@ int16 AudioResourceMan::loadMusic(uint32 fileHash) { return i; } } - + int16 musicIndex = _musicItems.size(); _musicItems.push_back(musicItem); return musicIndex; - + } void AudioResourceMan::updateMusic() { diff --git a/engines/neverhood/sound.h b/engines/neverhood/sound.h index aa5da284ea..0733346daa 100644 --- a/engines/neverhood/sound.h +++ b/engines/neverhood/sound.h @@ -70,7 +70,7 @@ public: void setVolume(int16 volume); protected: NeverhoodEngine *_vm; - int16 _musicIndex; + int16 _musicIndex; AudioResourceManMusicItem *getMusicItem(); }; @@ -83,7 +83,7 @@ public: void update(); uint32 getGroupNameHash() const { return _groupNameHash; } uint32 getFileHash() const { return _fileHash; } -protected: +protected: NeverhoodEngine *_vm; uint32 _groupNameHash; uint32 _fileHash; @@ -110,7 +110,7 @@ public: uint32 getGroupNameHash() const { return _groupNameHash; } uint32 getFileHash() const { return _fileHash; } int16 getCurrCountdown() const { return _currCountdown; } -protected: +protected: NeverhoodEngine *_vm; uint32 _groupNameHash; uint32 _fileHash; @@ -136,7 +136,7 @@ public: void deleteMusic(uint32 musicFileHash); void startMusic(uint32 musicFileHash, int16 countdown, int16 fadeVolumeStep); void stopMusic(uint32 musicFileHash, int16 countdown, int16 fadeVolumeStep); - + // Sound void addSound(uint32 groupNameHash, uint32 soundFileHash); void addSoundList(uint32 groupNameHash, const uint32 *soundFileHashList); @@ -148,7 +148,7 @@ public: void playSoundLooping(uint32 soundFileHash); void stopSound(uint32 soundFileHash); void setSoundVolume(uint32 soundFileHash, int volume); - + // Misc void update(); void deleteGroup(uint32 groupNameHash); @@ -161,25 +161,25 @@ public: protected: NeverhoodEngine *_vm; - + // TODO Find out what these special sounds are used for (door sounds?) int _soundIndex1, _soundIndex2; int16 _initialCountdown; bool _playOnceAfterCountdown; - + int _soundIndex3; int16 _initialCountdown3; bool _playOnceAfterCountdown3; Common::Array _musicItems; Common::Array _soundItems; - + MusicItem *getMusicItemByHash(uint32 musicFileHash); SoundItem *getSoundItemByHash(uint32 soundFileHash); int16 addMusicItem(MusicItem *musicItem); int16 addSoundItem(SoundItem *soundItem); void deleteSoundByIndex(int index); - + }; class NeverhoodAudioStream : public Audio::AudioStream { @@ -209,7 +209,7 @@ private: // TODO Rename these class AudioResourceManSoundItem { -public: +public: AudioResourceManSoundItem(NeverhoodEngine *vm, uint32 fileHash); void loadSound(); void unloadSound(); @@ -218,7 +218,7 @@ public: void playSound(bool looping); void stopSound(); bool isPlaying(); -protected: +protected: NeverhoodEngine *_vm; uint32 _fileHash; ResourceHandle _resourceHandle; @@ -243,7 +243,7 @@ public: bool canRestart() const { return _canRestart; } bool isTerminated() const { return _terminate; } uint32 getFileHash() const { return _fileHash; } -protected: +protected: NeverhoodEngine *_vm; uint32 _fileHash; bool _isPlaying; @@ -263,7 +263,7 @@ class AudioResourceMan { public: AudioResourceMan(NeverhoodEngine *vm); ~AudioResourceMan(); - + void stopAllSounds(); int16 addSound(uint32 fileHash); @@ -271,10 +271,10 @@ public: int16 loadMusic(uint32 fileHash); void updateMusic(); - + AudioResourceManSoundItem *getSoundItem(int16 index); AudioResourceManMusicItem *getMusicItem(int16 index); - + protected: NeverhoodEngine *_vm; diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 50880089f9..3c158ff7e3 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -28,11 +28,11 @@ namespace Neverhood { // Sprite Sprite::Sprite(NeverhoodEngine *vm, int objectPriority) - : Entity(vm, objectPriority), _x(0), _y(0), _spriteUpdateCb(NULL), _filterXCb(NULL), _filterYCb(NULL), + : Entity(vm, objectPriority), _x(0), _y(0), _spriteUpdateCb(NULL), _filterXCb(NULL), _filterYCb(NULL), _dataResource(vm), _doDeltaX(false), _doDeltaY(false), _needRefresh(false), _flags(0), _surface(NULL) { SetMessageHandler(&Sprite::handleMessage); - + } Sprite::~Sprite() { @@ -71,7 +71,7 @@ bool Sprite::isPointInside(int16 x, int16 y) { } bool Sprite::checkCollision(NRect &rect) { - return (_collisionBounds.x1 < rect.x2) && (rect.x1 < _collisionBounds.x2) && (_collisionBounds.y1 < rect.y2) && (rect.y1 < _collisionBounds.y2); + return (_collisionBounds.x1 < rect.x2) && (rect.x1 < _collisionBounds.x2) && (_collisionBounds.y1 < rect.y2) && (rect.y1 < _collisionBounds.y2); } uint32 Sprite::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { @@ -153,13 +153,13 @@ void StaticSprite::updatePosition() { if (!_surface) return; - + if (_doDeltaX) { _surface->getDrawRect().x = filterX(_x - _drawOffset.x - _drawOffset.width + 1); } else { _surface->getDrawRect().x = filterX(_x + _drawOffset.x); } - + if (_doDeltaY) { _surface->getDrawRect().y = filterY(_y - _drawOffset.y - _drawOffset.height + 1); } else { @@ -261,7 +261,7 @@ void AnimatedSprite::updateAnim() { } if (_newAnimFileHash == 0 && _currFrameIndex != _currStickFrameIndex) { if (_currFrameTicks != 0 && (--_currFrameTicks == 0) && _animResource.getFrameCount() != 0) { - + if (_nextAnimFileHash != 0) { if (_animResource.load(_nextAnimFileHash)) { _currAnimFileHash = _nextAnimFileHash; @@ -270,7 +270,7 @@ void AnimatedSprite::updateAnim() { _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { - _animResource.setRepl(_replOldColor, _replNewColor); + _animResource.setRepl(_replOldColor, _replNewColor); } _nextAnimFileHash = 0; if (_animStatus != 0) { @@ -278,17 +278,17 @@ void AnimatedSprite::updateAnim() { _lastFrameIndex = _plLastFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plLastFrameHash)) : _animResource.getFrameCount() - 1; } else { _currFrameIndex = _plFirstFrameIndex != -1 ? _plFirstFrameIndex : _animResource.getFrameCount() - 1; - _lastFrameIndex = _plLastFrameIndex != -1 ? _plLastFrameIndex : _animResource.getFrameCount() - 1; + _lastFrameIndex = _plLastFrameIndex != -1 ? _plLastFrameIndex : _animResource.getFrameCount() - 1; } } else { updateFrameIndex(); } if (_newAnimFileHash == 0) updateFrameInfo(); - } + } } } - + if (_newAnimFileHash != 0) { if (_animStatus == 2) { _currStickFrameIndex = _currFrameIndex; @@ -301,7 +301,7 @@ void AnimatedSprite::updateAnim() { _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { - _animResource.setRepl(_replOldColor, _replNewColor); + _animResource.setRepl(_replOldColor, _replNewColor); } _newAnimFileHash = 0; _currFrameIndex = _plFirstFrameHash != 0 ? MAX(0, _animResource.getFrameIndex(_plFirstFrameHash)) : 0; @@ -314,7 +314,7 @@ void AnimatedSprite::updateAnim() { _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { - _animResource.setRepl(_replOldColor, _replNewColor); + _animResource.setRepl(_replOldColor, _replNewColor); } _newAnimFileHash = 0; _currFrameIndex = _plFirstFrameIndex != -1 ? _plFirstFrameIndex : _animResource.getFrameCount() - 1; diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp index 3f89c2236f..006992641a 100644 --- a/engines/neverhood/staticdata.cpp +++ b/engines/neverhood/staticdata.cpp @@ -33,13 +33,13 @@ StaticData::~StaticData() { void StaticData::load(const char *filename) { Common::File fd; - + if (!fd.open(filename)) error("StaticData::load() Could not open %s", filename); - - fd.readUint32LE(); // magic + + fd.readUint32LE(); // magic fd.readUint32LE(); // version - + // Load message lists uint32 messageListsCount = fd.readUint32LE(); debug(3, "messageListsCount: %d", messageListsCount); @@ -84,7 +84,7 @@ void StaticData::load(const char *filename) { } _rectLists[id] = rectList; } - + // Load hit rects uint32 hitRectListsCount = fd.readUint32LE(); debug(3, "hitRectListsCount: %d", hitRectListsCount); diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 812d967b9f..3ac89bc2c2 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -364,7 +364,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { // Load MIDI/XMI resource data if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { - // Load the external music file for Mac IHNM + // Load the external music file for Mac IHNM _player->playQuickTime(Common::String::format("Music/Music%02x", resourceId), flags & MUSIC_LOOP); } else { if (_currentMusicBuffer == &_musicBuffer[1]) { diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 64793efa6c..3c223bebbe 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1966,7 +1966,7 @@ static bool isVertexCovered(const Patch &p, unsigned int wi) { // ---w1--1----p----w2--2---- // ^ \ (inside) if (wi > p.indexw1 && wi <= p.indexw2) - return true; + return true; // v / (outside) // ---w2--2----p----w1--1---- diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 15a9f54996..d72b1d1772 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -551,7 +551,7 @@ reg_t kMessage(EngineState *s, int argc, reg_t *argv) { // NOTE: To fix a corrupted jar object, type "send Glass_Jar message 52" // in the debugger. if (g_sci->getGameId() == GID_PEPPER && func == 0 && argc >= 6 && module == 894 && - tuple.noun == 26 && tuple.cond == 0 && tuple.seq == 1 && + tuple.noun == 26 && tuple.cond == 0 && tuple.seq == 1 && !s->_msgState->getMessage(module, tuple, NULL_REG)) tuple.verb = 0; diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index bf1ce6da64..bb960c8501 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -745,7 +745,7 @@ void GfxFrameout::kernelFrameout() { // Process global scaling, if needed. // TODO: Seems like SCI32 always processes global scaling for scaled objects // TODO: We can only process symmetrical scaling for now (i.e. same value for scaleX/scaleY) - if ((itemEntry->scaleSignal & kScaleSignalDoScaling32) && + if ((itemEntry->scaleSignal & kScaleSignalDoScaling32) && !(itemEntry->scaleSignal & kScaleSignalDisableGlobalScaling32) && (itemEntry->scaleX == itemEntry->scaleY) && itemEntry->scaleX != 128) diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 7f771a0265..0e96952a48 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -1509,7 +1509,7 @@ void IMuseInternal::initGM(MidiDriver *midi) { midi->sysEx(buffer, 9); debug(2, "GS SysEx: GS Reset"); _system->delayMillis(200); - + // Set global Master Tune to 442.0kHz, as on the MT-32 memcpy(&buffer[4], "\x40\x00\x00\x00\x04\x04\x0F\x29", 8); midi->sysEx(buffer, 12); diff --git a/engines/scumm/player_v3m.cpp b/engines/scumm/player_v3m.cpp index 0f222d84fe..bf65ec797f 100644 --- a/engines/scumm/player_v3m.cpp +++ b/engines/scumm/player_v3m.cpp @@ -124,7 +124,7 @@ bool Player_V3M::checkMusicAvailable() { return true; } } - + GUI::MessageDialog dialog(_( "Could not find the 'Loom' Macintosh executable to read the\n" "instruments from. Music will be disabled."), _("OK")); diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp index 242508bf85..1f3d2d063d 100644 --- a/engines/sword25/gfx/dynamicbitmap.cpp +++ b/engines/sword25/gfx/dynamicbitmap.cpp @@ -53,7 +53,7 @@ DynamicBitmap::DynamicBitmap(InputPersistenceBlock &reader, RenderObjectPtrgetGfx(); assert(pGfx); - + // Draw the bitmap bool result; if (_scaleFactorX == 1.0f && _scaleFactorY == 1.0f) { diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h index 9d7fc43251..8db54e7c54 100644 --- a/engines/sword25/gfx/image/image.h +++ b/engines/sword25/gfx/image/image.h @@ -205,7 +205,7 @@ public: @brief Returns true, if the content of the BS_Image is allowed to be replaced by call of SetContent(). */ virtual bool isSetContentAllowed() const = 0; - + virtual bool isSolid() const { return false; } //@} diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 81a29c727f..9b8cf2266d 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -294,7 +294,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe for (RectangleList::iterator it = updateRects->begin(); it != updateRects->end(); ++it) { const Common::Rect &clipRect = *it; - + int skipLeft = 0, skipTop = 0; int drawX = posX, drawY = posY; int drawWidth = img->w; @@ -306,7 +306,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe drawWidth -= skipLeft; drawX = clipRect.left; } - + if (drawY < clipRect.top) { skipTop = clipRect.top - drawY; drawHeight -= skipTop; @@ -315,13 +315,13 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe if (drawX + drawWidth >= clipRect.right) drawWidth = clipRect.right - drawX; - + if (drawY + drawHeight >= clipRect.bottom) drawHeight = clipRect.bottom - drawY; - + if ((drawWidth > 0) && (drawHeight > 0)) { int xp = 0, yp = 0; - + int inStep = 4; int inoStep = img->pitch; if (flipping & Image::FLIP_V) { @@ -330,14 +330,14 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } else { xp = skipLeft; } - + if (flipping & Image::FLIP_H) { inoStep = -inoStep; yp = img->h - 1 - skipTop; } else { yp = skipTop; } - + byte *ino = (byte *)img->getBasePtr(xp, yp); byte *outo = (byte *)_backSurface->getBasePtr(drawX, drawY); @@ -351,7 +351,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe ino += inoStep; } } else -#endif +#endif { byte *in, *out; for (int i = 0; i < drawHeight; i++) { @@ -361,7 +361,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe uint32 pix = *(uint32 *)in; int a = (pix >> 24) & 0xff; in += inStep; - + if (ca != 255) { a = a * ca >> 8; } @@ -371,11 +371,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe out += 4; continue; } - + int b = (pix >> 0) & 0xff; int g = (pix >> 8) & 0xff; int r = (pix >> 16) & 0xff; - + if (a == 255) { #if defined(SCUMM_LITTLE_ENDIAN) if (cb != 255) @@ -460,7 +460,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } } - + } if (imgScaled) { diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp index 931b9cdbe7..b9bb8b087d 100644 --- a/engines/sword25/gfx/panel.cpp +++ b/engines/sword25/gfx/panel.cpp @@ -84,7 +84,7 @@ bool Panel::doRender(RectangleList *updateRects) { gfxPtr->fill(&intersectionRect, _color); } } - + return true; } diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp index 807c1eb64b..1dd6f4590f 100644 --- a/engines/sword25/gfx/renderobject.cpp +++ b/engines/sword25/gfx/renderobject.cpp @@ -183,7 +183,7 @@ bool RenderObject::updateObjectState() { // Die Bounding-Box neu berechnen und Update-Regions registrieren. updateBoxes(); - + ++_version; // Änderungen Validieren diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h index 7e0334ee88..1116c3284c 100644 --- a/engines/sword25/gfx/renderobject.h +++ b/engines/sword25/gfx/renderobject.h @@ -236,7 +236,7 @@ public: @brief Löscht alle Kinderobjekte. */ void deleteAllChildren(); - + // Accessor-Methoden // ----------------- /** @@ -305,11 +305,11 @@ public: int getZ() const { return _z; } - + int getAbsoluteZ() const { return _absoluteZ; } - + /** @brief Gibt die Breite des Objektes zurück. */ @@ -363,11 +363,11 @@ public: return _handle; } - // Get the RenderObjects current version + // Get the RenderObjects current version int getVersion() const { return _version; } - + bool isSolid() const { return _isSolid; } @@ -410,7 +410,7 @@ protected: bool _oldVisible; static int _nextGlobalVersion; - + int _version; // This should be set to true if the RenderObject is NOT alpha-blended to optimize drawing @@ -509,9 +509,9 @@ private: @brief Berechnet die absolute Position des Objektes. */ int calcAbsoluteY() const; - + int calcAbsoluteZ() const; - + /** @brief Sortiert alle Kinderobjekte nach ihrem Renderang. */ diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp index 994d9367ab..77f944c9e0 100644 --- a/engines/sword25/gfx/renderobjectmanager.cpp +++ b/engines/sword25/gfx/renderobjectmanager.cpp @@ -113,7 +113,7 @@ bool RenderObjectManager::render() { RectangleList *updateRects = _uta->getRectangles(); Common::Array updateRectsMinZ; - + updateRectsMinZ.reserve(updateRects->size()); // Calculate the minimum drawing Z value of each update rectangle @@ -144,9 +144,9 @@ bool RenderObjectManager::render() { } delete updateRects; - + SWAP(_currQueue, _prevQueue); - + return true; } diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp index 91b93e8910..bb57fa3a03 100644 --- a/engines/sword25/gfx/staticbitmap.cpp +++ b/engines/sword25/gfx/staticbitmap.cpp @@ -71,7 +71,7 @@ bool StaticBitmap::initBitmapResource(const Common::String &filename) { // RenderObject Eigenschaften aktualisieren _originalWidth = _width = bitmapPtr->getWidth(); _originalHeight = _height = bitmapPtr->getHeight(); - + _isSolid = bitmapPtr->isSolid(); // Bild-Resource freigeben diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 2de81abb37..3e6e40a8fa 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -294,7 +294,7 @@ bool TeenAgentEngine::fnRobotSafeAlreadyUnlockedCheck() { } void TeenAgentEngine::fnRobotSafeUnlockCheck() { - if (CHECK_FLAG(dsAddr_MansionRobotSafeVoiceTestPassedFlag, 1) && + if (CHECK_FLAG(dsAddr_MansionRobotSafeVoiceTestPassedFlag, 1) && CHECK_FLAG(dsAddr_MansionRobotSafeScentTestPassedFlag, 1) && CHECK_FLAG(dsAddr_MansionRobotSafeViewTestPassedFlag, 1)) { waitLanAnimationFrame(1, 1); @@ -546,7 +546,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { break; case 0x4056: - // FIXME - This is the bird use callback in the first act at + // FIXME - This is the bird use callback in the first act at // the mudpool. Current Code based on behaviour. Need to analyse cseg data. dialog->popMark(scene, dsAddr_dialogStackMudpoolBird); break; @@ -1603,7 +1603,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { break; case 0x5b44: - // FIXME - This is the doorbell use callback on House #2 + // FIXME - This is the doorbell use callback on House #2 // i.e. Granny and Anne's House. Need to analyse cseg data properly. // Current code inferred from behaviour. // FIXME - Add animation call for Ego pushing doorbell. diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp index 870aca6400..312757a462 100644 --- a/engines/teenagent/dialog.cpp +++ b/engines/teenagent/dialog.cpp @@ -28,7 +28,7 @@ namespace TeenAgent { void Dialog::show(uint16 dialogNum, Scene *scene, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) { uint16 addr = _vm->res->getDialogAddr(dialogNum); - // WORKAROUND: For Dialog 163, The usage of this in the engine overlaps the previous dialog i.e. the + // WORKAROUND: For Dialog 163, The usage of this in the engine overlaps the previous dialog i.e. the // starting offset used is two bytes early, thus implicitly changing the first command of this dialog // from NEW_LINE to CHANGE_CHARACTER. // FIXME: Unsure if this is correct behaviour or if this is a regression from the original. Check this. diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 3921414b01..104adf72a2 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -300,7 +300,7 @@ void LoadFile(MEMHANDLE *pH) { // discardable - unlock the memory MemoryUnlock(pH->_node); - + // set the loaded flag pH->filesize |= fLoaded; diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index 17cb23b98f..43654fc3af 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -138,7 +138,7 @@ const SCENE_STRUC *GetSceneStruc(const byte *pStruc) { g_tempStruc.hEntrance = READ_32(p); p += sizeof(uint32); g_tempStruc.hPoly = READ_32(p); p += sizeof(uint32); g_tempStruc.hTaggedActor = READ_32(p); p += sizeof(uint32); - + return &g_tempStruc; } diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index b359e16f52..b6ed17aacb 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3216,7 +3216,7 @@ void Visage::flipVertical(GfxSurface &gfxSurface) { // Flip the lines1 byte *line1P = (byte *)s.getBasePtr(0, y); byte *line2P = (byte *)s.getBasePtr(0, s.h - y - 1); - + for (int x = 0; x < s.w; ++x) SWAP(line1P[x], line2P[x]); } diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index dc73408b0e..a010b46ea5 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -242,7 +242,7 @@ void GfxSurface::clear() { _customSurface->free(); delete _customSurface; _customSurface = NULL; - } + } } /** diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index fa9a94209a..6446f1953d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1351,7 +1351,7 @@ void MazeUI::clear() { if (_mapData) DEALLOCATE(_mapData); _mapData = NULL; - + _mapImage.clear(); } @@ -1397,7 +1397,7 @@ void MazeUI::draw() { // Loop to handle the cell rows of the visible display area one at a time for (int yCtr = 0; yCtr < _cellsVisible.y; ++yCtr, yPos += ySize) { int cellY = _mapOffset.y / _cellSize.y + yCtr; - + // Loop to iterate through the horizontal visible cells to build up // an entire cell high horizontal slice of the map for (int xCtr = 0; xCtr < _cellsVisible.x; ++xCtr) { @@ -1408,7 +1408,7 @@ void MazeUI::draw() { if (cell >= 0) { int frameNum = (cell % _frameCount) + 1; int rlbNum = (cell % _resCount) / _frameCount + 1; - int resNum = _cellsResNum + (cell / _resCount); + int resNum = _cellsResNum + (cell / _resCount); visage.setVisage(resNum, rlbNum); GfxSurface frame = visage.getFrame(frameNum); @@ -1426,7 +1426,7 @@ void MazeUI::draw() { // First line of the map to be displayed - only the bottom portion of that // first cell row may be visible yPos = _bounds.top; - ySize = _cellSize.y - (_mapOffset.y % _cellSize.y); + ySize = _cellSize.y - (_mapOffset.y % _cellSize.y); Rect srcBounds(_mapOffset.x % _cellSize.x, _mapOffset.y % _cellSize.y, (_mapOffset.x % _cellSize.x) + _bounds.width(), _cellSize.y); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index adeeab1c64..dbcec9dd63 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -7258,7 +7258,7 @@ bool Scene900::Button::startAction(CursorType action, Event &event) { break; } } else if (action == CURSOR_LOOK) { - SceneItem::display(900, ((_buttonId == 2) && (scene->_field412 == 2)) ? 21 : _buttonId + 11, + SceneItem::display(900, ((_buttonId == 2) && (scene->_field412 == 2)) ? 21 : _buttonId + 11, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, -999); return true; } else { diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 02a0c05c0c..9246c4b6a4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -762,8 +762,8 @@ Scene2000::Scene2000(): SceneExt() { R2_GLOBALS._v56605[1] = 21; R2_GLOBALS._v56605[2] = 21; } - if ((R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex] - != R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) + if ((R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex] + != R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) && (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 2350)) { R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 0; } diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index d5e7b1b9c1..6af2a0cad4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -4008,7 +4008,7 @@ void Scene3500::dispatch() { if ( (((cellId == 25) || (cellId == 26) || (cellId == 5)) && (newMazeY >= var_6) && (_mazePosition.y <= var_6)) || (((cellId == 23) || (cellId == 24) || (cellId == 4) || (cellId == 14) || (cellId == 15)) && (_mazeChangeAmount >= var_a) && (_mazeChangeAmount <= 3) && (_action1._field24 != 0)) ){ newMazeY = var_6; - + if ((cellId != 23) && (cellId != 24) && (cellId != 4) && (cellId != 14) && (cellId != 15)) R2_GLOBALS._sound2.play(339); _rotation->_idxChange = 0; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 192b6972c5..bff61bafc4 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -75,7 +75,7 @@ void VisualSpeaker::signal() { _sceneText.show(); if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { - // TODO: Check global that is passed + // TODO: Check global that is passed setFrame2(/* word_55F90 */ 0); } } else if (_action && _object2) { diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index 4483bbc667..d59bcf363c 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -166,7 +166,7 @@ BaseFont *AdResponse::getFont() const { int32 AdResponse::getID() const { return _iD; } - + const char *AdResponse::getText() const { return _text; } diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 4d8e79b5c2..0594699edc 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -212,7 +212,7 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam #else*/ _touchInterface = false; _constrainedMemory = false; - + _settings = new BaseGameSettings(this); //#endif @@ -3734,7 +3734,7 @@ bool BaseGame::onWindowClose() { bool BaseGame::displayDebugInfo() { const uint32 strLength = 100; char str[strLength]; - + if (_debugShowFPS) { sprintf(str, "FPS: %d", _gameRef->_fps); _systemFont->drawText((byte *)str, 0, 0, 100, TAL_LEFT); diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index d51255d013..b821805ada 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -137,7 +137,7 @@ public: bool initialize2(); bool initialize3(); BaseTransitionMgr *_transMgr; - + // String Table void expandStringByStringTable(char **str) const; char *getKeyFromStringTable(const char *str) const; @@ -275,7 +275,7 @@ private: bool _mouseRightDown; bool _mouseMidlleDown; - + BaseGameSettings *_settings; int32 _soundBufferSizeSec; diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp index ac23801e4c..eff5d47210 100644 --- a/engines/wintermute/base/base_game_music.cpp +++ b/engines/wintermute/base/base_game_music.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -65,10 +65,10 @@ bool BaseGameMusic::playMusic(int channel, const char *filename, bool looping, u BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + delete _music[channel]; _music[channel] = nullptr; - + _music[channel] = new BaseSound(_gameRef); if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { if (_musicStartTime[channel]) { @@ -93,7 +93,7 @@ bool BaseGameMusic::stopMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { _music[channel]->stop(); delete _music[channel]; @@ -111,7 +111,7 @@ bool BaseGameMusic::pauseMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { return _music[channel]->pause(); } else { @@ -126,7 +126,7 @@ bool BaseGameMusic::resumeMusic(int channel) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + if (_music[channel]) { return _music[channel]->resume(); } else { @@ -141,7 +141,7 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) { BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; } - + _musicStartTime[channel] = time; if (_music[channel] && _music[channel]->isPlaying()) { return _music[channel]->setPositionTime(time); @@ -153,14 +153,14 @@ bool BaseGameMusic::setMusicStartTime(int channel, uint32 time) { ////////////////////////////////////////////////////////////////////////// bool BaseGameMusic::updateMusicCrossfade() { /* byte globMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */ - + if (!_musicCrossfadeRunning) { return STATUS_OK; } if (_gameRef->_state == GAME_FROZEN) { return STATUS_OK; } - + if (_musicCrossfadeChannel1 < 0 || _musicCrossfadeChannel1 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel1]) { _musicCrossfadeRunning = false; return STATUS_OK; @@ -169,34 +169,34 @@ bool BaseGameMusic::updateMusicCrossfade() { _musicCrossfadeRunning = false; return STATUS_OK; } - + if (!_music[_musicCrossfadeChannel1]->isPlaying()) { _music[_musicCrossfadeChannel1]->play(); } if (!_music[_musicCrossfadeChannel2]->isPlaying()) { _music[_musicCrossfadeChannel2]->play(); } - + uint32 currentTime = _gameRef->getLiveTimer()->getTime() - _musicCrossfadeStartTime; - + if (currentTime >= _musicCrossfadeLength) { _musicCrossfadeRunning = false; //_music[_musicCrossfadeChannel2]->setVolume(GlobMusicVol); _music[_musicCrossfadeChannel2]->setVolumePercent(100); - + _music[_musicCrossfadeChannel1]->stop(); //_music[_musicCrossfadeChannel1]->setVolume(GlobMusicVol); _music[_musicCrossfadeChannel1]->setVolumePercent(100); - - + + if (_musicCrossfadeSwap) { // swap channels BaseSound *dummy = _music[_musicCrossfadeChannel1]; int dummyInt = _musicStartTime[_musicCrossfadeChannel1]; - + _music[_musicCrossfadeChannel1] = _music[_musicCrossfadeChannel2]; _musicStartTime[_musicCrossfadeChannel1] = _musicStartTime[_musicCrossfadeChannel2]; - + _music[_musicCrossfadeChannel2] = dummy; _musicStartTime[_musicCrossfadeChannel2] = dummyInt; } @@ -205,10 +205,10 @@ bool BaseGameMusic::updateMusicCrossfade() { //_music[_musicCrossfadeChannel2]->setVolume((float)CurrentTime / (float)_musicCrossfadeLength * GlobMusicVol); _music[_musicCrossfadeChannel1]->setVolumePercent((int)(100.0f - (float)currentTime / (float)_musicCrossfadeLength * 100.0f)); _music[_musicCrossfadeChannel2]->setVolumePercent((int)((float)currentTime / (float)_musicCrossfadeLength * 100.0f)); - + //_gameRef->QuickMessageForm("%d %d", _music[_musicCrossfadeChannel1]->GetVolume(), _music[_musicCrossfadeChannel2]->GetVolume()); } - + return STATUS_OK; } @@ -242,15 +242,15 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(4); channel = stack->pop()->getInt(); } - + const char *filename = stack->pop()->getString(); ScValue *valLooping = stack->pop(); bool looping = valLooping->isNULL() ? true : valLooping->getBool(); - + ScValue *valLoopStart = stack->pop(); uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt()); - - + + if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) { stack->pushBool(false); } else { @@ -258,20 +258,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // StopMusic / StopMusicChannel ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "StopMusic") == 0 || strcmp(name, "StopMusicChannel") == 0) { int channel = 0; - + if (strcmp(name, "StopMusic") == 0) { stack->correctParams(0); } else { stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(stopMusic(channel))) { stack->pushBool(false); } else { @@ -279,20 +279,20 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // PauseMusic / PauseMusicChannel ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "PauseMusic") == 0 || strcmp(name, "PauseMusicChannel") == 0) { int channel = 0; - + if (strcmp(name, "PauseMusic") == 0) { stack->correctParams(0); } else { stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(pauseMusic(channel))) { stack->pushBool(false); } else { @@ -300,7 +300,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // ResumeMusic / ResumeMusicChannel ////////////////////////////////////////////////////////////////////////// @@ -312,7 +312,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (DID_FAIL(resumeMusic(channel))) { stack->pushBool(false); } else { @@ -320,7 +320,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusic / GetMusicChannel ////////////////////////////////////////////////////////////////////////// @@ -343,7 +343,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // SetMusicPosition / SetMusicChannelPosition ////////////////////////////////////////////////////////////////////////// @@ -355,18 +355,18 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(2); channel = stack->pop()->getInt(); } - + uint32 time = stack->pop()->getInt(); - + if (DID_FAIL(setMusicStartTime(channel, time))) { stack->pushBool(false); } else { stack->pushBool(true); } - + return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusicPosition / GetMusicChannelPosition ////////////////////////////////////////////////////////////////////////// @@ -378,7 +378,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushInt(0); } else { @@ -386,7 +386,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // IsMusicPlaying / IsMusicChannelPlaying ////////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushBool(false); } else { @@ -406,7 +406,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // SetMusicVolume / SetMusicChannelVolume ////////////////////////////////////////////////////////////////////////// @@ -418,7 +418,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(2); channel = stack->pop()->getInt(); } - + int volume = stack->pop()->getInt(); if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushBool(false); @@ -431,7 +431,7 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // GetMusicVolume / GetMusicChannelVolume ////////////////////////////////////////////////////////////////////////// @@ -443,16 +443,16 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this stack->correctParams(1); channel = stack->pop()->getInt(); } - + if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) { stack->pushInt(0); } else { stack->pushInt(_music[channel]->getVolumePercent()); } - + return STATUS_OK; } - + ////////////////////////////////////////////////////////////////////////// // MusicCrossfade ////////////////////////////////////////////////////////////////////////// @@ -462,34 +462,34 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this int channel2 = stack->pop()->getInt(0); uint32 fadeLength = (uint32)stack->pop()->getInt(0); bool swap = stack->pop()->getBool(true); - + if (_musicCrossfadeRunning) { script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress."); stack->pushBool(false); return STATUS_OK; } - + _musicCrossfadeStartTime = _gameRef->getLiveTimer()->getTime(); _musicCrossfadeChannel1 = channel1; _musicCrossfadeChannel2 = channel2; _musicCrossfadeLength = fadeLength; _musicCrossfadeSwap = swap; - + _musicCrossfadeRunning = true; - + stack->pushBool(true); return STATUS_OK; - } + } ////////////////////////////////////////////////////////////////////////// // GetSoundLength ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "GetSoundLength") == 0) { stack->correctParams(1); - + int length = 0; const char *filename = stack->pop()->getString(); - + BaseSound *sound = new BaseSound(_gameRef); if (sound && DID_SUCCEED(sound->setSound(filename, Audio::Mixer::kMusicSoundType, true))) { length = sound->getLength(); diff --git a/engines/wintermute/base/base_game_music.h b/engines/wintermute/base/base_game_music.h index 0ac904b8c1..150ea6200c 100644 --- a/engines/wintermute/base/base_game_music.h +++ b/engines/wintermute/base/base_game_music.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -53,7 +53,7 @@ public: bool stopMusic(int channel); bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); bool updateMusicCrossfade(); - + bool persistChannels(BasePersistenceManager *persistMgr); bool persistCrossfadeSettings(BasePersistenceManager *persistMgr); private: diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp index 55fbe39fd2..9b5eb314bb 100644 --- a/engines/wintermute/base/base_game_settings.cpp +++ b/engines/wintermute/base/base_game_settings.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -47,7 +47,7 @@ BaseGameSettings::BaseGameSettings(BaseGame *gameRef) { _allowAccessTab = true; _allowAboutTab = true; _allowDesktopRes = false; - + _compressedSavegames = true; _richSavedGames = false; _savedGameExt = "dsv"; @@ -101,21 +101,21 @@ bool BaseGameSettings::loadSettings(const char *filename) { TOKEN_TABLE(SAVED_GAME_EXT) TOKEN_TABLE(GUID) TOKEN_TABLE_END - - + + byte *origBuffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); if (origBuffer == nullptr) { BaseEngine::LOG(0, "BaseGame::LoadSettings failed for file '%s'", filename); return STATUS_FAILED; } - + bool ret = STATUS_OK; - + byte *buffer = origBuffer; byte *params; int cmd; BaseParser parser; - + if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_SETTINGS) { BaseEngine::LOG(0, "'SETTINGS' keyword expected in game settings file."); return STATUS_FAILED; @@ -130,61 +130,61 @@ bool BaseGameSettings::loadSettings(const char *filename) { strcpy(_gameFile, (char *)params); } break; - + case TOKEN_STRING_TABLE: if (DID_FAIL(_stringTable->loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; - + case TOKEN_RESOLUTION: parser.scanStr((char *)params, "%d,%d", &_resWidth, &_resHeight); break; - + case TOKEN_REQUIRE_3D_ACCELERATION: parser.scanStr((char *)params, "%b", &_requireAcceleration); break; - + case TOKEN_REQUIRE_SOUND: parser.scanStr((char *)params, "%b", &_requireSound); break; - + case TOKEN_HWTL_MODE: parser.scanStr((char *)params, "%d", &_TLMode); break; - + case TOKEN_ALLOW_WINDOWED_MODE: parser.scanStr((char *)params, "%b", &_allowWindowed); break; - + case TOKEN_ALLOW_DESKTOP_RES: parser.scanStr((char *)params, "%b", &_allowDesktopRes); break; - + case TOKEN_ALLOW_ADVANCED: parser.scanStr((char *)params, "%b", &_allowAdvanced); break; - + case TOKEN_ALLOW_ACCESSIBILITY_TAB: parser.scanStr((char *)params, "%b", &_allowAccessTab); break; - + case TOKEN_ALLOW_ABOUT_TAB: parser.scanStr((char *)params, "%b", &_allowAboutTab); break; - + case TOKEN_REGISTRY_PATH: //BaseEngine::instance().getRegistry()->setBasePath((char *)params); break; - + case TOKEN_RICH_SAVED_GAMES: parser.scanStr((char *)params, "%b", &_richSavedGames); break; - + case TOKEN_SAVED_GAME_EXT: _savedGameExt = (char *)params; break; - + case TOKEN_GUID: break; } @@ -197,12 +197,12 @@ bool BaseGameSettings::loadSettings(const char *filename) { BaseEngine::LOG(0, "Error loading game settings '%s'", filename); ret = STATUS_FAILED; } - + _allowWindowed = true; // TODO: These two settings should probably be cleaned out altogether. _compressedSavegames = true; - + delete[] origBuffer; - + return ret; } diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h index 1dfb0b50cc..92c00ab0c2 100644 --- a/engines/wintermute/base/base_game_settings.h +++ b/engines/wintermute/base/base_game_settings.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h index b62ece02b7..e321dfee16 100644 --- a/engines/wintermute/base/base_keyboard_state.h +++ b/engines/wintermute/base/base_keyboard_state.h @@ -61,7 +61,7 @@ private: bool _currentPrintable; uint32 _currentKeyData; uint32 _currentCharCode; - + bool _currentShift; bool _currentAlt; bool _currentControl; diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 5dbacb157b..c46bb721fe 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -282,7 +282,7 @@ bool BasePersistenceManager::initSave(const char *desc) { } else { _saveStream->writeUint32LE(0); } - + thumbnailOK = true; } } diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index e1424cea87..eca2998da5 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -546,7 +546,7 @@ void BaseRenderOSystem::drawTickets() { // Revert the colorMod-state. _colorMod = oldColorMod; - + it = _renderQueue.begin(); // Clean out the old tickets decrement = 0; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 0572ef2f6e..87bb2fdb53 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -163,7 +163,7 @@ bool BaseSurfaceOSystem::finishLoad() { needsColorKey = true; } } - + if (needsColorKey) { TransparentSurface trans(*_surface); trans.applyColorKey(_ckRed, _ckGreen, _ckBlue, replaceAlpha); diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 36c5d7b740..98c5be62a8 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h index 968b42b5e1..64df3590a1 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.h +++ b/engines/wintermute/base/gfx/osystem/render_ticket.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/base/save_thumb_helper.cpp b/engines/wintermute/base/save_thumb_helper.cpp index bab29c5cf8..535648eddd 100644 --- a/engines/wintermute/base/save_thumb_helper.cpp +++ b/engines/wintermute/base/save_thumb_helper.cpp @@ -56,23 +56,23 @@ BaseImage *SaveThumbHelper::storeThumb(bool doFlip, int width, int height) { // works normally for direct3d _gameRef->displayContent(false); _gameRef->_renderer->flip(); - + _gameRef->displayContent(false); _gameRef->_renderer->flip(); } - + BaseImage *screenshot = _gameRef->_renderer->takeScreenshot(); if (!screenshot) { return nullptr; } - + // normal thumbnail if (_gameRef->getSaveThumbWidth() > 0 && _gameRef->getSaveThumbHeight() > 0) { thumbnail = new BaseImage(); thumbnail->copyFrom(screenshot, width, height); } - - + + delete screenshot; screenshot = nullptr; } @@ -99,7 +99,7 @@ bool SaveThumbHelper::storeThumbnail(bool doFlip) { bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) { delete _scummVMThumb; _scummVMThumb = nullptr; - + _scummVMThumb = storeThumb(doFlip, kThumbnailWidth, kThumbnailHeight2); if (!_scummVMThumb) { return STATUS_FAILED; diff --git a/engines/wintermute/base/timer.cpp b/engines/wintermute/base/timer.cpp index 5dfc117f48..96097c10d5 100644 --- a/engines/wintermute/base/timer.cpp +++ b/engines/wintermute/base/timer.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/base/timer.h b/engines/wintermute/base/timer.h index ec5477ba2e..4099c6c825 100644 --- a/engines/wintermute/base/timer.h +++ b/engines/wintermute/base/timer.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -51,7 +51,7 @@ public: void persist(BasePersistenceManager *persistMgr); }; - + } // End of namespace Wintermute #endif diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp index 92b8e6251f..6e865befb9 100644 --- a/engines/wintermute/debugger.cpp +++ b/engines/wintermute/debugger.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h index 588b81af97..6fbbb084f0 100644 --- a/engines/wintermute/debugger.h +++ b/engines/wintermute/debugger.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -32,7 +32,7 @@ class Console : public GUI::Debugger { public: Console(WintermuteEngine *vm); virtual ~Console(); - + bool Cmd_ShowFps(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); private: diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 8f9db8392f..ac24c6f15e 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -163,14 +163,14 @@ bool VideoTheoraPlayer::resetStream() { if (!_file) { return STATUS_FAILED; } - + #if defined (USE_THEORADEC) _theoraDecoder = new Video::TheoraDecoder(); #else return STATUS_FAILED; #endif _theoraDecoder->loadStream(_file); - + if (!_theoraDecoder->isVideoLoaded()) { return STATUS_FAILED; } diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index 364509a080..40b9ba104a 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -101,7 +101,7 @@ public: // video properties int32 _posX; int32 _posY; - + bool _dontDropFrames; private: int32 _state; diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index f2df146804..89a226922a 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -89,7 +89,7 @@ EventRecorder::EventRecorder() { _lastScreenshotTime = 0; _screenshotPeriod = 0; _playbackFile = 0; - + DebugMan.addDebugChannel(kDebugLevelEventRec, "EventRec", "Event recorder debug level"); } @@ -186,7 +186,7 @@ void EventRecorder::checkForKeyCode(const Common::Event &event) { bool EventRecorder::pollEvent(Common::Event &ev) { if ((_recordMode != kRecorderPlayback) || !_initialized) return false; - + if ((_nextEvent.recordedtype == Common::kRecorderEventTypeTimer) || (_nextEvent.type == Common::EVENT_INVALID)) { return false; } diff --git a/gui/about.cpp b/gui/about.cpp index 088971f273..20145886c6 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -46,7 +46,7 @@ enum { // 0 - 2 -- set a custom color: // 0 normal text // 1 highlighted text -// 2 disabled text +// 2 disabled text // TODO: Maybe add a tab/indent feature; that is, make it possible to specify // an amount by which that line shall be indented (the indent of course would have // to be considered while performing any word wrapping, too). @@ -139,7 +139,7 @@ void AboutDialog::addLine(const char *str) { } else { Common::String format(str, 2); str += 2; - + static Common::String asciiStr; if (format[0] == 'A') { bool useAscii = false; diff --git a/gui/editrecorddialog.cpp b/gui/editrecorddialog.cpp index a6a7a2560e..cfcc747121 100644 --- a/gui/editrecorddialog.cpp +++ b/gui/editrecorddialog.cpp @@ -37,7 +37,7 @@ void EditRecordDialog::setAuthor(const Common::String &author) { const Common::String EditRecordDialog::getNotes() { return _notesEdit->getEditString(); -} +} void EditRecordDialog::setNotes(const Common::String &desc) { _notesEdit->setEditString(desc); diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index 59fd83362e..18eb9a00a3 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -69,7 +69,7 @@ RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentS new GUI::ButtonWidget(this, "RecorderDialog.Cancel", _("Cancel"), 0, kCloseCmd); new GUI::ButtonWidget(this, "RecorderDialog.Record", _("Record"), 0, kRecordCmd); _playbackButton = new GUI::ButtonWidget(this, "RecorderDialog.Playback", _("Playback"), 0, kPlaybackCmd); - + _editButton = new GUI::ButtonWidget(this, "RecorderDialog.Edit", _("Edit"), 0, kEditRecordCmd); _editButton->setEnabled(false); @@ -80,7 +80,7 @@ RecorderDialog::RecorderDialog() : Dialog("RecorderDialog"), _list(0), _currentS _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); if (g_gui.xmlEval()->getVar("Globals.RecorderDialog.ExtInfo.Visible") == 1) { new GUI::ButtonWidget(this,"RecorderDialog.NextScreenShotButton", "<", 0, kPrevScreenshotCmd); - new GUI::ButtonWidget(this, "RecorderDialog.PreviousScreenShotButton", ">", 0, kNextScreenshotCmd); + new GUI::ButtonWidget(this, "RecorderDialog.PreviousScreenShotButton", ">", 0, kNextScreenshotCmd); _currentScreenshotText = new StaticTextWidget(this, "RecorderDialog.currentScreenshot", "0/0"); _authorText = new StaticTextWidget(this, "RecorderDialog.Author", _("Author: ")); _notesText = new StaticTextWidget(this, "RecorderDialog.Notes", _("Notes: ")); diff --git a/video/codecs/codec.h b/video/codecs/codec.h index c1194e461b..a4ad786bb0 100644 --- a/video/codecs/codec.h +++ b/video/codecs/codec.h @@ -51,7 +51,7 @@ public: * containing the decoded frame. * * @return a pointer to the decoded frame - * @note stream is not deleted + * @note stream is not deleted */ virtual const Graphics::Surface *decodeImage(Common::SeekableReadStream *stream) = 0; diff --git a/video/codecs/mpeg.cpp b/video/codecs/mpeg.cpp index cb3c63fcfc..4540b4182e 100644 --- a/video/codecs/mpeg.cpp +++ b/video/codecs/mpeg.cpp @@ -58,7 +58,7 @@ const Graphics::Surface *MPEGDecoder::decodeImage(Common::SeekableReadStream *st return _surface; } -bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32 &framePeriod, Graphics::Surface *dst) { +bool MPEGDecoder::decodePacket(Common::SeekableReadStream *packet, uint32 &framePeriod, Graphics::Surface *dst) { // Decode as much as we can out of this packet uint32 size = 0xFFFFFFFF; mpeg2_state_t state; -- cgit v1.2.3 From 5e835ef91529d9350d05864fd174a5e3db8d9615 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 14 Jul 2013 19:04:09 +0200 Subject: RECORDER: Fix indenting --- gui/recorderdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index 18eb9a00a3..a4c7428116 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -194,8 +194,8 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; default: Dialog::handleCommand(sender, cmd, data); - } } +} void RecorderDialog::updateList() { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); -- cgit v1.2.3 From 96e1d3b09a82d9b8a85b03d5c5855220db007ed5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Jul 2013 15:38:22 -0400 Subject: TSAGE: Added R2R ability to combine items. Further bugfixes for landing bay --- engines/tsage/ringworld2/ringworld2_logic.cpp | 123 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_logic.h | 3 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 6 +- 3 files changed, 128 insertions(+), 4 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 6446f1953d..87e1cbee52 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -852,6 +852,7 @@ Ringworld2InvObjectList::Ringworld2InvObjectList(): _itemList.push_back(&_inv52); _selectedItem = NULL; + } void Ringworld2InvObjectList::reset() { @@ -914,6 +915,9 @@ void Ringworld2InvObjectList::reset() { setObjectScene(R2_ALCOHOL_LAMP_3, 2435); setObjectScene(R2_BROKEN_DISPLAY, 1580); setObjectScene(R2_TOOLBOX, 3260); + + // Set up the select item handler method + T2_GLOBALS._onSelectItem = SelectItem; } void Ringworld2InvObjectList::setObjectScene(int objectNum, int sceneNumber) { @@ -931,6 +935,125 @@ void Ringworld2InvObjectList::setObjectScene(int objectNum, int sceneNumber) { T2_GLOBALS._uiElements.updateInventory(); } +/** + * When an inventory item is selected, in Return to Ringworld two objects can be combined + */ +bool Ringworld2InvObjectList::SelectItem(int objectNumber) { + // If no existing item selected, don't go any further + int currentItem = R2_GLOBALS._events.getCursor(); + if (currentItem >= 256) + return false; + + switch (objectNumber) { + case R2_NEGATOR_GUN: + switch (currentItem) { + case R2_SENSOR_PROBE: + if (R2_GLOBALS.getFlag(1)) + SceneItem::display2(5, 1); + else if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) == 100) + SceneItem::display(5, 3); + else { + R2_GLOBALS._sound3.play(48); + SceneItem::display2(5, 2); + R2_INVENTORY.setObjectScene(R2_SPENT_POWER_CAPSULE, 1); + } + break; + case R2_COM_SCANNER: + R2_GLOBALS._sound3.play(44); + if (R2_GLOBALS.getFlag(1)) + SceneItem::display2(5, 9); + else if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) == 100) + SceneItem::display2(5, 8); + else + SceneItem::display2(5, 10); + break; + case R2_CHARGED_POWER_CAPSULE: + if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) == 1) { + R2_GLOBALS._sound3.play(49); + R2_INVENTORY.setObjectScene(R2_CHARGED_POWER_CAPSULE, 100); + R2_GLOBALS.setFlag(1); + SceneItem::display2(5, 4); + } else { + SceneItem::display2(5, 5); + } + break; + default: + selectDefault(objectNumber); + break; + } + break; + case R2_STEPPING_DISKS: + switch (currentItem) { + case R2_SENSOR_PROBE: + if (R2_INVENTORY.getObjectScene(R2_CHARGED_POWER_CAPSULE) == 400) { + R2_GLOBALS._sound3.play(48); + SceneItem::display2(5, 6); + R2_INVENTORY.setObjectScene(R2_CHARGED_POWER_CAPSULE, 1); + } else { + SceneItem::display2(5, 7); + } + break; + case R2_COM_SCANNER: + R2_GLOBALS._sound3.play(44); + if (R2_INVENTORY.getObjectScene(R2_CHARGED_POWER_CAPSULE) == 400) + SceneItem::display2(5, 16); + else + SceneItem::display2(5, 17); + R2_GLOBALS._sound3.stop(); + break; + default: + selectDefault(objectNumber); + break; + } + break; + case R2_ATTRACTOR_UNIT: + case R2_CABLE_HARNESS: + if (currentItem == R2_CABLE_HARNESS || + currentItem == R2_ATTRACTOR_UNIT) { + R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 0); + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0); + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 1); + } else { + selectDefault(objectNumber); + } + break; + case R2_TANNER_MASK: + case R2_PURE_GRAIN_ALCOHOL: + if (currentItem == R2_TANNER_MASK || + currentItem == R2_PURE_GRAIN_ALCOHOL) { + R2_INVENTORY.setObjectScene(R2_TANNER_MASK, 0); + R2_INVENTORY.setObjectScene(R2_PURE_GRAIN_ALCOHOL, 0); + R2_INVENTORY.setObjectScene(R2_SOAKED_FACEMASK, 1); + } else { + selectDefault(objectNumber); + } + break; + default: + // Standard item selection + return false; + } + + return true; +} + +void Ringworld2InvObjectList::selectDefault(int objectNumber) { + Common::String msg1 = g_resourceManager->getMessage(4, 53); + Common::String msg2 = g_resourceManager->getMessage(4, R2_GLOBALS._events.getCursor()); + Common::String msg3 = g_resourceManager->getMessage(4, 54); + Common::String msg4 = g_resourceManager->getMessage(4, objectNumber); + Common::String line = Common::String::format("%.5s%.5s%.5s%.5s%s %s %s %s.", + msg1.c_str(), msg2.c_str(), msg3.c_str(), msg4.c_str(), + msg1.c_str() + 5, msg2.c_str() + 5, msg3.c_str() + 5, msg4.c_str() + 5); + + SceneItem::display(-1, -1, line.c_str(), + SET_WIDTH, 280, + SET_X, 160, + SET_Y, 20, + SET_POS_MODE, 1, + SET_EXT_BGCOLOR, 7, + LIST_END); +} + /*--------------------------------------------------------------------------*/ void Ringworld2Game::start() { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index fc25340785..57f8258a18 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -159,6 +159,9 @@ public: /*--------------------------------------------------------------------------*/ class Ringworld2InvObjectList : public InvObjectList { +private: + static bool SelectItem(int objectNumber); + static void selectDefault(int obectNumber); public: InvObject _none; InvObject _inv1; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index dbcec9dd63..692a708c74 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5852,7 +5852,7 @@ bool Scene700::Item12::startAction(CursorType action, Event &event) { break; } - scene->setAction(&scene->_sequenceManager, this, 707, &R2_GLOBALS._player, &scene->_actor5, NULL); + scene->setAction(&scene->_sequenceManager, scene, 707, &R2_GLOBALS._player, &scene->_actor5, NULL); return true; } @@ -6161,9 +6161,7 @@ void Scene700::signal() { } break; case 3: - R2_INVENTORY.setObjectScene(5, 600); - R2_INVENTORY.setObjectScene(16, 700); - R2_GLOBALS._player.enableControl(); + R2_GLOBALS._sceneManager.changeScene(600); break; case 4: _sceneMode = 5; -- cgit v1.2.3 From 7ae3386090429015fa7bbc887d11d026e2b46579 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:29:46 +0300 Subject: SAGA: Fix CID 1002507. Unused pointer value. --- engines/saga/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index fd602ff4fb..a99bd66e5e 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -185,7 +185,7 @@ int Anim::playCutaway(int cut, bool fade) { event.time = (40 / 3) * 1000 / _cutawayList[cut].frameRate; if (fade) - eventColumns = _vm->_events->chain(eventColumns, event); + _vm->_events->chain(eventColumns, event); else _vm->_events->queue(event); } -- cgit v1.2.3 From b1c886334dadd206db29a51b7b6922ef6d1f95a3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:45:12 +0300 Subject: INSANE: Fix CID 1003733. Missing break in switch. In fact the code was wrong there due to copy-paste error --- engines/scumm/insane/insane_enemy.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index fa6d4264ec..c192d2f06a 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -1519,8 +1519,6 @@ void Insane::chooseEnemyWeaponAnim(int32 buttons) { case INV_BOOT: case INV_HAND: case INV_DUST: - _actor[1].act[2].state = 0; - switchEnemyWeapon(); default: switchEnemyWeapon(); } -- cgit v1.2.3 From e0e6b9538422a1129a06c5b38a56092d3ca1e583 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:48:05 +0300 Subject: INSANE: Fix CID 1003734. Missing break in switch --- engines/scumm/insane/insane_enemy.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index c192d2f06a..3876966fd1 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -2435,6 +2435,7 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorFacing(1, 2, 6, 180); smlayer_setActorLayer(1, 2, 25); _actor[1].act[2].state = 103; + break; case 103: _actor[1].kicking = false; -- cgit v1.2.3 From 059fa15d148018a01721205f824116a905a73ff1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:51:57 +0300 Subject: DEVTOOLS: Fix CID 1022207. Missing break in switch --- devtools/create_lure/process_actions.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devtools/create_lure/process_actions.cpp b/devtools/create_lure/process_actions.cpp index db965730cb..d1ddbf03f2 100644 --- a/devtools/create_lure/process_actions.cpp +++ b/devtools/create_lure/process_actions.cpp @@ -149,6 +149,7 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain if (startOffset == 0x7328) { startOffset = 0x72ae; maxOffset = 0x7382; } if (startOffset == 0x702f) { startOffset = 0x6f3d; maxOffset = 0x70a3; } if (startOffset == 0x7886) { startOffset = 0x742a; maxOffset = 0x7896; } + break; case DE_DEU: if (startOffset == 0x7edb) { startOffset = 0x7ead; maxOffset = 0x7f05; } if (startOffset == 0x7ab8) { startOffset = 0x796c; maxOffset = 0x7ae2; } -- cgit v1.2.3 From ce057f896f70bab50d73abd4dc3f9a880490d6ca Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:54:26 +0300 Subject: AGI: Fix CID 1003769. Missing break in switch --- engines/agi/preagi_troll.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index b7d2801076..fc29577982 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -190,6 +190,7 @@ void TrollEngine::inventory() { break; case IDI_TRO_MAX_TREASURE: drawStr(3, 17, kColorDefault, IDS_TRO_TREASURE_2); + break; default: sprintf(tmp, IDS_TRO_TREASURE_4, _treasuresLeft); drawStr(20, 10, kColorDefault, tmp); -- cgit v1.2.3 From e809ebb90442662b40881d95c4ae6530d0db888e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 11:58:52 +0300 Subject: AGI: Fix CID 1003768. Missing break in switch --- engines/agi/preagi_winnie.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index bbe9ddd0c6..1be385be37 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -985,6 +985,7 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { } break; } + break; default: if (!event.kbd.flags) { // if the control/alt/shift keys are not pressed keyHelp(); -- cgit v1.2.3 From 8cdca523ea265d67c7f95604a88e03aa40d66cf0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 12:00:10 +0300 Subject: AGI: Mark fall-through. Detected by CID 1003771 --- engines/agi/preagi_troll.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index fc29577982..17d980dfd8 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -220,6 +220,7 @@ void TrollEngine::waitAnyKeyIntro() { switch (iMsg) { case 200: iMsg = 0; + // fall through case 0: drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_2); _gfx->doUpdate(); -- cgit v1.2.3 From 9572bc6e306dc82e0d2f00d7398896d317630ef0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 14:31:34 +0300 Subject: RECORDER: Fix wrong argument order --- common/recorderfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp index e6838ed02e..d08bc599f1 100644 --- a/common/recorderfile.cpp +++ b/common/recorderfile.cpp @@ -44,7 +44,7 @@ PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmp _headerDumped = false; _recordCount = 0; _eventsSize = 0; - memset(_tmpBuffer, kRecordBuffSize, 1); + memset(_tmpBuffer, 1, kRecordBuffSize); } PlaybackFile::~PlaybackFile() { -- cgit v1.2.3 From ddcfdf532927a3b31f0dd7033be5805fa38db15f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 15 Jul 2013 13:40:59 +0200 Subject: GUI: Allow the event recorder dialog to be closed. This is a regression from 6e4217e1ba1df9fd2ee4cd0d61151ed7dfc53021. setResult does not automatically close the dialog. However, Dialog::handleCommand will close the dialog when kCloseCmd is received. --- gui/recorderdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp index a4c7428116..1a11dbac65 100644 --- a/gui/recorderdialog.cpp +++ b/gui/recorderdialog.cpp @@ -191,7 +191,7 @@ void RecorderDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat break; case kCloseCmd: setResult(kRecordDialogClose); - break; + // Fall through default: Dialog::handleCommand(sender, cmd, data); } -- cgit v1.2.3 From 6a1112f98ff3739dde809275f1d09951b9a20ec6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 15 Jul 2013 13:44:24 +0200 Subject: GUI: Mark some intentional fall throughs in switches. All of these are for handling kCloseCmd. --- gui/chooser.cpp | 1 + gui/saveload-dialog.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 6ae08161df..c195e94c9b 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -67,6 +67,7 @@ void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data break; case kCloseCmd: setResult(-1); + // Fall through default: Dialog::handleCommand(sender, cmd, data); } diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index c7dd62b6c6..585117fba4 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -286,6 +286,7 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin break; case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } @@ -595,6 +596,7 @@ void SaveLoadChooserGrid::handleCommand(CommandSender *sender, uint32 cmd, uint3 case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } -- cgit v1.2.3 From b7e3d52abc97b14019fdc6e1637d979e37eedebb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 19:02:34 +0300 Subject: SWORD25: Replace Pluto with Tamed Pluto for increased compatibility Still saves are incompatible but at least this now has enhanced debugging capabilities. --- engines/sword25/util/pluto/pluto.cpp | 539 ++++++++++++++++++++++++++++++----- 1 file changed, 472 insertions(+), 67 deletions(-) diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp index b7f5e30340..fb477c1687 100644 --- a/engines/sword25/util/pluto/pluto.cpp +++ b/engines/sword25/util/pluto/pluto.cpp @@ -1,6 +1,6 @@ /* $Id$ */ -/* Pluto - Heavy-duty persistence for Lua +/* Tamed Pluto - Heavy-duty persistence for Lua * Copyright (C) 2004 by Ben Sunshine-Hill, and released into the public * domain. People making use of this software as part of an application * are politely requested to email the author at sneftel@gmail.com @@ -14,11 +14,16 @@ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Instrumented by Stefan Reich (info@luaos.net) + * for Mobile Lua (http://luaos.net/pages/mobile-lua.php) */ #include "sword25/util/lua/lua.h" #include "pluto.h" +#undef TOTEXT + #define USE_PDEP #ifdef USE_PDEP @@ -42,10 +47,20 @@ #include +/* Define this if you want size_t values to be written in 64-bit + (even on 32-bit systems). Should eliminate at least one source of + 32/64 bit incompatibility. */ +#define SIZES64 + /* #define PLUTO_DEBUG */ +#ifdef SIZES64 +#define VERSION "Tamed Pluto 1.0 with SIZES64 flag" +#else +#define VERSION "Tamed Pluto 1.0" +#endif #ifdef PLUTO_DEBUG @@ -56,6 +71,23 @@ #define verify(x) { int v = (int)((x)); v=v; lua_assert(v); } +#define NUMTYPES 9 +static const char* typenames[] = { + "nil", + "boolean", + "lightuserdata", + "number", + "string", + "table", + "function", + "userdata", + "thread" +}; + +static int humanReadable = 0; +#define hrBufSize 200 +static char hrBuf[hrBufSize]; + typedef struct PersistInfo_t { lua_State *L; int counter; @@ -76,6 +108,77 @@ void printindent(int indent) } #endif +/* lua_Chunkwriter signature: (lua_State *L, const void *p, size_t sz, void *ud). + ud is a pointer to the WriterInfo struct (holds the buffer pointer) +*/ + +static void pi_write(PersistInfo *pi, const void *p, size_t size, void *ud) { + if (humanReadable) { + uint i; + snprintf(hrBuf, hrBufSize, " pi_write %d ", (int) size); + pi->writer(pi->L, hrBuf, strlen(hrBuf), ud); + for (i = 0; i < size; i++) { + char b = ((char *)p)[i]; + snprintf(hrBuf, hrBufSize, "%X%X", (b >> 4) & 0xF, b & 0xF); + pi->writer(pi->L, hrBuf, strlen(hrBuf), ud); + } + snprintf(hrBuf, hrBufSize, "\n"); + pi->writer(pi->L, hrBuf, strlen(hrBuf), ud); + } else { + pi->writer(pi->L, p, size, ud); + } +#ifdef TOTEXT + int i; + printf(" pi_write %d ", (int) size); + for (i = 0; i < size; i++) { + char b = ((char *)p)[i]; + printf("%X%X", (b >> 4) & 0xF, b & 0xF); + } + printf("\n"); +#endif +} + +static void hrOut(PersistInfo *pi) { + pi->writer(pi->L, hrBuf, strlen(hrBuf), pi->ud); +} + +static void write_size(PersistInfo *pi, size_t *val) +{ +#ifdef SIZES64 + int64 longval; /* yeah, you really need long long to get 8 bytes on win32... duh. */ + longval = *val; + pi_write(pi, &longval, 8, pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "write_size64 %ld\n", longval); + hrOut(pi); + } +#ifdef TOTEXT + printf("write_size64 %ld\n", longval); +#endif +#else + pi_write(pi, val, sizeof(size_t), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "write_size %ld\n", *((size_t *)val)); + hrOut(pi); + } +#ifdef TOTEXT + printf("write_size %ld\n", *val); +#endif +#endif +} + +static void read_size(ZIO *zio, size_t *val) +{ +#ifdef SIZES64 + int64 longval; + verify(LIF(Z,read)(zio, &longval, 8) == 0); + *val = longval; +#else + verify(LIF(Z,read)(zio, val, sizeof(size_t)) == 0); +#endif +} + + /* Mutual recursion requires prototype */ static void persist(PersistInfo *pi); @@ -107,7 +210,14 @@ static int persistspecialobject(PersistInfo *pi, int defaction) if(defaction) { { int zero = 0; - pi->writer(pi->L, &zero, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistspecialobject_write_zero\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistspecialobject_write_zero\n"); +#endif } return 0; } else { @@ -127,7 +237,14 @@ static int persistspecialobject(PersistInfo *pi, int defaction) if(defaction) { { int zero = 0; - pi->writer(pi->L, &zero, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistspecialobject_write_zero2\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistspecialobject_write_zero2\n"); +#endif } return 0; } else { @@ -143,7 +260,14 @@ static int persistspecialobject(PersistInfo *pi, int defaction) /* perms reftbl sptbl ... obj */ { int zero = 0; - pi->writer(pi->L, &zero, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistspecialobject_write_zero3\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistspecialobject_write_zero3\n"); +#endif } return 0; } else { @@ -176,7 +300,14 @@ static int persistspecialobject(PersistInfo *pi, int defaction) /* perms reftbl ... obj mt func */ { int one = 1; - pi->writer(pi->L, &one, sizeof(int), pi->ud); + pi_write(pi, &one, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistspecialobject_write_one\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistspecialobject_write_one\n"); +#endif } persist(pi); /* perms reftbl ... obj mt func */ @@ -187,6 +318,14 @@ static int persistspecialobject(PersistInfo *pi, int defaction) static void persisttable(PersistInfo *pi) { + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persisttable\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persisttable\n"); +#endif + /* perms reftbl ... tbl */ lua_checkstack(pi->L, 3); if(persistspecialobject(pi, 1)) { @@ -235,8 +374,15 @@ static void persistuserdata(PersistInfo *pi) { } else { /* Use literal persistence */ size_t length = uvalue(getobject(pi->L, -1))->len; - pi->writer(pi->L, &length, sizeof(size_t), pi->ud); - pi->writer(pi->L, lua_touserdata(pi->L, -1), length, pi->ud); + write_size(pi, &length); + pi_write(pi, lua_touserdata(pi->L, -1), length, pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistuserdata %ld\n", (long) length); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistuserdata %ld\n", (long) length); +#endif if(!lua_getmetatable(pi->L, -1)) { /* perms reftbl ... udata */ lua_pushnil(pi->L); @@ -269,8 +415,8 @@ static void pushproto(lua_State *L, Proto *proto) #define setuvvalue(L,obj,x) \ { TValue *i_o=(obj); \ - i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUPVAL; \ - checkliveness(G(L),i_o); } + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUPVAL; \ + checkliveness(G(L),i_o); } static void pushupval(lua_State *L, UpVal *upval) { @@ -309,7 +455,14 @@ static void persistfunction(PersistInfo *pi) { /* We don't really _NEED_ the number of upvals, * but it'll simplify things a bit */ - pi->writer(pi->L, &cl->l.p->nups, sizeof(lu_byte), pi->ud); + pi_write(pi, &cl->l.p->nups, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistfunction_number_upvalues %d\n", (int) cl->l.p->nups); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistfunction_number_upvalues %d\n", (int) cl->l.p->nups); +#endif } /* Persist prototype */ { @@ -401,7 +554,14 @@ static void persistproto(PersistInfo *pi) /* Persist constant refs */ { int i; - pi->writer(pi->L, &p->sizek, sizeof(int), pi->ud); + pi_write(pi, &p->sizek, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_sizek %d\n", p->sizek); + hrOut(pi); + } + #ifdef TOTEXT + printf("persistproto_sizek %d\n", p->sizek); + #endif for(i=0; isizek; i++) { LIF(A,pushobject)(pi->L, &p->k[i]); /* perms reftbl ... proto const */ @@ -415,7 +575,14 @@ static void persistproto(PersistInfo *pi) /* serialize inner Proto refs */ { int i; - pi->writer(pi->L, &p->sizep, sizeof(int), pi->ud); + pi_write(pi, &p->sizep, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_sizep %d\n", p->sizep); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_sizep %d\n", p->sizep); +#endif for(i=0; isizep; i++) { pushproto(pi->L, p->p[i]); @@ -429,14 +596,37 @@ static void persistproto(PersistInfo *pi) /* Serialize code */ { - pi->writer(pi->L, &p->sizecode, sizeof(int), pi->ud); - pi->writer(pi->L, p->code, sizeof(Instruction) * p->sizecode, pi->ud); + int len; + pi_write(pi, &p->sizecode, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_sizecode %d\n", p->sizecode); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_sizecode %d\n", p->sizecode); +#endif + len = sizeof(Instruction) * p->sizecode; + pi_write(pi, p->code, len, pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_code %d\n", len); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_code %d\n", len); +#endif } /* Serialize upvalue names */ { int i; - pi->writer(pi->L, &p->sizeupvalues, sizeof(int), pi->ud); + pi_write(pi, &p->sizeupvalues, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_upvalues %d\n", p->sizeupvalues); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_upvalues %d\n", p->sizeupvalues); +#endif for(i=0; isizeupvalues; i++) { pushstring(pi->L, p->upvalues[i]); @@ -447,15 +637,36 @@ static void persistproto(PersistInfo *pi) /* Serialize local variable infos */ { int i; - pi->writer(pi->L, &p->sizelocvars, sizeof(int), pi->ud); + pi_write(pi, &p->sizelocvars, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_sizelocvars %d\n", p->sizelocvars); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_sizelocvars %d\n", p->sizelocvars); +#endif for(i=0; isizelocvars; i++) { pushstring(pi->L, p->locvars[i].varname); persist(pi); lua_pop(pi->L, 1); - pi->writer(pi->L, &p->locvars[i].startpc, sizeof(int), pi->ud); - pi->writer(pi->L, &p->locvars[i].endpc, sizeof(int), pi->ud); + pi_write(pi, &p->locvars[i].startpc, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_startpc %d\n", p->locvars[i].startpc); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_startpc %d\n", p->locvars[i].startpc); +#endif + pi_write(pi, &p->locvars[i].endpc, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_endpc %d\n", p->locvars[i].endpc); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_endpc %d\n", p->locvars[i].endpc); +#endif } } @@ -466,23 +677,81 @@ static void persistproto(PersistInfo *pi) /* Serialize line numbers */ { - pi->writer(pi->L, &p->sizelineinfo, sizeof(int), pi->ud); + pi_write(pi, &p->sizelineinfo, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_sizelineinfo %d\n", p->sizelineinfo); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_sizelineinfo %d\n", p->sizelineinfo); +#endif if (p->sizelineinfo) { - pi->writer(pi->L, p->lineinfo, sizeof(int) * p->sizelineinfo, pi->ud); + int len; + len = sizeof(int) * p->sizelineinfo; + pi_write(pi, p->lineinfo, len, pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_lineinfo %d\n", len); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_lineinfo %d\n", len); +#endif } } /* Serialize linedefined and lastlinedefined */ - pi->writer(pi->L, &p->linedefined, sizeof(int), pi->ud); - pi->writer(pi->L, &p->lastlinedefined, sizeof(int), pi->ud); + pi_write(pi, &p->linedefined, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_linedefined %d\n", p->linedefined); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_linedefined %d\n", p->linedefined); +#endif + pi_write(pi, &p->lastlinedefined, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_lastlinedefined %d\n", p->lastlinedefined); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_lastlinedefined %d\n", p->lastlinedefined); +#endif /* Serialize misc values */ { - pi->writer(pi->L, &p->nups, sizeof(lu_byte), pi->ud); - pi->writer(pi->L, &p->numparams, sizeof(lu_byte), pi->ud); - pi->writer(pi->L, &p->is_vararg, sizeof(lu_byte), pi->ud); - pi->writer(pi->L, &p->maxstacksize, sizeof(lu_byte), pi->ud); + pi_write(pi, &p->nups, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_nups %d\n", (int) p->nups); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_nups %d\n", (int) p->nups); +#endif + pi_write(pi, &p->numparams, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_numparams %d\n", (int) p->numparams); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_numparams %d\n", (int) p->numparams); +#endif + pi_write(pi, &p->is_vararg, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_is_vararg %d\n", (int) p->is_vararg); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_is_vararg %d\n", (int) p->is_vararg); +#endif + pi_write(pi, &p->maxstacksize, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistproto_maxstacksize %d\n", (int) p->maxstacksize); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistproto_maxstacksize %d\n", (int) p->maxstacksize); +#endif } /* We do not currently persist upvalue names, local variable names, * variable lifetimes, line info, or source code. */ @@ -518,7 +787,7 @@ static void persistthread(PersistInfo *pi) /* Persist the stack */ posremaining = revappendstack(L2, pi->L); /* perms reftbl ... thr (rev'ed contents of L2) */ - pi->writer(pi->L, &posremaining, sizeof(size_t), pi->ud); + write_size(pi, &posremaining); for(; posremaining > 0; posremaining--) { persist(pi); lua_pop(pi->L, 1); @@ -527,7 +796,7 @@ static void persistthread(PersistInfo *pi) /* Now, persist the CallInfo stack. */ { size_t i, numframes = (L2->ci - L2->base_ci) + 1; - pi->writer(pi->L, &numframes, sizeof(size_t), pi->ud); + write_size(pi, &numframes); for(i=0; ibase_ci + i; size_t stackbase = ci->base - L2->stack; @@ -536,11 +805,18 @@ static void persistthread(PersistInfo *pi) size_t savedpc = (ci != L2->base_ci) ? ci->savedpc - ci_func(ci)->l.p->code : 0; - pi->writer(pi->L, &stackbase, sizeof(size_t), pi->ud); - pi->writer(pi->L, &stackfunc, sizeof(size_t), pi->ud); - pi->writer(pi->L, &stacktop, sizeof(size_t), pi->ud); - pi->writer(pi->L, &ci->nresults, sizeof(int), pi->ud); - pi->writer(pi->L, &savedpc, sizeof(size_t), pi->ud); + write_size(pi, &stackbase); + write_size(pi, &stackfunc); + write_size(pi, &stacktop); + pi_write(pi, &ci->nresults, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistthread %d\n", ci->nresults); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistthread %d\n", ci->nresults); +#endif + write_size(pi, &savedpc); } } @@ -549,10 +825,18 @@ static void persistthread(PersistInfo *pi) size_t stackbase = L2->base - L2->stack; size_t stacktop = L2->top - L2->stack; lua_assert(L2->nCcalls <= 1); - pi->writer(pi->L, &L2->status, sizeof(lu_byte), pi->ud); - pi->writer(pi->L, &stackbase, sizeof(size_t), pi->ud); - pi->writer(pi->L, &stacktop, sizeof(size_t), pi->ud); - pi->writer(pi->L, &L2->errfunc, sizeof(ptrdiff_t), pi->ud); + pi_write(pi, &L2->status, sizeof(lu_byte), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistthread_status %d\n", (int) L2->status); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistthread_status %d\n", (int) L2->status); +#endif + write_size(pi, &stackbase); + write_size(pi, &stacktop); + pi_write(pi, &L2->errfunc, sizeof(ptrdiff_t), pi->ud); + //write_size(pi, (size_t *)&L2->errfunc); } /* Finally, record upvalues which need to be reopened */ @@ -573,7 +857,7 @@ static void persistthread(PersistInfo *pi) lua_pop(pi->L, 1); /* perms reftbl ... thr */ stackpos = uv->v - L2->stack; - pi->writer(pi->L, &stackpos, sizeof(size_t), pi->ud); + write_size(pi, &stackpos); } /* perms reftbl ... thr */ lua_pushnil(pi->L); @@ -588,26 +872,62 @@ static void persistthread(PersistInfo *pi) static void persistboolean(PersistInfo *pi) { int b = lua_toboolean(pi->L, -1); - pi->writer(pi->L, &b, sizeof(int), pi->ud); + pi_write(pi, &b, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistboolean %d\n", b); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistboolean %d\n", b); +#endif } static void persistlightuserdata(PersistInfo *pi) { void *p = lua_touserdata(pi->L, -1); - pi->writer(pi->L, &p, sizeof(void *), pi->ud); + pi_write(pi, &p, sizeof(void *), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistlightuserdata %p\n", p); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistlightuserdata %d\n", (int) p); +#endif } static void persistnumber(PersistInfo *pi) { lua_Number n = lua_tonumber(pi->L, -1); - pi->writer(pi->L, &n, sizeof(lua_Number), pi->ud); + pi_write(pi, &n, sizeof(lua_Number), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persistnumber %d (%d)\n", (int) n, (int) sizeof(lua_Number)); + hrOut(pi); + } +#ifdef TOTEXT + printf("persistnumber %d (%d)\n", (int) n, (int) sizeof(lua_Number)); +#endif } static void persiststring(PersistInfo *pi) { + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persiststring\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persiststring\n"); +#endif size_t length = lua_strlen(pi->L, -1); - pi->writer(pi->L, &length, sizeof(size_t), pi->ud); - pi->writer(pi->L, lua_tostring(pi->L, -1), length, pi->ud); + write_size(pi, &length); + const char* s = lua_tostring(pi->L, -1); + pi_write(pi, s, length, pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persiststring %d \"%s\"\n", (int)length, s); + hrOut(pi); + } +#ifdef TOTEXT + printf("persiststring %d \"%s\"\n", length, s); +#endif } /* Top-level delegating persist function @@ -630,8 +950,22 @@ static void persist(PersistInfo *pi) // since size_t is supposedly the same size as a pointer on most // (modern) architectures. int ref = (int)(size_t)lua_touserdata(pi->L, -1); - pi->writer(pi->L, &zero, sizeof(int), pi->ud); - pi->writer(pi->L, &ref, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_seenobject\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_seenobject\n"); +#endif + pi_write(pi, &ref, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_touserdata_ref %d\n", ref); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_touserdata_ref %d\n", ref); +#endif lua_pop(pi->L, 1); /* perms reftbl ... obj ref */ #ifdef PLUTO_DEBUG @@ -647,9 +981,16 @@ static void persist(PersistInfo *pi) if(lua_isnil(pi->L, -1)) { int zero = 0; /* firsttime */ - pi->writer(pi->L, &zero, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); /* ref */ - pi->writer(pi->L, &zero, sizeof(int), pi->ud); + pi_write(pi, &zero, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_nil (last 2 lines)\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_nil (last 2 lines)\n"); +#endif #ifdef PLUTO_DEBUG printindent(pi->level); printf("0 0\n"); @@ -659,7 +1000,14 @@ static void persist(PersistInfo *pi) { /* indicate that it's the first time */ int one = 1; - pi->writer(pi->L, &one, sizeof(int), pi->ud); + pi_write(pi, &one, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_newobject\n"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_newobject\n"); +#endif } lua_pushvalue(pi->L, -1); /* perms reftbl ... obj obj */ @@ -668,7 +1016,14 @@ static void persist(PersistInfo *pi) lua_rawset(pi->L, 2); /* perms reftbl ... obj */ - pi->writer(pi->L, &pi->counter, sizeof(int), pi->ud); + pi_write(pi, &pi->counter, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_counter %d\n", pi->counter); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_counter %d\n", pi->counter); +#endif /* At this point, we'll give the permanents table a chance to play. */ @@ -685,7 +1040,14 @@ static void persist(PersistInfo *pi) printf("1 %d PERM\n", pi->counter); pi->level++; #endif - pi->writer(pi->L, &type, sizeof(int), pi->ud); + pi_write(pi, &type, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist_permtype %d\n", type); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist_permtype %d\n", type); +#endif persist(pi); lua_pop(pi->L, 1); /* perms reftbl ... obj */ @@ -702,7 +1064,14 @@ static void persist(PersistInfo *pi) } { int type = lua_type(pi->L, -1); - pi->writer(pi->L, &type, sizeof(int), pi->ud); + pi_write(pi, &type, sizeof(int), pi->ud); + if (humanReadable) { + snprintf(hrBuf, hrBufSize, "persist %s\n", type >= 0 && type < NUMTYPES ? typenames[type] : "?"); + hrOut(pi); + } +#ifdef TOTEXT + printf("persist %s\n", type >= 0 && type < NUMTYPES ? typenames[type] : "?"); +#endif #ifdef PLUTO_DEBUG printindent(pi->level); @@ -798,8 +1167,8 @@ typedef struct WriterInfo_t { size_t buflen; } WriterInfo; -static int bufwriter (lua_State *L, const void* p, size_t sz, void* ud) { - const char* cp = (const char*)p; +static int bufwriter (lua_State *L, const void *p, size_t sz, void *ud) { + const char *cp = (const char *)p; WriterInfo *wi = (WriterInfo *)ud; LIF(M,reallocvector)(L, wi->buf, wi->buflen, wi->buflen+sz, char); @@ -819,7 +1188,7 @@ int persist_l(lua_State *L) wi.buf = NULL; wi.buflen = 0; - + lua_settop(L, 2); /* perms? rootobj? */ luaL_checktype(L, 1, LUA_TTABLE); @@ -895,10 +1264,13 @@ static void unpersistnumber(UnpersistInfo *upi) static void unpersiststring(UnpersistInfo *upi) { /* perms reftbl sptbl ref */ + /*int length;*/ size_t length; char* string; lua_checkstack(upi->L, 1); - verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0); + /*verify(LIF(Z,read)(&upi->zio, &length, sizeof(int)) == 0);*/ + /*verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0);*/ + read_size(&upi->zio, &length); string = pdep_newvector(upi->L, length, char); verify(LIF(Z,read)(&upi->zio, string, length) == 0); lua_pushlstring(upi->L, string, length); @@ -1312,7 +1684,7 @@ static void unpersistthread(int ref, UnpersistInfo *upi) /* First, deserialize the object stack. */ { size_t i, stacksize; - verify(LIF(Z,read)(&upi->zio, &stacksize, sizeof(size_t)) == 0); + read_size(&upi->zio, &stacksize); LIF(D,growstack)(L2, (int)stacksize); /* Make sure that the first stack element (a nil, representing * the imaginary top-level C function) is written to the very, @@ -1331,16 +1703,16 @@ static void unpersistthread(int ref, UnpersistInfo *upi) /* Now, deserialize the CallInfo stack. */ { size_t i, numframes; - verify(LIF(Z,read)(&upi->zio, &numframes, sizeof(size_t)) == 0); + read_size(&upi->zio, &numframes); LIF(D,reallocCI)(L2,numframes*2); for(i=0; ibase_ci + i; size_t stackbase, stackfunc, stacktop, savedpc; - verify(LIF(Z,read)(&upi->zio, &stackbase, sizeof(size_t)) == 0); - verify(LIF(Z,read)(&upi->zio, &stackfunc, sizeof(size_t)) == 0); - verify(LIF(Z,read)(&upi->zio, &stacktop, sizeof(size_t)) == 0); + read_size(&upi->zio, &stackbase); + read_size(&upi->zio, &stackfunc); + read_size(&upi->zio, &stacktop); verify(LIF(Z,read)(&upi->zio, &ci->nresults, sizeof(int)) == 0); - verify(LIF(Z,read)(&upi->zio, &savedpc, sizeof(size_t)) == 0); + read_size(&upi->zio, &savedpc); if(stacklimit < stacktop) stacklimit = stacktop; @@ -1363,9 +1735,10 @@ static void unpersistthread(int ref, UnpersistInfo *upi) size_t stackbase, stacktop; L2->savedpc = L2->ci->savedpc; verify(LIF(Z,read)(&upi->zio, &L2->status, sizeof(lu_byte)) == 0); - verify(LIF(Z,read)(&upi->zio, &stackbase, sizeof(size_t)) == 0); - verify(LIF(Z,read)(&upi->zio, &stacktop, sizeof(size_t)) == 0); + read_size(&upi->zio, &stackbase); + read_size(&upi->zio, &stacktop); verify(LIF(Z,read)(&upi->zio, &L2->errfunc, sizeof(ptrdiff_t)) == 0); + //read_size(&upi->zio, (size_t *)&L2->errfunc); L2->base = L2->stack + stackbase; L2->top = L2->stack + stacktop; } @@ -1391,7 +1764,7 @@ static void unpersistthread(int ref, UnpersistInfo *upi) lua_pop(upi->L, 1); /* perms reftbl ... thr */ - verify(LIF(Z,read)(&upi->zio, &stackpos, sizeof(size_t)) == 0); + read_size(&upi->zio, &stackpos); uv->v = L2->stack + stackpos; gcunlink(upi->L, (GCObject *)uv); uv->marked = luaC_white(g); @@ -1443,7 +1816,7 @@ static void unpersistuserdata(int ref, UnpersistInfo *upi) /* perms reftbl ... udata */ } else { size_t length; - verify(LIF(Z,read)(&upi->zio, &length, sizeof(size_t)) == 0); + read_size(&upi->zio, &length); lua_newuserdata(upi->L, length); /* perms reftbl ... udata */ @@ -1611,8 +1984,8 @@ void pluto_unpersist(lua_State *L, lua_Chunkreader reader, void *ud) } typedef struct LoadInfo_t { - char *buf; - size_t size; + char *buf; + size_t size; } LoadInfo; @@ -1653,9 +2026,41 @@ int unpersist_l(lua_State *L) return 1; } +/* Stefan's first C function for Lua! :) + Returns a string describing the Pluto version you're using. */ + +int version_l(lua_State *L) +{ + const char *version = VERSION; + + lua_settop(L, 0); + /* (empty) */ + lua_pushlstring(L, version, strlen(version)); + /* str */ + return 1; +} + +/* Set human-readable output on or off. */ +int human_l(lua_State *L) +{ + /* flag? ...? */ + lua_settop(L, 1); + /* flag? */ + /*luaL_checktype(L, 1, LUA_TBOOLEAN);*/ + /* flag */ + + humanReadable = lua_toboolean(L, 1); + + lua_settop(L, 0); + /* (empty) */ + return 0; +} + static luaL_reg pluto_reg[] = { { "persist", persist_l }, { "unpersist", unpersist_l }, + { "version", version_l }, + { "human", human_l }, { NULL, NULL } }; -- cgit v1.2.3 From 6dc3768faaa272a12e3c6e7ce0965905338132ad Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 19:19:45 +0300 Subject: SWORD25: Fix compilation on some 32-bit systems --- engines/sword25/util/pluto/pluto.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp index fb477c1687..b7a8fd3c8b 100644 --- a/engines/sword25/util/pluto/pluto.cpp +++ b/engines/sword25/util/pluto/pluto.cpp @@ -19,6 +19,7 @@ * for Mobile Lua (http://luaos.net/pages/mobile-lua.php) */ +#include "config.h" #include "sword25/util/lua/lua.h" #include "pluto.h" -- cgit v1.2.3 From 0c52bfa43effa63ae99736d8ff5aa05bc1a77316 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 15 Jul 2013 19:26:02 +0300 Subject: CONFIGURE: Added more 64bit integers to probing --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 7983f5a1ce..7e17b9c034 100755 --- a/configure +++ b/configure @@ -1843,7 +1843,7 @@ esac # Determine a data type with the given length # find_type_with_size() { - for datatype in int short char long "long long" unknown; do + for datatype in int short char long "long long" __int64 "long long int" unknown; do cat > tmp_find_type_with_size.cpp << EOF typedef $datatype ac__type_sizeof_; int main() { -- cgit v1.2.3 From 8e9aefbf6edafa9eed41bd90e5579e5bcde34b03 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 16 Jul 2013 11:00:09 +0200 Subject: CONFIGURE: Use -Wno-long-long when we use -pedantic. --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 7e17b9c034..1da7d7fb78 100755 --- a/configure +++ b/configure @@ -1785,7 +1785,8 @@ android | gamecube | psp | tizen | wii | webos) *) # ICC does not support pedantic, while GCC and clang do. if test "$have_icc" = no ; then - CXXFLAGS="$CXXFLAGS -pedantic" + # We *do* want the 'long long' extension. + CXXFLAGS="$CXXFLAGS -pedantic -Wno-long-long" fi ;; esac -- cgit v1.2.3 From e17095df2e636a3d36c1b606e7e650b494eec696 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 16 Jul 2013 09:19:19 -0400 Subject: TSAGE: Bugfixes for R2R drive room, and work on scanner modal dialog --- engines/tsage/globals.cpp | 13 + engines/tsage/globals.h | 6 + engines/tsage/ringworld2/ringworld2_logic.cpp | 339 +++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_logic.h | 66 ++++- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 20 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 49 +--- engines/tsage/ringworld2/ringworld2_scenes1.h | 9 +- engines/tsage/saveload.h | 10 + engines/tsage/user_interface.cpp | 9 +- 9 files changed, 451 insertions(+), 70 deletions(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 86ac8985d5..8970d08e4d 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -366,9 +366,20 @@ bool BlueForceGlobals::removeFlag(int flagNum) { namespace Ringworld2 { +Ringworld2Globals::Ringworld2Globals() { + _scannerDialog = new ScannerDialog(); +} + +Ringworld2Globals::~Ringworld2Globals() { + delete _scannerDialog; +} + void Ringworld2Globals::reset() { Globals::reset(); + if (!_scannerDialog) + _scannerDialog = new ScannerDialog(); + // Reset the inventory R2_INVENTORY.reset(); T2_GLOBALS._uiElements.updateInventory(); @@ -393,6 +404,7 @@ void Ringworld2Globals::reset() { _v565EB = 26; _v565F5 = 0; _v565F6 = 0; + _v565F8 = 0; _v565FA = 0; _v565AE = 0; _v56605[0] = 0; @@ -507,6 +519,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v565EB); s.syncAsSint16LE(_v565F5); s.syncAsSint16LE(_v565F6); + s.syncAsSint16LE(_v565F8); s.syncAsSint16LE(_v565FA); s.syncAsSint16LE(_v566A3); s.syncAsSint16LE(_v566A6); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 6eca937fda..88fc0821df 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -247,6 +247,8 @@ namespace Ringworld2 { #define k5A790 18 #define k5A791 17 +class ScannerDialog; + class Ringworld2Globals: public TsAGE2Globals { public: ASoundExt _sound1, _sound2, _sound3, _sound4; @@ -269,6 +271,7 @@ public: int _v565EB; int _v565F5; int _v565F6; + int _v565F8; int _v565FA; int _v5657C; byte _v565AE; @@ -304,7 +307,10 @@ public: byte _v565EC[5]; byte _v565F1[4]; byte _stripManager_lookupList[12]; + ScannerDialog *_scannerDialog; + Ringworld2Globals(); + virtual ~Ringworld2Globals(); virtual void reset(); virtual void synchronize(Serializer &s); }; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 87e1cbee52..1ddaa5e6c2 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -583,7 +583,7 @@ void SceneHandlerExt::process(Event &event) { SceneExt *scene = static_cast(R2_GLOBALS._sceneManager._scene); if (scene && R2_GLOBALS._player._uiEnabled) { // Handle any scene areas that have been registered - SynchronizedList::iterator saIter; + SynchronizedList::iterator saIter; for (saIter = scene->_sceneAreas.begin(); saIter != scene->_sceneAreas.end() && !event.handled; ++saIter) { (*saIter)->process(event); } @@ -2061,6 +2061,343 @@ void AnimationPlayerExt::synchronize(Serializer &s) { s.syncAsSint16LE(_v); } +/*--------------------------------------------------------------------------*/ + +ModalDialog::ModalDialog() { + _field20 = 0; +} + +void ModalDialog::remove() { + R2_GLOBALS._sceneItems.remove(&_object1); + _object1.remove(); + + SceneArea::remove(); + + --R2_GLOBALS._insetUp; +} + +void ModalDialog::synchronize(Serializer &s) { + SceneArea::synchronize(s); + + s.syncAsByte(_field20); +} + +void ModalDialog::process(Event &event) { + if (_field20 != R2_GLOBALS._insetUp) + return; + + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_object1._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { + if (cursor == _cursorNum) { + R2_GLOBALS._events.setCursor(_savedCursorNum); + } + } else if (event.mousePos.y < 168) { + if (cursor != _cursorNum) { + _savedCursorNum = cursor; + R2_GLOBALS._events.setCursor(CURSOR_INVALID); + } + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + R2_GLOBALS._events.setCursor(_savedCursorNum); + remove(); + } + } +} + +void ModalDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; + + _object1.postInit(); + _object1.setup(visage, stripFrameNum, frameNum); + _object1.setPosition(Common::Point(posX, posY)); + _object1.fixPriority(250); + _cursorNum = CURSOR_INVALID; + scene->_sceneAreas.push_front(this); + ++R2_GLOBALS._insetUp; + _field20 = R2_GLOBALS._insetUp; +} + +void ModalDialog::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { + _object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); +} + +/*--------------------------------------------------------------------------*/ + +ScannerDialog::ScannerActor::ScannerActor() { + _v1 = _v2 = 0; +} + +void ScannerDialog::ScannerActor::setup(int v) { + _v1 = v; + _v2 = 0; + SceneActor::postInit(); + + SceneObject::setup(4, 2, 2); + fixPriority(255); + + if (_v1 == 1) + setPosition(Common::Point(141, 99)); + else if (_v1 == 2) + setPosition(Common::Point(141, 108)); + + static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); +} + +void ScannerDialog::ScannerActor::synchronize(Serializer &s) { + SceneActor::synchronize(s); + s.syncAsSint16LE(_v1); + s.syncAsSint16LE(_v2); +} + +void ScannerDialog::ScannerActor::process(Event &event) { + if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE + && _bounds.contains(event.mousePos) && !_v2) { + setFrame(3); + _v2 = 1; + event.handled = true; + } + + if (event.eventType == EVENT_BUTTON_UP && _v2) { + setFrame(2); + _v2 = 0; + event.handled = true; + + reset(); + } +} + +bool ScannerDialog::ScannerActor::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + + return startAction(action, event); +} + +void ScannerDialog::ScannerActor::reset() { + Scene *scene = R2_GLOBALS._sceneManager._scene; + ScannerDialog &scanner = *R2_GLOBALS._scannerDialog; + + switch (_v1) { + case 1: + switch (R2_GLOBALS._sceneManager._sceneNumber) { + case 1550: + scene->_sceneMode = 80; + scene->signal(); + break; + case 1700: + scene->_sceneMode = 30; + scene->signal(); + remove(); + break; + default: + break; + } + break; + case 2: + switch (R2_GLOBALS._sceneManager._sceneNumber) { + case 1550: + scanner._obj4.setup(4, 3, 1); + + scanner._obj5.postInit(); + scanner._obj5.setup(4, 4, 1); + scanner._obj5.setPosition(Common::Point(R2_GLOBALS._v565EC[1] + 145, + R2_GLOBALS._v565EC[3] + 59)); + scanner._obj5.fixPriority(257); + + scanner._obj6.postInit(); + scanner._obj6.setup(4, 4, 2); + scanner._obj6.setPosition(Common::Point(R2_GLOBALS._v565EC[2] + 145, + R2_GLOBALS._v565EC[4] + 59)); + scanner._obj6.fixPriority(257); + break; + case 1700: + case 1800: + if (R2_GLOBALS._v565F8 < 0 || (R2_GLOBALS._v565F8 == 0 && R2_GLOBALS._v565F6 < 1201)) + scanner._obj4.setup(4, 3, 3); + else if (R2_GLOBALS._v565F8 > 0 || (R2_GLOBALS._v565F8 == 0 && R2_GLOBALS._v565F6 < 1201)) + scanner._obj4.setup(4, 3, 4); + else + scanner._obj4.setup(4, 3, 5); + break; + case 3800: + case 3900: + if ((R2_GLOBALS._v56A93 + 1) == 0 && R2_GLOBALS._v566A9 == 0) { + do { + R2_GLOBALS._v566A9 = R2_GLOBALS._randomSource.getRandomNumber(3); + } while (R2_GLOBALS._v566A9 == R2_GLOBALS._v566AA); + } + + scanner._obj4.setup(4, 7, R2_GLOBALS._v566A9); + if (!R2_GLOBALS.getFlag(46)) + R2_GLOBALS.setFlag(46); + break; + default: + scanner._obj4.setup(4, 3, 2); + break; + } + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +ScannerDialog::ScannerActor2::ScannerActor2() { + _v1 = _v2 = _yp = 0; + _v4 = _v5 = _v6 = 0; +} + +void ScannerDialog::ScannerActor2::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_v1); + s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_yp); + s.syncAsSint16LE(_v4); + s.syncAsSint16LE(_v5); + s.syncAsSint16LE(_v6); +} + +void ScannerDialog::ScannerActor2::remove() { + static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.remove(this); + SceneActor::remove(); +} + +void ScannerDialog::ScannerActor2::process(Event &event) { + if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE + && _bounds.contains(event.mousePos) && !_v2) { + _v6 = 1; + } + + if (event.eventType == EVENT_BUTTON_UP && _v6) { + _v6 = 0; + event.handled = 1; + update(); + } + + if (_v6) { + event.handled = true; + if (event.mousePos.x < _v2) { + setPosition(Common::Point(_v2, _yp)); + } else if (event.mousePos.x >= (_v2 + _v4)) { + setPosition(Common::Point(_v2 + _v4, _yp)); + } else { + setPosition(Common::Point(event.mousePos.x, _yp)); + } + } +} + +bool ScannerDialog::ScannerActor2::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + + return startAction(action, event); +} + +void ScannerDialog::ScannerActor2::update() { + int v = (_v4 / (_v5 - 1)) / 2; + int v2 = ((_position.x - _v2 + v) * _v5) / (_v4 + v * 2); + setPosition(Common::Point(_v2 + ((_v4 * v2) / (_v5 - 1)), _yp)); + + R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] = v2; + + switch (v2 - 1) { + case 0: + R2_GLOBALS._sound4.stop(); + break; + case 1: + R2_GLOBALS._sound4.play(45); + break; + case 2: + R2_GLOBALS._sound4.play(4); + break; + case 3: + R2_GLOBALS._sound4.play(5); + break; + case 4: + R2_GLOBALS._sound4.play(6); + break; + default: + break; + } +} + +void ScannerDialog::ScannerActor2::setup(int v1, int v2, int yp, int v4, int v5) { + _v1 = v1; + _v2 = v2; + _yp = yp; + _v4 = v4; + _v5 = v5; + _v6 = 0; + SceneActor::postInit(); + fixPriority(255); + setPosition(Common::Point(_v4 * (_v1 - 1) / (_v5 - 1) + _v2, yp)); + + static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); +} + +/*--------------------------------------------------------------------------*/ + +ScannerDialog::ScannerDialog() { +} + +void ScannerDialog::remove() { + switch (R2_GLOBALS._sceneManager._sceneNumber) { + case 1550: + case 1700: + R2_GLOBALS._events.setCursor(R2_GLOBALS._player._canWalk ? CURSOR_ARROW : CURSOR_USE); + break; + case 3800: + case 3900: { + Scene *scene = R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 3806; + scene->signal(); + break; + } + default: + break; + } + + SceneExt *scene = static_cast(R2_GLOBALS._sceneManager._scene); + scene->_sceneAreas.remove(&_obj1); + scene->_sceneAreas.remove(&_obj2); + _obj1.remove(); + _obj2.remove(); + _obj3.remove(); + _obj4.remove(); + _obj5.remove(); + _obj6.remove(); + _obj7.remove(); + + ModalDialog::remove(); +} + +void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + // Stop player moving if currently doing so + if (R2_GLOBALS._player._mover) + R2_GLOBALS._player.addMover(NULL); + + R2_GLOBALS._events.setCursor(EXITCURSOR_LEFT_HAND); + ModalDialog::proc12(visage, stripFrameNum, frameNum, posX, posY); + + proc13(100, -1, -1, -1); + _obj1.setup(1); + _obj2.setup(2); + _obj3.setup(R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); + _obj4.postInit(); + _obj4.setup(4, 3, 2); + _obj4.setPosition(Common::Point(160, 83)); + _obj4.fixPriority(256); + + if (R2_GLOBALS._sceneManager._sceneNumber == 3800 || R2_GLOBALS._sceneManager._sceneNumber == 3900) { + Scene *scene = R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 3805; + scene->signal(); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 57f8258a18..20ba999b00 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -88,7 +88,7 @@ public: SceneObject *_focusObject; Visage _cursorVisage; - SynchronizedList _sceneAreas; + SynchronizedList _sceneAreas; Rect _v51C34; public: @@ -444,6 +444,70 @@ public: virtual void synchronize(Serializer &s); }; +class ModalDialog: public SceneArea { +public: + SceneActor _object1; + byte _field20; +public: + ModalDialog(); + + virtual void remove(); + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); +}; + +class ScannerDialog: public ModalDialog { + + class ScannerActor: public SceneActor { + private: + void reset(); + public: + int _v1; + int _v2; + public: + ScannerActor(); + void setup(int v); + + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; + class ScannerActor2: public SceneActor { + private: + void update(); + public: + int _v1; + int _v2; + int _yp; + int _v4; + int _v5; + int _v6; + public: + ScannerActor2(); + void setup(int v1, int v2, int v3, int v4, int v5); + + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; +public: + ScannerActor _obj1; + ScannerActor _obj2; + ScannerActor2 _obj3; + SceneActor _obj4; + SceneActor _obj5; + SceneActor _obj6; + SceneActor _obj7; +public: + ScannerDialog(); + + virtual void remove(); + void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 692a708c74..d1deac7c3e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5397,13 +5397,14 @@ bool Scene600::Item4::startAction(CursorType action, Event &event) { } void Scene600::Actor4::signal() { - Common::Point pt(36, 177 + R2_GLOBALS._randomSource.getRandomNumber(5)); + Common::Point pt(177 + R2_GLOBALS._randomSource.getRandomNumber(5), + 108 + R2_GLOBALS._randomSource.getRandomNumber(3)); NpcMover *mover = new NpcMover(); addMover(mover, &pt, this); } bool Scene600::Actor4::startAction(CursorType action, Event &event) { - if ((action >= CURSOR_WALK) && (action < R2CURSORS_START)) + if (action >= CURSOR_WALK) // Only action cursors return SceneActor::startAction(action, event); @@ -5456,7 +5457,7 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) { bool Scene600::Actor6::startAction(CursorType action, Event &event) { Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; - if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) { + if (action < CURSOR_WALK) { switch (action) { case R2_COM_SCANNER: if (R2_GLOBALS.getFlag(6)) { @@ -5512,7 +5513,7 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { return false; break; } - } else if (action != CURSOR_USE) { + } else if (action == CURSOR_USE) { if (R2_GLOBALS.getFlag(5)) { return SceneActor::startAction(action, event); } else { @@ -5706,7 +5707,7 @@ void Scene600::signal() { R2_GLOBALS._walkRegions.enableRegion(9); R2_GLOBALS._walkRegions.enableRegion(10); - R2_INVENTORY.setObjectScene(12, 600); + R2_INVENTORY.setObjectScene(R2_AEROSOL, 600); R2_GLOBALS.setFlag(5); _actor4._effect = 3; @@ -5756,7 +5757,8 @@ void Scene600::signal() { } void Scene600::process(Event &event) { - if ((!R2_GLOBALS._player._canWalk) && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (R2_GLOBALS._player._canWalk && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN) + && (R2_GLOBALS._events.getCursor() == CURSOR_WALK)) { if (!_actor5.contains(event.mousePos) || (_actor5._frame <= 1)) { if (R2_GLOBALS.getFlag(5)) { _field412 += 10; @@ -5913,7 +5915,7 @@ bool Scene700::Actor5::startAction(CursorType action, Event &event) { case 0: if ((_strip == 2) && (_frame == 1)) { R2_GLOBALS._player.disableControl(); - if (R2_GLOBALS._player._position.x <= 100) { + if (R2_GLOBALS._player._position.y <= 100) { scene->_sceneMode = 710; scene->setAction(&scene->_sequenceManager, scene, 710, &R2_GLOBALS._player, this, NULL); } else { @@ -6417,8 +6419,8 @@ bool Scene800::Cabinet::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ void Scene800::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(800); + SceneExt::postInit(); _door.postInit(); _door.setVisage(800); @@ -7007,8 +7009,8 @@ bool Scene850::Panel::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ void Scene850::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(850); + SceneExt::postInit(); _liftDoor.postInit(); _liftDoor.setup(850, 2, 1); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index dd29488bea..00605b3ef6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -883,13 +883,6 @@ void Scene1200::synchronize(Serializer &s) { } Scene1200::LaserPanel::LaserPanel() { - _field20 = 0; -} - -void Scene1200::LaserPanel::synchronize(Serializer &s) { - SceneArea::synchronize(s); - - s.syncAsByte(_field20); } void Scene1200::LaserPanel::Jumper::init(int state) { @@ -1051,53 +1044,13 @@ void Scene1200::LaserPanel::remove() { // sub201EA R2_GLOBALS._sceneItems.remove((SceneItem *)this); - _actor2.remove(); + _object1.remove(); SceneArea::remove(); R2_GLOBALS._insetUp--; R2_GLOBALS._player._canWalk = true; } -void Scene1200::LaserPanel::process(Event &event) { - if (_field20 != R2_GLOBALS._insetUp) - return; - - CursorType cursor = R2_GLOBALS._events.getCursor(); - - if (_actor2._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) { - if (cursor == _cursorNum) { - R2_GLOBALS._events.setCursor(_savedCursorNum); - } - } else if (event.mousePos.y < 168) { - if (cursor != _cursorNum) { - _savedCursorNum = cursor; - R2_GLOBALS._events.setCursor(CURSOR_INVALID); - } - if (event.eventType == EVENT_BUTTON_DOWN) { - event.handled = true; - R2_GLOBALS._events.setCursor(_savedCursorNum); - remove(); - } - } -} - -void Scene1200::LaserPanel::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { - Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; - - _actor2.postInit(); - _actor2.setup(visage, stripFrameNum, frameNum); - _actor2.setPosition(Common::Point(posX, posY)); - _actor2.fixPriority(250); - _cursorNum = CURSOR_INVALID; - scene->_sceneAreas.push_front(this); - ++R2_GLOBALS._insetUp; - _field20 = R2_GLOBALS._insetUp; -} - -void Scene1200::LaserPanel::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { - _actor2.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); -} - void Scene1200::postInit(SceneObjectList *OwnerList) { loadScene(1200); SceneExt::postInit(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 1b6ca768ef..a2865a4b94 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -120,7 +120,7 @@ public: class Scene1200 : public SceneExt { enum CrawlDirection { CRAWL_EAST = 1, CRAWL_WEST = 2, CRAWL_SOUTH = 3, CRAWL_NORTH = 4 }; - class LaserPanel: public SceneArea { + class LaserPanel: public ModalDialog { public: class Jumper : public SceneActorExt { public: @@ -128,21 +128,14 @@ class Scene1200 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; - SceneActor _actor2; Jumper _jumper1; Jumper _jumper2; Jumper _jumper3; - byte _field20; - LaserPanel(); - void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); - virtual void process(Event &event); - virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); - virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; public: diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index 4126e31822..d43ef792bc 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -150,6 +150,16 @@ public: if (i != this->end()) ++i; this->insert(i, newItem); } + + bool contains(T item) { + typename SynchronizedList::iterator i = this->begin(); + for (; i != this->end(); ++i) { + if (*i == item) + return true; + } + + return false; + } }; /** diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index 4bd9e49875..c0ebb804d2 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -84,7 +84,10 @@ void UIQuestion::showDescription(CursorType cursor) { case GType_Ringworld2: if ((cursor == R2_COM_SCANNER) || (cursor == R2_COM_SCANNER_2)) { // Show communicator - warning("TODO: Communicator"); + Ringworld2::SceneExt *scene = static_cast + (R2_GLOBALS._sceneManager._scene); + if (!scene->_sceneAreas.contains(R2_GLOBALS._scannerDialog)) + R2_GLOBALS._scannerDialog->proc12(4, 1, 1, 160, 125); } else { // Show object description SceneItem::display2(3, (int)cursor); @@ -399,7 +402,7 @@ void UIElements::setup(const Common::Point &pt) { } // Setup bottom-right hand buttons - xp += 62; + xp = (g_vm->getGameID() == GType_Ringworld2) ? 255 : 253; int yp = (g_vm->getGameID() == GType_BlueForce) ? 16 : 17; _question.setup(1, 4, 7, xp, yp, 255); _question.setEnabled(false); @@ -410,7 +413,7 @@ void UIElements::setup(const Common::Point &pt) { add(&_scrollLeft); _scrollLeft._isLeft = true; - xp += 22; + xp += (g_vm->getGameID() == GType_Ringworld2) ? 21 : 22; _scrollRight.setup(1, 4, 4, xp, yp, 255); add(&_scrollRight); _scrollRight._isLeft = false; -- cgit v1.2.3 From 96c4ebe77fff9f23e085bb80a4907e6f857a96c2 Mon Sep 17 00:00:00 2001 From: countingpine Date: Tue, 16 Jul 2013 16:16:08 +0100 Subject: SCUMM: Better Player_Mac::durationToSamples Uses the fact that 4*480*480 == 225 << 12, and the identity (a*b)>>n == (a>>n)*b + ((a%(1<>n (assuming non-overflowing math), except the rhs uses smaller intermediate values and does not overflow(*). Compared to the original code, this uses 1 fewer division and eliminates the rounding error. (*) Technical note: In some cases the right hand side of the above identity still has possibilities of intermediate overflow, but only if b > (1 << n), or if (b << n) overflows, neither of which are true here.--- engines/scumm/player_mac.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/scumm/player_mac.cpp b/engines/scumm/player_mac.cpp index c16c85bff3..a60736df5e 100644 --- a/engines/scumm/player_mac.cpp +++ b/engines/scumm/player_mac.cpp @@ -289,12 +289,16 @@ uint32 Player_Mac::durationToSamples(uint16 duration) { // (duration * 473 * _sampleRate) / (4 * 480 * 480) // // But that's likely to cause integer overflow, so we do it in two - // steps and hope that the rounding error won't be noticeable. + // steps using bitwise operations to perform + // ((duration * 473 * _sampleRate) / 4096) without overflowing, + // then divide this by 225 + // (note that 4 * 480 * 480 == 225 * 4096 == 225 << 12) // // The original code is a bit unclear on if it should be 473 or 437, // but since the comments indicated 473 I'm assuming 437 was a typo. - uint32 samples = (duration * _sampleRate) / (4 * 480); - samples = (samples * 473) / 480; + uint32 samples = (duration * _sampleRate); + samples = (samples >> 12) * 473 + (((samples & 4095) * 473) >> 12); + samples = samples / 225; return samples; } -- cgit v1.2.3 From e5e90434f3e73d1a00f5fb77edb3916137603f18 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 16 Jul 2013 19:19:45 +0200 Subject: TSAGE: Fix stray "You have no use for that." message This would happen in Ringworld when clicking on the slot in the flycycle. I have compared the behaviour to the original, and I can't see any obvious differences after my change. CID 1003728 --- engines/tsage/ringworld/ringworld_scenes1.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/tsage/ringworld/ringworld_scenes1.cpp b/engines/tsage/ringworld/ringworld_scenes1.cpp index 4d9d565705..89c07273fc 100644 --- a/engines/tsage/ringworld/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld/ringworld_scenes1.cpp @@ -2273,6 +2273,7 @@ void Scene60::Item1::doAction(int action) { } else { scene->setAction(&scene->_action2); } + break; default: SceneHotspot::doAction(action); break; -- cgit v1.2.3 From 7381fcdf305315591fd2d9c66d9804ceb6fd3996 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 16 Jul 2013 20:30:30 +0100 Subject: TUCKER: Amend fix for bug #3614697 - "Spanish version uncompletable..." The mof instruction needs to return 0 or 1 to continue execution, rather than 2 which indicates to end table instruction execution. Using 0 as this is most likely correct value. --- engines/tucker/tucker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 122be958ff..04e83efbe5 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -3238,7 +3238,7 @@ int TuckerEngine::executeTableInstruction() { return 1; case kCode_mof: // TODO: Unknown opcode in Spanish version. Identify if this has any function. - return 2; + return 0; case kCode_opt: _conversationOptionsCount = readTableInstructionParam(2); for (i = 0; i < _conversationOptionsCount; ++i) { -- cgit v1.2.3 From b7fbf23673035508c0cd7099ade3311a00a3ea4f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 16 Jul 2013 23:20:58 -0400 Subject: TSAGE: Fixes for R2R scanner dialog --- engines/tsage/globals.cpp | 4 +- engines/tsage/globals.h | 2 +- engines/tsage/ringworld2/ringworld2_dialogs.cpp | 14 +-- engines/tsage/ringworld2/ringworld2_logic.cpp | 134 +++++++++++++----------- engines/tsage/ringworld2/ringworld2_logic.h | 36 ++++--- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 +- 6 files changed, 102 insertions(+), 92 deletions(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 8970d08e4d..27cda63aaa 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -478,7 +478,7 @@ void Ringworld2Globals::reset() { _v565EC[2] = 27; _v565EC[3] = 4; _v565EC[4] = 4; - Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 1); + Common::fill(&_scannerFrequencies[0], &_scannerFrequencies[MAX_CHARACTERS], 1); _speechSubtitles = SPEECH_VOICE | SPEECH_TEXT; _insetUp = 0; _frameEdgeColour = 2; @@ -541,7 +541,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsByte(_v565EC[i]); for (i = 0; i < MAX_CHARACTERS; ++i) - s.syncAsByte(_v565F1[i]); + s.syncAsByte(_scannerFrequencies[i]); s.syncAsByte(_v565AE); s.syncAsByte(_v566A4); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 88fc0821df..40254bd11e 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -305,7 +305,7 @@ public: int _v57C2C; int _speechSubtitles; byte _v565EC[5]; - byte _v565F1[4]; + byte _scannerFrequencies[4]; byte _stripManager_lookupList[12]; ScannerDialog *_scannerDialog; diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 478fdcf5a5..57fdef6405 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -236,7 +236,7 @@ void CharacterDialog::show() { // Play a transition sound as the character is changed if (R2_GLOBALS._player._characterScene[0] != 300) { - switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) { + switch (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex]) { case 0: R2_GLOBALS._sound4.stop(); break; @@ -255,8 +255,8 @@ void CharacterDialog::show() { default: break; } - } else if (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] > 1) { - switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) { + } else if (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex] > 1) { + switch (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex]) { case 2: R2_GLOBALS._sound4.play(45); break; @@ -272,8 +272,8 @@ void CharacterDialog::show() { default: break; } - } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._v565F1[1] != 1)) { - switch (R2_GLOBALS._v565F1[1]) { + } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._scannerFrequencies[1] != 1)) { + switch (R2_GLOBALS._scannerFrequencies[1]) { case 2: R2_GLOBALS._sound4.play(45); break; @@ -291,10 +291,10 @@ void CharacterDialog::show() { } } else if (R2_GLOBALS._player._characterScene[2] != 300) { R2_GLOBALS._sound4.stop(); - } else if (R2_GLOBALS._v565F1[2] == 1) { + } else if (R2_GLOBALS._scannerFrequencies[2] == 1) { R2_GLOBALS._sound4.stop(); } else { - switch (R2_GLOBALS._v565F1[1]) { + switch (R2_GLOBALS._scannerFrequencies[1]) { case 2: R2_GLOBALS._sound4.play(45); break; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 1ddaa5e6c2..b0d8d29843 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -417,8 +417,10 @@ bool SceneExt::display(CursorType action, Event &event) { SceneItem::display2(5, 0); break; case R2_SONIC_STUNNER: - if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) && - (R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) { + if ((R2_GLOBALS._scannerFrequencies[R2_QUINN] == 2) + || ((R2_GLOBALS._scannerFrequencies[R2_QUINN] == 1) && + (R2_GLOBALS._scannerFrequencies[R2_SEEKER] == 2) && + (R2_GLOBALS._sceneManager._previousScene == 300))) { R2_GLOBALS._sound4.stop(); R2_GLOBALS._sound3.play(46); SceneItem::display2(5, 15); @@ -2124,62 +2126,63 @@ void ModalDialog::proc13(int resNum, int lookLineNum, int talkLineNum, int useLi /*--------------------------------------------------------------------------*/ -ScannerDialog::ScannerActor::ScannerActor() { - _v1 = _v2 = 0; +ScannerDialog::Button::Button() { + _buttonId = 0; + _buttonDown = false; } -void ScannerDialog::ScannerActor::setup(int v) { - _v1 = v; - _v2 = 0; +void ScannerDialog::Button::setup(int buttonId) { + _buttonId = buttonId; + _buttonDown = false; SceneActor::postInit(); SceneObject::setup(4, 2, 2); fixPriority(255); - if (_v1 == 1) + if (_buttonId == 1) setPosition(Common::Point(141, 99)); - else if (_v1 == 2) + else if (_buttonId == 2) setPosition(Common::Point(141, 108)); static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); } -void ScannerDialog::ScannerActor::synchronize(Serializer &s) { +void ScannerDialog::Button::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_buttonId); } -void ScannerDialog::ScannerActor::process(Event &event) { +void ScannerDialog::Button::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE - && _bounds.contains(event.mousePos) && !_v2) { + && _bounds.contains(event.mousePos) && !_buttonDown) { setFrame(3); - _v2 = 1; + _buttonDown = true; event.handled = true; } - if (event.eventType == EVENT_BUTTON_UP && _v2) { + if (event.eventType == EVENT_BUTTON_UP && _buttonDown) { setFrame(2); - _v2 = 0; + _buttonDown = false; event.handled = true; reset(); } } -bool ScannerDialog::ScannerActor::startAction(CursorType action, Event &event) { +bool ScannerDialog::Button::startAction(CursorType action, Event &event) { if (action == CURSOR_USE) return false; return startAction(action, event); } -void ScannerDialog::ScannerActor::reset() { +void ScannerDialog::Button::reset() { Scene *scene = R2_GLOBALS._sceneManager._scene; ScannerDialog &scanner = *R2_GLOBALS._scannerDialog; - switch (_v1) { + switch (_buttonId) { case 1: + // Talk button switch (R2_GLOBALS._sceneManager._sceneNumber) { case 1550: scene->_sceneMode = 80; @@ -2195,6 +2198,7 @@ void ScannerDialog::ScannerActor::reset() { } break; case 2: + // Scan button switch (R2_GLOBALS._sceneManager._sceneNumber) { case 1550: scanner._obj4.setup(4, 3, 1); @@ -2244,66 +2248,66 @@ void ScannerDialog::ScannerActor::reset() { /*--------------------------------------------------------------------------*/ -ScannerDialog::ScannerActor2::ScannerActor2() { - _v1 = _v2 = _yp = 0; - _v4 = _v5 = _v6 = 0; +ScannerDialog::Slider::Slider() { + _initial = _xStart = _yp = 0; + _width = _xInc = 0; + _sliderDown = false; } -void ScannerDialog::ScannerActor2::synchronize(Serializer &s) { +void ScannerDialog::Slider::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_initial); + s.syncAsSint16LE(_xStart); s.syncAsSint16LE(_yp); - s.syncAsSint16LE(_v4); - s.syncAsSint16LE(_v5); - s.syncAsSint16LE(_v6); + s.syncAsSint16LE(_width); + s.syncAsSint16LE(_xInc); } -void ScannerDialog::ScannerActor2::remove() { +void ScannerDialog::Slider::remove() { static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.remove(this); SceneActor::remove(); } -void ScannerDialog::ScannerActor2::process(Event &event) { +void ScannerDialog::Slider::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE - && _bounds.contains(event.mousePos) && !_v2) { - _v6 = 1; + && _bounds.contains(event.mousePos)) { + _sliderDown = true; } - if (event.eventType == EVENT_BUTTON_UP && _v6) { - _v6 = 0; - event.handled = 1; + if (event.eventType == EVENT_BUTTON_UP && _sliderDown) { + _sliderDown = false; + event.handled = true; update(); } - if (_v6) { + if (_sliderDown) { event.handled = true; - if (event.mousePos.x < _v2) { - setPosition(Common::Point(_v2, _yp)); - } else if (event.mousePos.x >= (_v2 + _v4)) { - setPosition(Common::Point(_v2 + _v4, _yp)); + if (event.mousePos.x < _xStart) { + setPosition(Common::Point(_xStart, _yp)); + } else if (event.mousePos.x >= (_xStart + _width)) { + setPosition(Common::Point(_xStart + _width, _yp)); } else { setPosition(Common::Point(event.mousePos.x, _yp)); } } } -bool ScannerDialog::ScannerActor2::startAction(CursorType action, Event &event) { +bool ScannerDialog::Slider::startAction(CursorType action, Event &event) { if (action == CURSOR_USE) return false; return startAction(action, event); } -void ScannerDialog::ScannerActor2::update() { - int v = (_v4 / (_v5 - 1)) / 2; - int v2 = ((_position.x - _v2 + v) * _v5) / (_v4 + v * 2); - setPosition(Common::Point(_v2 + ((_v4 * v2) / (_v5 - 1)), _yp)); +void ScannerDialog::Slider::update() { + int incHalf = (_width / (_xInc - 1)) / 2; + int newFrequency = ((_position.x - _xStart + incHalf) * _xInc) / (_width + incHalf * 2); + setPosition(Common::Point(_xStart + ((_width * newFrequency) / (_xInc - 1)), _yp)); - R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] = v2; + R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex] = newFrequency + 1; - switch (v2 - 1) { + switch (newFrequency) { case 0: R2_GLOBALS._sound4.stop(); break; @@ -2324,16 +2328,17 @@ void ScannerDialog::ScannerActor2::update() { } } -void ScannerDialog::ScannerActor2::setup(int v1, int v2, int yp, int v4, int v5) { - _v1 = v1; - _v2 = v2; +void ScannerDialog::Slider::setup(int initial, int xStart, int yp, int width, int xInc) { + _initial = initial; + _xStart = xStart; _yp = yp; - _v4 = v4; - _v5 = v5; - _v6 = 0; + _width = width; + _xInc = xInc; + _sliderDown = false; SceneActor::postInit(); + SceneObject::setup(4, 2, 1); fixPriority(255); - setPosition(Common::Point(_v4 * (_v1 - 1) / (_v5 - 1) + _v2, yp)); + setPosition(Common::Point(_width * (_initial - 1) / (_xInc - 1) + _xStart, yp)); static_cast(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); } @@ -2361,11 +2366,11 @@ void ScannerDialog::remove() { } SceneExt *scene = static_cast(R2_GLOBALS._sceneManager._scene); - scene->_sceneAreas.remove(&_obj1); - scene->_sceneAreas.remove(&_obj2); - _obj1.remove(); - _obj2.remove(); - _obj3.remove(); + scene->_sceneAreas.remove(&_talkButton); + scene->_sceneAreas.remove(&_scanButton); + _talkButton.remove(); + _scanButton.remove(); + _slider.remove(); _obj4.remove(); _obj5.remove(); _obj6.remove(); @@ -2379,13 +2384,14 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); - R2_GLOBALS._events.setCursor(EXITCURSOR_LEFT_HAND); + R2_GLOBALS._events.setCursor(CURSOR_USE); ModalDialog::proc12(visage, stripFrameNum, frameNum, posX, posY); proc13(100, -1, -1, -1); - _obj1.setup(1); - _obj2.setup(2); - _obj3.setup(R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); + _talkButton.setup(1); + _scanButton.setup(2); + _slider.setup(R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); + _obj4.postInit(); _obj4.setup(4, 3, 2); _obj4.setPosition(Common::Point(160, 83)); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 20ba999b00..2e7dd64fa2 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -453,6 +453,7 @@ public: virtual void remove(); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ModalDialog"; } virtual void process(Event &event); virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); @@ -460,43 +461,45 @@ public: class ScannerDialog: public ModalDialog { - class ScannerActor: public SceneActor { + class Button: public SceneActor { private: void reset(); public: - int _v1; - int _v2; + int _buttonId; + bool _buttonDown; public: - ScannerActor(); - void setup(int v); + Button(); + void setup(int buttonId); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerButton"; } virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); }; - class ScannerActor2: public SceneActor { + class Slider: public SceneActor { private: void update(); public: - int _v1; - int _v2; + int _initial; + int _xStart; int _yp; - int _v4; - int _v5; - int _v6; + int _width; + int _xInc; + bool _sliderDown; public: - ScannerActor2(); - void setup(int v1, int v2, int v3, int v4, int v5); + Slider(); + void setup(int initial, int xStart, int yp, int width, int xInc); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerSlider"; } virtual void remove(); virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); }; public: - ScannerActor _obj1; - ScannerActor _obj2; - ScannerActor2 _obj3; + Button _talkButton; + Button _scanButton; + Slider _slider; SceneActor _obj4; SceneActor _obj5; SceneActor _obj6; @@ -504,6 +507,7 @@ public: public: ScannerDialog(); + virtual Common::String getClassName() { return "ScannerDialog"; } virtual void remove(); void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index d1deac7c3e..1dd9c9c25f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5548,7 +5548,7 @@ bool Scene600::Actor8::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 615; scene->setAction(&scene->_sequenceManager1, scene, 615, &R2_GLOBALS._player, &scene->_actor8, NULL); - } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._v565F1[1] == 2) && (!R2_GLOBALS.getFlag(8))){ + } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._scannerFrequencies[1] == 2) && (!R2_GLOBALS.getFlag(8))){ R2_GLOBALS._player.disableControl(); scene->_sceneMode = 608; scene->setAction(&scene->_sequenceManager1, scene, 608, &R2_GLOBALS._player, &scene->_actor4, NULL); @@ -5582,7 +5582,7 @@ void Scene600::postInit(SceneObjectList *OwnerList) { _actor8.setup(602, 5, 1); _actor8.setPosition(Common::Point(246, 41)); _actor8.setDetails(600, 20, -1, -1, 1, (SceneItem *) NULL); - switch (R2_GLOBALS._v565F1[1] - 2) { + switch (R2_GLOBALS._scannerFrequencies[1] - 2) { case 0: R2_GLOBALS._sound4.play(45); break; -- cgit v1.2.3 From 2eb26ad02ead5fc65cc206cb287ff04c84eba4e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 17 Jul 2013 22:02:24 -0400 Subject: TSAGE: Some further cleanup of R2R drive room --- engines/tsage/ringworld2/ringworld2_logic.cpp | 3 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 102 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes0.h | 22 ++--- 3 files changed, 66 insertions(+), 61 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index b0d8d29843..6dabbbc368 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -88,6 +88,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene - Walking in hall return new Scene525(); case 600: + // Drive Room return new Scene600(); case 700: // Lander Bay 2 @@ -426,7 +427,7 @@ bool SceneExt::display(CursorType action, Event &event) { SceneItem::display2(5, 15); } else { R2_GLOBALS._sound3.play(43, 0); - SceneItem::display2(2, 0); + SceneItem::display2(2, R2_SONIC_STUNNER); } R2_GLOBALS._sound4.play(45); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 1dd9c9c25f..634ecf3ddb 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2042,8 +2042,8 @@ void Scene200::WestExit::changeScene() { /*--------------------------------------------------------------------------*/ void Scene200::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(200); + SceneExt::postInit(); _westExit.setDetails(Rect(94, 0, 123, 58), EXITCURSOR_W, 175); _westExit.setDest(Common::Point(125, 52)); @@ -5341,9 +5341,10 @@ void Scene525::signal() { } /*-------------------------------------------------------------------------- - * Scene 600 - + * Scene 600 - Drive Room * *--------------------------------------------------------------------------*/ + Scene600::Scene600() { _field412 = 0; for (int i = 0; i < 256; i++) @@ -5358,11 +5359,12 @@ void Scene600::synchronize(Serializer &s) { s.syncAsByte(_fieldAD2[i]); } -bool Scene600::Item1::startAction(CursorType action, Event &event) { +bool Scene600::CompartmentHotspot::startAction(CursorType action, Event &event) { if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8))) return SceneHotspot::startAction(action, event); - SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 32, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER, + SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END); return true; } @@ -5371,12 +5373,14 @@ bool Scene600::Item4::startAction(CursorType action, Event &event) { return SceneHotspot::startAction(action, event); if ((R2_GLOBALS.getFlag(5)) && (!R2_GLOBALS.getFlag(8))) { - SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 32, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER, + SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END); return true; } if (R2_GLOBALS.getFlag(5)) { - SceneItem::display(600, 30, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 30, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER, + SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END); return true; } @@ -5416,7 +5420,7 @@ void Scene600::Actor4::draw() { SceneActor::draw(); } -bool Scene600::Actor5::startAction(CursorType action, Event &event) { +bool Scene600::Doorway::startAction(CursorType action, Event &event) { if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) return false; @@ -5427,10 +5431,10 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) { if ((R2_INVENTORY.getObjectScene(R2_CLAMP) == 600) && (!R2_GLOBALS.getFlag(6))) { R2_GLOBALS._player.disableControl(); - scene->_actor6.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL); + scene->_laser.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL); R2_GLOBALS.setFlag(6); scene->_sceneMode = 609; - scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_doorway, &scene->_laser, &scene->_actor1, NULL); return true; } @@ -5440,7 +5444,7 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) { if (!R2_GLOBALS.getFlag(6)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 616; - scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_doorway, &scene->_laser, NULL); return true; } @@ -5449,12 +5453,12 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) { else { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 601; - scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_actor5, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_doorway, NULL); } return true; } -bool Scene600::Actor6::startAction(CursorType action, Event &event) { +bool Scene600::Laser::startAction(CursorType action, Event &event) { Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; if (action < CURSOR_WALK) { @@ -5467,7 +5471,7 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { } else { R2_GLOBALS._player.disableControl(); scene->_actor8.postInit(); - scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_actor6); + scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_laser); scene->_sceneMode = 607; scene->setAction(&scene->_sequenceManager1, scene, 607, &R2_GLOBALS._player, &scene->_actor8, NULL); return true; @@ -5482,8 +5486,8 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { return true; } else { R2_GLOBALS._player.disableControl(); - scene->_actor7.postInit(); - scene->_actor7.setDetails(600, 27, -1, -1, 5, &scene->_actor6); + scene->_aerosol.postInit(); + scene->_aerosol.setDetails(600, 27, -1, -1, 5, &scene->_laser); scene->_actor4.postInit(); scene->_actor4.setup(601, 3, 1); @@ -5491,11 +5495,11 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { scene->_actor4._moveDiff = Common::Point(1, 1); scene->_actor4._moveRate = 2; scene->_actor4._numFrames = 3; - scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_actor7); + scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_aerosol); scene->_sceneMode = 605; - scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_actor7, &scene->_actor4, &scene->_actor5, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_aerosol, &scene->_actor4, &scene->_doorway, NULL); return true; } break; @@ -5503,7 +5507,7 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { if (R2_GLOBALS.getFlag(5)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 606; - scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_actor6, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_laser, NULL); return true; } else { return SceneActor::startAction(action, event); @@ -5526,7 +5530,7 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } -bool Scene600::Actor7::startAction(CursorType action, Event &event) { +bool Scene600::Aerosol::startAction(CursorType action, Event &event) { Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) { @@ -5534,7 +5538,7 @@ bool Scene600::Actor7::startAction(CursorType action, Event &event) { } else if (action == CURSOR_USE) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 614; - scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_actor7, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_aerosol, NULL); return true; } else { return SceneActor::startAction(action, event); @@ -5568,14 +5572,14 @@ void Scene600::postInit(SceneObjectList *OwnerList) { warning("FIXME: loop to initialize _fieldAD2[]"); - _actor5.postInit(); - _actor5.setVisage(600); - _actor5.setPosition(Common::Point(29, 147)); - _actor5.fixPriority(10); - _actor5.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL); + _doorway.postInit(); + _doorway.setVisage(600); + _doorway.setPosition(Common::Point(29, 147)); + _doorway.fixPriority(10); + _doorway.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL); - _actor6.postInit(); - _actor6.setPosition(Common::Point(246, 41)); + _laser.postInit(); + _laser.setPosition(Common::Point(246, 41)); if (R2_INVENTORY.getObjectScene(9) == 600) { _actor8.postInit(); @@ -5601,11 +5605,11 @@ void Scene600::postInit(SceneObjectList *OwnerList) { } if (R2_GLOBALS.getFlag(6)) { - _actor6.setup(602, 7, 1); - _actor6.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL); + _laser.setup(602, 7, 1); + _laser.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL); } else { - _actor6.setup(600, 2, 1); - _actor6.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL); + _laser.setup(600, 2, 1); + _laser.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL); _actor1.postInit(); _actor1.setup(600, 3, 5); @@ -5618,10 +5622,10 @@ void Scene600::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS.getFlag(5)) { if (R2_INVENTORY.getObjectScene(12) == 600) { - _actor7.postInit(); - _actor7.setup(602, 2, 2); - _actor7.setPosition(Common::Point(189, 95)); - _actor7.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL); + _aerosol.postInit(); + _aerosol.setup(602, 2, 2); + _aerosol.setPosition(Common::Point(189, 95)); + _aerosol.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL); } if (R2_GLOBALS.getFlag(8)) { @@ -5655,30 +5659,30 @@ void Scene600::postInit(SceneObjectList *OwnerList) { _item3.setDetails(11, 600, 14, -1, -1); if (R2_GLOBALS.getFlag(9)) { - _item1.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL); + _background.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL); } else { _item4.setDetails(Rect(173, 15, 315, 45), 600, 21, -1, 23, 1, NULL); - _item1.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL); + _background.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL); } _item5.setDetails(Rect(0, 0, 320, 200), 600, 0, -1, -1, 1, NULL); _sceneMode = 600; if (R2_GLOBALS._sceneManager._previousScene == 700) { if (R2_GLOBALS.getFlag(6)) { - setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_actor5, NULL); + setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_doorway, NULL); } else if (R2_GLOBALS.getFlag(5)) { - setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL); + setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_doorway, &_laser, &_actor1, NULL); } else { - setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL); + setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_doorway, &_laser, &_actor1, NULL); } } else if (R2_GLOBALS.getFlag(5)) { R2_GLOBALS._player.setPosition(Common::Point(50, 140)); R2_GLOBALS._player.setStrip(3); - _actor6.setFrame(_actor6.getFrameCount()); + _laser.setFrame(_laser.getFrameCount()); signal(); } else { - _actor5.setFrame(7); - _actor6.setFrame(7); + _doorway.setFrame(7); + _laser.setFrame(7); R2_GLOBALS._player.setPosition(Common::Point(28, 140)); R2_GLOBALS._player.setStrip(5); signal(); @@ -5734,12 +5738,12 @@ void Scene600::signal() { _actor3.remove(); R2_GLOBALS._sceneItems.remove(&_item4); _actor2.setDetails(600, 21, -1, 23, 4, &_item4); - _item1.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL); + _background.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL); R2_GLOBALS._player.enableControl(CURSOR_USE); break; case 614: R2_GLOBALS._player.enableControl(); - _actor7.remove(); + _aerosol.remove(); R2_INVENTORY.setObjectScene(12, 1); R2_GLOBALS._walkRegions.disableRegion(7); break; @@ -5759,7 +5763,7 @@ void Scene600::signal() { void Scene600::process(Event &event) { if (R2_GLOBALS._player._canWalk && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_WALK)) { - if (!_actor5.contains(event.mousePos) || (_actor5._frame <= 1)) { + if (!_doorway.contains(event.mousePos) || (_doorway._frame <= 1)) { if (R2_GLOBALS.getFlag(5)) { _field412 += 10; } else { @@ -5771,7 +5775,7 @@ void Scene600::process(Event &event) { } else { R2_GLOBALS._player.disableControl(); _sceneMode = 613; - setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_actor6, NULL); + setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_laser, NULL); event.handled = true; } } else if ((!R2_GLOBALS.getFlag(6)) && (R2_GLOBALS._player._mover) && (_field412 < 10)){ @@ -5783,9 +5787,9 @@ void Scene600::process(Event &event) { void Scene600::dispatch() { if ((_field412 != 0) && (_sceneMode != 600) && (_sceneMode != 603) && (_sceneMode != 602)) { - if ( ((_actor6._strip == 4) && (_actor6._frame > 1)) + if ( ((_laser._strip == 4) && (_laser._frame > 1)) || (_sceneMode == 601) - || ((_sceneMode == 616) && (_actor5._frame > 1)) ) + || ((_sceneMode == 616) && (_doorway._frame > 1)) ) _field412 = 0; else { _field412--; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index b229fd494b..58dad85a4c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -615,7 +615,7 @@ public: }; class Scene600 : public SceneExt { - class Item1 : public NamedHotspot { + class CompartmentHotspot : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -630,15 +630,15 @@ class Scene600 : public SceneExt { virtual bool startAction(CursorType action, Event &event); virtual void draw(); }; - class Actor5 : public SceneActor { + class Doorway : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor6 : public SceneActor { + class Laser : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor7 : public SceneActor { + class Aerosol : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; @@ -648,19 +648,19 @@ class Scene600 : public SceneExt { }; public: int _field412; - Item1 _item1; - Item1 _item2; - Item1 _item3; + CompartmentHotspot _background; + CompartmentHotspot _item2; + CompartmentHotspot _item3; Item4 _item4; - Item1 _item5; + CompartmentHotspot _item5; BackgroundSceneObject _object1; SceneActor _actor1; SceneActor _actor2; SceneActor _actor3; Actor4 _actor4; - Actor5 _actor5; - Actor6 _actor6; - Actor7 _actor7; + Doorway _doorway; + Laser _laser; + Aerosol _aerosol; Actor8 _actor8; ASoundExt _aSound1; SequenceManager _sequenceManager1; -- cgit v1.2.3 From 73bb5c5fbe66329f9074c2661a2035435e6756a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Jul 2013 09:27:55 -0400 Subject: DEVTOOLS: Moved implementation of create_mortdat File class from the header file --- devtools/create_mortdat/create_mortdat.cpp | 62 +++++++++++++++++++++++++++++ devtools/create_mortdat/create_mortdat.h | 63 +++++++----------------------- 2 files changed, 76 insertions(+), 49 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 2dff398de2..cb7d6aa189 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -42,6 +42,68 @@ #include "enginetext.h" #include "gametext.h" + +bool File::open(const char *filename, AccessMode mode) { + f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); + return (f != NULL); +} + +void File::close() { + fclose(f); + f = NULL; +} + +int File::seek(int32 offset, int whence) { + return fseek(f, offset, whence); +} + +long File::read(void *buffer, int len) { + return fread(buffer, 1, len, f); +} +void File::write(const void *buffer, int len) { + fwrite(buffer, 1, len, f); +} + +byte File::readByte() { + byte v; + read(&v, sizeof(byte)); + return v; +} + +uint16 File::readWord() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); +} + +uint32 File::readLong() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_LE_32(v); +} + +void File::writeByte(byte v) { + write(&v, sizeof(byte)); +} + +void File::writeWord(uint16 v) { + uint16 vTemp = TO_LE_16(v); + write(&vTemp, sizeof(uint16)); +} + +void File::writeLong(uint32 v) { + uint32 vTemp = TO_LE_32(v); + write(&vTemp, sizeof(uint32)); +} + +void File::writeString(const char *s) { + write(s, strlen(s) + 1); +} + +uint32 File::pos() { + return ftell(f); +} + /*-------------------------------------------------------------------------*/ void openOutputFile(const char *outFilename) { diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h index 908cb61951..8c210d32d9 100644 --- a/devtools/create_mortdat/create_mortdat.h +++ b/devtools/create_mortdat/create_mortdat.h @@ -43,55 +43,20 @@ class File { private: FILE *f; public: - bool open(const char *filename, AccessMode mode = kFileReadMode) { - f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); - return (f != NULL); - } - void close() { - fclose(f); - f = NULL; - } - int seek(int32 offset, int whence = SEEK_SET) { - return fseek(f, offset, whence); - } - long read(void *buffer, int len) { - return fread(buffer, 1, len, f); - } - void write(const void *buffer, int len) { - fwrite(buffer, 1, len, f); - } - byte readByte() { - byte v; - read(&v, sizeof(byte)); - return v; - } - uint16 readWord() { - uint16 v; - read(&v, sizeof(uint16)); - return FROM_LE_16(v); - } - uint32 readLong() { - uint32 v; - read(&v, sizeof(uint32)); - return FROM_LE_32(v); - } - void writeByte(byte v) { - write(&v, sizeof(byte)); - } - void writeWord(uint16 v) { - uint16 vTemp = TO_LE_16(v); - write(&vTemp, sizeof(uint16)); - } - void writeLong(uint32 v) { - uint32 vTemp = TO_LE_32(v); - write(&vTemp, sizeof(uint32)); - } - void writeString(const char *s) { - write(s, strlen(s) + 1); - } - uint32 pos() { - return ftell(f); - } + bool open(const char *filename, AccessMode mode = kFileReadMode); + void close(); + int seek(int32 offset, int whence = SEEK_SET); + uint32 pos(); + long read(void *buffer, int len); + void write(const void *buffer, int len); + + byte readByte(); + uint16 readWord(); + uint32 readLong(); + void writeByte(byte v); + void writeWord(uint16 v); + void writeLong(uint32 v); + void writeString(const char *s); }; File outputFile, mortCom; -- cgit v1.2.3 From a888de559944dffdffb77d339b7758eb867ea6a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 17 Jul 2013 15:21:27 +0200 Subject: MORTEVIELLE: Improve German engine texts --- devtools/create_mortdat/enginetext.h | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/devtools/create_mortdat/enginetext.h b/devtools/create_mortdat/enginetext.h index 6095f09360..e1c40f898b 100644 --- a/devtools/create_mortdat/enginetext.h +++ b/devtools/create_mortdat/enginetext.h @@ -135,52 +135,52 @@ const char *engineDataFr[] = { const char *engineDataDe[] = { "[2][ ][JA][NEIN]", - "Go to", - "Someone enters, looks surprised, but says nothing", + "gehen", + "Jemand kommt herein, scheint erstaunt, sagt nichts", "Cool", "Schwer", "Ungesund", "Idem", - "You", - "are", - "Alone", + "Sie", + "sind", + "allein", "Verdammt! Sie hoeren ein Geraeush...", "Sie haetten ", "% der Hinweise| bemerken muessen...", - "Do you want to wake up?", + "Moechten Sie aufwachen?", "OK", "", " schreiben", " lesen", - " Restart ", - "F3 nochmals", + " wieder ", + "F3: nochmals", "F8: stop", - "Hide self", - "take", - " probe ", - " raise ", + " sich verstecken", + " nehmen", + " sondieren", + " hochheben", " -WEITER- ", " -STOP- ", "[1][ Benutzen Sie jetzt das Menue DEP...][OK]", - "lift", - "read", - - "look", - "search", - "open", - "put", - "turn", - "tie", - "close", - "hit", - "pose", - "smash", - - "smell", - "scratch", - "probe", + "hochheben", + "lesen", + + "anschauen", + "durchsuchen", + "oeffnen", + "setzen", + "drehen", + "befestigen", + "schliessen", + "klopfen", + "hinlegen", + "eindruecken", + + "fuehlen", + "abkratzen", + "sondieren", "[1][ Benutzen Sie jetzt das Menue DEP...][OK]", "& tag", NULL -- cgit v1.2.3 From 69f593ad1e199a8768ed2a0b5a618b0ffaa353ae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 17 Jul 2013 20:32:50 +0200 Subject: MORTEVIELLE: Some renaming in intro functions --- engines/mortevielle/dialogs.cpp | 20 ++++++++++++++------ engines/mortevielle/dialogs.h | 6 +++--- engines/mortevielle/mortevielle.cpp | 4 ++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 69cb81b4ef..1e82863237 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -423,7 +423,7 @@ void DialogManager::drawF3F8() { * Graphical Device if modified * @remarks Originally called 'diver' */ -void DialogManager::checkForF8(int SpeechNum, bool drawAni50Fl) { +void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { _vm->_speechManager.startSpeech(SpeechNum, 0, 0); @@ -434,7 +434,7 @@ void DialogManager::checkForF8(int SpeechNum, bool drawAni50Fl) { if (_vm->_newGraphicalDevice != _vm->_currGraphicalDevice) { _vm->_currGraphicalDevice = _vm->_newGraphicalDevice; _vm->hirs(); - aff50(drawAni50Fl); + displayIntroScreen(drawFrame2Fl); } } while (_vm->_key != 66); // keycode for F8 } @@ -455,13 +455,17 @@ int DialogManager::waitForF3F8() { return key; } -void DialogManager::aff50(bool drawAni50Fl) { +/** + * Intro function - display intro screen + * @remarks Originally called 'aff50' + */ +void DialogManager::displayIntroScreen(bool drawFrame2Fl) { _vm->_caff = 50; _vm->_maff = 0; _vm->_text.taffich(); _vm->draw(kAdrDes, 63, 12); - if (drawAni50Fl) - ani50(); + if (drawFrame2Fl) + displayIntroFrame2(); else _vm->handleDescriptionText(2, kDialogStringIndex + 142); @@ -469,7 +473,11 @@ void DialogManager::aff50(bool drawAni50Fl) { drawF3F8(); } -void DialogManager::ani50() { +/** + * Intro function - display 2nd frame of intro + * @remarks Originally called 'ani50' + */ +void DialogManager::displayIntroFrame2() { _vm->_crep = _vm->animof(1, 1); _vm->pictout(kAdrAni, _vm->_crep, 63, 12); _vm->_crep = _vm->animof(2, 1); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 35c3c34cac..af667e40c5 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -54,10 +54,10 @@ public: void setParent(MortevielleEngine *vm); int show(const Common::String &msg, int n); void drawF3F8(); - void checkForF8(int SpeechNum, bool drawAni50Fl); + void checkForF8(int SpeechNum, bool drawFrame2Fl); int waitForF3F8(); - void aff50(bool drawAni50Fl); - void ani50(); + void displayIntroScreen(bool drawFrame2Fl); + void displayIntroFrame2(); bool showKnowledgeCheck(); }; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8ed6751b50..3505205977 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -365,13 +365,13 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - _dialogManager.aff50(false); + _dialogManager.displayIntroScreen(false); _speechManager._mlec = 0; _dialogManager.checkForF8(142, false); if (shouldQuit()) return; - _dialogManager.ani50(); + _dialogManager.displayIntroFrame2(); _dialogManager.checkForF8(143, true); if (shouldQuit()) return; -- cgit v1.2.3 From 85d79d0af8bbdd55b0e6c7674cd260a384d408d7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 17 Jul 2013 20:36:15 +0200 Subject: MORTEVIELLE: Enlarge F3/F8 dialog --- engines/mortevielle/dialogs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 1e82863237..d2f9274d25 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -415,7 +415,7 @@ void DialogManager::drawF3F8() { int f8Width = _vm->_screenSurface.getStringWidth(f8); // Write out the bounding box - _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); + _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); } /** -- cgit v1.2.3 From 09ccb836a6c5b690e8c96fc1026def119dd75c5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 17 Jul 2013 20:40:42 +0200 Subject: MORTEVIELLE: Enlarge box around screens in order to avoid to display a line of the picture below the border --- engines/mortevielle/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 78a4db8ad2..cc75f2ae7b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -388,7 +388,7 @@ void MortevielleEngine::setTextColor(int col) { */ void MortevielleEngine::prepareScreenType1() { // Large drawing - _screenSurface.drawBox(0, 11, 512, 163, 15); + _screenSurface.drawBox(0, 11, 512, 164, 15); } /** -- cgit v1.2.3 From f3a90ab1904c68cabb4c8f902b3adfcfb10479db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 18 Jul 2013 20:24:51 +0200 Subject: MORTEVIELLE: Modify some more boxes --- engines/mortevielle/utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index cc75f2ae7b..6469939f17 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1698,11 +1698,11 @@ void MortevielleEngine::clearDescriptionBar() { _mouse.hideMouse(); if (_largestClearScreen) { _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - _screenSurface.drawBox(0, 175, 634, 24, 15); + _screenSurface.drawBox(0, 176, 634, 23, 15); _largestClearScreen = false; } else { _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - _screenSurface.drawBox(0, 175, 634, 15, 15); + _screenSurface.drawBox(0, 176, 634, 14, 15); } _mouse.showMouse(); } @@ -2986,7 +2986,7 @@ void MortevielleEngine::drawPicture() { _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (_caff > 69) { draw(kAdrDes, 112, 48); // Heads - _screenSurface.drawBox(222, 47, 155, 91, 15); + _screenSurface.drawBox(222, 47, 155, 92, 15); } else { draw(kAdrDes, 0, 12); prepareScreenType1(); -- cgit v1.2.3 From 747d8f3047ba4520766c28c88a196b0fdcac6371 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 10:41:09 +0200 Subject: MORTEVIELLE: Constify an array in actions, reduce the scope of some variables --- engines/mortevielle/actions.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 38cbb30927..c3b82b795e 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -386,8 +386,6 @@ void MortevielleEngine::fctSelfRead() { * @remarks Originally called 'tregarder' */ void MortevielleEngine::fctLook() { - int cx; - if (_caff > 99) { _crep = 103; return; @@ -433,7 +431,7 @@ void MortevielleEngine::fctLook() { } return; } - cx = _coreVar._currPlace; + int cx = _coreVar._currPlace; if (_coreVar._currPlace == CHAPEL) cx = 17; if ((_coreVar._currPlace > MANOR_FRONT) && (_coreVar._currPlace < DOOR)) @@ -475,7 +473,7 @@ void MortevielleEngine::fctSelftLook() { * @remarks Originally called 'tfouiller' */ void MortevielleEngine::fctSearch() { - const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; + static const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; if (_caff > 99) { getSearchDescription(_caff); @@ -1188,7 +1186,7 @@ void MortevielleEngine::fctEnter() { * @remarks Originally called 'tdormir' */ void MortevielleEngine::fctSleep() { - int z, j, h, m; + int j, h, m; if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { _crep = 148; @@ -1212,7 +1210,7 @@ void MortevielleEngine::fctSleep() { do { if (h < 8) { _coreVar._faithScore -= (_coreVar._faithScore / 20); - z = (7 - h) * 2; + int z = (7 - h) * 2; if (m == 30) --z; _currentHourCount += z; @@ -1343,7 +1341,6 @@ void MortevielleEngine::fctDiscuss() { bool questionAsked[47]; int cy, cx; int x, y; -// int c; Common::String lib[47]; int choice; -- cgit v1.2.3 From 5924230634710250152014fd9dff10ddfcd90d2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 10:59:20 +0200 Subject: MORTEVIELLE: Replace some British words by US ones --- engines/mortevielle/graphics.cpp | 12 ++++++------ engines/mortevielle/graphics.h | 2 +- engines/mortevielle/mortevielle.cpp | 12 ++++++------ engines/mortevielle/mortevielle.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index ff6014585c..d47b6b5a23 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -40,7 +40,7 @@ namespace Mortevielle { *-------------------------------------------------------------------------*/ /** - * Set palette entries from the 64 colour available EGA palette + * Set palette entries from the 64 color available EGA palette */ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { assert((idx + size) <= 16); @@ -55,7 +55,7 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { *p++ = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55; } - // Loop through setting palette colours based on the passed indexes + // Loop through setting palette colors based on the passed indexes for (; size > 0; --size, ++idx) { int palIndex = palette[idx]; assert(palIndex < 64); @@ -416,7 +416,7 @@ void GfxSurface::decode(const byte *pSrc) { entryIndex + 1, _xp, _yp, _width, _height, decomIndex); } - // At this point, the outputBuffer has the data for the image. Initialise the surface + // At this point, the outputBuffer has the data for the image. Initialize the surface // with the calculated size, and copy the lines to the surface create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); @@ -1033,16 +1033,16 @@ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { } /** - * Fills an area with the specified colour + * Fills an area with the specified color * @remarks Because the ScummVM surface is using a double height 640x400 surface to * simulate the original 640x400 surface, all Y values have to be doubled */ -void ScreenSurface::fillRect(int colour, const Common::Rect &bounds) { +void ScreenSurface::fillRect(int color, const Common::Rect &bounds) { Graphics::Surface destSurface = lockArea(Common::Rect(bounds.left, bounds.top * 2, bounds.right, bounds.bottom * 2)); // Fill the area - destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), colour); + destSurface.fillRect(Common::Rect(0, 0, destSurface.w, destSurface.h), color); } /** diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 3a54f0c434..654814667f 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -100,7 +100,7 @@ public: void copyFrom(Graphics::Surface &src, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); - void fillRect(int colour, const Common::Rect &bounds); + void fillRect(int color, const Common::Rect &bounds); void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void drawString(const Common::String &l, int command); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3505205977..7829fabb5e 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -160,10 +160,10 @@ Common::String MortevielleEngine::generateSaveFilename(const Common::String &tar } /** - * Initialise the game state + * Initialize the game state */ -Common::ErrorCode MortevielleEngine::initialise() { - // Initialise graphics mode +Common::ErrorCode MortevielleEngine::initialize() { + // Initialize graphics mode initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); // Set debug channels @@ -329,8 +329,8 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp /*-------------------------------------------------------------------------*/ Common::Error MortevielleEngine::run() { - // Initialise the game - Common::ErrorCode err = initialise(); + // Initialize the game + Common::ErrorCode err = initialize(); if (err != Common::kNoError) return err; @@ -353,7 +353,7 @@ Common::Error MortevielleEngine::run() { // Run the main game loop mainGame(); - // Cleanup (allocated in initialise()) + // Cleanup (allocated in initialize()) _screenSurface.free(); free(_speechManager._cfiphBuffer); free(_cfiecBuffer); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 5255865cc5..18cf274283 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -284,7 +284,7 @@ private: uint16 _dialogIndexArray[kMaxDialogIndex + 1]; Hint _dialogHintArray[kMaxDialogHint + 1]; - Common::ErrorCode initialise(); + Common::ErrorCode initialize(); Common::ErrorCode loadMortDat(); void readStaticStrings(Common::File &f, int dataSize, DataType dataType); void loadFont(Common::File &f); -- cgit v1.2.3 From eb0de360853a7c7353133ecb7f88b2839a0ee188 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 11:21:05 +0200 Subject: MORTEVIELLE: Constify an array in graphics, reduce the scope of some variables --- engines/mortevielle/graphics.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index d47b6b5a23..c6356f48db 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -69,7 +69,7 @@ void PaletteManager::setPalette(const int *palette, uint idx, uint size) { * Set the default EGA palette */ void PaletteManager::setDefaultPalette() { - int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63 }; + const int defaultPalette[16] = { 0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63 }; setPalette(defaultPalette, 0, 16); } @@ -1072,21 +1072,20 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { * @remarks Originally called 'writeg' */ void ScreenSurface::drawString(const Common::String &l, int command) { - int i, x; - Common::Point pt; - int cecr = 0; - if (l == "") return; _vm->_mouse.hideMouse(); - pt = _textPos; + Common::Point pt = _textPos; + int i; if (_vm->_resolutionScaler == 2) i = 6; else i = 10; - x = pt.x + i * l.size(); + + int x = pt.x + i * l.size(); + int cecr = 0; switch (command) { case 1: -- cgit v1.2.3 From df7d181a6070b0400c38676514a43fbcfcfb0b8f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 11:24:42 +0200 Subject: MORTEVIELLE: Fix formatting glitch --- engines/mortevielle/graphics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 654814667f..fe8b365bfa 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -48,7 +48,7 @@ public: #define FONT_HEIGHT 6 #define FONT_NUM_CHARS 121 -class GfxSurface: public Graphics::Surface { +class GfxSurface : public Graphics::Surface { private: int _xp, _yp; int _xSize, _ySize; -- cgit v1.2.3 From 37a115e60b281dffa272f19060c6747c4af79ad9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 11:31:19 +0200 Subject: MORTEVIELLE: Use width and height provided by Graphics::Surface --- engines/mortevielle/graphics.cpp | 14 +++++++------- engines/mortevielle/graphics.h | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index c6356f48db..0ac43a65da 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -86,7 +86,7 @@ void PaletteManager::setDefaultPalette() { #define BUFFER_SIZE 40000 void GfxSurface::decode(const byte *pSrc) { - _width = _height = 0; + w = h = 0; // If no transparency, use invalid (for EGA) palette index of 16. Otherwise get index to use _transparency = (*pSrc == 0) ? 16 : *(pSrc + 2); bool offsetFlag = *pSrc++ == 0; @@ -413,27 +413,27 @@ void GfxSurface::decode(const byte *pSrc) { pSrc = pSrcStart; debugC(2, kMortevielleGraphics, "Decoding image block %d position %d,%d size %d,%d method %d", - entryIndex + 1, _xp, _yp, _width, _height, decomIndex); + entryIndex + 1, _xp, _yp, w, h, decomIndex); } // At this point, the outputBuffer has the data for the image. Initialize the surface // with the calculated size, and copy the lines to the surface - create(_width, _height, Graphics::PixelFormat::createFormatCLUT8()); + create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - for (int yCtr = 0; yCtr < _height; ++yCtr) { + for (int yCtr = 0; yCtr < h; ++yCtr) { const byte *copySrc = &outputBuffer[yCtr * DEFAULT_WIDTH]; byte *copyDest = (byte *)getBasePtr(0, yCtr); - Common::copy(copySrc, copySrc + _width, copyDest); + Common::copy(copySrc, copySrc + w, copyDest); } } void GfxSurface::majTtxTty() { if (!_yp) - _width += _xSize; + w += _xSize; if (!_xp) - _height += _ySize; + h += _ySize; } /** diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index fe8b365bfa..e31f5da29a 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -56,7 +56,6 @@ private: bool _nibbleFlag; int _thickness; int _yInc, _yEnd, _xInc, _xEnd; - int _width, _height; byte nextNibble(const byte *&pSrc); byte nextByte(const byte *&pSrc, const byte *&pLookup); -- cgit v1.2.3 From bb6db039d9258a2fdc30e5a6d185ae436c1e3d77 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 11:33:42 +0200 Subject: MORTEVIELLE: Rename menu constant --- engines/mortevielle/menu.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6035c3ae11..c856f0edc2 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -35,7 +35,7 @@ namespace Mortevielle { -const byte _menuConstants[8][4] = { +const byte menuConstants[8][4] = { { 7, 37, 23, 8}, {19, 33, 23, 7}, {31, 89, 10, 21}, @@ -235,7 +235,7 @@ void Menu::invert(int indx) { int menuIndex = lo(_msg4); - _vm->_screenSurface.putxy(_menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + _vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; switch (_msg3) { @@ -282,9 +282,9 @@ void Menu::invert(int indx) { void Menu::util(Common::Point pos) { - int ymx = (_menuConstants[_msg3 - 1][3] << 3) + 16; - int dxcar = _menuConstants[_msg3 - 1][2]; - int xmn = (_menuConstants[_msg3 - 1][0] << 2) * _vm->_resolutionScaler; + int ymx = (menuConstants[_msg3 - 1][3] << 3) + 16; + int dxcar = menuConstants[_msg3 - 1][2]; + int xmn = (menuConstants[_msg3 - 1][0] << 2) * _vm->_resolutionScaler; int ix; if (_vm->_resolutionScaler == 1) @@ -316,22 +316,22 @@ void Menu::menuDown(int ii) { _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); // Draw the menu - xco = _menuConstants[ii - 1][0]; - lignNumb = _menuConstants[ii - 1][3]; + xco = menuConstants[ii - 1][0]; + lignNumb = menuConstants[ii - 1][3]; _vm->_mouse.hideMouse(); xco = xco << 3; if (_vm->_resolutionScaler == 1) cx = 10; else cx = 6; - xcc = xco + (_menuConstants[ii - 1][2] * cx) + 6; + xcc = xco + (menuConstants[ii - 1][2] * cx) + 6; if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version xcc = 435; - _vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (_menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (_menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (_menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (_menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (menuConstants[ii - 1][1] << 1))); _vm->_screenSurface.putxy(xco, 16); cx = 0; do { -- cgit v1.2.3 From 67f900ed33bc56d586e3af54740060eab68273f9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 11:51:10 +0200 Subject: MORTEVIELLE: Reorder includes --- engines/mortevielle/actions.cpp | 5 +++-- engines/mortevielle/debugger.cpp | 2 +- engines/mortevielle/dialogs.cpp | 6 ++++-- engines/mortevielle/graphics.cpp | 7 ++++--- engines/mortevielle/menu.cpp | 10 ++++++---- engines/mortevielle/mortevielle.cpp | 16 +++++++++------- engines/mortevielle/mouse.cpp | 5 +++-- engines/mortevielle/outtext.cpp | 7 ++++--- engines/mortevielle/saveload.cpp | 7 ++++--- engines/mortevielle/sound.cpp | 5 +++-- engines/mortevielle/speech.cpp | 8 +++++--- engines/mortevielle/speech.h | 3 ++- engines/mortevielle/utils.cpp | 7 ++++--- 13 files changed, 52 insertions(+), 36 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index c3b82b795e..4fea2638f0 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -25,14 +25,15 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/scummsys.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" -#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/speech.h" +#include "common/scummsys.h" + namespace Mortevielle { /** diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 9c24954f83..042eb0e224 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -20,8 +20,8 @@ * */ -#include "mortevielle/debugger.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/debugger.h" namespace Mortevielle { diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index d2f9274d25..2c644bc459 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -25,13 +25,15 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/str.h" -#include "mortevielle/dialogs.h" #include "mortevielle/mortevielle.h" + +#include "mortevielle/dialogs.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/speech.h" +#include "common/str.h" + namespace Mortevielle { /** diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 0ac43a65da..1ced3003e2 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -25,12 +25,13 @@ * Copyright (c) 1987-1989 Lankhor */ +#include "mortevielle/mortevielle.h" +#include "mortevielle/graphics.h" +#include "mortevielle/mouse.h" + #include "common/endian.h" #include "common/system.h" #include "graphics/palette.h" -#include "mortevielle/graphics.h" -#include "mortevielle/mortevielle.h" -#include "mortevielle/mouse.h" namespace Mortevielle { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index c856f0edc2..a28965523a 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -25,14 +25,16 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/scummsys.h" -#include "common/str.h" -#include "common/textconsole.h" -#include "mortevielle/menu.h" #include "mortevielle/mortevielle.h" + +#include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" +#include "common/scummsys.h" +#include "common/str.h" +#include "common/textconsole.h" + namespace Mortevielle { const byte menuConstants[8][4] = { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7829fabb5e..418b0a079f 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -25,14 +25,8 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/system.h" -#include "common/config-manager.h" -#include "common/debug-channels.h" -#include "engines/util.h" -#include "engines/engine.h" -#include "graphics/palette.h" -#include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" + #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mouse.h" @@ -40,6 +34,14 @@ #include "mortevielle/saveload.h" #include "mortevielle/outtext.h" +#include "common/system.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "engines/util.h" +#include "engines/engine.h" +#include "graphics/palette.h" +#include "graphics/pixelformat.h" + namespace Mortevielle { MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 4d3d8bb2ab..139ccbef6c 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -25,10 +25,11 @@ * Copyright (c) 1987-1989 Lankhor */ +#include "mortevielle/mortevielle.h" +#include "mortevielle/mouse.h" + #include "common/endian.h" #include "common/rect.h" -#include "mortevielle/mouse.h" -#include "mortevielle/mortevielle.h" namespace Mortevielle { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 7778eb3484..81760d1afa 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -25,12 +25,13 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/file.h" -#include "common/str.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/graphics.h" -#include "mortevielle/mortevielle.h" + +#include "common/file.h" +#include "common/str.h" namespace Mortevielle { diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 382fd14277..ff3bee5c06 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -25,13 +25,14 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/file.h" -#include "common/system.h" -#include "mortevielle/dialogs.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/dialogs.h" #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" +#include "common/file.h" +#include "common/system.h" + namespace Mortevielle { static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index de5c4feba6..d54ab71e50 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -25,9 +25,10 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/scummsys.h" -#include "mortevielle/sound.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/sound.h" + +#include "common/scummsys.h" namespace Mortevielle { diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 1fe130af83..aea49d8df1 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -25,11 +25,13 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/endian.h" -#include "common/file.h" +#include "mortevielle/mortevielle.h" + #include "mortevielle/speech.h" #include "mortevielle/sound.h" -#include "mortevielle/mortevielle.h" + +#include "common/endian.h" +#include "common/file.h" namespace Mortevielle { diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 73f8e16067..7f779a86c3 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -28,9 +28,10 @@ #ifndef MORTEVIELLE_SPEECH_H #define MORTEVIELLE_SPEECH_H -#include "common/scummsys.h" #include "mortevielle/sound.h" +#include "common/scummsys.h" + namespace Mortevielle { const int kAdrNoise = 0x5cb0;/*2C00;*/ diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 6469939f17..ca6bdcdfc6 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -25,16 +25,17 @@ * Copyright (c) 1987-1989 Lankhor */ -#include "common/scummsys.h" -#include "graphics/cursorman.h" +#include "mortevielle/mortevielle.h" #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" -#include "mortevielle/mortevielle.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" #include "mortevielle/speech.h" +#include "common/scummsys.h" +#include "graphics/cursorman.h" + namespace Mortevielle { /** -- cgit v1.2.3 From 220088d6e881988d7346adff02ff7d39e0ea00de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 14:03:53 +0200 Subject: MORTEVIELLE: Fix define name in Mortevielle.h --- engines/mortevielle/mortevielle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 18cf274283..eb245c60ec 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -25,8 +25,8 @@ * Copyright (c) 1987-1989 Lankhor */ -#ifndef MORTEVIELLE_H -#define MORTEVIELLE_H +#ifndef MORTEVIELLE_MORTEVIELLE_H +#define MORTEVIELLE_MORTEVIELLE_H #include "common/events.h" #include "common/file.h" -- cgit v1.2.3 From 388b4a7b3390282b118a8b0720ae3a07c91f1934 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 14:08:17 +0200 Subject: TOOLS: Janitorial: remove trailing spaces in extract_mort --- devtools/extract_mort/extract_mort.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index 0164030769..fd6d8848af 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -40,7 +40,7 @@ #include "common/endian.h" enum AccessMode { - kFileReadMode = 1, + kFileReadMode = 1, kFileWriteMode = 2 }; @@ -108,7 +108,7 @@ public: fseek (f, 0, SEEK_END); int end = ftell (f); fseek (f, pos, SEEK_SET); - + return end; } }; @@ -228,7 +228,7 @@ static void addCompressedValue(int oct, int &indis, int &point, uint16 *strData) if (point < 5) { // Overlapping into next word ++indis; - + // Get the bits that fall into the next word and set it int remainder = oct & ((1 << (5 - point)) - 1); strData[indis] |= remainder << (16 - (5 - point)); -- cgit v1.2.3 From ed69aaf9991a63ad34085c67a8f5a04d968871ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 14:22:28 +0200 Subject: MORTEVIELLE: Constify 3 more arrays --- engines/mortevielle/outtext.cpp | 4 ++-- engines/mortevielle/utils.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 81760d1afa..6bb775a423 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -189,8 +189,8 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt void TextHandler::taffich() { static const byte _rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; - byte tran1[] = { 121, 121, 138, 139, 120 }; - byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; + static const byte tran1[] = { 121, 121, 138, 139, 120 }; + static const byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; int cx, handle, npal; int32 lgt; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index ca6bdcdfc6..2c1a501b19 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -182,7 +182,7 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { } -static byte CURSOR_ARROW_DATA[16 * 16] = { +static const byte CURSOR_ARROW_DATA[16 * 16] = { 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -- cgit v1.2.3 From 72914aafabf88cd7b56ff2a10036e470a8d2f05b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 17:29:33 +0200 Subject: MORTEVIELLE: Simplify the way skip info is computed, as pointed by LordHoto --- engines/mortevielle/outtext.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6bb775a423..d9d47a9fd3 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -133,11 +133,9 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt if (!f.open(filename)) error("Missing file %s", filename.c_str()); - int skipBlock = 0; - while (skipSize > 127) { - ++skipBlock; - skipSize -= 128; - } + int skipBlock = skipSize / 128; + skipSize %= 128; + if (skipBlock != 0) f.seek(skipBlock * 0x80); -- cgit v1.2.3 From 3d64ccac9c4cfbf477eb3e03273faa255d0bb6d3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 17:43:55 +0200 Subject: MORTEVIELLE: Fix glitch detected by criezy --- devtools/extract_mort/extract_mort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index fd6d8848af..159309c0fa 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -322,7 +322,7 @@ static void export_strings(const char *textFilename) { do { extractCharacter(ch, indis, point, endFlag, strData); buffer[charIndex++] = ch; - if (ch == BUFFER_SIZE) { + if (charIndex == BUFFER_SIZE) { printf("Extracted string exceeded allowed buffer size.\n"); exit(1); } -- cgit v1.2.3 From 4c3b2d3f544f22c6f2404d5a25cfc23dee1d75af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 17:54:09 +0200 Subject: MORTEVIELLE: Add a safeguard in Copy() --- engines/mortevielle/utils.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 2c1a501b19..28f3e4f629 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2487,6 +2487,8 @@ void MortevielleEngine::palette(int v1) { */ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) { + assert(idx + size < s.size()); + // Copy the substring into a temporary buffer char *tmp = new char[size + 1]; strncpy(tmp, s.c_str() + idx - 1, size); -- cgit v1.2.3 From 0e8491b162b9badbbaa72eaafebbee7cf95e732f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 19 Jul 2013 18:00:15 +0200 Subject: MORTEVIELLE: Fix glitch in constant name. Thanks to LordHoto for pointing it out --- engines/mortevielle/speech.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 7f779a86c3..b3d7c15203 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -43,7 +43,7 @@ const int kAdrWord = 0x4000; const int kOffsetB1 = 6; const int kOffsetB3 = 6; -const float freq0 = 1.19318e6; +const float kfreq0 = 1.19318e6; const int kNullValue = 255; const int kTempoMusic = 71; const int kTempoNoise = 78; -- cgit v1.2.3 From 71ed35502e218a11c16af624ef5a0a77296184cf Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 19 Jul 2013 20:49:15 +0200 Subject: TEENAGENT: Add missing "break"s to switch cases I think this is the correct thing to do, and that it won't have any noticeable effect whatsoever. Cases 29 and 30 happen in the first half of the game, in the cantine, while case 42 happens in the second half of the game. By the time you reach the point where case 42 does something, I don't think it's possible to get back to cases 29 and 30, so when case 29 falls through neither 30 nor 42 will do anything. CID 1003730, 1003731 --- engines/teenagent/resources.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp index 442d0abf16..399baf469f 100644 --- a/engines/teenagent/resources.cpp +++ b/engines/teenagent/resources.cpp @@ -206,16 +206,19 @@ Common::SeekableReadStream *Resources::loadLan000(uint32 id) const { if (dseg.get_byte(dsAddr_birdOnBarRadioAntennaFlag) == 1) { return lan500.getStream(380); } + break; case 30: if (dseg.get_byte(dsAddr_birdOnBarRadioAntennaFlag) == 1) { return lan500.getStream(381); } + break; case 42: if (dseg.get_byte(dsAddr_johnNotyOutsideMansionDoorFlag) == 1) { return lan500.getStream(400); } + break; } return lan000.getStream(id); } -- cgit v1.2.3 From c44d6ae60cfd1d06d2431918fb74c9ba1bfeb32e Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 19 Jul 2013 21:10:50 +0200 Subject: TONY: Fix parameter to RMGfxSourceBuffer8RLEWordAA::init() The method it is meant to override uses "const byte *buf" so this one should too. I don't know if/when it's called, but fuzzie tells me it should be a harmless change. Hopefully fixes CID 1003892. --- engines/tony/gfxcore.cpp | 3 ++- engines/tony/gfxcore.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index dc82c78ee5..d5002628e9 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -1865,7 +1865,8 @@ void RMGfxSourceBuffer8RLEWordAA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RM CORO_END_CODE; } -int RMGfxSourceBuffer8RLEWordAA::init(byte *buf, int dimx, int dimy, bool bLoadPalette) { +int RMGfxSourceBuffer8RLEWordAA::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) { + debug("Hello!!!"); return RMGfxSourceBuffer8RLE::init(buf, dimx, dimy, bLoadPalette); } diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h index 1bacf7e5a9..2548968e81 100644 --- a/engines/tony/gfxcore.h +++ b/engines/tony/gfxcore.h @@ -408,7 +408,7 @@ public: // Overloaded initialization methods virtual void init(Common::ReadStream &ds, int dimx, int dimy, bool bLoadPalette = false); - virtual int init(byte *buf, int dimx, int dimy, bool bLoadPalette = false); + virtual int init(const byte *buf, int dimx, int dimy, bool bLoadPalette = false); virtual ~RMGfxSourceBuffer8RLEWordAA(); }; -- cgit v1.2.3 From da17953c1298b8b6db86af42dd644bff01a5134c Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 19 Jul 2013 21:19:03 +0200 Subject: TONY: Remove debug message from last commit. Oops. --- engines/tony/gfxcore.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index d5002628e9..410f9b8971 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -1866,7 +1866,6 @@ void RMGfxSourceBuffer8RLEWordAA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RM } int RMGfxSourceBuffer8RLEWordAA::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) { - debug("Hello!!!"); return RMGfxSourceBuffer8RLE::init(buf, dimx, dimy, bLoadPalette); } -- cgit v1.2.3 From 06cc30cf6c02fafc7f6eedeba63b7d8e2f48f944 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 19 Jul 2013 21:22:36 +0200 Subject: SCI: Add FIXME --- engines/sci/sound/midiparser_sci.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 6a78f494c7..9653d9ccff 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -491,6 +491,10 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { // though, so ignoring these signals in SCI0 games will result // in glitches (e.g. the intro of LB1 Amiga gets stuck - bug // #3297883). Refer to MusicEntry::setSignal() in sound/music.cpp. + // FIXME: SSCI doesn't start playing at the very beginning + // of the stream, but at a fixed location a few commands later. + // That is probably why this signal isn't triggered + // immediately there. if (_soundVersion <= SCI_VERSION_0_LATE || _position._playTick || info.delta) { _signalSet = true; -- cgit v1.2.3 From a8c40e3c03dbfe70f96def059caf4f58c2f611e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 19 Jul 2013 22:51:25 -0400 Subject: MORTEVIELLE: Removed redundant mouse drawing code --- engines/mortevielle/mouse.cpp | 163 ++---------------------------------------- 1 file changed, 4 insertions(+), 159 deletions(-) diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 139ccbef6c..dfc9ccd706 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -45,174 +45,19 @@ void MouseHandler::initMouse() { } /** - * Hide the mouse + * Backs up the area behind where the mouse cursor is to be drawn * @remarks Originally called 'hide_mouse' */ void MouseHandler::hideMouse() { - --_counter; - if (_counter == 0) { - int j = 0; - switch (_vm->_currGraphicalDevice) { - case MODE_CGA: { - int k = 0; - j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); - do { - WRITE_LE_UINT16(&_vm->_mem[0xb000 * 16 + j], s_s[0][k]); - WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j + 2], s_s[1][k]); - WRITE_LE_UINT16(&_vm->_mem[0xba00 * 16 + j], s_s[2][k]); - WRITE_LE_UINT16(&_vm->_mem[0xba00 * 16 + j + 2], s_s[3][k]); - j += 80; - ++k; - } while (k < 5); - } - break; - case MODE_AMSTRAD1512: { - bool imp = odd(_pos.y); - for (int i = 0; i <= 3; ++i) { - int k = 0; - j = 0; - do { - if (imp) { - WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j], s_s[i][k]); - j += 80 - 0x2000; - } else { - WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + j], s_s[i][k]); - j += 0x2000; - } - imp = !imp; - ++k; - } while (k < 8); - } - break; - } - case MODE_EGA: { - int i = 0; - do { - int k = 0; - j = 0; - do { - // Useless ? - // ps = mem[0xa000 * 16 + j]; - _vm->_mem[0xa000 * 16 + j] = lo(s_s[i][k]); - - // Useless ?? - // ps = mem[0xa000 * 16 + j + 1]; - _vm->_mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]); - j += 80; - ++k; - } while (k < 8); - ++i; - } while (i != 4); - } - break; - case MODE_HERCULES: - j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); - for (int i = 0; i <= 5; ++i) { - for (int k = 0; k <= 3; ++k) - WRITE_LE_UINT16(&_vm->_mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]); - j += 80; - } - break; - case MODE_TANDY: { - j = ((uint)_pos.y >> 2) * 160 + ((uint)_pos.x >> 1); - int k = 0; - do { - for (int i = 0; i <= 3; ++i) { - WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]); - WRITE_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]); - } - j += 160; - ++k; - } while (k != 3); - } - break; - default: - break; - } // case Gd - } + // No implementation needed in ScummVM } /** - * Show mouse + * Draws the mouse cursor * @remarks Originally called 'show_mouse' */ void MouseHandler::showMouse() { - int k, l; - - ++_counter; - if (_counter != 1) - return; - int j = 0; - int i = _pos.x & 7; - switch (_vm->_currGraphicalDevice) { - case MODE_CGA: - k = 0; - j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 2); - do { - s_s[0][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); - s_s[1][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j + 2]); - s_s[2][k] = READ_LE_UINT16(&_vm->_mem[0xba00 * 16 + j]); - s_s[3][k] = READ_LE_UINT16(&_vm->_mem[0xba00 * 16 + j + 2]); - j += 80; - ++k; - } while (k < 5); - break; - case MODE_AMSTRAD1512: { - bool imp = odd(_pos.y); - for (i = 0; i <= 3; ++i) { - j = 0; - imp = odd(_pos.y); - k = 0; - do { - if (imp) { - s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); - j += 80 - 0x2000; - } else { - s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + j]); - j += 0x2000; - } - imp = !imp; - ++k; - } while (k < 8); - } - break; - } - case MODE_EGA: - l = 0; - do { - k = 0; - j = 0; - do { - s_s[l][k] = _vm->_mem[0xa000 * 16 + j] + (_vm->_mem[(0xa000 * 16) + j + 1] << 8); - j += 80; - ++k; - } while (k < 8); - ++l; - } while (l != 4); - break; - case MODE_HERCULES: - j = ((uint)_pos.y >> 1) * 80 + ((uint)_pos.x >> 3); - for (i = 0; i <= 5; ++i) { - for (k = 0; k <= 3; ++k) - s_s[i][k] = READ_LE_UINT16(&_vm->_mem[0xb000 * 16 + k * 0x200 + j]); - j += 80; - } - break; - case MODE_TANDY: - j = ((uint)_pos.y >> 2) * 160 + ((uint)_pos.x >> 1); - k = 0; - do { - for (i = 0; i <= 3; ++i) { - s_s[k][i + (k << 2)] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j]); - s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&_vm->_mem[0xb800 * 16 + 0x200 * i + j + 2]); - } - j += 160; - ++k; - } while (k != 3); - break; - default: - break; - } // case Gd + // ScummVM implementation uses CursorMan for drawing the cursor } /** -- cgit v1.2.3 From a979ec6c970360a9b9b390c58847fe3c78c01e47 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 19 Jul 2013 23:10:25 -0400 Subject: LURE: Added explicit comment to switch block fall-through --- engines/lure/hotspots.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 7fab4521f7..efd4051eba 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -4006,6 +4006,7 @@ void HotspotTickHandlers::rackSerfAnimHandler(Hotspot &h) { h.setActionCtr(4); h.setLayer(2); + // Deliberate fall-through case 4: if (HotspotScript::execute(&h)) { h.setLayer(255); -- cgit v1.2.3 From a790fe0e80b6b0b8c45c5d37de2eb6faf221444c Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 20 Jul 2013 05:32:11 +0200 Subject: TINSEL: Remove self-assignment (CID 1003626) However, dreammaster has confirmed this line was in the original so I'm leaving it commented-out in case there is a genuine bug still lurking there. --- engines/tinsel/rince.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp index 3e6334f583..49666c13ca 100644 --- a/engines/tinsel/rince.cpp +++ b/engines/tinsel/rince.cpp @@ -808,7 +808,8 @@ void T2MoverProcess(CORO_PARAM, const void *param) { PokeInPalette(pmi); pMover->actorObj = MultiInitObject(pmi); - pMover->actorID = pMover->actorID; + // FIXME: This is what the original did. A bug, perhaps? + // pMover->actorID = pMover->actorID; pMover->bActive = true; // add it to display list -- cgit v1.2.3 From fadedd2eacf15110dd9f461d9e475374bb9e8a31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 10:17:36 +0200 Subject: MORTEVIELLE: Little refactoring of decryptNextChar() --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index eb245c60ec..e941a866fc 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -432,7 +432,7 @@ private: void putInHand(int &objId); void prepareDisplayText(); - void cinq_huit(char &c, int &idx, byte &pt, bool &the_end); + bool decryptNextChar(char &c, int &idx, byte &pt); void copcha(); void adzon(); void phaz(int &rand, int &p, int cf); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 28f3e4f629..994376b1dc 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1846,7 +1846,15 @@ const byte cryptoArr31De[32]= { const byte *cryptoArrDefault, *cryptoArr30, *cryptoArr31; uint16 ctrlChar; -void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { +/** + * Decrypt the next character + * @param c OUT, next decrypted char + * @param idx IN/OUT, current buffer index + * @param pt IN/OUT, current encryption point + * @return a boolean specifying if a stop character has been encountered + * @remarks Originally called 'cinq_huit' + */ +bool MortevielleEngine::decryptNextChar(char &c, int &idx, byte &pt) { uint16 oct, ocd; /* 5-8 */ @@ -1864,7 +1872,7 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { if (oct == ctrlChar) { c = '$'; - the_end = true; + return true; } else if (oct == 30 || oct == 31) { ocd = _dialogIndexArray[idx]; ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt); @@ -1884,12 +1892,13 @@ void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) { c = chr(cryptoArr31[ocd]); if (c == '\0') { - the_end = true; c = '#'; + return true; } } else { c = chr(cryptoArrDefault[oct]); } + return false; } /** @@ -1910,7 +1919,7 @@ Common::String MortevielleEngine::getString(int num) { bool endFl = false; char let; do { - cinq_huit(let, hint, point, endFl); + endFl = decryptNextChar(let, hint, point); wrkStr += let; ++length; } while (!endFl); -- cgit v1.2.3 From 716b28b7ea307dec85e48d118e56a56b7555bfc7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 10:20:19 +0200 Subject: MORTEVIELLE: Reorder some functions in mortevielle.h --- engines/mortevielle/mortevielle.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e941a866fc..0f3d724da3 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -418,21 +418,20 @@ private: void endGame(); void askRestart(); void handleOpcode(); + void prepareDisplayText(); + bool decryptNextChar(char &c, int &idx, byte &pt); void displayStatusArrow(); void displayStatusInDescriptionBar(char stat); - void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); + void displayTextInVerbBar(Common::String text); void mapMessageId(int &mesgId); void resetOpenObjects(); void setCoordinates(int sx); - void displayTextInVerbBar(Common::String text); void drawPicture(); void drawPictureWithText(); void addObjectToInventory(int objectId); void putInHand(int &objId); - void prepareDisplayText(); - bool decryptNextChar(char &c, int &idx, byte &pt); void copcha(); void adzon(); void phaz(int &rand, int &p, int cf); -- cgit v1.2.3 From d5b10f7dd405ecb9039e1d04a54bd935c1c44134 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 10:47:32 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 18 +++++++++--------- engines/mortevielle/graphics.cpp | 12 ++++++------ engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 10 +++++++--- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 4fea2638f0..71f0d8f647 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1386,9 +1386,9 @@ void MortevielleEngine::fctDiscuss() { if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) - writetp(lib[icm], 1); + displayQuestionText(lib[icm], 1); else - writetp(lib[icm], 0); + displayQuestionText(lib[icm], 0); } if (icm == 23) { @@ -1398,7 +1398,7 @@ void MortevielleEngine::fctDiscuss() { posY += 8; } _screenSurface.putxy(320, 176); - writetp(lib[46], 0); + displayQuestionText(lib[46], 0); char retKey = '\0'; bool click; do { @@ -1423,9 +1423,9 @@ void MortevielleEngine::fctDiscuss() { posX = 0; _screenSurface.putxy(posX, posY); if (questionAsked[choice]) - writetp(lib[choice], 0); + displayQuestionText(lib[choice], 0); else - writetp(lib[choice], 1); + displayQuestionText(lib[choice], 1); questionAsked[choice] = !questionAsked[choice]; choice = 0; } @@ -1442,9 +1442,9 @@ void MortevielleEngine::fctDiscuss() { posX = 0; _screenSurface.putxy(posX, posY); if (questionAsked[choice]) - writetp(lib[choice], 0); + displayQuestionText(lib[choice], 0); else - writetp(lib[choice], 1); + displayQuestionText(lib[choice], 1); questionAsked[choice] = ! questionAsked[choice]; } if ((_coreVar._availableQuestion[ix] == '*') || (ix == 46)) { @@ -1455,9 +1455,9 @@ void MortevielleEngine::fctDiscuss() { posX = 0; _screenSurface.putxy(posX, posY); if (questionAsked[ix]) - writetp(lib[ix], 0); + displayQuestionText(lib[ix], 0); else - writetp(lib[ix], 1); + displayQuestionText(lib[ix], 1); questionAsked[ix] = ! questionAsked[ix]; choice = ix; } else diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 1ced3003e2..e94e1ce7a3 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1086,24 +1086,24 @@ void ScreenSurface::drawString(const Common::String &l, int command) { i = 10; int x = pt.x + i * l.size(); - int cecr = 0; + int color = 0; switch (command) { case 1: case 3: { - cecr = 0; + color = 0; _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; case 4: - cecr = 0; + color = 0; break; case 5: - cecr = 15; + color = 15; break; case 0: case 2: { - cecr = 15; + color = 15; _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); } break; @@ -1114,7 +1114,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), cecr); + _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), color); pt.x += i; } _vm->_mouse.showMouse(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0f3d724da3..b990859ac5 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -422,6 +422,7 @@ private: bool decryptNextChar(char &c, int &idx, byte &pt); void displayStatusArrow(); void displayStatusInDescriptionBar(char stat); + void displayQuestionText(Common::String s, int cmd); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void displayTextInVerbBar(Common::String text); void mapMessageId(int &mesgId); @@ -435,7 +436,6 @@ private: void copcha(); void adzon(); void phaz(int &rand, int &p, int cf); - void writetp(Common::String s, int t); void premtet(); void ajchai(); void ecr2(Common::String text); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 994376b1dc..8e0e76f088 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2957,11 +2957,15 @@ int MortevielleEngine::getPresence(int roomId) { return retVal; } -void MortevielleEngine::writetp(Common::String s, int t) { +/** + * Display Question String + * @remarks Originally called 'writetp' + */ +void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { if (_resolutionScaler == 2) - _screenSurface.drawString(s, t); + _screenSurface.drawString(s, cmd); else - _screenSurface.drawString(copy(s, 1, 25), t); + _screenSurface.drawString(copy(s, 1, 25), cmd); } void MortevielleEngine::aniof(int ouf, int num) { -- cgit v1.2.3 From 7fbdf23dc812cfdc08cc9ef84675122847b91c44 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 10:51:42 +0200 Subject: MORTEVIELLE: Simplify drawString code --- engines/mortevielle/graphics.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e94e1ce7a3..cf15b07ccc 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1079,43 +1079,38 @@ void ScreenSurface::drawString(const Common::String &l, int command) { _vm->_mouse.hideMouse(); Common::Point pt = _textPos; - int i; + int charWidth; if (_vm->_resolutionScaler == 2) - i = 6; + charWidth = 6; else - i = 10; + charWidth = 10; - int x = pt.x + i * l.size(); + int x = pt.x + charWidth * l.size(); int color = 0; switch (command) { + case 0: + case 2: + color = 15; + _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + break; case 1: - case 3: { - color = 0; + case 3: _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); - } - break; - case 4: - color = 0; break; case 5: color = 15; break; - case 0: - case 2: { - color = 15; - _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); - } - break; default: + // Default: Color set to zero (already done) break; } pt.x += 1; pt.y += 1; - for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { + for (x = 1; (x <= l.size()) && (l[x - 1] != 0); ++x) { _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), color); - pt.x += i; + pt.x += charWidth; } _vm->_mouse.showMouse(); } -- cgit v1.2.3 From 8b14677f57b63a36701fa9841027c6f68d476ec0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 11:17:18 +0200 Subject: MORTEVIELLE: Get rid of magic value 0x7000 --- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/graphics.cpp | 4 ++-- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/outtext.cpp | 6 +++--- engines/mortevielle/utils.cpp | 24 ++++++++++++------------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 2c644bc459..d992fa0cce 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -465,7 +465,7 @@ void DialogManager::displayIntroScreen(bool drawFrame2Fl) { _vm->_caff = 50; _vm->_maff = 0; _vm->_text.taffich(); - _vm->draw(kAdrDes, 63, 12); + _vm->draw(kAdrPictureComp, 63, 12); if (drawFrame2Fl) displayIntroFrame2(); else diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index cf15b07ccc..d5036cb4d7 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -937,7 +937,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &_vm->_mem[0x7000 * 16 + 2]; + const byte *paletteMap = &_vm->_mem[kAdrPictureComp * 16 + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { @@ -1108,7 +1108,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; - for (x = 1; (x <= l.size()) && (l[x - 1] != 0); ++x) { + for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), color); pt.x += charWidth; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b990859ac5..d95f2dc6f6 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -63,6 +63,7 @@ namespace Mortevielle { * 7000:2 - 16 words representing palette map * 7000:4138 - width, height, x/y offset of decoded image */ +const int kAdrPictureComp = 0x7000; #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) @@ -114,7 +115,6 @@ const int kTime1 = 410; const int kTime2 = 250; const int kAcha = 492; -const int kAdrDes = 0x7000; const int kFleche = 1758; const int kAsoul = 154; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d9d47a9fd3..6e372508d7 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -150,7 +150,7 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[0x7000 * 16 + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; + _vm->_mem[(kAdrPictureComp * 16) + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; } /** @@ -288,7 +288,7 @@ void TextHandler::taffich() { loadDesFile(filename, lgt, handle); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&_vm->_mem[(0x7000 * 16) + ((i + 1) << 1)]); + int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + ((i + 1) << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -296,7 +296,7 @@ void TextHandler::taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - _vm->_mem[(0x7000 * 16) + 2 + (k << 1)] = _rang[i]; + _vm->_mem[(kAdrPictureComp * 16) + 2 + (k << 1)] = _rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 8e0e76f088..2a39e4b4f7 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1997,8 +1997,8 @@ void MortevielleEngine::setPal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - _mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x; - _mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y; + _mem[(kAdrPictureComp * 16) + (2 * i)] = _stdPal[n][i].x; + _mem[(kAdrPictureComp * 16) + (2 * i) + 1] = _stdPal[n][i].y; } break; case MODE_CGA: { @@ -2245,7 +2245,7 @@ void MortevielleEngine::showTitleScreen() { if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - draw(kAdrDes, 0, 0); + draw(kAdrPictureComp, 0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); @@ -2270,7 +2270,7 @@ void MortevielleEngine::draw(int ad, int x, int y) { void MortevielleEngine::drawRightFrame() { setPal(89); if (_currGraphicalDevice == MODE_HERCULES) { - _mem[0x7000 * 16 + 14] = 15; + _mem[(kAdrPictureComp * 16) + 14] = 15; } _mouse.hideMouse(); pictout(0x73a2, 0, 0, 0); @@ -2561,12 +2561,12 @@ void MortevielleEngine::pictout(int seg, int dep, int x, int y) { surface.decode(&_mem[seg * 16 + dep]); if (_currGraphicalDevice == MODE_HERCULES) { - _mem[0x7000 * 16 + 2] = 0; - _mem[0x7000 * 16 + 32] = 15; + _mem[(kAdrPictureComp * 16) + 2] = 0; + _mem[(kAdrPictureComp * 16) + 32] = 15; } - if ((_caff != 51) && (READ_LE_UINT16(&_mem[0x7000 * 16 + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&_mem[0x7000 * 16 + 0x4138], 0x100); + if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrPictureComp * 16) + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + 0x4138], 0x100); _screenSurface.drawPicture(surface, x, y); } @@ -2998,13 +2998,13 @@ void MortevielleEngine::aniof(int ouf, int num) { void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { - draw(kAdrDes, 60, 33); + draw(kAdrPictureComp, 60, 33); _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (_caff > 69) { - draw(kAdrDes, 112, 48); // Heads + draw(kAdrPictureComp, 112, 48); // Heads _screenSurface.drawBox(222, 47, 155, 92, 15); } else { - draw(kAdrDes, 0, 12); + draw(kAdrPictureComp, 0, 12); prepareScreenType1(); if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { @@ -3177,7 +3177,7 @@ void MortevielleEngine::mennor() { } void MortevielleEngine::premtet() { - draw(kAdrDes, 10, 80); + draw(kAdrPictureComp, 10, 80); _screenSurface.drawBox(18, 79, 155, 91, 15); } -- cgit v1.2.3 From 66de61e812b233f19b23f08af6600ba3b73fb323 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 11:20:51 +0200 Subject: MORTEVIELLE: Get rid of magic value 0x6000 --- engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/outtext.cpp | 8 ++++---- engines/mortevielle/utils.cpp | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index d95f2dc6f6..2d2f598548 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -63,6 +63,7 @@ namespace Mortevielle { * 7000:2 - 16 words representing palette map * 7000:4138 - width, height, x/y offset of decoded image */ +const int kAdrPictureDecomp = 0x6000; const int kAdrPictureComp = 0x7000; #define ord(v) ((int) v) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6e372508d7..0bb59a66e1 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -141,7 +141,7 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt int remainingSkipSize = abs(skipSize); int totalLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; + int memIndx = kAdrPictureDecomp * 16; while (totalLength > 0) { f.read(&_vm->_mem[memIndx], 128); totalLength -= 128; @@ -150,7 +150,7 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[(kAdrPictureComp * 16) + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; + _vm->_mem[(kAdrPictureComp * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; } /** @@ -172,7 +172,7 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt int remainingSkipSize = abs(skipSize); int fullLength = length + remainingSkipSize; - int memIndx = 0x6000 * 16; + int memIndx = kAdrPictureDecomp * 16; while (fullLength > 0) { f.read(&_vm->_mem[memIndx], 128); fullLength -= 128; @@ -181,7 +181,7 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = _vm->_mem[0x6000 * 16 + i]; + _vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; } void TextHandler::taffich() { diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 2a39e4b4f7..dafdcbecf5 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2026,12 +2026,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr], p._tax); - WRITE_LE_UINT16(&_mem[0x6000 * 16 + addr + 2], p._tay); + WRITE_LE_UINT16(&_mem[(kAdrPictureDecomp * 16) + addr], p._tax); + WRITE_LE_UINT16(&_mem[(kAdrPictureDecomp * 16) + addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - _mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + _mem[(kAdrPictureDecomp * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } -- cgit v1.2.3 From 0ed03cb73840e11043e51d366345d55a7f079f54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 11:24:54 +0200 Subject: MORTEVIELLE: Get rid of magic value 0x5000 --- engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/sound.cpp | 2 +- engines/mortevielle/utils.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 2d2f598548..b5bb74ac1b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -63,6 +63,7 @@ namespace Mortevielle { * 7000:2 - 16 words representing palette map * 7000:4138 - width, height, x/y offset of decoded image */ +const int kAdrMusic = 0x5000; const int kAdrPictureDecomp = 0x6000; const int kAdrPictureComp = 0x7000; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index d54ab71e50..f9b53ffed7 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -178,7 +178,7 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::musyc(tablint &tb, int nbseg, int att) { #ifdef DEBUG - const byte *pSrc = &_vm->_mem[0x5000 * 16]; + const byte *pSrc = &_vm->_mem[kAdrMusic * 16]; // Convert the countdown amount to a tempo rate, and then to note length in microseconds int tempo = TIMER_FREQUENCY / att; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index dafdcbecf5..216bd72337 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2216,7 +2216,7 @@ void MortevielleEngine::music() { fic.read(&_mem[0x47a0 * 16 + 0], 123); fic.close(); - _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[0x5000 * 16], 623); + _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[kAdrMusic * 16], 623); _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); -- cgit v1.2.3 From d2ca83898e0dbd0161e7fc3a8747bab7f9ef5975 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 11:58:54 +0200 Subject: MORTEVIELLE: Make use of _mem more homogeneous, fix a couple of errors in phoneme handling --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/outtext.cpp | 4 ++-- engines/mortevielle/speech.cpp | 16 ++++++++-------- engines/mortevielle/utils.cpp | 17 ++++++++--------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index d5036cb4d7..f967ad9c6a 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -937,7 +937,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &_vm->_mem[kAdrPictureComp * 16 + 2]; + const byte *paletteMap = &_vm->_mem[(kAdrPictureComp * 16) + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 0bb59a66e1..8e27e471eb 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -181,7 +181,7 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt f.close(); for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[kAdrAni * 16 + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; + _vm->_mem[(kAdrAni * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; } void TextHandler::taffich() { @@ -288,7 +288,7 @@ void TextHandler::taffich() { loadDesFile(filename, lgt, handle); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + ((i + 1) << 1)]); + int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + 2 + (i << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index aea49d8df1..7f11ea20db 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -83,7 +83,7 @@ void SpeechManager::spfrac(int wor) { } void SpeechManager::charg_car(int &currWordNumb) { - int wor = swap(READ_LE_UINT16(&_vm->_mem[kAdrWord + currWordNumb])); + int wor = swap(READ_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb])); int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { @@ -123,7 +123,7 @@ void SpeechManager::charg_car(int &currWordNumb) { void SpeechManager::entroct(byte o) { - _vm->_mem[kAdrTroct * 16 + _ptr_oct] = o; + _vm->_mem[(kAdrTroct * 16) + _ptr_oct] = o; ++_ptr_oct; } @@ -145,7 +145,7 @@ void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { - _cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[kAdrNoise3 + i]); + _cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]); i += 2; ++j; } while (i < kOffsetB3 + 8790); @@ -161,7 +161,7 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&_vm->_mem[0x7414 * 16 + 0], 273); + f.read(&_vm->_mem[0x7414 * 16], 273); _vm->_soundManager.decodeMusic(&_vm->_mem[0x7414 * 16], &_vm->_mem[kAdrNoise * 16], 273); f.close(); @@ -194,10 +194,10 @@ void SpeechManager::loadNoise() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&_vm->_mem[kAdrNoise * 16 + 0], 250); + f.read(&_vm->_mem[kAdrNoise * 16], 250); for (i = 0; i <= 19013; ++i) - _vm->_mem[kAdrNoise * 16 + 32000 + i] = _vm->_mem[kAdrNoise5 + i]; - f.read(&_vm->_mem[kAdrNoise1 * 16 + kOffsetB1], 149); + _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _vm->_mem[(kAdrNoise5 * 16) + i]; + f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149); f.close(); } @@ -533,7 +533,7 @@ void SpeechManager::handlePhoneme() { int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&_vm->_mem[kAdrWord + currWord], _cfiphBuffer[i]); + WRITE_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]); _ptr_oct = 0; int currWord = 0; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 216bd72337..20ba38b969 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2152,7 +2152,7 @@ void MortevielleEngine::loadBRUIT5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&_mem[kAdrNoise5 * 16 + 0], 149 * 128); + f.read(&_mem[kAdrNoise5 * 16], 149 * 128); f.close(); } @@ -2212,8 +2212,8 @@ void MortevielleEngine::music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&_mem[0x3800 * 16 + 0], 500); - fic.read(&_mem[0x47a0 * 16 + 0], 123); + fic.read(&_mem[0x3800 * 16], 500); + fic.read(&_mem[0x47a0 * 16], 123); fic.close(); _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[kAdrMusic * 16], 623); @@ -2558,7 +2558,7 @@ void MortevielleEngine::displayControlMenu() { void MortevielleEngine::pictout(int seg, int dep, int x, int y) { GfxSurface surface; - surface.decode(&_mem[seg * 16 + dep]); + surface.decode(&_mem[(seg * 16) + dep]); if (_currGraphicalDevice == MODE_HERCULES) { _mem[(kAdrPictureComp * 16) + 2] = 0; @@ -2589,7 +2589,7 @@ void MortevielleEngine::adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&_mem[0x73a2 * 16 + 0], 1 * 1664); + f.read(&_mem[0x73a2 * 16], 1664); f.close(); } @@ -2597,12 +2597,12 @@ void MortevielleEngine::adzon() { * Returns the offset within the compressed image data resource of the desired image */ int MortevielleEngine::animof(int ouf, int num) { - int nani = _mem[kAdrAni * 16 + 1]; + int nani = _mem[(kAdrAni * 16) + 1]; int aux = num; if (ouf != 1) aux += nani; - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[kAdrAni * 16 + (aux << 1)]); + int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]); return animof_result; } @@ -2981,11 +2981,10 @@ void MortevielleEngine::aniof(int ouf, int num) { num = 3; } - int ad = kAdrAni; int offset = animof(ouf, num); GfxSurface surface; - surface.decode(&_mem[ad * 16 + offset]); + surface.decode(&_mem[(kAdrAni * 16) + offset]); _screenSurface.drawPicture(surface, 0, 12); prepareScreenType1(); -- cgit v1.2.3 From 448acf74354e5e99ccb57720bc748bb88a3eba2d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 17:58:41 +0200 Subject: MORTEVIELLE: Get rid of some more magic values --- engines/mortevielle/mortevielle.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b5bb74ac1b..28aa018f93 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -67,6 +67,11 @@ const int kAdrMusic = 0x5000; const int kAdrPictureDecomp = 0x6000; const int kAdrPictureComp = 0x7000; +const int kAdrEGA = 0xA000; +const int kAdrHERC = 0xB000; +const int kAdrCGA1 = 0xB800; +const int kAdrCGA2 = 0xBA00; + #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) #define lo(v) ((v) & 0xff) -- cgit v1.2.3 From d0c9c44d238a5343cb0085b6a7a4b3e6fcfc7d16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 18:01:40 +0200 Subject: MORTEVIELLE: Remove dead code, update comment --- engines/mortevielle/actions.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 71f0d8f647..b95e3eb902 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1603,9 +1603,7 @@ void MortevielleEngine::endGame() { testKey(false); // A wait message was displayed. // testKey (aka tkey1) was called before and after. - // Most likely the double call is useless, thus removed - // - // testKey(false); + // This double call is useless, thus removed resetVariables(); } -- cgit v1.2.3 From 042011a3fed84ff7290feb44788932c6bbba89e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Jul 2013 23:58:47 +0200 Subject: MORTEVIELLE: Remove one more magic value, simplify draw() --- engines/mortevielle/dialogs.cpp | 2 +- engines/mortevielle/mortevielle.h | 4 +++- engines/mortevielle/utils.cpp | 18 +++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index d992fa0cce..29722a1b59 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -465,7 +465,7 @@ void DialogManager::displayIntroScreen(bool drawFrame2Fl) { _vm->_caff = 50; _vm->_maff = 0; _vm->_text.taffich(); - _vm->draw(kAdrPictureComp, 63, 12); + _vm->draw(63, 12); if (drawFrame2Fl) displayIntroFrame2(); else diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 28aa018f93..44db0d24c3 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -67,6 +67,8 @@ const int kAdrMusic = 0x5000; const int kAdrPictureDecomp = 0x6000; const int kAdrPictureComp = 0x7000; +const int kAdrDecBuffer = 0x73A2; + const int kAdrEGA = 0xA000; const int kAdrHERC = 0xB000; const int kAdrCGA1 = 0xB800; @@ -520,7 +522,7 @@ public: void gameLoaded(); void initGame(); void displayAloneText(); - void draw(int ad, int x, int y); + void draw(int x, int y); void charToHour(); void hourToChar(); Common::String getString(int num); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 20ba38b969..d5b777bab1 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2245,7 +2245,7 @@ void MortevielleEngine::showTitleScreen() { if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; hirs(); - draw(kAdrPictureComp, 0, 0); + draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); @@ -2256,10 +2256,10 @@ void MortevielleEngine::showTitleScreen() { * Draw picture * @remarks Originally called 'dessine' */ -void MortevielleEngine::draw(int ad, int x, int y) { +void MortevielleEngine::draw(int x, int y) { _mouse.hideMouse(); setPal(_numpal); - pictout(ad, 0, x, y); + pictout(kAdrPictureComp, 0, x, y); _mouse.showMouse(); } @@ -2273,7 +2273,7 @@ void MortevielleEngine::drawRightFrame() { _mem[(kAdrPictureComp * 16) + 14] = 15; } _mouse.hideMouse(); - pictout(0x73a2, 0, 0, 0); + pictout(kAdrDecBuffer, 0, 0, 0); _mouse.showMouse(); } @@ -2589,7 +2589,7 @@ void MortevielleEngine::adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&_mem[0x73a2 * 16], 1664); + f.read(&_mem[kAdrDecBuffer * 16], 1664); f.close(); } @@ -2997,13 +2997,13 @@ void MortevielleEngine::aniof(int ouf, int num) { void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { - draw(kAdrPictureComp, 60, 33); + draw(60, 33); _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box } else if (_caff > 69) { - draw(kAdrPictureComp, 112, 48); // Heads + draw(112, 48); // Heads _screenSurface.drawBox(222, 47, 155, 92, 15); } else { - draw(kAdrPictureComp, 0, 12); + draw(0, 12); prepareScreenType1(); if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { @@ -3176,7 +3176,7 @@ void MortevielleEngine::mennor() { } void MortevielleEngine::premtet() { - draw(kAdrPictureComp, 10, 80); + draw(10, 80); _screenSurface.drawBox(18, 79, 155, 91, 15); } -- cgit v1.2.3 From b79fd7e965e2792a18e477b830067182f35a216a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Jul 2013 18:46:55 -0400 Subject: TSAGE: Work on setup of R2R engine palette maps --- engines/tsage/core.cpp | 5 ++ engines/tsage/core.h | 1 + engines/tsage/globals.cpp | 6 ++- engines/tsage/globals.h | 6 +-- engines/tsage/ringworld2/ringworld2_logic.cpp | 68 +++++++++++++++++++++---- engines/tsage/ringworld2/ringworld2_logic.h | 2 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 60 +++++++++++++++------- engines/tsage/ringworld2/ringworld2_scenes0.h | 4 +- 8 files changed, 115 insertions(+), 37 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index b6ed17aacb..7ca529f2ed 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -4291,10 +4291,15 @@ void SceneHandler::dispatch() { GUIErrorMessage(SAVE_ERROR_MSG); } if (_loadGameSlot != -1) { + int priorSceneBeforeLoad = GLOBALS._sceneManager._previousScene; + int currentSceneBeforeLoad = GLOBALS._sceneManager._sceneNumber; + int loadSlot = _loadGameSlot; _loadGameSlot = -1; g_saver->restore(loadSlot); g_globals->_events.setCursorFromFlag(); + + postLoad(priorSceneBeforeLoad, currentSceneBeforeLoad); } g_globals->_soundManager.dispatch(); diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 655bd234e6..1f9d7cd3a5 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -900,6 +900,7 @@ public: protected: virtual void playerAction(Event &event) {} virtual void processEnd(Event &event) {} + virtual void postLoad(int priorSceneBeforeLoad, int currentSceneBeforeLoad) {} public: SceneHandler(); void registerHandler(); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 27cda63aaa..316fb588ca 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -389,8 +389,10 @@ void Ringworld2Globals::reset() { _scrollFollower = &_player; // Reset fields - Common::fill(&_v1000[0], &_v1000[0x1000], 0); - _v1000Flag = false; + Common::fill(&_fadePaletteMap[0][0], &_fadePaletteMap[10][256], 0); + Common::fill(&_paletteMap[0], &_paletteMap[4096], 0); + + _fadePaletteFlag = false; _v5589E.set(0, 0, 0, 0); _v558B6.set(0, 0, 0, 0); _v558C2 = 0; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 40254bd11e..ed27ff0556 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -254,9 +254,9 @@ public: ASoundExt _sound1, _sound2, _sound3, _sound4; PlayStream _playStream; StripProxy _stripProxy; - bool _v1000Flag; - byte _v1000[0x1000]; - byte _palIndexList[10][256]; + bool _fadePaletteFlag; + byte _fadePaletteMap[10][256]; + byte _paletteMap[4096]; int _insetUp; int _frameEdgeColour; // _v421e Rect _v5589E; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 6dabbbc368..c98d40edb5 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -339,8 +339,7 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber; if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) || (sceneNumber == 50) - || ((prevScene == 205) && (sceneNumber == 100)) - || ((prevScene == 180) && (sceneNumber == 100))) { + || ((sceneNumber == 100) && (prevScene == 0 || prevScene == 180 || prevScene == 205))) { static_cast(R2_GLOBALS._sceneHandler)->setupPaletteMaps(); R2_GLOBALS._uiElements._active = true; R2_GLOBALS._uiElements.show(); @@ -425,12 +424,12 @@ bool SceneExt::display(CursorType action, Event &event) { R2_GLOBALS._sound4.stop(); R2_GLOBALS._sound3.play(46); SceneItem::display2(5, 15); + + R2_GLOBALS._sound4.play(45); } else { R2_GLOBALS._sound3.play(43, 0); SceneItem::display2(2, R2_SONIC_STUNNER); } - - R2_GLOBALS._sound4.play(45); break; case R2_COM_SCANNER: case R2_COM_SCANNER_2: @@ -596,11 +595,32 @@ void SceneHandlerExt::process(Event &event) { SceneHandler::process(event); } +void SceneHandlerExt::postLoad(int priorSceneBeforeLoad, int currentSceneBeforeLoad) { + if (priorSceneBeforeLoad == -1 || priorSceneBeforeLoad == 50 + || priorSceneBeforeLoad == 180 || priorSceneBeforeLoad == 205) + setupPaletteMaps(); + + if (currentSceneBeforeLoad == 2900) { + R2_GLOBALS._gfxFontNumber = 50; + R2_GLOBALS._gfxColors.background = 0; + R2_GLOBALS._gfxColors.foreground = 59; + R2_GLOBALS._fontColors.background = 4; + R2_GLOBALS._fontColors.foreground = 15; + R2_GLOBALS._frameEdgeColour = 2; + + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._scenePalette.setEntry(255, 0xff, 0xff, 0xff); + R2_GLOBALS._fadePaletteFlag = false; + setupPaletteMaps(); + } +} + void SceneHandlerExt::setupPaletteMaps() { byte *palP = &R2_GLOBALS._scenePalette._palette[0]; - if (!R2_GLOBALS._v1000Flag) { - R2_GLOBALS._v1000Flag = true; + // Set up the mapping table for giving faded versions of pixels at different fade percentages + if (!R2_GLOBALS._fadePaletteFlag) { + R2_GLOBALS._fadePaletteFlag = true; for (int idx = 0; idx < 10; ++idx) { for (int palIndex = 0; palIndex < 224; ++palIndex) { @@ -650,7 +670,7 @@ void SceneHandlerExt::setupPaletteMaps() { foundIndex = pIndex2; } - R2_GLOBALS._palIndexList[idx][palIndex] = foundIndex; + R2_GLOBALS._fadePaletteMap[idx][palIndex] = foundIndex; } } } @@ -660,8 +680,8 @@ void SceneHandlerExt::setupPaletteMaps() { int g = palP[palIndex * 3 + 1] >> 2; int b = palP[palIndex * 3 + 2] >> 2; - int idx = (((r << 4) | g) << 4) | b; - R2_GLOBALS._v1000[idx] = palIndex; + int v = (r << 8) | (g << 4) | b; + R2_GLOBALS._paletteMap[v] = palIndex; } int vdx = 0; @@ -669,9 +689,9 @@ void SceneHandlerExt::setupPaletteMaps() { int palIndex = 224; for (int vIndex = 0; vIndex < 4096; ++vIndex) { - int v = R2_GLOBALS._v1000[vIndex]; + int v = R2_GLOBALS._paletteMap[vIndex]; if (!v) { - R2_GLOBALS._v1000[vIndex] = idx; + R2_GLOBALS._paletteMap[vIndex] = idx; } else { idx = v; } @@ -1259,6 +1279,32 @@ bool SceneActor::startAction(CursorType action, Event &event) { return handled; } +GfxSurface SceneActor::getFrame() { + GfxSurface frame = SceneObject::getFrame(); + + // TODO: Proper effects handling + switch (_effect) { + case 0: + case 5: + // TODO: Figure out purpose of setting image flags to 64, and getting + // scene priorities -1 or _shade + break; + case 1: + // TODO: Transposing using R2_GLOBALS._pixelArrayMap + break; + case 2: + // No effect + break; + case 4: + break; + default: + // TODO: Default effect + break; + } + + return frame; +} + /*--------------------------------------------------------------------------*/ SceneArea::SceneArea(): EventHandler() { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 2e7dd64fa2..42ca071e33 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -114,6 +114,7 @@ class SceneHandlerExt: public SceneHandler { public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); + virtual void postLoad(int priorSceneBeforeLoad, int currentSceneBeforeLoad); void setupPaletteMaps(); }; @@ -265,6 +266,7 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual bool startAction(CursorType action, Event &event); + virtual GfxSurface getFrame(); }; class SceneActorExt: public SceneActor { diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 634ecf3ddb..92e92ea578 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -226,9 +226,9 @@ bool Scene100::Terminal::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ void Scene100::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(100); R2_GLOBALS._scenePalette.loadPalette(0); + SceneExt::postInit(); if (R2_GLOBALS._sceneManager._previousScene != 125) R2_GLOBALS._sound1.play(10); @@ -5345,20 +5345,6 @@ void Scene525::signal() { * *--------------------------------------------------------------------------*/ -Scene600::Scene600() { - _field412 = 0; - for (int i = 0; i < 256; i++) - _fieldAD2[i] = 0; -} - -void Scene600::synchronize(Serializer &s) { - SceneExt::synchronize(s); - - s.syncAsSint16LE(_field412); - for (int i = 0; i < 256; i++) - s.syncAsByte(_fieldAD2[i]); -} - bool Scene600::CompartmentHotspot::startAction(CursorType action, Event &event) { if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8))) return SceneHotspot::startAction(action, event); @@ -5415,9 +5401,22 @@ bool Scene600::Actor4::startAction(CursorType action, Event &event) { return false; } -void Scene600::Actor4::draw() { - warning("TODO: Actor4::draw()"); - SceneActor::draw(); +GfxSurface Scene600::Actor4::getFrame() { + GfxSurface frame = SceneActor::getFrame(); + + if (_effect) { + // Translate the frame using the scene's pixel map + byte *pixelMap = static_cast(R2_GLOBALS._sceneManager._scene)->_pixelMap; + Graphics::Surface surface = frame.lockSurface(); + byte *srcP = (byte *)surface.pixels; + + while (srcP < ((byte *)surface.pixels + (surface.w * surface.h))) + *srcP++ = pixelMap[*srcP]; + + frame.unlockSurface(); + } + + return frame; } bool Scene600::Doorway::startAction(CursorType action, Event &event) { @@ -5545,6 +5544,21 @@ bool Scene600::Aerosol::startAction(CursorType action, Event &event) { } } +/*--------------------------------------------------------------------------*/ + +Scene600::Scene600() { + _field412 = 0; + Common::fill(&_pixelMap[0], &_pixelMap[256], 0); +} + +void Scene600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + for (int i = 0; i < 256; i++) + s.syncAsByte(_pixelMap[i]); +} + bool Scene600::Actor8::startAction(CursorType action, Event &event) { Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene; @@ -5570,7 +5584,15 @@ void Scene600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._walkRegions.enableRegion(3); _field412 = 0; - warning("FIXME: loop to initialize _fieldAD2[]"); + // Initialise pixel map for the obscuring effect + ScenePalette &pal = R2_GLOBALS._scenePalette; + uint r, g, b; + for (int i = 0; i < 256; ++i) { + pal.getEntry(i, &r, &g, &b); + int av = ((r + g + b) / 48); + + _pixelMap[i] = R2_GLOBALS._paletteMap[(av << 8) | (av << 4) | av]; + } _doorway.postInit(); _doorway.setVisage(600); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 58dad85a4c..51cdd88cc1 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -628,7 +628,7 @@ class Scene600 : public SceneExt { public: virtual void signal(); virtual bool startAction(CursorType action, Event &event); - virtual void draw(); + virtual GfxSurface getFrame(); }; class Doorway : public SceneActor { public: @@ -665,7 +665,7 @@ public: ASoundExt _aSound1; SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; - byte _fieldAD2[256]; + byte _pixelMap[256]; Scene600(); virtual void postInit(SceneObjectList *OwnerList = NULL); -- cgit v1.2.3 From 4e9e2f4feadebbe34b54bbd56b2d34f5a2e165ac Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 20 Jul 2013 23:00:43 -0400 Subject: PEGASUS: Fix possible timer "skip" when resuming pause/resume need to treat things a bit differently from the normal setRate function. This caused a jump in a timer when resuming from the pause menu in certain cases, though not all the time. Regression from b50cac637ece07c87e39232a1e8fe7262ace06f2, which was part of the fix for the lid animations. --- engines/pegasus/timers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp index 50cc9bc6d8..8463d866e8 100644 --- a/engines/pegasus/timers.cpp +++ b/engines/pegasus/timers.cpp @@ -115,7 +115,7 @@ void TimeBase::stop() { void TimeBase::pause() { if (isRunning() && !_paused) { _pausedRate = getRate(); - stop(); + _rate = 0; _paused = true; _pauseStart = g_system->getMillis(); } @@ -123,7 +123,7 @@ void TimeBase::pause() { void TimeBase::resume() { if (_paused) { - setRate(_pausedRate); + _rate = _pausedRate; _paused = false; if (isRunning()) -- cgit v1.2.3 From 472618ffffa2a16f7879c28d1e8aa5b3b3110f7c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Jul 2013 23:26:25 -0400 Subject: TSAGE: Bugfixes for R2R drive room --- engines/tsage/globals.cpp | 2 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 13 ++++++++----- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 316fb588ca..5c4fa967e5 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -3,7 +3,7 @@ * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c98d40edb5..70749f6883 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -676,11 +676,12 @@ void SceneHandlerExt::setupPaletteMaps() { } for (int palIndex = 0; palIndex < 224; ++palIndex) { - int r = palP[palIndex * 3] >> 2; - int g = palP[palIndex * 3 + 1] >> 2; - int b = palP[palIndex * 3 + 2] >> 2; + int r = palP[palIndex * 3] >> 4; + int g = palP[palIndex * 3 + 1] >> 4; + int b = palP[palIndex * 3 + 2] >> 4; int v = (r << 8) | (g << 4) | b; + assert(v < 0x1000); R2_GLOBALS._paletteMap[v] = palIndex; } @@ -973,8 +974,8 @@ bool Ringworld2InvObjectList::SelectItem(int objectNumber) { case R2_SENSOR_PROBE: if (R2_GLOBALS.getFlag(1)) SceneItem::display2(5, 1); - else if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) == 100) - SceneItem::display(5, 3); + else if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) != 100) + SceneItem::display2(5, 3); else { R2_GLOBALS._sound3.play(48); SceneItem::display2(5, 2); @@ -989,6 +990,8 @@ bool Ringworld2InvObjectList::SelectItem(int objectNumber) { SceneItem::display2(5, 8); else SceneItem::display2(5, 10); + + R2_GLOBALS._sound3.stop(); break; case R2_CHARGED_POWER_CAPSULE: if (R2_INVENTORY.getObjectScene(R2_SPENT_POWER_CAPSULE) == 1) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 92e92ea578..8ccd94638b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5364,7 +5364,7 @@ bool Scene600::Item4::startAction(CursorType action, Event &event) { return true; } - if (R2_GLOBALS.getFlag(5)) { + if (!R2_GLOBALS.getFlag(5)) { SceneItem::display(600, 30, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER, SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END); return true; @@ -5382,7 +5382,7 @@ bool Scene600::Item4::startAction(CursorType action, Event &event) { scene->_actor2.postInit(); scene->_sceneMode = 612; - setAction(&scene->_sequenceManager1, this, 612, &scene->_actor3, &scene->_actor2, &R2_GLOBALS._player, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 612, &scene->_actor3, &scene->_actor2, &R2_GLOBALS._player, NULL); return true; } -- cgit v1.2.3 From bb0850101c005edfdea660241c67c21512ea60df Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 21 Jul 2013 08:15:16 +0200 Subject: TSAGE: Fix GCC warning about possibly undefined behaviour --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 8ccd94638b..ef53ddf302 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5410,8 +5410,10 @@ GfxSurface Scene600::Actor4::getFrame() { Graphics::Surface surface = frame.lockSurface(); byte *srcP = (byte *)surface.pixels; - while (srcP < ((byte *)surface.pixels + (surface.w * surface.h))) - *srcP++ = pixelMap[*srcP]; + while (srcP < ((byte *)surface.pixels + (surface.w * surface.h))) { + *srcP = pixelMap[*srcP]; + srcP++; + } frame.unlockSurface(); } -- cgit v1.2.3 From d5ad25316cf6ba5156c09e8b7d32b5b14f2455a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 21 Jul 2013 09:27:15 +0200 Subject: MORTEVIELLE: Remove constants previously used by the mouse code --- engines/mortevielle/mortevielle.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 44db0d24c3..d2649425e8 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -69,11 +69,6 @@ const int kAdrPictureComp = 0x7000; const int kAdrDecBuffer = 0x73A2; -const int kAdrEGA = 0xA000; -const int kAdrHERC = 0xB000; -const int kAdrCGA1 = 0xB800; -const int kAdrCGA2 = 0xBA00; - #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) #define lo(v) ((v) & 0xff) -- cgit v1.2.3 From 1f9f08c93583fe397ba2dabc5d8f6deaf9f5fb40 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 21 Jul 2013 10:02:02 +0200 Subject: SCUMM: Fix test before running VAR_SAVELOAD_SCRIPT2 (CID 1004135) This doesn't really make any difference because either both VAR_SAVELOAD_SCRIPT and VAR_SAVELOAD_SCRIPT2 exist, or neither does. But it feels more correct this way. --- engines/scumm/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index ee2de49475..d1786dfb60 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -535,7 +535,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { openMainMenuDialog(); // Display global main menu - if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) + if (VAR_SAVELOAD_SCRIPT2 != 0xFF && _currentRoom != 0) runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0); } else if (restartKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F8 && lastKeyHit.hasFlags(0))) { -- cgit v1.2.3 From 15456d333e9da3a2a6ed103487f2b1d004f1c5cc Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 21 Jul 2013 08:57:46 -0400 Subject: PEGASUS: Fix missing AI warning videos in the DVD demo --- engines/pegasus/neighborhood/neighborhood.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp index 38366c4ba2..3116bd7978 100644 --- a/engines/pegasus/neighborhood/neighborhood.cpp +++ b/engines/pegasus/neighborhood/neighborhood.cpp @@ -1364,7 +1364,7 @@ void Neighborhood::setUpAIRules() { if (g_AIArea) { g_AIArea->forceAIUnlocked(); - if (!_vm->isDemo() && (getObjectID() == kPrehistoricID || getObjectID() == kNoradAlphaID || + if (!_vm->isOldDemo() && (getObjectID() == kPrehistoricID || getObjectID() == kNoradAlphaID || getObjectID() == kNoradDeltaID || getObjectID() == kMarsID || getObjectID() == kWSCID)) { AIEnergyMonitorCondition *condition50 = new AIEnergyMonitorCondition(kWorriedEnergy); -- cgit v1.2.3 From 88f5fe7329f2ee75db66c58daead78f4f4296da6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 21 Jul 2013 19:59:58 +0200 Subject: MORTEVIELLE: Get rid of the last remaining magic values used with _mem --- engines/mortevielle/mortevielle.h | 3 +++ engines/mortevielle/speech.cpp | 4 ++-- engines/mortevielle/utils.cpp | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index d2649425e8..28e342cb95 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -67,6 +67,9 @@ const int kAdrMusic = 0x5000; const int kAdrPictureDecomp = 0x6000; const int kAdrPictureComp = 0x7000; +const int kAdrCompMusicBuf1 = 0x7414; +const int kAdrCompMusicBuf2 = 0x3800; +const int kAdrUnknownBuf = 0x47a0; const int kAdrDecBuffer = 0x73A2; #define ord(v) ((int) v) diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 7f11ea20db..70b017c747 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -161,9 +161,9 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&_vm->_mem[0x7414 * 16], 273); + f.read(&_vm->_mem[kAdrCompMusicBuf1 * 16], 273); - _vm->_soundManager.decodeMusic(&_vm->_mem[0x7414 * 16], &_vm->_mem[kAdrNoise * 16], 273); + _vm->_soundManager.decodeMusic(&_vm->_mem[kAdrCompMusicBuf1 * 16], &_vm->_mem[kAdrNoise * 16], 273); f.close(); } diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index d5b777bab1..1a3b1f1ec1 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2212,11 +2212,11 @@ void MortevielleEngine::music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&_mem[0x3800 * 16], 500); - fic.read(&_mem[0x47a0 * 16], 123); + fic.read(&_mem[kAdrCompMusicBuf2 * 16], 500); + fic.read(&_mem[kAdrUnknownBuf * 16], 123); fic.close(); - _soundManager.decodeMusic(&_mem[0x3800 * 16], &_mem[kAdrMusic * 16], 623); + _soundManager.decodeMusic(&_mem[kAdrCompMusicBuf2 * 16], &_mem[kAdrMusic * 16], 623); _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); -- cgit v1.2.3 From 624d05d7bce2c250016362f8af4cc27125ed67b8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 09:25:08 +0200 Subject: MORTEVIELLE: Fix invalid read size in music code --- engines/mortevielle/mortevielle.h | 1 - engines/mortevielle/utils.cpp | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 28e342cb95..5c4389483c 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -69,7 +69,6 @@ const int kAdrPictureComp = 0x7000; const int kAdrCompMusicBuf1 = 0x7414; const int kAdrCompMusicBuf2 = 0x3800; -const int kAdrUnknownBuf = 0x47a0; const int kAdrDecBuffer = 0x73A2; #define ord(v) ((int) v) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 1a3b1f1ec1..a23c444b2e 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2212,8 +2212,7 @@ void MortevielleEngine::music() { if (!fic.open("mort.img")) error("Missing file - mort.img"); - fic.read(&_mem[kAdrCompMusicBuf2 * 16], 500); - fic.read(&_mem[kAdrUnknownBuf * 16], 123); + fic.read(&_mem[kAdrCompMusicBuf2 * 16], 623 * 128); fic.close(); _soundManager.decodeMusic(&_mem[kAdrCompMusicBuf2 * 16], &_mem[kAdrMusic * 16], 623); -- cgit v1.2.3 From 6d2d0680a94dd47f55b94dcef8c40c1d06dd9f1d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 10:10:56 +0200 Subject: MORTEVIELLE: Fix some more invalid read sizes --- engines/mortevielle/speech.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 70b017c747..7fe8c54f2d 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -161,7 +161,7 @@ void SpeechManager::loadMusicSound() { if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&_vm->_mem[kAdrCompMusicBuf1 * 16], 273); + f.read(&_vm->_mem[kAdrCompMusicBuf1 * 16], 273 * 128); _vm->_soundManager.decodeMusic(&_vm->_mem[kAdrCompMusicBuf1 * 16], &_vm->_mem[kAdrNoise * 16], 273); f.close(); @@ -177,7 +177,7 @@ void SpeechManager::loadPhonemeSounds() { if (!f.open("phbrui.mor")) error("Missing file - phbrui.mor"); - for (int i = 1; i <= 3; ++i) + for (int i = 1; i <= f.size() / 2; ++i) _cfiphBuffer[i] = f.readSint16LE(); f.close(); @@ -194,10 +194,10 @@ void SpeechManager::loadNoise() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&_vm->_mem[kAdrNoise * 16], 250); + f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); for (i = 0; i <= 19013; ++i) _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _vm->_mem[(kAdrNoise5 * 16) + i]; - f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149); + f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); f.close(); } -- cgit v1.2.3 From b481096d87d3a24cc8c0e0e3a6c0cf60e2d55e8a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 10:42:02 +0200 Subject: MORTEVIELLE: Use kAdrPictureComp in displayCGAPattern --- engines/mortevielle/utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a23c444b2e..33f9b9b64e 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2026,12 +2026,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&_mem[(kAdrPictureDecomp * 16) + addr], p._tax); - WRITE_LE_UINT16(&_mem[(kAdrPictureDecomp * 16) + addr + 2], p._tay); + WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + addr], p._tax); + WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - _mem[(kAdrPictureDecomp * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + _mem[(kAdrPictureComp * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } -- cgit v1.2.3 From 4bba7fcb9048e856eeb8f35beb844890f110736e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 10:59:52 +0200 Subject: MORTEVIELLE: Simplify loadDesFile and loadAniFile --- engines/mortevielle/outtext.cpp | 42 ++++++----------------------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 8e27e471eb..1e25aea229 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -133,24 +133,10 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt if (!f.open(filename)) error("Missing file %s", filename.c_str()); - int skipBlock = skipSize / 128; - skipSize %= 128; - - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int totalLength = length + remainingSkipSize; - int memIndx = kAdrPictureDecomp * 16; - while (totalLength > 0) { - f.read(&_vm->_mem[memIndx], 128); - totalLength -= 128; - memIndx += 128; - } + assert(skipSize + length <= f.size()); + f.seek(skipSize); + f.read(&_vm->_mem[(kAdrPictureComp * 16)], length); f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[(kAdrPictureComp * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; } /** @@ -162,26 +148,10 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt if (!f.open(filename)) error("Missing file - %s", filename.c_str()); - int skipBlock = 0; - while (skipSize > 127) { - skipSize = skipSize - 128; - ++skipBlock; - } - if (skipBlock != 0) - f.seek(skipBlock * 0x80); - - int remainingSkipSize = abs(skipSize); - int fullLength = length + remainingSkipSize; - int memIndx = kAdrPictureDecomp * 16; - while (fullLength > 0) { - f.read(&_vm->_mem[memIndx], 128); - fullLength -= 128; - memIndx += 128; - } + assert(skipSize + length <= f.size()); + f.seek(skipSize); + f.read(&_vm->_mem[(kAdrAni * 16)], length); f.close(); - - for (int i = remainingSkipSize; i <= length + remainingSkipSize; ++i) - _vm->_mem[(kAdrAni * 16) + i - remainingSkipSize] = _vm->_mem[(kAdrPictureDecomp * 16) + i]; } void TextHandler::taffich() { -- cgit v1.2.3 From f706ffbc3c53ac7a7bd1ab263bdd35cb5e446a21 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 11:19:02 +0200 Subject: MORTEVIELLE: rename variable name not following naming conventions --- engines/mortevielle/outtext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 1e25aea229..c998e68e3f 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -155,7 +155,7 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt } void TextHandler::taffich() { - static const byte _rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; + static const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; static const byte tran1[] = { 121, 121, 138, 139, 120 }; static const byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; @@ -266,7 +266,7 @@ void TextHandler::taffich() { for (int j = 0; j <= 15; ++j) if (alllum[j] > alllum[k]) k = j; - _vm->_mem[(kAdrPictureComp * 16) + 2 + (k << 1)] = _rang[i]; + _vm->_mem[(kAdrPictureComp * 16) + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } } -- cgit v1.2.3 From 42ec5c7ed31e62fc675cf5ac14f2ad5d2dd872f0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 14:28:53 +0200 Subject: MORTEVIELLE: Fix glitch in one of the head display functions --- engines/mortevielle/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 33f9b9b64e..996175895d 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3176,7 +3176,7 @@ void MortevielleEngine::mennor() { void MortevielleEngine::premtet() { draw(10, 80); - _screenSurface.drawBox(18, 79, 155, 91, 15); + _screenSurface.drawBox(18, 79, 155, 92, 15); } void MortevielleEngine::ajchai() { -- cgit v1.2.3 From 74e3da2d0d8c2c16f9c789cd77508ad082303526 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 15:55:21 +0200 Subject: MORTEVIELLE: Fix another glitch in the head display functions --- engines/mortevielle/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 996175895d..4111a7ce55 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1398,7 +1398,7 @@ void MortevielleEngine::gotoDiningRoom() { showPeoplePresent(_currBitIndex); _caff = 77; drawPictureWithText(); - _screenSurface.drawBox(223, 47, 155, 91, 15); + _screenSurface.drawBox(223, 47, 155, 92, 15); handleDescriptionText(2, 33); testKey(false); mennor(); -- cgit v1.2.3 From 4abc37de3fa7006e8dd934ead5e032ab5ed60b18 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 23:37:33 +0200 Subject: MORTEVIELLE: Fix Wait and Sleep alerts --- engines/mortevielle/dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 29722a1b59..2536533251 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -220,8 +220,8 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, choiceStr += ']'; col += 6; } - ++i; - choiceListStr = _vm->copy(inputStr, i, 30); + + choiceListStr = Common::String(inputStr.c_str() + i); if (_vm->_resolutionScaler == 2) col *= 6; else -- cgit v1.2.3 From a5b18d79051a2cf660ffcffbc30dcd5f7dc69795 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 22 Jul 2013 23:59:43 +0200 Subject: MORTEVIELLE: Remove _msg array --- engines/mortevielle/actions.cpp | 16 +++---- engines/mortevielle/menu.cpp | 8 ++-- engines/mortevielle/mortevielle.h | 3 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/utils.cpp | 96 +++++++++++++++++++-------------------- 5 files changed, 63 insertions(+), 62 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b95e3eb902..b2adebfe83 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -41,13 +41,13 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((_coreVar._currPlace == ROOM26) && (_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == ROOM26) && (_currAction == _menu._moveMenu[6])) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; drawPictureWithText(); handleDescriptionText(2, _coreVar._currPlace); } - if ((_coreVar._currPlace == LANDING) && (_msg[4] == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == LANDING) && (_currAction == _menu._moveMenu[6])) { if (!_syn) displayTextInVerbBar(getEngineString(S_GO_TO)); displayStatusArrow(); @@ -86,7 +86,7 @@ void MortevielleEngine::fctMove() { exitRoom(); int menuChoice = 1; - while (_menu._moveMenu[menuChoice] != _msg[4]) + while (_menu._moveMenu[menuChoice] != _currAction) ++menuChoice; if (_coreVar._currPlace == MOUNTAIN) { @@ -302,7 +302,7 @@ void MortevielleEngine::fctInventoryTake() { int inventIndex = 0; do { ++inventIndex; - } while (_menu._inventoryMenu[inventIndex] != _msg[4]); + } while (_menu._inventoryMenu[inventIndex] != _currAction); int cz = 0; int cy = 0; do { @@ -582,7 +582,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _msg[4] = OPCODE_ENTER; + _currAction = OPCODE_ENTER; _syn = true; } else _crep = 997; @@ -1153,8 +1153,8 @@ void MortevielleEngine::fctEnter() { int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; - _msg[3] = MENU_DISCUSS; - _msg[4] = _menu._discussMenu[charIndex]; + _currMenu = MENU_DISCUSS; + _currAction = _menu._discussMenu[charIndex]; _syn = true; if (_roomDoorId == ROOM9) { _col = true; @@ -1354,7 +1354,7 @@ void MortevielleEngine::fctDiscuss() { cx = 0; do { ++cx; - } while (_menu._discussMenu[cx] != _msg[4]); + } while (_menu._discussMenu[cx] != _currAction); _caff = 69 + cx; drawPictureWithText(); handleDescriptionText(2, _caff); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a28965523a..a1f628992d 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -482,8 +482,8 @@ void Menu::updateMenu() { // A menu was clicked on _menuSelected = (_multiTitle) && (_msg4 != OPCODE_NONE); menuUp(_msg3); - _vm->_msg[4] = _msg4; - _vm->_msg[3] = _msg3; + _vm->_currAction = _msg4; + _vm->_currMenu = _msg3; _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; @@ -540,8 +540,8 @@ void Menu::initMenu(MortevielleEngine *vm) { } _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; - _vm->_msg[3] = OPCODE_NONE; - _vm->_msg[4] = OPCODE_NONE; + _vm->_currMenu = OPCODE_NONE; + _vm->_currAction = OPCODE_NONE; _vm->setMouseClick(false); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 5c4389483c..f12d55baea 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -455,7 +455,8 @@ private: public: Common::Point _prevPos; - int _msg[5]; + int _currMenu; + int _currAction; int _fxxBuffer[108]; byte _tabdon[4001]; bool _soundOff; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index c998e68e3f..9673917741 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -293,7 +293,7 @@ void TextHandler::taffich() { loadAniFile(filename, lgt, handle); } _vm->_mouse.showMouse(); - if ((a < 27) && ((_vm->_maff < 27) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_msg[4] != OPCODE_ENTER)) { + if ((a < 27) && ((_vm->_maff < 27) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) _vm->displayAloneText(); else if (!_vm->_blo) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 4111a7ce55..63cd7b3661 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -284,18 +284,18 @@ void MortevielleEngine::handleAction() { changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); return; } - if (_menu._menuSelected && (_msg[3] == MENU_SAVE)) { - Common::String saveName = Common::String::format("Savegame #%d", _msg[4] & 15); - _savegameManager.saveGame(_msg[4] & 15, saveName); + if (_menu._menuSelected && (_currMenu == MENU_SAVE)) { + Common::String saveName = Common::String::format("Savegame #%d", _currAction & 15); + _savegameManager.saveGame(_currAction & 15, saveName); } - if (_menu._menuSelected && (_msg[3] == MENU_LOAD)) - _savegameManager.loadGame((_msg[4] & 15) - 1); + if (_menu._menuSelected && (_currMenu == MENU_LOAD)) + _savegameManager.loadGame((_currAction & 15) - 1); if (inkey == '\103') { /* F9 */ temps = _dialogManager.show(_hintPctMessage, 1); return; } else if (inkey == '\77') { - if ((_menuOpcode != OPCODE_NONE) && ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF))) { - _msg[4] = _menuOpcode; + if ((_menuOpcode != OPCODE_NONE) && ((_currMenu == MENU_ACTION) || (_currMenu == MENU_SELF))) { + _currAction = _menuOpcode; displayTextInVerbBar(getEngineString(S_IDEM)); } else return; @@ -316,17 +316,17 @@ void MortevielleEngine::handleAction() { if (_num == 9999) _num = 0; } else { - _menuOpcode = _msg[3]; - if ((_msg[3] == MENU_ACTION) || (_msg[3] == MENU_SELF)) - _menuOpcode = _msg[4]; + _menuOpcode = _currMenu; + if ((_currMenu == MENU_ACTION) || (_currMenu == MENU_SELF)) + _menuOpcode = _currAction; if (!_anyone) { if ((_heroSearching) || (_obpart)) { if (_mouse._pos.y < 12) return; - if ((_msg[4] == OPCODE_SOUND) || (_msg[4] == OPCODE_LIFT)) { + if ((_currAction == OPCODE_SOUND) || (_currAction == OPCODE_LIFT)) { oo = true; - if ((_msg[4] == OPCODE_LIFT) || (_obpart)) { + if ((_currAction == OPCODE_LIFT) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; _crep = 998; @@ -1552,71 +1552,71 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_uptodatePresence) { - if ((_msg[3] == MENU_MOVE) || (_msg[4] == OPCODE_LEAVE) || (_msg[4] == OPCODE_SLEEP) || (_msg[4] == OPCODE_EAT)) { + if ((_currMenu == MENU_MOVE) || (_currAction == OPCODE_LEAVE) || (_currAction == OPCODE_SLEEP) || (_currAction == OPCODE_EAT)) { _controlMenu = 4; mennor(); return; } } - if (_msg[3] == MENU_MOVE) + if (_currMenu == MENU_MOVE) fctMove(); - if (_msg[3] == MENU_DISCUSS) + if (_currMenu == MENU_DISCUSS) fctDiscuss(); - if (_msg[3] == MENU_INVENTORY) + if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - if (_msg[4] == OPCODE_ATTACH) + if (_currAction == OPCODE_ATTACH) fctAttach(); - if (_msg[4] == OPCODE_WAIT) + if (_currAction == OPCODE_WAIT) fctWait(); - if (_msg[4] == OPCODE_FORCE) + if (_currAction == OPCODE_FORCE) fctForce(); - if (_msg[4] == OPCODE_SLEEP) + if (_currAction == OPCODE_SLEEP) fctSleep(); - if (_msg[4] == OPCODE_LISTEN) + if (_currAction == OPCODE_LISTEN) fctListen(); - if (_msg[4] == OPCODE_ENTER) + if (_currAction == OPCODE_ENTER) fctEnter(); - if (_msg[4] == OPCODE_CLOSE) + if (_currAction == OPCODE_CLOSE) fctClose(); - if (_msg[4] == OPCODE_SEARCH) + if (_currAction == OPCODE_SEARCH) fctSearch(); - if (_msg[4] == OPCODE_KNOCK) + if (_currAction == OPCODE_KNOCK) fctKnock(); - if (_msg[4] == OPCODE_SCRATCH) + if (_currAction == OPCODE_SCRATCH) fctScratch(); - if (_msg[4] == OPCODE_READ) + if (_currAction == OPCODE_READ) fctRead(); - if (_msg[4] == OPCODE_EAT) + if (_currAction == OPCODE_EAT) fctEat(); - if (_msg[4] == OPCODE_PLACE) + if (_currAction == OPCODE_PLACE) fctPlace(); - if (_msg[4] == OPCODE_OPEN) + if (_currAction == OPCODE_OPEN) fctOpen(); - if (_msg[4] == OPCODE_TAKE) + if (_currAction == OPCODE_TAKE) fctTake(); - if (_msg[4] == OPCODE_LOOK) + if (_currAction == OPCODE_LOOK) fctLook(); - if (_msg[4] == OPCODE_SMELL) + if (_currAction == OPCODE_SMELL) fctSmell(); - if (_msg[4] == OPCODE_SOUND) + if (_currAction == OPCODE_SOUND) fctSound(); - if (_msg[4] == OPCODE_LEAVE) + if (_currAction == OPCODE_LEAVE) fctLeave(); - if (_msg[4] == OPCODE_LIFT) + if (_currAction == OPCODE_LIFT) fctLift(); - if (_msg[4] == OPCODE_TURN) + if (_currAction == OPCODE_TURN) fctTurn(); - if (_msg[4] == OPCODE_SSEARCH) + if (_currAction == OPCODE_SSEARCH) fctSelfSearch(); - if (_msg[4] == OPCODE_SREAD) + if (_currAction == OPCODE_SREAD) fctSelfRead(); - if (_msg[4] == OPCODE_SPUT) + if (_currAction == OPCODE_SPUT) fctSelfPut(); - if (_msg[4] == OPCODE_SLOOK) + if (_currAction == OPCODE_SLOOK) fctSelftLook(); _hiddenHero = false; - if (_msg[4] == OPCODE_SHIDE) + if (_currAction == OPCODE_SHIDE) fctSelfHide(); } else { if (_anyone) { @@ -3078,7 +3078,7 @@ void MortevielleEngine::tlu(int af, int ob) { handleDescriptionText(2, 999); testKey(true); _caff = af; - _msg[3] = OPCODE_NONE; + _currMenu = OPCODE_NONE; _crep = 998; } @@ -3171,7 +3171,7 @@ void MortevielleEngine::getSearchDescription(int objId) { } void MortevielleEngine::mennor() { - _menu.menuUp(_msg[3]); + _menu.menuUp(_currMenu); } void MortevielleEngine::premtet() { @@ -3241,8 +3241,8 @@ L1: int cx = convertBitIndexToCharacterIndex(_currBitIndex); _caff = 69 + cx; _crep = _caff; - _msg[3] = MENU_DISCUSS; - _msg[4] = _menu._discussMenu[cx]; + _currMenu = MENU_DISCUSS; + _currAction = _menu._discussMenu[cx]; _syn = true; _col = true; } else { @@ -3387,7 +3387,7 @@ void MortevielleEngine::treg(int objId) { int mdes = _caff; _caff = objId; - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_msg[4] == OPCODE_SLOOK)) { + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == OPCODE_SLOOK)) { drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) handleDescriptionText(2, _caff); @@ -3395,7 +3395,7 @@ void MortevielleEngine::treg(int objId) { handleDescriptionText(2, _caff + 400); testKey(true); _caff = mdes; - _msg[3] = MENU_NONE; + _currMenu = MENU_NONE; _crep = 998; } else { _obpart = true; -- cgit v1.2.3 From ee6bb6719c40dc9bdf859e2f49c637bf2ee16dee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 09:13:32 +0200 Subject: MORTEVIELLE: Janitorial: Misc cosmetic changes --- engines/mortevielle/actions.cpp | 8 ++++---- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/outtext.cpp | 3 ++- engines/mortevielle/outtext.h | 2 +- engines/mortevielle/saveload.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b2adebfe83..62caa4829f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -609,10 +609,10 @@ void MortevielleEngine::fctOpen() { } while (!((tmpPlace > 6) || (_openObjects[tmpPlace] == 0) || (_openObjects[tmpPlace] == _num))); if (_openObjects[tmpPlace] != _num) { if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) - || (_coreVar._currPlace == ROOM9) - || (_coreVar._currPlace == BLUE_ROOM) + || (_coreVar._currPlace == ROOM9) + || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) - || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) + || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == RED_ROOM))) || ((_coreVar._currPlace == DARKBLUE_ROOM) && (_num == 5)) @@ -1344,7 +1344,7 @@ void MortevielleEngine::fctDiscuss() { int x, y; Common::String lib[47]; - int choice; + int choice; int displId; endSearch(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 418b0a079f..3a839a23da 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -354,7 +354,7 @@ Common::Error MortevielleEngine::run() { // Run the main game loop mainGame(); - + // Cleanup (allocated in initialize()) _screenSurface.free(); free(_speechManager._cfiphBuffer); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 9673917741..c74165e827 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -263,9 +263,10 @@ void TextHandler::taffich() { } for (int i = 0; i <= 15; ++i) { int k = 0; - for (int j = 0; j <= 15; ++j) + for (int j = 0; j <= 15; ++j) { if (alllum[j] > alllum[k]) k = j; + } _vm->_mem[(kAdrPictureComp * 16) + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index a4b078682a..514aae3a4c 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -42,7 +42,7 @@ private: public: void setParent(MortevielleEngine *vm); void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); - void loadDesFile(Common::String filename, int32 passe, int long_); + void loadDesFile(Common::String filename, int32 skipSize, int length); void loadAniFile(Common::String filename, int32 skipSize, int length); void taffich(); }; diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 6613b62ac7..0121a04d8e 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -61,7 +61,7 @@ public: Common::Error loadGame(const Common::String &filename); Common::Error saveGame(int n, const Common::String &saveName); Common::Error loadGame(int slot); - Common::Error saveGame(int slot); + Common::Error saveGame(int slot); void writeSavegameHeader(Common::OutSaveFile *out, const Common::String &saveName); static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header); -- cgit v1.2.3 From dcdf68b0a62391e8ea13464b42eb0f0c1caa8b4b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 09:31:47 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/outtext.cpp | 31 +++++++++++++++++-------------- engines/mortevielle/utils.cpp | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index f12d55baea..04ecd56ea5 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -457,7 +457,7 @@ public: Common::Point _prevPos; int _currMenu; int _currAction; - int _fxxBuffer[108]; + int _drawingSizeArr[108]; byte _tabdon[4001]; bool _soundOff; bool _blo; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index c74165e827..3164b51e5d 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -160,8 +160,8 @@ void TextHandler::taffich() { static const byte tran1[] = { 121, 121, 138, 139, 120 }; static const byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; - int cx, handle, npal; - int32 lgt; + int cx, drawingSize, npal; + int32 drawingStartPos; int alllum[16]; int a = _vm->_caff; @@ -213,7 +213,7 @@ void TextHandler::taffich() { _vm->_destinationOk = true; _vm->_mouse.hideMouse(); - lgt = 0; + drawingStartPos = 0; Common::String filename; if ((a != 50) && (a != 51)) { @@ -237,8 +237,8 @@ void TextHandler::taffich() { npal = a; for (cx = 0; cx <= (a - 1); ++cx) - lgt += _vm->_fxxBuffer[cx]; - handle = _vm->_fxxBuffer[a]; + drawingStartPos += _vm->_drawingSizeArr[cx]; + drawingSize = _vm->_drawingSizeArr[a]; filename = "DXX.mor"; } else { @@ -247,15 +247,15 @@ void TextHandler::taffich() { else filename = "DZZ.mor"; - handle = _vm->_fxxBuffer[87]; + drawingSize = _vm->_drawingSizeArr[87]; if (a == 51) { - lgt = handle; - handle = _vm->_fxxBuffer[88]; + drawingStartPos = drawingSize; + drawingSize = _vm->_drawingSizeArr[88]; } _vm->_maff = a; npal = a + 37; } - loadDesFile(filename, lgt, handle); + loadDesFile(filename, drawingStartPos, drawingSize); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + 2 + (i << 1)]); @@ -275,7 +275,7 @@ void TextHandler::taffich() { _vm->setPal(npal); if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) { - lgt = 0; + drawingStartPos = 0; if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26)) { if (b == 26) b = 18; @@ -284,14 +284,17 @@ void TextHandler::taffich() { else if (b > 15) --b; for (cx = 0; cx <= (b - 1); ++cx) - lgt += _vm->_fxxBuffer[cx + 89]; - handle = _vm->_fxxBuffer[b + 89]; + drawingStartPos += _vm->_drawingSizeArr[cx + 89]; + drawingSize = _vm->_drawingSizeArr[b + 89]; filename = "AXX.mor"; } else if (b == 50) { + // CHECKME: the size of AZZ.mor is 1280 for the DOS version + // and 1260 for the Amiga version. Maybe the 20 bytes + // are a filler, or the size should be variable. + drawingSize = 1260; filename = "AZZ.mor"; - handle = 1260; } - loadAniFile(filename, lgt, handle); + loadAniFile(filename, drawingStartPos, drawingSize); } _vm->_mouse.showMouse(); if ((a < 27) && ((_vm->_maff < 27) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) { diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 63cd7b3661..a0749a9ac7 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2051,7 +2051,7 @@ void MortevielleEngine::loadPalette() { } for (int i = 0; i < 108; ++i) - _fxxBuffer[i] = f.readSint16LE(); + _drawingSizeArr[i] = f.readSint16LE(); f.close(); if (!f.open("plxx.mor")) -- cgit v1.2.3 From 877fc1f8b9796a933a4e79f1af4a3a9634cd4e1f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 09:41:59 +0200 Subject: MORTEVIELLE: Clarify a part of taffich --- engines/mortevielle/outtext.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 3164b51e5d..e14fff0227 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -247,9 +247,11 @@ void TextHandler::taffich() { else filename = "DZZ.mor"; - drawingSize = _vm->_drawingSizeArr[87]; - if (a == 51) { - drawingStartPos = drawingSize; + if (a == 50) { + drawingStartPos = 0; + drawingSize = _vm->_drawingSizeArr[87]; + } else { // a == 51 + drawingStartPos = _vm->_drawingSizeArr[87]; drawingSize = _vm->_drawingSizeArr[88]; } _vm->_maff = a; @@ -290,7 +292,8 @@ void TextHandler::taffich() { } else if (b == 50) { // CHECKME: the size of AZZ.mor is 1280 for the DOS version // and 1260 for the Amiga version. Maybe the 20 bytes - // are a filler, or the size should be variable. + // are a filler (to get 10 blocks of 128 bytes), + // or the size should be variable. drawingSize = 1260; filename = "AZZ.mor"; } -- cgit v1.2.3 From de3566e82e4cf0db2e05c538bc3793389ad14e40 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 10:18:08 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 4 ++-- engines/mortevielle/outtext.cpp | 6 +++--- engines/mortevielle/utils.cpp | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 62caa4829f..0d2d8b4d1c 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -474,7 +474,7 @@ void MortevielleEngine::fctSelftLook() { * @remarks Originally called 'tfouiller' */ void MortevielleEngine::fctSearch() { - static const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; + static const byte answerArr[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; if (_caff > 99) { getSearchDescription(_caff); @@ -542,7 +542,7 @@ void MortevielleEngine::fctSearch() { _coreVar._faithScore += 3; _crep = 997; if (_coreVar._currPlace < CELLAR) - _crep = r[_coreVar._currPlace]; + _crep = answerArr[_coreVar._currPlace]; if ((_coreVar._currPlace == TOILETS) && (_num == 2)) _crep = 162; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index e14fff0227..3afab7c80b 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -289,7 +289,7 @@ void TextHandler::taffich() { drawingStartPos += _vm->_drawingSizeArr[cx + 89]; drawingSize = _vm->_drawingSizeArr[b + 89]; filename = "AXX.mor"; - } else if (b == 50) { + } else { // b == 50 // CHECKME: the size of AZZ.mor is 1280 for the DOS version // and 1260 for the Amiga version. Maybe the 20 bytes // are a filler (to get 10 blocks of 128 bytes), @@ -300,8 +300,8 @@ void TextHandler::taffich() { loadAniFile(filename, drawingStartPos, drawingSize); } _vm->_mouse.showMouse(); - if ((a < 27) && ((_vm->_maff < 27) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) { - if ((a == 13) || (a == 14)) + if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) { + if ((a == ATTIC) || (a == CELLAR)) _vm->displayAloneText(); else if (!_vm->_blo) _vm->getPresence(_vm->_coreVar._currPlace); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a0749a9ac7..c9b40c475f 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -254,10 +254,11 @@ void MortevielleEngine::handleAction() { const int lim = 20000; int temps = 0; char inkey = '\0'; - bool oo, funct = 0; + bool funct = false; clearVerbBar(); - oo = false; + + bool handledOpcodeFl = false; _controlMenu = 0; if (!_keyPressedEsc) { _menu.drawMenu(); @@ -325,7 +326,7 @@ void MortevielleEngine::handleAction() { return; if ((_currAction == OPCODE_SOUND) || (_currAction == OPCODE_LIFT)) { - oo = true; + handledOpcodeFl = true; if ((_currAction == OPCODE_LIFT) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; @@ -337,7 +338,7 @@ void MortevielleEngine::handleAction() { } } do { - if (! oo) + if (!handledOpcodeFl) handleOpcode(); if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { -- cgit v1.2.3 From be886b4e380a20aa6e3d06c98142bc4d0f604103 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 10:44:33 +0200 Subject: MORTEVIELLE: Improve question cheat in debugger --- engines/mortevielle/debugger.cpp | 5 +++++ engines/mortevielle/mortevielle.h | 4 ++-- engines/mortevielle/utils.cpp | 8 +++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 042eb0e224..5e1e33575f 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -38,6 +38,11 @@ bool Debugger::Cmd_showAllQuestions(int argc, const char **argv) { for (int i = 1; i <= 42; ++i) _vm->_coreVar._availableQuestion[i] = '*'; + for (int i = 0; i < 9; i++) { + _vm->_nbrep[i] = 0; + _vm->_nbrepm[i] = 999; + } + return true; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 04ecd56ea5..c198b246ba 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -285,8 +285,6 @@ private: byte *_cfiecBuffer; int _cfiecBufferSize; int _openObjects[8]; - int _nbrep[9]; - int _nbrepm[9]; uint16 _dialogIndexArray[kMaxDialogIndex + 1]; Hint _dialogHintArray[kMaxDialogHint + 1]; @@ -471,6 +469,8 @@ public: int _key; SaveStruct _coreVar, _saveStruct; + int _nbrep[9]; + int _nbrepm[9]; int _maff; int _caff; int _crep; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index c9b40c475f..e07623bdb7 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2300,13 +2300,11 @@ void MortevielleEngine::prepareRoom() { updateHour(day, hour, minute); if (day != _day) { _day = day; - int i = 0; - do { - ++i; - if (_nbrepm[i] != 0) + for (int i = 0; i < 9; i++) { + if (_nbrepm[i] > 0) --_nbrepm[i]; _nbrep[i] = 0; - } while (i != 8); + } } if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { _hour = hour; -- cgit v1.2.3 From 95ade596a1104e12171df58031bdb88391f2518e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 10:51:42 +0200 Subject: MORTEVIELLE: Renaming fields and functions related to the number of answers per character --- engines/mortevielle/actions.cpp | 4 ++-- engines/mortevielle/debugger.cpp | 4 ++-- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 6 +++--- engines/mortevielle/utils.cpp | 20 ++++++++++++-------- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 0d2d8b4d1c..9a29bbfd29 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1484,10 +1484,10 @@ void MortevielleEngine::fctDiscuss() { displId = 138; _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); } - } else if (_nbrep[_caff - 69] < _nbrepm[_caff - 69]) { + } else if (_charAnswerCount[_caff - 69] < _charAnswerMax[_caff - 69]) { displId = _tabdon[kArep + (ix << 3) + (_caff - 70)]; _coreVar._faithScore += _tabdon[kArcf + ix]; - ++_nbrep[_caff - 69]; + ++_charAnswerCount[_caff - 69]; } else { _coreVar._faithScore += 3; displId = 139; diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 5e1e33575f..4ef5151c81 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -39,8 +39,8 @@ bool Debugger::Cmd_showAllQuestions(int argc, const char **argv) { _vm->_coreVar._availableQuestion[i] = '*'; for (int i = 0; i < 9; i++) { - _vm->_nbrep[i] = 0; - _vm->_nbrepm[i] = 999; + _vm->_charAnswerCount[i] = 0; + _vm->_charAnswerMax[i] = 999; } return true; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3a839a23da..c13eba4a4a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -206,7 +206,7 @@ Common::ErrorCode MortevielleEngine::initialize() { loadCFIEC(); decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); _x26KeyCount = 1; - init_nbrepm(); + initMaxAnswer(); initMouse(); loadPlaces(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c198b246ba..45a06144cd 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -443,7 +443,7 @@ private: void premtet(); void ajchai(); void ecr2(Common::String text); - void init_nbrepm(); + void initMaxAnswer(); void aniof(int ouf, int num); void tlu(int af, int ob); void mennor(); @@ -456,6 +456,8 @@ public: int _currMenu; int _currAction; int _drawingSizeArr[108]; + int _charAnswerCount[9]; + int _charAnswerMax[9]; byte _tabdon[4001]; bool _soundOff; bool _blo; @@ -469,8 +471,6 @@ public: int _key; SaveStruct _coreVar, _saveStruct; - int _nbrep[9]; - int _nbrepm[9]; int _maff; int _caff; int _crep; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index e07623bdb7..094e1020d1 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1983,9 +1983,9 @@ void MortevielleEngine::resetVariables() { _coreVar._availableQuestion[33] = '*'; for (int i = 1; i <= 8; ++i) - _nbrep[i] = 0; + _charAnswerCount[i] = 0; - init_nbrepm(); + initMaxAnswer(); } /** @@ -2301,9 +2301,9 @@ void MortevielleEngine::prepareRoom() { if (day != _day) { _day = day; for (int i = 0; i < 9; i++) { - if (_nbrepm[i] > 0) - --_nbrepm[i]; - _nbrep[i] = 0; + if (_charAnswerMax[i] > 0) + --_charAnswerMax[i]; + _charAnswerCount[i] = 0; } } if ((hour > _hour) || ((hour == 0) && (_hour == 23))) { @@ -2879,11 +2879,15 @@ void MortevielleEngine::setPresenceFlags(int roomId) { _room9PresenceLeo = true; } -void MortevielleEngine::init_nbrepm() { - static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; +/** + * Initialize max answers per character + * @remarks Originally called 'init_nbrepm' + */ +void MortevielleEngine::initMaxAnswer() { + static const byte maxAnswer[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; for (int idx = 0; idx < 9; ++idx) - _nbrepm[idx] = ipm[idx]; + _charAnswerMax[idx] = maxAnswer[idx]; } void MortevielleEngine::phaz(int &rand, int &p, int cf) { -- cgit v1.2.3 From 03e32ca3186ac95661d9ec3624338a978b76f999 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 15:03:47 +0200 Subject: MORTEVIELLE: Get rid of phaz, Fix an uninitialized variable in setRandomPresenceRoom9 --- engines/mortevielle/mortevielle.h | 25 +++++---- engines/mortevielle/utils.cpp | 110 +++++++++++++++----------------------- 2 files changed, 55 insertions(+), 80 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 45a06144cd..371c812508 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -314,7 +314,7 @@ private: void displayControlMenu(); void displayItemInHand(int objId); void resetRoomVariables(int roomId); - int getPresenceStats(int &rand, int cf, int roomId); + int getPresenceStats(int &rand, int faithScore, int roomId); void setPresenceFlags(int roomId); void testKey(bool d); void exitRoom(); @@ -375,17 +375,17 @@ private: int setPresenceKitchen(); int setPresenceLanding(); int setPresenceChapel(int hour); - void setRandomPresenceGreenRoom(int cf); - void setRandomPresencePurpleRoom(int cf); - void setRandomPresenceBlueRoom(int cf); - void setRandomPresenceRedRoom(int cf); - void setRandomPresenceRoom9(int cf); - void setRandomPresenceDiningRoom(int cf); - void setRandomPresenceBureau(int cf); - void setRandomPresenceKitchen(int cf); - void setRandomPresenceAttic(int cf); - void setRandomPresenceLanding(int cf); - void setRandomPresenceChapel(int cf); + void setRandomPresenceGreenRoom(int faithScore); + void setRandomPresencePurpleRoom(int faithScore); + void setRandomPresenceBlueRoom(int faithScore); + void setRandomPresenceRedRoom(int faithScore); + void setRandomPresenceRoom9(int faithScore); + void setRandomPresenceDiningRoom(int faithScore); + void setRandomPresenceBureau(int faithScore); + void setRandomPresenceKitchen(int faithScore); + void setRandomPresenceAttic(int faithScore); + void setRandomPresenceLanding(int faithScore); + void setRandomPresenceChapel(int faithScore); void loadPlaces(); void resetPresenceInRooms(int roomId); void showPeoplePresent(int bitIndex); @@ -439,7 +439,6 @@ private: void copcha(); void adzon(); - void phaz(int &rand, int &p, int cf); void premtet(); void ajchai(); void ecr2(Common::String text); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 094e1020d1..5bf84d9c7b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -698,8 +698,8 @@ int MortevielleEngine::getPresenceStatsRedRoom() { * @remarks Originally called 'person' */ void MortevielleEngine::displayAloneText() { - for (int cf = 1; cf <= 8; ++cf) - _menu.disableMenuItem(_menu._discussMenu[cf]); + for (int i = 1; i <= 8; ++i) + _menu.disableMenuItem(_menu._discussMenu[i]); Common::String sYou = getEngineString(S_YOU); Common::String sAre = getEngineString(S_ARE); @@ -1090,14 +1090,12 @@ void MortevielleEngine::initGame() { * Engine function - Set Random Presence - Green Room * @remarks Originally called 'pl1' */ -void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { +void MortevielleEngine::setRandomPresenceGreenRoom(int faithScore) { if ( ((_place == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) || ((_place == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) { int p = getPresenceStatsGreenRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceGreenRoom(_place); @@ -1108,13 +1106,11 @@ void MortevielleEngine::setRandomPresenceGreenRoom(int cf) { * Engine function - Set Random Presence - Purple Room * @remarks Originally called 'pl2' */ -void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { +void MortevielleEngine::setRandomPresencePurpleRoom(int faithScore) { if (!_purpleRoomPresenceLeo) { int p = getPresenceStatsPurpleRoom(); - int rand; - phaz(rand, p, cf); - - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresencePurpleRoom(); @@ -1125,14 +1121,11 @@ void MortevielleEngine::setRandomPresencePurpleRoom(int cf) { * Engine function - Set Random Presence - Blue Room * @remarks Originally called 'pl5' */ -void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { +void MortevielleEngine::setRandomPresenceBlueRoom(int faithScore) { if (!_roomPresenceMax) { int p = getPresenceStatsBlueRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceBlueRoom(); @@ -1143,15 +1136,12 @@ void MortevielleEngine::setRandomPresenceBlueRoom(int cf) { * Engine function - Set Random Presence - Red Room * @remarks Originally called 'pl6' */ -void MortevielleEngine::setRandomPresenceRedRoom(int cf) { +void MortevielleEngine::setRandomPresenceRedRoom(int faithScore) { if ( ((_place == RED_ROOM) && (!_roomPresenceBob)) || ((_place == GREEN_ROOM2) && (!_roomPresencePat)) ) { int p = getPresenceStatsRedRoom(); - int rand; - - phaz(rand, p, cf); - - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceRedRoom(_place); @@ -1162,13 +1152,10 @@ void MortevielleEngine::setRandomPresenceRedRoom(int cf) { * Engine function - Set Random Presence - Room 9 * @remarks Originally called 'pl9' */ -void MortevielleEngine::setRandomPresenceRoom9(int cf) { +void MortevielleEngine::setRandomPresenceRoom9(int faithScore) { if (!_room9PresenceLeo) { - cf = -10; - int p, rand; - phaz(rand, p, cf); - - if (rand > p) + faithScore = -10; + if (getRandomNumber(1, 100) > faithScore) // always true? displayAloneText(); else setPresencePurpleRoom(); @@ -1179,12 +1166,11 @@ void MortevielleEngine::setRandomPresenceRoom9(int cf) { * Engine function - Set Random Presence - Dining Room * @remarks Originally called 'pl10' */ -void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { - int h, rand; +void MortevielleEngine::setRandomPresenceDiningRoom(int faithScore) { + int h; int p = getPresenceStatsDiningRoom(h); - phaz(rand, p, cf); - - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceDiningRoom(h); @@ -1194,12 +1180,12 @@ void MortevielleEngine::setRandomPresenceDiningRoom(int cf) { * Engine function - Set Random Presence - Bureau * @remarks Originally called 'pl11' */ -void MortevielleEngine::setRandomPresenceBureau(int cf) { - int h, rand; +void MortevielleEngine::setRandomPresenceBureau(int faithScore) { + int h; int p = getPresenceStatsBureau(h); - phaz(rand, p, cf); - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceBureau(h); @@ -1209,12 +1195,11 @@ void MortevielleEngine::setRandomPresenceBureau(int cf) { * Engine function - Set Random Presence - Kitchen * @remarks Originally called 'pl12' */ -void MortevielleEngine::setRandomPresenceKitchen(int cf) { - int p, rand; +void MortevielleEngine::setRandomPresenceKitchen(int faithScore) { - p = getPresenceStatsKitchen(); - phaz(rand, p, cf); - if (rand > p) + int p = getPresenceStatsKitchen(); + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceKitchen(); @@ -1224,12 +1209,10 @@ void MortevielleEngine::setRandomPresenceKitchen(int cf) { * Engine function - Set Random Presence - Attic / Cellar * @remarks Originally called 'pl13' */ -void MortevielleEngine::setRandomPresenceAttic(int cf) { - int p, rand; - - p = getPresenceStatsAttic(); - phaz(rand, p, cf); - if (rand > p) +void MortevielleEngine::setRandomPresenceAttic(int faithScore) { + int p = getPresenceStatsAttic(); + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceKitchen(); @@ -1239,12 +1222,10 @@ void MortevielleEngine::setRandomPresenceAttic(int cf) { * Engine function - Set Random Presence - Landing * @remarks Originally called 'pl15' */ -void MortevielleEngine::setRandomPresenceLanding(int cf) { - int p, rand; - - p = getPresenceStatsLanding(); - phaz(rand, p, cf); - if (rand > p) +void MortevielleEngine::setRandomPresenceLanding(int faithScore) { + int p = getPresenceStatsLanding(); + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceLanding(); @@ -1254,12 +1235,12 @@ void MortevielleEngine::setRandomPresenceLanding(int cf) { * Engine function - Set Random Presence - Chapel * @remarks Originally called 'pl20' */ -void MortevielleEngine::setRandomPresenceChapel(int cf) { - int h, rand; +void MortevielleEngine::setRandomPresenceChapel(int faithScore) { + int h; int p = getPresenceStatsChapel(h); - phaz(rand, p, cf); - if (rand > p) + p += faithScore; + if (getRandomNumber(1, 100) > p) displayAloneText(); else setPresenceChapel(h); @@ -2814,7 +2795,7 @@ void MortevielleEngine::resetRoomVariables(int roomId) { * Compute presence stats * @remarks Originally called 'ecfren' */ -int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { +int MortevielleEngine::getPresenceStats(int &rand, int faithScore, int roomId) { if (roomId == OWN_ROOM) displayAloneText(); int retVal = -500; @@ -2838,7 +2819,7 @@ int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) { || ((roomId == ROOM9) && (_purpleRoomPresenceLeo))) retVal = -400; if (retVal != -500) { - retVal += cf; + retVal += faithScore; rand = getRandomNumber(1, 100); } @@ -2890,11 +2871,6 @@ void MortevielleEngine::initMaxAnswer() { _charAnswerMax[idx] = maxAnswer[idx]; } -void MortevielleEngine::phaz(int &rand, int &p, int cf) { - p += cf; - rand = getRandomNumber(1, 100); -} - /** * Get Presence * @remarks Originally called 't11' -- cgit v1.2.3 From 3573929625b1253f642af8f0c73487fd6d8e9ebf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Jul 2013 17:19:16 +0200 Subject: MORTEVIELLE: Give a better name to kAdrDecBuffer --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 371c812508..6f77643186 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -69,7 +69,7 @@ const int kAdrPictureComp = 0x7000; const int kAdrCompMusicBuf1 = 0x7414; const int kAdrCompMusicBuf2 = 0x3800; -const int kAdrDecBuffer = 0x73A2; +const int kAdrRightFramePic = 0x73A2; #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 5bf84d9c7b..0cad1636d9 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2254,7 +2254,7 @@ void MortevielleEngine::drawRightFrame() { _mem[(kAdrPictureComp * 16) + 14] = 15; } _mouse.hideMouse(); - pictout(kAdrDecBuffer, 0, 0, 0); + pictout(kAdrRightFramePic, 0, 0, 0); _mouse.showMouse(); } @@ -2562,13 +2562,14 @@ void MortevielleEngine::adzon() { if (!f.open("bmor.mor")) error("Missing file - bmor.mor"); - f.read(&_tabdon[kFleche], 1 * 1916); + f.read(&_tabdon[kFleche], 1916); f.close(); + // Read Right Frame Drawing if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&_mem[kAdrDecBuffer * 16], 1664); + f.read(&_mem[kAdrRightFramePic * 16], 1664); f.close(); } -- cgit v1.2.3 From e19656464c779558a8bc201cb97b924edcf91ea1 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 23 Jul 2013 18:39:50 +0200 Subject: WINTERMUTE: Set _scriptStream to nullptr after deletion (Clang static-analyzer issue) --- engines/wintermute/base/scriptables/script.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index 1b945c2e1c..0cffa94b50 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -461,6 +461,7 @@ void ScScript::cleanup() { _parentScript = nullptr; // ref only delete _scriptStream; + _scriptStream = nullptr; } -- cgit v1.2.3 From 06e57dd53b94fa7e952a4aebf90420bff2f09d46 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Jul 2013 12:30:58 +0200 Subject: MORTEVIELLE: Remove useless constant, rename another one --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/mortevielle.h | 3 +-- engines/mortevielle/outtext.cpp | 6 +++--- engines/mortevielle/utils.cpp | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index f967ad9c6a..cb674a2317 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -937,7 +937,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &_vm->_mem[(kAdrPictureComp * 16) + 2]; + const byte *paletteMap = &_vm->_mem[(kAdrCurrentPicture * 16) + 2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6f77643186..347b921efc 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -64,8 +64,7 @@ namespace Mortevielle { * 7000:4138 - width, height, x/y offset of decoded image */ const int kAdrMusic = 0x5000; -const int kAdrPictureDecomp = 0x6000; -const int kAdrPictureComp = 0x7000; +const int kAdrCurrentPicture = 0x7000; const int kAdrCompMusicBuf1 = 0x7414; const int kAdrCompMusicBuf2 = 0x3800; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 3afab7c80b..311a4c2ee4 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -135,7 +135,7 @@ void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int lengt assert(skipSize + length <= f.size()); f.seek(skipSize); - f.read(&_vm->_mem[(kAdrPictureComp * 16)], length); + f.read(&_vm->_mem[(kAdrCurrentPicture * 16)], length); f.close(); } @@ -260,7 +260,7 @@ void TextHandler::taffich() { loadDesFile(filename, drawingStartPos, drawingSize); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&_vm->_mem[(kAdrPictureComp * 16) + 2 + (i << 1)]); + int palh = READ_LE_UINT16(&_vm->_mem[(kAdrCurrentPicture * 16) + 2 + (i << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -269,7 +269,7 @@ void TextHandler::taffich() { if (alllum[j] > alllum[k]) k = j; } - _vm->_mem[(kAdrPictureComp * 16) + 2 + (k << 1)] = rang[i]; + _vm->_mem[(kAdrCurrentPicture * 16) + 2 + (k << 1)] = rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 0cad1636d9..87bcc874b4 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1979,8 +1979,8 @@ void MortevielleEngine::setPal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - _mem[(kAdrPictureComp * 16) + (2 * i)] = _stdPal[n][i].x; - _mem[(kAdrPictureComp * 16) + (2 * i) + 1] = _stdPal[n][i].y; + _mem[(kAdrCurrentPicture * 16) + (2 * i)] = _stdPal[n][i].x; + _mem[(kAdrCurrentPicture * 16) + (2 * i) + 1] = _stdPal[n][i].y; } break; case MODE_CGA: { @@ -2008,12 +2008,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + addr], p._tax); - WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + addr + 2], p._tay); + WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + addr], p._tax); + WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - _mem[(kAdrPictureComp * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + _mem[(kAdrCurrentPicture * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } @@ -2240,7 +2240,7 @@ void MortevielleEngine::showTitleScreen() { void MortevielleEngine::draw(int x, int y) { _mouse.hideMouse(); setPal(_numpal); - pictout(kAdrPictureComp, 0, x, y); + pictout(kAdrCurrentPicture, 0, x, y); _mouse.showMouse(); } @@ -2251,7 +2251,7 @@ void MortevielleEngine::draw(int x, int y) { void MortevielleEngine::drawRightFrame() { setPal(89); if (_currGraphicalDevice == MODE_HERCULES) { - _mem[(kAdrPictureComp * 16) + 14] = 15; + _mem[(kAdrCurrentPicture * 16) + 14] = 15; } _mouse.hideMouse(); pictout(kAdrRightFramePic, 0, 0, 0); @@ -2540,12 +2540,12 @@ void MortevielleEngine::pictout(int seg, int dep, int x, int y) { surface.decode(&_mem[(seg * 16) + dep]); if (_currGraphicalDevice == MODE_HERCULES) { - _mem[(kAdrPictureComp * 16) + 2] = 0; - _mem[(kAdrPictureComp * 16) + 32] = 15; + _mem[(kAdrCurrentPicture * 16) + 2] = 0; + _mem[(kAdrCurrentPicture * 16) + 32] = 15; } - if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrPictureComp * 16) + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&_mem[(kAdrPictureComp * 16) + 0x4138], 0x100); + if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138]) > 0x100)) + WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138], 0x100); _screenSurface.drawPicture(surface, x, y); } -- cgit v1.2.3 From d5a6c9e4ab47c9e2b0a26fee2f9aa4da22ef5679 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Jul 2013 13:16:28 +0200 Subject: MORTEVIELLE: Remove useless define --- engines/mortevielle/mortevielle.h | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 347b921efc..4fd096aa43 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -75,7 +75,6 @@ const int kAdrRightFramePic = 0x73A2; #define lo(v) ((v) & 0xff) #define hi(v) (((v) >> 8) & 0xff) #define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) -#define odd(v) (((v) % 2) == 1) // Debug channels enum { -- cgit v1.2.3 From 9bbfd7f628fd335c9c9f5e67e2b86f674ef23f1a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Jul 2013 15:16:56 +0200 Subject: MORTEVIELLE: Start working on displayPicture, misc renaming and refactoring --- engines/mortevielle/actions.cpp | 40 ++++++++++++------------- engines/mortevielle/dialogs.cpp | 8 ++--- engines/mortevielle/mortevielle.h | 11 +++---- engines/mortevielle/utils.cpp | 61 ++++++++++++++++++++++----------------- 4 files changed, 64 insertions(+), 56 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 9a29bbfd29..91d9177dc6 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -241,17 +241,17 @@ void MortevielleEngine::fctTake() { if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { putInHand(_coreVar._atticBallHoleObjectId); if ((_crep != 997) && (_crep != 139)) - aniof(2, 7); + drawAnimFrame(2, 7); } if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { putInHand(_coreVar._atticRodHoleObjectId); if ((_crep != 997) && (_crep != 139)) - aniof(2, 6); + drawAnimFrame(2, 6); } if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { putInHand(_coreVar._cellarObjectId); if ((_crep != 997) && (_crep != 139)) - aniof(2, 2); + drawAnimFrame(2, 2); } if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) putInHand(_coreVar._cryptObjectId); @@ -260,13 +260,13 @@ void MortevielleEngine::fctTake() { putInHand(_coreVar._secretPassageObjectId); if ((_crep != 997) && (_crep != 139)) { _crep = 182; - aniof(2, 1); + drawAnimFrame(2, 1); } } if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { putInHand(_coreVar._wellObjectId); if ((_crep != 997) && (_crep != 139)) - aniof(2, 1); + drawAnimFrame(2, 1); } if ((_crep != 997) && (_crep != 182) && (_crep != 139)) _crep = 999; @@ -631,7 +631,7 @@ void MortevielleEngine::fctOpen() { _speechManager.startSpeech(7, 9, 1); } _openObjects[tmpPlace] = _num; - aniof(1, _num); + drawAnimFrame(1, _num); } tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -675,14 +675,14 @@ void MortevielleEngine::fctPlace() { } else { _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 141) - aniof(1, 7); + drawAnimFrame(1, 7); } } else if (_coreVar._atticRodHoleObjectId != 0) { _crep = 188; } else { _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 159) - aniof(1, 6); + drawAnimFrame(1, 6); } } @@ -693,8 +693,8 @@ void MortevielleEngine::fctPlace() { _coreVar._cellarObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 151) { // Open hidden passage - aniof(1, 2); - aniof(1, 1); + drawAnimFrame(1, 2); + drawAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); _speechManager.startSpeech(6, -9, 1); @@ -727,16 +727,16 @@ void MortevielleEngine::fctPlace() { _menu.setDestinationText(_coreVar._currPlace); setPal(14); drawPicture(); - aniof(1, 2); - aniof(1, 1); + drawAnimFrame(1, 2); + drawAnimFrame(1, 1); alertTxt = getString(577); _dialogManager.show(alertTxt, 1); - aniof(2, 1); + drawAnimFrame(2, 1); _crep = 166; } prepareDisplayText(); } else { - aniof(2, 1); + drawAnimFrame(2, 1); _crep = 166; } return; @@ -756,7 +756,7 @@ void MortevielleEngine::fctPlace() { _crep = 188; } else if (_coreVar._selectedObjectId == 143) { _coreVar._secretPassageObjectId = 143; - aniof(1, 1); + drawAnimFrame(1, 1); } else { _crep = 1512; loseGame(); @@ -768,7 +768,7 @@ void MortevielleEngine::fctPlace() { _crep = 188; } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; - aniof(1, 1); + drawAnimFrame(1, 1); } else { _crep = 185; } @@ -856,7 +856,7 @@ void MortevielleEngine::fctAttach() { _crep = 999; if ((_coreVar._selectedObjectId == 120) || (_coreVar._selectedObjectId == 140)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; - aniof(1, 1); + drawAnimFrame(1, 1); } else _crep = 185; displayEmptyHand(); @@ -886,7 +886,7 @@ void MortevielleEngine::fctClose() { ++cx; } while ((cx <= 6) && (_num != _openObjects[cx])); if (_num == _openObjects[cx]) { - aniof(2, _num); + drawAnimFrame(2, _num); _crep = 998; _openObjects[cx] = 0; --_openObjCount; @@ -1148,7 +1148,7 @@ void MortevielleEngine::fctEnter() { else { int randVal = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, randVal, 1); - aniof(1, 1); + drawAnimFrame(1, 1); int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; @@ -1169,7 +1169,7 @@ void MortevielleEngine::fctEnter() { } else { int randVal = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, randVal, 1); - aniof(1, 1); + drawAnimFrame(1, 1); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 2536533251..f6fe9661ac 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -480,10 +480,10 @@ void DialogManager::displayIntroScreen(bool drawFrame2Fl) { * @remarks Originally called 'ani50' */ void DialogManager::displayIntroFrame2() { - _vm->_crep = _vm->animof(1, 1); - _vm->pictout(kAdrAni, _vm->_crep, 63, 12); - _vm->_crep = _vm->animof(2, 1); - _vm->pictout(kAdrAni, _vm->_crep, 63, 12); + _vm->_crep = _vm->getAnimOffset(1, 1); + _vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12); + _vm->_crep = _vm->getAnimOffset(2, 1); + _vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12); _vm->_largestClearScreen = (_vm->_resolutionScaler == 1); _vm->handleDescriptionText(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 4fd096aa43..27d590ddb7 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -434,14 +434,14 @@ private: void drawPictureWithText(); void addObjectToInventory(int objectId); void putInHand(int &objId); + void initMaxAnswer(); + void drawAnimFrame(int frameNum, int animId); void copcha(); void adzon(); void premtet(); void ajchai(); void ecr2(Common::String text); - void initMaxAnswer(); - void aniof(int ouf, int num); void tlu(int af, int ob); void mennor(); void tsuiv(); @@ -526,12 +526,13 @@ public: void testKeyboard(); int getPresence(int roomId); void displayEmptyHand(); + void displayPicture(const byte *pic, int x, int y); - void hirs(); int gettKeyPressed(); void handleDescriptionText(int f, int mesgId); - int animof(int ouf, int num); - void pictout(int seg, int dep, int x, int y); + int getAnimOffset(int frameNum, int animNum); + + void hirs(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 87bcc874b4..0dd197840c 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2240,7 +2240,7 @@ void MortevielleEngine::showTitleScreen() { void MortevielleEngine::draw(int x, int y) { _mouse.hideMouse(); setPal(_numpal); - pictout(kAdrCurrentPicture, 0, x, y); + displayPicture(&_mem[kAdrCurrentPicture * 16], x, y); _mouse.showMouse(); } @@ -2254,7 +2254,7 @@ void MortevielleEngine::drawRightFrame() { _mem[(kAdrCurrentPicture * 16) + 14] = 15; } _mouse.hideMouse(); - pictout(kAdrRightFramePic, 0, 0, 0); + displayPicture(&_mem[kAdrRightFramePic * 16], 0, 0); _mouse.showMouse(); } @@ -2535,9 +2535,13 @@ void MortevielleEngine::displayControlMenu() { _controlMenu = 0; } -void MortevielleEngine::pictout(int seg, int dep, int x, int y) { +/** + * Display picture at a given coordinate + * @remarks Originally called 'pictout' + */ +void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { GfxSurface surface; - surface.decode(&_mem[(seg * 16) + dep]); + surface.decode(pic); if (_currGraphicalDevice == MODE_HERCULES) { _mem[(kAdrCurrentPicture * 16) + 2] = 0; @@ -2575,16 +2579,15 @@ void MortevielleEngine::adzon() { /** * Returns the offset within the compressed image data resource of the desired image + * @remarks Originally called 'animof' */ -int MortevielleEngine::animof(int ouf, int num) { - int nani = _mem[(kAdrAni * 16) + 1]; - int aux = num; - if (ouf != 1) - aux += nani; - - int animof_result = (nani << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]); +int MortevielleEngine::getAnimOffset(int frameNum, int animNum) { + int animCount = _mem[(kAdrAni * 16) + 1]; + int aux = animNum; + if (frameNum != 1) + aux += animCount; - return animof_result; + return (animCount << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]); } /** @@ -2947,20 +2950,24 @@ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { _screenSurface.drawString(copy(s, 1, 25), cmd); } -void MortevielleEngine::aniof(int ouf, int num) { - if ((_caff == BATHROOM) && ((num == 4) || (num == 5))) +/** + * Display animation frame + * @remarks Originally called 'aniof' + */ +void MortevielleEngine::drawAnimFrame(int frameNum, int animId) { + if ((_caff == BATHROOM) && ((animId == 4) || (animId == 5))) return; - if ((_caff == DINING_ROOM) && (num == 7)) - num = 6; + if ((_caff == DINING_ROOM) && (animId == 7)) + animId = 6; else if (_caff == KITCHEN) { - if (num == 3) - num = 4; - else if (num == 4) - num = 3; + if (animId == 3) + animId = 4; + else if (animId == 4) + animId = 3; } - int offset = animof(ouf, num); + int offset = getAnimOffset(frameNum, animId); GfxSurface surface; surface.decode(&_mem[(kAdrAni * 16) + offset]); @@ -2987,21 +2994,21 @@ void MortevielleEngine::drawPicture() { if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { if (_openObjects[cx] != 0) - aniof(1, _openObjects[cx]); + drawAnimFrame(1, _openObjects[cx]); } if (_caff == ATTIC) { if (_coreVar._atticBallHoleObjectId == 141) - aniof(1, 7); + drawAnimFrame(1, 7); if (_coreVar._atticRodHoleObjectId == 159) - aniof(1, 6); + drawAnimFrame(1, 6); } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) - aniof(1, 2); + drawAnimFrame(1, 2); else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) - aniof(1, 1); + drawAnimFrame(1, 1); else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) - aniof(1, 1); + drawAnimFrame(1, 1); } if (_caff < ROOM26) -- cgit v1.2.3 From 91ed5173325e885f8dff9a36122a60e161cdc448 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Jul 2013 18:22:35 +0200 Subject: MORTEVIELLE: Move Current Picture out of _mem buffer, some renaming --- engines/mortevielle/actions.cpp | 40 ++++++++++++++++++------------------ engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/mortevielle.h | 4 ++-- engines/mortevielle/outtext.cpp | 15 ++++++++------ engines/mortevielle/outtext.h | 2 +- engines/mortevielle/utils.cpp | 41 +++++++++++++++++++------------------ 7 files changed, 56 insertions(+), 50 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 91d9177dc6..88eee0cf7d 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -241,17 +241,17 @@ void MortevielleEngine::fctTake() { if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) { putInHand(_coreVar._atticBallHoleObjectId); if ((_crep != 997) && (_crep != 139)) - drawAnimFrame(2, 7); + displayAnimFrame(2, 7); } if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) { putInHand(_coreVar._atticRodHoleObjectId); if ((_crep != 997) && (_crep != 139)) - drawAnimFrame(2, 6); + displayAnimFrame(2, 6); } if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) { putInHand(_coreVar._cellarObjectId); if ((_crep != 997) && (_crep != 139)) - drawAnimFrame(2, 2); + displayAnimFrame(2, 2); } if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0)) putInHand(_coreVar._cryptObjectId); @@ -260,13 +260,13 @@ void MortevielleEngine::fctTake() { putInHand(_coreVar._secretPassageObjectId); if ((_crep != 997) && (_crep != 139)) { _crep = 182; - drawAnimFrame(2, 1); + displayAnimFrame(2, 1); } } if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) { putInHand(_coreVar._wellObjectId); if ((_crep != 997) && (_crep != 139)) - drawAnimFrame(2, 1); + displayAnimFrame(2, 1); } if ((_crep != 997) && (_crep != 182) && (_crep != 139)) _crep = 999; @@ -631,7 +631,7 @@ void MortevielleEngine::fctOpen() { _speechManager.startSpeech(7, 9, 1); } _openObjects[tmpPlace] = _num; - drawAnimFrame(1, _num); + displayAnimFrame(1, _num); } tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -675,14 +675,14 @@ void MortevielleEngine::fctPlace() { } else { _coreVar._atticBallHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 141) - drawAnimFrame(1, 7); + displayAnimFrame(1, 7); } } else if (_coreVar._atticRodHoleObjectId != 0) { _crep = 188; } else { _coreVar._atticRodHoleObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 159) - drawAnimFrame(1, 6); + displayAnimFrame(1, 6); } } @@ -693,8 +693,8 @@ void MortevielleEngine::fctPlace() { _coreVar._cellarObjectId = _coreVar._selectedObjectId; if (_coreVar._selectedObjectId == 151) { // Open hidden passage - drawAnimFrame(1, 2); - drawAnimFrame(1, 1); + displayAnimFrame(1, 2); + displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); _speechManager.startSpeech(6, -9, 1); @@ -727,16 +727,16 @@ void MortevielleEngine::fctPlace() { _menu.setDestinationText(_coreVar._currPlace); setPal(14); drawPicture(); - drawAnimFrame(1, 2); - drawAnimFrame(1, 1); + displayAnimFrame(1, 2); + displayAnimFrame(1, 1); alertTxt = getString(577); _dialogManager.show(alertTxt, 1); - drawAnimFrame(2, 1); + displayAnimFrame(2, 1); _crep = 166; } prepareDisplayText(); } else { - drawAnimFrame(2, 1); + displayAnimFrame(2, 1); _crep = 166; } return; @@ -756,7 +756,7 @@ void MortevielleEngine::fctPlace() { _crep = 188; } else if (_coreVar._selectedObjectId == 143) { _coreVar._secretPassageObjectId = 143; - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); } else { _crep = 1512; loseGame(); @@ -768,7 +768,7 @@ void MortevielleEngine::fctPlace() { _crep = 188; } else if ((_coreVar._selectedObjectId == 140) || (_coreVar._selectedObjectId == 120)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); } else { _crep = 185; } @@ -856,7 +856,7 @@ void MortevielleEngine::fctAttach() { _crep = 999; if ((_coreVar._selectedObjectId == 120) || (_coreVar._selectedObjectId == 140)) { _coreVar._wellObjectId = _coreVar._selectedObjectId; - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); } else _crep = 185; displayEmptyHand(); @@ -886,7 +886,7 @@ void MortevielleEngine::fctClose() { ++cx; } while ((cx <= 6) && (_num != _openObjects[cx])); if (_num == _openObjects[cx]) { - drawAnimFrame(2, _num); + displayAnimFrame(2, _num); _crep = 998; _openObjects[cx] = 0; --_openObjCount; @@ -1148,7 +1148,7 @@ void MortevielleEngine::fctEnter() { else { int randVal = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, randVal, 1); - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; @@ -1169,7 +1169,7 @@ void MortevielleEngine::fctEnter() { } else { int randVal = (getRandomNumber(0, 10)) - 5; _speechManager.startSpeech(7, randVal, 1); - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index cb674a2317..e5edeed97a 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -937,7 +937,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { (x + surface.w) * 2, (y + surface.h) * 2)); // Get a lookup for the palette mapping - const byte *paletteMap = &_vm->_mem[(kAdrCurrentPicture * 16) + 2]; + const byte *paletteMap = &_vm->_curPict[2]; // Loop through writing for (int yp = 0; yp < surface.h; ++yp) { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c13eba4a4a..f98832f984 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -101,9 +101,11 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _day = 0; memset(_mem, 0, sizeof(_mem)); + _curPict = nullptr; } MortevielleEngine::~MortevielleEngine() { + free(_curPict); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 27d590ddb7..91a65c1e0c 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -64,7 +64,6 @@ namespace Mortevielle { * 7000:4138 - width, height, x/y offset of decoded image */ const int kAdrMusic = 0x5000; -const int kAdrCurrentPicture = 0x7000; const int kAdrCompMusicBuf1 = 0x7414; const int kAdrCompMusicBuf2 = 0x3800; @@ -435,7 +434,7 @@ private: void addObjectToInventory(int objectId); void putInHand(int &objId); void initMaxAnswer(); - void drawAnimFrame(int frameNum, int animId); + void displayAnimFrame(int frameNum, int animId); void copcha(); void adzon(); @@ -477,6 +476,7 @@ public: // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; + byte *_curPict; Debugger _debugger; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 311a4c2ee4..37ea06eb33 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -125,17 +125,20 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int } /** - * Load DES file + * Load DES (picture container) file * @remarks Originally called 'chardes' */ -void TextHandler::loadDesFile(Common::String filename, int32 skipSize, int length) { +void TextHandler::loadPictureFile(Common::String filename, int32 skipSize, int length) { Common::File f; if (!f.open(filename)) error("Missing file %s", filename.c_str()); assert(skipSize + length <= f.size()); + + free(_vm->_curPict); + _vm->_curPict = (byte *)malloc(sizeof(byte) * length); f.seek(skipSize); - f.read(&_vm->_mem[(kAdrCurrentPicture * 16)], length); + f.read(_vm->_curPict, length); f.close(); } @@ -257,10 +260,10 @@ void TextHandler::taffich() { _vm->_maff = a; npal = a + 37; } - loadDesFile(filename, drawingStartPos, drawingSize); + loadPictureFile(filename, drawingStartPos, drawingSize); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&_vm->_mem[(kAdrCurrentPicture * 16) + 2 + (i << 1)]); + int palh = READ_LE_UINT16(&_vm->_curPict[2 + (i << 1)]); alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); } for (int i = 0; i <= 15; ++i) { @@ -269,7 +272,7 @@ void TextHandler::taffich() { if (alllum[j] > alllum[k]) k = j; } - _vm->_mem[(kAdrCurrentPicture * 16) + 2 + (k << 1)] = rang[i]; + _vm->_curPict[2 + (k << 1)] = rang[i]; alllum[k] = -1; } } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 514aae3a4c..1689e01714 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -42,7 +42,7 @@ private: public: void setParent(MortevielleEngine *vm); void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); - void loadDesFile(Common::String filename, int32 skipSize, int length); + void loadPictureFile(Common::String filename, int32 skipSize, int length); void loadAniFile(Common::String filename, int32 skipSize, int length); void taffich(); }; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 0dd197840c..c6dd3f90e7 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1979,8 +1979,8 @@ void MortevielleEngine::setPal(int n) { case MODE_EGA: case MODE_AMSTRAD1512: for (int i = 1; i <= 16; ++i) { - _mem[(kAdrCurrentPicture * 16) + (2 * i)] = _stdPal[n][i].x; - _mem[(kAdrCurrentPicture * 16) + (2 * i) + 1] = _stdPal[n][i].y; + _curPict[(2 * i)] = _stdPal[n][i].x; + _curPict[(2 * i) + 1] = _stdPal[n][i].y; } break; case MODE_CGA: { @@ -2008,12 +2008,12 @@ void MortevielleEngine::setPal(int n) { void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + addr], p._tax); - WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + addr + 2], p._tay); + WRITE_LE_UINT16(&_curPict[addr], p._tax); + WRITE_LE_UINT16(&_curPict[addr + 2], p._tay); addr += 4; for (int i = 0; i < p._tax; ++i) { for (int j = 0; j < p._tay; ++j) - _mem[(kAdrCurrentPicture * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + _curPict[addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; } } @@ -2240,7 +2240,7 @@ void MortevielleEngine::showTitleScreen() { void MortevielleEngine::draw(int x, int y) { _mouse.hideMouse(); setPal(_numpal); - displayPicture(&_mem[kAdrCurrentPicture * 16], x, y); + displayPicture(_curPict, x, y); _mouse.showMouse(); } @@ -2250,9 +2250,9 @@ void MortevielleEngine::draw(int x, int y) { */ void MortevielleEngine::drawRightFrame() { setPal(89); - if (_currGraphicalDevice == MODE_HERCULES) { - _mem[(kAdrCurrentPicture * 16) + 14] = 15; - } + if (_currGraphicalDevice == MODE_HERCULES) + _curPict[14] = 15; + _mouse.hideMouse(); displayPicture(&_mem[kAdrRightFramePic * 16], 0, 0); _mouse.showMouse(); @@ -2544,12 +2544,13 @@ void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { surface.decode(pic); if (_currGraphicalDevice == MODE_HERCULES) { - _mem[(kAdrCurrentPicture * 16) + 2] = 0; - _mem[(kAdrCurrentPicture * 16) + 32] = 15; + _curPict[2] = 0; + _curPict[32] = 15; } - if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138]) > 0x100)) - WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138], 0x100); + // CHECKME: Is it useful? + // if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138]) > 0x100)) + // WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138], 0x100); _screenSurface.drawPicture(surface, x, y); } @@ -2954,7 +2955,7 @@ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { * Display animation frame * @remarks Originally called 'aniof' */ -void MortevielleEngine::drawAnimFrame(int frameNum, int animId) { +void MortevielleEngine::displayAnimFrame(int frameNum, int animId) { if ((_caff == BATHROOM) && ((animId == 4) || (animId == 5))) return; @@ -2994,21 +2995,21 @@ void MortevielleEngine::drawPicture() { if ((_caff < 30) || (_caff > 32)) { for (int cx = 1; cx <= 6; ++cx) { if (_openObjects[cx] != 0) - drawAnimFrame(1, _openObjects[cx]); + displayAnimFrame(1, _openObjects[cx]); } if (_caff == ATTIC) { if (_coreVar._atticBallHoleObjectId == 141) - drawAnimFrame(1, 7); + displayAnimFrame(1, 7); if (_coreVar._atticRodHoleObjectId == 159) - drawAnimFrame(1, 6); + displayAnimFrame(1, 6); } else if ((_caff == CELLAR) && (_coreVar._cellarObjectId == 151)) - drawAnimFrame(1, 2); + displayAnimFrame(1, 2); else if ((_caff == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); else if ((_caff == WELL) && (_coreVar._wellObjectId != 0)) - drawAnimFrame(1, 1); + displayAnimFrame(1, 1); } if (_caff < ROOM26) -- cgit v1.2.3 From 11df17329283b03280ec145d7909e35e4e0d28e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Jul 2013 18:24:28 +0200 Subject: MORTEVIELLE: Remove unused code from the original compression scheme --- engines/mortevielle/utils.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index c6dd3f90e7..9cda39e9f8 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2548,10 +2548,6 @@ void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { _curPict[32] = 15; } - // CHECKME: Is it useful? - // if ((_caff != 51) && (READ_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138]) > 0x100)) - // WRITE_LE_UINT16(&_mem[(kAdrCurrentPicture * 16) + 0x4138], 0x100); - _screenSurface.drawPicture(surface, x, y); } -- cgit v1.2.3 From eb998776ac14cfd11a7baca5748dfad592fd9cd0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 00:50:08 +0200 Subject: MORTEVIELLE: Fix box height when searching --- engines/mortevielle/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 9cda39e9f8..a8394f5015 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2981,7 +2981,7 @@ void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { draw(60, 33); - _screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box + _screenSurface.drawBox(118, 32, 291, 122, 15); // Medium box } else if (_caff > 69) { draw(112, 48); // Heads _screenSurface.drawBox(222, 47, 155, 92, 15); -- cgit v1.2.3 From 3f191e8f0fb3fb4dbfac8e09fc39bf33557ab4ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 09:49:43 +0200 Subject: MORTEVIELLE: Fix the German 2nd intro screen (original bug) --- engines/mortevielle/outtext.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 37ea06eb33..9bc6d8ffc8 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -129,10 +129,17 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int * @remarks Originally called 'chardes' */ void TextHandler::loadPictureFile(Common::String filename, int32 skipSize, int length) { + warning("%s - pos %d size %d", filename.c_str(), skipSize, length); Common::File f; if (!f.open(filename)) error("Missing file %s", filename.c_str()); + // HACK: The original game contains a bug in the intro screen, in German DOS version. + // The size specified in the fxx array is wrong (too short). In order to fix it, we are using + // the value -1 to force a variable read length. + if (length < 0) + length = f.size() - skipSize; + assert(skipSize + length <= f.size()); free(_vm->_curPict); @@ -251,11 +258,14 @@ void TextHandler::taffich() { filename = "DZZ.mor"; if (a == 50) { + // First intro screen drawingStartPos = 0; drawingSize = _vm->_drawingSizeArr[87]; } else { // a == 51 + // Second intro screen drawingStartPos = _vm->_drawingSizeArr[87]; - drawingSize = _vm->_drawingSizeArr[88]; + // HACK: Force a variable size in order to fix the wrong size used by the German version + drawingSize = -1; } _vm->_maff = a; npal = a + 37; -- cgit v1.2.3 From 31dffa00e094f0782561fe3f5a342caae67dfdfd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 09:59:25 +0200 Subject: MORTEVIELLE: Remove the check on German for the intro filename by using an alternate filename in loading code --- engines/mortevielle/outtext.cpp | 26 ++++++++++++-------------- engines/mortevielle/outtext.h | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 9bc6d8ffc8..85cc5809dc 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -128,16 +128,16 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int * Load DES (picture container) file * @remarks Originally called 'chardes' */ -void TextHandler::loadPictureFile(Common::String filename, int32 skipSize, int length) { - warning("%s - pos %d size %d", filename.c_str(), skipSize, length); +void TextHandler::loadPictureFile(Common::String filename, Common::String altFilename, int32 skipSize, int length) { Common::File f; - if (!f.open(filename)) - error("Missing file %s", filename.c_str()); - - // HACK: The original game contains a bug in the intro screen, in German DOS version. + if (!f.open(filename)) { + if (!f.open(altFilename)) + error("Missing file: Either %s or %s", filename.c_str(), altFilename.c_str()); + } + // HACK: The original game contains a bug in the 2nd intro screen, in German DOS version. // The size specified in the fxx array is wrong (too short). In order to fix it, we are using // the value -1 to force a variable read length. - if (length < 0) + if (length == -1) length = f.size() - skipSize; assert(skipSize + length <= f.size()); @@ -224,7 +224,7 @@ void TextHandler::taffich() { _vm->_destinationOk = true; _vm->_mouse.hideMouse(); drawingStartPos = 0; - Common::String filename; + Common::String filename, altFilename; if ((a != 50) && (a != 51)) { _vm->_maff = a; @@ -250,12 +250,10 @@ void TextHandler::taffich() { drawingStartPos += _vm->_drawingSizeArr[cx]; drawingSize = _vm->_drawingSizeArr[a]; - filename = "DXX.mor"; + altFilename = filename = "DXX.mor"; } else { - if (_vm->getLanguage() == Common::DE_DEU) - filename = "DZZALL"; - else - filename = "DZZ.mor"; + filename = "DZZ.mor"; + altFilename = "DZZALL"; if (a == 50) { // First intro screen @@ -270,7 +268,7 @@ void TextHandler::taffich() { _vm->_maff = a; npal = a + 37; } - loadPictureFile(filename, drawingStartPos, drawingSize); + loadPictureFile(filename, altFilename, drawingStartPos, drawingSize); if (_vm->_currGraphicalDevice == MODE_HERCULES) { for (int i = 0; i <= 15; ++i) { int palh = READ_LE_UINT16(&_vm->_curPict[2 + (i << 1)]); diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 1689e01714..1c69d9b9b4 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -42,7 +42,7 @@ private: public: void setParent(MortevielleEngine *vm); void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); - void loadPictureFile(Common::String filename, int32 skipSize, int length); + void loadPictureFile(Common::String filename, Common::String altFilename, int32 skipSize, int length); void loadAniFile(Common::String filename, int32 skipSize, int length); void taffich(); }; -- cgit v1.2.3 From 51f69666562c86708466c85485ef2fe062f9af23 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 10:10:09 +0200 Subject: MORTEVIELLE: Use a specific buffer instead of _mem for the right frame --- engines/mortevielle/mortevielle.h | 3 +-- engines/mortevielle/utils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 91a65c1e0c..ae35b20554 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -67,7 +67,6 @@ const int kAdrMusic = 0x5000; const int kAdrCompMusicBuf1 = 0x7414; const int kAdrCompMusicBuf2 = 0x3800; -const int kAdrRightFramePic = 0x73A2; #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) @@ -477,7 +476,7 @@ public: // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; byte *_curPict; - + byte _rightFramePict[1664]; Debugger _debugger; ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a8394f5015..36b2d613ca 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2254,7 +2254,7 @@ void MortevielleEngine::drawRightFrame() { _curPict[14] = 15; _mouse.hideMouse(); - displayPicture(&_mem[kAdrRightFramePic * 16], 0, 0); + displayPicture(_rightFramePict, 0, 0); _mouse.showMouse(); } @@ -2570,7 +2570,7 @@ void MortevielleEngine::adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(&_mem[kAdrRightFramePic * 16], 1664); + f.read(_rightFramePict, 1664); f.close(); } -- cgit v1.2.3 From e86ec8bc819b60ef026450630d69b2bdd481b97c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 10:24:25 +0200 Subject: MORTEVIELLE: Use variable size for _rightFramePict in order to handle the different sizes of the Amiga and Atari versions --- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/mortevielle.h | 3 ++- engines/mortevielle/utils.cpp | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index f98832f984..7e73d116dd 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -102,10 +102,12 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g memset(_mem, 0, sizeof(_mem)); _curPict = nullptr; + _rightFramePict = nullptr; } MortevielleEngine::~MortevielleEngine() { free(_curPict); + free(_rightFramePict); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index ae35b20554..dbd0449d9a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -476,7 +476,8 @@ public: // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; byte *_curPict; - byte _rightFramePict[1664]; + byte *_rightFramePict; + Debugger _debugger; ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 36b2d613ca..f82f6f7837 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2570,7 +2570,9 @@ void MortevielleEngine::adzon() { if (!f.open("dec.mor")) error("Missing file - dec.mor"); - f.read(_rightFramePict, 1664); + free(_rightFramePict); + _rightFramePict = (byte *)malloc(sizeof(byte) * f.size()); + f.read(_rightFramePict, f.size()); f.close(); } -- cgit v1.2.3 From 8e2fe73afab1b27d70c4cd64c66b70673df5ea98 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 10:32:21 +0200 Subject: MORTEVIELLE: Use a specific buffer instead of _mem for the animations --- engines/mortevielle/dialogs.cpp | 4 ++-- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/mortevielle.h | 3 ++- engines/mortevielle/outtext.cpp | 5 ++++- engines/mortevielle/outtext.h | 2 -- engines/mortevielle/utils.cpp | 6 +++--- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index f6fe9661ac..ba5d984886 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -481,9 +481,9 @@ void DialogManager::displayIntroScreen(bool drawFrame2Fl) { */ void DialogManager::displayIntroFrame2() { _vm->_crep = _vm->getAnimOffset(1, 1); - _vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12); + _vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12); _vm->_crep = _vm->getAnimOffset(2, 1); - _vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12); + _vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12); _vm->_largestClearScreen = (_vm->_resolutionScaler == 1); _vm->handleDescriptionText(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7e73d116dd..8eea0cabb5 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -102,11 +102,13 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g memset(_mem, 0, sizeof(_mem)); _curPict = nullptr; + _curAnim = nullptr; _rightFramePict = nullptr; } MortevielleEngine::~MortevielleEngine() { free(_curPict); + free(_curAnim); free(_rightFramePict); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index dbd0449d9a..94e9716e7b 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -476,8 +476,9 @@ public: // TODO: Replace the following with proper implementations, or refactor out the code using them byte _mem[65536 * 16]; byte *_curPict; + byte *_curAnim; byte *_rightFramePict; - + Debugger _debugger; ScreenSurface _screenSurface; PaletteManager _paletteManager; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 85cc5809dc..99c06c7c4c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -159,8 +159,11 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt error("Missing file - %s", filename.c_str()); assert(skipSize + length <= f.size()); + + free(_vm->_curAnim); + _vm->_curAnim = (byte *)malloc(sizeof(byte) * length); f.seek(skipSize); - f.read(&_vm->_mem[(kAdrAni * 16)], length); + f.read(_vm->_curAnim, length); f.close(); } diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 1c69d9b9b4..44868036d5 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -33,8 +33,6 @@ namespace Mortevielle { class MortevielleEngine; -const int kAdrAni = 0x7314; - class TextHandler { private: MortevielleEngine *_vm; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index f82f6f7837..001b2d3baf 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2581,12 +2581,12 @@ void MortevielleEngine::adzon() { * @remarks Originally called 'animof' */ int MortevielleEngine::getAnimOffset(int frameNum, int animNum) { - int animCount = _mem[(kAdrAni * 16) + 1]; + int animCount = _curAnim[1]; int aux = animNum; if (frameNum != 1) aux += animCount; - return (animCount << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]); + return (animCount << 2) + 2 + READ_BE_UINT16(&_curAnim[aux << 1]); } /** @@ -2969,7 +2969,7 @@ void MortevielleEngine::displayAnimFrame(int frameNum, int animId) { int offset = getAnimOffset(frameNum, animId); GfxSurface surface; - surface.decode(&_mem[(kAdrAni * 16) + offset]); + surface.decode(&_curAnim[offset]); _screenSurface.drawPicture(surface, 0, 12); prepareScreenType1(); -- cgit v1.2.3 From db10ddace466522062a18a0c9079292225fb53d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Jul 2013 15:47:31 +0200 Subject: MORTEVIELLE: Use a specific buffer instead of _mem for noise5 file --- engines/mortevielle/speech.cpp | 11 ++++++++--- engines/mortevielle/speech.h | 4 +++- engines/mortevielle/utils.cpp | 5 ++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 7fe8c54f2d..3a42c957c8 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -68,6 +68,11 @@ SpeechManager::SpeechManager() { _queue[i]._freq = 0; _queue[i]._rep = 0; } + _noise5Buf = nullptr; +} + +SpeechManager::~SpeechManager() { + free(_noise5Buf); } void SpeechManager::spfrac(int wor) { @@ -194,10 +199,10 @@ void SpeechManager::loadNoise() { if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); - f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); + f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); // 32000 for (i = 0; i <= 19013; ++i) - _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _vm->_mem[(kAdrNoise5 * 16) + i]; - f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); + _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _noise5Buf[i]; + f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); // 19072 f.close(); } diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index b3d7c15203..ef3211dad9 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -37,7 +37,6 @@ namespace Mortevielle { const int kAdrNoise = 0x5cb0;/*2C00;*/ const int kAdrNoise1 = 0x6924; const int kAdrNoise3 = 0x6ba6;/*3AF6;*/ -const int kAdrNoise5 = 0x3b50; const int kAdrTroct = 0x406b; const int kAdrWord = 0x4000; const int kOffsetB1 = 6; @@ -79,8 +78,11 @@ public: int16 *_cfiphBuffer; int _tbi[256]; int _mlec; + byte *_noise5Buf; + int _noise5Size; SpeechManager(); + ~SpeechManager(); void setParent(MortevielleEngine *vm); void spfrac(int wor); void charg_car(int &currWordNumb); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 001b2d3baf..2211a6d569 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2134,7 +2134,10 @@ void MortevielleEngine::loadBRUIT5() { if (!f.open("bruit5")) error("Missing file - bruit5"); - f.read(&_mem[kAdrNoise5 * 16], 149 * 128); + free(_speechManager._noise5Buf); + _speechManager._noise5Size = f.size(); + _speechManager._noise5Buf = (byte *)malloc(sizeof(byte) * _speechManager._noise5Size); + f.read(_speechManager._noise5Buf, _speechManager._noise5Size); f.close(); } -- cgit v1.2.3 From bfcebeac7d755a0e6700448604b7a51f3b8ec672 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Jul 2013 21:57:42 -0400 Subject: TSAGE: Added new R2R conversation decoding logic --- engines/tsage/converse.cpp | 70 ++++++++++++++++++++----- engines/tsage/converse.h | 3 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 16 +++--- engines/tsage/ringworld2/ringworld2_logic.h | 8 +-- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 +- engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 6 files changed, 75 insertions(+), 28 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index bae0249eaa..8fc25f9a6d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -416,7 +416,7 @@ SequenceManager *SequenceManager::globalManager() { ConversationChoiceDialog::ConversationChoiceDialog() { _stdColor = 23; _highlightColor = g_globals->_scenePalette._colors.background; - _fontNumber = 1; + _fontNumber = (g_vm->getGameID() == GType_Ringworld2) ? 3 : 1; _savedFgColor = _savedFontNumber = 0; _selectedIndex = 0; } @@ -513,7 +513,11 @@ void ConversationChoiceDialog::draw() { // Fill in the contents of the entire dialog _gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - drawFrame(); + + if (g_vm->getGameID() == GType_Ringworld2) + GfxElement::drawFrame(); + else + drawFrame(); _gfxManager._bounds = tempRect; _gfxManager._font._colors.foreground = _stdColor; @@ -551,8 +555,8 @@ void Obj44::load(const byte *dataP) { _callbackId[idx] = s.readSint16LE(); if (g_vm->getGameID() == GType_Ringworld2) { - _field16 = s.readSint16LE(); - s.skip(20); + for (int i = 0; i < 11; ++i) + _field16[i] = s.readSint16LE(); } else { s.skip(4); } @@ -580,7 +584,9 @@ void Obj44::synchronize(Serializer &s) { s.syncAsSint16LE(_lookupIndex); s.syncAsSint16LE(_field6); s.syncAsSint16LE(_speakerMode); - s.syncAsSint16LE(_field16); + + for (int i = 0; i < 11; ++i) + s.syncAsSint16LE(_field16[i]); } } @@ -787,25 +793,65 @@ void StripManager::signal() { // Build up a list of script entries int idx; - if (g_vm->getGameID() == GType_Ringworld2 && obj44._field16) { + if ((g_vm->getGameID() == GType_Ringworld2) && obj44._field16[0]) { // Special loading mode used in Return to Ringworld for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) { - int objIndex = _lookupList[obj44._field16 - 1]; - - if (!obj44._list[objIndex]._id) + int f16Index = _lookupList[obj44._field16[0] - 1]; + Obj0A &entry = obj44._list[obj44._field16[f16Index]]; + if (!entry._id) break; // Get the next one - choiceList.push_back((const char *)&_script[0] + obj44._list[objIndex]._scriptOffset); + choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); } } else { // Standard choices loading - for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) { + for (idx = 0; idx < OBJ0A_LIST_SIZE; ++idx) { if (!obj44._list[idx]._id) break; // Get the next one - choiceList.push_back((const char *)&_script[0] + obj44._list[idx]._scriptOffset); + const char *choiceStr = (const char *)&_script[0] + obj44._list[idx]._scriptOffset; + + if (!*choiceStr) { + // Choice is empty + assert(g_vm->getGameID() == GType_Ringworld2); + + if (obj44._list[1]._id) { + // it's a reference to another list slot + int listId = obj44._list[idx]._id; + + int obj44Idx = 0; + while (_obj44List[obj44Idx]._id != listId) + ++obj44Idx; + + if (_obj44List[obj44Idx]._field16[0]) { + int f16Index = _lookupList[_obj44List[obj44Idx]._field16[0] - 1]; + listId = _obj44List[obj44Idx]._field16[f16Index]; + + if (_lookupList[_obj44List[obj44Idx]._field16[0] - 1]) { + int listIdx = 0; + while (_obj44List[obj44Idx]._list[listIdx]._id != listId) + ++listIdx; + + choiceStr = (const char *)&_script[0] + _obj44List[obj44Idx]._list[listIdx]._scriptOffset; + } else { + for (int listIdx = 0; listIdx < OBJ0A_LIST_SIZE; ++listIdx) { + obj44._list[listIdx]._id = obj44._list[listIdx + 1]._id; + obj44._list[listIdx]._scriptOffset = obj44._list[listIdx + 1]._scriptOffset; + + if (!obj44._list[listIdx + 1]._id) + obj44._list[listIdx]._id = 0; + } + + continue; + } + } + } + } + + // Add entry to the list + choiceList.push_back(choiceStr); } } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index accd2d49cd..66e9982762 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -190,7 +190,8 @@ public: // Return to Ringworld specific field int _mode; int _lookupValue, _lookupIndex, _field6; - int _speakerMode, _field16; + int _speakerMode; + int _field16[11]; public: void load(const byte *dataP); virtual void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 70749f6883..ac6ba523f6 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2115,11 +2115,11 @@ void AnimationPlayerExt::synchronize(Serializer &s) { /*--------------------------------------------------------------------------*/ -ModalDialog::ModalDialog() { +ModalWindow::ModalWindow() { _field20 = 0; } -void ModalDialog::remove() { +void ModalWindow::remove() { R2_GLOBALS._sceneItems.remove(&_object1); _object1.remove(); @@ -2128,13 +2128,13 @@ void ModalDialog::remove() { --R2_GLOBALS._insetUp; } -void ModalDialog::synchronize(Serializer &s) { +void ModalWindow::synchronize(Serializer &s) { SceneArea::synchronize(s); s.syncAsByte(_field20); } -void ModalDialog::process(Event &event) { +void ModalWindow::process(Event &event) { if (_field20 != R2_GLOBALS._insetUp) return; @@ -2157,7 +2157,7 @@ void ModalDialog::process(Event &event) { } } -void ModalDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; _object1.postInit(); @@ -2170,7 +2170,7 @@ void ModalDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, _field20 = R2_GLOBALS._insetUp; } -void ModalDialog::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void ModalWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { _object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -2426,7 +2426,7 @@ void ScannerDialog::remove() { _obj6.remove(); _obj7.remove(); - ModalDialog::remove(); + ModalWindow::remove(); } void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { @@ -2435,7 +2435,7 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._events.setCursor(CURSOR_USE); - ModalDialog::proc12(visage, stripFrameNum, frameNum, posX, posY); + ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY); proc13(100, -1, -1, -1); _talkButton.setup(1); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 42ca071e33..2cf48f3cf3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -446,22 +446,22 @@ public: virtual void synchronize(Serializer &s); }; -class ModalDialog: public SceneArea { +class ModalWindow: public SceneArea { public: SceneActor _object1; byte _field20; public: - ModalDialog(); + ModalWindow(); virtual void remove(); virtual void synchronize(Serializer &s); - virtual Common::String getClassName() { return "ModalDialog"; } + virtual Common::String getClassName() { return "ModalWindow"; } virtual void process(Event &event); virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; -class ScannerDialog: public ModalDialog { +class ScannerDialog: public ModalWindow { class Button: public SceneActor { private: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index ef53ddf302..840172335f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2597,8 +2597,8 @@ void Scene250::synchronize(Serializer &s) { } void Scene250::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(250); + SceneExt::postInit(); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setVisage(10); @@ -3050,7 +3050,7 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - if (R2_GLOBALS.getFlag(44)) { + if (!R2_GLOBALS.getFlag(44)) { if (!R2_GLOBALS.getFlag(38)) { R2_GLOBALS._sound1.play(69); scene->_stripId = 181; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index a2865a4b94..0da6b3f93d 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -120,7 +120,7 @@ public: class Scene1200 : public SceneExt { enum CrawlDirection { CRAWL_EAST = 1, CRAWL_WEST = 2, CRAWL_SOUTH = 3, CRAWL_NORTH = 4 }; - class LaserPanel: public ModalDialog { + class LaserPanel: public ModalWindow { public: class Jumper : public SceneActorExt { public: -- cgit v1.2.3 From 8009b2ebd87ca546741a391e399f3633576b255b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 26 Jul 2013 13:10:54 +0200 Subject: MORTEVIELLE: Remove another use of _mem --- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/speech.cpp | 4 +--- engines/mortevielle/utils.cpp | 13 ++++++++----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 8eea0cabb5..616bee1a67 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -104,12 +104,14 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _curPict = nullptr; _curAnim = nullptr; _rightFramePict = nullptr; + _compMusicBuf2 = nullptr; } MortevielleEngine::~MortevielleEngine() { free(_curPict); free(_curAnim); free(_rightFramePict); + free(_compMusicBuf2); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 94e9716e7b..23003719ba 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -66,7 +66,6 @@ namespace Mortevielle { const int kAdrMusic = 0x5000; const int kAdrCompMusicBuf1 = 0x7414; -const int kAdrCompMusicBuf2 = 0x3800; #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) @@ -478,6 +477,7 @@ public: byte *_curPict; byte *_curAnim; byte *_rightFramePict; + byte *_compMusicBuf2; Debugger _debugger; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 3a42c957c8..899cd80472 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -194,13 +194,12 @@ void SpeechManager::loadPhonemeSounds() { */ void SpeechManager::loadNoise() { Common::File f; - int i; if (!f.open("bruits")) //Translation: "noise" error("Missing file - bruits"); f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); // 32000 - for (i = 0; i <= 19013; ++i) + for (int i = 0; i < _noise5Size; ++i) _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _noise5Buf[i]; f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); // 19072 @@ -582,7 +581,6 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { switch (typ) { case 1: loadNoise(); - /*if zuul then zzuul(kAdrNoise,0,1095);*/ regenbruit(); break; case 2: diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 2211a6d569..7a8306067d 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2193,14 +2193,17 @@ void MortevielleEngine::music() { _reloadCFIEC = true; - Common::File fic; - if (!fic.open("mort.img")) + Common::File f; + if (!f.open("mort.img")) error("Missing file - mort.img"); - fic.read(&_mem[kAdrCompMusicBuf2 * 16], 623 * 128); - fic.close(); + free(_compMusicBuf2); + int size = f.size(); + _compMusicBuf2 = (byte *)malloc(sizeof(byte) * size); + f.read(_compMusicBuf2, size); + f.close(); - _soundManager.decodeMusic(&_mem[kAdrCompMusicBuf2 * 16], &_mem[kAdrMusic * 16], 623); + _soundManager.decodeMusic(_compMusicBuf2, &_mem[kAdrMusic * 16], size / 128); _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); -- cgit v1.2.3 From 0b8db36af5aa5305f3c420255fb7faa5f7b9f4e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 27 Jul 2013 00:08:56 +0200 Subject: MORTEVIELLE: Remove another use of _mem --- engines/mortevielle/mortevielle.cpp | 2 ++ engines/mortevielle/mortevielle.h | 3 +-- engines/mortevielle/speech.cpp | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 616bee1a67..b4b46a4286 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -104,6 +104,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _curPict = nullptr; _curAnim = nullptr; _rightFramePict = nullptr; + _compMusicBuf1 = nullptr; _compMusicBuf2 = nullptr; } @@ -111,6 +112,7 @@ MortevielleEngine::~MortevielleEngine() { free(_curPict); free(_curAnim); free(_rightFramePict); + free(_compMusicBuf1); free(_compMusicBuf2); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 23003719ba..6f5d4b4fac 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -65,8 +65,6 @@ namespace Mortevielle { */ const int kAdrMusic = 0x5000; -const int kAdrCompMusicBuf1 = 0x7414; - #define ord(v) ((int) v) #define chr(v) ((unsigned char) v) #define lo(v) ((v) & 0xff) @@ -477,6 +475,7 @@ public: byte *_curPict; byte *_curAnim; byte *_rightFramePict; + byte *_compMusicBuf1; byte *_compMusicBuf2; Debugger _debugger; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 899cd80472..445f7faffb 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -162,13 +162,15 @@ void SpeechManager::regenbruit() { */ void SpeechManager::loadMusicSound() { Common::File f; - if (!f.open("sonmus.mor")) error("Missing file - sonmus.mor"); - f.read(&_vm->_mem[kAdrCompMusicBuf1 * 16], 273 * 128); + free(_vm->_compMusicBuf1); + int size = f.size(); + _vm->_compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); + f.read(_vm->_compMusicBuf1, size); - _vm->_soundManager.decodeMusic(&_vm->_mem[kAdrCompMusicBuf1 * 16], &_vm->_mem[kAdrNoise * 16], 273); + _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, &_vm->_mem[kAdrNoise * 16], size / 128); f.close(); } -- cgit v1.2.3 From dee719390c0bf6c966b99126f122c7a21e3b33a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Jul 2013 21:57:02 -0400 Subject: HOPKINS: Move breakout highscore table to savegames, and fixes to display --- engines/hopkins/computer.cpp | 53 +++++++++++++++++++++++++++----------------- engines/hopkins/computer.h | 2 +- engines/hopkins/globals.cpp | 2 ++ engines/hopkins/globals.h | 1 + engines/hopkins/hopkins.cpp | 2 -- engines/hopkins/saveload.cpp | 12 ++++------ engines/hopkins/saveload.h | 3 +-- 7 files changed, 42 insertions(+), 33 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index f7b923badf..82e0dd0a06 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -58,7 +58,7 @@ ComputerManager::ComputerManager(HopkinsEngine *vm) { _minBreakoutMoveSpeed = 0; _maxBreakoutMoveSpeed = 0; _lastBreakoutMoveSpeed = 0; - _breakoutHiscore = 0; + _lowestHiScore = 0; } /** @@ -578,27 +578,28 @@ void ComputerManager::displayGamesSubMenu() { * Load Highscore from file */ void ComputerManager::loadHiscore() { - byte *ptr = _vm->_globals->allocMemory(100); - _vm->_saveLoad->load("HISCORE.DAT", ptr); + const byte *ptr = _vm->_globals->_highScoreData; for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { - for (int i = 0; i < 5; ++i) { + _score[scoreIndex]._name = " "; + _score[scoreIndex]._score = " "; + + for (int i = 0; i < 6; ++i) { char nextChar = ptr[(16 * scoreIndex) + i]; if (!nextChar) nextChar = ' '; - _score[scoreIndex]._name += nextChar; + _score[scoreIndex]._name.setChar(nextChar, i); } for (int i = 0; i < 9; ++i) { char nextChar = ptr[(scoreIndex * 16) + 6 + i]; if (!nextChar) nextChar = '0'; - _score[scoreIndex]._score += nextChar; + _score[scoreIndex]._score.setChar(nextChar, i); } } - _vm->_globals->freeMemory(ptr); - _breakoutHiscore = atol(_score[5]._score.c_str()); + _lowestHiScore = atol(_score[5]._score.c_str()); } /** @@ -779,7 +780,7 @@ void ComputerManager::playBreakout() { _vm->_events->mouseOn(); _vm->_objectsMan->removeSprite(0); _vm->_objectsMan->removeSprite(1); - if (_breakoutScore > _breakoutHiscore) + if (_breakoutScore > _lowestHiScore) getScoreName(); if (displayHiscores() != 1) break; @@ -823,11 +824,11 @@ int ComputerManager::displayHiscores() { yp += 46; // Display the characters of the name - for (int i = 0; i <= 5; i++) + for (int i = 0; i < 6; i++) displayHiscoreLine(ptr, 9 * i + 69, yp, _score[scoreIndex]._name[i]); // Display the digits of the score - for (int i = 0; i <= 8; i++) + for (int i = 0; i < 9; i++) displayHiscoreLine(ptr, 9 * i + 199, yp, _score[scoreIndex]._score[i]); } @@ -864,6 +865,19 @@ void ComputerManager::getScoreName() { _vm->_graphicsMan->setColorPercentage(254, 0, 0, 0); byte *ptr = _vm->_fileIO->loadFile("ALPHA.SPR"); _vm->_graphicsMan->fadeInBreakout(); + + // Figure out the line to put the new high score on + int scoreLine = 0; + while (scoreLine < 5 && _breakoutScore < atol(_score[scoreLine]._score.c_str())) + ++scoreLine; + + // If it's not the lasat line, move the lines down + for (int line = 5; line > scoreLine; --line) { + _score[line]._name = _score[line - 1]._name; + _score[line]._score = _score[line - 1]._score; + } + + // Get the name for the new high score for (int strPos = 0; strPos <= 4; strPos++) { displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1); @@ -873,13 +887,15 @@ void ComputerManager::getScoreName() { if ((curChar > '9') && (curChar < 'A')) curChar = ' '; - _score[5]._name.setChar(curChar, strPos); + _score[scoreLine]._name.setChar(curChar, strPos); displayHiscoreLine(ptr, 9 * strPos + 140, 78, curChar); for (int idx = 0; idx < 12; ++idx) _vm->_events->refreshScreenAndEvents(); } - _score[5]._score = " "; + + // Set up the new score + _score[scoreLine]._score = " "; char score[16]; sprintf(score, "%d", _breakoutScore); @@ -888,8 +904,8 @@ void ComputerManager::getScoreName() { ++scoreLen; while (score[scoreLen]); - for (int i = scoreLen, scorePos = 8; i >= 0; i--) { - _score[5]._score.setChar(score[i], scorePos--); + for (int i = scoreLen - 1, scorePos = 8; i >= 0; i--) { + _score[scoreLine]._score.setChar(score[i], scorePos--); } _vm->_graphicsMan->fadeOutBreakout(); _vm->_globals->freeMemory(ptr); @@ -969,11 +985,11 @@ void ComputerManager::saveScore() { } } - byte *ptr = _vm->_globals->allocMemory(100); + byte *ptr = _vm->_globals->_highScoreData; memset(ptr, 0, 99); for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { int curBufPtr = 16 * scorePlaceIdx; - for (int namePos = 0; namePos <= 4; namePos++) { + for (int namePos = 0; namePos < 6; namePos++) { char curChar = _score[scorePlace[scorePlaceIdx]]._name[namePos]; if (!curChar) curChar = ' '; @@ -990,9 +1006,6 @@ void ComputerManager::saveScore() { }; ptr[curBufPtr + 15] = 0; } - - _vm->_saveLoad->saveFile("HISCORE.DAT", ptr, 100); - _vm->_globals->freeMemory(ptr); } /** diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index cdd653f793..1771bba7d6 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -63,7 +63,7 @@ private: bool _ballUpFl; int _breakoutLevelNbr; int _padPositionX; - int _breakoutHiscore; + int _lowestHiScore; int _minBreakoutMoveSpeed; int _maxBreakoutMoveSpeed; int _lastBreakoutMoveSpeed; diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index a9a0a81f08..97d6c4046c 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -70,6 +70,8 @@ Globals::Globals(HopkinsEngine *vm) { for (int i = 0; i < 36; ++i) _inventory[i] = 0; + Common::fill(&_highScoreData[0], &_highScoreData[100], 0); + // Initialize fields _language = LANG_EN; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 94512c3d26..a76323bb50 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -206,6 +206,7 @@ public: Common::String _zoneFilename; Common::String _textFilename; byte *_levelSpriteBuf; + byte _highScoreData[100]; EventMode _eventMode; diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 6d93019faa..96131f2968 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -111,8 +111,6 @@ Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) } Common::Error HopkinsEngine::run() { - _saveLoad->initSaves(); - _globals->setConfig(); _fileIO->initCensorship(); initializeSystem(); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 98fb15046e..14b166294d 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -60,14 +60,6 @@ bool SaveLoadManager::saveFile(const Common::String &file, const void *buf, size return save(file, buf, n); } -void SaveLoadManager::initSaves() { - Common::String dataFilename = "HISCORE.DAT"; - byte data[100]; - Common::fill(&data[0], &data[100], 0); - - saveFile(dataFilename, data, 100); -} - void SaveLoadManager::load(const Common::String &file, byte *buf) { Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file); if (savefile == NULL) @@ -259,6 +251,10 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { + if (version >= 3) + // Sync embedded Breakout game high score data + s.syncBytes(&_vm->_globals->_highScoreData[0], 100); + s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050); syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins); diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 6fee814180..e4ee3aaeda 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -35,7 +35,7 @@ namespace Hopkins { class HopkinsEngine; -#define HOPKINS_SAVEGAME_VERSION 2 +#define HOPKINS_SAVEGAME_VERSION 3 struct hopkinsSavegameHeader { uint8 _version; @@ -56,7 +56,6 @@ private: public: SaveLoadManager(HopkinsEngine *vm); - void initSaves(); bool save(const Common::String &file, const void *buf, size_t n); bool saveFile(const Common::String &file, const void *buf, size_t n); void load(const Common::String &file, byte *buf); -- cgit v1.2.3 From b43bac61924d053b470125cf77ade6b72a17aeb7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 27 Jul 2013 20:48:16 +0300 Subject: WINTERMUTE: Added detection entry for Toshechka game --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 09426c9307..2639084fa6 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -50,6 +50,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, {"thebox", "The Box"}, + {"tib", "Fairy Tales About Toshechka and Boshechka"}, {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, {"wintermute", "Wintermute engine game"}, @@ -591,6 +592,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Fairy Tales About Toshechka and Boshechka + { + "tib", + "", + AD_ENTRY1s("data.dcp", "87d296ef3f46570ed18f000d3885db77", 340264526), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // The Trader of Stories { "tradestory", -- cgit v1.2.3 From 28b85375306e08a04360dacf070c496dc5d1dbd2 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Sat, 27 Jul 2013 21:40:27 +0200 Subject: WINTERMUTE: Respect EVENT_QUIT properly (and don't ask to quit anymore) --- engines/wintermute/platform_osystem.cpp | 9 ++++++--- engines/wintermute/wintermute.cpp | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 362c0da624..8b1a6e38e9 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -125,9 +125,12 @@ void BasePlatform::handleEvent(Common::Event *event) { // _gameRef->AutoSaveOnExit(); // _gameRef->_quitting = true; // } - if (_gameRef) { - _gameRef->onWindowClose(); - } + +// The engine CAN query for closing, but we disable it for now, as the EVENT_QUIT-event +// can't be stopped. +// if (_gameRef) { +// _gameRef->onWindowClose(); +// } break; default: // TODO: Do we care about any other events? diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 19848b002e..202b261599 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -250,6 +250,9 @@ int WintermuteEngine::messageLoop() { } prevTime = time; } + if (shouldQuit()) { + break; + } if (_game && _game->_quitting) { break; } -- cgit v1.2.3 From 8320a556d4f2d90aede5a8a8a4ae13bd213927dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 10:35:56 -0400 Subject: TSAGE: Added R2R conversation dialog text and removal code --- engines/tsage/converse.cpp | 41 +++++++++++++++++++++++++++++++++++------ engines/tsage/converse.h | 1 + 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 8fc25f9a6d..76ccb70441 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -429,10 +429,12 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { // Set up the list of choices int yp = 0; + int xp = (g_vm->getGameID() == GType_Ringworld2) ? 40 : 25; + for (uint idx = 0; idx < choiceList.size(); ++idx) { Rect tempRect; _gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, 265); - tempRect.moveTo(25, yp + 10); + tempRect.moveTo(xp, yp + 10); _choiceList.push_back(ChoiceEntry(choiceList[idx], tempRect)); yp += tempRect.height() + 5; @@ -537,6 +539,18 @@ void ConversationChoiceDialog::draw() { _gfxManager.deactivate(); } +void ConversationChoiceDialog::remove() { + if (_savedArea) { + // Restore the area the dialog covered + Rect tempRect = _bounds; + tempRect.collapse(-10, -10); + g_globals->_gfxManagerInstance.copyFrom(*_savedArea, tempRect.left, tempRect.top); + + delete _savedArea; + _savedArea = NULL; + } +} + /*--------------------------------------------------------------------------*/ void Obj44::load(const byte *dataP) { @@ -891,13 +905,26 @@ void StripManager::signal() { if (g_vm->getGameID() == GType_Ringworld2) { Ringworld2::VisualSpeaker *speaker = static_cast(_activeSpeaker); - speaker->_speakerMode = obj44._speakerMode; - if (_obj44List.size() > 0) + + if (speaker) { + speaker->_speakerMode = obj44._speakerMode; + if (choiceList[strIndex].empty()) + speaker->proc15(); + } + + if (!choiceList[strIndex].empty()) { + _textShown = true; + _activeSpeaker->setText(choiceList[strIndex]); + } else if (!obj44._speakerMode) { + _delayFrames = 1; + } else { + _delayFrames = 0; speaker->proc15(); + } + } else { + _textShown = true; + _activeSpeaker->setText(choiceList[strIndex]); } - - _textShown = true; - _activeSpeaker->setText(choiceList[strIndex]); } _obj44Index = getNewIndex(obj44._list[strIndex]._id); @@ -965,6 +992,8 @@ Speaker *StripManager::getSpeaker(const char *speakerName) { int StripManager::getNewIndex(int id) { if (id == 10000) return id; + if ((g_vm->getGameID() == GType_Ringworld2) && (id < 0)) + return id; for (uint idx = 0; idx < _obj44List.size(); ++idx) { if (_obj44List[idx]._id == id) { diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 66e9982762..7f30e963ec 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -164,6 +164,7 @@ public: int execute(const Common::StringArray &choiceList); virtual void draw(); + virtual void remove(); }; class Obj0A : public Serialisable { -- cgit v1.2.3 From d969b1b11b7c5d95d933b34f99f14b59f7de4bbb Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 28 Jul 2013 14:31:46 -0400 Subject: PEGASUS: Fix gas canister removal not stopping the air timer This bug was also in the original --- engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp | 2 +- engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp | 2 +- engines/pegasus/neighborhood/norad/norad.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp index 169f75f7d2..3491f161c7 100644 --- a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp +++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp @@ -201,7 +201,7 @@ void NoradAlphaFillingStation::showIntakeInProgress(uint16 numSeconds) { if (item->getObjectID() == kGasCanister) { GameState.setNoradGassed(true); - ((NoradAlpha *)getOwner())->loadAmbientLoops(); + ((NoradAlpha *)getOwner())->checkAirMask(); getOwner()->restoreStriding(kNorad03, kEast, kAltNoradAlphaNormal); } } else { diff --git a/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp index e4a5e26473..6a24113465 100644 --- a/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp +++ b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp @@ -576,7 +576,7 @@ void NoradAlpha::takeItemFromRoom(Item *item) { if (_fillingStationItem == item) { _fillingStationItem = 0; GameState.setNoradGassed(false); - loadAmbientLoops(); + checkAirMask(); ((NoradAlphaFillingStation *)_currentInteraction)->newFillingItem(0); forceStridingStop(kNorad03, kEast, kAltNoradAlphaNormal); } diff --git a/engines/pegasus/neighborhood/norad/norad.cpp b/engines/pegasus/neighborhood/norad/norad.cpp index 578f062dea..53b3ff9add 100644 --- a/engines/pegasus/neighborhood/norad/norad.cpp +++ b/engines/pegasus/neighborhood/norad/norad.cpp @@ -241,7 +241,9 @@ void Norad::setUpAirMask() { } void Norad::checkAirMask() { - if (g_airMask && g_airMask->isAirFilterOn()) { + // WORKAROUND: The original game forgot to handle the case where the canister would + // be removed, leading to the timer remaining active. + if (!GameState.getNoradGassed() || (g_airMask && g_airMask->isAirFilterOn())) { _airMaskTimer.stop(); } else if (GameState.getNoradGassed() && !_airMaskTimer.isRunning()) { _airMaskTimer.setTime(0); -- cgit v1.2.3 From 2fefa91d952d775158c1b9bae2d6c5821b62d385 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 16:50:33 -0400 Subject: TSAGE: Fixes for R2R text positioning in conversation dialogs --- engines/tsage/converse.cpp | 29 +++++---- engines/tsage/converse.h | 4 ++ engines/tsage/dialogs.cpp | 78 +++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes0.cpp | 7 ++- 4 files changed, 68 insertions(+), 50 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 76ccb70441..d1cc7fbf71 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -424,17 +424,15 @@ ConversationChoiceDialog::ConversationChoiceDialog() { int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { _gfxManager._font.setFontNumber(_fontNumber); - _bounds = Rect(20, 0, 20, 0); + _bounds = Rect(40, 0, 40, 0); _choiceList.clear(); // Set up the list of choices int yp = 0; - int xp = (g_vm->getGameID() == GType_Ringworld2) ? 40 : 25; - for (uint idx = 0; idx < choiceList.size(); ++idx) { Rect tempRect; - _gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, 265); - tempRect.moveTo(xp, yp + 10); + _gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, textMaxWidth()); + tempRect.moveTo(textLeft(), yp + 10); _choiceList.push_back(ChoiceEntry(choiceList[idx], tempRect)); yp += tempRect.height() + 5; @@ -515,11 +513,8 @@ void ConversationChoiceDialog::draw() { // Fill in the contents of the entire dialog _gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - - if (g_vm->getGameID() == GType_Ringworld2) - GfxElement::drawFrame(); - else - drawFrame(); + + drawFrame(); _gfxManager._bounds = tempRect; _gfxManager._font._colors.foreground = _stdColor; @@ -530,7 +525,7 @@ void ConversationChoiceDialog::draw() { Common::String strNum = Common::String::format("%d", idx + 1); // Write the choice number - _gfxManager._font.setPosition(13, _choiceList[idx]._bounds.top); + _gfxManager._font.setPosition(numberLeft(), _choiceList[idx]._bounds.top); _gfxManager._font.writeString(strNum.c_str()); _gfxManager._font.writeLines(_choiceList[idx]._msg.c_str(), _choiceList[idx]._bounds, ALIGN_LEFT); @@ -551,6 +546,18 @@ void ConversationChoiceDialog::remove() { } } +int ConversationChoiceDialog::textLeft() const { + return (g_vm->getGameID() == GType_Ringworld2) ? 20 : 25; +} + +int ConversationChoiceDialog::textMaxWidth() const { + return (g_vm->getGameID() == GType_Ringworld2) ? 250 : 265; +} + +int ConversationChoiceDialog::numberLeft() const { + return (g_vm->getGameID() == GType_Ringworld2) ? 6 : 13; +} + /*--------------------------------------------------------------------------*/ void Obj44::load(const byte *dataP) { diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 7f30e963ec..aedd7b7659 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -145,6 +145,10 @@ public: }; class ConversationChoiceDialog : public ModalDialog { +private: + int textLeft() const; + int textMaxWidth() const; + int numberLeft() const; public: int _stdColor; int _highlightColor; diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index 77ac0a25d7..43833f53b9 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -137,43 +137,47 @@ void ModalDialog::drawFrame() { Rect origRect = _bounds; _bounds.collapse(-10, -10); - // Fill the dialog area - g_globals->gfxManager().fillRect(origRect, 54); - - // Draw top line - GfxSurface surface = surfaceFromRes(8, 1, 7); - for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10) - surface.draw(Common::Point(xp, _bounds.top)); - surface.draw(Common::Point(_bounds.right - 20, _bounds.top)); - - surface = surfaceFromRes(8, 1, 1); - surface.draw(Common::Point(_bounds.left, _bounds.top)); - - surface = surfaceFromRes(8, 1, 4); - surface.draw(Common::Point(_bounds.right - 10, _bounds.top)); - - // Draw vertical edges - surface = surfaceFromRes(8, 1, 2); - for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10) - surface.draw(Common::Point(_bounds.left, yp)); - surface.draw(Common::Point(_bounds.left, _bounds.bottom - 20)); - - surface = surfaceFromRes(8, 1, 5); - for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10) - surface.draw(Common::Point(_bounds.right - 10, yp)); - surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 20)); - - // Draw bottom line - surface = surfaceFromRes(8, 1, 8); - for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10) - surface.draw(Common::Point(xp, _bounds.bottom - 10)); - surface.draw(Common::Point(_bounds.right - 20, _bounds.bottom - 10)); - - surface = surfaceFromRes(8, 1, 3); - surface.draw(Common::Point(_bounds.left, _bounds.bottom - 10)); - - surface = surfaceFromRes(8, 1, 6); - surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 10)); + if (g_vm->getGameID() == GType_Ringworld2) { + GfxElement::drawFrame(); + } else { + // Fill the dialog area + g_globals->gfxManager().fillRect(origRect, 54); + + // Draw top line + GfxSurface surface = surfaceFromRes(8, 1, 7); + for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10) + surface.draw(Common::Point(xp, _bounds.top)); + surface.draw(Common::Point(_bounds.right - 20, _bounds.top)); + + surface = surfaceFromRes(8, 1, 1); + surface.draw(Common::Point(_bounds.left, _bounds.top)); + + surface = surfaceFromRes(8, 1, 4); + surface.draw(Common::Point(_bounds.right - 10, _bounds.top)); + + // Draw vertical edges + surface = surfaceFromRes(8, 1, 2); + for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10) + surface.draw(Common::Point(_bounds.left, yp)); + surface.draw(Common::Point(_bounds.left, _bounds.bottom - 20)); + + surface = surfaceFromRes(8, 1, 5); + for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10) + surface.draw(Common::Point(_bounds.right - 10, yp)); + surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 20)); + + // Draw bottom line + surface = surfaceFromRes(8, 1, 8); + for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10) + surface.draw(Common::Point(xp, _bounds.bottom - 10)); + surface.draw(Common::Point(_bounds.right - 20, _bounds.bottom - 10)); + + surface = surfaceFromRes(8, 1, 3); + surface.draw(Common::Point(_bounds.left, _bounds.bottom - 10)); + + surface = surfaceFromRes(8, 1, 6); + surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 10)); + } // Set the dialog's manager bounds _gfxManager._bounds = origRect; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 840172335f..fd3b01c13a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3173,6 +3173,9 @@ bool Scene300::Doorway::startAction(CursorType action, Event &event) { Scene300::Scene300(): SceneExt() { _stripId = 0; _rotation = NULL; + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); } void Scene300::synchronize(Serializer &s) { @@ -3194,8 +3197,6 @@ void Scene300::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterIndex = R2_QUINN; } - _stripManager.setColors(60, 255); - _stripManager.setFontNumber(3); _stripManager.addSpeaker(&_mirandaSpeaker); _stripManager.addSpeaker(&_seekerSpeaker); _stripManager.addSpeaker(&_quinnSpeaker); @@ -3627,6 +3628,8 @@ void Scene300::signal() { case 309: signal309(); R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._events._currentCursor = CURSOR_ARROW; + _sceneMode = 10; _stripManager.start3(_stripId, this, R2_GLOBALS._stripManager_lookupList); break; -- cgit v1.2.3 From 40f82509e94a841130061296ff415048b3663571 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 17:07:57 -0400 Subject: TSAGE: Correct R2R width of conversation dialog --- engines/tsage/converse.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index d1cc7fbf71..46fb50b9ee 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -444,7 +444,8 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { _bounds.bottom -= 10; yp = 180 - _bounds.height(); _bounds.translate(0, yp); - _bounds.right = _bounds.left + 280; + _bounds.setWidth(textMaxWidth() + 15); + _bounds.moveTo(160 - (_bounds.width() / 2), _bounds.top); // Draw the dialog draw(); -- cgit v1.2.3 From 1b2adafefa6512ce8f3d9b85b0d55a3c8fad4672 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 28 Jul 2013 23:35:26 +0200 Subject: MORTEVIELLE: Use heap allocation in GfxSurface::decode, remove one use of swap --- engines/mortevielle/graphics.cpp | 12 ++++++++---- engines/mortevielle/speech.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e5edeed97a..3a411691aa 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -120,15 +120,15 @@ void GfxSurface::decode(const byte *pSrc) { } // Temporary output buffer - byte outputBuffer[65536]; - Common::fill(&outputBuffer[0], &outputBuffer[65536], _transparency); + byte *outputBuffer = (byte *)malloc(sizeof(byte) * 65536); + memset(outputBuffer, _transparency, 65536); byte *pDest = &outputBuffer[0]; const byte *pSrcStart = pSrc; const byte *pLookup = NULL; - byte lookupTable[BUFFER_SIZE]; - byte srcBuffer[BUFFER_SIZE]; + byte *lookupTable = (byte *)malloc(sizeof(byte) * BUFFER_SIZE); + byte *srcBuffer = (byte *)malloc(sizeof(byte) * BUFFER_SIZE); // Main processing loop for (int entryIndex = 0; entryIndex < entryCount; ++entryIndex) { @@ -427,6 +427,10 @@ void GfxSurface::decode(const byte *pSrc) { Common::copy(copySrc, copySrc + w, copyDest); } + + ::free(outputBuffer); + ::free(lookupTable); + ::free(srcBuffer); } void GfxSurface::majTtxTty() { diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 445f7faffb..08c92c6560 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -88,7 +88,7 @@ void SpeechManager::spfrac(int wor) { } void SpeechManager::charg_car(int &currWordNumb) { - int wor = swap(READ_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb])); + int wor = READ_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb]); int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { -- cgit v1.2.3 From a91b96f790ed8709984a3102598b161d021025fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 18:25:18 -0400 Subject: TSAGE: Corrected display of R2R conversation dialog border --- engines/tsage/converse.cpp | 2 +- engines/tsage/graphics.cpp | 69 ++++++++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 46fb50b9ee..145f04a1d7 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -556,7 +556,7 @@ int ConversationChoiceDialog::textMaxWidth() const { } int ConversationChoiceDialog::numberLeft() const { - return (g_vm->getGameID() == GType_Ringworld2) ? 6 : 13; + return (g_vm->getGameID() == GType_Ringworld2) ? 8 : 13; } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index a010b46ea5..ce19502524 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -798,35 +798,58 @@ void GfxElement::drawFrame() { lineP++; } } + + // Draw the edge frame + // Outer frame border + surface.hLine(tempRect.left + 2, tempRect.top, tempRect.right - 2, 0); + surface.hLine(tempRect.left + 2, tempRect.bottom, tempRect.right - 2, 0); + surface.vLine(tempRect.left, tempRect.top + 2, tempRect.bottom - 2, 0); + surface.vLine(tempRect.right, tempRect.top + 2, tempRect.bottom - 2, 0); + *((byte *)surface.getBasePtr(tempRect.left + 1, tempRect.top + 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.right - 1, tempRect.top + 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.left + 1, tempRect.bottom - 1)) = 0; + *((byte *)surface.getBasePtr(tempRect.right - 1, tempRect.bottom - 1)) = 0; + + // Inner frame border + surface.hLine(tempRect.left + 2, tempRect.top + 1, tempRect.right - 2, R2_GLOBALS._frameEdgeColour); + surface.hLine(tempRect.left + 2, tempRect.bottom - 1, tempRect.right - 2, R2_GLOBALS._frameEdgeColour); + surface.vLine(tempRect.left + 1, tempRect.top + 2, tempRect.bottom - 2, R2_GLOBALS._frameEdgeColour); + surface.vLine(tempRect.right - 1, tempRect.top + 2, tempRect.bottom - 2, R2_GLOBALS._frameEdgeColour); + *((byte *)surface.getBasePtr(tempRect.left + 2, tempRect.top + 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.right - 2, tempRect.top + 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.left + 2, tempRect.bottom - 2)) = R2_GLOBALS._frameEdgeColour; + *((byte *)surface.getBasePtr(tempRect.right - 2, tempRect.bottom - 2)) = R2_GLOBALS._frameEdgeColour; + gfxManager.unlockSurface(); + gfxManager.getSurface().addDirtyRect(tempRect); } else { // Fill dialog content with specified background colour gfxManager.fillRect(tempRect, _colors.background); - } - --tempRect.bottom; --tempRect.right; - gfxManager.fillArea(tempRect.left, tempRect.top, bgColor); - gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor); - gfxManager.fillArea(tempRect.right, tempRect.top, fgColor); - gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor); - - tempRect.collapse(-1, -1); - gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor); - gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor); - gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor); - gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor); - - gfxManager.fillArea(tempRect.left, tempRect.top, 0); - gfxManager.fillArea(tempRect.left, tempRect.bottom, 0); - gfxManager.fillArea(tempRect.right, tempRect.top, 0); - gfxManager.fillArea(tempRect.right, tempRect.bottom, 0); - - tempRect.collapse(-1, -1); - gfxManager.fillRect2(tempRect.left + 2, tempRect.top, tempRect.width() - 3, 1, 0); - gfxManager.fillRect2(tempRect.left, tempRect.top + 2, 1, tempRect.height() - 3, 0); - gfxManager.fillRect2(tempRect.left + 2, tempRect.bottom, tempRect.width() - 3, 1, 0); - gfxManager.fillRect2(tempRect.right, tempRect.top + 2, 1, tempRect.height() - 3, 0); + --tempRect.bottom; --tempRect.right; + gfxManager.fillArea(tempRect.left, tempRect.top, bgColor); + gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.top, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor); + + tempRect.collapse(-1, -1); + gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor); + gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor); + gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor); + gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor); + + gfxManager.fillArea(tempRect.left, tempRect.top, 0); + gfxManager.fillArea(tempRect.left, tempRect.bottom, 0); + gfxManager.fillArea(tempRect.right, tempRect.top, 0); + gfxManager.fillArea(tempRect.right, tempRect.bottom, 0); + + tempRect.collapse(-1, -1); + gfxManager.fillRect2(tempRect.left + 2, tempRect.top, tempRect.width() - 3, 1, 0); + gfxManager.fillRect2(tempRect.left, tempRect.top + 2, 1, tempRect.height() - 3, 0); + gfxManager.fillRect2(tempRect.left + 2, tempRect.bottom, tempRect.width() - 3, 1, 0); + gfxManager.fillRect2(tempRect.right, tempRect.top + 2, 1, tempRect.height() - 3, 0); + } gfxManager.unlockSurface(); } -- cgit v1.2.3 From 9d89861f77c9f7fc17ea93f90e7b8e937ec94298 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Jul 2013 19:01:55 -0400 Subject: TSAGE: Fix for clearing conversation dialogs --- engines/tsage/converse.cpp | 12 ------------ engines/tsage/converse.h | 1 - 2 files changed, 13 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 145f04a1d7..82feb314e6 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -535,18 +535,6 @@ void ConversationChoiceDialog::draw() { _gfxManager.deactivate(); } -void ConversationChoiceDialog::remove() { - if (_savedArea) { - // Restore the area the dialog covered - Rect tempRect = _bounds; - tempRect.collapse(-10, -10); - g_globals->_gfxManagerInstance.copyFrom(*_savedArea, tempRect.left, tempRect.top); - - delete _savedArea; - _savedArea = NULL; - } -} - int ConversationChoiceDialog::textLeft() const { return (g_vm->getGameID() == GType_Ringworld2) ? 20 : 25; } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index aedd7b7659..af0b3b8808 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -168,7 +168,6 @@ public: int execute(const Common::StringArray &choiceList); virtual void draw(); - virtual void remove(); }; class Obj0A : public Serialisable { -- cgit v1.2.3 From b50f0e2a0d657c64dedb5800912b9e6558e0529d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 29 Jul 2013 01:58:03 +0200 Subject: MORTEVIELLE: Remove remaining macros, start refactoring menus, modify the way _cfiphBuffer is read/written --- engines/mortevielle/actions.cpp | 21 ++++--- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/menu.cpp | 112 +++++++++++++++++++------------------- engines/mortevielle/menu.h | 39 +++++++++++-- engines/mortevielle/mortevielle.h | 20 ------- engines/mortevielle/speech.cpp | 23 ++++---- engines/mortevielle/speech.h | 2 +- engines/mortevielle/utils.cpp | 52 +++++++++--------- 8 files changed, 143 insertions(+), 128 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 88eee0cf7d..5738a8fd3a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -41,13 +41,14 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - if ((_coreVar._currPlace == ROOM26) && (_currAction == _menu._moveMenu[6])) { + int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId; + if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; drawPictureWithText(); handleDescriptionText(2, _coreVar._currPlace); } - if ((_coreVar._currPlace == LANDING) && (_currAction == _menu._moveMenu[6])) { + if ((_coreVar._currPlace == LANDING) && (_currAction == oldMenu)) { if (!_syn) displayTextInVerbBar(getEngineString(S_GO_TO)); displayStatusArrow(); @@ -85,9 +86,11 @@ void MortevielleEngine::fctMove() { } exitRoom(); int menuChoice = 1; - - while (_menu._moveMenu[menuChoice] != _currAction) + oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + while (oldMenu != _currAction) { ++menuChoice; + oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + } if (_coreVar._currPlace == MOUNTAIN) { if (menuChoice == 1) @@ -300,9 +303,11 @@ void MortevielleEngine::fctTake() { */ void MortevielleEngine::fctInventoryTake() { int inventIndex = 0; + int oldMenu = 0; do { ++inventIndex; - } while (_menu._inventoryMenu[inventIndex] != _currAction); + oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId; + } while (oldMenu != _currAction); int cz = 0; int cy = 0; do { @@ -1154,7 +1159,7 @@ void MortevielleEngine::fctEnter() { ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _currMenu = MENU_DISCUSS; - _currAction = _menu._discussMenu[charIndex]; + _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId; _syn = true; if (_roomDoorId == ROOM9) { _col = true; @@ -1352,9 +1357,11 @@ void MortevielleEngine::fctDiscuss() { displId = 128; else { cx = 0; + int oldMenu; do { ++cx; - } while (_menu._discussMenu[cx] != _currAction); + oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; + } while (oldMenu != _currAction); _caff = 69 + cx; drawPictureWithText(); handleDescriptionText(2, _caff); diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3a411691aa..8392fabd6a 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1113,7 +1113,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), ord(l[x - 1]), color); + _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); pt.x += charWidth; } _vm->_mouse.showMouse(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a1f628992d..f86fd208c1 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -52,32 +52,30 @@ const byte menuConstants[8][4] = { * Setup a menu's contents * @remarks Originally called 'menut' */ -void Menu::setText(int menuId, Common::String name) { - byte h = hi(menuId); - byte l = lo(menuId); +void Menu::setText(int menuId, int actionId, Common::String name) { Common::String s = name; while (s.size() < 22) s += ' '; - switch (h) { + switch (menuId) { case MENU_INVENTORY: - if (l != 7) { - _inventoryStringArray[l] = s; - _inventoryStringArray[l].insertChar(' ', 0); + if (actionId != 7) { + _inventoryStringArray[actionId] = s; + _inventoryStringArray[actionId].insertChar(' ', 0); } break; case MENU_MOVE: - _moveStringArray[l] = s; + _moveStringArray[actionId] = s; break; case MENU_ACTION: - _actionStringArray[l] = s; + _actionStringArray[actionId] = s; break; case MENU_SELF: - _selfStringArray[l] = s; + _selfStringArray[actionId] = s; break; case MENU_DISCUSS: - _discussStringArray[l] = s; + _discussStringArray[actionId] = s; break; default: break; @@ -99,40 +97,38 @@ void Menu::setDestinationText(int roomId) { nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; - setText(_moveMenu[destinationId + 1], nomp); + setText(_moveMenu[destinationId + 1]._menuId, _moveMenu[destinationId + 1]._actionId, nomp); } nomp = "* "; for (int i = 7; i >= destinationId + 1; --i) - setText(_moveMenu[i], nomp); + setText(_moveMenu[i]._menuId, _moveMenu[i]._actionId, nomp); } /** * _disable a menu item - * @param menuId Hi byte represents menu number, lo byte reprsents item index + * @param menuId Menu number + * @param actionId Item index */ -void Menu::disableMenuItem(int menuId) { - byte h = hi(menuId); - byte l = lo(menuId); - - switch (h) { +void Menu::disableMenuItem(int menuId, int actionId) { + switch (menuId) { case MENU_INVENTORY: - if (l > 6) { - _inventoryStringArray[l].setChar('<', 0); - _inventoryStringArray[l].setChar('>', 21); + if (actionId > 6) { + _inventoryStringArray[actionId].setChar('<', 0); + _inventoryStringArray[actionId].setChar('>', 21); } else - _inventoryStringArray[l].setChar('*', 0); + _inventoryStringArray[actionId].setChar('*', 0); break; case MENU_MOVE: - _moveStringArray[l].setChar('*', 0); + _moveStringArray[actionId].setChar('*', 0); break; case MENU_ACTION: - _actionStringArray[l].setChar('*', 0); + _actionStringArray[actionId].setChar('*', 0); break; case MENU_SELF: - _selfStringArray[l].setChar('*', 0); + _selfStringArray[actionId].setChar('*', 0); break; case MENU_DISCUSS: - _discussStringArray[l].setChar('*', 0); + _discussStringArray[actionId].setChar('*', 0); break; default: break; @@ -141,31 +137,29 @@ void Menu::disableMenuItem(int menuId) { /** * Enable a menu item - * @param menuId Hi byte represents menu number, lo byte reprsents item index + * @param menuId Menu number + * @param actionId Item index * @remarks Originally called menu_enable */ -void Menu::enableMenuItem(int menuId) { - byte h = hi(menuId); - byte l = lo(menuId); - - switch (h) { +void Menu::enableMenuItem(int menuId, int actionId) { + switch (menuId) { case MENU_INVENTORY: - _inventoryStringArray[l].setChar(' ', 0); - _inventoryStringArray[l].setChar(' ', 21); + _inventoryStringArray[actionId].setChar(' ', 0); + _inventoryStringArray[actionId].setChar(' ', 21); break; case MENU_MOVE: - _moveStringArray[l].setChar(' ', 0); + _moveStringArray[actionId].setChar(' ', 0); break; case MENU_ACTION: - _actionStringArray[l].setChar(' ', 0); + _actionStringArray[actionId].setChar(' ', 0); break; case MENU_SELF: - _selfStringArray[l].setChar(' ', 0); + _selfStringArray[actionId].setChar(' ', 0); // The original sets two times the same value. Skipped // _selfStringArray[l].setChar(' ', 0); break; case MENU_DISCUSS: - _discussStringArray[l].setChar(' ', 0); + _discussStringArray[actionId].setChar(' ', 0); break; default: break; @@ -235,7 +229,7 @@ void Menu::invert(int indx) { if (_msg4 == OPCODE_NONE) return; - int menuIndex = lo(_msg4); + int menuIndex = _msg4 & 0xFF; _vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); @@ -471,7 +465,7 @@ void Menu::updateMenu() { // Another menu to be _displayed _vm->setMouseClick(false); menuUp(_msg3); - if (lo(_msg4) == 1) + if ((_msg4 & 0xFF) == 1) _msg3 = MENU_SAVE; else _msg3 = MENU_LOAD; @@ -531,12 +525,16 @@ void Menu::initMenu(MortevielleEngine *vm) { ++i; } while (i != 22); for (i = 1; i <= 8; ++i) { - _discussMenu[i] = 0x500 + i; - if (i < 8) - _moveMenu[i] = 0x200 + i; - _inventoryMenu[i] = 0x100 + i; + _discussMenu[i]._menuId = MENU_DISCUSS; + _discussMenu[i]._actionId = i; + if (i < 8) { + _moveMenu[i]._menuId = MENU_MOVE; + _moveMenu[i]._actionId = i; + } + _inventoryMenu[i]._menuId = MENU_INVENTORY; + _inventoryMenu[i]._actionId = i; if (i > 6) - disableMenuItem(_inventoryMenu[i]); + disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); } _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; @@ -551,13 +549,13 @@ void Menu::initMenu(MortevielleEngine *vm) { */ void Menu::setSearchMenu() { for (int i = 1; i <= 7; ++i) - disableMenuItem(_moveMenu[i]); + disableMenuItem(MENU_MOVE, _moveMenu[i]._actionId); for (int i = 1; i <= 11; ++i) - disableMenuItem(_actionMenu[i]); + disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); - setText(OPCODE_SOUND, _vm->getEngineString(S_SUITE)); - setText(OPCODE_LIFT, _vm->getEngineString(S_STOP)); + setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_SUITE)); + setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_STOP)); } /** @@ -567,10 +565,10 @@ void Menu::setSearchMenu() { void Menu::unsetSearchMenu() { setDestinationText(_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) - enableMenuItem(_actionMenu[i]); + enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); - setText(OPCODE_SOUND, _vm->getEngineString(S_PROBE)); - setText(OPCODE_LIFT, _vm->getEngineString(S_RAISE)); + setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_PROBE)); + setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_RAISE)); } /** @@ -586,15 +584,15 @@ void Menu::setInventoryText() { ++cy; int r = _vm->_coreVar._inventory[i] + 400; nomp = _vm->getString(r - 501 + kInventoryStringIndex); - setText(_inventoryMenu[cy], nomp); - enableMenuItem(_inventoryMenu[i]); + setText(_inventoryMenu[cy]._menuId, _inventoryMenu[cy]._actionId, nomp); + enableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); } } if (cy < 6) { for (int i = cy + 1; i <= 6; ++i) { - setText(_inventoryMenu[i], " "); - disableMenuItem(_inventoryMenu[i]); + setText(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId, " "); + disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); } } } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index d4538effee..2428d8917b 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -40,6 +40,33 @@ enum { MENU_LOAD = 8 }; +enum verbs {OPCODE_NONE = 0, OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, +OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, +OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, +OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, +OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, +OPCODE_SLOOK = 0x405}; + +struct menuItem { + int _menuId; + int _actionId; +}; + +static const menuItem _actionMenu[12] = { + {OPCODE_NONE >> 8, OPCODE_NONE & 0xFF}, + {OPCODE_SHIDE >> 8, OPCODE_SHIDE & 0xFF}, + {OPCODE_ATTACH >> 8, OPCODE_ATTACH & 0xFF}, + {OPCODE_FORCE >> 8, OPCODE_FORCE & 0xFF}, + {OPCODE_SLEEP >> 8, OPCODE_SLEEP & 0xFF}, + {OPCODE_ENTER >> 8, OPCODE_ENTER & 0xFF}, + {OPCODE_CLOSE >> 8, OPCODE_CLOSE & 0xFF}, + {OPCODE_KNOCK >> 8, OPCODE_KNOCK & 0xFF}, + {OPCODE_EAT >> 8, OPCODE_EAT & 0xFF}, + {OPCODE_PLACE >> 8, OPCODE_PLACE & 0xFF}, + {OPCODE_OPEN >> 8, OPCODE_OPEN & 0xFF}, + {OPCODE_LEAVE >> 8, OPCODE_LEAVE & 0xFF} +}; + class Menu { private: MortevielleEngine *_vm; @@ -61,15 +88,15 @@ public: Common::String _actionStringArray[22]; Common::String _selfStringArray[7]; Common::String _discussStringArray[9]; - int _discussMenu[9]; - int _inventoryMenu[9]; - int _moveMenu[8]; + menuItem _discussMenu[9]; + menuItem _inventoryMenu[9]; + menuItem _moveMenu[8]; - void setText(int menuId, Common::String name); + void setText(int menuId, int actionId, Common::String name); void setDestinationText(int roomId); void setInventoryText(); - void disableMenuItem(int menuId); - void enableMenuItem(int menuId); + void disableMenuItem(int menuId, int actionId); + void enableMenuItem(int menuId, int actionId); void displayMenu(); void drawMenu(); void menuUp(int msgId); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6f5d4b4fac..4d07d3000f 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -65,12 +65,6 @@ namespace Mortevielle { */ const int kAdrMusic = 0x5000; -#define ord(v) ((int) v) -#define chr(v) ((unsigned char) v) -#define lo(v) ((v) & 0xff) -#define hi(v) (((v) >> 8) & 0xff) -#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8)) - // Debug channels enum { kMortevielleCore = 1 << 0, @@ -137,20 +131,6 @@ const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; const int kMaxPatt = 20; -const int OPCODE_NONE = 0; -enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, - OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, - OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, - OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, - OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, - OPCODE_SLOOK = 0x405}; - -static const int _actionMenu[12] = { OPCODE_NONE, - OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, - OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, - OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE -}; - /* 9 "A glance at the forbidden$", 18 "It's already open$", diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 08c92c6560..68ae3dac3e 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -150,7 +150,7 @@ void SpeechManager::regenbruit() { int i = kOffsetB3 + 8590; int j = 0; do { - _cfiphBuffer[j] = READ_LE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]); + _cfiphBuffer[j] = READ_BE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]); i += 2; ++j; } while (i < kOffsetB3 + 8790); @@ -185,7 +185,7 @@ void SpeechManager::loadPhonemeSounds() { error("Missing file - phbrui.mor"); for (int i = 1; i <= f.size() / 2; ++i) - _cfiphBuffer[i] = f.readSint16LE(); + _cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -214,7 +214,7 @@ void SpeechManager::trait_car() { switch (_queue[1]._code) { case 9: - if (_queue[1]._val != ord('#')) + if (_queue[1]._val != (int)'#') for (i = 0; i <= _queue[1]._rep; ++i) entroct(_queue[1]._val); break; @@ -533,13 +533,16 @@ void SpeechManager::initQueue() { * @remarks Originally called 'trait_ph' */ void SpeechManager::handlePhoneme() { - const int deca[3] = {300, 30, 40}; + const uint16 deca[3] = {300, 30, 40}; - int startPos = swap(_cfiphBuffer[_phonemeNumb - 1]) + deca[_typlec]; - int endPos = swap(_cfiphBuffer[_phonemeNumb]) + deca[_typlec]; + uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_typlec]; + uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_typlec]; int wordCount = endPos - startPos; - for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) - WRITE_LE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]); + + startPos /= 2; + endPos /= 2; + for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) + WRITE_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]); _ptr_oct = 0; int currWord = 0; @@ -553,7 +556,7 @@ void SpeechManager::handlePhoneme() { moveQueue(); trait_car(); - entroct(ord('#')); + entroct((int)'#'); } /** @@ -561,7 +564,7 @@ void SpeechManager::handlePhoneme() { * @remarks Originally called 'parole' */ void SpeechManager::startSpeech(int rep, int ht, int typ) { - int savph[501]; + uint16 savph[501]; int tempo; if (_vm->_soundOff) diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index ef3211dad9..c3c4c32942 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -75,7 +75,7 @@ private: int _ptr_oct; public: - int16 *_cfiphBuffer; + uint16 *_cfiphBuffer; int _tbi[256]; int _mlec; byte *_noise5Buf; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 7a8306067d..2316d1e9fd 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -282,7 +282,7 @@ void MortevielleEngine::handleAction() { _menu.eraseMenu(); _menu._menuDisplayed = false; if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - changeGraphicalDevice((uint)(ord(inkey) - 1) >> 1); + changeGraphicalDevice((uint)((int)inkey - 1) >> 1); return; } if (_menu._menuSelected && (_currMenu == MENU_SAVE)) { @@ -504,48 +504,48 @@ void MortevielleEngine::showPeoplePresent(int bitIndex) { int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); clearUpperRightPart(); if ((bitIndex & 128) == 128) { _screenSurface.putxy(xp, 24); _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]); + _menu.enableMenuItem(_menu._discussMenu[1]._menuId, _menu._discussMenu[1]._actionId); } if ((bitIndex & 64) == 64) { _screenSurface.putxy(xp, 32); _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]); + _menu.enableMenuItem(_menu._discussMenu[2]._menuId, _menu._discussMenu[2]._actionId); } if ((bitIndex & 32) == 32) { _screenSurface.putxy(xp, 40); _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]); + _menu.enableMenuItem(_menu._discussMenu[3]._menuId, _menu._discussMenu[3]._actionId); } if ((bitIndex & 16) == 16) { _screenSurface.putxy(xp, 48); _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]); + _menu.enableMenuItem(_menu._discussMenu[4]._menuId, _menu._discussMenu[4]._actionId); } if ((bitIndex & 8) == 8) { _screenSurface.putxy(xp, 56); _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]); + _menu.enableMenuItem(_menu._discussMenu[5]._menuId, _menu._discussMenu[5]._actionId); } if ((bitIndex & 4) == 4) { _screenSurface.putxy(xp, 64); _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]); + _menu.enableMenuItem(_menu._discussMenu[6]._menuId, _menu._discussMenu[6]._actionId); } if ((bitIndex & 2) == 2) { _screenSurface.putxy(xp, 72); _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]); + _menu.enableMenuItem(_menu._discussMenu[7]._menuId, _menu._discussMenu[7]._actionId); } if ((bitIndex & 1) == 1) { _screenSurface.putxy(xp, 80); _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]); + _menu.enableMenuItem(_menu._discussMenu[8]._menuId, _menu._discussMenu[8]._actionId); } _currBitIndex = bitIndex; } @@ -699,7 +699,7 @@ int MortevielleEngine::getPresenceStatsRedRoom() { */ void MortevielleEngine::displayAloneText() { for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); Common::String sYou = getEngineString(S_YOU); Common::String sAre = getEngineString(S_ARE); @@ -1643,7 +1643,7 @@ void MortevielleEngine::hourToChar() { minute = 1; hour += day * 24; minute += hour * 2; - _coreVar._fullHour = chr(minute); + _coreVar._fullHour = (unsigned char)minute; } /** @@ -1651,7 +1651,7 @@ void MortevielleEngine::hourToChar() { * @remarks Originally called 'theure' */ void MortevielleEngine::charToHour() { - int fullHour = ord(_coreVar._fullHour); + int fullHour = _coreVar._fullHour; int tmpHour = fullHour % 48; _currDay = fullHour / 48; _currHalfHour = tmpHour % 2; @@ -1869,16 +1869,16 @@ bool MortevielleEngine::decryptNextChar(char &c, int &idx, byte &pt) { } if (oct == 30) - c = chr(cryptoArr30[ocd]); + c = (unsigned char)cryptoArr30[ocd]; else - c = chr(cryptoArr31[ocd]); + c = (unsigned char)cryptoArr31[ocd]; if (c == '\0') { c = '#'; return true; } } else { - c = chr(cryptoArrDefault[oct]); + c = (unsigned char)cryptoArrDefault[oct]; } return false; } @@ -1944,7 +1944,7 @@ void MortevielleEngine::resetVariables() { // Only object in inventory: a gun _coreVar._inventory[1] = 113; - _coreVar._fullHour = chr(20); + _coreVar._fullHour = (unsigned char)20; for (int i = 1; i <= 10; ++i) _coreVar._pctHintFound[i] = ' '; @@ -2175,10 +2175,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _speechManager._cfiphBuffer = (int16 *)malloc(sizeof(int16) * (f.size() / 2)); + _speechManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _speechManager._cfiphBuffer[i] = f.readSint16LE(); + _speechManager._cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2307,7 +2307,7 @@ void MortevielleEngine::prepareRoom() { if (hintCount == 10) pctStr = "10"; else - pctStr = chr(hintCount + 48); + pctStr = (unsigned char)(hintCount + 48); _hintPctMessage = "[1]["; _hintPctMessage += getEngineString(S_SHOULD_HAVE_NOTICED); @@ -2762,8 +2762,8 @@ void MortevielleEngine::displayItemInHand(int objId) { if (objId != 500) strp = getString(objId - 501 + kInventoryStringIndex); - _menu.setText(_menu._inventoryMenu[8], strp); - _menu.disableMenuItem(_menu._inventoryMenu[8]); + _menu.setText(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId, strp); + _menu.disableMenuItem(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId); } /** @@ -3234,7 +3234,7 @@ L1: _caff = 69 + cx; _crep = _caff; _currMenu = MENU_DISCUSS; - _currAction = _menu._discussMenu[cx]; + _currAction = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; _syn = true; _col = true; } else { @@ -3291,7 +3291,7 @@ void MortevielleEngine::displayStatusArrow() { if (_num == 9999) return; - displayStatusInDescriptionBar(chr(152)); + displayStatusInDescriptionBar((unsigned char)152); bool inRect = false; do { touch = '\0'; @@ -3450,7 +3450,7 @@ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { else color = 12; - _screenSurface.writeCharacter(Common::Point(306, 193), ord(stat), color); + _screenSurface.writeCharacter(Common::Point(306, 193), stat, color); _screenSurface.drawBox(300, 191, 16, 8, 15); _mouse.showMouse(); } @@ -3491,7 +3491,7 @@ int MortevielleEngine::gettKeyPressed() { break; } - return ord(ch); + return (int)ch; } } // End of namespace Mortevielle -- cgit v1.2.3 From c7277df1ed0a11c62971a859f101852083debd57 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 29 Jul 2013 07:27:31 +0200 Subject: DEVTOOLS: Add support to another DOS executable for Mortevielle --- devtools/create_mortdat/create_mortdat.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index cb7d6aa189..653a0754eb 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -119,13 +119,13 @@ void openOutputFile(const char *outFilename) { * Write out the data for the font */ void writeFontBlock() { - const int knownAddr[2] = {0x36b0, 0x36c0}; + const int knownAddr[3] = {0x30cd, 0x36b0, 0x36c0}; byte checkBuffer[7]; byte fontBuffer[121 * 6]; // Move to just prior the font data and verify that we're reading the known mort.com - for (int i = 0; i <= 2; ++i) { - if ( i == 2) { + for (int i = 0; i <= 3; ++i) { + if ( i == 3) { printf("Invalid mort.com input file"); exit(0); } -- cgit v1.2.3 From 351af76f9bce9b78ef10cb403c635e7b121e883b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 29 Jul 2013 12:25:57 +0300 Subject: COMMON: Added copy constructors and copier to Rect and Point. --- common/rect.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/rect.h b/common/rect.h index 5790cf7c0f..31e0b5152f 100644 --- a/common/rect.h +++ b/common/rect.h @@ -38,11 +38,14 @@ struct Point { Point() : x(0), y(0) {} Point(int16 x1, int16 y1) : x(x1), y(y1) {} + Point(const Point &p) : x(p.x), y(p.y) {} bool operator==(const Point &p) const { return x == p.x && y == p.y; } bool operator!=(const Point &p) const { return x != p.x || y != p.y; } Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); } Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); } + void copy(const Point &p) { x = p.x; y = p.y; } + void operator+=(const Point &delta) { x += delta.x; y += delta.y; @@ -99,9 +102,12 @@ struct Rect { Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(isValidRect()); } + Rect(const Rect &r) : top(r.top), left(r.left), bottom(r.bottom), right(r.right) {} bool operator==(const Rect &rhs) const { return equals(rhs); } bool operator!=(const Rect &rhs) const { return !equals(rhs); } + void copy(const Rect &r) { top = r.top; left = r.left; bottom = r.bottom; right = r.right; } + int16 width() const { return right - left; } int16 height() const { return bottom - top; } -- cgit v1.2.3 From 67af740f3ae63b2f1f1ccf643f7eb51888d6de9b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 29 Jul 2013 12:30:47 +0300 Subject: COMMON: Revert last commit as rightfully pointed out by fuzze. --- common/rect.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/rect.h b/common/rect.h index 31e0b5152f..5790cf7c0f 100644 --- a/common/rect.h +++ b/common/rect.h @@ -38,14 +38,11 @@ struct Point { Point() : x(0), y(0) {} Point(int16 x1, int16 y1) : x(x1), y(y1) {} - Point(const Point &p) : x(p.x), y(p.y) {} bool operator==(const Point &p) const { return x == p.x && y == p.y; } bool operator!=(const Point &p) const { return x != p.x || y != p.y; } Point operator+(const Point &delta) const { return Point(x + delta.x, y + delta.y); } Point operator-(const Point &delta) const { return Point(x - delta.x, y - delta.y); } - void copy(const Point &p) { x = p.x; y = p.y; } - void operator+=(const Point &delta) { x += delta.x; y += delta.y; @@ -102,12 +99,9 @@ struct Rect { Rect(int16 x1, int16 y1, int16 x2, int16 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(isValidRect()); } - Rect(const Rect &r) : top(r.top), left(r.left), bottom(r.bottom), right(r.right) {} bool operator==(const Rect &rhs) const { return equals(rhs); } bool operator!=(const Rect &rhs) const { return !equals(rhs); } - void copy(const Rect &r) { top = r.top; left = r.left; bottom = r.bottom; right = r.right; } - int16 width() const { return right - left; } int16 height() const { return bottom - top; } -- cgit v1.2.3 From 4df545c1ee833884cdfbbd4aee12f6756687c877 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 29 Jul 2013 23:42:56 +0200 Subject: WINTERMUTE: Handle setting Save/Load-screen to NULL. --- engines/wintermute/base/gfx/base_renderer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index c20881e425..b3f05ce977 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -113,15 +113,21 @@ void BaseRenderer::setIndicatorVal(int value) { } void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) { - // TODO: Handle NULL - _loadImageName = filename; + if (filename == nullptr) { + _saveImageName = ""; + } else { + _loadImageName = filename; + } _loadImageX = x; _loadImageY = y; } void BaseRenderer::setSaveImage(const char *filename, int x, int y) { - // TODO: Handle NULL - _saveImageName = filename; + if (filename == nullptr) { + _saveImageName = ""; + } else { + _saveImageName = filename; + } _saveImageX = x; _saveImageY = y; } -- cgit v1.2.3 From ebabf3948d4179db9f830f94abbdb6b1e0fdc2dc Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 29 Jul 2013 23:46:15 +0200 Subject: WINTERMUTE: Add detection for The Shine of a Star. --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 2639084fa6..d3284cddee 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -49,6 +49,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"reversion1", "Reversion: The Escape"}, {"reversion2", "Reversion: The Meeting"}, {"rosemary", "Rosemary"}, + {"shinestar", "The Shine of a Star"}, {"thebox", "The Box"}, {"tib", "Fairy Tales About Toshechka and Boshechka"}, {"tradestory", "The Trader of Stories"}, @@ -582,6 +583,16 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // The Shine of a Star + { + "shinestar", + "", + AD_ENTRY1s("data.dcp", "f05abe9e2427a5e4f73648fa09c4ba8e", 94113060), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // The Box { "thebox", -- cgit v1.2.3 From 7deef6ad63d8ded5ff301b0bc13af0fb90493180 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 29 Jul 2013 23:48:27 +0200 Subject: WINTERMUTE: Align detection-entries properly with spaces. --- engines/wintermute/detection_tables.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index d3284cddee..7df061c1c6 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -42,7 +42,7 @@ static const PlainGameDescriptor wintermuteGames[] = { {"dreamscape", "Dreamscape"}, {"ghostsheet", "Ghost in the Sheet"}, {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, - {"jamesperis", "James Peris: No License Nor Control"}, + {"jamesperis", "James Peris: No License Nor Control"}, {"julia", "J.U.L.I.A."}, {"mirage", "Mirage"}, {"pigeons", "Pigeons in the Park"}, @@ -51,8 +51,8 @@ static const PlainGameDescriptor wintermuteGames[] = { {"rosemary", "Rosemary"}, {"shinestar", "The Shine of a Star"}, {"thebox", "The Box"}, - {"tib", "Fairy Tales About Toshechka and Boshechka"}, - {"tradestory", "The Trader of Stories"}, + {"tib", "Fairy Tales About Toshechka and Boshechka"}, + {"tradestory", "The Trader of Stories"}, {"twc", "the white chamber"}, {"wintermute", "Wintermute engine game"}, {0, 0} -- cgit v1.2.3 From 2088a77388f82489295d53bf1cc3b33d17f9dbd5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 30 Jul 2013 04:21:51 +0300 Subject: SCI: Add a hack to fix the inventory in GK1 For some reason, the top left nsRect coordinates get swapped in the GK1 inventory screen, investigate why --- engines/sci/graphics/frameout.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index bb960c8501..ca1ef357ae 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -779,6 +779,14 @@ void GfxFrameout::kernelFrameout() { _coordAdjuster->fromDisplayToScript(nsRect.bottom, nsRect.right); g_sci->_gfxCompare->setNSRect(itemEntry->object, nsRect); } + + // TODO: For some reason, the top left nsRect coordinates get + // swapped in the GK1 inventory screen, investigate why. + // HACK: Fix the coordinates by explicitly setting them here. + Common::Rect objNSRect = g_sci->_gfxCompare->getNSRect(itemEntry->object); + if (objNSRect.top == nsRect.left && objNSRect.left == nsRect.top && nsRect.top != 0 && nsRect.left != 0) { + g_sci->_gfxCompare->setNSRect(itemEntry->object, nsRect); + } } // Don't attempt to draw sprites that are outside the visible -- cgit v1.2.3 From a3e5c990058e780c9eb92c2fc7b6f13caa0ca14a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Jul 2013 22:24:25 -0400 Subject: TSAGE: Fixes for R2R extended conversations --- engines/tsage/converse.cpp | 39 +++++++++++++++--------- engines/tsage/converse.h | 1 + engines/tsage/ringworld2/ringworld2_speakers.cpp | 6 ++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 82feb314e6..7e6c1b30d5 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -724,14 +724,24 @@ void StripManager::synchronize(Serializer &s) { } void StripManager::remove() { + if (g_vm->getGameID() == GType_Ringworld2) { + for (int i = 0; i < _speakerList.size(); ++i) { + if (_activeSpeaker != _speakerList[i]) + _speakerList[i]->proc16(); + } + } + if (_textShown) { if (_activeSpeaker) _activeSpeaker->removeText(); _textShown = false; } - if (_activeSpeaker) + if (_activeSpeaker) { + if (g_vm->getGameID() == GType_Ringworld2) + static_cast(_activeSpeaker)->_speakerMode = 0xff; _activeSpeaker->remove(); + } if (_sceneNumber != g_globals->_sceneManager._scene->_screenNumber) { g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds; @@ -776,9 +786,7 @@ void StripManager::signal() { Obj44 &obj44 = _obj44List[_obj44Index]; - if (g_vm->getGameID() != GType_Ringworld2) { - _field2E8 = obj44._id; - } else { + if (g_vm->getGameID() == GType_Ringworld2) { // Return to Ringworld specific handling if (obj44._field6) _field2E8 = obj44._field6; @@ -797,22 +805,27 @@ void StripManager::signal() { break; } } - + + _field2E8 = obj44._id; Common::StringArray choiceList; // Build up a list of script entries int idx; + bool delayFlag = false; if ((g_vm->getGameID() == GType_Ringworld2) && obj44._field16[0]) { // Special loading mode used in Return to Ringworld for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) { int f16Index = _lookupList[obj44._field16[0] - 1]; - Obj0A &entry = obj44._list[obj44._field16[f16Index]]; - if (!entry._id) - break; + int entryId = obj44._field16[f16Index]; - // Get the next one - choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); + Obj0A &entry = obj44._list[idx]; + if (entry._id == entryId) { + // Get the next one + choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); + delayFlag = true; + break; + } } } else { // Standard choices loading @@ -853,8 +866,6 @@ void StripManager::signal() { if (!obj44._list[listIdx + 1]._id) obj44._list[listIdx]._id = 0; } - - continue; } } } @@ -870,7 +881,7 @@ void StripManager::signal() { // Get the user to select a conversation option strIndex = _choiceDialog.execute(choiceList); - if ((choiceList.size() != 1) && !_field2E6) + if ((delayFlag || choiceList.size() != 1) && !_field2E6) _delayFrames = 1; else { Speaker *speakerP = getSpeaker((const char *)&_script[0] + obj44._speakerOffset); @@ -904,7 +915,7 @@ void StripManager::signal() { if (speaker) { speaker->_speakerMode = obj44._speakerMode; - if (choiceList[strIndex].empty()) + if (!choiceList[strIndex].empty()) speaker->proc15(); } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index af0b3b8808..00c1f44051 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -94,6 +94,7 @@ public: virtual void proc12(Action *action); virtual void setText(const Common::String &msg); virtual void removeText(); + virtual void proc16() {} void setTextPos(const Common::Point &pt) { _textPos = pt; } }; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index bff61bafc4..b8d593b90a 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -252,8 +252,8 @@ void VisualSpeaker::proc16() { _speakerMode = 0; _object1.remove(); - assert(_object2); - _object2->show(); + if (_object2) + _object2->show(); _object2 = NULL; _fieldF8 = 0; } @@ -1948,7 +1948,7 @@ void SpeakerSeeker300::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) { + if (R2_GLOBALS._player._characterIndex == 2) { _object2 = &R2_GLOBALS._player; } else { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; -- cgit v1.2.3 From 25974eddb882adc818a9e93ced022253f72b31ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Jul 2013 08:59:29 -0400 Subject: TSAGE: Further fix for R2R conversations --- engines/tsage/converse.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 7e6c1b30d5..ec14ff330d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -755,6 +755,8 @@ void StripManager::remove() { } void StripManager::signal() { + int strIndex = 0; + if (_textShown) { _activeSpeaker->removeText(); _textShown = false; @@ -823,6 +825,7 @@ void StripManager::signal() { if (entry._id == entryId) { // Get the next one choiceList.push_back((const char *)&_script[0] + entry._scriptOffset); + strIndex = idx; delayFlag = true; break; } @@ -876,7 +879,6 @@ void StripManager::signal() { } } - int strIndex = 0; if (choiceList.size() > 1) // Get the user to select a conversation option strIndex = _choiceDialog.execute(choiceList); -- cgit v1.2.3 From 5080f5dfcdc3b9543789f9faa4cce6bb42bb7b62 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Jul 2013 09:00:06 -0400 Subject: TSAGE: Scene fixes for R2R Medbay --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index fd3b01c13a..9cfa53ed22 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -6351,12 +6351,26 @@ bool Scene800::DeviceSlot::startAction(CursorType action, Event &event) { break; R2_GLOBALS._player.disableControl(); - scene->_reader.postInit(); + _lookLineNum = 27; + scene->_sceneMode = 809; if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) - scene->setAction(&scene->_sequenceManager1, scene, 814, &R2_GLOBALS._player, &scene->_reader, &scene->_opticalFibre, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 815, &R2_GLOBALS._player, &scene->_reader, &scene->_opticalFibre, NULL); else - scene->setAction(&scene->_sequenceManager1, scene, 804, &R2_GLOBALS._player, &scene->_reader, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 809, &R2_GLOBALS._player, &scene->_reader, NULL); + return true; + case R2_READER: + R2_GLOBALS._player.disableControl(); + scene->_reader.postInit(); + scene->_sceneMode = 804; + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) { + scene->setAction(&scene->_sequenceManager1, scene, 814, &R2_GLOBALS._player, + &scene->_reader, &scene->_opticalFibre, NULL); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 804, &R2_GLOBALS._player, + &scene->_reader, NULL); + } return true; default: break; -- cgit v1.2.3 From f51f0e5ae80c9c276357bf5d78ad572fa1bf5e7c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Jul 2013 09:32:32 -0400 Subject: TSAGE: Fix upper bound of loop in R2R scene 1575 --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 00605b3ef6..ba62a119a8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -8886,7 +8886,7 @@ void Scene1575::Hotspot1::process(Event &event) { di -= 2; scene->_field41A -= 2; - for (int i = 0; i < 178; i++) + for (int i = 0; i < 17; i++) scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y)); scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y)); -- cgit v1.2.3 From 2f9b7ba686c8ba763395fbc876a892cc9ea01fd4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 30 Jul 2013 21:02:01 +0200 Subject: COMMON: Enforce formatting guidelines a bit more in util.h. --- common/util.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/util.h b/common/util.h index 4ca1c42929..392ced1ffe 100644 --- a/common/util.h +++ b/common/util.h @@ -41,10 +41,10 @@ #undef MAX #endif -template inline T ABS (T x) { return (x>=0) ? x : -x; } -template inline T MIN (T a, T b) { return (a inline T MAX (T a, T b) { return (a>b) ? a : b; } -template inline T CLIP (T v, T amin, T amax) +template inline T ABS(T x) { return (x >= 0) ? x : -x; } +template inline T MIN(T a, T b) { return (a < b) ? a : b; } +template inline T MAX(T a, T b) { return (a > b) ? a : b; } +template inline T CLIP(T v, T amin, T amax) { if (v < amin) return amin; else if (v > amax) return amax; else return v; } /** -- cgit v1.2.3 From 2d1ac29551c2976149100606eb5415649eed3704 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Tue, 30 Jul 2013 20:21:03 +0100 Subject: DEVTOOLS: Update create_mortdat to the latest version English translation --- devtools/create_mortdat/gametext.h | 2 +- dists/engine-data/mort.dat | Bin 75663 -> 75737 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index f8fe070bf0..9a4f0f7fc5 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -395,7 +395,7 @@ const char *gameDataEn[] = { "She got along with everyone. She loved her son dearly. As for the relations between mother-in-law and daughter-in-law...$", "Apart from Leo, she got along very well with Max...$", "Even if your relations were unfrequent, Jerome, there was still a place for you in her heart...$", - "(370) Apart from her family, not a lot of people$", + "Apart from her family, not a lot of people$", "Oh right! I think she deeply regretted this friend's leaving... err! Marielle... or Mireille...$", "No, nothing!$", "No... Not that I know of$", diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 23e06fe014..fca30ab238 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 3a4507bf5a3fd29fe097b2c65a2b47992219fc43 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 30 Jul 2013 20:53:07 +0100 Subject: MORTEVIELLE: Fix compilation on WinCE. The LANG_* symbols were colliding with defined symbols in the WinCE system headers. Renamed to avoid this. --- engines/mortevielle/mortevielle.cpp | 8 ++++---- engines/mortevielle/mortevielle.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index b4b46a4286..2d45923032 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -297,17 +297,17 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp byte desiredLanguageId; switch(getLanguage()) { case Common::EN_ANY: - desiredLanguageId = LANG_ENGLISH; + desiredLanguageId = MORTDAT_LANG_ENGLISH; break; case Common::FR_FRA: - desiredLanguageId = LANG_FRENCH; + desiredLanguageId = MORTDAT_LANG_FRENCH; break; case Common::DE_DEU: - desiredLanguageId = LANG_GERMAN; + desiredLanguageId = MORTDAT_LANG_GERMAN; break; default: warning("Language not supported, switching to English"); - desiredLanguageId = LANG_ENGLISH; + desiredLanguageId = MORTDAT_LANG_ENGLISH; break; } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 4d07d3000f..388abbc50a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -73,9 +73,9 @@ enum { // Game languages enum { - LANG_FRENCH = 0, - LANG_ENGLISH = 1, - LANG_GERMAN = 2 + MORTDAT_LANG_FRENCH = 0, + MORTDAT_LANG_ENGLISH = 1, + MORTDAT_LANG_GERMAN = 2 }; // Static string list -- cgit v1.2.3 From d81f6450c981d4738df1627611d4b5428e3422c8 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 30 Jul 2013 21:18:01 +0100 Subject: NEVERHOOD: Silence noisy compiler warning. This is due to NULL being used. Switching to nullptr which is equivalent i.e. 0 should silence this. --- engines/neverhood/entity.cpp | 2 +- engines/neverhood/entity.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/neverhood/entity.cpp b/engines/neverhood/entity.cpp index af65cfd025..1ebf1dcf6c 100644 --- a/engines/neverhood/entity.cpp +++ b/engines/neverhood/entity.cpp @@ -47,7 +47,7 @@ Entity *MessageParam::asEntity() const { } Entity::Entity(NeverhoodEngine *vm, int priority) - : _vm(vm), _updateHandlerCb(NULL), _messageHandlerCb(NULL), _priority(priority), _soundResources(NULL) { + : _vm(vm), _updateHandlerCb(NULL), _messageHandlerCb(nullptr), _priority(priority), _soundResources(NULL) { } Entity::~Entity() { diff --git a/engines/neverhood/entity.h b/engines/neverhood/entity.h index 0d5cf3fd50..5c29bf8a4f 100644 --- a/engines/neverhood/entity.h +++ b/engines/neverhood/entity.h @@ -98,7 +98,7 @@ public: void incGlobalVar(uint32 nameHash, int incrValue); void incSubVar(uint32 nameHash, uint32 subNameHash, int incrValue); int getPriority() const { return _priority; } - bool hasMessageHandler() const { return _messageHandlerCb != NULL; } + bool hasMessageHandler() const { return _messageHandlerCb != nullptr; } protected: void (Entity::*_updateHandlerCb)(); uint32 (Entity::*_messageHandlerCb)(int messageNum, const MessageParam ¶m, Entity *sender); -- cgit v1.2.3 From b4a0fd13ef28ec8a6d8e60b5ab90539620ee9ee1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 31 Jul 2013 01:07:48 +0100 Subject: MORTEVIELLE: Another fix for WinCE compilation. S_OK is a system define in the WinCE toolchain library headers, so this conflicts. Renamed to S_OKAY in the engine code to avoid this. --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 388abbc50a..795bac5652 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -83,7 +83,7 @@ enum { S_YES_NO = 0, S_GO_TO = 1, S_SOMEONE_ENTERS = 2, S_COOL = 3, S_LOURDE = 4, S_MALSAINE = 5, S_IDEM = 6, S_YOU = 7, S_ARE = 8, S_ALONE = 9, S_HEAR_NOISE = 10, S_SHOULD_HAVE_NOTICED = 11, S_NUMBER_OF_HINTS = 12, - S_WANT_TO_WAKE_UP = 13, S_OK = 14, S_SAVE_LOAD = 15, S_RESTART = 18, S_F3 = 19, + S_WANT_TO_WAKE_UP = 13, S_OKAY = 14, S_SAVE_LOAD = 15, S_RESTART = 18, S_F3 = 19, S_F8 = 20, S_HIDE_SELF = 21, S_TAKE = 22, S_PROBE = 23, S_RAISE = 24, S_SUITE = 25, S_STOP = 26, S_USE_DEP_MENU = 27, S_LIFT = 28, S_READ = 29, S_LOOK = 30, S_SEARCH = 31, S_OPEN = 32, S_PUT = 33, S_TURN = 34, S_TIE = 35, S_CLOSE = 36, diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 2316d1e9fd..8fa608953d 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2315,7 +2315,7 @@ void MortevielleEngine::prepareRoom() { _hintPctMessage += '0'; _hintPctMessage += getEngineString(S_NUMBER_OF_HINTS); _hintPctMessage += "]["; - _hintPctMessage += getEngineString(S_OK); + _hintPctMessage += getEngineString(S_OKAY); _hintPctMessage += ']'; } if (minute > _minute) { -- cgit v1.2.3 From e296ac1d47e3d53e86773fb2876d48b3db2935b4 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 31 Jul 2013 04:22:44 +0200 Subject: WINTERMUTE: Let engine know both gameid and language of target as well as targetname. --- engines/wintermute/base/base_engine.cpp | 12 +++++++----- engines/wintermute/base/base_engine.h | 10 +++++++--- engines/wintermute/base/base_file_manager.cpp | 2 +- engines/wintermute/base/base_game.cpp | 2 +- engines/wintermute/base/base_game.h | 8 ++++---- engines/wintermute/base/base_persistence_manager.cpp | 2 +- engines/wintermute/wintermute.cpp | 4 ++-- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index d4b17a0a64..79b16e5c74 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -46,8 +46,8 @@ BaseEngine::BaseEngine() { _gameId = ""; } -void BaseEngine::init(Common::Language lang) { - _fileManager = new BaseFileManager(lang); +void BaseEngine::init() { + _fileManager = new BaseFileManager(_language); // Don't forget to register your random source _rnd = new Common::RandomSource("Wintermute"); _classReg = new SystemClassRegistry(); @@ -60,9 +60,11 @@ BaseEngine::~BaseEngine() { delete _classReg; } -void BaseEngine::createInstance(const Common::String &gameid, Common::Language lang) { - instance()._gameId = gameid; - instance().init(lang); +void BaseEngine::createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang) { + instance()._targetName = targetName; + instance()._gameId = gameId; + instance()._language = lang; + instance().init(); } void BaseEngine::LOG(bool res, const char *fmt, ...) { diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h index d972e6ebbc..1b3b976bda 100644 --- a/engines/wintermute/base/base_engine.h +++ b/engines/wintermute/base/base_engine.h @@ -44,17 +44,19 @@ class BaseRenderer; class SystemClassRegistry; class Timer; class BaseEngine : public Common::Singleton { - void init(Common::Language lang); + void init(); BaseFileManager *_fileManager; Common::String _gameId; + Common::String _targetName; BaseGame *_gameRef; // We need random numbers Common::RandomSource *_rnd; SystemClassRegistry *_classReg; + Common::Language _language; public: BaseEngine(); ~BaseEngine(); - static void createInstance(const Common::String &gameid, Common::Language lang); + static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang); void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; } Common::RandomSource *getRandomSource() { return _rnd; } @@ -68,7 +70,9 @@ public: static const Timer *getTimer(); static const Timer *getLiveTimer(); static void LOG(bool res, const char *fmt, ...); - const char *getGameId() { return _gameId.c_str(); } + const char *getGameTargetName() const { return _targetName.c_str(); } + Common::String getGameId() const { return _gameId; } + Common::Language getLanguage() const { return _language; } }; } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index 7d59b03684..64bdbd1660 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -269,7 +269,7 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f bool BaseFileManager::hasFile(const Common::String &filename) { if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) { - BasePersistenceManager pm(BaseEngine::instance().getGameId()); + BasePersistenceManager pm(BaseEngine::instance().getGameTargetName()); if (filename.size() <= 9) { return false; } diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 0594699edc..d2cf7d12da 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -81,7 +81,7 @@ IMPLEMENT_PERSISTENT(BaseGame, true) ////////////////////////////////////////////////////////////////////// -BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gameId), _timerNormal(), _timerLive() { +BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _targetName(targetName), _timerNormal(), _timerLive() { _shuttingDown = false; _state = GAME_RUNNING; diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index b821805ada..1943024db8 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -150,7 +150,7 @@ public: BaseScriptable *_mathClass; BaseSurfaceStorage *_surfaceStorage; BaseFontStorage *_fontStorage; - BaseGame(const Common::String &gameId); + BaseGame(const Common::String &targetName); virtual ~BaseGame(); bool _debugDebugMode; @@ -173,8 +173,8 @@ public: // compatibility bits bool _compatKillMethodThreads; - const char* getGameId() const { return _gameId.c_str(); } - void setGameId(const Common::String& gameId) { _gameId = gameId; } + const char* getGameTargetName() const { return _targetName.c_str(); } + void setGameTargetName(const Common::String& targetName) { _targetName = targetName; } uint32 _surfaceGCCycleTime; bool _smartCache; // RO bool _subtitles; // RO @@ -295,7 +295,7 @@ private: uint32 _lastTime; uint32 _fpsTime; uint32 _framesRendered; - Common::String _gameId; + Common::String _targetName; void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = nullptr, void *data = nullptr); ENGINE_LOG_CALLBACK _engineLogCallback; diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index c46bb721fe..23290e1574 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -94,7 +94,7 @@ BasePersistenceManager::BasePersistenceManager(const char *savePrefix, bool dele if (savePrefix) { _savePrefix = savePrefix; } else if (_gameRef) { - _savePrefix = _gameRef->getGameId(); + _savePrefix = _gameRef->getGameTargetName(); } else { _savePrefix = "wmesav"; } diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 202b261599..a878944661 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -133,7 +133,7 @@ Common::Error WintermuteEngine::run() { } int WintermuteEngine::init() { - BaseEngine::createInstance(_targetName, _gameDescription->language); + BaseEngine::createInstance(_targetName, _gameDescription->gameid, _gameDescription->language); _game = new AdGame(_targetName); if (!_game) { return 1; @@ -147,7 +147,7 @@ int WintermuteEngine::init() { _game->initialize1(); // set gameId, for savegame-naming: - _game->setGameId(_targetName); + _game->setGameTargetName(_targetName); if (DID_FAIL(_game->loadSettings("startup.settings"))) { _game->LOG(0, "Error loading game settings."); -- cgit v1.2.3 From f691e005f835fbb9266e5d240296f05cf6ef83d6 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 31 Jul 2013 04:23:57 +0200 Subject: WINTERMUTE: Add detection for both english and spanish James Peris Demo. --- engines/wintermute/detection_tables.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 7df061c1c6..1dff3622ec 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -294,12 +294,23 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, - // James Peris: No License Nor Control + // James Peris: No License Nor Control (English) { "jamesperis", "Demo", AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), - Common::UNK_LANG, // No solution in place to select language + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, + // James Peris: No License Nor Control (Spanish) + { + "jamesperis", + "Demo", + AD_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), + Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE | ADGF_DEMO, -- cgit v1.2.3 From 1396052dc9ee95618c7d57f9230803bccb2f99d9 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 31 Jul 2013 04:25:08 +0200 Subject: WINTERMUTE: Add hack to allow language-selection in James Peris demo. --- engines/wintermute/base/base_game.cpp | 28 +++++++++++++++++++++++----- engines/wintermute/base/base_game.h | 2 ++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index d2cf7d12da..0f0d928285 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1276,11 +1276,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack stack->correctParams(2); const char *key = stack->pop()->getString(); const char *initVal = stack->pop()->getString(); - Common::String privKey = "wme_" + StringUtil::encodeSetting(key); - Common::String result = initVal; - if (ConfMan.hasKey(privKey)) { - result = StringUtil::decodeSetting(ConfMan.get(key)); - } + Common::String result = readRegistryString(key, initVal); stack->pushString(result.c_str()); return STATUS_OK; } @@ -3902,4 +3898,26 @@ char *BaseGame::getKeyFromStringTable(const char *str) const { return _settings->getKeyFromStringTable(str); } +Common::String BaseGame::readRegistryString(const Common::String &key, const Common::String &initValue) const { + // Game specific hacks: + Common::String result = initValue; + // James Peris: + if (BaseEngine::instance().getGameId() == "jamesperis" && key == "Language") { + Common::Language language = BaseEngine::instance().getLanguage(); + if (language == Common::EN_ANY) { + result = "english"; + } else if (language == Common::ES_ESP) { + result = "spanish"; + } else { + error("Invalid language set for James Peris"); + } + } else { // Just fallback to using ConfMan for now + Common::String privKey = "wme_" + StringUtil::encodeSetting(key); + if (ConfMan.hasKey(privKey)) { + result = StringUtil::decodeSetting(ConfMan.get(key)); + } + } + return result; +} + } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 1943024db8..f635339286 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -343,6 +343,8 @@ private: bool isDoubleClick(int32 buttonIndex); uint32 _usedMem; +// TODO: This should be expanded into a proper class eventually: + Common::String readRegistryString(const Common::String &key, const Common::String &initValue) const; protected: -- cgit v1.2.3 From ffef92a134a27790584d4d2656e8966a980b5063 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 31 Jul 2013 03:36:16 +0100 Subject: MORTEVIELLE: Fix two GCC compiler warnings. The first is due to a variable set but never used i.e. destSurface, but I think this call is still needed to lock the area being copied, hence have removed the variable, but not the call. The second was a real bug in the type of the print format string used for savegame naming. slot is a number, not a string and can vary from 0 to 999, hence the 3 digit fixed size with zero padded prefix. --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/saveload.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 8392fabd6a..c066114e8d 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -974,7 +974,7 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { * Copys a given surface to the given position */ void ScreenSurface::copyFrom(Graphics::Surface &src, int x, int y) { - Graphics::Surface destSurface = lockArea(Common::Rect(x, y, x + src.w, y + src.h)); + lockArea(Common::Rect(x, y, x + src.w, y + src.h)); // Loop through writing for (int yp = 0; yp < src.h; ++yp) { diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index ff3bee5c06..77c242c9e7 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -300,7 +300,7 @@ SaveStateDescriptor SavegameManager::querySaveMetaInfos(const Common::String &fi // Original savegame perhaps? delete f; - SaveStateDescriptor desc(slot, Common::String::format("Savegame - %s", slot)); + SaveStateDescriptor desc(slot, Common::String::format("Savegame - %03d", slot)); desc.setDeletableFlag(slot != 0); desc.setWriteProtectedFlag(slot == 0); return desc; -- cgit v1.2.3 From 52886eed68fb88288026064a8970e21ec568fc90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Jul 2013 22:40:47 -0400 Subject: TSAGE: Bugfixes for giving reader to Miranda --- engines/tsage/converse.cpp | 13 ++++++++----- engines/tsage/converse.h | 3 ++- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 17 +++++++++-------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index ec14ff330d..753a835389 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -556,7 +556,7 @@ void Obj44::load(const byte *dataP) { _mode = s.readSint16LE(); _lookupValue = s.readSint16LE(); _lookupIndex = s.readSint16LE(); - _field6 = s.readSint16LE(); + _exitMode = s.readSint16LE(); _speakerMode = s.readSint16LE(); } @@ -592,7 +592,7 @@ void Obj44::synchronize(Serializer &s) { s.syncAsSint16LE(_mode); s.syncAsSint16LE(_lookupValue); s.syncAsSint16LE(_lookupIndex); - s.syncAsSint16LE(_field6); + s.syncAsSint16LE(_exitMode); s.syncAsSint16LE(_speakerMode); for (int i = 0; i < 11; ++i) @@ -648,6 +648,7 @@ void StripManager::reset() { _activeSpeaker = NULL; _textShown = false; _callbackObject = NULL; + _exitMode = 0; _obj44List.clear(); if (!_script.empty()) { @@ -695,6 +696,8 @@ void StripManager::synchronize(Serializer &s) { s.syncAsByte(_textShown); s.syncAsByte(_field2E6); s.syncAsSint32LE(_field2E8); + if (g_vm->getGameID() == GType_Ringworld2) + s.syncAsSint16LE(_exitMode); // Synchronize the item list int arrSize = _obj44List.size(); @@ -725,7 +728,7 @@ void StripManager::synchronize(Serializer &s) { void StripManager::remove() { if (g_vm->getGameID() == GType_Ringworld2) { - for (int i = 0; i < _speakerList.size(); ++i) { + for (uint i = 0; i < _speakerList.size(); ++i) { if (_activeSpeaker != _speakerList[i]) _speakerList[i]->proc16(); } @@ -790,8 +793,8 @@ void StripManager::signal() { if (g_vm->getGameID() == GType_Ringworld2) { // Return to Ringworld specific handling - if (obj44._field6) - _field2E8 = obj44._field6; + if (obj44._exitMode) + _exitMode = obj44._exitMode; switch (obj44._mode) { case 1: diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 00c1f44051..5aef0d8a7f 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -194,7 +194,7 @@ public: // Return to Ringworld specific field int _mode; - int _lookupValue, _lookupIndex, _field6; + int _lookupValue, _lookupIndex, _exitMode; int _speakerMode; int _field16[11]; public: @@ -223,6 +223,7 @@ public: bool _textShown; bool _field2E6; int _field2E8; + int _exitMode; Common::Array _obj44List; Common::Array _script; StripProc _onBegin; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 9cfa53ed22..3cb3574364 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3488,27 +3488,27 @@ void Scene300::remove() { void Scene300::signal() { switch (_sceneMode) { case 10: - switch (_stripManager._field2E8) { - case 0: + switch (_stripManager._exitMode) { + case 1: R2_GLOBALS._sound1.changeSound(10); R2_GLOBALS.setFlag(38); break; - case 1: + case 2: R2_GLOBALS.setFlag(3); break; - case 2: + case 3: R2_GLOBALS.setFlag(4); break; - case 3: + case 4: R2_GLOBALS.setFlag(13); if (R2_GLOBALS._stripManager_lookupList[1] == 6) R2_GLOBALS.setFlag(40); break; - case 4: + case 5: if (R2_GLOBALS._stripManager_lookupList[1] == 6) R2_GLOBALS.setFlag(40); break; - case 5: + case 6: R2_GLOBALS._sceneManager.changeScene(1000); break; default: @@ -6874,8 +6874,9 @@ void Scene825::doButtonPress(int buttonId) { _sceneText.setup(NO_TREATMENT_REQUIRED); } else { _button6._buttonId = 5; - + _sceneMode = 827; _object5.postInit(); + setAction(&_sequenceManager1, this, 827, &_object5, NULL); } } else { -- cgit v1.2.3 From 1809cc567303651dd3acd54d64f0e7c33a2651df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 30 Jul 2013 23:00:55 -0400 Subject: TSAGE: R2R fixes for reading infodisk --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 19 ++++++++++--------- engines/tsage/ringworld2/ringworld2_scenes0.h | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 3cb3574364..4018921791 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -573,23 +573,23 @@ void Scene125::Icon::hideIcon() { /*--------------------------------------------------------------------------*/ -bool Scene125::Item4::startAction(CursorType action, Event &event) { +bool Scene125::DiskSlot::startAction(CursorType action, Event &event) { Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene; switch (action) { case CURSOR_USE: if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._player._oldCharacterScene[1]) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 126; - scene->setAction(&scene->_sequenceManager, scene, 126, &scene->_object7, NULL); + scene->setAction(&scene->_sequenceManager, scene, 126, &scene->_infoDisk, NULL); return true; } break; case R2_OPTO_DISK: if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1) { R2_GLOBALS._player.disableControl(); - scene->_object7.postInit(); + scene->_infoDisk.postInit(); scene->_sceneMode = 125; - scene->setAction(&scene->_sequenceManager, scene, 125, &scene->_object7, NULL); + scene->setAction(&scene->_sequenceManager, scene, 125, &scene->_infoDisk, NULL); return true; } break; @@ -626,16 +626,16 @@ void Scene125::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._player._oldCharacterScene[1]) { - _object7.postInit(); - _object7.setup(160, 3, 5); - _object7.setPosition(Common::Point(47, 167)); + _infoDisk.postInit(); + _infoDisk.setup(160, 3, 5); + _infoDisk.setPosition(Common::Point(47, 167)); } _object6.postInit(); _object6.setup(162, 1, 1); _object6.setPosition(Common::Point(214, 168)); - _item4.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL); + _diskSlot.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL); _item3.setDetails(Rect(144, 119, 286, 167), 126, 6, 7, 8, 1, NULL); _item2.setDetails(1, 126, 3, 4, 5); _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 126, 0, 1, -1, 1, NULL); @@ -782,10 +782,11 @@ void Scene125::signal() { break; case 125: R2_INVENTORY.setObjectScene(R2_OPTO_DISK, R2_GLOBALS._player._oldCharacterScene[1]); + R2_GLOBALS._player.enableControl(); break; case 126: R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 1); - _object7.remove(); + _infoDisk.remove(); R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; break; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 51cdd88cc1..80dab89b32 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -126,7 +126,7 @@ class Scene125: public SceneExt { }; /* Items */ - class Item4: public NamedHotspot { + class DiskSlot: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -135,8 +135,8 @@ public: ScenePalette _palette; ASoundExt _sound1; NamedHotspot _background, _item2, _item3; - Item4 _item4; - SceneActor _object1, _object2, _object3, _object4, _object5, _object6, _object7; + DiskSlot _diskSlot; + SceneActor _object1, _object2, _object3, _object4, _object5, _object6, _infoDisk; Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6; SequenceManager _sequenceManager; SceneText _sceneText; -- cgit v1.2.3 From 26a9b528dadde6521f80a7121af69f6af6f53b9a Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 31 Jul 2013 06:18:58 +0100 Subject: COMMON: Move definition of math constants to scummsys header. This should have no effect on common/math.h as scummsys is included at the top anyway, but this will fix compilation on some toolchains when strict ANSI language compliance is enabled i.e. -std=c++11, rather than -std=gnu11. This causes an issue as a side effect is to set a guard which disables various non-standard defines in the system headers i.e. the M_PI and M_SQRT1_2 constant definitions in the MinGW x86_64 toolchain on buildbot. By moving this into scummsys.h after the point of system math.h inclusion, we can ensure that M_PI etc. are always present. --- common/math.h | 8 -------- common/scummsys.h | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/math.h b/common/math.h index b85ec0d22a..ba137101e4 100644 --- a/common/math.h +++ b/common/math.h @@ -52,14 +52,6 @@ #endif #endif -#ifndef M_SQRT1_2 - #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ -#endif - -#ifndef M_PI - #define M_PI 3.14159265358979323846 -#endif - #ifndef FLT_MIN #define FLT_MIN 1E-37 #endif diff --git a/common/scummsys.h b/common/scummsys.h index 291de87dc9..aeffbbfcf3 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -144,6 +144,14 @@ #endif #endif +#ifndef M_SQRT1_2 + #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif + +#ifndef M_PI + #define M_PI 3.14159265358979323846 +#endif + // Include our C++11 compatability header for pre-C++11 compilers. #if __cplusplus < 201103L #include "common/c++11-compat.h" -- cgit v1.2.3 From 58855dd37f94d58b2a1dad810b52bc4394bfc5ab Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Wed, 31 Jul 2013 16:02:38 +0200 Subject: WINTERMUTE: Add detection for James Peris (Full Version) --- engines/wintermute/detection_tables.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 1dff3622ec..3d9afe7c97 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -295,6 +295,26 @@ static const ADGameDescription gameDescriptions[] = { GUIO0() }, // James Peris: No License Nor Control (English) + { + "jamesperis", + "", + AD_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // James Peris: No License Nor Control (Spanish) + { + "jamesperis", + "", + AD_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // James Peris: No License Nor Control (Demo) (English) { "jamesperis", "Demo", @@ -305,7 +325,7 @@ static const ADGameDescription gameDescriptions[] = { ADGF_DEMO, GUIO0() }, - // James Peris: No License Nor Control (Spanish) + // James Peris: No License Nor Control (Demo) (Spanish) { "jamesperis", "Demo", -- cgit v1.2.3 From 03c4b7a240d53b36c86aea564fb8ae0b0a747604 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 15:09:19 +0200 Subject: WINTERMUTE: Introduce TransformStruct and FloatPoint; add operators to Point32 --- engines/wintermute/graphics/transform_struct.cpp | 127 +++++++++++++++++++++++ engines/wintermute/graphics/transform_struct.h | 87 ++++++++++++++++ engines/wintermute/math/floatrect.h | 52 ++++++++++ engines/wintermute/math/rect32.h | 26 ++++- engines/wintermute/module.mk | 1 + 5 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 engines/wintermute/graphics/transform_struct.cpp create mode 100644 engines/wintermute/graphics/transform_struct.h create mode 100644 engines/wintermute/math/floatrect.h diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp new file mode 100644 index 0000000000..9a11aa9fdd --- /dev/null +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -0,0 +1,127 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/wintermute/graphics/transform_struct.h" +#include "engines/wintermute/graphics/transparent_surface.h" + +namespace Wintermute { +void TransformStruct::init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, Point32 offset) { + _zoom = zoom; + _angle = angle; + _hotspot = hotspot; + _blendMode = blendMode; + _rgbaMod = rgbaMod; + _alphaDisable = alphaDisable; + _flip = 0; + _flip += TransparentSurface::FLIP_H * mirrorX; + _flip += TransparentSurface::FLIP_V * mirrorY; + _offset = offset; +} + + +TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY, int32 offsetX, int32 offsetY) { + init(Point32(zoomX, zoomY), + angle, + Point32(hotspotX, hotspotY), + false, + blendMode, + rgbaMod, + mirrorX, mirrorY, + Point32(offsetX, offsetY)); +} + +TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { + init(Point32(zoomX, zoomY), + DEFAULT_ANGLE, + Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + false, + blendMode, + rgbaMod, + mirrorX, + mirrorY, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +TransformStruct::TransformStruct(int32 zoom, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { + init(Point32(zoom, zoom), + DEFAULT_ANGLE, + Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + false, + blendMode, + rgbaMod, + mirrorX, mirrorY, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +TransformStruct::TransformStruct(int32 zoom, bool mirrorX, bool mirrorY) { + init(Point32(zoom, zoom), + DEFAULT_ANGLE, + Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + true, + BLEND_NORMAL, + DEFAULT_RGBAMOD, + mirrorX, mirrorY, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) { + init(Point32(zoomX, zoomY), + angle, + Point32(hotspotX, hotspotY), + true, + BLEND_NORMAL, + DEFAULT_RGBAMOD, + false, false, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +TransformStruct::TransformStruct(int32 zoom) { + init(Point32(zoom, zoom), + DEFAULT_ANGLE, + Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + true, + BLEND_NORMAL, + DEFAULT_RGBAMOD, + false, false, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +TransformStruct::TransformStruct() { + init(Point32(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y), + DEFAULT_ANGLE, + Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + true, + BLEND_NORMAL, + DEFAULT_RGBAMOD, + false, false, + Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); +} + +bool TransformStruct::mirrorX() const { + return (bool)(_flip & TransparentSurface::FLIP_H); +} + +bool TransformStruct::mirrorY() const { + return (bool)(_flip & TransparentSurface::FLIP_V); +} + +} diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h new file mode 100644 index 0000000000..9a28a48bd1 --- /dev/null +++ b/engines/wintermute/graphics/transform_struct.h @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GRAPHICS_TRANSFORM_STRUCT_H +#define GRAPHICS_TRANSFORM_STRUCT_H + +#include "engines/wintermute/math/rect32.h" +#include "engines/wintermute/dctypes.h" + +#define DEFAULT_ZOOM_X 100 +#define DEFAULT_ZOOM_Y 100 +#define DEFAULT_RGBAMOD 0xFFFFFFFF +#define DEFAULT_HOTSPOT_X 0 +#define DEFAULT_HOTSPOT_Y 0 +#define DEFAULT_OFFSET_X 0 +#define DEFAULT_OFFSET_Y 0 +#define DEFAULT_ANGLE 0 + +namespace Wintermute { +/** + * Contains all the required information that define a transform. + * Same source sprite + same TransformStruct = Same resulting sprite. + * Has a number of overloaded constructors to accomodate various argument lists. + */ +struct TransformStruct { +private: + void init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Point32 offset); + +public: + TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0); + TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false); + TransformStruct(int32 zoom, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY); + TransformStruct(int32 zoom, bool mirrorX, bool mirrorY); + TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0); + TransformStruct(int32 zoom); + TransformStruct(); + + Point32 _zoom; ///< Zoom; 100 = no zoom + Point32 _hotspot; ///< Position of the hotspot + uint32 _angle; ///< Rotation angle, in degrees + byte _flip; ///< Bitflag: see TransparentSurface::FLIP_XXX + bool _alphaDisable; + TSpriteBlendMode _blendMode; + uint32 _rgbaMod; ///< RGBa + Point32 _offset; + + bool mirrorX() const; + bool mirrorY() const; + + bool operator==(const TransformStruct &compare) const { + return (compare._angle == _angle && + compare._flip == _flip && + compare._zoom == _zoom && + compare._offset == _offset && + compare._alphaDisable == _alphaDisable && + compare._rgbaMod == _rgbaMod && + compare._blendMode == _blendMode + ); + } + + bool operator!=(const TransformStruct &compare) const { + return !(compare == *this); + } +}; + +} + +#endif diff --git a/engines/wintermute/math/floatrect.h b/engines/wintermute/math/floatrect.h new file mode 100644 index 0000000000..f8eb3827fd --- /dev/null +++ b/engines/wintermute/math/floatrect.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef WINTERMUTE_FLOATRECT_H +#define WINTERMUTE_FLOATRECT_H + +namespace Wintermute { + +struct FloatPoint { + float x; + float y; + FloatPoint() : x(0), y(0) {} + FloatPoint(float x1, float y1) : x(x1), y(y1) {} + bool operator==(const FloatPoint &p) const { return x == p.x && y == p.y; } + bool operator!=(const FloatPoint &p) const { return x != p.x || y != p.y; } + FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); } + FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); } + + FloatPoint& operator+=(const FloatPoint &delta) { + x += delta.x; + y += delta.y; + return *this; + } + FloatPoint& operator-=(const FloatPoint &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } +}; + +} // end of namespace Wintermute + +#endif diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 190c1135cf..6618a51e91 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -24,14 +24,38 @@ #define WINTERMUTE_RECT32_H #include "common/system.h" +#include "engines/wintermute/math/floatrect.h" namespace Wintermute { struct Point32 { int32 x; int32 y; -}; + Point32() : x(0), y(0) {} + Point32(int32 x1, int32 y1) : x(x1), y(y1) {} + bool operator==(const Point32 &p) const { return x == p.x && y == p.y; } + bool operator!=(const Point32 &p) const { return x != p.x || y != p.y; } + Point32 operator+(const Point32 &delta) const { return Point32(x + delta.x, y + delta.y); } + Point32 operator-(const Point32 &delta) const { return Point32(x - delta.x, y - delta.y); } + + Point32 &operator+=(const Point32 &delta) { + x += delta.x; + y += delta.y; + return *this; + } + Point32 &operator-=(const Point32 &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } + + operator FloatPoint() { + return FloatPoint(x,y); + } + + +}; struct Rect32 { int32 top, left; ///< The point at the top left of the rectangle (part of the rect). int32 bottom, right; ///< The point at the bottom right of the rectangle (not part of the rect). diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 32931bf05f..d1edced818 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -89,6 +89,7 @@ MODULE_OBJS := \ base/save_thumb_helper.o \ base/timer.o \ detection.o \ + graphics/transform_struct.o \ graphics/transparent_surface.o \ math/math_util.o \ math/matrix4.o \ -- cgit v1.2.3 From 3c0089e31e1392f38cfb0e13d7c4d395bad4f949 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 15:47:05 +0200 Subject: WINTERMUTE: Introduce TransformTools --- engines/wintermute/base/base_sub_frame.cpp | 11 ++++ engines/wintermute/graphics/transform_tools.cpp | 75 +++++++++++++++++++++++++ engines/wintermute/graphics/transform_tools.h | 47 ++++++++++++++++ engines/wintermute/math/floatpoint.h | 52 +++++++++++++++++ engines/wintermute/math/floatrect.h | 52 ----------------- engines/wintermute/math/rect32.h | 3 +- engines/wintermute/module.mk | 1 + 7 files changed, 188 insertions(+), 53 deletions(-) create mode 100644 engines/wintermute/graphics/transform_tools.cpp create mode 100644 engines/wintermute/graphics/transform_tools.h create mode 100644 engines/wintermute/math/floatpoint.h delete mode 100644 engines/wintermute/math/floatrect.h diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index d93cf667f1..d9620d3939 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -38,6 +38,8 @@ #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script_stack.h" +#include "engines/wintermute/graphics/transform_tools.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { @@ -256,6 +258,15 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl } if (rotate != 0.0f) { + Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin; + Point32 origin(x, y); + Rect32 oldRect = getRect(); + Point32 newHotspot; + TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0); + Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot); + newOrigin = origin - newHotspot; + // When the transform functions are refactored to use TransformStruct this will be like: + // res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transformStruct); res = _surface->displayTransform((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), _hotspotX, _hotspotY, getRect(), zoomX, zoomY, alpha, rotate, blendMode, _mirrorX, _mirrorY); } else { if (zoomX == 100 && zoomY == 100) { diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp new file mode 100644 index 0000000000..2390b86391 --- /dev/null +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -0,0 +1,75 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include "engines/wintermute/graphics/transform_tools.h" +#include + +namespace Wintermute { + + FloatPoint TransformTools::transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX, bool mirrorY) { + /* + * Returns the coordinates for a point after rotation + */ + float rotateRad = rotate * M_PI / 180; + FloatPoint newPoint; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/100; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/100; + if (mirrorX) newPoint.x *= -1; + if (mirrorY) newPoint.y *= -1; + /* + * I apply the textbook formula, but first I reverse the Y-axis, otherwise + * I'd be performing a rotation in the wrong direction + */ + return newPoint; + } + + Rect32 TransformTools::newRect (Rect32 oldRect, TransformStruct transform, Point32 *newHotspot) { + Point32 nw(oldRect.left, oldRect.top); + Point32 ne(oldRect.right, oldRect.top); + Point32 sw(oldRect.left, oldRect.bottom); + Point32 se(oldRect.right, oldRect.bottom); + + FloatPoint nw1, ne1, sw1, se1; + + nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); + ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); + sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); + se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); + + float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); + float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); + float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x))); + float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); + + Rect32 res; + newHotspot->y = -floor(top); + newHotspot->x = -floor(left); + + res.top = floor(top) + transform._hotspot.y; + res.bottom = ceil(bottom) + transform._hotspot.y; + res.left = floor(left) + transform._hotspot.x; + res.right = ceil(right) + transform._hotspot.x; + + return res; + } +} diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h new file mode 100644 index 0000000000..fbc0653e64 --- /dev/null +++ b/engines/wintermute/graphics/transform_tools.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef WINTERMUTE_TRANSFORMTOOLS_H +#define WINTERMUTE_TRANSFORMTOOLS_H + +#include "engines/wintermute/math/rect32.h" +#include "engines/wintermute/math/floatpoint.h" +#include "engines/wintermute/graphics/transform_struct.h" + +namespace Wintermute { +class TransformTools { +public: + /** + * Basic transform (scale + rotate) for a single point + */ + static FloatPoint transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX = false, bool mirrorY = false); + + /** + * Takes a rectangle, a transform and a pointer to a point, "newHotspot". + * In return you get the smallest rect that can contain the transformed sprite + * and, as a side-effect, "newHotspot" will tell you where the hotspot will + * have ended up in the new rect, for centering. + */ + static Rect32 newRect (Rect32 oldRect, TransformStruct transform, Point32 *newHotspot); +}; +} // end of namespace Wintermute +#endif diff --git a/engines/wintermute/math/floatpoint.h b/engines/wintermute/math/floatpoint.h new file mode 100644 index 0000000000..bf194d8437 --- /dev/null +++ b/engines/wintermute/math/floatpoint.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef WINTERMUTE_FLOATPOINT_H +#define WINTERMUTE_FLOATPOINT_H + +namespace Wintermute { + +struct FloatPoint { + float x; + float y; + FloatPoint() : x(0), y(0) {} + FloatPoint(float x1, float y1) : x(x1), y(y1) {} + bool operator==(const FloatPoint &p) const { return x == p.x && y == p.y; } + bool operator!=(const FloatPoint &p) const { return x != p.x || y != p.y; } + FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); } + FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); } + + FloatPoint& operator+=(const FloatPoint &delta) { + x += delta.x; + y += delta.y; + return *this; + } + FloatPoint& operator-=(const FloatPoint &delta) { + x -= delta.x; + y -= delta.y; + return *this; + } +}; + +} // end of namespace Wintermute + +#endif diff --git a/engines/wintermute/math/floatrect.h b/engines/wintermute/math/floatrect.h deleted file mode 100644 index f8eb3827fd..0000000000 --- a/engines/wintermute/math/floatrect.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef WINTERMUTE_FLOATRECT_H -#define WINTERMUTE_FLOATRECT_H - -namespace Wintermute { - -struct FloatPoint { - float x; - float y; - FloatPoint() : x(0), y(0) {} - FloatPoint(float x1, float y1) : x(x1), y(y1) {} - bool operator==(const FloatPoint &p) const { return x == p.x && y == p.y; } - bool operator!=(const FloatPoint &p) const { return x != p.x || y != p.y; } - FloatPoint operator+(const FloatPoint &delta) const { return FloatPoint (x + delta.x, y + delta.y); } - FloatPoint operator-(const FloatPoint &delta) const { return FloatPoint (x - delta.x, y - delta.y); } - - FloatPoint& operator+=(const FloatPoint &delta) { - x += delta.x; - y += delta.y; - return *this; - } - FloatPoint& operator-=(const FloatPoint &delta) { - x -= delta.x; - y -= delta.y; - return *this; - } -}; - -} // end of namespace Wintermute - -#endif diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 6618a51e91..d44655311c 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -24,7 +24,8 @@ #define WINTERMUTE_RECT32_H #include "common/system.h" -#include "engines/wintermute/math/floatrect.h" +#include "engines/wintermute/math/floatpoint.h" +#include "common/rect.h" namespace Wintermute { diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index d1edced818..95f9ba2ffb 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -90,6 +90,7 @@ MODULE_OBJS := \ base/timer.o \ detection.o \ graphics/transform_struct.o \ + graphics/transform_tools.o \ graphics/transparent_surface.o \ math/math_util.o \ math/matrix4.o \ -- cgit v1.2.3 From 66ba2ea4558bab4583a7d7bb27e1e254c34f579f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 16:16:26 +0200 Subject: WINTERMUTE: Refactor some bits to use TransformStruct --- engines/wintermute/base/base_sub_frame.cpp | 4 +- engines/wintermute/base/gfx/base_surface.cpp | 4 +- engines/wintermute/base/gfx/base_surface.h | 3 +- .../base/gfx/osystem/base_surface_osystem.cpp | 75 ++++++++++++++-------- .../base/gfx/osystem/base_surface_osystem.h | 5 +- 5 files changed, 57 insertions(+), 34 deletions(-) diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index d9620d3939..b51b723f61 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -265,9 +265,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0); Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot); newOrigin = origin - newHotspot; - // When the transform functions are refactored to use TransformStruct this will be like: - // res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transformStruct); - res = _surface->displayTransform((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), _hotspotX, _hotspotY, getRect(), zoomX, zoomY, alpha, rotate, blendMode, _mirrorX, _mirrorY); + res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { if (zoomX == 100 && zoomY == 100) { res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY); diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp index 2002463ea4..7457e34826 100644 --- a/engines/wintermute/base/gfx/base_surface.cpp +++ b/engines/wintermute/base/gfx/base_surface.cpp @@ -75,8 +75,8 @@ bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) { } ////////////////////////////////////////////////////////////////////////// -bool BaseSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY); +bool BaseSurface::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) { + return displayTransform(x, y, rect, newRect, transform); } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index b83efa0bb8..be7a5c13ca 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -32,6 +32,7 @@ #include "engines/wintermute/base/base.h" #include "engines/wintermute/math/rect32.h" #include "graphics/surface.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { @@ -53,8 +54,8 @@ public: virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0; virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) = 0; virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; - virtual bool displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) = 0; virtual bool restore(); virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 0572ef2f6e..5a12ad94e4 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -52,6 +52,7 @@ BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) { _lockPixels = nullptr; _lockPitch = 0; _loaded = false; + _rotation = 0; } ////////////////////////////////////////////////////////////////////////// @@ -319,39 +320,56 @@ bool BaseSurfaceOSystem::endPixelOp() { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(100, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(100, blendMode, 0xFFFFFFFF, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { - return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(100, 100, 0, 0, 0, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); + _rotation = 0; + return drawSprite(x, y, &rect, nullptr, TransformStruct(zoomX, zoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !transparent, blendMode, mirrorX, mirrorY); + _rotation = 0; + TransformStruct transform; + if (transparent) { + transform = TransformStruct(zoomX, zoomY, 0, 0, 0, blendMode, alpha, mirrorX, mirrorY); + } else { + transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY); + } + return drawSprite(x, y, &rect, nullptr, transform); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { - return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY); +bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) { + _rotation = (uint32)transform._angle; + if (transform._angle < 0.0f) { + warning("Negative rotation: %f %d", transform._angle, _rotation); + _rotation = (uint32)(360.0f + transform._angle); + warning("Negative post rotation: %f %d", transform._angle, _rotation); + } + return drawSprite(x, y, &rect, &newRect, transform); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { +bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transform) { BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); if (!_loaded) { @@ -359,13 +377,13 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo } if (renderer->_forceAlphaColor != 0) { - alpha = renderer->_forceAlphaColor; + transform._rgbaMod = renderer->_forceAlphaColor; } - byte r = RGBCOLGetR(alpha); - byte g = RGBCOLGetG(alpha); - byte b = RGBCOLGetB(alpha); - byte a = RGBCOLGetA(alpha); + byte r = RGBCOLGetR(transform._rgbaMod); + byte g = RGBCOLGetG(transform._rgbaMod); + byte b = RGBCOLGetB(transform._rgbaMod); + byte a = RGBCOLGetA(transform._rgbaMod); renderer->setAlphaMod(a); renderer->setColorMod(r, g, b); @@ -386,8 +404,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo srcRect.setHeight(rect->bottom - rect->top); Common::Rect position; - position.left = x + offsetX; - position.top = y + offsetY; + position.left = x + transform._offset.x; + position.top = y + transform._offset.y; // Crop off-by-ones: if (position.left == -1) { @@ -396,30 +414,35 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo if (position.top == -1) { position.top = 0; // TODO: Something is wrong } - - position.setWidth((int16)((float)srcRect.width() * zoomX / 100.f)); - position.setHeight((int16)((float)srcRect.height() * zoomX / 100.f)); - + if (newRect) { + position.top = y; + position.left = x; + position.right = x + (newRect->right - newRect->left); + position.bottom = y + (newRect->top - newRect->bottom); + position.setWidth(newRect->right - newRect->left); + position.setHeight(newRect->bottom - newRect->top); + } else { + position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / 100.f)); + position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / 100.f)); + } renderer->modTargetRect(&position); - /* position.left += offsetX; - position.top += offsetY;*/ - // TODO: This actually requires us to have the SAME source-offsets every time, // But no checking is in place for that yet. // TODO: Optimize by not doing alpha-blits if we lack or disable alpha bool hasAlpha; - if (_hasAlpha && !alphaDisable) { + if (_hasAlpha && !transform._alphaDisable) { hasAlpha = true; } else { hasAlpha = false; } - if (alphaDisable) { + if (transform._alphaDisable) { warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } - - renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, !hasAlpha); + bool mirrorX = transform._flip && TransparentSurface::FLIP_H; + bool mirrorY = transform._flip && TransparentSurface::FLIP_V; + renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, transform._alphaDisable); return STATUS_OK; } diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 9091ec65b1..b6978d50e4 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -56,7 +56,7 @@ public: bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransform(int x, int y, int hotX, int hotY, Rect32 Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; /* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); @@ -85,10 +85,11 @@ private: Graphics::Surface *_surface; bool _loaded; bool finishLoad(); - bool drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0); + bool drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transformStruct); void genAlphaMask(Graphics::Surface *surface); uint32 getPixelAt(Graphics::Surface *surface, int x, int y); + uint32 _rotation; bool _hasAlpha; void *_lockPixels; int _lockPitch; -- cgit v1.2.3 From 384dd8da7ef8cc7660607301c36b52645942faf0 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 16:27:51 +0200 Subject: WINTERMUTE: Bilinear scaling. Refactor scale(), factor out actual mapping algorithm, add bilinear scaling --- .../wintermute/graphics/transparent_surface.cpp | 129 +++++++++++++++++++-- engines/wintermute/graphics/transparent_surface.h | 12 +- 2 files changed, 128 insertions(+), 13 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index dcdcbf247e..f68259fb94 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -29,6 +29,117 @@ namespace Wintermute { +void TransparentSurface::nearestCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + uint32 color; + + if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { + color = 0; + } else { + color = READ_UINT32((const byte *)src->getBasePtr(projX, projY)); + } + + WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); +} + +void TransparentSurface::bilinearCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + float x1 = floor(projX); + float x2 = ceil(projX); + float y1 = floor(projY); + float y2 = ceil(projY); + + uint32 Q11, Q12, Q21, Q22; + + if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { + Q11 = 0; + } else { + Q11 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y1 + srcRect.top)); + } + + if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { + Q12 = 0; + } else { + Q12 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y2 + srcRect.top)); + } + + if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { + Q21 = 0; + } else { + Q21 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y1 + srcRect.top)); + } + + if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { + Q22 = 0; + } else { + Q22 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y2 + srcRect.top)); + } + + byte *Q11s = (byte *)&Q11; + byte *Q12s = (byte *)&Q12; + byte *Q21s = (byte *)&Q21; + byte *Q22s = (byte *)&Q22; + + uint32 color; + byte *dest = (byte *)&color; + + float q11x = (x2 - projX); + float q11y = (y2 - projY); + float q21x = (projX - x1); + float q21y = (y2 - projY); + float q12x = (x2 - projX); + float q12y = (projY - y1); + float q22x = (projX - x1); + float q22y = (projY - y1); + + if (x1 == x2 && y1 == y2) { + for (int c = 0; c < 4; c++) { + dest[c] = ((float)Q11s[c]); + } + } else { + + if (x1 == x2) { + q11x = 0.5; + q12x = 0.5; + q21x = 0.5; + q22x = 0.5; + } else if (y1 == y2) { + q11y = 0.5; + q12y = 0.5; + q21y = 0.5; + q22y = 0.5; + } + + for (int c = 0; c < 4; c++) { + dest[c] = ( + ((float)Q11s[c]) * q11x * q11y + + ((float)Q21s[c]) * q21x * q21y + + ((float)Q12s[c]) * q12x * q12y + + ((float)Q22s[c]) * (1.0 - + q11x * q11y - + q21x * q21y - + q12x * q12y) + ); + } + } + WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); +} + byte *TransparentSurface::_lookup = nullptr; void TransparentSurface::destroyLookup() { @@ -386,13 +497,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const { Common::Rect srcRect(0, 0, (int16)w, (int16)h); Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight); - return scale(srcRect, dstRect); -} - -// Copied from clone2727's https://github.com/clone2727/scummvm/blob/pegasus/engines/pegasus/surface.cpp#L247 -TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const { - // I'm doing simple linear scaling here - // dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH); + TransparentSurface *target = new TransparentSurface(); assert(format.bytesPerPixel == 4); @@ -406,9 +511,13 @@ TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { - uint32 color = READ_UINT32((const byte *)getBasePtr(x * srcW / dstW + srcRect.left, - y * srcH / dstH + srcRect.top)); - WRITE_UINT32((byte *)target->getBasePtr(x + dstRect.left, y + dstRect.top), color); + float projX = x / (float)dstW * srcW; + float projY = y / (float)dstH * srcH; + if (FAST_TRANSFORM) { + nearestCopy(projX, projY, x, y, srcRect, dstRect, this, target); + } else { + bilinearCopy(projX, projY, x, y, srcRect, dstRect, this, target); + } } } return target; diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index dc079a1fbc..0f48054d7c 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -24,6 +24,10 @@ #include "graphics/surface.h" + +#define FAST_TRANSFORM 0 + + /* * This code is based on Broken Sword 2.5 engine * @@ -49,6 +53,9 @@ struct TransparentSurface : public Graphics::Surface { void setColorKey(char r, char g, char b); void disableColorKey(); + static void bilinearCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); + static void nearestCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); + // Enums /** @brief The possible flipping parameters for the blit methode. @@ -102,9 +109,8 @@ struct TransparentSurface : public Graphics::Surface { uint color = BS_ARGB(255, 255, 255, 255), int width = -1, int height = -1); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); - // The following scale-code supports arbitrary scaling (i.e. no repeats of column 0 at the end of lines) - TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const; - TransparentSurface *scale(const Common::Rect &srcRect, const Common::Rect &dstRect) const; + + TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From cced42a765cff0ad89490ebc0e70a7e00b8a2f4f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 16:38:49 +0200 Subject: WINTERMUTE: Add cast op Common::Rect => Rect32 --- engines/wintermute/math/rect32.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index d44655311c..821df1880e 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -57,12 +57,14 @@ struct Point32 { }; + struct Rect32 { int32 top, left; ///< The point at the top left of the rectangle (part of the rect). int32 bottom, right; ///< The point at the bottom right of the rectangle (not part of the rect). Rect32() : top(0), left(0), bottom(0), right(0) {} Rect32(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {} + Rect32(Common::Rect rect) : top(rect.top), left(rect.left), bottom(rect.bottom), right(rect.right) {} Rect32(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(isValidRect()); } -- cgit v1.2.3 From 58e096de97d7b8a0c09f5ac0bd6ff65853669a80 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 16:47:33 +0200 Subject: WINTERMUTE: Add rotation Add actual rotation code, make ticket-system transformStruct-aware --- .../base/gfx/osystem/base_render_osystem.cpp | 21 ++++---- .../base/gfx/osystem/base_render_osystem.h | 3 +- .../base/gfx/osystem/base_surface_osystem.cpp | 5 +- .../wintermute/base/gfx/osystem/render_ticket.cpp | 60 +++++++++++++--------- .../wintermute/base/gfx/osystem/render_ticket.h | 20 ++++---- .../wintermute/graphics/transparent_surface.cpp | 41 +++++++++++++++ engines/wintermute/graphics/transparent_surface.h | 3 +- 7 files changed, 102 insertions(+), 51 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index e1424cea87..e36eeb3ee6 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -256,7 +256,6 @@ void BaseRenderOSystem::fade(uint16 alpha) { return fadeToColor(0, 0, 0, dwAlpha); } - ////////////////////////////////////////////////////////////////////////// void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) { Common::Rect fillRect; @@ -286,7 +285,7 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect Common::Rect sizeRect(fillRect); sizeRect.translate(-fillRect.top, -fillRect.left); surf.fillRect(fillRect, col); - drawSurface(nullptr, &surf, &sizeRect, &fillRect, false, false); + drawSurface(nullptr, &surf, &sizeRect, &fillRect, TransformStruct()); surf.free(); //SDL_SetRenderDrawColor(_renderer, r, g, b, a); @@ -298,16 +297,18 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const { return _renderSurface->format; } -void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) { +void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform) { + if (_tempDisableDirtyRects || _disableDirtyRects) { - RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); - ticket->_colorMod = _colorMod; + RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); + ticket->_transform._rgbaMod = _colorMod; ticket->_wantsDraw = true; _renderQueue.push_back(ticket); _previousTicket = ticket; drawFromSurface(ticket); return; } + // Start searching from the beginning for the first and second items (since it's empty the first time around // then keep incrementing the start-position, to avoid comparing against already used tickets. if (_drawNum == 0 || _drawNum == 1) { @@ -320,12 +321,11 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S } if (owner) { // Fade-tickets are owner-less - RenderTicket compare(owner, nullptr, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); + RenderTicket compare(owner, nullptr, srcRect, dstRect, transform); compare._batchNum = _batchNum; if (_spriteBatch) { _batchNum++; } - compare._colorMod = _colorMod; RenderQueueIterator it; // Avoid calling end() and operator* every time, when potentially going through // LOTS of tickets. @@ -334,7 +334,6 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S for (it = _lastAddedTicket; it != endIterator; ++it) { compareTicket = *it; if (*(compareTicket) == compare && compareTicket->_isValid) { - compareTicket->_colorMod = _colorMod; if (_disableDirtyRects) { drawFromSurface(compareTicket); } else { @@ -349,8 +348,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S } } } - RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha); - ticket->_colorMod = _colorMod; + RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); if (!_disableDirtyRects) { drawFromTicket(ticket); _previousTicket = ticket; @@ -390,7 +388,7 @@ void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX, dstRect.translate(offsetX, 0); } for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) { - drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, false, false); + drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, TransformStruct()); dstRect.translate(offsetX, 0); } dstRect.left = initLeft; @@ -535,7 +533,6 @@ void BaseRenderOSystem::drawTickets() { // convert from screen-coords to surface-coords. dstClip.translate(-offsetX, -offsetY); - _colorMod = ticket->_colorMod; drawFromSurface(ticket, &pos, &dstClip); _needsFlip = true; } diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 3cb0fa82a3..b3483f0efa 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -33,6 +33,7 @@ #include "common/rect.h" #include "graphics/surface.h" #include "common/list.h" +#include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { class BaseSurfaceOSystem; @@ -80,7 +81,7 @@ public: virtual bool startSpriteBatch() override; virtual bool endSpriteBatch() override; void endSaveLoad(); - void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha = false) ; + void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform); void repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY); BaseSurface *createSurface() override; private: diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 5a12ad94e4..e1348726b4 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -440,10 +440,7 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, if (transform._alphaDisable) { warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } - bool mirrorX = transform._flip && TransparentSurface::FLIP_H; - bool mirrorY = transform._flip && TransparentSurface::FLIP_V; - renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, transform._alphaDisable); - + renderer->drawSurface(this, _surface, &srcRect, &position, transform); return STATUS_OK; } diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 36c5d7b740..23cf5c318e 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -26,22 +26,22 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/graphics/transparent_surface.h" + #include "engines/wintermute/base/gfx/osystem/render_ticket.h" +#include "engines/wintermute/graphics/transform_tools.h" +#include "common/textconsole.h" namespace Wintermute { -RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) : _owner(owner), -_srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(!disableAlpha) { - _colorMod = 0; +RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform) : + _owner(owner), + _srcRect(*srcRect), + _dstRect(*dstRect), + _drawNum(0), + _isValid(true), + _wantsDraw(true), + _transform(transform) { _batchNum = 0; - _mirror = TransparentSurface::FLIP_NONE; - if (mirrorX) { - _mirror |= TransparentSurface::FLIP_V; - } - if (mirrorY) { - _mirror |= TransparentSurface::FLIP_H; - } if (surf) { _surface = new Graphics::Surface(); _surface->create((uint16)srcRect->width(), (uint16)srcRect->height(), surf->format); @@ -51,7 +51,14 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw( memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); } // Then scale it if necessary - if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) { + if (_transform._angle != 0) { + TransparentSurface src(*_surface, false); + Common::Rect srcRect_1(srcRect->left, srcRect->top, srcRect->right, srcRect->bottom); + Graphics::Surface *temp = src.rotate(srcRect_1, transform); + _surface->free(); + delete _surface; + _surface = temp; + } else if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) { TransparentSurface src(*_surface, false); Graphics::Surface *temp = src.scale(dstRect->width(), dstRect->height()); _surface->free(); @@ -60,6 +67,14 @@ _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw( } } else { _surface = nullptr; + + if (transform._angle != 0) { // Make sure comparison-tickets get the correct width + Rect32 dstRect; + Point32 newHotspot; + dstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); + _dstRect.setWidth(dstRect.right-dstRect.left); + _dstRect.setHeight(dstRect.bottom-dstRect.top); + } } } @@ -70,32 +85,31 @@ RenderTicket::~RenderTicket() { } } -bool RenderTicket::operator==(RenderTicket &t) { +bool RenderTicket::operator==(const RenderTicket &t) const { if ((t._owner != _owner) || (t._batchNum != _batchNum) || - (t._hasAlpha != _hasAlpha) || - (t._mirror != _mirror) || - (t._colorMod != _colorMod) || + (t._transform != _transform) || (t._dstRect != _dstRect) || - (t._srcRect != _srcRect)) { + (t._srcRect != _srcRect) + ) { return false; } return true; } // Replacement for SDL2's SDL_RenderCopy -void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) { +void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const { TransparentSurface src(*getSurface(), false); Common::Rect clipRect; clipRect.setWidth(getSurface()->w); clipRect.setHeight(getSurface()->h); - src._enableAlphaBlit = _hasAlpha; - src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _mirror, &clipRect, _colorMod, clipRect.width(), clipRect.height()); + src._enableAlphaBlit = !_transform._alphaDisable; + src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _transform._flip, &clipRect, _transform._rgbaMod, clipRect.width(), clipRect.height()); } -void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) { +void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const { TransparentSurface src(*getSurface(), false); bool doDelete = false; if (!clipRect) { @@ -105,8 +119,8 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect clipRect->setHeight(getSurface()->h); } - src._enableAlphaBlit = _hasAlpha; - src.blit(*_targetSurface, dstRect->left, dstRect->top, _mirror, clipRect, _colorMod, clipRect->width(), clipRect->height()); + src._enableAlphaBlit = !_transform._alphaDisable; + src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height()); if (doDelete) { delete clipRect; } diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h index 968b42b5e1..c294cb3082 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.h +++ b/engines/wintermute/base/gfx/osystem/render_ticket.h @@ -29,6 +29,7 @@ #ifndef WINTERMUTE_RENDER_TICKET_H #define WINTERMUTE_RENDER_TICKET_H +#include "engines/wintermute/graphics/transparent_surface.h" #include "graphics/surface.h" #include "common/rect.h" @@ -37,14 +38,14 @@ namespace Wintermute { class BaseSurfaceOSystem; class RenderTicket { public: - RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false, bool disableAlpha = false); - RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {} + RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, TransformStruct transform); + RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0), _transform(TransformStruct()) {} ~RenderTicket(); - const Graphics::Surface *getSurface() { return _surface; } + const Graphics::Surface *getSurface() const { return _surface; } // Non-dirty-rects: - void drawToSurface(Graphics::Surface *_targetSurface); + void drawToSurface(Graphics::Surface *_targetSurface) const; // Dirty-rects: - void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect); + void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) const; Common::Rect _dstRect; uint32 _batchNum; @@ -52,16 +53,15 @@ public: bool _isValid; bool _wantsDraw; uint32 _drawNum; - uint32 _colorMod; + TransformStruct _transform; + BaseSurfaceOSystem *_owner; - bool operator==(RenderTicket &a); - const Common::Rect *getSrcRect() { return &_srcRect; } + bool operator==(const RenderTicket &a) const; + const Common::Rect *getSrcRect() const { return &_srcRect; } private: Graphics::Surface *_surface; Common::Rect _srcRect; - bool _hasAlpha; - uint32 _mirror; }; } // end of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index f68259fb94..87cb143dac 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -23,9 +23,11 @@ #include "common/endian.h" #include "common/util.h" #include "common/rect.h" +#include "common/math.h" #include "common/textconsole.h" #include "graphics/primitives.h" #include "engines/wintermute/graphics/transparent_surface.h" +#include "engines/wintermute/graphics/transform_tools.h" namespace Wintermute { @@ -494,6 +496,45 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } +TransparentSurface *TransparentSurface::rotate(Common::Rect aSrcRect, TransformStruct transform) const { + Point32 newHotspot; + Rect32 rect = TransformTools::newRect(Rect32 (aSrcRect), transform, &newHotspot); + Common::Rect srcRect(0, 0, (int16)(aSrcRect.right - aSrcRect.left), (int16)(aSrcRect.bottom - aSrcRect.top)); + Common::Rect dstRect(0, 0, (int16)(rect.right - rect.left), (int16)(rect.bottom - rect.top)); + + TransparentSurface *target = new TransparentSurface(); + assert(format.bytesPerPixel == 4); + + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + target->create((uint16)dstW, (uint16)dstH, this->format); + + uint32 invAngle = (360 - transform._angle) % 360; + float invCos = cos(invAngle * M_PI / 180.0); + float invSin = sin(invAngle * M_PI / 180.0); + + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; + + float targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + float targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + + targX += transform._hotspot.x; + targY += transform._hotspot.y; + + if (FAST_TRANSFORM) { + bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + } else { + bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + } + } + } + return target; +} + TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const { Common::Rect srcRect(0, 0, (int16)w, (int16)h); Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight); diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 0f48054d7c..b81dbe86e9 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -23,7 +23,7 @@ #define GRAPHICS_TRANSPARENTSURFACE_H #include "graphics/surface.h" - +#include "engines/wintermute/graphics/transform_struct.h" #define FAST_TRANSFORM 0 @@ -111,6 +111,7 @@ struct TransparentSurface : public Graphics::Surface { void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; + TransparentSurface *rotate(Common::Rect srcRect, TransformStruct transform) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From 321c7f071668025b1c9bb16e28a70c29843e45de Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 17:19:52 +0200 Subject: WINTERMUTE: Removed useless argument from rotate() --- engines/wintermute/base/gfx/osystem/render_ticket.cpp | 3 +-- engines/wintermute/graphics/transparent_surface.cpp | 8 ++++---- engines/wintermute/graphics/transparent_surface.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 23cf5c318e..3f94c2e500 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -53,8 +53,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s // Then scale it if necessary if (_transform._angle != 0) { TransparentSurface src(*_surface, false); - Common::Rect srcRect_1(srcRect->left, srcRect->top, srcRect->right, srcRect->bottom); - Graphics::Surface *temp = src.rotate(srcRect_1, transform); + Graphics::Surface *temp = src.rotate(transform); _surface->free(); delete _surface; _surface = temp; diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 87cb143dac..3f64305487 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -496,10 +496,10 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } -TransparentSurface *TransparentSurface::rotate(Common::Rect aSrcRect, TransformStruct transform) const { +TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const { Point32 newHotspot; - Rect32 rect = TransformTools::newRect(Rect32 (aSrcRect), transform, &newHotspot); - Common::Rect srcRect(0, 0, (int16)(aSrcRect.right - aSrcRect.left), (int16)(aSrcRect.bottom - aSrcRect.top)); + Common::Rect srcRect(0, 0, (int16)w, (int16)h); + Rect32 rect = TransformTools::newRect(Rect32 (srcRect), transform, &newHotspot); Common::Rect dstRect(0, 0, (int16)(rect.right - rect.left), (int16)(rect.bottom - rect.top)); TransparentSurface *target = new TransparentSurface(); @@ -526,7 +526,7 @@ TransparentSurface *TransparentSurface::rotate(Common::Rect aSrcRect, TransformS targY += transform._hotspot.y; if (FAST_TRANSFORM) { - bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + nearestCopy(targX, targY, x, y, srcRect, dstRect, this, target); } else { bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); } diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index b81dbe86e9..474b10a6f1 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -111,7 +111,7 @@ struct TransparentSurface : public Graphics::Surface { void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; - TransparentSurface *rotate(Common::Rect srcRect, TransformStruct transform) const; + TransparentSurface *rotate(TransformStruct transform) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From e30ab15bb0f21a77f8e1752745cd6ec954661d83 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 17:25:46 +0200 Subject: WINTERMUTE: Move if() outside transform loop --- .../wintermute/graphics/transparent_surface.cpp | 60 ++++++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 3f64305487..403ce8984e 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -513,25 +513,41 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const uint32 invAngle = (360 - transform._angle) % 360; float invCos = cos(invAngle * M_PI / 180.0); float invSin = sin(invAngle * M_PI / 180.0); + float targX; + float targY; - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - int x1 = x - newHotspot.x; - int y1 = y - newHotspot.y; + if (FAST_TRANSFORM) { + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; - float targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - float targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; - targX += transform._hotspot.x; - targY += transform._hotspot.y; + targX += transform._hotspot.x; + targY += transform._hotspot.y; - if (FAST_TRANSFORM) { nearestCopy(targX, targY, x, y, srcRect, dstRect, this, target); - } else { - bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + } + } + } else { + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; + + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + + targX += transform._hotspot.x; + targY += transform._hotspot.y; + + bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); } } } + return target; } @@ -550,13 +566,23 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) target->create((uint16)dstW, (uint16)dstH, this->format); - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - float projX = x / (float)dstW * srcW; - float projY = y / (float)dstH * srcH; - if (FAST_TRANSFORM) { + if (FAST_TRANSFORM) { + int projX; + int projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / dstW * srcW; + projY = y / dstH * srcH; nearestCopy(projX, projY, x, y, srcRect, dstRect, this, target); - } else { + } + } + } else { + float projX; + float projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / (float)dstW * srcW; + projY = y / (float)dstH * srcH; bilinearCopy(projX, projY, x, y, srcRect, dstRect, this, target); } } -- cgit v1.2.3 From e47deb0e0e02f8ab288c21a33f5ec6187ab15e71 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 27 Jun 2013 17:28:43 +0200 Subject: WINTERMUTE: Rename pixel copy functions --- engines/wintermute/graphics/transparent_surface.cpp | 12 ++++++------ engines/wintermute/graphics/transparent_surface.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 403ce8984e..bdf074fdd9 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -31,7 +31,7 @@ namespace Wintermute { -void TransparentSurface::nearestCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { +void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { int srcW = srcRect.width(); int srcH = srcRect.height(); int dstW = dstRect.width(); @@ -51,7 +51,7 @@ void TransparentSurface::nearestCopy(float projX, float projY, int dstX, int dst WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); } -void TransparentSurface::bilinearCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { +void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { int srcW = srcRect.width(); int srcH = srcRect.height(); @@ -528,7 +528,7 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const targX += transform._hotspot.x; targY += transform._hotspot.y; - nearestCopy(targX, targY, x, y, srcRect, dstRect, this, target); + copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); } } } else { @@ -543,7 +543,7 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const targX += transform._hotspot.x; targY += transform._hotspot.y; - bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); } } } @@ -573,7 +573,7 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) for (int x = 0; x < dstW; x++) { projX = x / dstW * srcW; projY = y / dstH * srcH; - nearestCopy(projX, projY, x, y, srcRect, dstRect, this, target); + copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); } } } else { @@ -583,7 +583,7 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) for (int x = 0; x < dstW; x++) { projX = x / (float)dstW * srcW; projY = y / (float)dstH * srcH; - bilinearCopy(projX, projY, x, y, srcRect, dstRect, this, target); + copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); } } } diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 474b10a6f1..f9486d1b25 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -53,8 +53,8 @@ struct TransparentSurface : public Graphics::Surface { void setColorKey(char r, char g, char b); void disableColorKey(); - static void bilinearCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); - static void nearestCopy(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); + static void copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); + static void copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); // Enums /** -- cgit v1.2.3 From d2a249384eed076195b86f24ae1a041a93b3cd89 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Fri, 28 Jun 2013 16:19:34 +0200 Subject: WINTERMUTE: Partial fix for mirrored sprites Still weird with rotated + mirrored + scaled sprites. Offset. --- engines/wintermute/graphics/transform_tools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 2390b86391..f0a092a31b 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -32,8 +32,8 @@ namespace Wintermute { */ float rotateRad = rotate * M_PI / 180; FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/100; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/100; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/100.0; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/100.0; if (mirrorX) newPoint.x *= -1; if (mirrorY) newPoint.y *= -1; /* -- cgit v1.2.3 From b788ae7f382ca05cecdf0eba5bfb176279299416 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Sat, 29 Jun 2013 12:09:46 +0200 Subject: WINTERMUTE: Swap flip bits --- engines/wintermute/graphics/transparent_surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index bdf074fdd9..5606d41ae6 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -363,12 +363,12 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p int inStep = 4; int inoStep = img->pitch; - if (flipping & TransparentSurface::FLIP_V) { + if (flipping & TransparentSurface::FLIP_H) { inStep = -inStep; xp = img->w - 1; } - if (flipping & TransparentSurface::FLIP_H) { + if (flipping & TransparentSurface::FLIP_V) { inoStep = -inoStep; yp = img->h - 1; } -- cgit v1.2.3 From 8bed134ad6a155ec6b35e3cba4a212e016bf3c90 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Sun, 7 Jul 2013 23:11:32 +0200 Subject: WINTERMUTE: Force angle normalization This fixes the issues in J.U.L.I.A. --- engines/wintermute/base/base_sub_frame.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index b51b723f61..eb1c859c2f 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -235,6 +235,12 @@ const char* BaseSubFrame::getSurfaceFilename() { ////////////////////////////////////////////////////////////////////// bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { + + while (rotate < 0) { + rotate += 360.0f; + } + rotate = fmod(rotate, 360.0f); + if (!_surface) { return STATUS_OK; } -- cgit v1.2.3 From 0b21d6dca2ad5be41fa2aa4c2bed2cb694fba4d1 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 8 Jul 2013 15:39:23 +0200 Subject: WINTERMUTE: Fix alpha bug in engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp This fixes the "TV static" bug in J.U.L.I.A. --- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index e1348726b4..adbef559df 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -328,7 +328,7 @@ bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode ble ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(100, blendMode, 0xFFFFFFFF, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(100, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From b34d7b753912af6dd971872cd702d489974606ff Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 9 Jul 2013 20:57:03 +0200 Subject: WINTERMUTE: *transform as pointer in transform_tools --- engines/wintermute/base/base_sub_frame.cpp | 2 +- .../wintermute/base/gfx/osystem/render_ticket.cpp | 4 ++-- engines/wintermute/graphics/transform_tools.cpp | 21 +++++++++++--------- engines/wintermute/graphics/transform_tools.h | 2 +- .../wintermute/graphics/transparent_surface.cpp | 23 ++++++++++++---------- engines/wintermute/graphics/transparent_surface.h | 2 +- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index eb1c859c2f..dbf46eae2e 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -269,7 +269,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl Rect32 oldRect = getRect(); Point32 newHotspot; TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0); - Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot); + Rect32 newRect = TransformTools::newRect (oldRect, &transform, &newHotspot); newOrigin = origin - newHotspot; res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 3f94c2e500..8ea4f18605 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -53,7 +53,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s // Then scale it if necessary if (_transform._angle != 0) { TransparentSurface src(*_surface, false); - Graphics::Surface *temp = src.rotate(transform); + Graphics::Surface *temp = src.rotate(&transform); _surface->free(); delete _surface; _surface = temp; @@ -70,7 +70,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s if (transform._angle != 0) { // Make sure comparison-tickets get the correct width Rect32 dstRect; Point32 newHotspot; - dstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); + dstRect = TransformTools::newRect(_srcRect, &transform, &newHotspot); _dstRect.setWidth(dstRect.right-dstRect.left); _dstRect.setHeight(dstRect.bottom-dstRect.top); } diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index f0a092a31b..2388b88236 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -43,7 +43,10 @@ namespace Wintermute { return newPoint; } - Rect32 TransformTools::newRect (Rect32 oldRect, TransformStruct transform, Point32 *newHotspot) { + Rect32 TransformTools::newRect (Rect32 oldRect, TransformStruct *transform, Point32 *newHotspot) { + + assert (transform); + Point32 nw(oldRect.left, oldRect.top); Point32 ne(oldRect.right, oldRect.top); Point32 sw(oldRect.left, oldRect.bottom); @@ -51,10 +54,10 @@ namespace Wintermute { FloatPoint nw1, ne1, sw1, se1; - nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); - ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); - sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); - se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); + nw1 = transformPoint(nw - transform->_hotspot, transform->_angle, transform->_zoom); + ne1 = transformPoint(ne - transform->_hotspot, transform->_angle, transform->_zoom); + sw1 = transformPoint(sw - transform->_hotspot, transform->_angle, transform->_zoom); + se1 = transformPoint(se - transform->_hotspot, transform->_angle, transform->_zoom); float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); @@ -65,10 +68,10 @@ namespace Wintermute { newHotspot->y = -floor(top); newHotspot->x = -floor(left); - res.top = floor(top) + transform._hotspot.y; - res.bottom = ceil(bottom) + transform._hotspot.y; - res.left = floor(left) + transform._hotspot.x; - res.right = ceil(right) + transform._hotspot.x; + res.top = floor(top) + transform->_hotspot.y; + res.bottom = ceil(bottom) + transform->_hotspot.y; + res.left = floor(left) + transform->_hotspot.x; + res.right = ceil(right) + transform->_hotspot.x; return res; } diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index fbc0653e64..ae60e5ab32 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -41,7 +41,7 @@ public: * and, as a side-effect, "newHotspot" will tell you where the hotspot will * have ended up in the new rect, for centering. */ - static Rect32 newRect (Rect32 oldRect, TransformStruct transform, Point32 *newHotspot); + static Rect32 newRect (Rect32 oldRect, TransformStruct *transform, Point32 *newHotspot); }; } // end of namespace Wintermute #endif diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 5606d41ae6..1139b08199 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -496,7 +496,10 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } -TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const { +TransparentSurface *TransparentSurface::rotate(TransformStruct *transform) const { + + assert (transform); + Point32 newHotspot; Common::Rect srcRect(0, 0, (int16)w, (int16)h); Rect32 rect = TransformTools::newRect(Rect32 (srcRect), transform, &newHotspot); @@ -510,7 +513,7 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const target->create((uint16)dstW, (uint16)dstH, this->format); - uint32 invAngle = (360 - transform._angle) % 360; + uint32 invAngle = (360 - transform->_angle) % 360; float invCos = cos(invAngle * M_PI / 180.0); float invSin = sin(invAngle * M_PI / 180.0); float targX; @@ -522,11 +525,11 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const int x1 = x - newHotspot.x; int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform->_zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform->_zoom.y + srcRect.top; - targX += transform._hotspot.x; - targY += transform._hotspot.y; + targX += transform->_hotspot.x; + targY += transform->_hotspot.y; copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); } @@ -537,11 +540,11 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const int x1 = x - newHotspot.x; int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform->_zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform->_zoom.y + srcRect.top; - targX += transform._hotspot.x; - targY += transform._hotspot.y; + targX += transform->_hotspot.x; + targY += transform->_hotspot.y; copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); } diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index f9486d1b25..c01b10d96f 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -111,7 +111,7 @@ struct TransparentSurface : public Graphics::Surface { void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; - TransparentSurface *rotate(TransformStruct transform) const; + TransparentSurface *rotate(TransformStruct *transform) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From 285ed18979a470c458654f9f0c42ca02aa927f80 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 9 Jul 2013 21:02:55 +0200 Subject: WINTERMUTE: Rename rotate() -> rotoscale() for consistency --- engines/wintermute/base/gfx/osystem/render_ticket.cpp | 2 +- engines/wintermute/graphics/transparent_surface.cpp | 3 ++- engines/wintermute/graphics/transparent_surface.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 8ea4f18605..2049d3ec57 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -53,7 +53,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s // Then scale it if necessary if (_transform._angle != 0) { TransparentSurface src(*_surface, false); - Graphics::Surface *temp = src.rotate(&transform); + Graphics::Surface *temp = src.rotoscale(&transform); _surface->free(); delete _surface; _surface = temp; diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 1139b08199..07c2537d0f 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -496,9 +496,10 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } -TransparentSurface *TransparentSurface::rotate(TransformStruct *transform) const { +TransparentSurface *TransparentSurface::rotoscale(TransformStruct *transform) const { assert (transform); + assert (transform->_angle != 0); // This would not be ideal Point32 newHotspot; Common::Rect srcRect(0, 0, (int16)w, (int16)h); diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index c01b10d96f..2798323379 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -111,7 +111,7 @@ struct TransparentSurface : public Graphics::Surface { void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; - TransparentSurface *rotate(TransformStruct *transform) const; + TransparentSurface *rotoscale (TransformStruct *transform) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From ae589c41ff869bb7e2352a2a60764b46bd80b72c Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 9 Jul 2013 21:52:16 +0200 Subject: WINTERMUTE: Deprecate setAlphaMod, setColorMod --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 13 +++---------- .../wintermute/base/gfx/osystem/base_surface_osystem.cpp | 8 -------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index e36eeb3ee6..143879c991 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -60,8 +60,7 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _borderLeft = _borderRight = _borderTop = _borderBottom = 0; _ratioX = _ratioY = 1.0f; - setAlphaMod(255); - setColorMod(255, 255, 255); + _colorMod = 0xFFFFFFFF; _dirtyRect = nullptr; _disableDirtyRects = false; _tempDisableDirtyRects = 0; @@ -151,15 +150,11 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { } void BaseRenderOSystem::setAlphaMod(byte alpha) { - byte r = RGBCOLGetR(_colorMod); - byte g = RGBCOLGetB(_colorMod); - byte b = RGBCOLGetB(_colorMod); - _colorMod = BS_ARGB(alpha, r, g, b); + error("DEPRECATED: BaseRenderOSystem::setAlphaMod(byte alpha)"); } void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) { - byte alpha = RGBCOLGetA(_colorMod); - _colorMod = BS_ARGB(alpha, r, g, b); + error("DEPRECATED: void BaseRenderOSystem::setColorMod(byte r, byte g, byte b)"); } bool BaseRenderOSystem::indicatorFlip() { @@ -278,8 +273,6 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect //TODO: This is only here until I'm sure about the final pixelformat uint32 col = _renderSurface->format.ARGBToColor(a, r, g, b); - setAlphaMod(255); - setColorMod(255, 255, 255); Graphics::Surface surf; surf.create((uint16)fillRect.width(), (uint16)fillRect.height(), _renderSurface->format); Common::Rect sizeRect(fillRect); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index adbef559df..a7866472e7 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -380,14 +380,6 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, transform._rgbaMod = renderer->_forceAlphaColor; } - byte r = RGBCOLGetR(transform._rgbaMod); - byte g = RGBCOLGetG(transform._rgbaMod); - byte b = RGBCOLGetB(transform._rgbaMod); - byte a = RGBCOLGetA(transform._rgbaMod); - - renderer->setAlphaMod(a); - renderer->setColorMod(r, g, b); - #if 0 // These are kept for reference if BlendMode is reimplemented at some point. if (alphaDisable) { SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE); -- cgit v1.2.3 From b6ed5ee816e7bb23e21acfaee56835e167c6025f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 9 Jul 2013 22:10:33 +0200 Subject: WINTERMUTE: Reinstate rgbaMod comparisons for compare-tickets --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 143879c991..e647b0e446 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -327,6 +327,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S for (it = _lastAddedTicket; it != endIterator; ++it) { compareTicket = *it; if (*(compareTicket) == compare && compareTicket->_isValid) { + compareTicket->_transform._rgbaMod = transform._rgbaMod; if (_disableDirtyRects) { drawFromSurface(compareTicket); } else { @@ -526,6 +527,7 @@ void BaseRenderOSystem::drawTickets() { // convert from screen-coords to surface-coords. dstClip.translate(-offsetX, -offsetY); + _colorMod = ticket->_transform._rgbaMod; drawFromSurface(ticket, &pos, &dstClip); _needsFlip = true; } -- cgit v1.2.3 From 1b9967400dbf28fa34dde175fdb4ad88c39ea623 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 9 Jul 2013 22:20:39 +0200 Subject: WINTERMUTE: Use constants from transform_tools for consistency --- engines/wintermute/base/base_sprite.h | 9 +++++---- engines/wintermute/base/base_sub_frame.cpp | 15 ++++++++------- .../wintermute/base/gfx/osystem/base_surface_osystem.h | 8 ++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 05cb9fc936..6badffa827 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -32,6 +32,7 @@ #include "engines/wintermute/coll_templ.h" #include "engines/wintermute/base/base_script_holder.h" +#include "engines/wintermute/graphics/transform_tools.h" namespace Wintermute { class BaseFrame; @@ -44,17 +45,17 @@ public: void setDefaults(); DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) - bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); + bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = DEFAULT_ZOOM_X, float scaleY = DEFAULT_ZOOM_Y); int32 _moveY; int32 _moveX; - bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); - bool getCurrentFrame(float zoomX = 100, float zoomY = 100); + bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD, float rotate = DEFAULT_ANGLE, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool getCurrentFrame(float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y); void reset(); bool isChanged(); bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); + bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD); bool _looping; int32 _currentFrame; bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr); diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index dbf46eae2e..0028de1908 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -48,8 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _surface = nullptr; - _hotspotX = _hotspotY = 0; - _alpha = 0xFFFFFFFF; + _hotspotX = DEFAULT_HOTSPOT_X; + _hotspotY = DEFAULT_HOTSPOT_Y; + _alpha = DEFAULT_RGBAMOD; _transparent = 0xFFFF00FF; _wantsDefaultRect = false; @@ -246,7 +247,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl } if (registerOwner != nullptr && !_decoration) { - if (zoomX == 100 && zoomY == 100) { + if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise)); } else { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise)); @@ -259,11 +260,11 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl bool res; //if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha) - if (_alpha != 0xFFFFFFFF) { + if (_alpha != DEFAULT_RGBAMOD) { alpha = _alpha; } - if (rotate != 0.0f) { + if (rotate != DEFAULT_ANGLE) { Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin; Point32 origin(x, y); Rect32 oldRect = getRect(); @@ -273,10 +274,10 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl newOrigin = origin - newHotspot; res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { - if (zoomX == 100 && zoomY == 100) { + if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY); } else { - res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); + res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / DEFAULT_ZOOM_X)), (int)(y - _hotspotY * (zoomY / DEFAULT_ZOOM_Y)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); } } diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index b6978d50e4..7eef416d0e 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -51,11 +51,11 @@ public: bool endPixelOp() override; - bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; + bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; -- cgit v1.2.3 From dafcef5c9f5ddc27ca804ea1da0ab37720b103c8 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 11:17:10 +0200 Subject: WINTERMUTE: Replace normalization loop with if() for legibility --- engines/wintermute/base/base_sub_frame.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 0028de1908..6f79d7f3a7 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -237,11 +237,11 @@ const char* BaseSubFrame::getSurfaceFilename() { ////////////////////////////////////////////////////////////////////// bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { - while (rotate < 0) { + rotate = fmod(rotate, 360.0f); + if (rotate < 0) { rotate += 360.0f; } - rotate = fmod(rotate, 360.0f); - + if (!_surface) { return STATUS_OK; } -- cgit v1.2.3 From 0153f762b16d33c350cde5f472bba42733f18dc7 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 11:27:40 +0200 Subject: WINTERMUTE: Defaults -> float --- engines/wintermute/graphics/transform_struct.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 9a28a48bd1..ed30044174 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -26,8 +26,8 @@ #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/dctypes.h" -#define DEFAULT_ZOOM_X 100 -#define DEFAULT_ZOOM_Y 100 +#define DEFAULT_ZOOM_X 100.0 +#define DEFAULT_ZOOM_Y 100.0 #define DEFAULT_RGBAMOD 0xFFFFFFFF #define DEFAULT_HOTSPOT_X 0 #define DEFAULT_HOTSPOT_Y 0 -- cgit v1.2.3 From f014cccb94e0b3244a3e6dca91db7ca7552e6d79 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 11:27:50 +0200 Subject: WINTERMUTE: Formatting --- engines/wintermute/graphics/transform_tools.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 2388b88236..0ab28eb275 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -27,19 +27,16 @@ namespace Wintermute { FloatPoint TransformTools::transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX, bool mirrorY) { - /* - * Returns the coordinates for a point after rotation - */ float rotateRad = rotate * M_PI / 180; FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/100.0; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/100.0; - if (mirrorX) newPoint.x *= -1; - if (mirrorY) newPoint.y *= -1; - /* - * I apply the textbook formula, but first I reverse the Y-axis, otherwise - * I'd be performing a rotation in the wrong direction - */ + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/DEFAULT_ZOOM_X; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/DEFAULT_ZOOM_Y; + if (mirrorX) { + newPoint.x *= -1; + } + if (mirrorY) { + newPoint.y *= -1; + } return newPoint; } -- cgit v1.2.3 From 9f97ad6a3e9e10fa7164a4e545c1705896f77925 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 11:42:16 +0200 Subject: WINTERMUTE: s/*transform/const &transform/ --- engines/wintermute/base/base_sub_frame.cpp | 2 +- .../wintermute/base/gfx/osystem/render_ticket.cpp | 4 +- engines/wintermute/graphics/transform_tools.cpp | 20 +++-- engines/wintermute/graphics/transform_tools.h | 2 +- .../wintermute/graphics/transparent_surface.cpp | 87 +++++++++++----------- engines/wintermute/graphics/transparent_surface.h | 4 +- 6 files changed, 58 insertions(+), 61 deletions(-) diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 6f79d7f3a7..f8c4000324 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -270,7 +270,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl Rect32 oldRect = getRect(); Point32 newHotspot; TransformStruct transform = TransformStruct(zoomX, zoomY, rotate, _hotspotX, _hotspotY, blendMode, alpha, _mirrorX, _mirrorY, 0, 0); - Rect32 newRect = TransformTools::newRect (oldRect, &transform, &newHotspot); + Rect32 newRect = TransformTools::newRect (oldRect, transform, &newHotspot); newOrigin = origin - newHotspot; res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 2049d3ec57..b11e0722af 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -53,7 +53,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s // Then scale it if necessary if (_transform._angle != 0) { TransparentSurface src(*_surface, false); - Graphics::Surface *temp = src.rotoscale(&transform); + Graphics::Surface *temp = src.rotoscale(transform); _surface->free(); delete _surface; _surface = temp; @@ -70,7 +70,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s if (transform._angle != 0) { // Make sure comparison-tickets get the correct width Rect32 dstRect; Point32 newHotspot; - dstRect = TransformTools::newRect(_srcRect, &transform, &newHotspot); + dstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); _dstRect.setWidth(dstRect.right-dstRect.left); _dstRect.setHeight(dstRect.bottom-dstRect.top); } diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 0ab28eb275..194bedec64 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -40,9 +40,7 @@ namespace Wintermute { return newPoint; } - Rect32 TransformTools::newRect (Rect32 oldRect, TransformStruct *transform, Point32 *newHotspot) { - - assert (transform); + Rect32 TransformTools::newRect (Rect32 oldRect, const TransformStruct &transform, Point32 *newHotspot) { Point32 nw(oldRect.left, oldRect.top); Point32 ne(oldRect.right, oldRect.top); @@ -51,10 +49,10 @@ namespace Wintermute { FloatPoint nw1, ne1, sw1, se1; - nw1 = transformPoint(nw - transform->_hotspot, transform->_angle, transform->_zoom); - ne1 = transformPoint(ne - transform->_hotspot, transform->_angle, transform->_zoom); - sw1 = transformPoint(sw - transform->_hotspot, transform->_angle, transform->_zoom); - se1 = transformPoint(se - transform->_hotspot, transform->_angle, transform->_zoom); + nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); + ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); + sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); + se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); @@ -65,10 +63,10 @@ namespace Wintermute { newHotspot->y = -floor(top); newHotspot->x = -floor(left); - res.top = floor(top) + transform->_hotspot.y; - res.bottom = ceil(bottom) + transform->_hotspot.y; - res.left = floor(left) + transform->_hotspot.x; - res.right = ceil(right) + transform->_hotspot.x; + res.top = floor(top) + transform._hotspot.y; + res.bottom = ceil(bottom) + transform._hotspot.y; + res.left = floor(left) + transform._hotspot.x; + res.right = ceil(right) + transform._hotspot.x; return res; } diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index ae60e5ab32..fb165d7ec8 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -41,7 +41,7 @@ public: * and, as a side-effect, "newHotspot" will tell you where the hotspot will * have ended up in the new rect, for centering. */ - static Rect32 newRect (Rect32 oldRect, TransformStruct *transform, Point32 *newHotspot); + static Rect32 newRect (Rect32 oldRect, const TransformStruct &transform, Point32 *newHotspot); }; } // end of namespace Wintermute #endif diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 07c2537d0f..0ec0b84f25 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -496,10 +496,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p return retSize; } -TransparentSurface *TransparentSurface::rotoscale(TransformStruct *transform) const { +TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const { - assert (transform); - assert (transform->_angle != 0); // This would not be ideal + assert (transform._angle != 0); // This would not be ideal Point32 newHotspot; Common::Rect srcRect(0, 0, (int16)w, (int16)h); @@ -514,43 +513,43 @@ TransparentSurface *TransparentSurface::rotoscale(TransformStruct *transform) co target->create((uint16)dstW, (uint16)dstH, this->format); - uint32 invAngle = (360 - transform->_angle) % 360; + uint32 invAngle = (360 - transform._angle) % 360; float invCos = cos(invAngle * M_PI / 180.0); float invSin = sin(invAngle * M_PI / 180.0); float targX; float targY; - if (FAST_TRANSFORM) { - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - int x1 = x - newHotspot.x; - int y1 = y - newHotspot.y; +#if ENABLE_BILINEAR + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform->_zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform->_zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; - targX += transform->_hotspot.x; - targY += transform->_hotspot.y; + targX += transform._hotspot.x; + targY += transform._hotspot.y; - copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); - } + copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); } - } else { - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - int x1 = x - newHotspot.x; - int y1 = y - newHotspot.y; + } +#else + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform->_zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform->_zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; - targX += transform->_hotspot.x; - targY += transform->_hotspot.y; + targX += transform._hotspot.x; + targY += transform._hotspot.y; - copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); - } + copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); } } +#endif return target; } @@ -570,27 +569,27 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) target->create((uint16)dstW, (uint16)dstH, this->format); - if (FAST_TRANSFORM) { - int projX; - int projY; - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - projX = x / dstW * srcW; - projY = y / dstH * srcH; - copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); - } +#if ENABLE_BILINEAR + float projX; + float projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / (float)dstW * srcW; + projY = y / (float)dstH * srcH; + copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); } - } else { - float projX; - float projY; - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - projX = x / (float)dstW * srcW; - projY = y / (float)dstH * srcH; - copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); - } + } +#else + int projX; + int projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / dstW * srcW; + projY = y / dstH * srcH; + copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); } } +#endif return target; } diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 2798323379..71c139a76a 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -25,7 +25,7 @@ #include "graphics/surface.h" #include "engines/wintermute/graphics/transform_struct.h" -#define FAST_TRANSFORM 0 +#define ENABLE_BILINEAR 0 /* @@ -111,7 +111,7 @@ struct TransparentSurface : public Graphics::Surface { void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; - TransparentSurface *rotoscale (TransformStruct *transform) const; + TransparentSurface *rotoscale (const TransformStruct &transform) const; static byte *_lookup; static void destroyLookup(); private: -- cgit v1.2.3 From a0561f1aa52b31feff468dc53b6556a683b6a819 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 11:44:38 +0200 Subject: WINTERMUTE: Fix calculation of inverse angles --- engines/wintermute/graphics/transparent_surface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 0ec0b84f25..a0d472389f 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -513,7 +513,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo target->create((uint16)dstW, (uint16)dstH, this->format); - uint32 invAngle = (360 - transform._angle) % 360; + uint32 invAngle = 360 - (transform._angle % 360); float invCos = cos(invAngle * M_PI / 180.0); float invSin = sin(invAngle * M_PI / 180.0); float targX; -- cgit v1.2.3 From ab022b179897153b1be97804502f5ece24931e56 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 12:22:07 +0200 Subject: WINTERMUTE: // End of namespace Wintermute --- engines/wintermute/graphics/transform_struct.cpp | 3 +-- engines/wintermute/graphics/transform_struct.h | 4 +--- engines/wintermute/graphics/transform_tools.cpp | 2 +- engines/wintermute/graphics/transform_tools.h | 2 +- engines/wintermute/math/floatpoint.h | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp index 9a11aa9fdd..dc5e45feea 100644 --- a/engines/wintermute/graphics/transform_struct.cpp +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -123,5 +123,4 @@ bool TransformStruct::mirrorX() const { bool TransformStruct::mirrorY() const { return (bool)(_flip & TransparentSurface::FLIP_V); } - -} +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index ed30044174..1f7d556fe7 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -81,7 +81,5 @@ public: return !(compare == *this); } }; - -} - +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 194bedec64..9e736366c3 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -70,4 +70,4 @@ namespace Wintermute { return res; } -} +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index fb165d7ec8..ee4d16acb0 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -43,5 +43,5 @@ public: */ static Rect32 newRect (Rect32 oldRect, const TransformStruct &transform, Point32 *newHotspot); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/floatpoint.h b/engines/wintermute/math/floatpoint.h index bf194d8437..0c47ef09d7 100644 --- a/engines/wintermute/math/floatpoint.h +++ b/engines/wintermute/math/floatpoint.h @@ -47,6 +47,6 @@ struct FloatPoint { } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif -- cgit v1.2.3 From 163cd6a5284a352225fbfa621a1e7152d0e5f8e0 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 12:32:22 +0200 Subject: WINTERMUTE: Constants --- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index a7866472e7..d218c916e4 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -334,7 +334,7 @@ bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, T ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(100, 100, 0, 0, 0, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); } ////////////////////////////////////////////////////////////////////////// @@ -349,7 +349,7 @@ bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, flo _rotation = 0; TransformStruct transform; if (transparent) { - transform = TransformStruct(zoomX, zoomY, 0, 0, 0, blendMode, alpha, mirrorX, mirrorY); + transform = TransformStruct(zoomX, zoomY, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY); } else { transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY); } @@ -414,8 +414,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, position.setWidth(newRect->right - newRect->left); position.setHeight(newRect->bottom - newRect->top); } else { - position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / 100.f)); - position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / 100.f)); + position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / DEFAULT_ZOOM_X)); + position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / DEFAULT_ZOOM_Y)); } renderer->modTargetRect(&position); -- cgit v1.2.3 From 6f03fbac843410f457115bd075a6926ed3924ce0 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 12:46:32 +0200 Subject: WINTERMUTE: Pass structs by const reference --- engines/wintermute/base/gfx/base_surface.cpp | 2 +- engines/wintermute/base/gfx/base_surface.h | 2 +- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 2 +- engines/wintermute/base/gfx/osystem/base_surface_osystem.h | 2 +- engines/wintermute/base/gfx/osystem/render_ticket.cpp | 4 ++-- engines/wintermute/graphics/transform_tools.cpp | 4 ++-- engines/wintermute/graphics/transform_tools.h | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp index 7457e34826..42ec51f39e 100644 --- a/engines/wintermute/base/gfx/base_surface.cpp +++ b/engines/wintermute/base/gfx/base_surface.cpp @@ -75,7 +75,7 @@ bool BaseSurface::displayHalfTrans(int x, int y, Rect32 rect) { } ////////////////////////////////////////////////////////////////////////// -bool BaseSurface::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) { +bool BaseSurface::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) { return displayTransform(x, y, rect, newRect, transform); } diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index be7a5c13ca..016831fb29 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -54,7 +54,7 @@ public: virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0; virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; - virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) = 0; + virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) = 0; virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) = 0; virtual bool restore(); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index d218c916e4..8ec60bfd68 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -358,7 +358,7 @@ bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, flo ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) { +bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) { _rotation = (uint32)transform._angle; if (transform._angle < 0.0f) { warning("Negative rotation: %f %d", transform._angle, _rotation); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 7eef416d0e..2e2da3c289 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -56,7 +56,7 @@ public: bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, TransformStruct transform) override; + bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; /* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index b11e0722af..d510d97dd1 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -51,7 +51,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); } // Then scale it if necessary - if (_transform._angle != 0) { + if (_transform._angle != DEFAULT_ANGLE) { TransparentSurface src(*_surface, false); Graphics::Surface *temp = src.rotoscale(transform); _surface->free(); @@ -67,7 +67,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s } else { _surface = nullptr; - if (transform._angle != 0) { // Make sure comparison-tickets get the correct width + if (transform._angle != DEFAULT_ANGLE) { // Make sure comparison-tickets get the correct width Rect32 dstRect; Point32 newHotspot; dstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 9e736366c3..01e8b486ce 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -26,7 +26,7 @@ namespace Wintermute { - FloatPoint TransformTools::transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX, bool mirrorY) { + FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { float rotateRad = rotate * M_PI / 180; FloatPoint newPoint; newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/DEFAULT_ZOOM_X; @@ -40,7 +40,7 @@ namespace Wintermute { return newPoint; } - Rect32 TransformTools::newRect (Rect32 oldRect, const TransformStruct &transform, Point32 *newHotspot) { + Rect32 TransformTools::newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { Point32 nw(oldRect.left, oldRect.top); Point32 ne(oldRect.right, oldRect.top); diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index ee4d16acb0..a9eabffe26 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -33,7 +33,7 @@ public: /** * Basic transform (scale + rotate) for a single point */ - static FloatPoint transformPoint(FloatPoint point, float rotate, Point32 zoom, bool mirrorX = false, bool mirrorY = false); + static FloatPoint transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX = false, const bool mirrorY = false); /** * Takes a rectangle, a transform and a pointer to a point, "newHotspot". @@ -41,7 +41,7 @@ public: * and, as a side-effect, "newHotspot" will tell you where the hotspot will * have ended up in the new rect, for centering. */ - static Rect32 newRect (Rect32 oldRect, const TransformStruct &transform, Point32 *newHotspot); + static Rect32 newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot); }; } // End of namespace Wintermute #endif -- cgit v1.2.3 From 5a9e917a600eb47dd420f5efd2d52005b68a151c Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 12:53:05 +0200 Subject: WINTERMUTE: Fix operator precedence in scale() --- engines/wintermute/graphics/transparent_surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index a0d472389f..e20f97b116 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -584,8 +584,8 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) int projY; for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { - projX = x / dstW * srcW; - projY = y / dstH * srcH; + projX = x / (float)dstW * srcW; + projY = y / (float)dstH * srcH; copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); } } -- cgit v1.2.3 From 4405a534e5470cb2f14baad7d76f109f379023cf Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 12:56:18 +0200 Subject: WINTERMUTE: Remove set[Color|Alpha]Mod altogether --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 8 -------- engines/wintermute/base/gfx/osystem/base_render_osystem.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index e647b0e446..c81ea14fe9 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -149,14 +149,6 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { return STATUS_OK; } -void BaseRenderOSystem::setAlphaMod(byte alpha) { - error("DEPRECATED: BaseRenderOSystem::setAlphaMod(byte alpha)"); -} - -void BaseRenderOSystem::setColorMod(byte r, byte g, byte b) { - error("DEPRECATED: void BaseRenderOSystem::setColorMod(byte r, byte g, byte b)"); -} - bool BaseRenderOSystem::indicatorFlip() { g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_indicatorX, _indicatorY), _renderSurface->pitch, _indicatorX, _indicatorY, _indicatorWidthDrawn, _indicatorHeight); g_system->updateScreen(); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index b3483f0efa..63967288b7 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -57,8 +57,6 @@ public: BaseImage *takeScreenshot() override; - void setAlphaMod(byte alpha); - void setColorMod(byte r, byte g, byte b); void invalidateTicket(RenderTicket *renderTicket); void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf); void drawFromTicket(RenderTicket *renderTicket); -- cgit v1.2.3 From 9cfea04846b19f17c8c68c9e19a044c1b48c0f7f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 10 Jul 2013 16:37:51 +0200 Subject: WINTERMUTE: Formatting --- engines/wintermute/graphics/transparent_surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index e20f97b116..48d550c26f 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -498,8 +498,8 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const { - assert (transform._angle != 0); // This would not be ideal - + assert(transform._angle != 0); // This would not be ideal; rotoscale() should never be called in conditional branches where angle = 0 anyway. + Point32 newHotspot; Common::Rect srcRect(0, 0, (int16)w, (int16)h); Rect32 rect = TransformTools::newRect(Rect32 (srcRect), transform, &newHotspot); -- cgit v1.2.3 From 9d4def3bfd541cd95ce62e18fa18d90799fcd791 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Sat, 13 Jul 2013 19:14:10 +0200 Subject: WINTERMUTE: Fix alpha bug in BaseRenderOSystem::fadeToColor Introduced in 37b1ff3, broke fade-in/fade-outs --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index c81ea14fe9..2aae973309 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -270,7 +270,9 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect Common::Rect sizeRect(fillRect); sizeRect.translate(-fillRect.top, -fillRect.left); surf.fillRect(fillRect, col); - drawSurface(nullptr, &surf, &sizeRect, &fillRect, TransformStruct()); + TransformStruct temp = TransformStruct(); + temp._alphaDisable = false; + drawSurface(nullptr, &surf, &sizeRect, &fillRect, temp); surf.free(); //SDL_SetRenderDrawColor(_renderer, r, g, b, a); -- cgit v1.2.3 From 64db90ed67e385a7ba8ca18faa0da345987201db Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 20:54:25 +0200 Subject: WINTERMUTE: TransformStruct by reference in engines/wintermute/base/gfx/osystem/base_render_osystem.h --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 5 +++-- engines/wintermute/base/gfx/osystem/base_render_osystem.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 2aae973309..06cf531a9e 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -284,7 +284,7 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const { return _renderSurface->format; } -void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform) { +void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform) { if (_tempDisableDirtyRects || _disableDirtyRects) { RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); @@ -376,7 +376,8 @@ void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX, dstRect.translate(offsetX, 0); } for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) { - drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, TransformStruct()); + TransformStruct temp = TransformStruct(); + drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, temp); dstRect.translate(offsetX, 0); } dstRect.left = initLeft; diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 63967288b7..5531961623 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -79,7 +79,7 @@ public: virtual bool startSpriteBatch() override; virtual bool endSpriteBatch() override; void endSaveLoad(); - void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct transform); + void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform); void repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY); BaseSurface *createSurface() override; private: -- cgit v1.2.3 From 286b1d11ca798249d412adb52e453404de7b727e Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 21:42:16 +0200 Subject: WINTERMUTE: Use Rect::width() and height() in base_surface_osystem.cpp --- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 8ec60bfd68..6db4818945 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -409,10 +409,10 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, if (newRect) { position.top = y; position.left = x; - position.right = x + (newRect->right - newRect->left); - position.bottom = y + (newRect->top - newRect->bottom); - position.setWidth(newRect->right - newRect->left); - position.setHeight(newRect->bottom - newRect->top); + position.right = x + newRect->width(); + position.bottom = y + newRect->height(); + position.setWidth(newRect->width()); + position.setHeight(newRect->height()); } else { position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / DEFAULT_ZOOM_X)); position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / DEFAULT_ZOOM_Y)); -- cgit v1.2.3 From 06ec0067665c4aa2369ea0b3b451ca0e7b2951c1 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 21:55:30 +0200 Subject: WINTERMUTE: Remove redeclaration in render_ticket.cpp --- engines/wintermute/base/gfx/osystem/render_ticket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index d510d97dd1..7f141aa460 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -68,11 +68,11 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s _surface = nullptr; if (transform._angle != DEFAULT_ANGLE) { // Make sure comparison-tickets get the correct width - Rect32 dstRect; + Rect32 newDstRect; Point32 newHotspot; - dstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); - _dstRect.setWidth(dstRect.right-dstRect.left); - _dstRect.setHeight(dstRect.bottom-dstRect.top); + newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); + _dstRect.setWidth(newDstRect.right - newDstRect.left); + _dstRect.setHeight(newDstRect.bottom - newDstRect.top); } } } -- cgit v1.2.3 From 63b8132ea3ec6fe6bcfcb43d1e0c9baf481eab1e Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 22:24:46 +0200 Subject: WINTERMUTE: Remove single-argument zoom, rename mirrorX => getMirrorX() in transform_struct.h --- .../base/gfx/osystem/base_surface_osystem.cpp | 4 +-- engines/wintermute/graphics/transform_struct.cpp | 37 ++-------------------- engines/wintermute/graphics/transform_struct.h | 7 ++-- 3 files changed, 6 insertions(+), 42 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 6db4818945..02f7f991e1 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -321,14 +321,14 @@ bool BaseSurfaceOSystem::endPixelOp() { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(100, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(100, blendMode, alpha, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp index dc5e45feea..c179d42ab1 100644 --- a/engines/wintermute/graphics/transform_struct.cpp +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -61,28 +61,6 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blen Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); } -TransformStruct::TransformStruct(int32 zoom, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { - init(Point32(zoom, zoom), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), - false, - blendMode, - rgbaMod, - mirrorX, mirrorY, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); -} - -TransformStruct::TransformStruct(int32 zoom, bool mirrorX, bool mirrorY) { - init(Point32(zoom, zoom), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), - true, - BLEND_NORMAL, - DEFAULT_RGBAMOD, - mirrorX, mirrorY, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); -} - TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) { init(Point32(zoomX, zoomY), angle, @@ -94,17 +72,6 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 h Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); } -TransformStruct::TransformStruct(int32 zoom) { - init(Point32(zoom, zoom), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), - true, - BLEND_NORMAL, - DEFAULT_RGBAMOD, - false, false, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); -} - TransformStruct::TransformStruct() { init(Point32(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y), DEFAULT_ANGLE, @@ -116,11 +83,11 @@ TransformStruct::TransformStruct() { Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); } -bool TransformStruct::mirrorX() const { +bool TransformStruct::getMirrorX() const { return (bool)(_flip & TransparentSurface::FLIP_H); } -bool TransformStruct::mirrorY() const { +bool TransformStruct::getMirrorY() const { return (bool)(_flip & TransparentSurface::FLIP_V); } } // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 1f7d556fe7..6b021b5cd5 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -48,10 +48,7 @@ private: public: TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false, int32 offsetX = 0, int32 offsetY = 0); TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false); - TransformStruct(int32 zoom, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY); - TransformStruct(int32 zoom, bool mirrorX, bool mirrorY); TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0); - TransformStruct(int32 zoom); TransformStruct(); Point32 _zoom; ///< Zoom; 100 = no zoom @@ -63,8 +60,8 @@ public: uint32 _rgbaMod; ///< RGBa Point32 _offset; - bool mirrorX() const; - bool mirrorY() const; + bool getMirrorX() const; + bool getMirrorY() const; bool operator==(const TransformStruct &compare) const { return (compare._angle == _angle && -- cgit v1.2.3 From d2d72c0110e4e2c265fcc1413958540f182d4353 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 22:39:55 +0200 Subject: WINTERMUTE: #define to const for TransformStruct defaults --- engines/wintermute/base/base_sprite.h | 8 ++++---- engines/wintermute/base/base_sub_frame.cpp | 16 ++++++++-------- .../base/gfx/osystem/base_surface_osystem.cpp | 12 ++++++------ .../base/gfx/osystem/base_surface_osystem.h | 8 ++++---- .../wintermute/base/gfx/osystem/render_ticket.cpp | 4 ++-- engines/wintermute/graphics/transform_struct.cpp | 20 ++++++++++---------- engines/wintermute/graphics/transform_struct.h | 22 +++++++++++----------- engines/wintermute/graphics/transform_tools.cpp | 4 ++-- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 6badffa827..d464899b04 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -45,17 +45,17 @@ public: void setDefaults(); DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) - bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = DEFAULT_ZOOM_X, float scaleY = DEFAULT_ZOOM_Y); + bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = kDefaultZoomX, float scaleY = kDefaultZoomY); int32 _moveY; int32 _moveX; - bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD, float rotate = DEFAULT_ANGLE, TSpriteBlendMode blendMode = BLEND_NORMAL); - bool getCurrentFrame(float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y); + bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod, float rotate = kDefaultAngle, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool getCurrentFrame(float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY); void reset(); bool isChanged(); bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD); + bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod); bool _looping; int32 _currentFrame; bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr); diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index f8c4000324..7012c28feb 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -48,9 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _surface = nullptr; - _hotspotX = DEFAULT_HOTSPOT_X; - _hotspotY = DEFAULT_HOTSPOT_Y; - _alpha = DEFAULT_RGBAMOD; + _hotspotX = kDefaultHotspotX; + _hotspotY = kDefaultHotspotY; + _alpha = kDefaultRgbaMod; _transparent = 0xFFFF00FF; _wantsDefaultRect = false; @@ -247,7 +247,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl } if (registerOwner != nullptr && !_decoration) { - if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise)); } else { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise)); @@ -260,11 +260,11 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl bool res; //if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha) - if (_alpha != DEFAULT_RGBAMOD) { + if (_alpha != kDefaultRgbaMod) { alpha = _alpha; } - if (rotate != DEFAULT_ANGLE) { + if (rotate != kDefaultAngle) { Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin; Point32 origin(x, y); Rect32 oldRect = getRect(); @@ -274,10 +274,10 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl newOrigin = origin - newHotspot; res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { - if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY); } else { - res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / DEFAULT_ZOOM_X)), (int)(y - _hotspotY * (zoomY / DEFAULT_ZOOM_Y)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); + res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / kDefaultZoomX)), (int)(y - _hotspotY * (zoomY / kDefaultZoomY)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); } } diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 02f7f991e1..e01a669a2c 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -321,20 +321,20 @@ bool BaseSurfaceOSystem::endPixelOp() { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, blendMode, alpha, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); } ////////////////////////////////////////////////////////////////////////// @@ -349,7 +349,7 @@ bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, flo _rotation = 0; TransformStruct transform; if (transparent) { - transform = TransformStruct(zoomX, zoomY, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY); + transform = TransformStruct(zoomX, zoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY); } else { transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY); } @@ -414,8 +414,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, position.setWidth(newRect->width()); position.setHeight(newRect->height()); } else { - position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / DEFAULT_ZOOM_X)); - position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / DEFAULT_ZOOM_Y)); + position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / kDefaultZoomX)); + position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / kDefaultZoomY)); } renderer->modTargetRect(&position); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 2e2da3c289..8f38128039 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -51,11 +51,11 @@ public: bool endPixelOp() override; - bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; + bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 7f141aa460..091bb6e58a 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -51,7 +51,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); } // Then scale it if necessary - if (_transform._angle != DEFAULT_ANGLE) { + if (_transform._angle != kDefaultAngle) { TransparentSurface src(*_surface, false); Graphics::Surface *temp = src.rotoscale(transform); _surface->free(); @@ -67,7 +67,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s } else { _surface = nullptr; - if (transform._angle != DEFAULT_ANGLE) { // Make sure comparison-tickets get the correct width + if (transform._angle != kDefaultAngle) { // Make sure comparison-tickets get the correct width Rect32 newDstRect; Point32 newHotspot; newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp index c179d42ab1..8edbf765b5 100644 --- a/engines/wintermute/graphics/transform_struct.cpp +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -51,14 +51,14 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 h TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { init(Point32(zoomX, zoomY), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), false, blendMode, rgbaMod, mirrorX, mirrorY, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) { @@ -67,20 +67,20 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 h Point32(hotspotX, hotspotY), true, BLEND_NORMAL, - DEFAULT_RGBAMOD, + kDefaultRgbaMod, false, false, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } TransformStruct::TransformStruct() { - init(Point32(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + init(Point32(kDefaultZoomX, kDefaultZoomY), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), true, BLEND_NORMAL, - DEFAULT_RGBAMOD, + kDefaultRgbaMod, false, false, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } bool TransformStruct::getMirrorX() const { diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 6b021b5cd5..3fec9c0d0d 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -20,21 +20,21 @@ * */ -#ifndef GRAPHICS_TRANSFORM_STRUCT_H -#define GRAPHICS_TRANSFORM_STRUCT_H +#ifndef WINTERMUTE_TRANSFORM_STRUCT_H +#define WINTERMUTE_TRANSFORM_STRUCT_H #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/dctypes.h" -#define DEFAULT_ZOOM_X 100.0 -#define DEFAULT_ZOOM_Y 100.0 -#define DEFAULT_RGBAMOD 0xFFFFFFFF -#define DEFAULT_HOTSPOT_X 0 -#define DEFAULT_HOTSPOT_Y 0 -#define DEFAULT_OFFSET_X 0 -#define DEFAULT_OFFSET_Y 0 -#define DEFAULT_ANGLE 0 - +const float kDefaultZoomX = 100.0; +const float kDefaultZoomY = 100.0; +const uint32 kDefaultRgbaMod = 0xFFFFFFFF; +const int32 kDefaultHotspotX = 0; +const int32 kDefaultHotspotY = 0; +const int32 kDefaultOffsetX = 0; +const int32 kDefaultOffsetY = 0; +const int32 kDefaultAngle = 0; + namespace Wintermute { /** * Contains all the required information that define a transform. diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 01e8b486ce..1ba48433ef 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -29,8 +29,8 @@ namespace Wintermute { FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { float rotateRad = rotate * M_PI / 180; FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/DEFAULT_ZOOM_X; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/DEFAULT_ZOOM_Y; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/kDefaultZoomX; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/kDefaultZoomY; if (mirrorX) { newPoint.x *= -1; } -- cgit v1.2.3 From 0d407fd2066fb94d19e7fd7e4bf703dd68d34ec9 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 22:59:57 +0200 Subject: WINTERMUTE: Express 180.0f as float in TransformTools --- engines/wintermute/graphics/transform_tools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 1ba48433ef..52e6a51296 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -27,7 +27,7 @@ namespace Wintermute { FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { - float rotateRad = rotate * M_PI / 180; + float rotateRad = rotate * M_PI / 180.0f; FloatPoint newPoint; newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/kDefaultZoomX; newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/kDefaultZoomY; -- cgit v1.2.3 From aeb4c0953805185ab70ceecb8e38b3b47c4322d9 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 23:29:55 +0200 Subject: WINTERMUTE: Doxygen comments in TransformStruct --- engines/wintermute/graphics/transform_tools.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index a9eabffe26..0d81fb66da 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -36,8 +36,12 @@ public: static FloatPoint transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX = false, const bool mirrorY = false); /** - * Takes a rectangle, a transform and a pointer to a point, "newHotspot". - * In return you get the smallest rect that can contain the transformed sprite + * @param &point the point on which the transform is to be applied + * @param rotate the angle in degrees + * @param &zoom zoom x,y in percent + * @param mirrorX flip along the vertical axis? + * @param mirrorY flip along the horizontal axis? + * @return the smallest rect that can contain the transformed sprite * and, as a side-effect, "newHotspot" will tell you where the hotspot will * have ended up in the new rect, for centering. */ -- cgit v1.2.3 From 1ecdd2d61ad6dcf809c0cfaa37e7d9bbceb6bad3 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 15 Jul 2013 22:39:55 +0200 Subject: WINTERMUTE: #define to const for TransformStruct defaults --- engines/wintermute/graphics/transform_struct.h | 4 ++-- engines/wintermute/graphics/transform_tools.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 3fec9c0d0d..0ca7e9167d 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -26,8 +26,8 @@ #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/dctypes.h" -const float kDefaultZoomX = 100.0; -const float kDefaultZoomY = 100.0; +const uint32 kDefaultZoomX = 100; +const uint32 kDefaultZoomY = 100; const uint32 kDefaultRgbaMod = 0xFFFFFFFF; const int32 kDefaultHotspotX = 0; const int32 kDefaultHotspotY = 0; diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 52e6a51296..73f48402f4 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -29,8 +29,8 @@ namespace Wintermute { FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { float rotateRad = rotate * M_PI / 180.0f; FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/kDefaultZoomX; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/kDefaultZoomY; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad)) * zoom.x / kDefaultZoomX; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad)) * zoom.y / kDefaultZoomY; if (mirrorX) { newPoint.x *= -1; } -- cgit v1.2.3 From f872d316784b43e394e3c7c3490181fd465b7ba0 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 16 Jul 2013 01:05:08 +0200 Subject: WINTERMUTE: Fix type-related warnings in base_surface_osystem.cpp --- .../wintermute/base/gfx/osystem/base_surface_osystem.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index e01a669a2c..e90df52e38 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -361,9 +361,9 @@ bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, flo bool BaseSurfaceOSystem::displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) { _rotation = (uint32)transform._angle; if (transform._angle < 0.0f) { - warning("Negative rotation: %f %d", transform._angle, _rotation); + warning("Negative rotation: %d %d", transform._angle, _rotation); _rotation = (uint32)(360.0f + transform._angle); - warning("Negative post rotation: %f %d", transform._angle, _rotation); + warning("Negative post rotation: %d %d", transform._angle, _rotation); } return drawSprite(x, y, &rect, &newRect, transform); } @@ -423,12 +423,13 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, // But no checking is in place for that yet. // TODO: Optimize by not doing alpha-blits if we lack or disable alpha - bool hasAlpha; + + bool hasAlpha = false; + if (_hasAlpha && !transform._alphaDisable) { hasAlpha = true; - } else { - hasAlpha = false; - } + } + if (transform._alphaDisable) { warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } -- cgit v1.2.3 From 566495de3b62c135767a3bf473e5a52d190caa15 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 16 Jul 2013 02:15:57 +0200 Subject: WINTERMUTE: Remove unused variable in transparent_surface.cpp --- engines/wintermute/graphics/transparent_surface.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 48d550c26f..7aa25d1502 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -106,8 +106,6 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i float q21y = (y2 - projY); float q12x = (x2 - projX); float q12y = (projY - y1); - float q22x = (projX - x1); - float q22y = (projY - y1); if (x1 == x2 && y1 == y2) { for (int c = 0; c < 4; c++) { @@ -119,12 +117,10 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i q11x = 0.5; q12x = 0.5; q21x = 0.5; - q22x = 0.5; } else if (y1 == y2) { q11y = 0.5; q12y = 0.5; q21y = 0.5; - q22y = 0.5; } for (int c = 0; c < 4; c++) { -- cgit v1.2.3 From 567cd1eb123357fe474066fd73328bb2aeab42ca Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 16 Jul 2013 22:05:40 +0200 Subject: WINTERMUTE: zoom parameter in display*** is now integer --- engines/wintermute/base/gfx/base_surface.h | 4 ++-- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 4 ++-- engines/wintermute/base/gfx/osystem/base_surface_osystem.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index 016831fb29..e308b29996 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -50,12 +50,12 @@ public: virtual bool displayHalfTrans(int x, int y, Rect32 rect); virtual bool isTransparentAt(int x, int y); - virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0; virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) = 0; - virtual bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; virtual bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) = 0; virtual bool restore(); virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index e90df52e38..e0b7aea5a3 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -338,14 +338,14 @@ bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 al } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; return drawSprite(x, y, &rect, nullptr, TransformStruct(zoomX, zoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// -bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha, bool transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; TransformStruct transform; if (transparent) { diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 8f38128039..5290170db8 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -51,11 +51,11 @@ public: bool endPixelOp() override; - bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayZoom(int x, int y, Rect32 rect, int32 zoomX, int32 zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; -- cgit v1.2.3 From 381df0c64ac88a704f931b0011d7f3f730c5caba Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 16 Jul 2013 22:08:40 +0200 Subject: WINTERMUTE: Various explicit casts * for floor/ceil output in transform_tools.cpp * for projX/Y in transparent_surface.cpp * in transpaprent_surface.cpp --- engines/wintermute/graphics/transform_tools.cpp | 12 ++++++------ engines/wintermute/graphics/transparent_surface.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 73f48402f4..ff90707615 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -60,13 +60,13 @@ namespace Wintermute { float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); Rect32 res; - newHotspot->y = -floor(top); - newHotspot->x = -floor(left); + newHotspot->y = (uint32)(-floor(top)); + newHotspot->x = (uint32)(-floor(left)); - res.top = floor(top) + transform._hotspot.y; - res.bottom = ceil(bottom) + transform._hotspot.y; - res.left = floor(left) + transform._hotspot.x; - res.right = ceil(right) + transform._hotspot.x; + res.top = (int32)(floor(top)) + transform._hotspot.y; + res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; + res.left = (int32)(floor(left)) + transform._hotspot.x; + res.right = (int32)(ceil(right)) + transform._hotspot.x; return res; } diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 7aa25d1502..49ac2bdc5a 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -45,7 +45,7 @@ void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { color = 0; } else { - color = READ_UINT32((const byte *)src->getBasePtr(projX, projY)); + color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); } WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); @@ -71,25 +71,25 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { Q11 = 0; } else { - Q11 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y1 + srcRect.top)); + Q11 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left),(int)(y1 + srcRect.top))); } if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { Q12 = 0; } else { - Q12 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y2 + srcRect.top)); + Q12 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y2 + srcRect.top))); } if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { Q21 = 0; } else { - Q21 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y1 + srcRect.top)); + Q21 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y1 + srcRect.top))); } if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { Q22 = 0; } else { - Q22 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y2 + srcRect.top)); + Q22 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y2 + srcRect.top))); } byte *Q11s = (byte *)&Q11; @@ -124,7 +124,7 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i } for (int c = 0; c < 4; c++) { - dest[c] = ( + dest[c] = (byte)( ((float)Q11s[c]) * q11x * q11y + ((float)Q21s[c]) * q21x * q21y + ((float)Q12s[c]) * q12x * q12y + @@ -580,8 +580,8 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) int projY; for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { - projX = x / (float)dstW * srcW; - projY = y / (float)dstH * srcH; + projX = (int)(x / (float)dstW * srcW); + projY = (int)(y / (float)dstH * srcH); copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); } } -- cgit v1.2.3 From 86c8d238a4c14dd26b251a1662473b38cfaa1cdc Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 16 Jul 2013 22:44:29 +0200 Subject: WINTERMUTE: const Common::Rect rect& in rect32.h --- engines/wintermute/math/rect32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 821df1880e..79d6e80017 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -64,7 +64,7 @@ struct Rect32 { Rect32() : top(0), left(0), bottom(0), right(0) {} Rect32(int32 w, int32 h) : top(0), left(0), bottom(h), right(w) {} - Rect32(Common::Rect rect) : top(rect.top), left(rect.left), bottom(rect.bottom), right(rect.right) {} + Rect32(const Common::Rect &rect) : top(rect.top), left(rect.left), bottom(rect.bottom), right(rect.right) {} Rect32(int32 x1, int32 y1, int32 x2, int32 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(isValidRect()); } -- cgit v1.2.3 From 1a8a9bab861402e81dd2e5407182f3c0a7cc479b Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 17 Jul 2013 02:14:48 +0200 Subject: WINTERMUTE: Compile bilinear copy only if needed --- engines/wintermute/graphics/transparent_surface.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 49ac2bdc5a..534e51684e 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -31,6 +31,8 @@ namespace Wintermute { + +#ifndef ENABLE_BILINEAR void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { int srcW = srcRect.width(); int srcH = srcRect.height(); @@ -50,7 +52,9 @@ void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); } +#endif +#ifdef ENABLE_BILINEAR void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { int srcW = srcRect.width(); @@ -137,6 +141,7 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i } WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); } +#endif byte *TransparentSurface::_lookup = nullptr; -- cgit v1.2.3 From 14d151ab31d8163f3e7dc943be191c3a98bd4f6b Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 17 Jul 2013 23:37:21 +0200 Subject: WINTERMUTE: Fix #ifdef in transparent_surface.[h|cpp] --- .../wintermute/graphics/transparent_surface.cpp | 46 +++++++++++----------- engines/wintermute/graphics/transparent_surface.h | 4 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 534e51684e..4eabc356b4 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -32,28 +32,6 @@ namespace Wintermute { -#ifndef ENABLE_BILINEAR -void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { - int srcW = srcRect.width(); - int srcH = srcRect.height(); - int dstW = dstRect.width(); - int dstH = dstRect.height(); - - assert(dstX >= 0 && dstX < dstW); - assert(dstY >= 0 && dstY < dstH); - - uint32 color; - - if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { - color = 0; - } else { - color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); - } - - WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); -} -#endif - #ifdef ENABLE_BILINEAR void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { @@ -141,6 +119,26 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i } WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); } +#else +void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + uint32 color; + + if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { + color = 0; + } else { + color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); + } + + WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); +} #endif byte *TransparentSurface::_lookup = nullptr; @@ -520,7 +518,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo float targX; float targY; -#if ENABLE_BILINEAR +#ifdef ENABLE_BILINEAR for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { int x1 = x - newHotspot.x; @@ -570,7 +568,7 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) target->create((uint16)dstW, (uint16)dstH, this->format); -#if ENABLE_BILINEAR +#ifdef ENABLE_BILINEAR float projX; float projY; for (int y = 0; y < dstH; y++) { diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 71c139a76a..7182967aa6 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -53,9 +53,11 @@ struct TransparentSurface : public Graphics::Surface { void setColorKey(char r, char g, char b); void disableColorKey(); +#ifdef ENABLE_BILINEAR static void copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); +#else static void copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); - +#endif // Enums /** @brief The possible flipping parameters for the blit methode. -- cgit v1.2.3 From d83e4e1268e7422abd6f00463065f6e12fea15f7 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Jul 2013 16:03:06 +0200 Subject: WINTERMUTE: FActor out TransformStruc initialization in repeatLastDraw loop --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 06cf531a9e..58bd8d34e1 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -371,12 +371,13 @@ void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX, int initLeft = dstRect.left; int initRight = dstRect.right; + TransformStruct temp = TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, BLEND_NORMAL, kDefaultRgbaMod, false, false, kDefaultOffsetX, kDefaultOffsetY); + for (int i = 0; i < numTimesY; i++) { if (i == 0) { dstRect.translate(offsetX, 0); } for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) { - TransformStruct temp = TransformStruct(); drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, temp); dstRect.translate(offsetX, 0); } -- cgit v1.2.3 From 56aa1297d13304666aa91cc57a5da88f3aa20b5f Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Jul 2013 16:05:23 +0200 Subject: WINTERMUTE: Bring consts inside namespace in transform_struct.h --- engines/wintermute/graphics/transform_struct.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 0ca7e9167d..acde410e89 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -26,6 +26,13 @@ #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/dctypes.h" +namespace Wintermute { +/** + * Contains all the required information that define a transform. + * Same source sprite + same TransformStruct = Same resulting sprite. + * Has a number of overloaded constructors to accomodate various argument lists. + */ + const uint32 kDefaultZoomX = 100; const uint32 kDefaultZoomY = 100; const uint32 kDefaultRgbaMod = 0xFFFFFFFF; @@ -35,12 +42,6 @@ const int32 kDefaultOffsetX = 0; const int32 kDefaultOffsetY = 0; const int32 kDefaultAngle = 0; -namespace Wintermute { -/** - * Contains all the required information that define a transform. - * Same source sprite + same TransformStruct = Same resulting sprite. - * Has a number of overloaded constructors to accomodate various argument lists. - */ struct TransformStruct { private: void init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Point32 offset); -- cgit v1.2.3 From b5adcda94719792c15a2cb72e9c0ad191f8fa224 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Jul 2013 16:12:01 +0200 Subject: WINTERMUTE: s/WINTERMUTE_TRANSFORMTOOLS_H/WINTERMUTE_TRANSFORM_TOOLS_H/ --- engines/wintermute/graphics/transform_tools.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index 0d81fb66da..77b41a9045 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -20,8 +20,8 @@ * */ -#ifndef WINTERMUTE_TRANSFORMTOOLS_H -#define WINTERMUTE_TRANSFORMTOOLS_H +#ifndef WINTERMUTE_TRANSFORM_TOOLS_H +#define WINTERMUTE_TRANSFORM_TOOLS_H #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/math/floatpoint.h" -- cgit v1.2.3 From 1c25eb24900445ba704e759239572a86ea88c3e1 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Jul 2013 16:32:42 +0200 Subject: WINTERMUTE: Formatting --- .../wintermute/graphics/transparent_surface.cpp | 35 +++++----------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 4eabc356b4..3c64930fcb 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -518,38 +518,24 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo float targX; float targY; -#ifdef ENABLE_BILINEAR for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { int x1 = x - newHotspot.x; int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * kDefaultZoomX / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * kDefaultZoomY / transform._zoom.y + srcRect.top; targX += transform._hotspot.x; targY += transform._hotspot.y; +#ifdef ENABLE_BILINEAR copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); - } - } #else - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - int x1 = x - newHotspot.x; - int y1 = y - newHotspot.y; - - targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; - - targX += transform._hotspot.x; - targY += transform._hotspot.y; - copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); +#endif } } -#endif - return target; } @@ -568,27 +554,20 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) target->create((uint16)dstW, (uint16)dstH, this->format); -#ifdef ENABLE_BILINEAR + float projX; float projY; for (int y = 0; y < dstH; y++) { for (int x = 0; x < dstW; x++) { projX = x / (float)dstW * srcW; projY = y / (float)dstH * srcH; +#ifdef ENABLE_BILINEAR copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); - } - } #else - int projX; - int projY; - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - projX = (int)(x / (float)dstW * srcW); - projY = (int)(y / (float)dstH * srcH); copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); +#endif } } -#endif return target; } -- cgit v1.2.3 From 204c75bc2733fb5b4251e73d6859398dd50f942a Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 18 Jul 2013 17:02:40 +0200 Subject: WINTERMUTE: s/255,255,255,255/kDefaultMod/ --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 58bd8d34e1..866a8a1623 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -60,7 +60,7 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _borderLeft = _borderRight = _borderTop = _borderBottom = 0; _ratioX = _ratioY = 1.0f; - _colorMod = 0xFFFFFFFF; + _colorMod = kDefaultRgbaMod; _dirtyRect = nullptr; _disableDirtyRects = false; _tempDisableDirtyRects = 0; -- cgit v1.2.3 From e3381cff0db4ebc8be62a2f7f2b228cd55cd23bc Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 1 Aug 2013 01:42:51 +0200 Subject: WINTERMUTE: #ifdef ENABLE_BILINEAR -> #if ENBABLE_BILINEAR --- engines/wintermute/graphics/transparent_surface.cpp | 6 +++--- engines/wintermute/graphics/transparent_surface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 3c64930fcb..5b7c416ee9 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -32,7 +32,7 @@ namespace Wintermute { -#ifdef ENABLE_BILINEAR +#if ENABLE_BILINEAR void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { int srcW = srcRect.width(); @@ -529,7 +529,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo targX += transform._hotspot.x; targY += transform._hotspot.y; -#ifdef ENABLE_BILINEAR +#if ENABLE_BILINEAR copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); #else copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); @@ -561,7 +561,7 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) for (int x = 0; x < dstW; x++) { projX = x / (float)dstW * srcW; projY = y / (float)dstH * srcH; -#ifdef ENABLE_BILINEAR +#if ENABLE_BILINEAR copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); #else copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 7182967aa6..7b5579f389 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -53,7 +53,7 @@ struct TransparentSurface : public Graphics::Surface { void setColorKey(char r, char g, char b); void disableColorKey(); -#ifdef ENABLE_BILINEAR +#if ENABLE_BILINEAR static void copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); #else static void copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst); -- cgit v1.2.3 From c32769e0b7e63e9e9b8bf0fc7d4caa91554fa8ad Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 1 Aug 2013 02:48:14 +0200 Subject: WINTERMUTE; Indentation in transform_* --- engines/wintermute/graphics/transform_tools.cpp | 71 +++++++++++++------------ engines/wintermute/graphics/transform_tools.h | 2 + 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index ff90707615..4f05e19a92 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -26,48 +26,49 @@ namespace Wintermute { - FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { - float rotateRad = rotate * M_PI / 180.0f; - FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad)) * zoom.x / kDefaultZoomX; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad)) * zoom.y / kDefaultZoomY; - if (mirrorX) { - newPoint.x *= -1; - } - if (mirrorY) { - newPoint.y *= -1; - } - return newPoint; +FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { + float rotateRad = rotate * M_PI / 180.0f; + FloatPoint newPoint; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad)) * zoom.x / kDefaultZoomX; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad)) * zoom.y / kDefaultZoomY; + if (mirrorX) { + newPoint.x *= -1; } + if (mirrorY) { + newPoint.y *= -1; + } + return newPoint; +} - Rect32 TransformTools::newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { +Rect32 TransformTools::newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { - Point32 nw(oldRect.left, oldRect.top); - Point32 ne(oldRect.right, oldRect.top); - Point32 sw(oldRect.left, oldRect.bottom); - Point32 se(oldRect.right, oldRect.bottom); + Point32 nw(oldRect.left, oldRect.top); + Point32 ne(oldRect.right, oldRect.top); + Point32 sw(oldRect.left, oldRect.bottom); + Point32 se(oldRect.right, oldRect.bottom); - FloatPoint nw1, ne1, sw1, se1; + FloatPoint nw1, ne1, sw1, se1; - nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); - ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); - sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); - se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); + nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); + ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); + sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); + se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); - float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); - float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); - float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x))); - float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); + float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); + float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); + float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x))); + float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); - Rect32 res; - newHotspot->y = (uint32)(-floor(top)); - newHotspot->x = (uint32)(-floor(left)); + Rect32 res; + newHotspot->y = (uint32)(-floor(top)); + newHotspot->x = (uint32)(-floor(left)); - res.top = (int32)(floor(top)) + transform._hotspot.y; - res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; - res.left = (int32)(floor(left)) + transform._hotspot.x; - res.right = (int32)(ceil(right)) + transform._hotspot.x; + res.top = (int32)(floor(top)) + transform._hotspot.y; + res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; + res.left = (int32)(floor(left)) + transform._hotspot.x; + res.right = (int32)(ceil(right)) + transform._hotspot.x; + + return res; +} - return res; - } } // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index 77b41a9045..e59c47272a 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -28,6 +28,7 @@ #include "engines/wintermute/graphics/transform_struct.h" namespace Wintermute { + class TransformTools { public: /** @@ -47,5 +48,6 @@ public: */ static Rect32 newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot); }; + } // End of namespace Wintermute #endif -- cgit v1.2.3 From 07d8e5643b11e109da5f3e9fabaed023e5717457 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 31 Jul 2013 21:01:04 -0400 Subject: HOPKINS: Reverted to saving Breakout high scores in a separate file --- engines/hopkins/computer.cpp | 14 +++++++++++--- engines/hopkins/detection.cpp | 4 ++++ engines/hopkins/globals.cpp | 2 -- engines/hopkins/globals.h | 1 - engines/hopkins/hopkins.h | 1 + engines/hopkins/saveload.cpp | 11 +++++++---- engines/hopkins/saveload.h | 3 ++- engines/tsage/ringworld2/ringworld2_logic.cpp | 13 +++++++++++++ engines/tsage/ringworld2/ringworld2_logic.h | 10 ++++++++++ engines/tsage/ringworld2/ringworld2_scenes0.cpp | 13 ------------- engines/tsage/ringworld2/ringworld2_scenes0.h | 9 ++------- engines/tsage/ringworld2/ringworld2_scenes1.h | 13 +++++++++++++ 12 files changed, 63 insertions(+), 31 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 82e0dd0a06..489e7e1133 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -578,7 +578,11 @@ void ComputerManager::displayGamesSubMenu() { * Load Highscore from file */ void ComputerManager::loadHiscore() { - const byte *ptr = _vm->_globals->_highScoreData; + byte *ptr = _vm->_globals->allocMemory(100); + memset(ptr, 0, 100); + + if (_vm->_saveLoad->saveExists(_vm->targetName() + "-highscore.dat")) + _vm->_saveLoad->load(_vm->targetName() + "-highscore.dat", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { _score[scoreIndex]._name = " "; @@ -600,6 +604,7 @@ void ComputerManager::loadHiscore() { } _lowestHiScore = atol(_score[5]._score.c_str()); + _vm->_globals->freeMemory(ptr); } /** @@ -985,8 +990,8 @@ void ComputerManager::saveScore() { } } - byte *ptr = _vm->_globals->_highScoreData; - memset(ptr, 0, 99); + byte *ptr = _vm->_globals->allocMemory(100); + memset(ptr, 0, 100); for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { int curBufPtr = 16 * scorePlaceIdx; for (int namePos = 0; namePos < 6; namePos++) { @@ -1006,6 +1011,9 @@ void ComputerManager::saveScore() { }; ptr[curBufPtr + 15] = 0; } + + _vm->_saveLoad->saveFile(_vm->targetName() + "-highscore.dat", ptr, 100); + _vm->_globals->freeMemory(ptr); } /** diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 9d16b0ab51..45b6c2bc1d 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -56,6 +56,10 @@ bool HopkinsEngine::getIsDemo() const { return _gameDescription->desc.flags & ADGF_DEMO; } +Common::String HopkinsEngine::targetName() const { + return _targetName; +} + } // End of namespace Hopkins static const PlainGameDescriptor hopkinsGames[] = { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 97d6c4046c..a9a0a81f08 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -70,8 +70,6 @@ Globals::Globals(HopkinsEngine *vm) { for (int i = 0; i < 36; ++i) _inventory[i] = 0; - Common::fill(&_highScoreData[0], &_highScoreData[100], 0); - // Initialize fields _language = LANG_EN; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a76323bb50..94512c3d26 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -206,7 +206,6 @@ public: Common::String _zoneFilename; Common::String _textFilename; byte *_levelSpriteBuf; - byte _highScoreData[100]; EventMode _eventMode; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 398e41a4d2..54e7c90b78 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -164,6 +164,7 @@ public: Common::Platform getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; + Common::String targetName() const; int getRandomNumber(int maxNumber); Common::String generateSaveName(int slotNumber); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 14b166294d..20ef5da44c 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -55,6 +55,13 @@ bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n return false; } +bool SaveLoadManager::saveExists(const Common::String &file) { + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file); + bool result = savefile != NULL; + delete savefile; + return result; +} + // Save File bool SaveLoadManager::saveFile(const Common::String &file, const void *buf, size_t n) { return save(file, buf, n); @@ -251,10 +258,6 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { - if (version >= 3) - // Sync embedded Breakout game high score data - s.syncBytes(&_vm->_globals->_highScoreData[0], 100); - s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050); syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins); diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index e4ee3aaeda..191cb9e18f 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -35,7 +35,7 @@ namespace Hopkins { class HopkinsEngine; -#define HOPKINS_SAVEGAME_VERSION 3 +#define HOPKINS_SAVEGAME_VERSION 2 struct hopkinsSavegameHeader { uint8 _version; @@ -56,6 +56,7 @@ private: public: SaveLoadManager(HopkinsEngine *vm); + bool saveExists(const Common::String &file); bool save(const Common::String &file, const void *buf, size_t n); bool saveFile(const Common::String &file, const void *buf, size_t n); void load(const Common::String &file, byte *buf); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ac6ba523f6..d9bb50453c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2454,6 +2454,19 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX } } +/*--------------------------------------------------------------------------*/ + +FinePositionedObject::FinePositionedObject(): SceneObject() { + _x100 = _y100 = 0; +} + +void FinePositionedObject::synchronize(Serializer &s) { + EventHandler::synchronize(s); + + s.syncAsSint32LE(_x100); + s.syncAsSint32LE(_y100); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 2cf48f3cf3..371ec6be23 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -514,6 +514,16 @@ public: void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; +class FinePositionedObject: public SceneObject { +public: + int _x100, _y100; +public: + FinePositionedObject(); + + virtual Common::String getClassName() { return "FinePositionedObject"; } + virtual void synchronize(Serializer &s); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 4018921791..b977ea1516 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2312,19 +2312,6 @@ void Scene205::Action1::textLoop() { /*--------------------------------------------------------------------------*/ -Scene205::Object::Object(): SceneObject() { - _x100 = _y100 = 0; -} - -void Scene205::Object::synchronize(Serializer &s) { - EventHandler::synchronize(s); - - s.syncAsSint32LE(_x100); - s.syncAsSint32LE(_y100); -} - -/*--------------------------------------------------------------------------*/ - Scene205::Scene205(): SceneExt() { _yp = 0; _textIndex = 1; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 80dab89b32..b7268da788 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -273,13 +273,8 @@ class Scene205: public SceneExt { }; /* Objects */ - class Object: public SceneObject { - public: - int _x100, _y100; - public: - Object(); - - virtual void synchronize(Serializer &s); + class Object: public FinePositionedObject { + // TODO: More derived logic }; private: void setup(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 0da6b3f93d..f3e94369a7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -39,6 +39,19 @@ namespace Ringworld2 { using namespace TsAGE; +class Scene1000 : public SceneExt { +public: + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SpeakerGameText _gameTextSpeaker; + +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + class Scene1010 : public SceneExt { public: SequenceManager _sequenceManager; -- cgit v1.2.3 From ac70aa2e5c246225ac5bf44fb7f746d4f2ec13f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 31 Jul 2013 21:21:29 -0400 Subject: HOPKINS: Bumped up savegame version, and added load handling the brief version 3 format --- engines/hopkins/saveload.cpp | 4 ++++ engines/hopkins/saveload.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 20ef5da44c..c514df6943 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -258,6 +258,10 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { + // The brief version 3 had the highscores embedded. They're in a separate file now, so skip + if (version == 3 && s.isLoading()) + s.skip(100); + s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050); syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins); diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 191cb9e18f..5b77c11f12 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -35,7 +35,7 @@ namespace Hopkins { class HopkinsEngine; -#define HOPKINS_SAVEGAME_VERSION 2 +#define HOPKINS_SAVEGAME_VERSION 4 struct hopkinsSavegameHeader { uint8 _version; -- cgit v1.2.3 From 9b8afdab0ea366de0fe1125f86405df232688dfa Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 1 Aug 2013 03:28:27 +0200 Subject: HOPKINS: Slight cleanup. This renames HopkinsEngine::targetName to HopkinsEngine::getTargetName. This is more consistent with the name scheme of the remaining getters. It also makes getTargetName return a const reference instead of a copy. --- engines/hopkins/computer.cpp | 6 +++--- engines/hopkins/detection.cpp | 2 +- engines/hopkins/hopkins.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 489e7e1133..c09d748b97 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -581,8 +581,8 @@ void ComputerManager::loadHiscore() { byte *ptr = _vm->_globals->allocMemory(100); memset(ptr, 0, 100); - if (_vm->_saveLoad->saveExists(_vm->targetName() + "-highscore.dat")) - _vm->_saveLoad->load(_vm->targetName() + "-highscore.dat", ptr); + if (_vm->_saveLoad->saveExists(_vm->getTargetName() + "-highscore.dat")) + _vm->_saveLoad->load(_vm->getTargetName() + "-highscore.dat", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { _score[scoreIndex]._name = " "; @@ -1012,7 +1012,7 @@ void ComputerManager::saveScore() { ptr[curBufPtr + 15] = 0; } - _vm->_saveLoad->saveFile(_vm->targetName() + "-highscore.dat", ptr, 100); + _vm->_saveLoad->saveFile(_vm->getTargetName() + "-highscore.dat", ptr, 100); _vm->_globals->freeMemory(ptr); } diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 45b6c2bc1d..c617a5aacf 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -56,7 +56,7 @@ bool HopkinsEngine::getIsDemo() const { return _gameDescription->desc.flags & ADGF_DEMO; } -Common::String HopkinsEngine::targetName() const { +const Common::String &HopkinsEngine::getTargetName() const { return _targetName; } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 54e7c90b78..d8c30e5004 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -164,7 +164,7 @@ public: Common::Platform getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; - Common::String targetName() const; + const Common::String &getTargetName() const; int getRandomNumber(int maxNumber); Common::String generateSaveName(int slotNumber); -- cgit v1.2.3 From 9db17152c1ca47a851aed685c0515f3aebb6c390 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 1 Aug 2013 23:53:18 +0200 Subject: GRAPHICS: Make Surface::copyFrom work for any src pitch. Formerly we assumed that the newly created surface has the same pitch as the source surface. This is a assumption that might be invalid (for example in case of the Surface returned by OSystem::lockScreen.) --- graphics/surface.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 41ae8dcebb..010389c9fa 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -84,7 +84,17 @@ void Surface::free() { void Surface::copyFrom(const Surface &surf) { create(surf.w, surf.h, surf.format); - memcpy(pixels, surf.pixels, h * pitch); + if (surf.pitch == pitch) { + memcpy(pixels, surf.pixels, h * pitch); + } else { + const byte *src = (const byte *)surf.pixels; + byte *dst = (byte *)pixels; + for (int y = h; y > 0; --y) { + memcpy(dst, src, w * format.bytesPerPixel); + src += surf.pitch; + dst += pitch; + } + } } void Surface::hLine(int x, int y, int x2, uint32 color) { -- cgit v1.2.3 From 275c65c2727db483b43819b0df91a93148229808 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 1 Aug 2013 21:56:01 +0200 Subject: TONY: Simplify thumbnail loading code. --- engines/tony/detection.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 1094950e2c..2a443c4097 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -154,26 +154,16 @@ void TonyMetaEngine::removeSaveState(const char *target, int slot) const { SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String saveName; byte difficulty; - byte thumbData[160 * 120 * 2]; - - if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, thumbData, saveName, difficulty)) { - // Convert the 565 thumbnail data to the needed overlay format - Common::MemoryReadStream thumbStream(thumbData, 160 * 120 * 2); - Graphics::PixelFormat destFormat = g_system->getOverlayFormat(); - Graphics::Surface *to = new Graphics::Surface(); - to->create(160, 120, destFormat); - - OverlayColor *pixels = (OverlayColor *)to->pixels; - for (int y = 0; y < to->h; ++y) { - for (int x = 0; x < to->w; ++x) { - uint8 r, g, b; - Graphics::colorToRGB >(thumbStream.readUint16LE(), r, g, b); - - // converting to current OSystem Color - *pixels++ = destFormat.RGBToColor(r, g, b); - } - } + Graphics::Surface *to = new Graphics::Surface(); + to->create(160, 120, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + + if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->pixels, saveName, difficulty)) { +#ifdef SCUMM_BIG_ENDIAN + uint16 *pixels = (uint16 *)to->pixels; + for (int i = 0; i < to->w * to->h; ++i) + pixels[i] = READ_LE_UINT16(pixels + i); +#endif // Create the return descriptor SaveStateDescriptor desc(slot, saveName); desc.setDeletableFlag(true); @@ -183,6 +173,7 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } + delete to; return SaveStateDescriptor(); } -- cgit v1.2.3 From d1795a21bc26ae32e36bd0cf777fb05b556107fd Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 1 Aug 2013 22:49:53 +0200 Subject: TONY: Fix savegames on BE (this breaks compatibility). --- engines/tony/mpal/mpal.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index fff8676a89..5e6d44f0a3 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -2035,7 +2035,13 @@ int mpalGetSaveStateSize() { void mpalSaveState(byte *buf) { lockVar(); WRITE_LE_UINT32(buf, GLOBALS._nVars); - memcpy(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MpalVar)); + buf += 4; + for (uint i = 0; i < GLOBALS._nVars; ++i) { + LpMpalVar var = &GLOBALS._lpmvVars[i]; + WRITE_LE_UINT32(buf, var->_dwVal); + memcpy(buf + 4, var->_lpszVarName, sizeof(var->_lpszVarName)); + buf += (4 + sizeof(var->_lpszVarName)); + } unlockVar(); } @@ -2050,10 +2056,16 @@ int mpalLoadState(byte *buf) { globalFree(GLOBALS._hVars); GLOBALS._nVars = READ_LE_UINT32(buf); + buf += 4; GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MpalVar)); lockVar(); - memcpy((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MpalVar)); + for (uint i = 0; i < GLOBALS._nVars; ++i) { + LpMpalVar var = &GLOBALS._lpmvVars[i]; + var->_dwVal = READ_LE_UINT32(buf); + memcpy(var->_lpszVarName, buf + 4, sizeof(var->_lpszVarName)); + buf += (4 + sizeof(var->_lpszVarName)); + } unlockVar(); return GLOBALS._nVars * sizeof(MpalVar) + 4; -- cgit v1.2.3 From 9c02f5b59355590219fb37a0f1ec2b325acae9eb Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 1 Aug 2013 22:55:40 +0200 Subject: TONY: Fix thumbnails on BE. --- engines/tony/game.cpp | 3 ++- engines/tony/gfxcore.h | 4 +++- engines/tony/window.cpp | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index 501a588ff5..ca7c07ad8c 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -508,7 +508,8 @@ void RMOptionScreen::refreshThumbnails() { _curThumb[i] = NULL; _curThumbName[i].clear(); _curThumbDiff[i] = 11; - } + } else + _curThumb[i]->prepareImage(); } } diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h index 2548968e81..9e8f5225c0 100644 --- a/engines/tony/gfxcore.h +++ b/engines/tony/gfxcore.h @@ -208,8 +208,10 @@ public: * 16-bit color source */ class RMGfxSourceBuffer16 : public RMGfxSourceBuffer { -protected: +public: virtual void prepareImage(); + +protected: bool _bTrasp0; public: diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 61497a8066..a732862854 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -330,6 +330,14 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) { src += RM_BBX * dezoom; } } + +#ifdef SCUMM_BIG_ENDIAN + if (lpDestBuf != NULL) { + for (int i = 0; i < dimx * dimy; i++) { + lpDestBuf[i] = SWAP_BYTES_16(lpDestBuf[i]); + } + } +#endif } } // End of namespace Tony -- cgit v1.2.3 From 5b6d3078c9174f0b932b88bf9aeef7c11c3cb190 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 1 Aug 2013 23:36:20 +0200 Subject: TONY: Add a hack to work around amigaos4 issues. --- engines/tony/sound.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 90ae241db0..547f31906e 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -500,7 +500,13 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSiz break; case FPCODEC_ADPCM: +#ifdef __amigaos4__ + // HACK: AmigaOS 4 has weird performance problems with reading in the audio thread, + // so we read the whole stream into memory. + _rewindableStream = Audio::makeADPCMStream(_file.readStream(_size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, 44100, 2); +#else _rewindableStream = Audio::makeADPCMStream(&_file, DisposeAfterUse::NO, 0, Audio::kADPCMDVI, 44100, 2); +#endif break; default: -- cgit v1.2.3 From cb7e9774b0200a7aa58df4508a992287375b1e12 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 Aug 2013 22:21:22 -0400 Subject: TSAGE: Implementing code for R2R scene 1000 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 22 +- engines/tsage/ringworld2/ringworld2_logic.h | 17 +- engines/tsage/ringworld2/ringworld2_scenes0.h | 7 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 428 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes1.h | 5 + 5 files changed, 467 insertions(+), 12 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index d9bb50453c..f872d8edd2 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -108,7 +108,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { /* Scene group #1 */ // case 1000: - error("Missing scene %d from group 1", sceneNumber); + // Cutscene: Ship moving + return new Scene1000(); case 1010: // Cutscene - trip in space return new Scene1010(); @@ -2456,15 +2457,24 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX /*--------------------------------------------------------------------------*/ -FinePositionedObject::FinePositionedObject(): SceneObject() { - _x100 = _y100 = 0; +DataManager::DataManager(): EventHandler() { + } -void FinePositionedObject::synchronize(Serializer &s) { +void DataManager::synchronize(Serializer &s) { EventHandler::synchronize(s); - s.syncAsSint32LE(_x100); - s.syncAsSint32LE(_y100); +} + +void DataManager::load(int v) { + warning("TODO"); +} + +void DataManager::remove() { + if (_endHandler) + _endHandler->signal(); + + _endHandler = NULL; } } // End of namespace Ringworld2 diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 371ec6be23..9ea2494124 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -514,14 +514,23 @@ public: void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; -class FinePositionedObject: public SceneObject { +class DataManager: public EventHandler { public: - int _x100, _y100; + int _field3C; + int _field56; + + int _palStart; + int _palLength; + byte _palData[256 * 3]; + EventHandler *_endHandler; public: - FinePositionedObject(); + DataManager(); - virtual Common::String getClassName() { return "FinePositionedObject"; } + virtual Common::String getClassName() { return "DataManager"; } virtual void synchronize(Serializer &s); + virtual void remove(); + + void load(int v); }; } // End of namespace Ringworld2 diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index b7268da788..bad946fbd6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -273,8 +273,11 @@ class Scene205: public SceneExt { }; /* Objects */ - class Object: public FinePositionedObject { - // TODO: More derived logic + class Object: public SceneObject { + public: + int _x100, _y100; + public: + // TODO: Check if this derives from DataManager? and flesh out }; private: void setup(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index ba62a119a8..ffc491725e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -29,10 +29,438 @@ namespace TsAGE { namespace Ringworld2 { +/*-------------------------------------------------------------------------- + * Scene 1000 - Cutscene: Ship moving + * + *--------------------------------------------------------------------------*/ + +Scene1000::Scene1000(): SceneExt() { + R2_GLOBALS._sceneManager._hasPalette = false; + R2_GLOBALS._uiElements._active = false; + _gameTextSpeaker._displayMode = 9; + _fieldD2E = 0; +} + +void Scene1000::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + + _stripManager.addSpeaker(&_gameTextSpeaker); + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 300: + _sceneMode = R2_GLOBALS.getFlag(57) ? 40 : 0; + break; + case 1010: + _sceneMode = 30; + break; + case 1100: + _sceneMode = 10; + break; + case 1530: + _sceneMode = 20; + break; + case 2500: + _sceneMode = 100; + break; + case 2800: + _sceneMode = 2800; + break; + case 3100: + if (R2_GLOBALS._player._oldCharacterScene[R2_QUINN] == 1000) + _sceneMode = 90; + else + _sceneMode = 80; + break; + case 3500: + _sceneMode = 50; + break; + case 3700: + _sceneMode = 60; + break; + default: + _sceneMode = 999; + break; + } + + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); +} + +void Scene1000::remove() { + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._scenePalette.setEntry(255, 0xff, 0xff, 0xff); + SceneExt::remove(); +} + +void Scene1000::signal() { + ScenePalette scenePalette1, scenePalette2; + uint32 black = 0; + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 0: + // TODO: Sort out values + R2_GLOBALS._gfxColors.foreground = 191; + R2_GLOBALS._gfxColors.background = 144; + R2_GLOBALS._fontColors.background = 224; + R2_GLOBALS._fontColors.foreground = 119; + + _dataManager._field56 = 2; + _dataManager._field3C = 2; + _dataManager.load(5); + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + + _dataManager.dispatch(); + _fieldD2E = 1; + + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound1.play(67); + break; + + case 1: + R2_GLOBALS._sound1.fadeOut2(NULL); + + // TODO: Sort out values + R2_GLOBALS._gfxColors.foreground = 191; + R2_GLOBALS._gfxColors.background = 144; + R2_GLOBALS._fontColors.background = 224; + R2_GLOBALS._fontColors.foreground = 119; + + R2_GLOBALS._scenePalette.loadPalette(0); + loadScene(9999); + + R2_GLOBALS._player.setup(1140, 1, 1); + R2_GLOBALS._player.setPosition(Common::Point(160, 100)); + R2_GLOBALS._player.show(); + + _field412 = 0; + _stripManager.start(29, this); + break; + + case 2: + if (R2_GLOBALS._speechSubtitles & SPEECH_TEXT) { + setAction(&_sequenceManager1, this, &R2_GLOBALS._player, NULL); + } else { + if (++_field412 < 3) + _sceneMode = 2; + + setAction(&_sequenceManager1, this, &R2_GLOBALS._player, NULL); + } + break; + + case 3: + // TODO: Sort out values + R2_GLOBALS._gfxColors.foreground = 191; + R2_GLOBALS._gfxColors.background = 144; + R2_GLOBALS._fontColors.background = 224; + R2_GLOBALS._fontColors.foreground = 119; + + for (int percent = 100; percent >= 0; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(7); + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound2.play(81); + R2_GLOBALS._sound1.play(80); + break; + + case 4: + // TODO: Sort out values + R2_GLOBALS._gfxColors.foreground = 191; + R2_GLOBALS._gfxColors.background = 144; + R2_GLOBALS._fontColors.background = 224; + R2_GLOBALS._fontColors.foreground = 119; + + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sceneManager.changeScene(1100); + break; + + case 10: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(6); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound1.play(55); + break; + + case 11: + R2_GLOBALS._scenePalette.loadPalette(NULL); + R2_GLOBALS._sceneManager.changeScene(300); + break; + + case 20: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(8); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 21: + R2_GLOBALS._scenePalette.loadPalette(NULL); + R2_GLOBALS._sceneManager.changeScene(1530); + break; + + case 30: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(17); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound2.play(91); + break; + + case 31: + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS.setFlag(51); + R2_GLOBALS._sceneManager.changeScene(300); + break; + + case 40: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(18); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound2.play(90); + break; + + case 41: + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._sceneManager.changeScene(1010); + break; + + case 50: + R2_GLOBALS._sound2.play(306); + for (int percent = 100; percent >= 0; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(13); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 51: + R2_GLOBALS._sound2.stop(); + R2_GLOBALS._sound2.play(307); + R2_GLOBALS._sound1.play(308); + + for (int percent = 100; percent >= 0; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(14); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 52: + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._sceneManager.changeScene(3350); + break; + + case 60: + R2_GLOBALS._sound1.play(333); + + for (int percent = 100; percent >= 0; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(12); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 61: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._sceneManager.changeScene(160); + break; + + case 70: + R2_GLOBALS._sound2.play(113); + for (int percent = 100; percent >= 0; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(9); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 71: + case 81: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._sceneManager.changeScene(3100); + break; + + case 80: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(10); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound1.play(242); + R2_GLOBALS._sound2.play(286); + break; + + case 90: + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(11); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + + R2_GLOBALS._sound1.play(277); + break; + + case 91: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._player._characterIndex = R2_SEEKER; + R2_GLOBALS._player._oldCharacterScene[R2_SEEKER] = 3100; + R2_GLOBALS._sceneManager.changeScene(2500); + break; + + case 100: + R2_GLOBALS._sound1.play(304); + R2_GLOBALS._sound2.play(82); + + _dataManager._field3C = 2; + _dataManager._field56 = 2; + _dataManager.load(19); + + R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._sceneManager._hasPalette = false; + _dataManager.dispatch(); + + _fieldD2E = 1; + R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); + for (int percent = 0; percent < 100; percent += 5) + R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); + break; + + case 101: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._sceneManager.changeScene(3500); + break; + } +} + +void Scene1000::dispatch() { + +} + + /*-------------------------------------------------------------------------- * Scene 1010 - Cutscene: A pixel lost in space! * *--------------------------------------------------------------------------*/ + void Scene1010::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(1010); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index f3e94369a7..4ee0c29f4f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -44,8 +44,13 @@ public: SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; SpeakerGameText _gameTextSpeaker; + DataManager _dataManager; + int _field412; + int _fieldD2E; public: + Scene1000(); + virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void signal(); -- cgit v1.2.3 From 17ccd18ed3a41702ac7de7e55fca09578f734ccb Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 2 Aug 2013 06:23:52 +0100 Subject: COMMON: Add comment explaining reason for defining math constants. --- common/scummsys.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/scummsys.h b/common/scummsys.h index aeffbbfcf3..099b12b291 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -144,6 +144,11 @@ #endif #endif +// The following math constants are usually defined by the system math.h header, but +// they are not part of the ANSI C++ standards and so can NOT be relied upon to be +// present i.e. when -std=c++11 is passed to GCC, enabling strict ANSI compliance. +// As we rely on these being present, we define them if they are not set. + #ifndef M_SQRT1_2 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif -- cgit v1.2.3 From 9a787fa5861061580711073d5e2403d54887a421 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 17:33:13 +0200 Subject: GRAPHICS: Silence conversion warnings by using an explicit cast. --- graphics/scaler/thumbnail_intern.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 2756e4026a..d51eff59e8 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -145,9 +145,9 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { const float xDiff = xFrac - x1; const float yDiff = yFrac - y1; - uint8 pR = ((1 - yDiff) * ((1 - xDiff) * p1R + xDiff * p2R) + yDiff * ((1 - xDiff) * p3R + xDiff * p4R)); - uint8 pG = ((1 - yDiff) * ((1 - xDiff) * p1G + xDiff * p2G) + yDiff * ((1 - xDiff) * p3G + xDiff * p4G)); - uint8 pB = ((1 - yDiff) * ((1 - xDiff) * p1B + xDiff * p2B) + yDiff * ((1 - xDiff) * p3B + xDiff * p4B)); + uint8 pR = (uint8)((1 - yDiff) * ((1 - xDiff) * p1R + xDiff * p2R) + yDiff * ((1 - xDiff) * p3R + xDiff * p4R)); + uint8 pG = (uint8)((1 - yDiff) * ((1 - xDiff) * p1G + xDiff * p2G) + yDiff * ((1 - xDiff) * p3G + xDiff * p4G)); + uint8 pB = (uint8)((1 - yDiff) * ((1 - xDiff) * p1B + xDiff * p2B) + yDiff * ((1 - xDiff) * p3B + xDiff * p4B)); WRITE_UINT16(dst, Graphics::RGBToColor >(pR, pG, pB)); -- cgit v1.2.3 From ff451ba2dc8c417d781f362f4af80aec44b57341 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 17:48:31 +0200 Subject: GRAPHICS: Slight formatting fixes in thumbnail_intern.cpp. --- graphics/scaler/thumbnail_intern.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index d51eff59e8..347a25ec37 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -149,7 +149,6 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { uint8 pG = (uint8)((1 - yDiff) * ((1 - xDiff) * p1G + xDiff * p2G) + yDiff * ((1 - xDiff) * p3G + xDiff * p4G)); uint8 pB = (uint8)((1 - yDiff) * ((1 - xDiff) * p1B + xDiff * p2B) + yDiff * ((1 - xDiff) * p3B + xDiff * p4B)); - WRITE_UINT16(dst, Graphics::RGBToColor >(pR, pG, pB)); dst += 2; } @@ -165,7 +164,7 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { * Copies the current screen contents to a new surface, using RGB565 format. * WARNING: surf->free() must be called by the user to avoid leaking. * - * @param surf the surface to store the data in it + * @param surf the surface to store the data in it */ static bool grabScreen565(Graphics::Surface *surf) { Graphics::Surface *screen = g_system->lockScreen(); -- cgit v1.2.3 From 058c22ddaa073a1584993b2d68b2db02ad80d088 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 18:37:12 +0200 Subject: GRAPHICS: Allow to query a Surface describing a subarea in Surface. --- graphics/surface.cpp | 28 ++++++++++++++++++++++++++++ graphics/surface.h | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 010389c9fa..b90ddd23e8 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -97,6 +97,34 @@ void Surface::copyFrom(const Surface &surf) { } } +Surface Surface::getSubArea(const Common::Rect &area) { + Common::Rect effectiveArea(area); + effectiveArea.clip(w, h); + + Surface subSurface; + subSurface.w = effectiveArea.width(); + subSurface.h = effectiveArea.height(); + subSurface.pitch = pitch; + subSurface.pixels = getBasePtr(area.left, area.top); + subSurface.format = format; + return subSurface; +} + +const Surface Surface::getSubArea(const Common::Rect &area) const { + Common::Rect effectiveArea(area); + effectiveArea.clip(w, h); + + Surface subSurface; + subSurface.w = effectiveArea.width(); + subSurface.h = effectiveArea.height(); + subSurface.pitch = pitch; + // We need to cast the const away here because a Surface always has a + // pointer to modifiable pixel data. + subSurface.pixels = const_cast(getBasePtr(area.left, area.top)); + subSurface.format = format; + return subSurface; +} + void Surface::hLine(int x, int y, int x2, uint32 color) { // Clipping if (y < 0 || y >= h) diff --git a/graphics/surface.h b/graphics/surface.h index 6c9e464657..21b491e043 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -134,11 +134,43 @@ struct Surface { */ void copyFrom(const Surface &surf); + /** + * Creates a Surface which represents a sub-area of this Surface object. + * + * The pixel (0, 0) of the returned Surface will be the same as Pixel + * (area.x, area.y) of this Surface. Changes to any of the Surface objects + * will change the shared pixel data. + * + * Note that the Surface returned is only valid as long as this Surface + * object is still alive (i.e. its pixel data is not destroyed or + * reallocated). Do *never* try to free the returned Surface. + * + * @param area The area which should be represented. Note that the area + * will get clipped in case it does not fit! + */ + Surface getSubArea(const Common::Rect &area); + + /** + * Creates a Surface which represents a sub-area of this Surface object. + * + * The pixel (0, 0) of the returned Surface will be the same as Pixel + * (area.x, area.y) of this Surface. + * + * Note that the Surface returned is only valid as long as this Surface + * object is still alive (i.e. its pixel data is not destroyed or + * reallocated). Do *never* try to free the returned Surface. + * + * @param area The area which should be represented. Note that the area + * will get clipped in case it does not fit! + */ + const Surface getSubArea(const Common::Rect &area) const; + /** * Convert the data to another pixel format. * * This works in-place. This means it will not create an additional buffer - * for the conversion process. The value of pixels might change though. + * for the conversion process. The value of 'pixels' might change though + * (that means it might realloc the pixel data). * * Note that you should only use this, when you created the Surface data via * create! Otherwise this function has undefined behavior. -- cgit v1.2.3 From 4790a4abd5c157254cab069bc34aa8ef8347f668 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 20:02:02 +0200 Subject: COMMON: Define all Unix98/BSD math constants in scummsys.h. This should fix compilation on mingw64 with --enable-c++11 and also make sure the constants are present on other systems for the uncommon case they might be missing. --- common/scummsys.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/common/scummsys.h b/common/scummsys.h index 099b12b291..3e9d5ef063 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -149,12 +149,56 @@ // present i.e. when -std=c++11 is passed to GCC, enabling strict ANSI compliance. // As we rely on these being present, we define them if they are not set. -#ifndef M_SQRT1_2 - #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#ifndef M_E + #define M_E 2.7182818284590452354 /* e */ +#endif + +#ifndef M_LOG2E + #define M_LOG2E 1.4426950408889634074 /* log_2 e */ +#endif + +#ifndef M_LOG10E + #define M_LOG10E 0.43429448190325182765 /* log_10 e */ +#endif + +#ifndef M_LN2 + #define M_LN2 0.69314718055994530942 /* log_e 2 */ +#endif + +#ifndef M_LN10 + #define M_LN10 2.30258509299404568402 /* log_e 10 */ #endif #ifndef M_PI - #define M_PI 3.14159265358979323846 + #define M_PI 3.14159265358979323846 /* pi */ +#endif + +#ifndef M_PI_2 + #define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif + +#ifndef M_PI_4 + #define M_PI_4 0.78539816339744830962 /* pi/4 */ +#endif + +#ifndef M_1_PI + #define M_1_PI 0.31830988618379067154 /* 1/pi */ +#endif + +#ifndef M_2_PI + #define M_2_PI 0.63661977236758134308 /* 2/pi */ +#endif + +#ifndef M_2_SQRTPI + #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#endif + +#ifndef M_SQRT2 + #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif + +#ifndef M_SQRT1_2 + #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif // Include our C++11 compatability header for pre-C++11 compilers. -- cgit v1.2.3 From c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 22:23:00 +0200 Subject: SCUMM: Prefer getBasePtr over direct Surface::pixels access. --- engines/scumm/akos.cpp | 6 +++--- engines/scumm/base-costume.cpp | 2 +- engines/scumm/bomp.cpp | 5 ++++- engines/scumm/charset.cpp | 9 ++++----- engines/scumm/costume.cpp | 6 +++--- engines/scumm/cursor.cpp | 2 +- engines/scumm/debugger.cpp | 2 +- engines/scumm/gfx.cpp | 14 +++++++------- engines/scumm/gfx_towns.cpp | 2 +- engines/scumm/he/animation_he.cpp | 4 ++-- engines/scumm/nut_renderer.cpp | 10 ++++++++-- 11 files changed, 35 insertions(+), 27 deletions(-) diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index b6acf01050..481c4af432 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -994,7 +994,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (_draw_bottom < rect.bottom) _draw_bottom = rect.bottom; - v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel; + v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y); codec1_genericDecode(v1); @@ -1288,7 +1288,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { int32 numskip_before = skip_x + (skip_y * _width); int32 numskip_after = _width - cur_x; - byte *dst = (byte *)_out.pixels + height_unk * _out.pitch + width_unk * _vm->_bytesPerPixel; + byte *dst = (byte *)_out.getBasePtr(width_unk, height_unk); akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf); return 0; @@ -1358,7 +1358,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768; } - byte *dstPtr = (byte *)_out.pixels + dst.top * _out.pitch + dst.left * _vm->_bytesPerPixel; + byte *dstPtr = (byte *)_out.getBasePtr(dst.left, dst.top); if (_shadow_mode == 3) { Wiz::decompressWizImage(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bytesPerPixel); } else { diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index 46c68c81b0..ff9058538b 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -38,7 +38,7 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _out.w = _out.pitch / _vm->_bytesPerPixel; - _out.pixels = (byte *)_out.pixels - (_vm->_virtscr[kMainVirtScreen].xstart & 7); + _out.pixels = (byte *)_out.getBasePtr(-(_vm->_virtscr[kMainVirtScreen].xstart & 7), 0); _numStrips = numStrips; diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp index 845cf70722..5b87f3042c 100644 --- a/engines/scumm/bomp.cpp +++ b/engines/scumm/bomp.cpp @@ -231,7 +231,10 @@ void drawBomp(const BompDrawData &bd) { } src = bd.src; - dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left); + // FIXME: This gets passed a const destination Surface. Intuitively this + // should never get written to. But sadly it does... For now we simply + // cast the const qualifier away. + dst = (byte *)const_cast(bd.dst.getBasePtr((bd.x + clip.left), bd.y)); const byte maskbit = revBitMask((bd.x + clip.left) & 7); diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 9ae75b6683..6e289b2afc 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -799,7 +799,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, if (ignoreCharsetMask || !vs->hasTwoBuffers) { dstPtr = vs->getPixels(0, 0); } else { - dstPtr = (byte *)_vm->_textSurface.pixels; + dstPtr = (byte *)_vm->_textSurface.getBasePtr(0, 0); } if (_blitAlso && vs->hasTwoBuffers) { @@ -829,7 +829,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, dstPtr = vs->getPixels(_left, drawTop); } else { dstSurface = _vm->_textSurface; - dstPtr = (byte *)_vm->_textSurface.pixels + (_top - _vm->_screenTop) * _vm->_textSurface.pitch * _vm->_textSurfaceMultiplier + _left * _vm->_textSurfaceMultiplier; + dstPtr = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, (_top - _vm->_screenTop) * _vm->_textSurfaceMultiplier); } if (_blitAlso && vs->hasTwoBuffers) { @@ -907,7 +907,7 @@ bool CharsetRendererClassic::prepareDraw(uint16 chr) { void CharsetRendererClassic::drawChar(int chr, Graphics::Surface &s, int x, int y) { if (!prepareDraw(chr)) return; - byte *dst = (byte *)s.pixels + y * s.pitch + x; + byte *dst = (byte *)s.getBasePtr(x, y); drawBitsN(s, dst, _charPtr, *_fontPtr, y, _width, _height); } @@ -1242,7 +1242,6 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) { if (ignoreCharsetMask) { VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; s = *vs; - s.pixels = vs->getPixels(0, 0); } else { s = _vm->_textSurface; drawTop -= _vm->_screenTop; @@ -1401,7 +1400,7 @@ void CharsetRendererTownsClassic::drawBitsN(const Graphics::Surface&, byte *dst, } bool scale2x = (_vm->_textSurfaceMultiplier == 2); - dst = (byte *)_vm->_textSurface.pixels + (_top - _vm->_screenTop) * _vm->_textSurface.pitch * _vm->_textSurfaceMultiplier + _left * _vm->_textSurfaceMultiplier; + dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, (_top - _vm->_screenTop) * _vm->_textSurfaceMultiplier); int y, x; int color; diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 4ebdd00fdc..85c60f9a40 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -293,7 +293,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { return 2; } - v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel; + v1.destptr = (byte *)_out.getBasePtr(v1.x, v1.y); v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf); @@ -826,7 +826,7 @@ byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) { int my = _actorY + y + ty; int mx = _actorX + x + tx; if (!(_zbuf && (maskBuf[my * _numStrips + mx / 8] & revBitMask(mx & 7)))) - *((byte *)_out.pixels + my * _out.pitch + mx) = palette[c]; + *((byte *)_out.getBasePtr(mx, my)) = palette[c]; } } } @@ -1238,7 +1238,7 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) { int destY = ypos + y; if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) { - byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX; + byte *dst = (byte *)_out.getBasePtr(destX, destY); byte *mask = _vm->getMaskBuffer(0, destY, _zbuf); if (a0->_limb_flipped[limb]) { LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6); diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 269ae9e10a..3eb7246b3a 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -139,7 +139,7 @@ void ScummEngine_v6::grabCursor(int x, int y, int w, int h) { return; } - setCursorFromBuffer((byte *)vs->pixels + (y - vs->topline) * vs->pitch + x, w, h, vs->pitch); + setCursorFromBuffer((byte *)vs->getBasePtr(x, y - vs->topline), w, h, vs->pitch); } void ScummEngine_v6::setDefaultCursor() { diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 9b6dd1e687..5e5719d6bc 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -641,7 +641,7 @@ static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) { x2 = right - 1; - ptr = (byte *)vs->pixels + x1 + y * vs->pitch; + ptr = (byte *)vs->getBasePtr(y, x1); while (x1++ <= x2) { *ptr++ = color; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 50ff0b3988..41899da0a3 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -422,7 +422,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int _res->createResource(rtBuffer, slot + 1, size); vs->pixels = getResourceAddress(rtBuffer, slot + 1); - memset(vs->pixels, 0, size); // reset background + memset(vs->getPixels(0, 0), 0, size); // reset background if (twobufs) { vs->backBuf = _res->createResource(rtBuffer, slot + 5, size); @@ -612,7 +612,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Some paranoia checks assert(top >= 0 && bottom <= vs->h); assert(x >= 0 && width <= vs->pitch); - assert(_textSurface.pixels); + assert(_textSurface.getBasePtr(0, 0)); // Perform some clipping if (width > vs->w - x) @@ -1135,7 +1135,7 @@ void ScummEngine::clearTextSurface() { _townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0); #endif - fill((byte *)_textSurface.pixels, _textSurface.pitch, + fill((byte *)_textSurface.getBasePtr(0, 0), _textSurface.pitch, #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE _game.platform == Common::kPlatformFMTowns ? 0 : #endif @@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, if (vs->hasTwoBuffers) dst = vs->backBuf + y * vs->pitch + x * 8; else - dst = (byte *)vs->pixels + y * vs->pitch + x * 8; + dst = (byte *)vs->getPixels(x * 8, y); mask_ptr = getMaskBuffer(x, y, 1); @@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const if (vs->hasTwoBuffers) dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); else - dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); + dstPtr = (byte *)vs->getPixels(x * 8, y); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); @@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const transpStrip = true; if (vs->hasTwoBuffers) { - byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); + byte *frontBuf = (byte *)vs->getPixels(x * 8, y); if (lightsOn) copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); else @@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) { vs->bdirty[strip] = bottom; bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; - backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; + backbuff_ptr = (byte *)vs->getPixels((strip + vs->xstart/8) * 8, top); numLinesToProcess = bottom - top; if (numLinesToProcess) { diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp index f86a4e56d5..a803b6e511 100644 --- a/engines/scumm/gfx_towns.cpp +++ b/engines/scumm/gfx_towns.cpp @@ -34,7 +34,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in if (width <= 0 || height <= 0) return; - assert(_textSurface.pixels); + assert(_textSurface.getBasePtr(0, 0)); int m = _textSurfaceMultiplier; diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index be17a3b305..7ae5547702 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -90,7 +90,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint if (!surface) return; - byte *src = (byte *)surface->pixels; + const byte *src = (const byte *)surface->getBasePtr(0, 0); if (_video->hasDirtyPalette()) _vm->setPaletteFromPtr(_video->getPalette(), 256); @@ -119,7 +119,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint dst += y * pitch + x * 2; do { for (uint i = 0; i < w; i++) { - uint16 color = *((uint16 *)src + i); + uint16 color = *((const uint16 *)src + i); switch (dstType) { case kDstScreen: WRITE_UINT16(dst + i * 2, color); diff --git a/engines/scumm/nut_renderer.cpp b/engines/scumm/nut_renderer.cpp index 048b29d68b..d9f0b412e1 100644 --- a/engines/scumm/nut_renderer.cpp +++ b/engines/scumm/nut_renderer.cpp @@ -357,7 +357,10 @@ void NutRenderer::drawFrame(byte *dst, int c, int x, int y) { } void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byte color) { - byte *dst = (byte *)s.pixels + y * s.pitch + x; + // FIXME: This gets passed a const destination Surface. Intuitively this + // should never get written to. But sadly it does... For now we simply + // cast the const qualifier away. + byte *dst = (byte *)const_cast(s.getBasePtr(x, y)); const int width = MIN((int)_chars[c].width, s.w - x); const int height = MIN((int)_chars[c].height, s.h - y); const byte *src = unpackChar(c); @@ -391,7 +394,10 @@ void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byt } void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byte color) { - byte *dst = (byte *)s.pixels + y * s.pitch + x; + // FIXME: This gets passed a const destination Surface. Intuitively this + // should never get written to. But sadly it does... For now we simply + // cast the const qualifier away. + byte *dst = (byte *)const_cast(s.getBasePtr(x, y)); const int width = _vm->_2byteWidth; const int height = MIN(_vm->_2byteHeight, s.h - y); const byte *src = _vm->get2byteCharPtr(c); -- cgit v1.2.3 From 28b74b14ec5444d9f2558c05cea67f3567322b51 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:12:09 +0200 Subject: AGOS: Prefer getBasePtr over direct Surface::pixels access. --- engines/agos/animation.cpp | 8 ++--- engines/agos/charset-fontdata.cpp | 8 ++--- engines/agos/charset.cpp | 2 +- engines/agos/draw.cpp | 30 +++++++++--------- engines/agos/event.cpp | 2 +- engines/agos/gfx.cpp | 64 +++++++++++++++++++-------------------- engines/agos/icons.cpp | 16 +++++----- engines/agos/menus.cpp | 4 +-- engines/agos/verb.cpp | 2 +- engines/agos/vga.cpp | 11 ++++--- engines/agos/vga_e2.cpp | 10 +++--- engines/agos/vga_pn.cpp | 4 +-- engines/agos/vga_s2.cpp | 5 ++- engines/agos/vga_ww.cpp | 2 +- engines/agos/window.cpp | 4 +-- 15 files changed, 89 insertions(+), 83 deletions(-) diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 9176412e0e..214a383680 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -272,7 +272,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { if (!surface) return; - byte *src = (byte *)surface->pixels; + const byte *src = (const byte *)surface->getBasePtr(0, 0); dst += y * pitch + x; do { @@ -344,7 +344,7 @@ void MoviePlayerDXA::handleNextFrame() { bool MoviePlayerDXA::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); + copyFrameToBuffer((byte *)screen->getBasePtr(0, 0), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); _vm->_system->unlockScreen(); uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound); @@ -443,7 +443,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { if (!surface) return; - byte *src = (byte *)surface->pixels; + const byte *src = (const byte *)surface->getBasePtr(0, 0); dst += y * pitch + x; do { @@ -495,7 +495,7 @@ void MoviePlayerSMK::nextFrame() { bool MoviePlayerSMK::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->pixels, (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); + copyFrameToBuffer((byte *)screen->getBasePtr(0, 0), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); _vm->_system->unlockScreen(); uint32 waitTime = getTimeToNextFrame(); diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp index 262ae44f01..b67b307606 100644 --- a/engines/agos/charset-fontdata.cpp +++ b/engines/agos/charset-fontdata.cpp @@ -2924,7 +2924,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dstPitch = screen->pitch; h = 8; w = 6; @@ -2961,7 +2961,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dstPitch = screen->pitch; h = 8; w = 6; @@ -2986,14 +2986,14 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA1) { - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dstPitch = screen->pitch; h = 8; w = 6; src = english_elvira1Font + (chr - 32) * 8; } else { - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dstPitch = screen->pitch; h = 8; w = 8; diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp index f58f4397b5..eca9728643 100644 --- a/engines/agos/charset.cpp +++ b/engines/agos/charset.cpp @@ -362,7 +362,7 @@ void AGOSEngine::windowScroll(WindowBlock *window) { w = window->width * 8; h = (window->height -1) * 8; - dst = (byte *)screen->pixels + window->y * screen->pitch + window->x * 8; + dst = (byte *)screen->getBasePtr(window->x * 8, window->y); src = dst + 8 * screen->pitch; do { diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index cf3a12ceb8..63bd22f65b 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -32,15 +32,15 @@ namespace AGOS { byte *AGOSEngine::getBackBuf() { - return (byte *)_backBuf->pixels; + return (byte *)_backBuf->getBasePtr(0, 0); } byte *AGOSEngine::getBackGround() { - return (byte *)_backGroundBuf->pixels; + return (byte *)_backGroundBuf->getBasePtr(0, 0); } byte *AGOSEngine::getScaleBuf() { - return (byte *)_scaleBuf->pixels; + return (byte *)_scaleBuf->getBasePtr(0, 0); } #ifdef ENABLE_AGOS2 @@ -226,7 +226,7 @@ void AGOSEngine::animateSprites() { debug(0, "Using special wall"); uint8 color, h, len; - byte *dst = (byte *)_window4BackScn->pixels; + byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); color = (_variableArray[293] & 1) ? 13 : 15; _wallOn = 2; @@ -256,7 +256,7 @@ void AGOSEngine::animateSprites() { } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) { // Used by the Unholy Barrier spell uint8 color, h, len; - byte *dst = (byte *)_window4BackScn->pixels; + byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); color = 1; _wallOn = 2; @@ -491,7 +491,7 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) { int16 y = vsp->y - _scrollY; if (_window3Flag == 1) { - animTable->srcPtr = (const byte *)_window4BackScn->pixels; + animTable->srcPtr = (const byte *)_window4BackScn->getBasePtr(0, 0); } else { int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8; int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y); @@ -565,7 +565,7 @@ void AGOSEngine::displayBoxStars() { if (x_ >= 311) continue; - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += (((screen->pitch / 4) * y_) * 4) + x_; @@ -673,7 +673,7 @@ void AGOSEngine::scrollScreen() { if (getGameType() == GType_SIMON2) { src = getBackGround(); - dst = (byte *)_window4BackScn->pixels; + dst = (byte *)_window4BackScn->getBasePtr(0, 0); for (int i = 0; i < _scrollHeight; i++) { memcpy(dst, src, _screenWidth); src += _backGroundBuf->pitch; @@ -725,7 +725,7 @@ void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) { void AGOSEngine::fillBackFromFront() { Graphics::Surface *screen = _system->lockScreen(); - byte *src = (byte *)screen->pixels; + byte *src = (byte *)screen->getBasePtr(0, 0); byte *dst = getBackBuf(); for (int i = 0; i < _screenHeight; i++) { @@ -748,7 +748,7 @@ void AGOSEngine::fillBackGroundFromBack() { void AGOSEngine::fillBackGroundFromFront() { Graphics::Surface *screen = _system->lockScreen(); - byte *src = (byte *)screen->pixels; + byte *src = (byte *)screen->getBasePtr(0, 0); byte *dst = getBackGround(); for (int i = 0; i < _screenHeight; i++) { @@ -785,7 +785,7 @@ void AGOSEngine::displayScreen() { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_PP || getGameType() == GType_FF) { byte *src = getBackBuf(); - byte *dst = (byte *)screen->pixels; + byte *dst = (byte *)screen->getBasePtr(0, 0); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += _backBuf->pitch; @@ -798,9 +798,9 @@ void AGOSEngine::displayScreen() { _window4Flag = 0; uint16 srcWidth, width, height; - byte *dst = (byte *)screen->pixels; + byte *dst = (byte *)screen->getBasePtr(0, 0); - const byte *src = (const byte *)_window4BackScn->pixels; + const byte *src = (const byte *)_window4BackScn->getBasePtr(0, 0); if (_window3Flag == 1) { src = getBackGround(); } @@ -831,8 +831,8 @@ void AGOSEngine::displayScreen() { if (_window6Flag == 2) { _window6Flag = 0; - byte *src = (byte *)_window6BackScn->pixels; - byte *dst = (byte *)screen->pixels + 51 * screen->pitch; + byte *src = (byte *)_window6BackScn->getBasePtr(0, 0); + byte *dst = (byte *)screen->getBasePtr(0, 51); for (int i = 0; i < 80; i++) { memcpy(dst, src, _window6BackScn->w); dst += screen->pitch; diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index cc1c40c207..65c7f7fd77 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -365,7 +365,7 @@ void AGOSEngine::drawStuff(const byte *src, uint xoffs) { const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 135; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * screen->pitch + xoffs; + byte *dst = (byte *)screen->getBasePtr(xoffs, y); for (uint h = 0; h < 6; h++) { memcpy(dst, src, 4); diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index db0817250b..2808543f8e 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -649,7 +649,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _window4BackScn->pitch; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -666,7 +666,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -678,7 +678,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -696,7 +696,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _window4BackScn->pitch; } @@ -712,7 +712,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -861,7 +861,7 @@ void AGOSEngine::drawImage(VC10_state *state) { uint16 xoffs = 0, yoffs = 0; if (getGameType() == GType_WW) { if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) { - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -873,7 +873,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -881,7 +881,7 @@ void AGOSEngine::drawImage(VC10_state *state) { } } else if (getGameType() == GType_ELVIRA2) { if (_windowNum == 4 || _windowNum >= 10) { - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -893,7 +893,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -901,19 +901,19 @@ void AGOSEngine::drawImage(VC10_state *state) { } } else if (getGameType() == GType_ELVIRA1) { if (_windowNum == 6) { - state->surf_addr = (byte *)_window6BackScn->pixels; + state->surf_addr = (byte *)_window6BackScn->getBasePtr(0, 0); state->surf_pitch = _window6BackScn->pitch; xoffs = state->x * 8; yoffs = state->y; } else if (_windowNum == 2 || _windowNum == 3) { - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; } else { - state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -926,7 +926,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } } else { - state->surf_addr = (byte *)screen->pixels; + state->surf_addr = (byte *)screen->getBasePtr(0, 0); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -973,7 +973,7 @@ void AGOSEngine::horizontalScroll(VC10_state *state) { vcWriteVar(251, _scrollX); if (getGameType() == GType_SIMON2) { - dst = (byte *)_window4BackScn->pixels; + dst = (byte *)_window4BackScn->getBasePtr(0, 0); dstPitch = _window4BackScn->pitch; } else { dst = getBackBuf(); @@ -1375,10 +1375,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) { // The DOS Floppy demo was based off Waxworks engine if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->pixels; + src = (byte *)_window4BackScn->getBasePtr(0, 0); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { _system->unlockScreen(); @@ -1387,13 +1387,13 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_SIMON1) { if (updateWindow == 4) { - src = (byte *)_window4BackScn->pixels; + src = (byte *)_window4BackScn->getBasePtr(0, 0); srcWidth = _videoWindows[18] * 16; } else if (updateWindow >= 10) { - src = (byte *)_window4BackScn->pixels + xoffs + yoffs * 320; + src = (byte *)_window4BackScn->getBasePtr(xoffs, yoffs); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 0) { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { _system->unlockScreen(); @@ -1402,10 +1402,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_WW) { if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->pixels; + src = (byte *)_window4BackScn->getBasePtr(0, 0); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { _system->unlockScreen(); @@ -1414,10 +1414,10 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_ELVIRA2) { if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->pixels; + src = (byte *)_window4BackScn->getBasePtr(0, 0); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3) { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { _system->unlockScreen(); @@ -1427,17 +1427,17 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } else if (getGameType() == GType_ELVIRA1) { if (updateWindow == 6) { _window6Flag = 1; - src = (byte *)_window6BackScn->pixels; + src = (byte *)_window6BackScn->getBasePtr(0, 0); srcWidth = 48; } else if (updateWindow == 2 || updateWindow == 3) { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { - src = (byte *)_window4BackScn->pixels; + src = (byte *)_window4BackScn->getBasePtr(0, 0); srcWidth = _videoWindows[18] * 16; } } else { - src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } @@ -1451,13 +1451,13 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas if (getGameType() == GType_PN && !_wiped && !specialCase) { uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15; - dst = (byte *)screen->pixels + 48; + dst = (byte *)screen->getBasePtr(48, 0); memset(dst, color, 224); - dst = (byte *)screen->pixels + 132 * screen->pitch + 48; + dst = (byte *)screen->getBasePtr(48, 132); memset(dst, color, 224); } else if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette) { - dst = (byte *)screen->pixels + 133 * screen->pitch; + dst = (byte *)screen->getBasePtr(0, 133); for (int h = 0; h < 67; h++) { for (int w = 0; w < _screenWidth; w++) @@ -1479,7 +1479,7 @@ void AGOSEngine::drawEdging() { Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels + 136 * screen->pitch; + dst = (byte *)screen->getBasePtr(0, 136); uint8 len = 52; while (len--) { @@ -1488,7 +1488,7 @@ void AGOSEngine::drawEdging() { dst += screen->pitch; } - dst = (byte *)screen->pixels + 187 * screen->pitch; + dst = (byte *)screen->getBasePtr(0, 187); memset(dst, color, _screenWidth); _system->unlockScreen(); diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index 0ee1d62fde..558e7f9adb 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -202,7 +202,7 @@ void AGOSEngine_Simon2::drawIcon(WindowBlock *window, uint icon, uint x, uint y) _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += 110; dst += x; @@ -228,7 +228,7 @@ void AGOSEngine_Simon1::drawIcon(WindowBlock *window, uint icon, uint x, uint y) _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += (x + window->x) * 8; dst += (y * 25 + window->y) * screen->pitch; @@ -256,7 +256,7 @@ void AGOSEngine_Waxworks::drawIcon(WindowBlock *window, uint icon, uint x, uint _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += (x + window->x) * 8; dst += (y * 20 + window->y) * screen->pitch; @@ -284,7 +284,7 @@ void AGOSEngine_Elvira2::drawIcon(WindowBlock *window, uint icon, uint x, uint y _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += (x + window->x) * 8; dst += (y * 8 + window->y) * screen->pitch; @@ -312,7 +312,7 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); dst += (x + window->x) * 8; dst += (y * 8 + window->y) * screen->pitch; @@ -339,7 +339,7 @@ void AGOSEngine::drawIcon(WindowBlock *window, uint icon, uint x, uint y) { _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels + y * screen->pitch + x * 8; + dst = (byte *)screen->getBasePtr(x * 8, y); src = _iconFilePtr + icon * 146; if (icon == 0xFF) { @@ -951,7 +951,7 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) { } Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * screen->pitch + x * 8; + byte *dst = (byte *)screen->getBasePtr(x * 8, y); for (h = 0; h < 19; h++) { for (w = 0; w < 16; w++) { @@ -1042,7 +1042,7 @@ static const byte hitBarData[12 * 7] = { // Personal Nightmare specific void AGOSEngine_PN::drawIconHitBar() { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + 3 * screen->pitch + 6 * 8; + byte *dst = (byte *)screen->getBasePtr(6 * 8, 3); const byte *src = hitBarData; uint8 color = (getPlatform() == Common::kPlatformDOS) ? 7 : 15; diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp index a0d2bdcaa0..85c50e421b 100644 --- a/engines/agos/menus.cpp +++ b/engines/agos/menus.cpp @@ -164,7 +164,7 @@ void AGOSEngine::unlightMenuStrip() { mouseOff(); Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + 8 * screen->pitch + 272; + src = (byte *)screen->getBasePtr(272, 8); w = 48; h = 82; @@ -192,7 +192,7 @@ void AGOSEngine::lightMenuBox(uint hitarea) { mouseOff(); Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; + src = (byte *)screen->getBasePtr(ha->x, ha->y); w = ha->width; h = ha->height; diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 93077ed83e..f5b57a01c8 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -973,7 +973,7 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) { _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; + src = (byte *)screen->getBasePtr(ha->x, ha->y); // WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) { diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 8541f579d6..5456174f5d 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1179,7 +1179,7 @@ void AGOSEngine::vc32_saveScreen() { if (getGameType() == GType_PN) { Graphics::Surface *screen = _system->lockScreen(); byte *dst = getBackGround(); - byte *src = (byte *)screen->pixels; + byte *src = (byte *)screen->getBasePtr(0, 0); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); dst += _backGroundBuf->pitch; @@ -1193,7 +1193,7 @@ void AGOSEngine::vc32_saveScreen() { uint16 height = _videoWindows[4 * 4 + 3]; byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs); - byte *src = (byte *)_window4BackScn->pixels; + byte *src = (byte *)_window4BackScn->getBasePtr(0, 0); uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16; for (; height > 0; height--) { memcpy(dst, src, width); @@ -1247,7 +1247,7 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) { if (getGameType() == GType_ELVIRA1 && num == 3) { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels; + byte *dst = (byte *)screen->getBasePtr(0, 0); for (int i = 0; i < _screenHeight; i++) { memset(dst, color, _screenWidth); dst += screen->pitch; @@ -1258,7 +1258,10 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) { uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16; uint16 yoffs = (vlut[1] - _videoWindows[17]); uint16 dstWidth = _videoWindows[18] * 16; - byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; + // TODO: Is there any known connection between dstWidth and the pitch + // of the _window4BackScn Surface? If so, we might be able to pass + // yoffs as proper y parameter to getBasePtr. + byte *dst = (byte *)_window4BackScn->getBasePtr(xoffs, 0) + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index d4aafd3d7b..b335c6b18a 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -76,7 +76,7 @@ void AGOSEngine::vc45_setWindowPalette() { uint8 height = vlut[3]; if (num == 4) { - byte *dst = (byte *)_window4BackScn->pixels; + byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); for (uint8 h = 0; h < height; h++) { for (uint8 w = 0; w < width; w++) { @@ -223,11 +223,11 @@ void AGOSEngine::vc53_dissolveIn() { uint16 count = dissolveCheck * 2; while (count--) { Graphics::Surface *screen = _system->lockScreen(); - byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; + byte *dstPtr = (byte *)screen->getBasePtr(x, y); yoffs = _rnd.getRandomNumber(dissolveY); dst = dstPtr + yoffs * screen->pitch; - src = (byte *)_window4BackScn->pixels + yoffs * _window4BackScn->pitch; + src = (byte *)_window4BackScn->getBasePtr(0, yoffs); xoffs = _rnd.getRandomNumber(dissolveX); dst += xoffs; @@ -296,7 +296,7 @@ void AGOSEngine::vc54_dissolveOut() { uint16 count = dissolveCheck * 2; while (count--) { Graphics::Surface *screen = _system->lockScreen(); - byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; + byte *dstPtr = (byte *)screen->getBasePtr(x, y); color |= dstPtr[0] & 0xF0; yoffs = _rnd.getRandomNumber(dissolveY); @@ -378,7 +378,7 @@ void AGOSEngine::fullFade() { void AGOSEngine::vc56_fullScreen() { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels; + byte *dst = (byte *)screen->getBasePtr(0, 0); byte *src = _curVgaFile2 + 800; for (int i = 0; i < _screenHeight; i++) { diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index 1e7b2ba060..dc364cd99b 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -155,7 +155,7 @@ void AGOSEngine::vc48_specialEffect() { if (getPlatform() == Common::kPlatformDOS) { if (num == 1) { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels; + byte *dst = (byte *)screen->getBasePtr(0, 0); for (uint h = 0; h < _screenHeight; h++) { for (uint w = 0; w < _screenWidth; w++) { @@ -205,7 +205,7 @@ void AGOSEngine_PN::clearVideoWindow(uint16 num, uint16 color) { uint16 yoffs = vlut[1]; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + xoffs + yoffs * screen->pitch; + byte *dst = (byte *)screen->getBasePtr(xoffs, yoffs); for (uint h = 0; h < vlut[3]; h++) { memset(dst, color, vlut[2] * 16); dst += screen->pitch; diff --git a/engines/agos/vga_s2.cpp b/engines/agos/vga_s2.cpp index 9b9ed4e297..e0780b491a 100644 --- a/engines/agos/vga_s2.cpp +++ b/engines/agos/vga_s2.cpp @@ -213,7 +213,10 @@ void AGOSEngine_Simon2::clearVideoWindow(uint16 num, uint16 color) { uint16 xoffs = vlut[0] * 16; uint16 yoffs = vlut[1]; uint16 dstWidth = _videoWindows[18] * 16; - byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; + // TODO: Is there any known connection between dstWidth and the pitch + // of the _window4BackScn Surface? If so, we might be able to pass + // yoffs as proper y parameter to getBasePtr. + byte *dst = (byte *)_window4BackScn->getBasePtr(xoffs, 0) + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp index c74f0cf52b..f0e081182e 100644 --- a/engines/agos/vga_ww.cpp +++ b/engines/agos/vga_ww.cpp @@ -143,7 +143,7 @@ void AGOSEngine::vc61() { uint h, tmp; Graphics::Surface *screen = _system->lockScreen(); - dstPtr = (byte *)screen->pixels; + dstPtr = (byte *)screen->getBasePtr(0, 0); if (a == 6) { src = _curVgaFile2 + 800; diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp index 0365c736d8..95dbabf0fd 100644 --- a/engines/agos/window.cpp +++ b/engines/agos/window.cpp @@ -170,7 +170,7 @@ void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, u _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * screen->pitch + x; + byte *dst = (byte *)screen->getBasePtr(x, y); uint8 color = window->fillColor; if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) @@ -232,7 +232,7 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) { uint i; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels; + dst = (byte *)screen->getBasePtr(0, 0); src = getBackGround(); dst += y * screen->pitch; -- cgit v1.2.3 From 1f0832b4f2ebb9abf798ea5c31ea16275e316d11 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:16:36 +0200 Subject: CGE: Prefer getBasePtr over direct Surface::pixels access. --- engines/cge/cge_main.cpp | 2 +- engines/cge/vga13h.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index f4f1cd3e0b..c6c7acd1f5 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -358,7 +358,7 @@ void CGEEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &he // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface *s = _vga->_page[0]; - ::createThumbnail(thumb, (const byte *)s->pixels, kScrWidth, kScrHeight, thumbPalette); + ::createThumbnail(thumb, (const byte *)s->getBasePtr(0, 0), kScrWidth, kScrHeight, thumbPalette); Graphics::saveThumbnail(*out, *thumb); thumb->free(); delete thumb; diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 56a0754527..ddcbcea47c 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -845,7 +845,7 @@ void Bitmap::xShow(int16 x, int16 y) { debugC(4, kCGEDebugBitmap, "Bitmap::xShow(%d, %d)", x, y); const byte *srcP = (const byte *)_v; - byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight); + byte *destEndP = (byte *)_vm->_vga->_page[1]->getBasePtr(0, kScrHeight); byte *lookupTable = _m; // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a @@ -898,7 +898,7 @@ void Bitmap::show(int16 x, int16 y) { debugC(5, kCGEDebugBitmap, "Bitmap::show(%d, %d)", x, y); const byte *srcP = (const byte *)_v; - byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight); + byte *destEndP = (byte *)_vm->_vga->_page[1]->getBasePtr(0, kScrHeight); // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data -- cgit v1.2.3 From 2fdebe41b545a814b4eac83f24497ae194f255c6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:22:48 +0200 Subject: COMPOSER: Prefer getBasePtr over direct Surface::pixels access. --- engines/composer/graphics.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp index 2b68fac233..a751da20a3 100644 --- a/engines/composer/graphics.cpp +++ b/engines/composer/graphics.cpp @@ -39,7 +39,7 @@ bool Sprite::contains(const Common::Point &pos) const { return false; if (adjustedPos.y < 0 || adjustedPos.y >= _surface.h) return false; - byte *pixels = (byte *)_surface.pixels; + const byte *pixels = (const byte *)_surface.getBasePtr(0, 0); return (pixels[(_surface.h - adjustedPos.y - 1) * _surface.w + adjustedPos.x] != 0); } @@ -541,7 +541,7 @@ void ComposerEngine::redraw() { for (uint i = 0; i < _dirtyRects.size(); i++) { const Common::Rect &rect = _dirtyRects[i]; - byte *pixels = (byte *)_screen.pixels + (rect.top * _screen.pitch) + rect.left; + byte *pixels = (byte *)_screen.getBasePtr(rect.left, rect.top); _system->copyRectToScreen(pixels, _screen.pitch, rect.left, rect.top, rect.width(), rect.height()); } _system->updateScreen(); @@ -794,7 +794,7 @@ bool ComposerEngine::initSprite(Sprite &sprite) { if (width > 0 && height > 0) { sprite._surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - decompressBitmap(type, stream, (byte *)sprite._surface.pixels, size, width, height); + decompressBitmap(type, stream, (byte *)sprite._surface.getBasePtr(0, 0), size, width, height); } else { // there are some sprites (e.g. a -998x-998 one in Gregory's title screen) // which have an invalid size, but the original engine doesn't notice for @@ -814,13 +814,13 @@ void ComposerEngine::drawSprite(const Sprite &sprite) { int y = sprite._pos.y; // incoming data is BMP-style (bottom-up), so flip it - byte *pixels = (byte *)_screen.pixels; + byte *pixels = (byte *)_screen.getBasePtr(0, 0); for (int j = 0; j < sprite._surface.h; j++) { if (j + y < 0) continue; if (j + y >= _screen.h) break; - byte *in = (byte *)sprite._surface.pixels + (sprite._surface.h - j - 1) * sprite._surface.w; + const byte *in = (const byte *)sprite._surface.getBasePtr(0, sprite._surface.h - j - 1); byte *out = pixels + ((j + y) * _screen.w) + x; for (int i = 0; i < sprite._surface.w; i++) if ((x + i >= 0) && (x + i < _screen.w) && in[i]) -- cgit v1.2.3 From 2131d2d2f5a2142bd537cf853a6d9b9cd867357c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:25:29 +0200 Subject: DRASCULA: Prefer getBasePtr over direct Surface::pixels access. --- engines/drascula/graphics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 3bdf724670..aa13192b25 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -132,7 +132,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra byte *prevFrame = (byte *)malloc(64000); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->pixels; + byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); uint16 screenPitch = screenSurf->pitch; for (int y = 0; y < 200; y++) { memcpy(prevFrame+y*320, screenBuffer+y*screenPitch, 320); @@ -449,7 +449,7 @@ void DrasculaEngine::screenSaver() { int x1_, y1_, off1, off2; Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->pixels; + byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); uint16 screenPitch = screenSurf->pitch; for (int i = 0; i < 200; i++) { for (int j = 0; j < 320; j++) { @@ -538,7 +538,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) { waitFrameSSN(); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->pixels; + byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); uint16 screenPitch = screenSurf->pitch; if (FrameSSN) mixVideo(screenBuffer, screenSurface, screenPitch); @@ -557,7 +557,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) { free(BufferSSN); waitFrameSSN(); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->pixels; + byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); uint16 screenPitch = screenSurf->pitch; if (FrameSSN) mixVideo(screenBuffer, screenSurface, screenPitch); -- cgit v1.2.3 From 690d55d763ed0c771dde7ff025fbe0c9f3d26228 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:32:31 +0200 Subject: GOB: Prefer getBasePtr over direct Surface::pixels access. --- engines/gob/surface.cpp | 2 +- engines/gob/videoplayer.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 839378a412..0090045b45 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -821,7 +821,7 @@ bool Surface::loadIFF(Common::SeekableReadStream &stream) { return false; resize(decoder.getSurface()->w, decoder.getSurface()->h); - memcpy(_vidMem, decoder.getSurface()->pixels, decoder.getSurface()->w * decoder.getSurface()->h); + memcpy(_vidMem, decoder.getSurface()->getBasePtr(0, 0), decoder.getSurface()->w * decoder.getSurface()->h); return true; } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index a478492ccc..8d37c59a85 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -734,7 +734,11 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest, if (!surface) return false; - Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)surface->pixels); + // FIXME? This currently casts away const from the pixel data. However, it + // is only used read-only in this case (as far as I can tell). Not casting + // the const qualifier away will lead to an additional allocation and copy + // of the frame data which is undesirable. + Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast(surface->getBasePtr(0, 0))); dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp); return true; -- cgit v1.2.3 From 8b763977a38b366e0360a7fef861bd53f6aa6299 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:37:51 +0200 Subject: HOPKINS: Prefer getBasePtr over direct Surface::pixels access. --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/graphics.cpp | 4 ++-- engines/hopkins/saveload.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index ab672d4c48..32b8cd8256 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -691,7 +691,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) { Graphics::Surface thumb8; _vm->_saveLoad->convertThumb16To8(header._thumbnail, &thumb8); - byte *thumb = (byte *)thumb8.pixels; + byte *thumb = (byte *)thumb8.getBasePtr(0, 0); int16 startPosX_ = _vm->_events->_startPos.x; switch (slotNumber) { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b83371d65f..7fe9943dbb 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -325,7 +325,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte // Copy out the dimensions and pixels of the decoded surface _largeScreenFl = s->w > SCREEN_WIDTH; - Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); + Common::copy((const byte *)s->getBasePtr(0, 0), (const byte *)s->getBasePtr(0, s->h), surface); // Copy out the palette const byte *palSrc = pcxDecoder.getPalette(); @@ -1202,7 +1202,7 @@ void GraphicsManager::displayZones() { void GraphicsManager::displayLines() { Graphics::Surface *screenSurface = g_system->lockScreen(); - uint16* pixels = (uint16*)screenSurface->pixels; + uint16 *pixels = (uint16 *)screenSurface->getBasePtr(0, 0); for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { int i = 0; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index c514df6943..3a1f596c52 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -233,14 +233,14 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { Graphics::Surface thumb8; thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.pixels, + _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.getBasePtr(0, 0), _vm->_events->_startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); // Convert the 8-bit pixel to 16 bit surface s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - const byte *srcP = (const byte *)thumb8.pixels; - uint16 *destP = (uint16 *)s->pixels; + const byte *srcP = (const byte *)thumb8.getBasePtr(0, 0); + uint16 *destP = (uint16 *)s->getBasePtr(0, 0); for (int yp = 0; yp < h; ++yp) { // Copy over the line, using the source pixels as lookups into the pixels palette @@ -299,8 +299,8 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]); } - const uint16 *srcP = (const uint16 *)thumb16->pixels; - byte *destP = (byte *)thumb8->pixels; + const uint16 *srcP = (const uint16 *)thumb16->getBasePtr(0, 0); + byte *destP = (byte *)thumb8->getBasePtr(0, 0); for (int yp = 0; yp < thumb16->h; ++yp) { const uint16 *lineSrcP = srcP; -- cgit v1.2.3 From 578715b6f69bcd846e31ae4f207c759ee05022c8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:42:16 +0200 Subject: HUGO: Prefer getBasePtr over direct Surface::pixels access. --- engines/hugo/dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index 0f07d52aee..0fc4c87683 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -140,8 +140,8 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { _arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat()); _arrayBmp[i * 2 + 1] = new Graphics::Surface(); _arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat()); - byte *src = (byte *)_arrayBmp[i * 2]->pixels; - byte *dst = (byte *)_arrayBmp[i * 2 + 1]->pixels; + byte *src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, 0); + byte *dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, 0); for (int j = 0; j < _arrayBmp[i * 2]->h; j++) { src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j); -- cgit v1.2.3 From 786ad6cea0caa076b1af56eb2bb6d85075e6bfd0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:44:26 +0200 Subject: LASTEXPRESS: Prefer getBasePtr over direct Surface::pixels access. --- engines/lastexpress/data/animation.cpp | 2 +- engines/lastexpress/data/sequence.cpp | 4 ++-- engines/lastexpress/graphics.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index 7618259e69..e9500aec38 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -270,7 +270,7 @@ void Animation::play() { draw(s); // XXX: Update the screen - g_system->copyRectToScreen(s->pixels, s->pitch, 0, 0, s->w, s->h); + g_system->copyRectToScreen(s->getBasePtr(0, 0), s->pitch, 0, 0, s->w, s->h); // Free the temporary surface s->free(); diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp index a5bcba84cd..d58ff32047 100644 --- a/engines/lastexpress/data/sequence.cpp +++ b/engines/lastexpress/data/sequence.cpp @@ -128,8 +128,8 @@ AnimFrame::~AnimFrame() { } Common::Rect AnimFrame::draw(Graphics::Surface *s) { - byte *inp = (byte *)_image.pixels; - uint16 *outp = (uint16 *)s->pixels; + byte *inp = (byte *)_image.getBasePtr(0, 0); + uint16 *outp = (uint16 *)s->getBasePtr(0, 0); for (int i = 0; i < 640 * 480; i++, inp++, outp++) { if (*inp) *outp = _palette[*inp]; diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp index 753c3a39e4..4934c4f519 100644 --- a/engines/lastexpress/graphics.cpp +++ b/engines/lastexpress/graphics.cpp @@ -131,11 +131,11 @@ void GraphicsManager::mergePlanes() { // Clear screen surface _screen.fillRect(Common::Rect(640, 480), 0); - uint16 *screen = (uint16 *)_screen.pixels; - uint16 *inventory = (uint16 *)_inventory.pixels; - uint16 *overlay = (uint16 *)_overlay.pixels; - uint16 *backgroundC = (uint16 *)_backgroundC.pixels; - uint16 *backgroundA = (uint16 *)_backgroundA.pixels; + uint16 *screen = (uint16 *)_screen.getBasePtr(0, 0); + uint16 *inventory = (uint16 *)_inventory.getBasePtr(0, 0); + uint16 *overlay = (uint16 *)_overlay.getBasePtr(0, 0); + uint16 *backgroundC = (uint16 *)_backgroundC.getBasePtr(0, 0); + uint16 *backgroundA = (uint16 *)_backgroundA.getBasePtr(0, 0); for (int i = 0; i < 640 * 480; i++) { -- cgit v1.2.3 From 8f73027d8273b482386d8c114674876b11069957 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:47:42 +0200 Subject: MADE: Prefer getBasePtr over direct Surface::pixels access. --- engines/made/pmvplayer.cpp | 2 +- engines/made/screen.cpp | 8 ++++---- engines/made/scriptfuncs.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index cf450f7e25..9e4354d6a3 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -248,7 +248,7 @@ void PmvPlayer::handleEvents() { } void PmvPlayer::updateScreen() { - _vm->_system->copyRectToScreen(_surface->pixels, _surface->pitch, + _vm->_system->copyRectToScreen(_surface->getBasePtr(0, 0), _surface->pitch, (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h); _vm->_system->updateScreen(); } diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index ea7d57f82d..737b009565 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -344,12 +344,12 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask void Screen::updateSprites() { // TODO: This needs some more work, dirty rectangles are currently not used - memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); + memcpy(_workScreen->getBasePtr(0, 0), _backgroundScreen->getBasePtr(0, 0), 64000); drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); drawSpriteChannels(_workScreenDrawCtx, 1, 2); - _vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); + _vm->_system->copyRectToScreen(_workScreen->getBasePtr(0, 0), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); _vm->_screen->updateScreenAndWait(10); } @@ -593,7 +593,7 @@ void Screen::show() { return; drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); - memcpy(_workScreen->pixels, _backgroundScreen->pixels, 64000); + memcpy(_workScreen->getBasePtr(0, 0), _backgroundScreen->getBasePtr(0, 0), 64000); drawSpriteChannels(_workScreenDrawCtx, 1, 2); _fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount); @@ -775,7 +775,7 @@ void Screen::unlockScreen() { } void Screen::showWorkScreen() { - _vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); + _vm->_system->copyRectToScreen(_workScreen->getBasePtr(0, 0), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); } void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index c57778fb71..9a43bc44d2 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -574,7 +574,7 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) { PictureResource *flex = _vm->_res->getPicture(argv[2]); if (flex) { Graphics::Surface *surf = flex->getPicture(); - CursorMan.replaceCursor(surf->pixels, surf->w, surf->h, argv[1], argv[0], 0); + CursorMan.replaceCursor(surf->getBasePtr(0, 0), surf->w, surf->h, argv[1], argv[0], 0); _vm->_res->freeResource(flex); } return 0; -- cgit v1.2.3 From 6eb9c8da9e37e9afcb2c6d378c30d8ea88c0b8de Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:58:11 +0200 Subject: MOHAWK: Prefer getBasePtr over direct Surface::pixels access. --- engines/mohawk/bitmap.cpp | 10 +++++----- engines/mohawk/cursors.cpp | 4 ++-- engines/mohawk/riven_graphics.cpp | 8 ++++---- engines/mohawk/video.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index bc19fe2d3e..d16a41698b 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -580,7 +580,7 @@ void MohawkBitmap::drawRaw(Graphics::Surface *surface) { _data->skip(_header.bytesPerRow - _header.width * 3); } else { - _data->read((byte *)surface->pixels + y * _header.width, _header.width); + _data->read((byte *)surface->getBasePtr(0, y), _header.width); _data->skip(_header.bytesPerRow - _header.width); } } @@ -599,7 +599,7 @@ void MohawkBitmap::drawRLE8(Graphics::Surface *surface, bool isLE) { for (uint16 i = 0; i < _header.height; i++) { uint16 rowByteCount = isLE ? _data->readUint16LE() : _data->readUint16BE(); int32 startPos = _data->pos(); - byte *dst = (byte *)surface->pixels + i * _header.width; + byte *dst = (byte *)surface->getBasePtr(0, i); int16 remaining = _header.width; while (remaining > 0) { @@ -779,7 +779,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) { } Graphics::Surface *surface = createSurface(_header.width, _header.height); - memset(surface->pixels, 0, _header.width * _header.height); + memset(surface->getBasePtr(0, 0), 0, _header.width * _header.height); // Expand the <8bpp data to one byte per pixel switch (getBitsPerPixel()) { @@ -801,7 +801,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) { void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) { assert(surface->format.bytesPerPixel == 1); - byte *dst = (byte *)surface->pixels; + byte *dst = (byte *)surface->getBasePtr(0, 0); // Expand the 8 pixels in a byte into a full byte per pixel @@ -830,7 +830,7 @@ void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableRead // Note that the image is in EGA planar form and not just standard 4bpp // This seems to contradict the PoP specs which seem to do something else - byte *dst = (byte *)surface->pixels; + byte *dst = (byte *)surface->getBasePtr(0, 0); for (uint32 i = 0; i < surface->h; i++) { uint x = 0; diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index c7bd03678f..7cef566e13 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -121,11 +121,11 @@ void MystCursorManager::setCursor(uint16 id) { // Myst ME stores some cursors as 24bpp images instead of 8bpp if (surface->format.bytesPerPixel == 1) { - CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0); + CursorMan.replaceCursor(surface->getBasePtr(0, 0), surface->w, surface->h, hotspotX, hotspotY, 0); CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256); } else { Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); + CursorMan.replaceCursor(surface->getBasePtr(0, 0), surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); } _vm->_needsUpdate = true; diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp index 05e66a3924..35474aebe2 100644 --- a/engines/mohawk/riven_graphics.cpp +++ b/engines/mohawk/riven_graphics.cpp @@ -255,7 +255,7 @@ void RivenGraphics::runScheduledTransition() { } // For now, just copy the image to screen without doing any transition. - _vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); + _vm->_system->copyRectToScreen(_mainScreen->getBasePtr(0, 0), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); _scheduledTransition = -1; // Clear scheduled transition @@ -345,7 +345,7 @@ void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) { mhkSurface->convertToTrueColor(); Graphics::Surface *surface = mhkSurface->getSurface(); - _vm->_system->copyRectToScreen(surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h); + _vm->_system->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, rect->left, rect->top, surface->w, surface->h); delete mhkSurface; } @@ -420,7 +420,7 @@ void RivenGraphics::updateCredits() { } else { // Otheriwse, we're scrolling // Move the screen up one row - memmove(_mainScreen->pixels, _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); + memmove(_mainScreen->getBasePtr(0, 0), _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); // Only update as long as we're not before the last frame // Otherwise, we're just moving up a row (which we already did) @@ -437,7 +437,7 @@ void RivenGraphics::updateCredits() { } // Now flush the new screen - _vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); + _vm->_system->copyRectToScreen(_mainScreen->getBasePtr(0, 0), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); } } diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index 8b0130d711..b580a56577 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -245,7 +245,7 @@ bool VideoManager::updateMovies() { // Clip the width/height to make sure we stay on the screen (Myst does this a few times) uint16 width = MIN(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x); uint16 height = MIN(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y); - _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height); // We've drawn something to the screen, make sure we update it updateScreen = true; -- cgit v1.2.3 From 82b96d33ad4f6ca623aa84df3e14a95e5cc2a091 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:00:35 +0200 Subject: NEVERHOOD: Prefer getBasePtr over direct Surface::pixels access. --- engines/neverhood/mouse.cpp | 2 +- engines/neverhood/resource.cpp | 6 +++--- engines/neverhood/screen.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/neverhood/mouse.cpp b/engines/neverhood/mouse.cpp index 13fba41e92..0d7ebb59dc 100644 --- a/engines/neverhood/mouse.cpp +++ b/engines/neverhood/mouse.cpp @@ -183,7 +183,7 @@ void Mouse::updateCursor() { _drawOffset = _mouseCursorResource.getRect(); _surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2); Graphics::Surface *cursorSurface = _surface->getSurface(); - CursorMan.replaceCursor((const byte*)cursorSurface->pixels, + CursorMan.replaceCursor((const byte*)cursorSurface->getBasePtr(0, 0), cursorSurface->w, cursorSurface->h, -_drawOffset.x, -_drawOffset.y, 0); } diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index 5f7aea86f4..745f567ead 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -39,7 +39,7 @@ SpriteResource::~SpriteResource() { void SpriteResource::draw(Graphics::Surface *destSurface, bool flipX, bool flipY) { if (_pixels) { - byte *dest = (byte*)destSurface->pixels; + byte *dest = (byte*)destSurface->getBasePtr(0, 0); const int destPitch = destSurface->pitch; if (_rle) unpackSpriteRle(_pixels, _dimensions.width, _dimensions.height, dest, destPitch, flipX, flipY); @@ -116,7 +116,7 @@ AnimResource::~AnimResource() { void AnimResource::draw(uint frameIndex, Graphics::Surface *destSurface, bool flipX, bool flipY) { const AnimFrameInfo frameInfo = _frames[frameIndex]; - byte *dest = (byte*)destSurface->pixels; + byte *dest = (byte*)destSurface->getBasePtr(0, 0); const int destPitch = destSurface->pitch; _currSpriteData = _spriteData + frameInfo.spriteDataOffs; _width = frameInfo.drawOffset.width; @@ -298,7 +298,7 @@ void MouseCursorResource::draw(int frameNum, Graphics::Surface *destSurface) { const int sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment const int destPitch = destSurface->pitch; const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; - byte *dest = (byte*)destSurface->pixels; + byte *dest = (byte*)destSurface->getBasePtr(0, 0); for (int16 yc = 0; yc < 32; yc++) { memcpy(dest, source, 32); source += sourcePitch; diff --git a/engines/neverhood/screen.cpp b/engines/neverhood/screen.cpp index 4a5bfb92ce..17fb79ab0d 100644 --- a/engines/neverhood/screen.cpp +++ b/engines/neverhood/screen.cpp @@ -54,7 +54,7 @@ void Screen::update() { if (_fullRefresh) { // NOTE When playing a fullscreen/doubled Smacker video usually a full screen refresh is needed - _vm->_system->copyRectToScreen((const byte*)_backScreen->pixels, _backScreen->pitch, 0, 0, 640, 480); + _vm->_system->copyRectToScreen((const byte*)_backScreen->getBasePtr(0, 0), _backScreen->pitch, 0, 0, 640, 480); _fullRefresh = false; return; } @@ -174,7 +174,7 @@ void Screen::updatePalette() { } void Screen::clear() { - memset(_backScreen->pixels, 0, _backScreen->pitch * _backScreen->h); + memset(_backScreen->getBasePtr(0, 0), 0, _backScreen->pitch * _backScreen->h); _fullRefresh = true; clearRenderQueue(); } -- cgit v1.2.3 From 2117feaeec980b06b996ad6d154e12761fcc9d5b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:06:19 +0200 Subject: MORTEVIELLE: Prefer getBasePtr over direct Surface::pixels access. --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/saveload.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index c066114e8d..535dd6ddaa 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1067,7 +1067,7 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { assert((pt.x >= 0) && (pt.y >= 0) && (pt.x <= SCREEN_WIDTH) && (pt.y <= SCREEN_ORIG_HEIGHT)); Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); - byte *destP = (byte *)destSurface.pixels; + byte *destP = (byte *)destSurface.getBasePtr(0, 0); *destP = palIndex; *(destP + SCREEN_WIDTH) = palIndex; } diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index 77c242c9e7..d46383a6fc 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -189,7 +189,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); - ::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); + ::createThumbnail(thumb, (const byte *)s.getBasePtr(0, 0), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); thumb->free(); delete thumb; -- cgit v1.2.3 From d82741a3c8b64fc0b167548f65b53181b67959fb Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:17:40 +0200 Subject: PARALLACTION: Prefer getBasePtr over direct Surface::pixels access. --- engines/parallaction/disk_br.cpp | 8 ++++---- engines/parallaction/disk_ns.cpp | 6 +++--- engines/parallaction/graphics.cpp | 18 +++++++++--------- engines/parallaction/input.cpp | 2 +- engines/parallaction/inventory.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 3135c3e8c5..dfb8bded87 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -225,7 +225,7 @@ void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surfac } surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - stream.read(surf.pixels, width * height); + stream.read(surf.getBasePtr(0, 0), width * height); } Frames* DosDisk_br::loadPointer(const char *name) { @@ -449,7 +449,7 @@ void AmigaDisk_br::init() { void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) { uint size = surf.w * surf.h; - byte *data = (byte *)surf.pixels; + byte *data = (byte *)surf.getBasePtr(0, 0); for (uint i = 0; i < size; i++, data++) { if (transparentColor == -1 || transparentColor != *data) *data += 16; @@ -552,7 +552,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name, uint32 w, uint32 h) { MaskBuffer *buffer = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing buffer->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(buffer->data, decoder.getSurface()->pixels, buffer->size); + memcpy(buffer->data, decoder.getSurface()->getBasePtr(0, 0), buffer->size); buffer->bigEndian = true; finalpass(buffer->data, buffer->size); return buffer; @@ -612,7 +612,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { stream->read(shadow, shadowSize); for (int32 i = 0; i < surf->h; ++i) { byte *src = shadow + shadowWidth * i; - byte *dst = (byte *)surf->pixels + surf->pitch * i; + byte *dst = (byte *)surf->getBasePtr(0, 0) + surf->pitch * i; for (int32 j = 0; j < surf->w; ++j, ++dst) { byte bit = src[j/8] & (1 << (7 - (j & 7))); diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 4c4893ec61..45f7100f80 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -482,7 +482,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) { // read bitmap, mask and path data and extract them into the 3 buffers info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8()); createMaskAndPathBuffers(info); - unpackBackground(stream, (byte *)info.bg.pixels, info._mask->data, info._path->data); + unpackBackground(stream, (byte *)info.bg.getBasePtr(0, 0), info._mask->data, info._path->data); delete stream; } @@ -976,7 +976,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo& info, const char *name) { info._mask = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing info._mask->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(info._mask->data, decoder.getSurface()->pixels, info._mask->size); + memcpy(info._mask->data, decoder.getSurface()->getBasePtr(0, 0), info._mask->size); info._mask->bigEndian = true; } @@ -998,7 +998,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo& info, const char *name) { info._path = new PathBuffer; // surface width was shrunk to 1/8th of the bitmap width due to the pixel packing info._path->create(decoder.getSurface()->w * 8, decoder.getSurface()->h); - memcpy(info._path->data, decoder.getSurface()->pixels, info._path->size); + memcpy(info._path->data, decoder.getSurface()->getBasePtr(0, 0), info._path->size); info._path->bigEndian = true; } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index b8a8ceb61f..0aaf78ec13 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -332,7 +332,7 @@ void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int void Gfx::clearScreen() { if (_doubleBuffering) { - if (_backBuffer.pixels) { + if (_backBuffer.getBasePtr(0, 0)) { Common::Rect r(_backBuffer.w, _backBuffer.h); _backBuffer.fillRect(r, 0); } @@ -419,7 +419,7 @@ void Gfx::updateScreen() { // is needed _overlayMode = false; - bool skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing + bool skipBackground = (_backgroundInfo->bg.getBasePtr(0, 0) == 0); // don't render frame if background is missing if (!skipBackground) { // background may not cover the whole screen, so adjust bulk update size @@ -450,7 +450,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) { return; } - byte *buf = (byte *)surf.pixels; + byte *buf = (byte *)surf.getBasePtr(0, 0); for (int i = 0; i < surf.w*surf.h; i++) { *buf++ |= 0x20; } @@ -493,7 +493,7 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) r.moveTo(x, y); uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND; - blt(r, (byte *)surf.pixels, &_backgroundInfo->bg, z, 100, 0); + blt(r, (byte *)surf.getBasePtr(0, 0), &_backgroundInfo->bg, z, 100, 0); } void Gfx::fillBackground(const Common::Rect& r, byte color) { @@ -536,12 +536,12 @@ GfxObj *Gfx::renderFloatingLabel(Font *font, char *text) { setupLabelSurface(*cnv, w, h); font->setColor((_gameType == GType_BRA) ? 0 : 7); - font->drawString((byte *)cnv->pixels + 1, cnv->w, text); - font->drawString((byte *)cnv->pixels + 1 + cnv->w * 2, cnv->w, text); - font->drawString((byte *)cnv->pixels + cnv->w, cnv->w, text); - font->drawString((byte *)cnv->pixels + 2 + cnv->w, cnv->w, text); + font->drawString((byte *)cnv->getBasePtr(1, 0), cnv->w, text); + font->drawString((byte *)cnv->getBasePtr(1, 2), cnv->w, text); + font->drawString((byte *)cnv->getBasePtr(0, 1), cnv->w, text); + font->drawString((byte *)cnv->getBasePtr(2, 1), cnv->w, text); font->setColor((_gameType == GType_BRA) ? 11 : 1); - font->drawString((byte *)cnv->pixels + 1 + cnv->w, cnv->w, text); + font->drawString((byte *)cnv->getBasePtr(1, 1), cnv->w, text); } else { w = font->getStringWidth(text); h = font->height(); diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index bf7cdc439d..df7275aacc 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -499,7 +499,7 @@ void Input::initCursors() { // TODO: scale mouse cursor (see staticres.cpp) Graphics::Surface *surf2 = new Graphics::Surface; surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8()); - memcpy(surf2->pixels, _resMouseArrow_BR_Amiga, 32*16); + memcpy(surf2->getBasePtr(0, 0), _resMouseArrow_BR_Amiga, 32*16); _mouseArrow = new SurfaceToFrames(surf2); } break; diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index a3b7bf953f..418d1f7229 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -108,7 +108,7 @@ public: void highlightItem(ItemPosition pos, byte color); void drawItem(ItemName name, byte *buffer, uint pitch); - byte* getData() const { return (byte *)_surf.pixels; } + byte *getData() { return (byte *)_surf.getBasePtr(0, 0); } void getRect(Common::Rect &r) const; int16 getNumLines() const; -- cgit v1.2.3 From e59995b0b26c06a92a4ae3a78dd069e75010e74b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:30:23 +0200 Subject: PEGASUS: Prefer getBasePtr over direct Surface::pixels access. --- engines/pegasus/cursor.cpp | 6 +++--- engines/pegasus/graphics.cpp | 2 +- engines/pegasus/neighborhood/caldoria/caldoria.cpp | 4 ++-- engines/pegasus/pegasus.cpp | 10 +++++----- engines/pegasus/transition.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp index 897d31d7bd..dcf6749620 100644 --- a/engines/pegasus/cursor.cpp +++ b/engines/pegasus/cursor.cpp @@ -85,9 +85,9 @@ void Cursor::setCurrentFrameIndex(int32 index) { if (_info[index].surface->format.bytesPerPixel == 1) { CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount); - CursorMan.replaceCursor(_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0); + CursorMan.replaceCursor(_info[index].surface->getBasePtr(0, 0), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0); } else { - CursorMan.replaceCursor(_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format); + CursorMan.replaceCursor(_info[index].surface->getBasePtr(0, 0), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format); } ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty(); @@ -203,7 +203,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) { // PixMap data if (pixMap.pixelSize == 8) { cursorInfo.surface->create(pixMap.rowBytes, pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8()); - cicnStream->read(cursorInfo.surface->pixels, pixMap.rowBytes * pixMap.bounds.height()); + cicnStream->read(cursorInfo.surface->getBasePtr(0, 0), pixMap.rowBytes * pixMap.bounds.height()); // While this looks sensible, it actually doesn't work for some cursors // (ie. the 'can grab' hand) diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp index 8dbd678809..ee7e7bd9cc 100644 --- a/engines/pegasus/graphics.cpp +++ b/engines/pegasus/graphics.cpp @@ -318,7 +318,7 @@ void GraphicsManager::shakeTheWorld(TimeValue duration, TimeScale scale) { } if (lastOffset.x != 0 || lastOffset.y != 0) { - g_system->copyRectToScreen((byte *)oldScreen.pixels, oldScreen.pitch, 0, 0, 640, 480); + g_system->copyRectToScreen((byte *)oldScreen.getBasePtr(0, 0), oldScreen.pitch, 0, 0, 640, 480); g_system->updateScreen(); } diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index 9a378a6728..76954afa2b 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -200,7 +200,7 @@ void Caldoria::start() { const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); assert(frame); assert(frame->format == g_system->getScreenFormat()); - g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h); + g_system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 64, 112, frame->w, frame->h); _vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond); bool saveAllowed = _vm->swapSaveAllowed(false); @@ -216,7 +216,7 @@ void Caldoria::start() { frame = pullbackMovie->decodeNextFrame(); if (frame) { - g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h); + g_system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 64, 112, frame->w, frame->h); g_system->updateScreen(); } } diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 463e81e52e..83abe4a894 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -313,7 +313,7 @@ void PegasusEngine::runIntro() { const Graphics::Surface *frame = video->decodeNextFrame(); if (frame) { - _system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); + _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 0, 0, frame->w, frame->h); _system->updateScreen(); } } @@ -1367,7 +1367,7 @@ bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 if (frame->w <= 320 && frame->h <= 240) { drawScaledFrame(frame, x, y); } else { - _system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); + _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); _system->updateScreen(); } } @@ -2270,11 +2270,11 @@ void PegasusEngine::drawScaledFrame(const Graphics::Surface *frame, uint16 x, ui scaledFrame.create(frame->w * 2, frame->h * 2, frame->format); if (frame->format.bytesPerPixel == 2) - scaleFrame((uint16 *)frame->pixels, (uint16 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch); + scaleFrame((const uint16 *)frame->getBasePtr(0, 0), (uint16 *)scaledFrame.getBasePtr(0, 0), frame->w, frame->h, frame->pitch); else - scaleFrame((uint32 *)frame->pixels, (uint32 *)scaledFrame.pixels, frame->w, frame->h, frame->pitch); + scaleFrame((const uint32 *)frame->getBasePtr(0, 0), (uint32 *)scaledFrame.getBasePtr(0, 0), frame->w, frame->h, frame->pitch); - _system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _system->copyRectToScreen((byte *)scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); _system->updateScreen(); scaledFrame.free(); } diff --git a/engines/pegasus/transition.cpp b/engines/pegasus/transition.cpp index 1ae212df85..37ea38147e 100644 --- a/engines/pegasus/transition.cpp +++ b/engines/pegasus/transition.cpp @@ -70,7 +70,7 @@ void ScreenFader::setFaderValue(const int32 value) { if (value != getFaderValue()) { Fader::setFaderValue(value); - if (_screen->pixels) { + if (_screen->getBasePtr(0, 0)) { // The original game does a gamma fade here using the Mac API. In order to do // that, it would require an immense amount of CPU processing. This does a // linear fade instead, which looks fairly well, IMO. -- cgit v1.2.3 From 8617edea04cfb2439de54d3ce4e64f92e5bd0416 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:33:42 +0200 Subject: SAGA: Prefer getBasePtr over direct Surface::pixels access. --- engines/saga/animation.cpp | 2 +- engines/saga/gfx.h | 2 +- engines/saga/introproc_ihnm.cpp | 8 ++++---- engines/saga/introproc_saga2.cpp | 2 +- engines/saga/scene.cpp | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index a99bd66e5e..85f2579138 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -501,7 +501,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { } anim = getAnimation(animId); - displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->pixels; + displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0); if (playing) { anim->state = ANIM_PLAYING; diff --git a/engines/saga/gfx.h b/engines/saga/gfx.h index c677b76324..f3c871e55d 100644 --- a/engines/saga/gfx.h +++ b/engines/saga/gfx.h @@ -201,7 +201,7 @@ public: // Whenever it gets called, the corresponding caller must take care // to add the corresponding dirty rectangle itself byte *getBackBufferPixels() { - return (byte *)_backBuffer.pixels; + return (byte *)_backBuffer.getBasePtr(0, 0); } uint16 getBackBufferWidth() { diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index 6015e6757a..c21652da7c 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -212,7 +212,7 @@ bool Scene::playTitle(int title, int time, int mode) { break; case 2: // display background - _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, + _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); phase++; startTime = curTime; @@ -247,7 +247,7 @@ bool Scene::playTitle(int title, int time, int mode) { frameTime = curTime; - _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, + _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); } @@ -273,8 +273,8 @@ bool Scene::playTitle(int title, int time, int mode) { _vm->_anim->endVideo(); - memset((byte *)backBufferSurface->pixels, 0, backBufferSurface->w * backBufferSurface->h); - _vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0, + memset((byte *)backBufferSurface->getBasePtr(0, 0), 0, backBufferSurface->w * backBufferSurface->h); + _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); return interrupted; diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp index 260eca98e6..9d8295b6de 100644 --- a/engines/saga/introproc_saga2.cpp +++ b/engines/saga/introproc_saga2.cpp @@ -108,7 +108,7 @@ void Scene::playMovie(const char *filename) { if (smkDecoder->needsUpdate()) { const Graphics::Surface *frame = smkDecoder->decodeNextFrame(); if (frame) { - _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); if (smkDecoder->hasDirtyPalette()) _vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256); diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 75876b1c90..23d3015afd 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -468,7 +468,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy pal = decoder.getPalette(); rect.setWidth(decoder.getSurface()->w); rect.setHeight(decoder.getSurface()->h); - _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->pixels); + _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->getBasePtr(0, 0)); for (int j = 0; j < PAL_ENTRIES; j++) { cPal[j].red = *pal++; cPal[j].green = *pal++; @@ -1120,9 +1120,9 @@ void Scene::draw() { _vm->_render->getBackGroundSurface()->getRect(rect); rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom; if (_vm->_render->isFullRefresh()) - _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels); + _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0)); else - _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels); + _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0)); } } -- cgit v1.2.3 From dd67e9f09939367f19b7ada1c51ca0760b0fda87 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:40:03 +0200 Subject: SCI: Prefer getBasePtr over direct Surface::pixels access. --- engines/sci/engine/kvideo.cpp | 4 ++-- engines/sci/graphics/frameout.cpp | 2 +- engines/sci/graphics/maciconbar.cpp | 6 +++--- engines/sci/graphics/screen.cpp | 4 ++-- engines/sci/video/robot_decoder.cpp | 2 +- engines/sci/video/seq_decoder.cpp | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 9b0cb38f51..5db4f24dcd 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -103,10 +103,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { if (frame) { if (scaleBuffer) { // TODO: Probably should do aspect ratio correction in e.g. GK1 Windows - g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); + g_sci->_gfxScreen->scale2x((const byte *)frame->getBasePtr(0, 0), scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height); } else { - g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height); + g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, width, height); } if (videoDecoder->hasDirtyPalette()) { diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index ca1ef357ae..a835a0e9f0 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -532,7 +532,7 @@ void GfxFrameout::showVideo() { if (videoDecoder->needsUpdate()) { const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); if (frame) { - g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); + g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); if (videoDecoder->hasDirtyPalette()) g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256); diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp index dfb50b0edb..c800c0dd2f 100644 --- a/engines/sci/graphics/maciconbar.cpp +++ b/engines/sci/graphics/maciconbar.cpp @@ -129,7 +129,7 @@ void GfxMacIconBar::drawIcon(uint16 iconIndex, bool selected) { void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) { if (surface) - g_system->copyRectToScreen(surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height()); + g_system->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, rect.left, rect.top, rect.width(), rect.height()); } void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) { @@ -153,7 +153,7 @@ void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common:: *((byte *)newSurf.getBasePtr(j, i)) = 0; } - g_system->copyRectToScreen(newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height()); + g_system->copyRectToScreen(newSurf.getBasePtr(0, 0), newSurf.pitch, rect.left, rect.top, rect.width(), rect.height()); newSurf.free(); } @@ -224,7 +224,7 @@ Graphics::Surface *GfxMacIconBar::createImage(uint32 iconIndex, bool isSelected) } void GfxMacIconBar::remapColors(Graphics::Surface *surf, const byte *palette) { - byte *pixels = (byte *)surf->pixels; + byte *pixels = (byte *)surf->getBasePtr(0, 0); // Remap to the screen palette for (uint16 i = 0; i < surf->w * surf->h; i++) { diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 74503c0c77..d5631bdaf5 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -170,14 +170,14 @@ void GfxScreen::copyToScreen() { void GfxScreen::copyFromScreen(byte *buffer) { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(buffer, screen->pixels, _displayPixels); + memcpy(buffer, screen->getBasePtr(0, 0), _displayPixels); g_system->unlockScreen(); } void GfxScreen::kernelSyncWithFramebuffer() { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(_displayScreen, screen->pixels, _displayPixels); + memcpy(_displayScreen, screen->getBasePtr(0, 0), _displayPixels); g_system->unlockScreen(); } diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp index 0337a8d306..775cd0d74b 100644 --- a/engines/sci/video/robot_decoder.cpp +++ b/engines/sci/video/robot_decoder.cpp @@ -210,7 +210,7 @@ void RobotDecoder::readNextPacket() { // Copy over the decompressed frame byte *inFrame = decompressedFrame; - byte *outFrame = (byte *)surface->pixels; + byte *outFrame = (byte *)surface->getBasePtr(0, 0); // Black out the surface memset(outFrame, 0, surface->w * surface->h); diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp index a7b6346eca..54603ec1f1 100644 --- a/engines/sci/video/seq_decoder.cpp +++ b/engines/sci/video/seq_decoder.cpp @@ -119,7 +119,7 @@ const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() { _fileStream->seek(offset); if (frameType == kSeqFrameFull) { - byte *dst = (byte *)_surface->pixels + frameTop * SEQ_SCREEN_WIDTH + frameLeft; + byte *dst = (byte *)_surface->getBasePtr(frameLeft, frameTop); byte *linebuf = new byte[frameWidth]; @@ -133,7 +133,7 @@ const Graphics::Surface *SEQDecoder::SEQVideoTrack::decodeNextFrame() { } else { byte *buf = new byte[frameSize]; _fileStream->read(buf, frameSize); - decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, (byte *)_surface->pixels + SEQ_SCREEN_WIDTH * frameTop, frameLeft, frameWidth, frameHeight, colorKey); + decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, (byte *)_surface->getBasePtr(0, frameTop), frameLeft, frameWidth, frameHeight, colorKey); delete[] buf; } -- cgit v1.2.3 From 338c4e2bce7729a4150a735f6208c1f83bbd5882 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:42:06 +0200 Subject: SWORD1: Prefer getBasePtr over direct Surface::pixels access. --- engines/sword1/animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 79ec060bc1..73a22093ab 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -314,7 +314,7 @@ bool MoviePlayer::playVideo() { if (_decoderType == kVideoDecoderPSX) drawFramePSX(frame); else - _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); } if (_decoder->hasDirtyPalette()) { @@ -407,7 +407,7 @@ bool MoviePlayer::playVideo() { } Graphics::Surface *screen = _vm->_system->lockScreen(); - performPostProcessing((byte *)screen->pixels); + performPostProcessing((byte *)screen->getBasePtr(0, 0)); _vm->_system->unlockScreen(); _vm->_system->updateScreen(); } @@ -498,7 +498,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { uint16 x = (g_system->getWidth() - scaledFrame.w) / 2; uint16 y = (g_system->getHeight() - scaledFrame.h) / 2; - _vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _vm->_system->copyRectToScreen(scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); scaledFrame.free(); } -- cgit v1.2.3 From d91c379f16e6a75f3dac6464630bccc0d4437f40 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:43:48 +0200 Subject: SWORD2: Prefer getBasePtr over direct Surface::pixels access. --- engines/sword2/animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 713120ad43..c25b29d337 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -334,7 +334,7 @@ bool MoviePlayer::playVideo() { if (_decoderType == kVideoDecoderPSX) drawFramePSX(frame); else - _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); } if (_decoder->hasDirtyPalette()) { @@ -403,7 +403,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { uint16 x = (g_system->getWidth() - scaledFrame.w) / 2; uint16 y = (g_system->getHeight() - scaledFrame.h) / 2; - _vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _vm->_system->copyRectToScreen(scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); scaledFrame.free(); } -- cgit v1.2.3 From 5afa6f97f46f2ce22b3c0ae6bca6338acd74bd14 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:49:23 +0200 Subject: SWORD25: Prefer getBasePtr over direct Surface::pixels access. --- engines/sword25/gfx/image/imgloader.cpp | 2 +- engines/sword25/gfx/image/renderedimage.cpp | 2 +- engines/sword25/gfx/screenshot.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/sword25/gfx/image/imgloader.cpp b/engines/sword25/gfx/image/imgloader.cpp index e103626416..6a458a0ae1 100644 --- a/engines/sword25/gfx/image/imgloader.cpp +++ b/engines/sword25/gfx/image/imgloader.cpp @@ -50,7 +50,7 @@ bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, byte *&un width = pngSurface->w; height = pngSurface->h; uncompressedDataPtr = new byte[pngSurface->pitch * pngSurface->h]; - memcpy(uncompressedDataPtr, (byte *)pngSurface->pixels, pngSurface->pitch * pngSurface->h); + memcpy(uncompressedDataPtr, (byte *)pngSurface->getBasePtr(0, 0), pngSurface->pitch * pngSurface->h); pngSurface->free(); delete pngSurface; diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 9b8cf2266d..f8ed7a00b2 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -287,7 +287,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = scale(srcImage, width, height); - savedPixels = (byte *)img->pixels; + savedPixels = (byte *)img->getBasePtr(0, 0); } else { img = &srcImage; } diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index 0ea4bff906..73149ec119 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -85,7 +85,7 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data) uint x, y; x = y = 0; - for (byte *pDest = (byte *)thumbnail.pixels; pDest < ((byte *)thumbnail.pixels + thumbnail.pitch * thumbnail.h); ) { + for (byte *pDest = (byte *)thumbnail.getBasePtr(0, 0); pDest < ((byte *)thumbnail.getBasePtr(0, thumbnail.h)); ) { // Get an average over a 4x4 pixel block in the source image int alpha, red, green, blue; alpha = red = green = blue = 0; -- cgit v1.2.3 From affb7c3cb3d7a898419fc7ea081824382b2d2d8c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:55:08 +0200 Subject: GRAPHICS: Prefer getBasePtr over direct Surface::pixels access. --- graphics/VectorRenderer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index 0467cac946..3e4b6f4653 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -278,7 +278,7 @@ public: * Clears the active surface. */ virtual void clearSurface() { - byte *src = (byte *)_activeSurface->pixels; + byte *src = (byte *)_activeSurface->getBasePtr(0, 0); memset(src, 0, _activeSurface->pitch * _activeSurface->h); } -- cgit v1.2.3 From 509f96dff3e41fe88e78997f8e1617b0067f85cd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 00:58:47 +0200 Subject: TEENAGENT: Prefer getBasePtr over direct Surface::pixels access. --- engines/teenagent/font.cpp | 2 +- engines/teenagent/resources.cpp | 2 +- engines/teenagent/scene.cpp | 12 +++++------- engines/teenagent/teenagent.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp index 47f52ff90f..efc107f6db 100644 --- a/engines/teenagent/font.cpp +++ b/engines/teenagent/font.cpp @@ -65,7 +65,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) byte *glyph = _data + READ_LE_UINT16(_data + idx * 2); int h = glyph[0], w = glyph[1]; - if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth) + if (surface == NULL || surface->getBasePtr(0, 0) == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth) return w - _widthPack; int i0 = 0, j0 = 0; diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp index 399baf469f..cf1c4efdf6 100644 --- a/engines/teenagent/resources.cpp +++ b/engines/teenagent/resources.cpp @@ -160,7 +160,7 @@ void Resources::loadOff(Graphics::Surface &surface, byte *palette, int id) { off.read(id, buf, bufferSize); byte *src = buf; - byte *dst = (byte *)surface.pixels; + byte *dst = (byte *)surface.getBasePtr(0, 0); memcpy(dst, src, 64000); memcpy(palette, buf + 64000, 768); diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index bdeb11a841..f9a3cca683 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -48,7 +48,6 @@ Scene::Scene(TeenAgentEngine *vm) : _vm(vm), intro(false), _id(0), ons(0), onEnabled = true; memset(palette, 0, sizeof(palette)); - background.pixels = 0; FilePack varia; varia.open("varia.res"); @@ -74,8 +73,7 @@ Scene::Scene(TeenAgentEngine *vm) : _vm(vm), intro(false), _id(0), ons(0), } Scene::~Scene() { - if (background.pixels) - background.free(); + background.free(); delete[] ons; ons = 0; @@ -372,7 +370,7 @@ void Scene::init(int id, const Common::Point &pos) { for (byte i = 0; i < 4; ++i) customAnimation[i].free(); - if (background.pixels == NULL) + if (background.getBasePtr(0, 0) == NULL) background.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); warp(pos); @@ -416,7 +414,7 @@ void Scene::init(int id, const Common::Point &pos) { if (nowPlaying != _vm->res->dseg.get_byte(dsAddr_currentMusic)) _vm->music->load(_vm->res->dseg.get_byte(dsAddr_currentMusic)); - _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h); + _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h); setPalette(0); } @@ -642,8 +640,8 @@ bool Scene::render(bool tickGame, bool tickMark, uint32 messageDelta) { return true; } - if (background.pixels && debugFeatures.feature[DebugFeatures::kShowBack]) { - _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h); + if (background.getBasePtr(0, 0) && debugFeatures.feature[DebugFeatures::kShowBack]) { + _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h); } else _vm->_system->fillScreen(0); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 0b48a18b26..40c868042e 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -399,7 +399,7 @@ bool TeenAgentEngine::showLogo() { return true; } - _system->copyRectToScreen(s.pixels, s.w, s.x, s.y, s.w, s.h); + _system->copyRectToScreen(s.getBasePtr(0, 0), s.w, s.x, s.y, s.w, s.h); _system->updateScreen(); _system->delayMillis(100); -- cgit v1.2.3 From 76aa360112e8dd6a741d9cbab5db744e91efcc27 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:01:09 +0200 Subject: TOLTECS: Prefer getBasePtr over direct Surface::pixels access. --- engines/toltecs/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp index b52d7dad82..d2b3d5a163 100644 --- a/engines/toltecs/menu.cpp +++ b/engines/toltecs/menu.cpp @@ -69,7 +69,7 @@ int MenuSystem::run(MenuID menuId) { _vm->_screen->blastSprite(0x140 + _vm->_cameraX, 0x175 + _vm->_cameraY, 0, 1, 0x4000); shadeRect(60, 39, 520, 247, 225, 229); - memcpy(_background->pixels, _vm->_screen->_frontScreen, 640 * 400); + memcpy(_background->getBasePtr(0, 0), _vm->_screen->_frontScreen, 640 * 400); while (_running) { update(); @@ -229,7 +229,7 @@ void MenuSystem::initMenu(MenuID menuID) { _items.clear(); - memcpy(_vm->_screen->_frontScreen, _background->pixels, 640 * 400); + memcpy(_vm->_screen->_frontScreen, _background->getBasePtr(0, 0), 640 * 400); switch (menuID) { case kMenuIdMain: -- cgit v1.2.3 From f30eb4ea3244853a2f5f574de4945ced4b89f5e2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:02:12 +0200 Subject: TONY: Prefer getBasePtr over direct Surface::pixels access. --- engines/tony/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 2a443c4097..5fc4329ff6 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -158,9 +158,9 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s Graphics::Surface *to = new Graphics::Surface(); to->create(160, 120, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); - if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->pixels, saveName, difficulty)) { + if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->getBasePtr(0, 0), saveName, difficulty)) { #ifdef SCUMM_BIG_ENDIAN - uint16 *pixels = (uint16 *)to->pixels; + uint16 *pixels = (uint16 *)to->getBasePtr(0, 0); for (int i = 0; i < to->w * to->h; ++i) pixels[i] = READ_LE_UINT16(pixels + i); #endif -- cgit v1.2.3 From cbef0de3a4cb74aa7e583209d47332608536f21b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:08:29 +0200 Subject: TOON: Prefer getBasePtr over direct Surface::pixels access. --- engines/toon/anim.cpp | 6 +++--- engines/toon/movie.cpp | 2 +- engines/toon/picture.cpp | 6 +++--- engines/toon/toon.cpp | 12 +++++------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index a6744568f7..aecf341079 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -190,7 +190,7 @@ void Animation::drawFrame(Graphics::Surface &surface, int32 frame, int16 xx, int int32 destPitch = surface.pitch; uint8 *srcRow = _frames[frame]._data + offsX + (_frames[frame]._x2 - _frames[frame]._x1) * offsY; - uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1 + offsY) * destPitch + (xx + _x1 + _frames[frame]._x1 + offsX); + uint8 *curRow = (uint8 *)surface.getBasePtr(xx + _x1 + _frames[frame]._x1 + offsX, yy + _frames[frame]._y1 + _y1 + offsY); for (int16 y = 0; y < rectY; y++) { uint8 *cur = curRow; uint8 *c = srcRow + y * (_frames[frame]._x2 - _frames[frame]._x1); @@ -231,7 +231,7 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram int32 destPitch = surface.pitch; int32 destPitchMask = mask->getWidth(); uint8 *c = _frames[frame]._data; - uint8 *curRow = (uint8 *)surface.pixels; + uint8 *curRow = (uint8 *)surface.getBasePtr(0, 0); uint8 *curRowMask = mask->getDataPtr(); bool shadowFlag = false; @@ -341,7 +341,7 @@ void Animation::drawFontFrame(Graphics::Surface &surface, int32 frame, int16 xx, int32 destPitch = surface.pitch; uint8 *c = _frames[frame]._data; - uint8 *curRow = (uint8 *)surface.pixels + (yy + _frames[frame]._y1 + _y1) * destPitch + (xx + _x1 + _frames[frame]._x1); + uint8 *curRow = (uint8 *)surface.getBasePtr(xx + _x1 + _frames[frame]._x1, yy + _frames[frame]._y1 + _y1); for (int16 y = 0; y < rectY; y++) { unsigned char *cur = curRow; for (int16 x = 0; x < rectX; x++) { diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index 8c85e20f7c..962b73dfa7 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -112,7 +112,7 @@ bool Movie::playVideo(bool isFirstIntroVideo) { } _vm->_system->unlockScreen(); } else { - _vm->_system->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, 0, 0, frame->w, frame->h); // WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels. if (isFirstIntroVideo) { diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp index f59cdca064..65cc3a70e1 100644 --- a/engines/toon/picture.cpp +++ b/engines/toon/picture.cpp @@ -170,7 +170,7 @@ void Picture::drawMask(Graphics::Surface &surface, int16 x, int16 y, int16 dx, i int32 destPitch = surface.pitch; int32 srcPitch = _width; uint8 *c = _data + _width * dy + dx; - uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x; + uint8 *curRow = (uint8 *)surface.getBasePtr(x, y); for (int16 yy = 0; yy < ry; yy++) { uint8 *curSrc = c; @@ -205,7 +205,7 @@ void Picture::drawWithRectList(Graphics::Surface& surface, int16 x, int16 y, int int16 fillRy = MIN(ry, rect.bottom - rect.top); uint8 *c = _data + _width * (dy + rect.top) + (dx + rect.left); - uint8 *curRow = (uint8 *)surface.pixels + (y + rect.top) * destPitch + (x + rect.left); + uint8 *curRow = (uint8 *)surface.getBasePtr(x + rect.left, y + rect.top); for (int16 yy = 0; yy < fillRy; yy++) { uint8 *curSrc = c; @@ -233,7 +233,7 @@ void Picture::draw(Graphics::Surface &surface, int16 x, int16 y, int16 dx, int16 int32 destPitch = surface.pitch; int32 srcPitch = _width; uint8 *c = _data + _width * dy + dx; - uint8 *curRow = (uint8 *)surface.pixels + y * destPitch + x; + uint8 *curRow = (uint8 *)surface.getBasePtr(x, y); for (int16 yy = 0; yy < ry; yy++) { uint8 *curSrc = c; diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 7ad29ab8d8..2f5c810811 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -466,8 +466,7 @@ void ToonEngine::doMagnifierEffect() { int32 cy = CLIP(posY + y, 0, TOON_BACKBUFFER_HEIGHT-1); for (int32 x = -12; x <= 12; x++) { int32 cx = CLIP(posX + x, 0, TOON_BACKBUFFER_WIDTH-1); - int32 destPitch = surface.pitch; - uint8 *curRow = (uint8 *)surface.pixels + cy * destPitch + cx; + uint8 *curRow = (uint8 *)surface.getBasePtr(cx, cy); tempBuffer[(y + 12) * 25 + x + 12] = *curRow; } } @@ -479,8 +478,7 @@ void ToonEngine::doMagnifierEffect() { if (dist > 144) continue; int32 cx = CLIP(posX + x, 0, TOON_BACKBUFFER_WIDTH-1); - int32 destPitch = surface.pitch; - uint8 *curRow = (uint8 *)surface.pixels + cy * destPitch + cx; + uint8 *curRow = (uint8 *)surface.getBasePtr(cx, cy); int32 lerp = (512 + intSqrt[dist] * 256 / 12); *curRow = tempBuffer[(y * lerp / 1024 + 12) * 25 + x * lerp / 1024 + 12]; } @@ -501,7 +499,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { if (_dirtyAll || _gameState->_currentScrollValue != lastScroll) { // we have to refresh everything in case of scrolling. - _system->copyRectToScreen((byte *)_mainSurface->pixels + state()->_currentScrollValue, TOON_BACKBUFFER_WIDTH, 0, 0, TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); + _system->copyRectToScreen((byte *)_mainSurface->getBasePtr(0, 0) + state()->_currentScrollValue, TOON_BACKBUFFER_WIDTH, 0, 0, TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); } else { int32 offX = 0; @@ -517,7 +515,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { } rect.clip(TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); if (rect.left >= 0 && rect.top >= 0 && rect.right - rect.left > 0 && rect.bottom - rect.top > 0) { - _system->copyRectToScreen((byte *)_mainSurface->pixels + _oldDirtyRects[i].left + offX + _oldDirtyRects[i].top * TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_WIDTH, rect.left , rect.top, rect.right - rect.left, rect.bottom - rect.top); + _system->copyRectToScreen((byte *)_mainSurface->getBasePtr(_oldDirtyRects[i].left + offX, _oldDirtyRects[i].top), TOON_BACKBUFFER_WIDTH, rect.left , rect.top, rect.right - rect.left, rect.bottom - rect.top); } } @@ -533,7 +531,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { } rect.clip(TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); if (rect.left >= 0 && rect.top >= 0 && rect.right - rect.left > 0 && rect.bottom - rect.top > 0) { - _system->copyRectToScreen((byte *)_mainSurface->pixels + _dirtyRects[i].left + offX + _dirtyRects[i].top * TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_WIDTH, rect.left , rect.top, rect.right - rect.left, rect.bottom - rect.top); + _system->copyRectToScreen((byte *)_mainSurface->getBasePtr(_dirtyRects[i].left + offX, _dirtyRects[i].top), TOON_BACKBUFFER_WIDTH, rect.left , rect.top, rect.right - rect.left, rect.bottom - rect.top); } } } -- cgit v1.2.3 From ae7bc4dcf041c10ea0ce312bb788c402923ebdb0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:14:28 +0200 Subject: TSAGE: Prefer getBasePtr over direct Surface::pixels access. --- engines/tsage/graphics.cpp | 8 ++++---- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 ++-- engines/tsage/saveload.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index ce19502524..ecacf4bce3 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -316,7 +316,7 @@ void GfxSurface::create(int width, int height) { } _customSurface = new Graphics::Surface(); _customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - Common::fill((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0); + Common::fill((byte *)_customSurface->getBasePtr(0, 0), (byte *)_customSurface->getBasePtr(0, height), 0); _bounds = Rect(0, 0, width, height); } @@ -363,7 +363,7 @@ void GfxSurface::synchronize(Serializer &s) { if (_customSurface) { s.syncAsSint16LE(_customSurface->w); s.syncAsSint16LE(_customSurface->h); - s.syncBytes((byte *)_customSurface->pixels, _customSurface->w * _customSurface->h); + s.syncBytes((byte *)_customSurface->getBasePtr(0, 0), _customSurface->w * _customSurface->h); } else { int zero = 0; s.syncAsSint16LE(zero); @@ -380,7 +380,7 @@ void GfxSurface::synchronize(Serializer &s) { _customSurface = NULL; } else { create(w, h); - s.syncBytes((byte *)_customSurface->pixels, w * h); + s.syncBytes((byte *)_customSurface->getBasePtr(0, 0), w * h); } } } @@ -581,7 +581,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi Graphics::Surface destSurface = srcImage.lockSurface(); const byte *srcP = (const byte *)srcSurface.getBasePtr(srcBounds.left, srcBounds.top); - byte *destP = (byte *)destSurface.pixels; + byte *destP = (byte *)destSurface.getBasePtr(0, 0); for (int yp = srcBounds.top; yp < srcBounds.bottom; ++yp, srcP += srcSurface.pitch, destP += destSurface.pitch) { Common::copy(srcP, srcP + srcBounds.width(), destP); } diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index b977ea1516..36c011ffd7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5399,9 +5399,9 @@ GfxSurface Scene600::Actor4::getFrame() { // Translate the frame using the scene's pixel map byte *pixelMap = static_cast(R2_GLOBALS._sceneManager._scene)->_pixelMap; Graphics::Surface surface = frame.lockSurface(); - byte *srcP = (byte *)surface.pixels; + byte *srcP = (byte *)surface.getBasePtr(0, 0); - while (srcP < ((byte *)surface.pixels + (surface.w * surface.h))) { + while (srcP < ((byte *)surface.getBasePtr(0, surface.h))) { *srcP = pixelMap[*srcP]; srcP++; } diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index af2f3566ad..1357ece71e 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -289,7 +289,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface s = g_globals->_screenSurface.lockSurface(); - ::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); + ::createThumbnail(thumb, (const byte *)s.getBasePtr(0, 0), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); g_globals->_screenSurface.unlockSurface(); thumb->free(); -- cgit v1.2.3 From d26817a6b89fa99dd69c633eee904ea4fa73714b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:16:11 +0200 Subject: TUCKER: Prefer getBasePtr over direct Surface::pixels access. --- engines/tucker/sequences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 16c4f4f6f0..5efe5eed00 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -763,7 +763,7 @@ bool AnimationSequencePlayer::decodeNextAnimationFrame(int index, bool copyDirty if (!copyDirtyRects) { for (uint16 y = 0; (y < surface->h) && (y < kScreenHeight); y++) - memcpy(_offscreenBuffer + y * kScreenWidth, (byte *)surface->pixels + y * surface->pitch, surface->w); + memcpy(_offscreenBuffer + y * kScreenWidth, (const byte *)surface->getBasePtr(0, y), surface->w); } else { _flicPlayer[index].copyDirtyRectsToBuffer(_offscreenBuffer, kScreenWidth); } @@ -811,7 +811,7 @@ void AnimationSequencePlayer::playIntroSeq19_20() { if (surface) for (int i = 0; i < kScreenWidth * kScreenHeight; ++i) if (_offscreenBuffer[i] == 0) - _offscreenBuffer[i] = *((byte *)surface->pixels + i); + _offscreenBuffer[i] = *((const byte *)surface->getBasePtr(0, 0) + i); if (!framesLeft) _changeToNextSequence = true; -- cgit v1.2.3 From 19fa89b8f58df702c5cb16d03a9cb51c1acce7ab Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:23:37 +0200 Subject: WINTERMUTE: Prefer getBasePtr over direct Surface::pixels access. --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 6 +++--- .../wintermute/base/gfx/osystem/base_surface_osystem.cpp | 2 +- engines/wintermute/graphics/transparent_surface.cpp | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 7905184190..06a872a9aa 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -187,9 +187,9 @@ bool BaseRenderOSystem::flip() { } if (_needsFlip || _disableDirtyRects || _tempDisableDirtyRects) { if (_disableDirtyRects || _tempDisableDirtyRects) { - g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); } - // g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); + // g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); delete _dirtyRect; _dirtyRect = nullptr; g_system->updateScreen(); @@ -682,7 +682,7 @@ void BaseRenderOSystem::endSaveLoad() { _drawNum = 1; _renderSurface->fillRect(Common::Rect(0, 0, _renderSurface->h, _renderSurface->w), _renderSurface->format.ARGBToColor(255, 0, 0, 0)); - g_system->copyRectToScreen((byte *)_renderSurface->pixels, _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); g_system->updateScreen(); } diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index b809318133..a61e59c4d6 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -234,7 +234,7 @@ uint32 BaseSurfaceOSystem::getPixelAt(Graphics::Surface *surface, int x, int y) warning("BaseSurfaceOSystem::GetPixel - Not ported yet"); int bpp = surface->format.bytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ - uint8 *p = (uint8 *)surface->pixels + y * surface->pitch + x * bpp; + uint8 *p = (uint8 *)surface->getBasePtr(x, y); switch (bpp) { case 1: diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 5b7c416ee9..9efeea9cad 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -158,7 +158,10 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur h = surf.h; pitch = surf.pitch; format = surf.format; - pixels = surf.pixels; + // We need to cast the const qualifier away here because 'pixels' + // always needs to be writable. 'surf' however is a constant Surface, + // thus getBasePtr will always return const pixel data. + pixels = const_cast(surf.getBasePtr(0, 0)); } } @@ -307,7 +310,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p } if (pPartRect) { - srcImage.pixels = &((char *)pixels)[pPartRect->top * srcImage.pitch + pPartRect->left * 4]; + srcImage.pixels = getBasePtr(pPartRect->top, pPartRect->left); srcImage.w = pPartRect->width(); srcImage.h = pPartRect->height(); @@ -336,7 +339,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = srcImage.scale(width, height); - savedPixels = (byte *)img->pixels; + savedPixels = (byte *)img->getBasePtr(0, 0); } else { img = &srcImage; } @@ -344,13 +347,13 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p // Handle off-screen clipping if (posY < 0) { img->h = MAX(0, (int)img->h - -posY); - img->pixels = (byte *)img->pixels + img->pitch * -posY; + img->pixels = (byte *)img->getBasePtr(0, -posY); posY = 0; } if (posX < 0) { img->w = MAX(0, (int)img->w - -posX); - img->pixels = (byte *)img->pixels + (-posX * 4); + img->pixels = (byte *)img->getBasePtr(-posX, 0); posX = 0; } -- cgit v1.2.3 From 103e926c0765c45267c1cfac0eb07a201e5084bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:26:04 +0200 Subject: GUI: Prefer getBasePtr instead of direct Surface::pixels access. --- gui/EventRecorder.cpp | 2 +- gui/ThemeEngine.cpp | 6 +++--- gui/widget.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index fd0093d266..4f569b75c5 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -522,7 +522,7 @@ bool EventRecorder::grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5 warning("Can't save screenshot"); return false; } - Common::MemoryReadStream bitmapStream((const byte*)screen.pixels, screen.w * screen.h * screen.format.bytesPerPixel); + Common::MemoryReadStream bitmapStream((const byte*)screen.getBasePtr(0, 0), screen.w * screen.h * screen.format.bytesPerPixel); computeStreamMD5(bitmapStream, md5); return true; } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 3ce043cb39..80f3946729 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -389,7 +389,7 @@ bool ThemeEngine::init() { _overlayFormat = _system->getOverlayFormat(); setGraphicsMode(_graphicsMode); - if (_screen.pixels && _backBuffer.pixels) { + if (_screen.getBasePtr(0, 0) && _backBuffer.getBasePtr(0, 0)) { _initOk = true; } @@ -439,7 +439,7 @@ bool ThemeEngine::init() { void ThemeEngine::clearAll() { if (_initOk) { _system->clearOverlay(); - _system->grabOverlay(_screen.pixels, _screen.pitch); + _system->grabOverlay(_screen.getBasePtr(0, 0), _screen.pitch); } } @@ -1326,7 +1326,7 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; Common::HashMap colorToIndex; - const OverlayColor *src = (const OverlayColor *)cursor->pixels; + const OverlayColor *src = (const OverlayColor *)cursor->getBasePtr(0, 0); for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { byte r, g, b; diff --git a/gui/widget.cpp b/gui/widget.cpp index c3f10a861f..197250a940 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -396,7 +396,7 @@ PicButtonWidget::~PicButtonWidget() { void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getBasePtr(0, 0)) return; if (gfx->format.bytesPerPixel == 1) { @@ -429,7 +429,7 @@ void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (_gfx.pixels) { + if (_gfx.getBasePtr(0, 0)) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); @@ -646,7 +646,7 @@ GraphicsWidget::~GraphicsWidget() { void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getBasePtr(0, 0)) return; if (gfx->format.bytesPerPixel == 1) { @@ -676,7 +676,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (_gfx.pixels) { + if (_gfx.getBasePtr(0, 0)) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); -- cgit v1.2.3 From 55afab4d68454a2ea18da39e0c0c856424ecfb46 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:27:41 +0200 Subject: BACKENDS: Prefer getBasePtr over direct Surface::pixels access. --- backends/base-backend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp index 3e0005dedd..f410270d9e 100644 --- a/backends/base-backend.cpp +++ b/backends/base-backend.cpp @@ -57,7 +57,7 @@ void BaseBackend::initBackend() { void BaseBackend::fillScreen(uint32 col) { Graphics::Surface *screen = lockScreen(); - if (screen && screen->pixels) - memset(screen->pixels, col, screen->h * screen->pitch); + if (screen && screen->getBasePtr(0, 0)) + memset(screen->getBasePtr(0, 0), col, screen->h * screen->pitch); unlockScreen(); } -- cgit v1.2.3 From 3169e070135ed06b7f5c5e8ad60c088e4cbd496f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:32:11 +0200 Subject: OPENGL: Prefer getBasePtr over direct Surface::pixels access. --- backends/graphics/opengl/opengl-graphics.cpp | 40 +++++++++++++--------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 48e2663d44..d126ebc212 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -357,7 +357,7 @@ void OpenGLGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, // Copy buffer data to game screen internal buffer const byte *src = (const byte *)buf; - byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel; + byte *dst = (byte *)_screenData.getBasePtr(x, y); for (int i = 0; i < h; i++) { memcpy(dst, src, w * _screenData.format.bytesPerPixel); src += pitch; @@ -385,15 +385,15 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) { #ifdef USE_RGB_COLOR if (_screenFormat.bytesPerPixel == 1) { - memset(_screenData.pixels, col, _screenData.h * _screenData.pitch); + memset(_screenData.getBasePtr(0, 0), col, _screenData.h * _screenData.pitch); } else if (_screenFormat.bytesPerPixel == 2) { - uint16 *pixels = (uint16 *)_screenData.pixels; + uint16 *pixels = (uint16 *)_screenData.getBasePtr(0, 0); uint16 col16 = (uint16)col; for (int i = 0; i < _screenData.w * _screenData.h; i++) { pixels[i] = col16; } } else if (_screenFormat.bytesPerPixel == 3) { - uint8 *pixels = (uint8 *)_screenData.pixels; + uint8 *pixels = (uint8 *)_screenData.getBasePtr(0, 0); byte r = (col >> 16) & 0xFF; byte g = (col >> 8) & 0xFF; byte b = col & 0xFF; @@ -404,13 +404,13 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) { pixels += 3; } } else if (_screenFormat.bytesPerPixel == 4) { - uint32 *pixels = (uint32 *)_screenData.pixels; + uint32 *pixels = (uint32 *)_screenData.getBasePtr(0, 0); for (int i = 0; i < _screenData.w * _screenData.h; i++) { pixels[i] = col; } } #else - memset(_screenData.pixels, col, _screenData.h * _screenData.pitch); + memset(_screenData.getBasePtr(0, 0), col, _screenData.h * _screenData.pitch); #endif _screenNeedsRedraw = true; } @@ -463,12 +463,12 @@ Graphics::PixelFormat OpenGLGraphicsManager::getOverlayFormat() const { void OpenGLGraphicsManager::clearOverlay() { // Set all pixels to 0 - memset(_overlayData.pixels, 0, _overlayData.h * _overlayData.pitch); + memset(_overlayData.getBasePtr(0, 0), 0, _overlayData.h * _overlayData.pitch); _overlayNeedsRedraw = true; } void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) { - const byte *src = (byte *)_overlayData.pixels; + const byte *src = (byte *)_overlayData.getBasePtr(0, 0); byte *dst = (byte *)buf; for (int i = 0; i < _overlayData.h; i++) { // Copy overlay data to buffer @@ -509,7 +509,7 @@ void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, return; // Copy buffer data to internal overlay surface - byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; + byte *dst = (byte *)_overlayData.getBasePtr(0, y); for (int i = 0; i < h; i++) { memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel); src += pitch; @@ -609,7 +609,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int _cursorData.create(w, h, _cursorFormat); // Save cursor data - memcpy(_cursorData.pixels, buf, h * _cursorData.pitch); + memcpy(_cursorData.getBasePtr(0, 0), buf, h * _cursorData.pitch); // Set cursor info _cursorState.w = w; @@ -688,7 +688,7 @@ void OpenGLGraphicsManager::refreshGameScreen() { byte *surface = new byte[w * h * 3]; // Convert the paletted buffer to RGB888 - const byte *src = (byte *)_screenData.pixels + y * _screenData.pitch; + const byte *src = (byte *)_screenData.getBasePtr(0, y); src += x * _screenData.format.bytesPerPixel; byte *dst = surface; for (int i = 0; i < h; i++) { @@ -708,8 +708,7 @@ void OpenGLGraphicsManager::refreshGameScreen() { delete[] surface; } else { // Update the texture - _gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch + - x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h); + _gameTexture->updateBuffer((byte *)_screenData.getBasePtr(x, y), _screenData.pitch, x, y, w, h); } _screenNeedsRedraw = false; @@ -730,7 +729,7 @@ void OpenGLGraphicsManager::refreshOverlay() { byte *surface = new byte[w * h * 3]; // Convert the paletted buffer to RGB888 - const byte *src = (byte *)_overlayData.pixels + y * _overlayData.pitch; + const byte *src = (byte *)_overlayData.getBasePtr(0, y); src += x * _overlayData.format.bytesPerPixel; byte *dst = surface; for (int i = 0; i < h; i++) { @@ -750,8 +749,7 @@ void OpenGLGraphicsManager::refreshOverlay() { delete[] surface; } else { // Update the texture - _overlayTexture->updateBuffer((byte *)_overlayData.pixels + y * _overlayData.pitch + - x * _overlayData.format.bytesPerPixel, _overlayData.pitch, x, y, w, h); + _overlayTexture->updateBuffer((byte *)_overlayData.getBasePtr(x, y), _overlayData.pitch, x, y, w, h); } _overlayNeedsRedraw = false; @@ -780,7 +778,7 @@ void OpenGLGraphicsManager::refreshCursor() { palette = _cursorPalette; // Convert the paletted cursor to RGBA8888 - const byte *src = (byte *)_cursorData.pixels; + const byte *src = (byte *)_cursorData.getBasePtr(0, 0); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -796,7 +794,7 @@ void OpenGLGraphicsManager::refreshCursor() { // Convert the RGB cursor to RGBA8888 if (_cursorFormat.bytesPerPixel == 2) { - const uint16 *src = (uint16 *)_cursorData.pixels; + const uint16 *src = (uint16 *)_cursorData.getBasePtr(0, 0); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -808,7 +806,7 @@ void OpenGLGraphicsManager::refreshCursor() { dst += 4; } } else if (_cursorFormat.bytesPerPixel == 4) { - const uint32 *src = (uint32 *)_cursorData.pixels; + const uint32 *src = (uint32 *)_cursorData.getBasePtr(0, 0); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -1356,7 +1354,7 @@ void OpenGLGraphicsManager::updateOSD() { _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat); else // Clear everything - memset(_osdSurface.pixels, 0, _osdSurface.h * _osdSurface.pitch); + memset(_osdSurface.getBasePtr(0, 0), 0, _osdSurface.h * _osdSurface.pitch); // Determine a rect which would contain the message string (clipped to the // screen dimensions). @@ -1390,7 +1388,7 @@ void OpenGLGraphicsManager::updateOSD() { } // Update the texture - _osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0, + _osdTexture->updateBuffer(_osdSurface.getBasePtr(0, 0), _osdSurface.pitch, 0, 0, _osdSurface.w, _osdSurface.h); } #endif -- cgit v1.2.3 From b7706acb4107b6dd6b562062f1d20720e0560f9e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 01:40:57 +0200 Subject: SDL: Prefer getBasePtr over direct Surface::pixels access. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index a2e1981e79..e36e43b05e 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -1340,8 +1340,8 @@ void SurfaceSdlGraphicsManager::unlockScreen() { void SurfaceSdlGraphicsManager::fillScreen(uint32 col) { Graphics::Surface *screen = lockScreen(); - if (screen && screen->pixels) - memset(screen->pixels, col, screen->h * screen->pitch); + if (screen && screen->getBasePtr(0, 0)) + memset(screen->getBasePtr(0, 0), col, screen->h * screen->pitch); unlockScreen(); } -- cgit v1.2.3 From 6fce92b0ea2fce78c375ade0bc6c2ac4231b96bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:05:40 +0200 Subject: VIDEO: Prefer getBasePtr over direct Surface::pixels access. --- video/codecs/cdtoons.cpp | 2 +- video/codecs/cinepak.cpp | 6 +++--- video/codecs/msrle.cpp | 2 +- video/codecs/msvideo1.cpp | 2 +- video/codecs/qtrle.cpp | 12 ++++++------ video/codecs/rpza.cpp | 2 +- video/codecs/smc.cpp | 2 +- video/coktel_decoder.cpp | 34 +++++++++++++++------------------- video/flic_decoder.cpp | 14 +++++++------- video/smk_decoder.cpp | 6 +++--- 10 files changed, 39 insertions(+), 43 deletions(-) diff --git a/video/codecs/cdtoons.cpp b/video/codecs/cdtoons.cpp index 528cee8094..f4adb11dae 100644 --- a/video/codecs/cdtoons.cpp +++ b/video/codecs/cdtoons.cpp @@ -298,7 +298,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea for (uint i = 0; i < actions.size(); i++) { CDToonsAction &action = actions[i]; if (i == 0 && action.blockId == 0) - memset(_surface->pixels, backgroundColor, _surface->w * _surface->h); + memset(_surface->getBasePtr(0, 0), backgroundColor, _surface->w * _surface->h); if (!_blocks.contains(action.blockId)) continue; if (!action.rect.right) diff --git a/video/codecs/cinepak.cpp b/video/codecs/cinepak.cpp index bcf0cf1180..363ca43f61 100644 --- a/video/codecs/cinepak.cpp +++ b/video/codecs/cinepak.cpp @@ -41,11 +41,11 @@ namespace Video { byte b = _clipTable[lum + (u << 1)]; \ \ if (_pixelFormat.bytesPerPixel == 2) \ - *((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint16 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ else \ - *((uint32 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint32 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ } else \ - *((byte *)_curFrame.surface->pixels + offset) = lum + *((byte *)_curFrame.surface->getBasePtr(0, 0) + offset) = lum CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() { _curFrame.surface = NULL; diff --git a/video/codecs/msrle.cpp b/video/codecs/msrle.cpp index fa03a59efd..8efc1a9d8d 100644 --- a/video/codecs/msrle.cpp +++ b/video/codecs/msrle.cpp @@ -53,7 +53,7 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { int x = 0; int y = _surface->h - 1; - byte *data = (byte *) _surface->pixels; + byte *data = (byte *) _surface->getBasePtr(0, 0); uint16 width = _surface->w; uint16 height = _surface->h; diff --git a/video/codecs/msvideo1.cpp b/video/codecs/msvideo1.cpp index 06e4640025..dc7550f791 100644 --- a/video/codecs/msvideo1.cpp +++ b/video/codecs/msvideo1.cpp @@ -48,7 +48,7 @@ MSVideo1Decoder::~MSVideo1Decoder() { void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) { byte colors[8]; - byte *pixels = (byte *)_surface->pixels; + byte *pixels = (byte *)_surface->getBasePtr(0, 0); uint16 stride = _surface->w; int skipBlocks = 0; diff --git a/video/codecs/qtrle.cpp b/video/codecs/qtrle.cpp index d2cdea27de..0e356e5d63 100644 --- a/video/codecs/qtrle.cpp +++ b/video/codecs/qtrle.cpp @@ -61,7 +61,7 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Cod void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); while (linesToChange) { CHECK_STREAM_PTR(2); @@ -105,7 +105,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); byte numPixels = (bpp == 4) ? 8 : 16; while (linesToChange--) { @@ -165,7 +165,7 @@ void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -210,7 +210,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint16 *rgb = (uint16 *)_surface->pixels; + uint16 *rgb = (uint16 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -248,7 +248,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->pixels; + uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -294,7 +294,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->pixels; + uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); diff --git a/video/codecs/rpza.cpp b/video/codecs/rpza.cpp index 0a9f87747e..f4bdc380fe 100644 --- a/video/codecs/rpza.cpp +++ b/video/codecs/rpza.cpp @@ -58,7 +58,7 @@ RPZADecoder::~RPZADecoder() { #define PUT_PIXEL(color) \ if ((int32)blockPtr < _surface->w * _surface->h) \ - WRITE_UINT16((uint16 *)_surface->pixels + blockPtr, color); \ + WRITE_UINT16((uint16 *)_surface->getBasePtr(0, 0) + blockPtr, color); \ blockPtr++ const Graphics::Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) { diff --git a/video/codecs/smc.cpp b/video/codecs/smc.cpp index 2eedb62a0f..c1b765a3cd 100644 --- a/video/codecs/smc.cpp +++ b/video/codecs/smc.cpp @@ -56,7 +56,7 @@ SMCDecoder::~SMCDecoder() { } const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { - byte *pixels = (byte *)_surface->pixels; + byte *pixels = (byte *)_surface->getBasePtr(0, 0); uint32 numBlocks = 0; uint32 colorFlags = 0; diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 4c3b6f8414..2d66e49f5a 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -122,7 +122,7 @@ const Graphics::Surface *CoktelDecoder::getSurface() const { } bool CoktelDecoder::hasSurface() { - return _surface.pixels != 0; + return _surface.getBasePtr(0, 0); } void CoktelDecoder::createSurface() { @@ -473,7 +473,7 @@ void CoktelDecoder::renderBlockWhole(Graphics::Surface &dstSurf, const byte *src rect.clip(dstSurf.w, dstSurf.h); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left * dstSurf.format.bytesPerPixel; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); for (int i = 0; i < rect.height(); i++) { memcpy(dst, src, rect.width() * dstSurf.format.bytesPerPixel); @@ -488,7 +488,7 @@ void CoktelDecoder::renderBlockWhole4X(Graphics::Surface &dstSurf, const byte *s rect.clip(dstSurf.w, dstSurf.h); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); for (int i = 0; i < rect.height(); i++) { byte *dstRow = dst; const byte *srcRow = src; @@ -515,7 +515,7 @@ void CoktelDecoder::renderBlockWhole2Y(Graphics::Surface &dstSurf, const byte *s int16 height = rect.height(); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); while (height > 1) { memcpy(dst , src, rect.width()); memcpy(dst + dstSurf.pitch, src, rect.width()); @@ -535,7 +535,7 @@ void CoktelDecoder::renderBlockSparse(Graphics::Surface &dstSurf, const byte *sr rect.clip(dstSurf.w, dstSurf.h); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); for (int i = 0; i < rect.height(); i++) { byte *dstRow = dst; int16 pixWritten = 0; @@ -572,7 +572,7 @@ void CoktelDecoder::renderBlockSparse2Y(Graphics::Surface &dstSurf, const byte * rect.clip(dstSurf.w, dstSurf.h); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); for (int i = 0; i < rect.height(); i += 2) { byte *dstRow = dst; int16 pixWritten = 0; @@ -604,7 +604,7 @@ void CoktelDecoder::renderBlockRLE(Graphics::Surface &dstSurf, const byte *src, rect.clip(dstSurf.w, dstSurf.h); - byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left; + byte *dst = (byte *)dstSurf.getBasePtr(rect.left, rect.top); for (int i = 0; i < rect.height(); i++) { byte *dstRow = dst; int16 pixWritten = 0; @@ -865,7 +865,7 @@ void PreIMDDecoder::renderFrame() { uint16 h = CLIP(_surface.h - _y, 0, _height); const byte *src = _videoBuffer; - byte *dst = (byte *)_surface.pixels + (_y * _surface.pitch) + _x; + byte *dst = (byte *)_surface.getBasePtr(_x, _y); uint32 frameDataSize = _videoBufferSize; @@ -1458,7 +1458,7 @@ bool IMDDecoder::renderFrame(Common::Rect &rect) { const int offsetY = (_y + rect.top) * _surface.pitch; const int offset = offsetX + offsetY; - if (deLZ77((byte *)_surface.pixels + offset, dataPtr, dataSize, + if (deLZ77((byte *)_surface.getBasePtr(0, 0) + offset, dataPtr, dataSize, _surface.w * _surface.h * _surface.format.bytesPerPixel - offset)) return true; } @@ -2277,7 +2277,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) { rect = Common::Rect(_x, _y, _x + codecSurf->w, _y + codecSurf->h); rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height)); - renderBlockWhole(_surface, (const byte *) codecSurf->pixels, rect); + renderBlockWhole(_surface, (const byte *)codecSurf->getBasePtr(0, 0), rect); return true; } @@ -2298,7 +2298,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) { const int offsetY = (_y + rect.top) * _surface.pitch; const int offset = offsetX + offsetY; - if (deLZ77((byte *)_surface.pixels + offset, dataPtr, dataSize, + if (deLZ77((byte *)_surface.getBasePtr(0, 0) + offset, dataPtr, dataSize, _surface.w * _surface.h * _surface.format.bytesPerPixel - offset)) return true; } @@ -2406,10 +2406,8 @@ void VMDDecoder::blit16(const Graphics::Surface &srcSurf, Common::Rect &rect) { Graphics::PixelFormat pixelFormat = getPixelFormat(); - const byte *src = (byte *)srcSurf.pixels + - (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; - byte *dst = (byte *)_surface.pixels + - ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.format.bytesPerPixel; + const byte *src = (const byte *)srcSurf.getBasePtr(srcRect.left, srcRect.top); + byte *dst = (byte *)_surface.getBasePtr(_x + rect.left, _y + rect.top); for (int i = 0; i < rect.height(); i++) { const byte *srcRow = src; @@ -2446,10 +2444,8 @@ void VMDDecoder::blit24(const Graphics::Surface &srcSurf, Common::Rect &rect) { Graphics::PixelFormat pixelFormat = getPixelFormat(); - const byte *src = (byte *)srcSurf.pixels + - (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; - byte *dst = (byte *)_surface.pixels + - ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.format.bytesPerPixel; + const byte *src = (const byte *)srcSurf.getBasePtr(srcRect.left, srcRect.top); + byte *dst = (byte *)_surface.getBasePtr(_x + rect.left, _y + rect.top); for (int i = 0; i < rect.height(); i++) { const byte *srcRow = src; diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp index de545366b1..a295c3e342 100644 --- a/video/flic_decoder.cpp +++ b/video/flic_decoder.cpp @@ -244,7 +244,7 @@ void FlicDecoder::FlicVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) for (Common::List::const_iterator it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { for (int y = (*it).top; y < (*it).bottom; ++y) { const int x = (*it).left; - memcpy(dst + y * pitch + x, (byte *)_surface->pixels + y * getWidth() + x, (*it).right - x); + memcpy(dst + y * pitch + x, (byte *)_surface->getBasePtr(x, y), (*it).right - x); } } @@ -252,7 +252,7 @@ void FlicDecoder::FlicVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) } void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) { - memcpy((byte *)_surface->pixels, data, getWidth() * getHeight()); + memcpy((byte *)_surface->getBasePtr(0, 0), data, getWidth() * getHeight()); // Redraw _dirtyRects.clear(); @@ -260,8 +260,8 @@ void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) { } void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) { - byte *ptr = (byte *)_surface->pixels; - while ((int32)(ptr - (byte *)_surface->pixels) < (getWidth() * getHeight())) { + byte *ptr = (byte *)_surface->getBasePtr(0, 0); + while ((int32)(ptr - (byte *)_surface->getBasePtr(0, 0)) < (getWidth() * getHeight())) { int chunks = *data++; while (chunks--) { int count = (int8)*data++; @@ -305,7 +305,7 @@ void FlicDecoder::FlicVideoTrack::decodeDeltaFLC(uint8 *data) { case OP_UNDEFINED: break; case OP_LASTPIXEL: - *((byte *)_surface->pixels + currentLine * getWidth() + getWidth() - 1) = (opcode & 0xFF); + *((byte *)_surface->getBasePtr(getWidth() - 1, currentLine)) = (opcode & 0xFF); _dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1)); break; case OP_LINESKIPCOUNT: @@ -321,14 +321,14 @@ void FlicDecoder::FlicVideoTrack::decodeDeltaFLC(uint8 *data) { column += *data++; int rleCount = (int8)*data++; if (rleCount > 0) { - memcpy((byte *)_surface->pixels + (currentLine * getWidth()) + column, data, rleCount * 2); + memcpy((byte *)_surface->getBasePtr(column, currentLine), data, rleCount * 2); data += rleCount * 2; _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); } else if (rleCount < 0) { rleCount = -rleCount; uint16 dataWord = READ_UINT16(data); data += 2; for (int i = 0; i < rleCount; ++i) { - WRITE_UINT16((byte *)_surface->pixels + currentLine * getWidth() + column + i * 2, dataWord); + WRITE_UINT16((byte *)_surface->getBasePtr(column + i * 2, currentLine), dataWord); } _dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1)); } else { // End of cutscene ? diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index b622a0ab61..356ec8e45b 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -580,7 +580,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { while (run-- && block < blocks) { clr = _MClrTree->getCode(bs); map = _MMapTree->getCode(bs); - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; hi = clr >> 8; lo = clr & 0xff; for (i = 0; i < 4; i++) { @@ -613,7 +613,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { } while (run-- && block < blocks) { - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; switch (mode) { case 0: for (i = 0; i < 4; ++i) { @@ -679,7 +679,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { uint32 col; mode = type >> 8; while (run-- && block < blocks) { - out = (byte *)_surface->pixels + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; col = mode * 0x01010101; for (i = 0; i < 4 * doubleY; ++i) { out[0] = out[1] = out[2] = out[3] = col; -- cgit v1.2.3 From dbef9fef3b65cfd74a25ecb8767e1ba396f5b3b1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:14:51 +0200 Subject: GRAPHICS: Prefer getBasePtr over direct Surface::pixels access. --- graphics/decoders/bmp.cpp | 6 +++--- graphics/decoders/iff.cpp | 4 ++-- graphics/decoders/jpeg.cpp | 2 +- graphics/decoders/pcx.cpp | 6 +++--- graphics/decoders/pict.cpp | 2 +- graphics/decoders/png.cpp | 2 +- graphics/decoders/tga.cpp | 4 ++-- graphics/scaler/thumbnail_intern.cpp | 19 ++++++++++--------- graphics/yuv_to_rgb.cpp | 18 +++++++++--------- 9 files changed, 32 insertions(+), 31 deletions(-) diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp index bcfd0abbda..51e43075a5 100644 --- a/graphics/decoders/bmp.cpp +++ b/graphics/decoders/bmp.cpp @@ -130,14 +130,14 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0; if (bitsPerPixel == 8) { - byte *dst = (byte *)_surface->pixels; + byte *dst = (byte *)_surface->getBasePtr(0, 0); for (int32 i = 0; i < height; i++) { stream.read(dst + (height - i - 1) * width, width); stream.skip(extraDataLength); } } else if (bitsPerPixel == 24) { - byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch; + byte *dst = (byte *)_surface->getBasePtr(0, height - 1); for (int32 i = 0; i < height; i++) { for (uint32 j = 0; j < width; j++) { @@ -154,7 +154,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { dst -= _surface->pitch * 2; } } else { // 32 bpp - byte *dst = (byte *)_surface->pixels + (height - 1) * _surface->pitch; + byte *dst = (byte *)_surface->getBasePtr(0, height - 1); for (int32 i = 0; i < height; i++) { for (uint32 j = 0; j < width; j++) { diff --git a/graphics/decoders/iff.cpp b/graphics/decoders/iff.cpp index 50c7b4f7de..60a6dafda2 100644 --- a/graphics/decoders/iff.cpp +++ b/graphics/decoders/iff.cpp @@ -170,7 +170,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { if (_type == TYPE_ILBM) { uint32 scanlinePitch = ((_header.width + 15) >> 4) << 1; byte *scanlines = new byte[scanlinePitch * _header.numPlanes]; - byte *data = (byte *)_surface->pixels; + byte *data = (byte *)_surface->getBasePtr(0, 0); for (uint16 i = 0; i < _header.height; ++i) { byte *scanline = scanlines; @@ -194,7 +194,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { delete[] scanlines; } else if (_type == TYPE_PBM) { - byte *data = (byte *)_surface->pixels; + byte *data = (byte *)_surface->getBasePtr(0, 0); uint32 outSize = _header.width * _header.height; if (_header.compression) { diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp index 75fdcd6e5a..d2829e3576 100644 --- a/graphics/decoders/jpeg.cpp +++ b/graphics/decoders/jpeg.cpp @@ -81,7 +81,7 @@ const Surface *JPEGDecoder::getSurface() const { const Graphics::Surface *uComponent = getComponent(2); const Graphics::Surface *vComponent = getComponent(3); - YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (byte *)yComponent->pixels, (byte *)uComponent->pixels, (byte *)vComponent->pixels, yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); + YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (const byte *)yComponent->getBasePtr(0, 0), (const byte *)uComponent->getBasePtr(0, 0), (const byte *)vComponent->getBasePtr(0, 0), yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); return _rgbSurface; } diff --git a/graphics/decoders/pcx.cpp b/graphics/decoders/pcx.cpp index 1250398c73..5815633545 100644 --- a/graphics/decoders/pcx.cpp +++ b/graphics/decoders/pcx.cpp @@ -117,7 +117,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { if (nPlanes == 3 && bitsPerPixel == 8) { // 24bpp Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); _surface->create(width, height, format); - dst = (byte *)_surface->pixels; + dst = (byte *)_surface->getBasePtr(0, 0); _paletteColorCount = 0; for (y = 0; y < height; y++) { @@ -135,7 +135,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->pixels; + dst = (byte *)_surface->getBasePtr(0, 0); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { @@ -163,7 +163,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) && bitsPerPixel == 1) { // planar, 4, 8 or 16 colors _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->pixels; + dst = (byte *)_surface->getBasePtr(0, 0); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp index b1d408ebc3..0b2ba9a64e 100644 --- a/graphics/decoders/pict.cpp +++ b/graphics/decoders/pict.cpp @@ -364,7 +364,7 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa case 1: // Just copy to the image _outputSurface->create(width, height, PixelFormat::createFormatCLUT8()); - memcpy(_outputSurface->pixels, buffer, _outputSurface->w * _outputSurface->h); + memcpy(_outputSurface->getBasePtr(0, 0), buffer, _outputSurface->w * _outputSurface->h); break; case 2: // We have a 16-bit surface diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp index 11e26162eb..ac9689fcc8 100644 --- a/graphics/decoders/png.cpp +++ b/graphics/decoders/png.cpp @@ -164,7 +164,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { png_set_packing(pngPtr); } else { _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); - if (!_outputSurface->pixels) { + if (!_outputSurface->getBasePtr(0, 0)) { error("Could not allocate memory for output image."); } if (bitDepth == 16) diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp index c3b9d84055..3ee506f31b 100644 --- a/graphics/decoders/tga.cpp +++ b/graphics/decoders/tga.cpp @@ -272,7 +272,7 @@ bool TGADecoder::readData(Common::SeekableReadStream &tga, byte imageType, byte } else if (imageType == TYPE_BW) { _surface.create(_surface.w, _surface.h, _format); - byte *data = (byte *)_surface.pixels; + byte *data = (byte *)_surface.getBasePtr(0, 0); uint32 count = _surface.w * _surface.h; while (count-- > 0) { @@ -318,7 +318,7 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW || imageType == TYPE_RLE_CMAP) { _surface.create(_surface.w, _surface.h, _format); uint32 count = _surface.w * _surface.h; - byte *data = (byte *)_surface.pixels; + byte *data = (byte *)_surface.getBasePtr(0, 0); while (count > 0) { uint32 header = tga.readByte(); diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 347a25ec37..675328db6d 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -77,13 +77,13 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { while (in.w / out.w >= 4 || in.h / out.h >= 4) { - createThumbnail_4<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); + createThumbnail_4<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h); in.w /= 4; in.h /= 4; } while (in.w / out.w >= 2 || in.h / out.h >= 2) { - createThumbnail_2<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); + createThumbnail_2<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h); in.w /= 2; in.h /= 2; } @@ -172,7 +172,7 @@ static bool grabScreen565(Graphics::Surface *surf) { return false; assert(screen->format.bytesPerPixel == 1 || screen->format.bytesPerPixel == 2); - assert(screen->pixels != 0); + assert(screen->getBasePtr(0, 0) != 0); Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); @@ -190,15 +190,16 @@ static bool grabScreen565(Graphics::Surface *surf) { byte r = 0, g = 0, b = 0; if (screenFormat.bytesPerPixel == 1) { - r = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3]; - g = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 1]; - b = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 2]; + uint8 pixel = *(uint8 *)screen->getBasePtr(x, y); + r = palette[pixel * 3 + 0]; + g = palette[pixel * 3 + 1]; + b = palette[pixel * 3 + 2]; } else if (screenFormat.bytesPerPixel == 2) { uint16 col = READ_UINT16(screen->getBasePtr(x, y)); screenFormat.colorToRGB(col, r, g, b); } - ((uint16 *)surf->pixels)[y * surf->w + x] = Graphics::RGBToColor >(r, g, b); + *((uint16 *)surf->getBasePtr(x, y)) = Graphics::RGBToColor >(r, g, b); } } @@ -246,7 +247,7 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, g = palette[pixels[y * w + x] * 3 + 1]; b = palette[pixels[y * w + x] * 3 + 2]; - ((uint16 *)screen.pixels)[y * screen.w + x] = Graphics::RGBToColor >(r, g, b); + *((uint16 *)screen.getBasePtr(y, x)) = Graphics::RGBToColor >(r, g, b); } } @@ -272,7 +273,7 @@ bool createScreenShot(Graphics::Surface &surf) { byte r = 0, g = 0, b = 0, a = 0; uint32 col = READ_UINT32(screen->getBasePtr(x, y)); screenFormat.colorToARGB(col, a, r, g, b); - ((uint32 *)surf.pixels)[y * surf.w + x] = Graphics::ARGBToColor >(a, r, g, b); + *((uint32 *)surf.getBasePtr(x, y)) = Graphics::ARGBToColor >(a, r, g, b); } } g_system->unlockScreen(); diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp index 6043315a13..e9dfa37b03 100644 --- a/graphics/yuv_to_rgb.cpp +++ b/graphics/yuv_to_rgb.cpp @@ -229,7 +229,7 @@ void convertYUV444ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->pixels); + assert(dst && dst->getBasePtr(0, 0)); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); @@ -237,9 +237,9 @@ void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV444ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV444ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV444ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV444ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } template @@ -283,7 +283,7 @@ void convertYUV420ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert420(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->pixels); + assert(dst && dst->getBasePtr(0, 0)); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); assert((yWidth & 1) == 0); @@ -293,9 +293,9 @@ void YUVToRGBManager::convert420(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV420ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV420ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV420ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV420ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } #define READ_QUAD(ptr, prefix) \ @@ -368,7 +368,7 @@ void convertYUV410ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert410(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->pixels); + assert(dst && dst->getBasePtr(0, 0)); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); assert((yWidth & 3) == 0); @@ -378,9 +378,9 @@ void YUVToRGBManager::convert410(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV410ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV410ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV410ToRGB((byte *)dst->pixels, dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV410ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } } // End of namespace Graphics -- cgit v1.2.3 From f03dc05847a77661c2978619099ab18c82bb94f7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:22:59 +0200 Subject: GRAPHICS: Add an easy way to query 'pixels' of Surface. This introduced getPixels which is a shortcut for getBasePtr(0, 0). --- graphics/surface.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/graphics/surface.h b/graphics/surface.h index 6c9e464657..d685853009 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -77,6 +77,24 @@ struct Surface { Surface() : w(0), h(0), pitch(0), pixels(0), format() { } + /** + * Return a pointer to the pixel data. + * + * @return Pointer to the pixel data. + */ + inline const void *getPixels() const { + return pixels; + } + + /** + * Return a pointer to the pixel data. + * + * @return Pointer to the pixel data. + */ + inline void *getPixels() { + return pixels; + } + /** * Return a pointer to the pixel at the specified point. * -- cgit v1.2.3 From 5111746911958bd35422e9614b0961a6b911ea06 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:35:31 +0200 Subject: GRAPHICS: Take advantage of Surface::getPixels. --- graphics/VectorRenderer.h | 2 +- graphics/VectorRendererSpec.cpp | 8 ++++---- graphics/decoders/bmp.cpp | 2 +- graphics/decoders/iff.cpp | 4 ++-- graphics/decoders/jpeg.cpp | 2 +- graphics/decoders/pcx.cpp | 6 +++--- graphics/decoders/pict.cpp | 2 +- graphics/decoders/png.cpp | 2 +- graphics/decoders/tga.cpp | 4 ++-- graphics/fonts/ttf.cpp | 4 ++-- graphics/scaler/thumbnail_intern.cpp | 8 ++++---- graphics/yuv_to_rgb.cpp | 18 +++++++++--------- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index 3e4b6f4653..5d6369c08f 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -278,7 +278,7 @@ public: * Clears the active surface. */ virtual void clearSurface() { - byte *src = (byte *)_activeSurface->getBasePtr(0, 0); + byte *src = (byte *)_activeSurface->getPixels(); memset(src, 0, _activeSurface->pitch * _activeSurface->h); } diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 6a3ee306a5..4c5dd33cb5 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -397,7 +397,7 @@ gradientFill(PixelType *ptr, int width, int x, int y) { template void VectorRendererSpec:: fillSurface() { - byte *ptr = (byte *)_activeSurface->getBasePtr(0, 0); + byte *ptr = (byte *)_activeSurface->getPixels(); int h = _activeSurface->h; int pitch = _activeSurface->pitch; @@ -453,7 +453,7 @@ template void VectorRendererSpec:: blitSubSurface(const Graphics::Surface *source, const Common::Rect &r) { byte *dst_ptr = (byte *)_activeSurface->getBasePtr(r.left, r.top); - const byte *src_ptr = (const byte *)source->getBasePtr(0, 0); + const byte *src_ptr = (const byte *)source->getPixels(); const int dst_pitch = _activeSurface->pitch; const int src_pitch = source->pitch; @@ -481,7 +481,7 @@ blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r) { y = y + (r.height() >> 1) - (source->h >> 1); PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(x, y); - const PixelType *src_ptr = (const PixelType *)source->getBasePtr(0, 0); + const PixelType *src_ptr = (const PixelType *)source->getPixels(); int dst_pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel; int src_pitch = source->pitch / source->format.bytesPerPixel; @@ -508,7 +508,7 @@ template void VectorRendererSpec:: applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { int pixels = _activeSurface->w * _activeSurface->h; - PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(0, 0); + PixelType *ptr = (PixelType *)_activeSurface->getPixels(); uint8 r, g, b; uint lum; diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp index 51e43075a5..2eabbb7631 100644 --- a/graphics/decoders/bmp.cpp +++ b/graphics/decoders/bmp.cpp @@ -130,7 +130,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0; if (bitsPerPixel == 8) { - byte *dst = (byte *)_surface->getBasePtr(0, 0); + byte *dst = (byte *)_surface->getPixels(); for (int32 i = 0; i < height; i++) { stream.read(dst + (height - i - 1) * width, width); diff --git a/graphics/decoders/iff.cpp b/graphics/decoders/iff.cpp index 60a6dafda2..7b37969fc1 100644 --- a/graphics/decoders/iff.cpp +++ b/graphics/decoders/iff.cpp @@ -170,7 +170,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { if (_type == TYPE_ILBM) { uint32 scanlinePitch = ((_header.width + 15) >> 4) << 1; byte *scanlines = new byte[scanlinePitch * _header.numPlanes]; - byte *data = (byte *)_surface->getBasePtr(0, 0); + byte *data = (byte *)_surface->getPixels(); for (uint16 i = 0; i < _header.height; ++i) { byte *scanline = scanlines; @@ -194,7 +194,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { delete[] scanlines; } else if (_type == TYPE_PBM) { - byte *data = (byte *)_surface->getBasePtr(0, 0); + byte *data = (byte *)_surface->getPixels(); uint32 outSize = _header.width * _header.height; if (_header.compression) { diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp index d2829e3576..ff018c799a 100644 --- a/graphics/decoders/jpeg.cpp +++ b/graphics/decoders/jpeg.cpp @@ -81,7 +81,7 @@ const Surface *JPEGDecoder::getSurface() const { const Graphics::Surface *uComponent = getComponent(2); const Graphics::Surface *vComponent = getComponent(3); - YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (const byte *)yComponent->getBasePtr(0, 0), (const byte *)uComponent->getBasePtr(0, 0), (const byte *)vComponent->getBasePtr(0, 0), yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); + YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (const byte *)yComponent->getPixels(), (const byte *)uComponent->getPixels(), (const byte *)vComponent->getPixels(), yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); return _rgbSurface; } diff --git a/graphics/decoders/pcx.cpp b/graphics/decoders/pcx.cpp index 5815633545..eb9b4c997d 100644 --- a/graphics/decoders/pcx.cpp +++ b/graphics/decoders/pcx.cpp @@ -117,7 +117,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { if (nPlanes == 3 && bitsPerPixel == 8) { // 24bpp Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); _surface->create(width, height, format); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 0; for (y = 0; y < height; y++) { @@ -135,7 +135,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { @@ -163,7 +163,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) && bitsPerPixel == 1) { // planar, 4, 8 or 16 colors _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp index 0b2ba9a64e..f3e17b33e2 100644 --- a/graphics/decoders/pict.cpp +++ b/graphics/decoders/pict.cpp @@ -364,7 +364,7 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa case 1: // Just copy to the image _outputSurface->create(width, height, PixelFormat::createFormatCLUT8()); - memcpy(_outputSurface->getBasePtr(0, 0), buffer, _outputSurface->w * _outputSurface->h); + memcpy(_outputSurface->getPixels(), buffer, _outputSurface->w * _outputSurface->h); break; case 2: // We have a 16-bit surface diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp index ac9689fcc8..505475213f 100644 --- a/graphics/decoders/png.cpp +++ b/graphics/decoders/png.cpp @@ -164,7 +164,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { png_set_packing(pngPtr); } else { _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); - if (!_outputSurface->getBasePtr(0, 0)) { + if (!_outputSurface->getPixels()) { error("Could not allocate memory for output image."); } if (bitDepth == 16) diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp index 3ee506f31b..a9f136d238 100644 --- a/graphics/decoders/tga.cpp +++ b/graphics/decoders/tga.cpp @@ -272,7 +272,7 @@ bool TGADecoder::readData(Common::SeekableReadStream &tga, byte imageType, byte } else if (imageType == TYPE_BW) { _surface.create(_surface.w, _surface.h, _format); - byte *data = (byte *)_surface.getBasePtr(0, 0); + byte *data = (byte *)_surface.getPixels(); uint32 count = _surface.w * _surface.h; while (count-- > 0) { @@ -318,7 +318,7 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW || imageType == TYPE_RLE_CMAP) { _surface.create(_surface.w, _surface.h, _format); uint32 count = _surface.w * _surface.h; - byte *data = (byte *)_surface.getBasePtr(0, 0); + byte *data = (byte *)_surface.getPixels(); while (count > 0) { uint32 header = tga.readByte(); diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index 2b1dca1eae..b9e9610d77 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -322,7 +322,7 @@ void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const int w = glyph.image.w; int h = glyph.image.h; - const uint8 *srcPos = (const uint8 *)glyph.image.getBasePtr(0, 0); + const uint8 *srcPos = (const uint8 *)glyph.image.getPixels(); // Make sure we are not drawing outside the screen bounds if (x < 0) { @@ -422,7 +422,7 @@ bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) { srcPitch = -srcPitch; } - uint8 *dst = (uint8 *)glyph.image.getBasePtr(0, 0); + uint8 *dst = (uint8 *)glyph.image.getPixels(); memset(dst, 0, glyph.image.h * glyph.image.pitch); switch (bitmap.pixel_mode) { diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 675328db6d..e6e4a1a298 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -77,13 +77,13 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32 static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { while (in.w / out.w >= 4 || in.h / out.h >= 4) { - createThumbnail_4<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h); + createThumbnail_4<565>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h); in.w /= 4; in.h /= 4; } while (in.w / out.w >= 2 || in.h / out.h >= 2) { - createThumbnail_2<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h); + createThumbnail_2<565>((const uint8 *)in.getPixels(), in.pitch, (uint8 *)in.getPixels(), in.pitch, in.w, in.h); in.w /= 2; in.h /= 2; } @@ -91,7 +91,7 @@ static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) { if ((in.w == out.w && in.h < out.h) || (in.w < out.w && in.h == out.h)) { // In this case we simply center the input surface in the output uint8 *dst = (uint8 *)out.getBasePtr((out.w - in.w) / 2, (out.h - in.h) / 2); - const uint8 *src = (const uint8 *)in.getBasePtr(0, 0); + const uint8 *src = (const uint8 *)in.getPixels(); for (int y = 0; y < in.h; ++y) { memcpy(dst, src, in.w * in.format.bytesPerPixel); @@ -172,7 +172,7 @@ static bool grabScreen565(Graphics::Surface *surf) { return false; assert(screen->format.bytesPerPixel == 1 || screen->format.bytesPerPixel == 2); - assert(screen->getBasePtr(0, 0) != 0); + assert(screen->getPixels() != 0); Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp index e9dfa37b03..2a485fa664 100644 --- a/graphics/yuv_to_rgb.cpp +++ b/graphics/yuv_to_rgb.cpp @@ -229,7 +229,7 @@ void convertYUV444ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->getBasePtr(0, 0)); + assert(dst && dst->getPixels()); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); @@ -237,9 +237,9 @@ void YUVToRGBManager::convert444(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV444ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV444ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV444ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV444ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } template @@ -283,7 +283,7 @@ void convertYUV420ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert420(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->getBasePtr(0, 0)); + assert(dst && dst->getPixels()); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); assert((yWidth & 1) == 0); @@ -293,9 +293,9 @@ void YUVToRGBManager::convert420(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV420ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV420ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV420ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV420ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } #define READ_QUAD(ptr, prefix) \ @@ -368,7 +368,7 @@ void convertYUV410ToRGB(byte *dstPtr, int dstPitch, const YUVToRGBLookup *lookup void YUVToRGBManager::convert410(Graphics::Surface *dst, YUVToRGBManager::LuminanceScale scale, const byte *ySrc, const byte *uSrc, const byte *vSrc, int yWidth, int yHeight, int yPitch, int uvPitch) { // Sanity checks - assert(dst && dst->getBasePtr(0, 0)); + assert(dst && dst->getPixels()); assert(dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(ySrc && uSrc && vSrc); assert((yWidth & 3) == 0); @@ -378,9 +378,9 @@ void YUVToRGBManager::convert410(Graphics::Surface *dst, YUVToRGBManager::Lumina // Use a templated function to avoid an if check on every pixel if (dst->format.bytesPerPixel == 2) - convertYUV410ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV410ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); else - convertYUV410ToRGB((byte *)dst->getBasePtr(0, 0), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); + convertYUV410ToRGB((byte *)dst->getPixels(), dst->pitch, lookup, _colorTab, ySrc, uSrc, vSrc, yWidth, yHeight, yPitch, uvPitch); } } // End of namespace Graphics -- cgit v1.2.3 From e0c9c1d261665f51a202b2446bf7ff7eff888d51 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:35:51 +0200 Subject: VIDEO: Take advantage of Surface::getPixels. --- video/codecs/cdtoons.cpp | 2 +- video/codecs/cinepak.cpp | 6 +++--- video/codecs/msrle.cpp | 2 +- video/codecs/msvideo1.cpp | 2 +- video/codecs/qtrle.cpp | 12 ++++++------ video/codecs/rpza.cpp | 2 +- video/codecs/smc.cpp | 2 +- video/coktel_decoder.cpp | 8 ++++---- video/flic_decoder.cpp | 6 +++--- video/smk_decoder.cpp | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/video/codecs/cdtoons.cpp b/video/codecs/cdtoons.cpp index f4adb11dae..68925ed0db 100644 --- a/video/codecs/cdtoons.cpp +++ b/video/codecs/cdtoons.cpp @@ -298,7 +298,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea for (uint i = 0; i < actions.size(); i++) { CDToonsAction &action = actions[i]; if (i == 0 && action.blockId == 0) - memset(_surface->getBasePtr(0, 0), backgroundColor, _surface->w * _surface->h); + memset(_surface->getPixels(), backgroundColor, _surface->w * _surface->h); if (!_blocks.contains(action.blockId)) continue; if (!action.rect.right) diff --git a/video/codecs/cinepak.cpp b/video/codecs/cinepak.cpp index 363ca43f61..a7782f4192 100644 --- a/video/codecs/cinepak.cpp +++ b/video/codecs/cinepak.cpp @@ -41,11 +41,11 @@ namespace Video { byte b = _clipTable[lum + (u << 1)]; \ \ if (_pixelFormat.bytesPerPixel == 2) \ - *((uint16 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint16 *)_curFrame.surface->getPixels() + offset) = _pixelFormat.RGBToColor(r, g, b); \ else \ - *((uint32 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint32 *)_curFrame.surface->getPixels() + offset) = _pixelFormat.RGBToColor(r, g, b); \ } else \ - *((byte *)_curFrame.surface->getBasePtr(0, 0) + offset) = lum + *((byte *)_curFrame.surface->getPixels() + offset) = lum CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() { _curFrame.surface = NULL; diff --git a/video/codecs/msrle.cpp b/video/codecs/msrle.cpp index 8efc1a9d8d..2f2ac0334f 100644 --- a/video/codecs/msrle.cpp +++ b/video/codecs/msrle.cpp @@ -53,7 +53,7 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { int x = 0; int y = _surface->h - 1; - byte *data = (byte *) _surface->getBasePtr(0, 0); + byte *data = (byte *) _surface->getPixels(); uint16 width = _surface->w; uint16 height = _surface->h; diff --git a/video/codecs/msvideo1.cpp b/video/codecs/msvideo1.cpp index dc7550f791..409d588ddf 100644 --- a/video/codecs/msvideo1.cpp +++ b/video/codecs/msvideo1.cpp @@ -48,7 +48,7 @@ MSVideo1Decoder::~MSVideo1Decoder() { void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) { byte colors[8]; - byte *pixels = (byte *)_surface->getBasePtr(0, 0); + byte *pixels = (byte *)_surface->getPixels(); uint16 stride = _surface->w; int skipBlocks = 0; diff --git a/video/codecs/qtrle.cpp b/video/codecs/qtrle.cpp index 0e356e5d63..1f1fee7997 100644 --- a/video/codecs/qtrle.cpp +++ b/video/codecs/qtrle.cpp @@ -61,7 +61,7 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Cod void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->getBasePtr(0, 0); + byte *rgb = (byte *)_surface->getPixels(); while (linesToChange) { CHECK_STREAM_PTR(2); @@ -105,7 +105,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->getBasePtr(0, 0); + byte *rgb = (byte *)_surface->getPixels(); byte numPixels = (bpp == 4) ? 8 : 16; while (linesToChange--) { @@ -165,7 +165,7 @@ void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->getBasePtr(0, 0); + byte *rgb = (byte *)_surface->getPixels(); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -210,7 +210,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint16 *rgb = (uint16 *)_surface->getBasePtr(0, 0); + uint16 *rgb = (uint16 *)_surface->getPixels(); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -248,7 +248,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); + uint32 *rgb = (uint32 *)_surface->getPixels(); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -294,7 +294,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); + uint32 *rgb = (uint32 *)_surface->getPixels(); while (linesToChange--) { CHECK_STREAM_PTR(2); diff --git a/video/codecs/rpza.cpp b/video/codecs/rpza.cpp index f4bdc380fe..17a2c53d9b 100644 --- a/video/codecs/rpza.cpp +++ b/video/codecs/rpza.cpp @@ -58,7 +58,7 @@ RPZADecoder::~RPZADecoder() { #define PUT_PIXEL(color) \ if ((int32)blockPtr < _surface->w * _surface->h) \ - WRITE_UINT16((uint16 *)_surface->getBasePtr(0, 0) + blockPtr, color); \ + WRITE_UINT16((uint16 *)_surface->getPixels() + blockPtr, color); \ blockPtr++ const Graphics::Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) { diff --git a/video/codecs/smc.cpp b/video/codecs/smc.cpp index c1b765a3cd..c0f8152547 100644 --- a/video/codecs/smc.cpp +++ b/video/codecs/smc.cpp @@ -56,7 +56,7 @@ SMCDecoder::~SMCDecoder() { } const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { - byte *pixels = (byte *)_surface->getBasePtr(0, 0); + byte *pixels = (byte *)_surface->getPixels(); uint32 numBlocks = 0; uint32 colorFlags = 0; diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 2d66e49f5a..32eef5acc3 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -122,7 +122,7 @@ const Graphics::Surface *CoktelDecoder::getSurface() const { } bool CoktelDecoder::hasSurface() { - return _surface.getBasePtr(0, 0); + return _surface.getPixels(); } void CoktelDecoder::createSurface() { @@ -1458,7 +1458,7 @@ bool IMDDecoder::renderFrame(Common::Rect &rect) { const int offsetY = (_y + rect.top) * _surface.pitch; const int offset = offsetX + offsetY; - if (deLZ77((byte *)_surface.getBasePtr(0, 0) + offset, dataPtr, dataSize, + if (deLZ77((byte *)_surface.getPixels() + offset, dataPtr, dataSize, _surface.w * _surface.h * _surface.format.bytesPerPixel - offset)) return true; } @@ -2277,7 +2277,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) { rect = Common::Rect(_x, _y, _x + codecSurf->w, _y + codecSurf->h); rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height)); - renderBlockWhole(_surface, (const byte *)codecSurf->getBasePtr(0, 0), rect); + renderBlockWhole(_surface, (const byte *)codecSurf->getPixels(), rect); return true; } @@ -2298,7 +2298,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) { const int offsetY = (_y + rect.top) * _surface.pitch; const int offset = offsetX + offsetY; - if (deLZ77((byte *)_surface.getBasePtr(0, 0) + offset, dataPtr, dataSize, + if (deLZ77((byte *)_surface.getPixels() + offset, dataPtr, dataSize, _surface.w * _surface.h * _surface.format.bytesPerPixel - offset)) return true; } diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp index a295c3e342..317dc14691 100644 --- a/video/flic_decoder.cpp +++ b/video/flic_decoder.cpp @@ -252,7 +252,7 @@ void FlicDecoder::FlicVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) } void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) { - memcpy((byte *)_surface->getBasePtr(0, 0), data, getWidth() * getHeight()); + memcpy((byte *)_surface->getPixels(), data, getWidth() * getHeight()); // Redraw _dirtyRects.clear(); @@ -260,8 +260,8 @@ void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) { } void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) { - byte *ptr = (byte *)_surface->getBasePtr(0, 0); - while ((int32)(ptr - (byte *)_surface->getBasePtr(0, 0)) < (getWidth() * getHeight())) { + byte *ptr = (byte *)_surface->getPixels(); + while ((int32)(ptr - (byte *)_surface->getPixels()) < (getWidth() * getHeight())) { int chunks = *data++; while (chunks--) { int count = (int8)*data++; diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index 356ec8e45b..3dbcebcde4 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -580,7 +580,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { while (run-- && block < blocks) { clr = _MClrTree->getCode(bs); map = _MMapTree->getCode(bs); - out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getPixels() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; hi = clr >> 8; lo = clr & 0xff; for (i = 0; i < 4; i++) { @@ -613,7 +613,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { } while (run-- && block < blocks) { - out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getPixels() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; switch (mode) { case 0: for (i = 0; i < 4; ++i) { @@ -679,7 +679,7 @@ void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) { uint32 col; mode = type >> 8; while (run-- && block < blocks) { - out = (byte *)_surface->getBasePtr(0, 0) + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; + out = (byte *)_surface->getPixels() + (block / bw) * (stride * 4 * doubleY) + (block % bw) * 4; col = mode * 0x01010101; for (i = 0; i < 4 * doubleY; ++i) { out[0] = out[1] = out[2] = out[3] = col; -- cgit v1.2.3 From b1bd9322a1867d95d0faa7a3ce2865b8ead8d3f8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:36:28 +0200 Subject: GUI: Take advantage of Surface::getPixels. --- gui/EventRecorder.cpp | 2 +- gui/ThemeEngine.cpp | 10 +++++----- gui/widget.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 4f569b75c5..4bf5832864 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -522,7 +522,7 @@ bool EventRecorder::grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5 warning("Can't save screenshot"); return false; } - Common::MemoryReadStream bitmapStream((const byte*)screen.getBasePtr(0, 0), screen.w * screen.h * screen.format.bytesPerPixel); + Common::MemoryReadStream bitmapStream((const byte*)screen.getPixels(), screen.w * screen.h * screen.format.bytesPerPixel); computeStreamMD5(bitmapStream, md5); return true; } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 80f3946729..0f8b449b58 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -389,7 +389,7 @@ bool ThemeEngine::init() { _overlayFormat = _system->getOverlayFormat(); setGraphicsMode(_graphicsMode); - if (_screen.getBasePtr(0, 0) && _backBuffer.getBasePtr(0, 0)) { + if (_screen.getPixels() && _backBuffer.getPixels()) { _initOk = true; } @@ -439,7 +439,7 @@ bool ThemeEngine::init() { void ThemeEngine::clearAll() { if (_initOk) { _system->clearOverlay(); - _system->grabOverlay(_screen.getBasePtr(0, 0), _screen.pitch); + _system->grabOverlay(_screen.getPixels(), _screen.pitch); } } @@ -1219,7 +1219,7 @@ void ThemeEngine::updateScreen(bool render) { } _vectorRenderer->setSurface(&_screen); - memcpy(_screen.getBasePtr(0, 0), _backBuffer.getBasePtr(0, 0), _screen.pitch * _screen.h); + memcpy(_screen.getPixels(), _backBuffer.getPixels(), _screen.pitch * _screen.h); _bufferQueue.clear(); } @@ -1287,7 +1287,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { addDirtyRect(Common::Rect(0, 0, _screen.w, _screen.h)); } - memcpy(_backBuffer.getBasePtr(0, 0), _screen.getBasePtr(0, 0), _screen.pitch * _screen.h); + memcpy(_backBuffer.getPixels(), _screen.getPixels(), _screen.pitch * _screen.h); _vectorRenderer->setSurface(&_screen); } @@ -1326,7 +1326,7 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; Common::HashMap colorToIndex; - const OverlayColor *src = (const OverlayColor *)cursor->getBasePtr(0, 0); + const OverlayColor *src = (const OverlayColor *)cursor->getPixels(); for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { byte r, g, b; diff --git a/gui/widget.cpp b/gui/widget.cpp index 197250a940..d97c46a5cc 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -396,7 +396,7 @@ PicButtonWidget::~PicButtonWidget() { void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->getBasePtr(0, 0)) + if (!gfx || !gfx->getPixels()) return; if (gfx->format.bytesPerPixel == 1) { @@ -429,7 +429,7 @@ void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (_gfx.getBasePtr(0, 0)) { + if (_gfx.getPixels()) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); @@ -646,7 +646,7 @@ GraphicsWidget::~GraphicsWidget() { void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->getBasePtr(0, 0)) + if (!gfx || !gfx->getPixels()) return; if (gfx->format.bytesPerPixel == 1) { @@ -676,7 +676,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (_gfx.getBasePtr(0, 0)) { + if (_gfx.getPixels()) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); -- cgit v1.2.3 From 0a1cbac76ac66876d187d2951c671a86a4812a59 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:36:43 +0200 Subject: SCUMM: Take advantage of Surface::getPixels. --- engines/scumm/charset.cpp | 2 +- engines/scumm/gfx.cpp | 4 ++-- engines/scumm/gfx_towns.cpp | 2 +- engines/scumm/he/animation_he.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 6e289b2afc..298fb149f4 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -799,7 +799,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, if (ignoreCharsetMask || !vs->hasTwoBuffers) { dstPtr = vs->getPixels(0, 0); } else { - dstPtr = (byte *)_vm->_textSurface.getBasePtr(0, 0); + dstPtr = (byte *)_vm->_textSurface.getPixels(); } if (_blitAlso && vs->hasTwoBuffers) { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 41899da0a3..3da07610eb 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -612,7 +612,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Some paranoia checks assert(top >= 0 && bottom <= vs->h); assert(x >= 0 && width <= vs->pitch); - assert(_textSurface.getBasePtr(0, 0)); + assert(_textSurface.getPixels()); // Perform some clipping if (width > vs->w - x) @@ -1135,7 +1135,7 @@ void ScummEngine::clearTextSurface() { _townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0); #endif - fill((byte *)_textSurface.getBasePtr(0, 0), _textSurface.pitch, + fill((byte *)_textSurface.getPixels(), _textSurface.pitch, #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE _game.platform == Common::kPlatformFMTowns ? 0 : #endif diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp index a803b6e511..0aed181afd 100644 --- a/engines/scumm/gfx_towns.cpp +++ b/engines/scumm/gfx_towns.cpp @@ -34,7 +34,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in if (width <= 0 || height <= 0) return; - assert(_textSurface.getBasePtr(0, 0)); + assert(_textSurface.getPixels()); int m = _textSurfaceMultiplier; diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 7ae5547702..d01b456c8b 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -90,7 +90,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint if (!surface) return; - const byte *src = (const byte *)surface->getBasePtr(0, 0); + const byte *src = (const byte *)surface->getPixels(); if (_video->hasDirtyPalette()) _vm->setPaletteFromPtr(_video->getPalette(), 256); -- cgit v1.2.3 From 01daff0f1d5f222e7b892f3068e7ef6880b40346 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:36:55 +0200 Subject: AGOS: Take advantage of Surface::getPixels. --- engines/agos/animation.cpp | 8 ++++---- engines/agos/charset-fontdata.cpp | 8 ++++---- engines/agos/draw.cpp | 28 +++++++++++++-------------- engines/agos/gfx.cpp | 40 +++++++++++++++++++-------------------- engines/agos/icons.cpp | 10 +++++----- engines/agos/vga.cpp | 6 +++--- engines/agos/vga_e2.cpp | 4 ++-- engines/agos/vga_pn.cpp | 2 +- engines/agos/vga_ww.cpp | 2 +- engines/agos/window.cpp | 2 +- 10 files changed, 55 insertions(+), 55 deletions(-) diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 214a383680..40c9d1d049 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -272,7 +272,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { if (!surface) return; - const byte *src = (const byte *)surface->getBasePtr(0, 0); + const byte *src = (const byte *)surface->getPixels(); dst += y * pitch + x; do { @@ -344,7 +344,7 @@ void MoviePlayerDXA::handleNextFrame() { bool MoviePlayerDXA::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->getBasePtr(0, 0), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); + copyFrameToBuffer((byte *)screen->getPixels(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); _vm->_system->unlockScreen(); uint32 soundTime = _mixer->getSoundElapsedTime(_bgSound); @@ -443,7 +443,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { if (!surface) return; - const byte *src = (const byte *)surface->getBasePtr(0, 0); + const byte *src = (const byte *)surface->getPixels(); dst += y * pitch + x; do { @@ -495,7 +495,7 @@ void MoviePlayerSMK::nextFrame() { bool MoviePlayerSMK::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->getBasePtr(0, 0), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); + copyFrameToBuffer((byte *)screen->getPixels(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, screen->pitch); _vm->_system->unlockScreen(); uint32 waitTime = getTimeToNextFrame(); diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp index b67b307606..b6b90eefcc 100644 --- a/engines/agos/charset-fontdata.cpp +++ b/engines/agos/charset-fontdata.cpp @@ -2924,7 +2924,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dstPitch = screen->pitch; h = 8; w = 6; @@ -2961,7 +2961,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dstPitch = screen->pitch; h = 8; w = 6; @@ -2986,14 +2986,14 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA1) { - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dstPitch = screen->pitch; h = 8; w = 6; src = english_elvira1Font + (chr - 32) * 8; } else { - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dstPitch = screen->pitch; h = 8; w = 8; diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index 63bd22f65b..d27aed29db 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -32,15 +32,15 @@ namespace AGOS { byte *AGOSEngine::getBackBuf() { - return (byte *)_backBuf->getBasePtr(0, 0); + return (byte *)_backBuf->getPixels(); } byte *AGOSEngine::getBackGround() { - return (byte *)_backGroundBuf->getBasePtr(0, 0); + return (byte *)_backGroundBuf->getPixels(); } byte *AGOSEngine::getScaleBuf() { - return (byte *)_scaleBuf->getBasePtr(0, 0); + return (byte *)_scaleBuf->getPixels(); } #ifdef ENABLE_AGOS2 @@ -226,7 +226,7 @@ void AGOSEngine::animateSprites() { debug(0, "Using special wall"); uint8 color, h, len; - byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); + byte *dst = (byte *)_window4BackScn->getPixels(); color = (_variableArray[293] & 1) ? 13 : 15; _wallOn = 2; @@ -256,7 +256,7 @@ void AGOSEngine::animateSprites() { } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) { // Used by the Unholy Barrier spell uint8 color, h, len; - byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); + byte *dst = (byte *)_window4BackScn->getPixels(); color = 1; _wallOn = 2; @@ -491,7 +491,7 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) { int16 y = vsp->y - _scrollY; if (_window3Flag == 1) { - animTable->srcPtr = (const byte *)_window4BackScn->getBasePtr(0, 0); + animTable->srcPtr = (const byte *)_window4BackScn->getPixels(); } else { int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8; int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y); @@ -565,7 +565,7 @@ void AGOSEngine::displayBoxStars() { if (x_ >= 311) continue; - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += (((screen->pitch / 4) * y_) * 4) + x_; @@ -673,7 +673,7 @@ void AGOSEngine::scrollScreen() { if (getGameType() == GType_SIMON2) { src = getBackGround(); - dst = (byte *)_window4BackScn->getBasePtr(0, 0); + dst = (byte *)_window4BackScn->getPixels(); for (int i = 0; i < _scrollHeight; i++) { memcpy(dst, src, _screenWidth); src += _backGroundBuf->pitch; @@ -725,7 +725,7 @@ void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) { void AGOSEngine::fillBackFromFront() { Graphics::Surface *screen = _system->lockScreen(); - byte *src = (byte *)screen->getBasePtr(0, 0); + byte *src = (byte *)screen->getPixels(); byte *dst = getBackBuf(); for (int i = 0; i < _screenHeight; i++) { @@ -748,7 +748,7 @@ void AGOSEngine::fillBackGroundFromBack() { void AGOSEngine::fillBackGroundFromFront() { Graphics::Surface *screen = _system->lockScreen(); - byte *src = (byte *)screen->getBasePtr(0, 0); + byte *src = (byte *)screen->getPixels(); byte *dst = getBackGround(); for (int i = 0; i < _screenHeight; i++) { @@ -785,7 +785,7 @@ void AGOSEngine::displayScreen() { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_PP || getGameType() == GType_FF) { byte *src = getBackBuf(); - byte *dst = (byte *)screen->getBasePtr(0, 0); + byte *dst = (byte *)screen->getPixels(); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += _backBuf->pitch; @@ -798,9 +798,9 @@ void AGOSEngine::displayScreen() { _window4Flag = 0; uint16 srcWidth, width, height; - byte *dst = (byte *)screen->getBasePtr(0, 0); + byte *dst = (byte *)screen->getPixels(); - const byte *src = (const byte *)_window4BackScn->getBasePtr(0, 0); + const byte *src = (const byte *)_window4BackScn->getPixels(); if (_window3Flag == 1) { src = getBackGround(); } @@ -831,7 +831,7 @@ void AGOSEngine::displayScreen() { if (_window6Flag == 2) { _window6Flag = 0; - byte *src = (byte *)_window6BackScn->getBasePtr(0, 0); + byte *src = (byte *)_window6BackScn->getPixels(); byte *dst = (byte *)screen->getBasePtr(0, 51); for (int i = 0; i < 80; i++) { memcpy(dst, src, _window6BackScn->w); diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index 2808543f8e..266fcc9796 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -649,7 +649,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _window4BackScn->pitch; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -666,7 +666,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -678,7 +678,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -696,7 +696,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _window4BackScn->pitch; } @@ -712,7 +712,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -861,7 +861,7 @@ void AGOSEngine::drawImage(VC10_state *state) { uint16 xoffs = 0, yoffs = 0; if (getGameType() == GType_WW) { if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) { - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -873,7 +873,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -881,7 +881,7 @@ void AGOSEngine::drawImage(VC10_state *state) { } } else if (getGameType() == GType_ELVIRA2) { if (_windowNum == 4 || _windowNum >= 10) { - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -893,7 +893,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -901,19 +901,19 @@ void AGOSEngine::drawImage(VC10_state *state) { } } else if (getGameType() == GType_ELVIRA1) { if (_windowNum == 6) { - state->surf_addr = (byte *)_window6BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window6BackScn->getPixels(); state->surf_pitch = _window6BackScn->pitch; xoffs = state->x * 8; yoffs = state->y; } else if (_windowNum == 2 || _windowNum == 3) { - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; } else { - state->surf_addr = (byte *)_window4BackScn->getBasePtr(0, 0); + state->surf_addr = (byte *)_window4BackScn->getPixels(); state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -926,7 +926,7 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } } else { - state->surf_addr = (byte *)screen->getBasePtr(0, 0); + state->surf_addr = (byte *)screen->getPixels(); state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; @@ -973,7 +973,7 @@ void AGOSEngine::horizontalScroll(VC10_state *state) { vcWriteVar(251, _scrollX); if (getGameType() == GType_SIMON2) { - dst = (byte *)_window4BackScn->getBasePtr(0, 0); + dst = (byte *)_window4BackScn->getPixels(); dstPitch = _window4BackScn->pitch; } else { dst = getBackBuf(); @@ -1375,7 +1375,7 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) { // The DOS Floppy demo was based off Waxworks engine if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->getBasePtr(0, 0); + src = (byte *)_window4BackScn->getPixels(); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { src = (byte *)screen->getBasePtr(xoffs, yoffs); @@ -1387,7 +1387,7 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_SIMON1) { if (updateWindow == 4) { - src = (byte *)_window4BackScn->getBasePtr(0, 0); + src = (byte *)_window4BackScn->getPixels(); srcWidth = _videoWindows[18] * 16; } else if (updateWindow >= 10) { src = (byte *)_window4BackScn->getBasePtr(xoffs, yoffs); @@ -1402,7 +1402,7 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_WW) { if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->getBasePtr(0, 0); + src = (byte *)_window4BackScn->getPixels(); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { src = (byte *)screen->getBasePtr(xoffs, yoffs); @@ -1414,7 +1414,7 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_ELVIRA2) { if (updateWindow == 4 || updateWindow >= 10) { - src = (byte *)_window4BackScn->getBasePtr(0, 0); + src = (byte *)_window4BackScn->getPixels(); srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3) { src = (byte *)screen->getBasePtr(xoffs, yoffs); @@ -1427,13 +1427,13 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } else if (getGameType() == GType_ELVIRA1) { if (updateWindow == 6) { _window6Flag = 1; - src = (byte *)_window6BackScn->getBasePtr(0, 0); + src = (byte *)_window6BackScn->getPixels(); srcWidth = 48; } else if (updateWindow == 2 || updateWindow == 3) { src = (byte *)screen->getBasePtr(xoffs, yoffs); srcWidth = screen->pitch; } else { - src = (byte *)_window4BackScn->getBasePtr(0, 0); + src = (byte *)_window4BackScn->getPixels(); srcWidth = _videoWindows[18] * 16; } } else { diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index 558e7f9adb..6d4192da2a 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -202,7 +202,7 @@ void AGOSEngine_Simon2::drawIcon(WindowBlock *window, uint icon, uint x, uint y) _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += 110; dst += x; @@ -228,7 +228,7 @@ void AGOSEngine_Simon1::drawIcon(WindowBlock *window, uint icon, uint x, uint y) _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += (x + window->x) * 8; dst += (y * 25 + window->y) * screen->pitch; @@ -256,7 +256,7 @@ void AGOSEngine_Waxworks::drawIcon(WindowBlock *window, uint icon, uint x, uint _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += (x + window->x) * 8; dst += (y * 20 + window->y) * screen->pitch; @@ -284,7 +284,7 @@ void AGOSEngine_Elvira2::drawIcon(WindowBlock *window, uint icon, uint x, uint y _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += (x + window->x) * 8; dst += (y * 8 + window->y) * screen->pitch; @@ -312,7 +312,7 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); dst += (x + window->x) * 8; dst += (y * 8 + window->y) * screen->pitch; diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 5456174f5d..cc5ede5f2c 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1179,7 +1179,7 @@ void AGOSEngine::vc32_saveScreen() { if (getGameType() == GType_PN) { Graphics::Surface *screen = _system->lockScreen(); byte *dst = getBackGround(); - byte *src = (byte *)screen->getBasePtr(0, 0); + byte *src = (byte *)screen->getPixels(); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); dst += _backGroundBuf->pitch; @@ -1193,7 +1193,7 @@ void AGOSEngine::vc32_saveScreen() { uint16 height = _videoWindows[4 * 4 + 3]; byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs); - byte *src = (byte *)_window4BackScn->getBasePtr(0, 0); + byte *src = (byte *)_window4BackScn->getPixels(); uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16; for (; height > 0; height--) { memcpy(dst, src, width); @@ -1247,7 +1247,7 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) { if (getGameType() == GType_ELVIRA1 && num == 3) { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->getBasePtr(0, 0); + byte *dst = (byte *)screen->getPixels(); for (int i = 0; i < _screenHeight; i++) { memset(dst, color, _screenWidth); dst += screen->pitch; diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index b335c6b18a..4eb337c687 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -76,7 +76,7 @@ void AGOSEngine::vc45_setWindowPalette() { uint8 height = vlut[3]; if (num == 4) { - byte *dst = (byte *)_window4BackScn->getBasePtr(0, 0); + byte *dst = (byte *)_window4BackScn->getPixels(); for (uint8 h = 0; h < height; h++) { for (uint8 w = 0; w < width; w++) { @@ -378,7 +378,7 @@ void AGOSEngine::fullFade() { void AGOSEngine::vc56_fullScreen() { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->getBasePtr(0, 0); + byte *dst = (byte *)screen->getPixels(); byte *src = _curVgaFile2 + 800; for (int i = 0; i < _screenHeight; i++) { diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index dc364cd99b..b7f80ebf91 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -155,7 +155,7 @@ void AGOSEngine::vc48_specialEffect() { if (getPlatform() == Common::kPlatformDOS) { if (num == 1) { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->getBasePtr(0, 0); + byte *dst = (byte *)screen->getPixels(); for (uint h = 0; h < _screenHeight; h++) { for (uint w = 0; w < _screenWidth; w++) { diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp index f0e081182e..ca93fa9fec 100644 --- a/engines/agos/vga_ww.cpp +++ b/engines/agos/vga_ww.cpp @@ -143,7 +143,7 @@ void AGOSEngine::vc61() { uint h, tmp; Graphics::Surface *screen = _system->lockScreen(); - dstPtr = (byte *)screen->getBasePtr(0, 0); + dstPtr = (byte *)screen->getPixels(); if (a == 6) { src = _curVgaFile2 + 800; diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp index 95dbabf0fd..892df92554 100644 --- a/engines/agos/window.cpp +++ b/engines/agos/window.cpp @@ -232,7 +232,7 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) { uint i; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->getBasePtr(0, 0); + dst = (byte *)screen->getPixels(); src = getBackGround(); dst += y * screen->pitch; -- cgit v1.2.3 From c87472110996a1a1ac03692287ac121b572a0753 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:38:08 +0200 Subject: CGE: Take advantage of Surface::getPixels. --- engines/cge/cge_main.cpp | 2 +- engines/cge/vga13h.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index c6c7acd1f5..ae4dee6090 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -358,7 +358,7 @@ void CGEEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &he // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface *s = _vga->_page[0]; - ::createThumbnail(thumb, (const byte *)s->getBasePtr(0, 0), kScrWidth, kScrHeight, thumbPalette); + ::createThumbnail(thumb, (const byte *)s->getPixels(), kScrWidth, kScrHeight, thumbPalette); Graphics::saveThumbnail(*out, *thumb); thumb->free(); delete thumb; diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index ddcbcea47c..c0407cab42 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -826,7 +826,7 @@ void Vga::update() { } } - g_system->copyRectToScreen(Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight); + g_system->copyRectToScreen(Vga::_page[0]->getPixels(), kScrWidth, 0, 0, kScrWidth, kScrHeight); g_system->updateScreen(); } -- cgit v1.2.3 From 3fbc497e1c7fddc543aabf5886ccf364a3416efc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:38:22 +0200 Subject: COMPOSER: Take advantage of Surface::getPixels. --- engines/composer/graphics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp index a751da20a3..caf3ba3a40 100644 --- a/engines/composer/graphics.cpp +++ b/engines/composer/graphics.cpp @@ -39,7 +39,7 @@ bool Sprite::contains(const Common::Point &pos) const { return false; if (adjustedPos.y < 0 || adjustedPos.y >= _surface.h) return false; - const byte *pixels = (const byte *)_surface.getBasePtr(0, 0); + const byte *pixels = (const byte *)_surface.getPixels(); return (pixels[(_surface.h - adjustedPos.y - 1) * _surface.w + adjustedPos.x] != 0); } @@ -794,7 +794,7 @@ bool ComposerEngine::initSprite(Sprite &sprite) { if (width > 0 && height > 0) { sprite._surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - decompressBitmap(type, stream, (byte *)sprite._surface.getBasePtr(0, 0), size, width, height); + decompressBitmap(type, stream, (byte *)sprite._surface.getPixels(), size, width, height); } else { // there are some sprites (e.g. a -998x-998 one in Gregory's title screen) // which have an invalid size, but the original engine doesn't notice for @@ -814,7 +814,7 @@ void ComposerEngine::drawSprite(const Sprite &sprite) { int y = sprite._pos.y; // incoming data is BMP-style (bottom-up), so flip it - byte *pixels = (byte *)_screen.getBasePtr(0, 0); + byte *pixels = (byte *)_screen.getPixels(); for (int j = 0; j < sprite._surface.h; j++) { if (j + y < 0) continue; -- cgit v1.2.3 From f8ffe816d600a83cacc0063f0ef69d18325f1cdf Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:38:33 +0200 Subject: DRACI: Take advantage of Surface::getPixels. --- engines/draci/screen.cpp | 4 ++-- engines/draci/surface.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp index 8c1a0c40f7..e43e367300 100644 --- a/engines/draci/screen.cpp +++ b/engines/draci/screen.cpp @@ -110,7 +110,7 @@ void Screen::copyToScreen() { // If a full update is needed, update the whole screen if (_surface->needsFullUpdate()) { - byte *ptr = (byte *)_surface->getBasePtr(0, 0); + byte *ptr = (byte *)_surface->getPixels(); _vm->_system->copyRectToScreen(ptr, kScreenWidth, 0, 0, kScreenWidth, kScreenHeight); @@ -138,7 +138,7 @@ void Screen::copyToScreen() { * Clears the screen and marks the whole screen dirty. */ void Screen::clearScreen() { - byte *ptr = (byte *)_surface->getBasePtr(0, 0); + byte *ptr = (byte *)_surface->getPixels(); _surface->markDirty(); diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 8380f8777b..3676c6edac 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -80,7 +80,7 @@ void Surface::markClean() { * @brief Fills the surface with the specified color */ void Surface::fill(uint color) { - byte *ptr = (byte *)getBasePtr(0, 0); + byte *ptr = (byte *)getPixels(); memset(ptr, color, w * h); } -- cgit v1.2.3 From acfdfd46d16f840842b1e632d3af216d0d2c156f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:38:46 +0200 Subject: DRASCULA: Take advantage of Surface::getPixels. --- engines/drascula/graphics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index aa13192b25..31d03a94a7 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -132,7 +132,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra byte *prevFrame = (byte *)malloc(64000); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); + byte *screenBuffer = (byte *)screenSurf->getPixels(); uint16 screenPitch = screenSurf->pitch; for (int y = 0; y < 200; y++) { memcpy(prevFrame+y*320, screenBuffer+y*screenPitch, 320); @@ -449,7 +449,7 @@ void DrasculaEngine::screenSaver() { int x1_, y1_, off1, off2; Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); + byte *screenBuffer = (byte *)screenSurf->getPixels(); uint16 screenPitch = screenSurf->pitch; for (int i = 0; i < 200; i++) { for (int j = 0; j < 320; j++) { @@ -538,7 +538,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) { waitFrameSSN(); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); + byte *screenBuffer = (byte *)screenSurf->getPixels(); uint16 screenPitch = screenSurf->pitch; if (FrameSSN) mixVideo(screenBuffer, screenSurface, screenPitch); @@ -557,7 +557,7 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) { free(BufferSSN); waitFrameSSN(); Graphics::Surface *screenSurf = _system->lockScreen(); - byte *screenBuffer = (byte *)screenSurf->getBasePtr(0, 0); + byte *screenBuffer = (byte *)screenSurf->getPixels(); uint16 screenPitch = screenSurf->pitch; if (FrameSSN) mixVideo(screenBuffer, screenSurface, screenPitch); -- cgit v1.2.3 From 63a2e47bfe2a0be8bc717a4274e94f78a98a9000 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:39:04 +0200 Subject: GOB: Take advantage of Surface::getPixels. --- engines/gob/surface.cpp | 2 +- engines/gob/videoplayer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 0090045b45..870b0f15b3 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -821,7 +821,7 @@ bool Surface::loadIFF(Common::SeekableReadStream &stream) { return false; resize(decoder.getSurface()->w, decoder.getSurface()->h); - memcpy(_vidMem, decoder.getSurface()->getBasePtr(0, 0), decoder.getSurface()->w * decoder.getSurface()->h); + memcpy(_vidMem, decoder.getSurface()->getPixels(), decoder.getSurface()->w * decoder.getSurface()->h); return true; } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 8d37c59a85..155989ccee 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -738,7 +738,7 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest, // is only used read-only in this case (as far as I can tell). Not casting // the const qualifier away will lead to an additional allocation and copy // of the frame data which is undesirable. - Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast(surface->getBasePtr(0, 0))); + Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast(surface->getPixels())); dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp); return true; -- cgit v1.2.3 From 254dea1a35bedd8a9093680eafca9cdb780cb0f5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:39:22 +0200 Subject: GROOVIE: Take advantage of Surface::getPixels. --- engines/groovie/graphics.cpp | 6 +++--- engines/groovie/roq.cpp | 14 +++++++------- engines/groovie/script.cpp | 4 ++-- engines/groovie/vdx.cpp | 14 +++++++------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp index 73eb574dec..a4d8a4330c 100644 --- a/engines/groovie/graphics.cpp +++ b/engines/groovie/graphics.cpp @@ -82,8 +82,8 @@ void GraphicsMan::mergeFgAndBg() { uint32 i; byte *countf, *countb; - countf = (byte *)_foreground.getBasePtr(0, 0); - countb = (byte *)_background.getBasePtr(0, 0); + countf = (byte *)_foreground.getPixels(); + countb = (byte *)_background.getPixels(); for (i = 640 * 320; i; i--) { if (255 == *(countf)) { *(countf) = *(countb); @@ -94,7 +94,7 @@ void GraphicsMan::mergeFgAndBg() { } void GraphicsMan::updateScreen(Graphics::Surface *source) { - _vm->_system->copyRectToScreen(source->getBasePtr(0, 0), 640, 0, 80, 640, 320); + _vm->_system->copyRectToScreen(source->getPixels(), 640, 0, 80, 640, 320); change(); } diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 72a61fefb2..f9a938bfd4 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -160,7 +160,7 @@ bool ROQPlayer::playFrameInternal() { if (_dirty) { // Update the screen - _syst->copyRectToScreen(_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h); + _syst->copyRectToScreen(_bg->getPixels(), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h); _syst->updateScreen(); // Clear the dirty flag @@ -291,8 +291,8 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) { } // Clear the buffers with black YUV values - byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0); - byte *ptr2 = (byte *)_prevBuf->getBasePtr(0, 0); + byte *ptr1 = (byte *)_currBuf->getPixels(); + byte *ptr2 = (byte *)_prevBuf->getPixels(); for (int i = 0; i < width * height; i++) { *ptr1++ = 0; *ptr1++ = 128; @@ -436,11 +436,11 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) { Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder(); jpg->loadStream(*_file); - const byte *y = (const byte *)jpg->getComponent(1)->getBasePtr(0, 0); - const byte *u = (const byte *)jpg->getComponent(2)->getBasePtr(0, 0); - const byte *v = (const byte *)jpg->getComponent(3)->getBasePtr(0, 0); + const byte *y = (const byte *)jpg->getComponent(1)->getPixels(); + const byte *u = (const byte *)jpg->getComponent(2)->getPixels(); + const byte *v = (const byte *)jpg->getComponent(3)->getPixels(); - byte *ptr = (byte *)_currBuf->getBasePtr(0, 0); + byte *ptr = (byte *)_currBuf->getPixels(); for (int i = 0; i < _currBuf->w * _currBuf->h; i++) { *ptr++ = *y++; *ptr++ = *u++; diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index cbbdecc3e7..8e3bef9945 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -373,7 +373,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) { DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) { rect.translate(0, -80); _vm->_graphicsMan->_foreground.frameRect(rect, 250); - _vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320); + _vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320); _vm->_system->updateScreen(); } @@ -983,7 +983,7 @@ void Script::o_strcmpnejmp_var() { // 0x21 void Script::o_copybgtofg() { // 0x22 debugScript(1, true, "COPY_BG_TO_FG"); - memcpy(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_background.getBasePtr(0, 0), 640 * 320); + memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * 320); } void Script::o_strcmpeqjmp() { // 0x23 diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index 8786e75488..59d966a22f 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -358,7 +358,7 @@ void VDXPlayer::getStill(Common::ReadStream *in) { byte *buf; if (_flagOne) { // Paint to the foreground - buf = (byte *)_fg->getBasePtr(0, 0); + buf = (byte *)_fg->getPixels(); if (_flag2Byte) { mask = 0xff; } else { @@ -370,7 +370,7 @@ void VDXPlayer::getStill(Common::ReadStream *in) { _flagFirstFrame = true; } else { // Paint to the background - buf = (byte *)_bg->getBasePtr(0, 0); + buf = (byte *)_bg->getPixels(); } // Read the palette @@ -486,9 +486,9 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth) // TODO: Verify just the else block is required //if (_flagOne) { // Paint to the foreground - //dest = (byte *)_fg->getBasePtr(0, 0) + offset; + //dest = (byte *)_fg->getPixels() + offset; //} else { - dest = (byte *)_bg->getBasePtr(0, 0) + offset; + dest = (byte *)_bg->getPixels() + offset; //} // Move the pointers to the beginning of the current block @@ -496,8 +496,8 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth) dest += blockOff; byte *fgBuf = 0; if (_flagSeven) { - fgBuf = (byte *)_fg->getBasePtr(0, 0) + offset + blockOff; - //byte *bgBuf = (byte *)_bg->getBasePtr(0, 0) + offset + blockOff; + fgBuf = (byte *)_fg->getPixels() + offset + blockOff; + //byte *bgBuf = (byte *)_bg->getPixels() + offset + blockOff; } for (int y = TILE_SIZE; y; y--) { @@ -550,7 +550,7 @@ void VDXPlayer::fadeIn(uint8 *targetpal) { // TODO: Is it required? If so, move to an appropiate place // Copy the foreground to the background - memcpy((byte *)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), (byte *)_vm->_graphicsMan->_background.getBasePtr(0, 0), 640 * 320); + memcpy((byte *)_vm->_graphicsMan->_foreground.getPixels(), (byte *)_vm->_graphicsMan->_background.getPixels(), 640 * 320); // Start a fadein _vm->_graphicsMan->fadeIn(targetpal); -- cgit v1.2.3 From cad9148f851df68e030dfa858b5cdd56d3b2a4ac Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:39:37 +0200 Subject: HOPKINS: Take advantage of Surface::getPixels. --- engines/hopkins/dialogs.cpp | 2 +- engines/hopkins/graphics.cpp | 4 ++-- engines/hopkins/saveload.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 32b8cd8256..3b8fedf0ee 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -691,7 +691,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) { Graphics::Surface thumb8; _vm->_saveLoad->convertThumb16To8(header._thumbnail, &thumb8); - byte *thumb = (byte *)thumb8.getBasePtr(0, 0); + byte *thumb = (byte *)thumb8.getPixels(); int16 startPosX_ = _vm->_events->_startPos.x; switch (slotNumber) { diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7fe9943dbb..66ddbfaae6 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -325,7 +325,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte // Copy out the dimensions and pixels of the decoded surface _largeScreenFl = s->w > SCREEN_WIDTH; - Common::copy((const byte *)s->getBasePtr(0, 0), (const byte *)s->getBasePtr(0, s->h), surface); + Common::copy((const byte *)s->getPixels(), (const byte *)s->getBasePtr(0, s->h), surface); // Copy out the palette const byte *palSrc = pcxDecoder.getPalette(); @@ -1202,7 +1202,7 @@ void GraphicsManager::displayZones() { void GraphicsManager::displayLines() { Graphics::Surface *screenSurface = g_system->lockScreen(); - uint16 *pixels = (uint16 *)screenSurface->getBasePtr(0, 0); + uint16 *pixels = (uint16 *)screenSurface->getPixels(); for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { int i = 0; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 3a1f596c52..b0dea7e6d1 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -233,14 +233,14 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { Graphics::Surface thumb8; thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.getBasePtr(0, 0), + _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.getPixels(), _vm->_events->_startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80); // Convert the 8-bit pixel to 16 bit surface s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); - const byte *srcP = (const byte *)thumb8.getBasePtr(0, 0); - uint16 *destP = (uint16 *)s->getBasePtr(0, 0); + const byte *srcP = (const byte *)thumb8.getPixels(); + uint16 *destP = (uint16 *)s->getPixels(); for (int yp = 0; yp < h; ++yp) { // Copy over the line, using the source pixels as lookups into the pixels palette @@ -299,8 +299,8 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]); } - const uint16 *srcP = (const uint16 *)thumb16->getBasePtr(0, 0); - byte *destP = (byte *)thumb8->getBasePtr(0, 0); + const uint16 *srcP = (const uint16 *)thumb16->getPixels(); + byte *destP = (byte *)thumb8->getPixels(); for (int yp = 0; yp < thumb16->h; ++yp) { const uint16 *lineSrcP = srcP; -- cgit v1.2.3 From 2578ec6e2f4f71730cd89ed8c88711aa4e377f28 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:39:49 +0200 Subject: HUGO: Take advantage of Surface::getPixels. --- engines/hugo/dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index 0fc4c87683..5dcee3ae94 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -140,8 +140,8 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { _arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat()); _arrayBmp[i * 2 + 1] = new Graphics::Surface(); _arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat()); - byte *src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, 0); - byte *dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, 0); + byte *src = (byte *)_arrayBmp[i * 2]->getPixels(); + byte *dst = (byte *)_arrayBmp[i * 2 + 1]->getPixels(); for (int j = 0; j < _arrayBmp[i * 2]->h; j++) { src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j); -- cgit v1.2.3 From bcc4a3d0b839b7d750d7c6dbb022cab165a743e8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:40:01 +0200 Subject: LASTEXRPESS: Take advantage of Surface::getPixels. --- engines/lastexpress/data/animation.cpp | 2 +- engines/lastexpress/data/sequence.cpp | 12 ++++++------ engines/lastexpress/graphics.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index e9500aec38..832bcc2e26 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -270,7 +270,7 @@ void Animation::play() { draw(s); // XXX: Update the screen - g_system->copyRectToScreen(s->getBasePtr(0, 0), s->pitch, 0, 0, s->w, s->h); + g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h); // Free the temporary surface s->free(); diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp index d58ff32047..c7073b560c 100644 --- a/engines/lastexpress/data/sequence.cpp +++ b/engines/lastexpress/data/sequence.cpp @@ -128,8 +128,8 @@ AnimFrame::~AnimFrame() { } Common::Rect AnimFrame::draw(Graphics::Surface *s) { - byte *inp = (byte *)_image.getBasePtr(0, 0); - uint16 *outp = (uint16 *)s->getBasePtr(0, 0); + byte *inp = (byte *)_image.getPixels(); + uint16 *outp = (uint16 *)s->getPixels(); for (int i = 0; i < 640 * 480; i++, inp++, outp++) { if (*inp) *outp = _palette[*inp]; @@ -155,7 +155,7 @@ void AnimFrame::decomp4(Common::SeekableReadStream *in, const FrameInfo &f) { } void AnimFrame::decomp34(Common::SeekableReadStream *in, const FrameInfo &f, byte mask, byte shift) { - byte *p = (byte *)_image.getBasePtr(0, 0); + byte *p = (byte *)_image.getPixels(); uint32 skip = f.initialSkip / 2; uint32 size = f.decompressedEndOffset / 2; @@ -200,7 +200,7 @@ void AnimFrame::decomp34(Common::SeekableReadStream *in, const FrameInfo &f, byt } void AnimFrame::decomp5(Common::SeekableReadStream *in, const FrameInfo &f) { - byte *p = (byte *)_image.getBasePtr(0, 0); + byte *p = (byte *)_image.getPixels(); uint32 skip = f.initialSkip / 2; uint32 size = f.decompressedEndOffset / 2; @@ -235,7 +235,7 @@ void AnimFrame::decomp5(Common::SeekableReadStream *in, const FrameInfo &f) { } void AnimFrame::decomp7(Common::SeekableReadStream *in, const FrameInfo &f) { - byte *p = (byte *)_image.getBasePtr(0, 0); + byte *p = (byte *)_image.getPixels(); uint32 skip = f.initialSkip / 2; uint32 size = f.decompressedEndOffset / 2; @@ -288,7 +288,7 @@ void AnimFrame::decomp7(Common::SeekableReadStream *in, const FrameInfo &f) { } void AnimFrame::decompFF(Common::SeekableReadStream *in, const FrameInfo &f) { - byte *p = (byte *)_image.getBasePtr(0, 0); + byte *p = (byte *)_image.getPixels(); uint32 skip = f.initialSkip / 2; uint32 size = f.decompressedEndOffset / 2; diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp index 4934c4f519..9ced38a2e1 100644 --- a/engines/lastexpress/graphics.cpp +++ b/engines/lastexpress/graphics.cpp @@ -131,11 +131,11 @@ void GraphicsManager::mergePlanes() { // Clear screen surface _screen.fillRect(Common::Rect(640, 480), 0); - uint16 *screen = (uint16 *)_screen.getBasePtr(0, 0); - uint16 *inventory = (uint16 *)_inventory.getBasePtr(0, 0); - uint16 *overlay = (uint16 *)_overlay.getBasePtr(0, 0); - uint16 *backgroundC = (uint16 *)_backgroundC.getBasePtr(0, 0); - uint16 *backgroundA = (uint16 *)_backgroundA.getBasePtr(0, 0); + uint16 *screen = (uint16 *)_screen.getPixels(); + uint16 *inventory = (uint16 *)_inventory.getPixels(); + uint16 *overlay = (uint16 *)_overlay.getPixels(); + uint16 *backgroundC = (uint16 *)_backgroundC.getPixels(); + uint16 *backgroundA = (uint16 *)_backgroundA.getPixels(); for (int i = 0; i < 640 * 480; i++) { @@ -160,7 +160,7 @@ void GraphicsManager::mergePlanes() { void GraphicsManager::updateScreen() { g_system->fillScreen(0); - g_system->copyRectToScreen(_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480); + g_system->copyRectToScreen(_screen.getPixels(), 640 * 2, 0, 0, 640, 480); } } // End of namespace LastExpress -- cgit v1.2.3 From 66fe0181ffc9dbd169e166d3e3684863dc619425 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:40:13 +0200 Subject: MADE: Take advantage of Surface::getPixels. --- engines/made/graphics.cpp | 4 ++-- engines/made/pmvplayer.cpp | 2 +- engines/made/screen.cpp | 8 ++++---- engines/made/screenfx.cpp | 4 ++-- engines/made/scriptfuncs.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp index 4d3fc7116a..a8e33774f6 100644 --- a/engines/made/graphics.cpp +++ b/engines/made/graphics.cpp @@ -83,7 +83,7 @@ void decompressImage(byte *source, Graphics::Surface &surface, uint16 cmdOffs, u if ((maskFlags != 0) && (maskFlags != 2) && (pixelFlags != 0) && (pixelFlags != 2) && (cmdFlags != 0)) error("decompressImage() Unsupported flags: cmdFlags = %02X; maskFlags = %02X, pixelFlags = %02X", cmdFlags, maskFlags, pixelFlags); - byte *destPtr = (byte *)surface.getBasePtr(0, 0); + byte *destPtr = (byte *)surface.getPixels(); byte lineBuf[640 * 4]; byte bitBuf[40]; @@ -196,7 +196,7 @@ void decompressMovieImage(byte *source, Graphics::Surface &surface, uint16 cmdOf byte *maskBuffer = source + maskOffs; byte *pixelBuffer = source + pixelOffs; - byte *destPtr = (byte *)surface.getBasePtr(0, 0); + byte *destPtr = (byte *)surface.getPixels(); byte bitBuf[40]; diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 9e4354d6a3..573ff7faf1 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -248,7 +248,7 @@ void PmvPlayer::handleEvents() { } void PmvPlayer::updateScreen() { - _vm->_system->copyRectToScreen(_surface->getBasePtr(0, 0), _surface->pitch, + _vm->_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h); _vm->_system->updateScreen(); } diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 737b009565..30848e8ec1 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -344,12 +344,12 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask void Screen::updateSprites() { // TODO: This needs some more work, dirty rectangles are currently not used - memcpy(_workScreen->getBasePtr(0, 0), _backgroundScreen->getBasePtr(0, 0), 64000); + memcpy(_workScreen->getPixels(), _backgroundScreen->getPixels(), 64000); drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); drawSpriteChannels(_workScreenDrawCtx, 1, 2); - _vm->_system->copyRectToScreen(_workScreen->getBasePtr(0, 0), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); + _vm->_system->copyRectToScreen(_workScreen->getPixels(), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); _vm->_screen->updateScreenAndWait(10); } @@ -593,7 +593,7 @@ void Screen::show() { return; drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0); - memcpy(_workScreen->getBasePtr(0, 0), _backgroundScreen->getBasePtr(0, 0), 64000); + memcpy(_workScreen->getPixels(), _backgroundScreen->getPixels(), 64000); drawSpriteChannels(_workScreenDrawCtx, 1, 2); _fx->run(_visualEffectNum, _workScreen, _palette, _newPalette, _paletteColorCount); @@ -775,7 +775,7 @@ void Screen::unlockScreen() { } void Screen::showWorkScreen() { - _vm->_system->copyRectToScreen(_workScreen->getBasePtr(0, 0), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); + _vm->_system->copyRectToScreen(_workScreen->getPixels(), _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); } void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp index ad71f1fb49..d069308a4b 100644 --- a/engines/made/screenfx.cpp +++ b/engines/made/screenfx.cpp @@ -368,7 +368,7 @@ void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPa // "Screen slide in" right to left void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { for (int x = 8; x <= 320; x += 8) { - _screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200); + _screen->copyRectToScreen(surface->getPixels(), surface->pitch, 320 - x, 0, x, 200); _screen->updateScreenAndWait(25); } setPalette(palette); @@ -529,7 +529,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa // "Screen slide in" bottom to top void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { for (int y = 4; y <= 200; y += 4) { - _screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y); + _screen->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 200 - y, 320, y); _screen->updateScreenAndWait(25); } diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index 9a43bc44d2..0e3b50aa98 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -574,7 +574,7 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) { PictureResource *flex = _vm->_res->getPicture(argv[2]); if (flex) { Graphics::Surface *surf = flex->getPicture(); - CursorMan.replaceCursor(surf->getBasePtr(0, 0), surf->w, surf->h, argv[1], argv[0], 0); + CursorMan.replaceCursor(surf->getPixels(), surf->w, surf->h, argv[1], argv[0], 0); _vm->_res->freeResource(flex); } return 0; -- cgit v1.2.3 From 575cfca013dadfbd8d0dc5dbe5b4d693f2315413 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:40:23 +0200 Subject: MOHAWK: Take advantage of Surface::getPixels. --- engines/mohawk/bitmap.cpp | 6 +++--- engines/mohawk/cursors.cpp | 4 ++-- engines/mohawk/riven_graphics.cpp | 8 ++++---- engines/mohawk/video.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index d16a41698b..b321e043d9 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -779,7 +779,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) { } Graphics::Surface *surface = createSurface(_header.width, _header.height); - memset(surface->getBasePtr(0, 0), 0, _header.width * _header.height); + memset(surface->getPixels(), 0, _header.width * _header.height); // Expand the <8bpp data to one byte per pixel switch (getBitsPerPixel()) { @@ -801,7 +801,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) { void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) { assert(surface->format.bytesPerPixel == 1); - byte *dst = (byte *)surface->getBasePtr(0, 0); + byte *dst = (byte *)surface->getPixels(); // Expand the 8 pixels in a byte into a full byte per pixel @@ -830,7 +830,7 @@ void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableRead // Note that the image is in EGA planar form and not just standard 4bpp // This seems to contradict the PoP specs which seem to do something else - byte *dst = (byte *)surface->getBasePtr(0, 0); + byte *dst = (byte *)surface->getPixels(); for (uint32 i = 0; i < surface->h; i++) { uint x = 0; diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 7cef566e13..f70efde5fb 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -121,11 +121,11 @@ void MystCursorManager::setCursor(uint16 id) { // Myst ME stores some cursors as 24bpp images instead of 8bpp if (surface->format.bytesPerPixel == 1) { - CursorMan.replaceCursor(surface->getBasePtr(0, 0), surface->w, surface->h, hotspotX, hotspotY, 0); + CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, 0); CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256); } else { Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor(surface->getBasePtr(0, 0), surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); + CursorMan.replaceCursor(surface->getPixels(), surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); } _vm->_needsUpdate = true; diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp index 35474aebe2..cd15960b85 100644 --- a/engines/mohawk/riven_graphics.cpp +++ b/engines/mohawk/riven_graphics.cpp @@ -255,7 +255,7 @@ void RivenGraphics::runScheduledTransition() { } // For now, just copy the image to screen without doing any transition. - _vm->_system->copyRectToScreen(_mainScreen->getBasePtr(0, 0), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); + _vm->_system->copyRectToScreen(_mainScreen->getPixels(), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); _scheduledTransition = -1; // Clear scheduled transition @@ -345,7 +345,7 @@ void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) { mhkSurface->convertToTrueColor(); Graphics::Surface *surface = mhkSurface->getSurface(); - _vm->_system->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, rect->left, rect->top, surface->w, surface->h); + _vm->_system->copyRectToScreen(surface->getPixels(), surface->pitch, rect->left, rect->top, surface->w, surface->h); delete mhkSurface; } @@ -420,7 +420,7 @@ void RivenGraphics::updateCredits() { } else { // Otheriwse, we're scrolling // Move the screen up one row - memmove(_mainScreen->getBasePtr(0, 0), _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); + memmove(_mainScreen->getPixels(), _mainScreen->getBasePtr(0, 1), _mainScreen->pitch * (_mainScreen->h - 1)); // Only update as long as we're not before the last frame // Otherwise, we're just moving up a row (which we already did) @@ -437,7 +437,7 @@ void RivenGraphics::updateCredits() { } // Now flush the new screen - _vm->_system->copyRectToScreen(_mainScreen->getBasePtr(0, 0), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); + _vm->_system->copyRectToScreen(_mainScreen->getPixels(), _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); } } diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index b580a56577..b7e06a2b9f 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -245,7 +245,7 @@ bool VideoManager::updateMovies() { // Clip the width/height to make sure we stay on the screen (Myst does this a few times) uint16 width = MIN(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x); uint16 height = MIN(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y); - _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height); // We've drawn something to the screen, make sure we update it updateScreen = true; -- cgit v1.2.3 From 0c0f99eb96e9c7d13ae1430604a1d7569ec776cc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:40:37 +0200 Subject: MORTEVIELLE: Take advantage of Surface::getPixels. --- engines/mortevielle/graphics.cpp | 2 +- engines/mortevielle/menu.cpp | 2 +- engines/mortevielle/saveload.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 535dd6ddaa..dd0710655c 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1067,7 +1067,7 @@ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { assert((pt.x >= 0) && (pt.y >= 0) && (pt.x <= SCREEN_WIDTH) && (pt.y <= SCREEN_ORIG_HEIGHT)); Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); - byte *destP = (byte *)destSurface.getBasePtr(0, 0); + byte *destP = (byte *)destSurface.getPixels(); *destP = palIndex; *(destP + SCREEN_WIDTH) = palIndex; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f86fd208c1..0eaaf79f77 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -393,7 +393,7 @@ void Menu::menuUp(int msgId) { // Get a pointer to the source and destination of the area to restore const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); - byte *pDest = (byte *)destArea.getBasePtr(0, 0); + byte *pDest = (byte *)destArea.getPixels(); // Copy the data Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index d46383a6fc..651ed07b65 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -189,7 +189,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); - ::createThumbnail(thumb, (const byte *)s.getBasePtr(0, 0), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); + ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); thumb->free(); delete thumb; -- cgit v1.2.3 From 2c629803a2d5706093e6ee14b5604817a08b35c4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:40:51 +0200 Subject: NEVERHOOD: Take advantage of Surface::getPixels. --- engines/neverhood/mouse.cpp | 2 +- engines/neverhood/resource.cpp | 6 +++--- engines/neverhood/screen.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/neverhood/mouse.cpp b/engines/neverhood/mouse.cpp index 0d7ebb59dc..f11a3f99ea 100644 --- a/engines/neverhood/mouse.cpp +++ b/engines/neverhood/mouse.cpp @@ -183,7 +183,7 @@ void Mouse::updateCursor() { _drawOffset = _mouseCursorResource.getRect(); _surface->drawMouseCursorResource(_mouseCursorResource, _frameNum / 2); Graphics::Surface *cursorSurface = _surface->getSurface(); - CursorMan.replaceCursor((const byte*)cursorSurface->getBasePtr(0, 0), + CursorMan.replaceCursor((const byte*)cursorSurface->getPixels(), cursorSurface->w, cursorSurface->h, -_drawOffset.x, -_drawOffset.y, 0); } diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index 745f567ead..a1a517f251 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -39,7 +39,7 @@ SpriteResource::~SpriteResource() { void SpriteResource::draw(Graphics::Surface *destSurface, bool flipX, bool flipY) { if (_pixels) { - byte *dest = (byte*)destSurface->getBasePtr(0, 0); + byte *dest = (byte*)destSurface->getPixels(); const int destPitch = destSurface->pitch; if (_rle) unpackSpriteRle(_pixels, _dimensions.width, _dimensions.height, dest, destPitch, flipX, flipY); @@ -116,7 +116,7 @@ AnimResource::~AnimResource() { void AnimResource::draw(uint frameIndex, Graphics::Surface *destSurface, bool flipX, bool flipY) { const AnimFrameInfo frameInfo = _frames[frameIndex]; - byte *dest = (byte*)destSurface->getBasePtr(0, 0); + byte *dest = (byte*)destSurface->getPixels(); const int destPitch = destSurface->pitch; _currSpriteData = _spriteData + frameInfo.spriteDataOffs; _width = frameInfo.drawOffset.width; @@ -298,7 +298,7 @@ void MouseCursorResource::draw(int frameNum, Graphics::Surface *destSurface) { const int sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment const int destPitch = destSurface->pitch; const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; - byte *dest = (byte*)destSurface->getBasePtr(0, 0); + byte *dest = (byte*)destSurface->getPixels(); for (int16 yc = 0; yc < 32; yc++) { memcpy(dest, source, 32); source += sourcePitch; diff --git a/engines/neverhood/screen.cpp b/engines/neverhood/screen.cpp index 17fb79ab0d..4c8dd9add0 100644 --- a/engines/neverhood/screen.cpp +++ b/engines/neverhood/screen.cpp @@ -54,7 +54,7 @@ void Screen::update() { if (_fullRefresh) { // NOTE When playing a fullscreen/doubled Smacker video usually a full screen refresh is needed - _vm->_system->copyRectToScreen((const byte*)_backScreen->getBasePtr(0, 0), _backScreen->pitch, 0, 0, 640, 480); + _vm->_system->copyRectToScreen((const byte*)_backScreen->getPixels(), _backScreen->pitch, 0, 0, 640, 480); _fullRefresh = false; return; } @@ -174,7 +174,7 @@ void Screen::updatePalette() { } void Screen::clear() { - memset(_backScreen->getBasePtr(0, 0), 0, _backScreen->pitch * _backScreen->h); + memset(_backScreen->getPixels(), 0, _backScreen->pitch * _backScreen->h); _fullRefresh = true; clearRenderQueue(); } @@ -257,7 +257,7 @@ void Screen::drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, ND void Screen::drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect) { - const byte *source = (const byte*)surface->getBasePtr(0, 0); + const byte *source = (const byte*)surface->getPixels(); byte *dest = (byte*)_backScreen->getBasePtr(drawRect.x, drawRect.y); for (int16 yc = 0; yc < surface->h; yc++) { -- cgit v1.2.3 From ccaf4d865c46402f9e5d800956c414fd134b5dc9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:41:03 +0200 Subject: PARALLACTION: Take advantage of Surface::getPixels. --- engines/parallaction/disk_br.cpp | 8 ++++---- engines/parallaction/disk_ns.cpp | 6 +++--- engines/parallaction/graphics.cpp | 12 ++++++------ engines/parallaction/input.cpp | 2 +- engines/parallaction/inventory.h | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index dfb8bded87..f648f4b9a1 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -225,7 +225,7 @@ void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surfac } surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - stream.read(surf.getBasePtr(0, 0), width * height); + stream.read(surf.getPixels(), width * height); } Frames* DosDisk_br::loadPointer(const char *name) { @@ -449,7 +449,7 @@ void AmigaDisk_br::init() { void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) { uint size = surf.w * surf.h; - byte *data = (byte *)surf.getBasePtr(0, 0); + byte *data = (byte *)surf.getPixels(); for (uint i = 0; i < size; i++, data++) { if (transparentColor == -1 || transparentColor != *data) *data += 16; @@ -552,7 +552,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name, uint32 w, uint32 h) { MaskBuffer *buffer = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing buffer->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(buffer->data, decoder.getSurface()->getBasePtr(0, 0), buffer->size); + memcpy(buffer->data, decoder.getSurface()->getPixels(), buffer->size); buffer->bigEndian = true; finalpass(buffer->data, buffer->size); return buffer; @@ -612,7 +612,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { stream->read(shadow, shadowSize); for (int32 i = 0; i < surf->h; ++i) { byte *src = shadow + shadowWidth * i; - byte *dst = (byte *)surf->getBasePtr(0, 0) + surf->pitch * i; + byte *dst = (byte *)surf->getPixels() + surf->pitch * i; for (int32 j = 0; j < surf->w; ++j, ++dst) { byte bit = src[j/8] & (1 << (7 - (j & 7))); diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 45f7100f80..ae28e864a9 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -482,7 +482,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) { // read bitmap, mask and path data and extract them into the 3 buffers info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8()); createMaskAndPathBuffers(info); - unpackBackground(stream, (byte *)info.bg.getBasePtr(0, 0), info._mask->data, info._path->data); + unpackBackground(stream, (byte *)info.bg.getPixels(), info._mask->data, info._path->data); delete stream; } @@ -976,7 +976,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo& info, const char *name) { info._mask = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing info._mask->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(info._mask->data, decoder.getSurface()->getBasePtr(0, 0), info._mask->size); + memcpy(info._mask->data, decoder.getSurface()->getPixels(), info._mask->size); info._mask->bigEndian = true; } @@ -998,7 +998,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo& info, const char *name) { info._path = new PathBuffer; // surface width was shrunk to 1/8th of the bitmap width due to the pixel packing info._path->create(decoder.getSurface()->w * 8, decoder.getSurface()->h); - memcpy(info._path->data, decoder.getSurface()->getBasePtr(0, 0), info._path->size); + memcpy(info._path->data, decoder.getSurface()->getPixels(), info._path->size); info._path->bigEndian = true; } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 0aaf78ec13..3f36d56420 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -332,7 +332,7 @@ void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int void Gfx::clearScreen() { if (_doubleBuffering) { - if (_backBuffer.getBasePtr(0, 0)) { + if (_backBuffer.getPixels()) { Common::Rect r(_backBuffer.w, _backBuffer.h); _backBuffer.fillRect(r, 0); } @@ -419,13 +419,13 @@ void Gfx::updateScreen() { // is needed _overlayMode = false; - bool skipBackground = (_backgroundInfo->bg.getBasePtr(0, 0) == 0); // don't render frame if background is missing + bool skipBackground = (_backgroundInfo->bg.getPixels() == 0); // don't render frame if background is missing if (!skipBackground) { // background may not cover the whole screen, so adjust bulk update size uint w = _backgroundInfo->width; uint h = _backgroundInfo->height; - byte *backgroundData = (byte *)_backgroundInfo->bg.getBasePtr(0, 0); + byte *backgroundData = (byte *)_backgroundInfo->bg.getPixels(); uint16 backgroundPitch = _backgroundInfo->bg.pitch; copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->_x, _backgroundInfo->_y, w, h); } @@ -450,7 +450,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) { return; } - byte *buf = (byte *)surf.getBasePtr(0, 0); + byte *buf = (byte *)surf.getPixels(); for (int i = 0; i < surf.w*surf.h; i++) { *buf++ |= 0x20; } @@ -493,7 +493,7 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) r.moveTo(x, y); uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND; - blt(r, (byte *)surf.getBasePtr(0, 0), &_backgroundInfo->bg, z, 100, 0); + blt(r, (byte *)surf.getPixels(), &_backgroundInfo->bg, z, 100, 0); } void Gfx::fillBackground(const Common::Rect& r, byte color) { @@ -704,7 +704,7 @@ void Gfx::unregisterLabel(GfxObj *label) { void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) { byte *s = (byte *)src.getBasePtr(r.left, r.top); - byte *d = (byte *)dst.getBasePtr(0, 0); + byte *d = (byte *)dst.getPixels(); for (uint16 i = 0; i < r.height(); i++) { memcpy(d, s, r.width()); diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index df7275aacc..a445ce0138 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -499,7 +499,7 @@ void Input::initCursors() { // TODO: scale mouse cursor (see staticres.cpp) Graphics::Surface *surf2 = new Graphics::Surface; surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8()); - memcpy(surf2->getBasePtr(0, 0), _resMouseArrow_BR_Amiga, 32*16); + memcpy(surf2->getPixels(), _resMouseArrow_BR_Amiga, 32*16); _mouseArrow = new SurfaceToFrames(surf2); } break; diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index 418d1f7229..d5cf8badf0 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -108,7 +108,7 @@ public: void highlightItem(ItemPosition pos, byte color); void drawItem(ItemName name, byte *buffer, uint pitch); - byte *getData() { return (byte *)_surf.getBasePtr(0, 0); } + byte *getData() { return (byte *)_surf.getPixels(); } void getRect(Common::Rect &r) const; int16 getNumLines() const; -- cgit v1.2.3 From aca802bd701e0043040e82f0fd61d9cf9ff3ab95 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:41:16 +0200 Subject: PEGASUS: Take advantage of Surface::getPixels. --- engines/pegasus/cursor.cpp | 6 +++--- engines/pegasus/graphics.cpp | 2 +- engines/pegasus/neighborhood/caldoria/caldoria.cpp | 4 ++-- engines/pegasus/pegasus.cpp | 10 +++++----- engines/pegasus/transition.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp index dcf6749620..ad0d2c2d7d 100644 --- a/engines/pegasus/cursor.cpp +++ b/engines/pegasus/cursor.cpp @@ -85,9 +85,9 @@ void Cursor::setCurrentFrameIndex(int32 index) { if (_info[index].surface->format.bytesPerPixel == 1) { CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount); - CursorMan.replaceCursor(_info[index].surface->getBasePtr(0, 0), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0); + CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0); } else { - CursorMan.replaceCursor(_info[index].surface->getBasePtr(0, 0), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format); + CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format); } ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty(); @@ -203,7 +203,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) { // PixMap data if (pixMap.pixelSize == 8) { cursorInfo.surface->create(pixMap.rowBytes, pixMap.bounds.height(), Graphics::PixelFormat::createFormatCLUT8()); - cicnStream->read(cursorInfo.surface->getBasePtr(0, 0), pixMap.rowBytes * pixMap.bounds.height()); + cicnStream->read(cursorInfo.surface->getPixels(), pixMap.rowBytes * pixMap.bounds.height()); // While this looks sensible, it actually doesn't work for some cursors // (ie. the 'can grab' hand) diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp index ee7e7bd9cc..5475108abd 100644 --- a/engines/pegasus/graphics.cpp +++ b/engines/pegasus/graphics.cpp @@ -318,7 +318,7 @@ void GraphicsManager::shakeTheWorld(TimeValue duration, TimeScale scale) { } if (lastOffset.x != 0 || lastOffset.y != 0) { - g_system->copyRectToScreen((byte *)oldScreen.getBasePtr(0, 0), oldScreen.pitch, 0, 0, 640, 480); + g_system->copyRectToScreen((byte *)oldScreen.getPixels(), oldScreen.pitch, 0, 0, 640, 480); g_system->updateScreen(); } diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index 76954afa2b..0b3e1ee040 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -200,7 +200,7 @@ void Caldoria::start() { const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); assert(frame); assert(frame->format == g_system->getScreenFormat()); - g_system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 64, 112, frame->w, frame->h); + g_system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 64, 112, frame->w, frame->h); _vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond); bool saveAllowed = _vm->swapSaveAllowed(false); @@ -216,7 +216,7 @@ void Caldoria::start() { frame = pullbackMovie->decodeNextFrame(); if (frame) { - g_system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 64, 112, frame->w, frame->h); + g_system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 64, 112, frame->w, frame->h); g_system->updateScreen(); } } diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 83abe4a894..3bd29ce8dd 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -313,7 +313,7 @@ void PegasusEngine::runIntro() { const Graphics::Surface *frame = video->decodeNextFrame(); if (frame) { - _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, 0, 0, frame->w, frame->h); + _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h); _system->updateScreen(); } } @@ -1367,7 +1367,7 @@ bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 if (frame->w <= 320 && frame->h <= 240) { drawScaledFrame(frame, x, y); } else { - _system->copyRectToScreen((const byte *)frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); + _system->copyRectToScreen((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); _system->updateScreen(); } } @@ -2270,11 +2270,11 @@ void PegasusEngine::drawScaledFrame(const Graphics::Surface *frame, uint16 x, ui scaledFrame.create(frame->w * 2, frame->h * 2, frame->format); if (frame->format.bytesPerPixel == 2) - scaleFrame((const uint16 *)frame->getBasePtr(0, 0), (uint16 *)scaledFrame.getBasePtr(0, 0), frame->w, frame->h, frame->pitch); + scaleFrame((const uint16 *)frame->getPixels(), (uint16 *)scaledFrame.getPixels(), frame->w, frame->h, frame->pitch); else - scaleFrame((const uint32 *)frame->getBasePtr(0, 0), (uint32 *)scaledFrame.getBasePtr(0, 0), frame->w, frame->h, frame->pitch); + scaleFrame((const uint32 *)frame->getPixels(), (uint32 *)scaledFrame.getPixels(), frame->w, frame->h, frame->pitch); - _system->copyRectToScreen((byte *)scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _system->copyRectToScreen((byte *)scaledFrame.getPixels(), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); _system->updateScreen(); scaledFrame.free(); } diff --git a/engines/pegasus/transition.cpp b/engines/pegasus/transition.cpp index 37ea38147e..b736b115ee 100644 --- a/engines/pegasus/transition.cpp +++ b/engines/pegasus/transition.cpp @@ -70,7 +70,7 @@ void ScreenFader::setFaderValue(const int32 value) { if (value != getFaderValue()) { Fader::setFaderValue(value); - if (_screen->getBasePtr(0, 0)) { + if (_screen->getPixels()) { // The original game does a gamma fade here using the Mac API. In order to do // that, it would require an immense amount of CPU processing. This does a // linear fade instead, which looks fairly well, IMO. -- cgit v1.2.3 From e30cb842101a6259633de46a9517ea46a2ba9860 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:41:27 +0200 Subject: SAGA: Take advantage of Sufrace::getPixels. --- engines/saga/animation.cpp | 2 +- engines/saga/gfx.h | 2 +- engines/saga/introproc_ihnm.cpp | 8 ++++---- engines/saga/introproc_saga2.cpp | 2 +- engines/saga/scene.cpp | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 85f2579138..df8283b4c2 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -501,7 +501,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { } anim = getAnimation(animId); - displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0); + displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->getPixels(); if (playing) { anim->state = ANIM_PLAYING; diff --git a/engines/saga/gfx.h b/engines/saga/gfx.h index f3c871e55d..c68160e907 100644 --- a/engines/saga/gfx.h +++ b/engines/saga/gfx.h @@ -201,7 +201,7 @@ public: // Whenever it gets called, the corresponding caller must take care // to add the corresponding dirty rectangle itself byte *getBackBufferPixels() { - return (byte *)_backBuffer.getBasePtr(0, 0); + return (byte *)_backBuffer.getPixels(); } uint16 getBackBufferWidth() { diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index c21652da7c..7922d56425 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -212,7 +212,7 @@ bool Scene::playTitle(int title, int time, int mode) { break; case 2: // display background - _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, + _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); phase++; startTime = curTime; @@ -247,7 +247,7 @@ bool Scene::playTitle(int title, int time, int mode) { frameTime = curTime; - _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, + _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); } @@ -273,8 +273,8 @@ bool Scene::playTitle(int title, int time, int mode) { _vm->_anim->endVideo(); - memset((byte *)backBufferSurface->getBasePtr(0, 0), 0, backBufferSurface->w * backBufferSurface->h); - _vm->_system->copyRectToScreen(backBufferSurface->getBasePtr(0, 0), backBufferSurface->w, 0, 0, + memset((byte *)backBufferSurface->getPixels(), 0, backBufferSurface->w * backBufferSurface->h); + _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); return interrupted; diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp index 9d8295b6de..e61dfbf161 100644 --- a/engines/saga/introproc_saga2.cpp +++ b/engines/saga/introproc_saga2.cpp @@ -108,7 +108,7 @@ void Scene::playMovie(const char *filename) { if (smkDecoder->needsUpdate()) { const Graphics::Surface *frame = smkDecoder->decodeNextFrame(); if (frame) { - _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); if (smkDecoder->hasDirtyPalette()) _vm->_system->getPaletteManager()->setPalette(smkDecoder->getPalette(), 0, 256); diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 23d3015afd..eff31cf98b 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -468,7 +468,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy pal = decoder.getPalette(); rect.setWidth(decoder.getSurface()->w); rect.setHeight(decoder.getSurface()->h); - _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->getBasePtr(0, 0)); + _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->getPixels()); for (int j = 0; j < PAL_ENTRIES; j++) { cPal[j].red = *pal++; cPal[j].green = *pal++; @@ -1120,9 +1120,9 @@ void Scene::draw() { _vm->_render->getBackGroundSurface()->getRect(rect); rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom; if (_vm->_render->isFullRefresh()) - _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0)); + _vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getPixels()); else - _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getBasePtr(0, 0)); + _vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->getPixels()); } } -- cgit v1.2.3 From dbda889e6337a21babb95eae66880c81eb022bda Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:41:39 +0200 Subject: SCI: Take advantage of Surface::getPixels. --- engines/sci/engine/kvideo.cpp | 4 ++-- engines/sci/graphics/frameout.cpp | 2 +- engines/sci/graphics/maciconbar.cpp | 6 +++--- engines/sci/graphics/screen.cpp | 4 ++-- engines/sci/video/robot_decoder.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 5db4f24dcd..3964ccc1f8 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -103,10 +103,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) { if (frame) { if (scaleBuffer) { // TODO: Probably should do aspect ratio correction in e.g. GK1 Windows - g_sci->_gfxScreen->scale2x((const byte *)frame->getBasePtr(0, 0), scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); + g_sci->_gfxScreen->scale2x((const byte *)frame->getPixels(), scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height); } else { - g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, width, height); + g_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, width, height); } if (videoDecoder->hasDirtyPalette()) { diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index a835a0e9f0..76510fa53b 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -532,7 +532,7 @@ void GfxFrameout::showVideo() { if (videoDecoder->needsUpdate()) { const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); if (frame) { - g_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); + g_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); if (videoDecoder->hasDirtyPalette()) g_system->getPaletteManager()->setPalette(videoDecoder->getPalette(), 0, 256); diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp index c800c0dd2f..4df80b289f 100644 --- a/engines/sci/graphics/maciconbar.cpp +++ b/engines/sci/graphics/maciconbar.cpp @@ -129,7 +129,7 @@ void GfxMacIconBar::drawIcon(uint16 iconIndex, bool selected) { void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) { if (surface) - g_system->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, rect.left, rect.top, rect.width(), rect.height()); + g_system->copyRectToScreen(surface->getPixels(), surface->pitch, rect.left, rect.top, rect.width(), rect.height()); } void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) { @@ -153,7 +153,7 @@ void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common:: *((byte *)newSurf.getBasePtr(j, i)) = 0; } - g_system->copyRectToScreen(newSurf.getBasePtr(0, 0), newSurf.pitch, rect.left, rect.top, rect.width(), rect.height()); + g_system->copyRectToScreen(newSurf.getPixels(), newSurf.pitch, rect.left, rect.top, rect.width(), rect.height()); newSurf.free(); } @@ -224,7 +224,7 @@ Graphics::Surface *GfxMacIconBar::createImage(uint32 iconIndex, bool isSelected) } void GfxMacIconBar::remapColors(Graphics::Surface *surf, const byte *palette) { - byte *pixels = (byte *)surf->getBasePtr(0, 0); + byte *pixels = (byte *)surf->getPixels(); // Remap to the screen palette for (uint16 i = 0; i < surf->w * surf->h; i++) { diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index d5631bdaf5..7b92bc89eb 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -170,14 +170,14 @@ void GfxScreen::copyToScreen() { void GfxScreen::copyFromScreen(byte *buffer) { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(buffer, screen->getBasePtr(0, 0), _displayPixels); + memcpy(buffer, screen->getPixels(), _displayPixels); g_system->unlockScreen(); } void GfxScreen::kernelSyncWithFramebuffer() { // TODO this ignores the pitch Graphics::Surface *screen = g_system->lockScreen(); - memcpy(_displayScreen, screen->getBasePtr(0, 0), _displayPixels); + memcpy(_displayScreen, screen->getPixels(), _displayPixels); g_system->unlockScreen(); } diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp index 775cd0d74b..a567ece2ea 100644 --- a/engines/sci/video/robot_decoder.cpp +++ b/engines/sci/video/robot_decoder.cpp @@ -210,7 +210,7 @@ void RobotDecoder::readNextPacket() { // Copy over the decompressed frame byte *inFrame = decompressedFrame; - byte *outFrame = (byte *)surface->getBasePtr(0, 0); + byte *outFrame = (byte *)surface->getPixels(); // Black out the surface memset(outFrame, 0, surface->w * surface->h); -- cgit v1.2.3 From 54b30d8e5d7cb61bea8c439cd5bd0dd1f1d289fb Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:42:09 +0200 Subject: SWORD1: Take advantage of Surface::getPixels. --- engines/sword1/animation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 73a22093ab..742aac1a53 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -314,7 +314,7 @@ bool MoviePlayer::playVideo() { if (_decoderType == kVideoDecoderPSX) drawFramePSX(frame); else - _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); } if (_decoder->hasDirtyPalette()) { @@ -407,7 +407,7 @@ bool MoviePlayer::playVideo() { } Graphics::Surface *screen = _vm->_system->lockScreen(); - performPostProcessing((byte *)screen->getBasePtr(0, 0)); + performPostProcessing((byte *)screen->getPixels()); _vm->_system->unlockScreen(); _vm->_system->updateScreen(); } @@ -498,7 +498,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { uint16 x = (g_system->getWidth() - scaledFrame.w) / 2; uint16 y = (g_system->getHeight() - scaledFrame.h) / 2; - _vm->_system->copyRectToScreen(scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _vm->_system->copyRectToScreen(scaledFrame.getPixels(), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); scaledFrame.free(); } -- cgit v1.2.3 From 5f8bce839f1a463f0de0ba5e116d93d802fb8ad0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:42:18 +0200 Subject: SWORD2: Take advantage of Surface::getPixels. --- engines/sword2/animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index c25b29d337..92fa9d0e44 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -334,7 +334,7 @@ bool MoviePlayer::playVideo() { if (_decoderType == kVideoDecoderPSX) drawFramePSX(frame); else - _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, x, y, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); } if (_decoder->hasDirtyPalette()) { @@ -403,7 +403,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) { uint16 x = (g_system->getWidth() - scaledFrame.w) / 2; uint16 y = (g_system->getHeight() - scaledFrame.h) / 2; - _vm->_system->copyRectToScreen(scaledFrame.getBasePtr(0, 0), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); + _vm->_system->copyRectToScreen(scaledFrame.getPixels(), scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h); scaledFrame.free(); } -- cgit v1.2.3 From 1550e9804b883afd4eb32eaea77cd81cbef75953 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:42:32 +0200 Subject: SWORD25: Take advantage of Surface::getPixels. --- engines/sword25/fmv/movieplayer.cpp | 4 ++-- engines/sword25/gfx/image/imgloader.cpp | 2 +- engines/sword25/gfx/image/renderedimage.cpp | 2 +- engines/sword25/gfx/screenshot.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index a95532ec65..3cdce1b493 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -130,10 +130,10 @@ void MoviePlayer::update() { assert(s->format.bytesPerPixel == 4); #ifdef THEORA_INDIRECT_RENDERING - const byte *frameData = (const byte *)s->getBasePtr(0, 0); + const byte *frameData = (const byte *)s->getPixels(); _outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch); #else - g_system->copyRectToScreen(s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h)); + g_system->copyRectToScreen(s->getPixels(), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h)); g_system->updateScreen(); #endif } diff --git a/engines/sword25/gfx/image/imgloader.cpp b/engines/sword25/gfx/image/imgloader.cpp index 6a458a0ae1..9006a596b4 100644 --- a/engines/sword25/gfx/image/imgloader.cpp +++ b/engines/sword25/gfx/image/imgloader.cpp @@ -50,7 +50,7 @@ bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, byte *&un width = pngSurface->w; height = pngSurface->h; uncompressedDataPtr = new byte[pngSurface->pitch * pngSurface->h]; - memcpy(uncompressedDataPtr, (byte *)pngSurface->getBasePtr(0, 0), pngSurface->pitch * pngSurface->h); + memcpy(uncompressedDataPtr, (byte *)pngSurface->getPixels(), pngSurface->pitch * pngSurface->h); pngSurface->free(); delete pngSurface; diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index f8ed7a00b2..c0138c8fd3 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -287,7 +287,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = scale(srcImage, width, height); - savedPixels = (byte *)img->getBasePtr(0, 0); + savedPixels = (byte *)img->getPixels(); } else { img = &srcImage; } diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index 73149ec119..7b56a6e9f3 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -40,7 +40,7 @@ namespace Sword25 { bool Screenshot::saveToFile(Graphics::Surface *data, Common::WriteStream *stream) { // Convert the RGBA data to RGB - const byte *pSrc = (const byte *)data->getBasePtr(0, 0); + const byte *pSrc = (const byte *)data->getPixels(); // Write our own custom header stream->writeUint32BE(MKTAG('S','C','R','N')); // SCRN, short for "Screenshot" @@ -85,7 +85,7 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data) uint x, y; x = y = 0; - for (byte *pDest = (byte *)thumbnail.getBasePtr(0, 0); pDest < ((byte *)thumbnail.getBasePtr(0, thumbnail.h)); ) { + for (byte *pDest = (byte *)thumbnail.getPixels(); pDest < ((byte *)thumbnail.getBasePtr(0, thumbnail.h)); ) { // Get an average over a 4x4 pixel block in the source image int alpha, red, green, blue; alpha = red = green = blue = 0; -- cgit v1.2.3 From 4ddace8a7a5afd11918fa9c6cc0e9f1e02a5d1bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:42:42 +0200 Subject: TEENAGENT: Take advantage of Surface::getPixels. --- engines/teenagent/font.cpp | 2 +- engines/teenagent/resources.cpp | 2 +- engines/teenagent/scene.cpp | 8 ++++---- engines/teenagent/teenagent.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp index efc107f6db..9d85328f20 100644 --- a/engines/teenagent/font.cpp +++ b/engines/teenagent/font.cpp @@ -65,7 +65,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) byte *glyph = _data + READ_LE_UINT16(_data + idx * 2); int h = glyph[0], w = glyph[1]; - if (surface == NULL || surface->getBasePtr(0, 0) == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth) + if (surface == NULL || surface->getPixels() == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth) return w - _widthPack; int i0 = 0, j0 = 0; diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp index cf1c4efdf6..cdbdcf9655 100644 --- a/engines/teenagent/resources.cpp +++ b/engines/teenagent/resources.cpp @@ -160,7 +160,7 @@ void Resources::loadOff(Graphics::Surface &surface, byte *palette, int id) { off.read(id, buf, bufferSize); byte *src = buf; - byte *dst = (byte *)surface.getBasePtr(0, 0); + byte *dst = (byte *)surface.getPixels(); memcpy(dst, src, 64000); memcpy(palette, buf + 64000, 768); diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index f9a3cca683..f36a60932c 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -370,7 +370,7 @@ void Scene::init(int id, const Common::Point &pos) { for (byte i = 0; i < 4; ++i) customAnimation[i].free(); - if (background.getBasePtr(0, 0) == NULL) + if (background.getPixels() == NULL) background.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); warp(pos); @@ -414,7 +414,7 @@ void Scene::init(int id, const Common::Point &pos) { if (nowPlaying != _vm->res->dseg.get_byte(dsAddr_currentMusic)) _vm->music->load(_vm->res->dseg.get_byte(dsAddr_currentMusic)); - _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h); + _vm->_system->copyRectToScreen(background.getPixels(), background.pitch, 0, 0, background.w, background.h); setPalette(0); } @@ -640,8 +640,8 @@ bool Scene::render(bool tickGame, bool tickMark, uint32 messageDelta) { return true; } - if (background.getBasePtr(0, 0) && debugFeatures.feature[DebugFeatures::kShowBack]) { - _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h); + if (background.getPixels() && debugFeatures.feature[DebugFeatures::kShowBack]) { + _vm->_system->copyRectToScreen(background.getPixels(), background.pitch, 0, 0, background.w, background.h); } else _vm->_system->fillScreen(0); diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 40c868042e..e73f1100d6 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -399,7 +399,7 @@ bool TeenAgentEngine::showLogo() { return true; } - _system->copyRectToScreen(s.getBasePtr(0, 0), s.w, s.x, s.y, s.w, s.h); + _system->copyRectToScreen(s.getPixels(), s.w, s.x, s.y, s.w, s.h); _system->updateScreen(); _system->delayMillis(100); -- cgit v1.2.3 From 2977ff8ba09d1b1885abb92ccbfe97f89e634ae5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:42:56 +0200 Subject: TINSEL: Take advantage of Surface::getPixels. --- engines/tinsel/bmv.cpp | 2 +- engines/tinsel/graphics.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index 106e1542d5..fa66b7ad8e 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -1031,7 +1031,7 @@ void BMVPlayer::CopyMovieToScreen() { // The movie surface is slightly less high than the output screen (429 rows versus 432). // Because of this, there's some extra line clearing above and below the displayed area int yStart = (SCREEN_HEIGHT - SCREEN_HIGH) / 2; - memset(_vm->screen().getBasePtr(0, 0), 0, yStart * SCREEN_WIDTH); + memset(_vm->screen().getPixels(), 0, yStart * SCREEN_WIDTH); memcpy(_vm->screen().getBasePtr(0, yStart), ScreenBeg, SCREEN_WIDTH * SCREEN_HIGH); memset(_vm->screen().getBasePtr(0, yStart + SCREEN_HIGH), 0, (SCREEN_HEIGHT - SCREEN_HIGH - yStart) * SCREEN_WIDTH); diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 5dae984def..c4f341f6fe 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -798,7 +798,7 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, */ void ClearScreen() { byte blackColorIndex = (!TinselV1Mac) ? 0 : 255; - void *pDest = _vm->screen().getBasePtr(0, 0); + void *pDest = _vm->screen().getPixels(); memset(pDest, blackColorIndex, SCREEN_WIDTH * SCREEN_HEIGHT); g_system->fillScreen(blackColorIndex); g_system->updateScreen(); -- cgit v1.2.3 From 863ead081d9367a3ac0575ebc195d0022d28ecf8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:43:54 +0200 Subject: TOLTECS: Take advantage of Surface::getPixels. --- engines/toltecs/menu.cpp | 4 ++-- engines/toltecs/screen.cpp | 2 +- engines/toltecs/segmap.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp index d2b3d5a163..0850630c43 100644 --- a/engines/toltecs/menu.cpp +++ b/engines/toltecs/menu.cpp @@ -69,7 +69,7 @@ int MenuSystem::run(MenuID menuId) { _vm->_screen->blastSprite(0x140 + _vm->_cameraX, 0x175 + _vm->_cameraY, 0, 1, 0x4000); shadeRect(60, 39, 520, 247, 225, 229); - memcpy(_background->getBasePtr(0, 0), _vm->_screen->_frontScreen, 640 * 400); + memcpy(_background->getPixels(), _vm->_screen->_frontScreen, 640 * 400); while (_running) { update(); @@ -229,7 +229,7 @@ void MenuSystem::initMenu(MenuID menuID) { _items.clear(); - memcpy(_vm->_screen->_frontScreen, _background->getBasePtr(0, 0), 640 * 400); + memcpy(_vm->_screen->_frontScreen, _background->getPixels(), 640 * 400); switch (menuID) { case kMenuIdMain: diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index 5e12773e1b..1eb2f41fd2 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -651,7 +651,7 @@ void Screen::drawSurface(int16 x, int16 y, Graphics::Surface *surface) { int16 skipX = 0; int16 width = surface->w; int16 height = surface->h; - byte *surfacePixels = (byte *)surface->getBasePtr(0, 0); + byte *surfacePixels = (byte *)surface->getPixels(); byte *frontScreen; // Not on screen, skip diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp index b06c0af675..fea40f3277 100644 --- a/engines/toltecs/segmap.cpp +++ b/engines/toltecs/segmap.cpp @@ -373,7 +373,7 @@ void SegmentMap::loadSegmapMaskRectSurface(byte *maskData, SegmapMaskRect &maskR maskRect.surface->create(maskRect.width, maskRect.height, Graphics::PixelFormat::createFormatCLUT8()); byte *backScreen = _vm->_screen->_backScreen + maskRect.x + (maskRect.y * _vm->_sceneWidth); - byte *dest = (byte *)maskRect.surface->getBasePtr(0, 0); + byte *dest = (byte *)maskRect.surface->getPixels(); for (int16 h = 0; h < maskRect.height; h++) { int16 w = maskRect.width; -- cgit v1.2.3 From b125aa953b04c8411b00aa89ae4f19786232dbd9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:44:06 +0200 Subject: TONY: Take advantage of Surface::getPixels. --- engines/tony/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 5fc4329ff6..d355450153 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -158,9 +158,9 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s Graphics::Surface *to = new Graphics::Surface(); to->create(160, 120, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); - if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->getBasePtr(0, 0), saveName, difficulty)) { + if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->getPixels(), saveName, difficulty)) { #ifdef SCUMM_BIG_ENDIAN - uint16 *pixels = (uint16 *)to->getBasePtr(0, 0); + uint16 *pixels = (uint16 *)to->getPixels(); for (int i = 0; i < to->w * to->h; ++i) pixels[i] = READ_LE_UINT16(pixels + i); #endif -- cgit v1.2.3 From 7455cd4e35cb8d65e9adef86062f0566bc96e4ba Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:44:15 +0200 Subject: TOON: Take advantage of Surface::getPixels. --- engines/toon/anim.cpp | 2 +- engines/toon/movie.cpp | 2 +- engines/toon/toon.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index aecf341079..78d3954325 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -231,7 +231,7 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram int32 destPitch = surface.pitch; int32 destPitchMask = mask->getWidth(); uint8 *c = _frames[frame]._data; - uint8 *curRow = (uint8 *)surface.getBasePtr(0, 0); + uint8 *curRow = (uint8 *)surface.getPixels(); uint8 *curRowMask = mask->getDataPtr(); bool shadowFlag = false; diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index 962b73dfa7..f0463a52e1 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -112,7 +112,7 @@ bool Movie::playVideo(bool isFirstIntroVideo) { } _vm->_system->unlockScreen(); } else { - _vm->_system->copyRectToScreen(frame->getBasePtr(0, 0), frame->pitch, 0, 0, frame->w, frame->h); + _vm->_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h); // WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels. if (isFirstIntroVideo) { diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 2f5c810811..286bcf1941 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -499,7 +499,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) { if (_dirtyAll || _gameState->_currentScrollValue != lastScroll) { // we have to refresh everything in case of scrolling. - _system->copyRectToScreen((byte *)_mainSurface->getBasePtr(0, 0) + state()->_currentScrollValue, TOON_BACKBUFFER_WIDTH, 0, 0, TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); + _system->copyRectToScreen((byte *)_mainSurface->getPixels() + state()->_currentScrollValue, TOON_BACKBUFFER_WIDTH, 0, 0, TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT); } else { int32 offX = 0; -- cgit v1.2.3 From 9d8939f42db8dbf28b249feb149ff409a05a5685 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:44:25 +0200 Subject: TSAGE: Take advantage of Surface::getPixels. --- engines/tsage/events.cpp | 8 ++++---- engines/tsage/graphics.cpp | 16 ++++++++-------- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 +- engines/tsage/saveload.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 8f07a8243b..5ca531fdb9 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -277,7 +277,7 @@ void EventsClass::setCursor(CursorType cursorType) { GfxSurface s = surfaceFromRes(cursor); Graphics::Surface surface = s.lockSurface(); - const byte *cursorData = (const byte *)surface.getBasePtr(0, 0); + const byte *cursorData = (const byte *)surface.getPixels(); CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor); s.unlockSurface(); @@ -333,7 +333,7 @@ void EventsClass::pushCursor(CursorType cursorType) { GfxSurface s = surfaceFromRes(cursor); Graphics::Surface surface = s.lockSurface(); - const byte *cursorData = (const byte *)surface.getBasePtr(0, 0); + const byte *cursorData = (const byte *)surface.getPixels(); CursorMan.pushCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor); s.unlockSurface(); @@ -346,7 +346,7 @@ void EventsClass::popCursor() { } void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId) { - const byte *cursorData = (const byte *)cursor.getBasePtr(0, 0); + const byte *cursorData = (const byte *)cursor.getPixels(); CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColor); _currentCursor = cursorId; @@ -355,7 +355,7 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com void EventsClass::setCursor(GfxSurface &cursor) { Graphics::Surface s = cursor.lockSurface(); - const byte *cursorData = (const byte *)s.getBasePtr(0, 0); + const byte *cursorData = (const byte *)s.getPixels(); CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(), cursor._centroid.x, cursor._centroid.y, cursor._transColor); diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index ecacf4bce3..3080cfe7c2 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -47,7 +47,7 @@ GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds) { Graphics::Surface destSurface = dest->lockSurface(); byte *srcP = (byte *)srcSurface.getBasePtr(bounds.left, bounds.top); - byte *destP = (byte *)destSurface.getBasePtr(0, 0); + byte *destP = (byte *)destSurface.getPixels(); for (int y = bounds.top; y < bounds.bottom; ++y, srcP += srcSurface.pitch, destP += destSurface.pitch) Common::copy(srcP, srcP + destSurface.pitch, destP); @@ -76,7 +76,7 @@ GfxSurface surfaceFromRes(const byte *imgData) { const byte *srcP = imgData + 10; Graphics::Surface destSurface = s.lockSurface(); - byte *destP = (byte *)destSurface.getBasePtr(0, 0); + byte *destP = (byte *)destSurface.getPixels(); if (!rleEncoded) { Common::copy(srcP, srcP + (r.width() * r.height()), destP); @@ -316,7 +316,7 @@ void GfxSurface::create(int width, int height) { } _customSurface = new Graphics::Surface(); _customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - Common::fill((byte *)_customSurface->getBasePtr(0, 0), (byte *)_customSurface->getBasePtr(0, height), 0); + Common::fill((byte *)_customSurface->getPixels(), (byte *)_customSurface->getBasePtr(0, height), 0); _bounds = Rect(0, 0, width, height); } @@ -363,7 +363,7 @@ void GfxSurface::synchronize(Serializer &s) { if (_customSurface) { s.syncAsSint16LE(_customSurface->w); s.syncAsSint16LE(_customSurface->h); - s.syncBytes((byte *)_customSurface->getBasePtr(0, 0), _customSurface->w * _customSurface->h); + s.syncBytes((byte *)_customSurface->getPixels(), _customSurface->w * _customSurface->h); } else { int zero = 0; s.syncAsSint16LE(zero); @@ -380,7 +380,7 @@ void GfxSurface::synchronize(Serializer &s) { _customSurface = NULL; } else { create(w, h); - s.syncBytes((byte *)_customSurface->getBasePtr(0, 0), w * h); + s.syncBytes((byte *)_customSurface->getPixels(), w * h); } } } @@ -417,8 +417,8 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) { // Surface owns the internal data, so replicate it so new surface owns it's own _customSurface = new Graphics::Surface(); _customSurface->create(s._customSurface->w, s._customSurface->h, Graphics::PixelFormat::createFormatCLUT8()); - const byte *srcP = (const byte *)s._customSurface->getBasePtr(0, 0); - byte *destP = (byte *)_customSurface->getBasePtr(0, 0); + const byte *srcP = (const byte *)s._customSurface->getPixels(); + byte *destP = (byte *)_customSurface->getPixels(); Common::copy(srcP, srcP + (_bounds.width() * _bounds.height()), destP); } @@ -581,7 +581,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi Graphics::Surface destSurface = srcImage.lockSurface(); const byte *srcP = (const byte *)srcSurface.getBasePtr(srcBounds.left, srcBounds.top); - byte *destP = (byte *)destSurface.getBasePtr(0, 0); + byte *destP = (byte *)destSurface.getPixels(); for (int yp = srcBounds.top; yp < srcBounds.bottom; ++yp, srcP += srcSurface.pitch, destP += destSurface.pitch) { Common::copy(srcP, srcP + srcBounds.width(), destP); } diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f872d8edd2..e2114fbfe5 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -522,7 +522,7 @@ void SceneExt::refreshBackground(int xAmount, int yAmount) { assert(screenSize == (s.w * s.h)); // Copy the data - byte *destP = (byte *)s.getBasePtr(0, 0); + byte *destP = (byte *)s.getPixels(); Common::copy(dataP, dataP + (s.w * s.h), destP); _backSurface.unlockSurface(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 36c011ffd7..a20d949cd5 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5399,7 +5399,7 @@ GfxSurface Scene600::Actor4::getFrame() { // Translate the frame using the scene's pixel map byte *pixelMap = static_cast(R2_GLOBALS._sceneManager._scene)->_pixelMap; Graphics::Surface surface = frame.lockSurface(); - byte *srcP = (byte *)surface.getBasePtr(0, 0); + byte *srcP = (byte *)surface.getPixels(); while (srcP < ((byte *)surface.getBasePtr(0, surface.h))) { *srcP = pixelMap[*srcP]; diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index 1357ece71e..7143305586 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -289,7 +289,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); Graphics::Surface s = g_globals->_screenSurface.lockSurface(); - ::createThumbnail(thumb, (const byte *)s.getBasePtr(0, 0), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); + ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); g_globals->_screenSurface.unlockSurface(); thumb->free(); -- cgit v1.2.3 From 431841073185d45a945a459768fccc091cc2c2fd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:44:35 +0200 Subject: TUCKER: Take advantage of Surface::getPixels. --- engines/tucker/sequences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 5efe5eed00..bd03eed00b 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -811,7 +811,7 @@ void AnimationSequencePlayer::playIntroSeq19_20() { if (surface) for (int i = 0; i < kScreenWidth * kScreenHeight; ++i) if (_offscreenBuffer[i] == 0) - _offscreenBuffer[i] = *((const byte *)surface->getBasePtr(0, 0) + i); + _offscreenBuffer[i] = *((const byte *)surface->getPixels() + i); if (!framesLeft) _changeToNextSequence = true; -- cgit v1.2.3 From 0ee407c44bc8ce3c1c26ba68d5eb5a68599788c7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:44:47 +0200 Subject: WINTERMUTE: Take advantage of Surface::getPixels. --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 6 +++--- engines/wintermute/graphics/transparent_surface.cpp | 6 +++--- engines/wintermute/video/video_theora_player.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 06a872a9aa..d36221d291 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -187,9 +187,9 @@ bool BaseRenderOSystem::flip() { } if (_needsFlip || _disableDirtyRects || _tempDisableDirtyRects) { if (_disableDirtyRects || _tempDisableDirtyRects) { - g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); } - // g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); + // g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); delete _dirtyRect; _dirtyRect = nullptr; g_system->updateScreen(); @@ -682,7 +682,7 @@ void BaseRenderOSystem::endSaveLoad() { _drawNum = 1; _renderSurface->fillRect(Common::Rect(0, 0, _renderSurface->h, _renderSurface->w), _renderSurface->format.ARGBToColor(255, 0, 0, 0)); - g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(0, 0), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); + g_system->copyRectToScreen((byte *)_renderSurface->getPixels(), _renderSurface->pitch, 0, 0, _renderSurface->w, _renderSurface->h); g_system->updateScreen(); } diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 9efeea9cad..faaa3b138c 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -160,8 +160,8 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur format = surf.format; // We need to cast the const qualifier away here because 'pixels' // always needs to be writable. 'surf' however is a constant Surface, - // thus getBasePtr will always return const pixel data. - pixels = const_cast(surf.getBasePtr(0, 0)); + // thus getPixels will always return const pixel data. + pixels = const_cast(surf.getPixels()); } } @@ -339,7 +339,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = srcImage.scale(width, height); - savedPixels = (byte *)img->getBasePtr(0, 0); + savedPixels = (byte *)img->getPixels(); } else { img = &srcImage; } diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index ac24c6f15e..f68e952dfb 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -369,14 +369,14 @@ void VideoTheoraPlayer::writeAlpha() { if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) { assert(_alphaImage->getSurface()->format.bytesPerPixel == 4); assert(_surface.format.bytesPerPixel == 4); - const byte *alphaData = (const byte *)_alphaImage->getSurface()->getBasePtr(0, 0); + const byte *alphaData = (const byte *)_alphaImage->getSurface()->getPixels(); #ifdef SCUMM_LITTLE_ENDIAN int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8); #else int alphaPlace = 3 - (_alphaImage->getSurface()->format.aShift / 8); #endif alphaData += alphaPlace; - byte *imgData = (byte *)_surface.getBasePtr(0, 0); + byte *imgData = (byte *)_surface.getPixels(); #ifdef SCUMM_LITTLE_ENDIAN imgData += (_surface.format.aShift / 8); #else -- cgit v1.2.3 From 7670680aa8ca1975b7c481ac8b402e8b2df17081 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:45:04 +0200 Subject: IPHONE: Take advantage of Surface::getPixels. --- backends/platform/iphone/osys_video.mm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index a11bf32c54..d48003be95 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -310,7 +310,7 @@ void OSystem_IPHONE::hideOverlay() { void OSystem_IPHONE::clearOverlay() { //printf("clearOverlay()\n"); - bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch); + bzero(_videoContext->overlayTexture.getPixels(), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch); dirtyFullOverlayScreen(); } @@ -319,7 +319,7 @@ void OSystem_IPHONE::grabOverlay(void *buf, int pitch) { int h = _videoContext->overlayHeight; byte *dst = (byte *)buf; - const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0); + const byte *src = (const byte *)_videoContext->overlayTexture.getPixels(); do { memcpy(dst, src, _videoContext->overlayWidth * sizeof(uint16)); src += _videoContext->overlayTexture.pitch; @@ -428,7 +428,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot _mouseKeyColor = keycolor; - memcpy(_mouseBuffer.getBasePtr(0, 0), buf, h * _mouseBuffer.pitch); + memcpy(_mouseBuffer.getPixels(), buf, h * _mouseBuffer.pitch); _mouseDirty = true; _mouseNeedTextureUpdate = true; @@ -464,7 +464,7 @@ void OSystem_IPHONE::updateMouseTexture() { else palette = _gamePaletteRGBA5551; - uint16 *mouseBuf = (uint16 *)mouseTexture.getBasePtr(0, 0); + uint16 *mouseBuf = (uint16 *)mouseTexture.getPixels(); for (uint x = 0; x < _videoContext->mouseWidth; ++x) { for (uint y = 0; y < _videoContext->mouseHeight; ++y) { const byte color = *(const byte *)_mouseBuffer.getBasePtr(x, y); @@ -475,12 +475,12 @@ void OSystem_IPHONE::updateMouseTexture() { } } } else { - if (crossBlit((byte *)mouseTexture.getBasePtr(0, 0), (const byte *)_mouseBuffer.getBasePtr(0, 0), mouseTexture.pitch, + if (crossBlit((byte *)mouseTexture.getPixels(), (const byte *)_mouseBuffer.getPixels(), mouseTexture.pitch, _mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) { if (!_mouseBuffer.format.aBits()) { // Apply color keying since the original cursor had no alpha channel. - const uint16 *src = (const uint16 *)_mouseBuffer.getBasePtr(0, 0); - uint8 *dstRaw = (uint8 *)mouseTexture.getBasePtr(0, 0); + const uint16 *src = (const uint16 *)_mouseBuffer.getPixels(); + uint8 *dstRaw = (uint8 *)mouseTexture.getPixels(); for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) { uint16 *dst = (uint16 *)dstRaw; @@ -495,7 +495,7 @@ void OSystem_IPHONE::updateMouseTexture() { } else { // TODO: Log this! // Make the cursor all transparent... we really need a better fallback ;-). - memset(mouseTexture.getBasePtr(0, 0), 0, mouseTexture.h * mouseTexture.pitch); + memset(mouseTexture.getPixels(), 0, mouseTexture.h * mouseTexture.pitch); } } -- cgit v1.2.3 From 79c124842bae01e2be82192f23001bec5c55710b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:45:19 +0200 Subject: OPENGL: Take advantage of Surface::getPixels. --- backends/graphics/opengl/opengl-graphics.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index d126ebc212..84be83d524 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -385,15 +385,15 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) { #ifdef USE_RGB_COLOR if (_screenFormat.bytesPerPixel == 1) { - memset(_screenData.getBasePtr(0, 0), col, _screenData.h * _screenData.pitch); + memset(_screenData.getPixels(), col, _screenData.h * _screenData.pitch); } else if (_screenFormat.bytesPerPixel == 2) { - uint16 *pixels = (uint16 *)_screenData.getBasePtr(0, 0); + uint16 *pixels = (uint16 *)_screenData.getPixels(); uint16 col16 = (uint16)col; for (int i = 0; i < _screenData.w * _screenData.h; i++) { pixels[i] = col16; } } else if (_screenFormat.bytesPerPixel == 3) { - uint8 *pixels = (uint8 *)_screenData.getBasePtr(0, 0); + uint8 *pixels = (uint8 *)_screenData.getPixels(); byte r = (col >> 16) & 0xFF; byte g = (col >> 8) & 0xFF; byte b = col & 0xFF; @@ -404,13 +404,13 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) { pixels += 3; } } else if (_screenFormat.bytesPerPixel == 4) { - uint32 *pixels = (uint32 *)_screenData.getBasePtr(0, 0); + uint32 *pixels = (uint32 *)_screenData.getPixels(); for (int i = 0; i < _screenData.w * _screenData.h; i++) { pixels[i] = col; } } #else - memset(_screenData.getBasePtr(0, 0), col, _screenData.h * _screenData.pitch); + memset(_screenData.getPixels(), col, _screenData.h * _screenData.pitch); #endif _screenNeedsRedraw = true; } @@ -463,12 +463,12 @@ Graphics::PixelFormat OpenGLGraphicsManager::getOverlayFormat() const { void OpenGLGraphicsManager::clearOverlay() { // Set all pixels to 0 - memset(_overlayData.getBasePtr(0, 0), 0, _overlayData.h * _overlayData.pitch); + memset(_overlayData.getPixels(), 0, _overlayData.h * _overlayData.pitch); _overlayNeedsRedraw = true; } void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) { - const byte *src = (byte *)_overlayData.getBasePtr(0, 0); + const byte *src = (byte *)_overlayData.getPixels(); byte *dst = (byte *)buf; for (int i = 0; i < _overlayData.h; i++) { // Copy overlay data to buffer @@ -609,7 +609,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int _cursorData.create(w, h, _cursorFormat); // Save cursor data - memcpy(_cursorData.getBasePtr(0, 0), buf, h * _cursorData.pitch); + memcpy(_cursorData.getPixels(), buf, h * _cursorData.pitch); // Set cursor info _cursorState.w = w; @@ -778,7 +778,7 @@ void OpenGLGraphicsManager::refreshCursor() { palette = _cursorPalette; // Convert the paletted cursor to RGBA8888 - const byte *src = (byte *)_cursorData.getBasePtr(0, 0); + const byte *src = (byte *)_cursorData.getPixels(); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -794,7 +794,7 @@ void OpenGLGraphicsManager::refreshCursor() { // Convert the RGB cursor to RGBA8888 if (_cursorFormat.bytesPerPixel == 2) { - const uint16 *src = (uint16 *)_cursorData.getBasePtr(0, 0); + const uint16 *src = (uint16 *)_cursorData.getPixels(); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -806,7 +806,7 @@ void OpenGLGraphicsManager::refreshCursor() { dst += 4; } } else if (_cursorFormat.bytesPerPixel == 4) { - const uint32 *src = (uint32 *)_cursorData.getBasePtr(0, 0); + const uint32 *src = (uint32 *)_cursorData.getPixels(); for (int i = 0; i < _cursorState.w * _cursorState.h; i++) { // Check for keycolor if (src[i] != _cursorKeyColor) { @@ -1354,7 +1354,7 @@ void OpenGLGraphicsManager::updateOSD() { _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat); else // Clear everything - memset(_osdSurface.getBasePtr(0, 0), 0, _osdSurface.h * _osdSurface.pitch); + memset(_osdSurface.getPixels(), 0, _osdSurface.h * _osdSurface.pitch); // Determine a rect which would contain the message string (clipped to the // screen dimensions). @@ -1388,7 +1388,7 @@ void OpenGLGraphicsManager::updateOSD() { } // Update the texture - _osdTexture->updateBuffer(_osdSurface.getBasePtr(0, 0), _osdSurface.pitch, 0, 0, + _osdTexture->updateBuffer(_osdSurface.getPixels(), _osdSurface.pitch, 0, 0, _osdSurface.w, _osdSurface.h); } #endif -- cgit v1.2.3 From f386e15b6f6f1862264d3cb79d98bfeebf841480 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:45:32 +0200 Subject: SDL: Take advantage of Surface::getPixels. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index e36e43b05e..860ed0f4a3 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -1340,8 +1340,8 @@ void SurfaceSdlGraphicsManager::unlockScreen() { void SurfaceSdlGraphicsManager::fillScreen(uint32 col) { Graphics::Surface *screen = lockScreen(); - if (screen && screen->getBasePtr(0, 0)) - memset(screen->getBasePtr(0, 0), col, screen->h * screen->pitch); + if (screen && screen->getPixels()) + memset(screen->getPixels(), col, screen->h * screen->pitch); unlockScreen(); } -- cgit v1.2.3 From 767f0d8ca9114ea05cc1e8c5dc1940cc9718c306 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:45:42 +0200 Subject: BACKENDS: Take advantage of Surface::getPixels. --- backends/base-backend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp index f410270d9e..3e95c3e26a 100644 --- a/backends/base-backend.cpp +++ b/backends/base-backend.cpp @@ -57,7 +57,7 @@ void BaseBackend::initBackend() { void BaseBackend::fillScreen(uint32 col) { Graphics::Surface *screen = lockScreen(); - if (screen && screen->getBasePtr(0, 0)) - memset(screen->getBasePtr(0, 0), col, screen->h * screen->pitch); + if (screen && screen->getPixels()) + memset(screen->getPixels(), col, screen->h * screen->pitch); unlockScreen(); } -- cgit v1.2.3 From 260ec7a430b34f75ec6c30f0f8f444bb7397341e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:42:37 +0200 Subject: GRAPHICS: Add two new methods to change 'pixels' of a Surface. One method is a simpler setter for 'pixels'. The other one can be used to setup a Surface with custom data. --- graphics/surface.cpp | 8 ++++++++ graphics/surface.h | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 010389c9fa..728c6db12c 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -82,6 +82,14 @@ void Surface::free() { format = PixelFormat(); } +void Surface::init(uint16 width, uint16 height, uint16 newPitch, void *newPixels, const PixelFormat &f) { + w = width; + h = height; + pitch = newPitch; + pixels = newPixels; + format = f; +} + void Surface::copyFrom(const Surface &surf) { create(surf.w, surf.h, surf.format); if (surf.pitch == pitch) { diff --git a/graphics/surface.h b/graphics/surface.h index d685853009..8ce2cf3ecc 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -95,6 +95,15 @@ struct Surface { return pixels; } + /** + * Sets the pixel data. + * + * Note that this is a simply setter. Be careful what you are doing! + * + * @param newPixels The new pixel data. + */ + void setPixels(void *newPixels) { pixels = newPixels; } + /** * Return a pointer to the pixel at the specified point. * @@ -139,6 +148,20 @@ struct Surface { */ void free(); + /** + * Set up the Surface with user specified data. + * + * Note that this simply sets the 'internal' attributes of the Surface. It + * will not take care of freeing old data via free or similar! + * + * @param width Width of the pixel data. + * @param height Height of the pixel data. + * @param pitch The pitch of the pixel data. + * @param pixels The pixel data itself. + * @param format The pixel format of the pixel data. + */ + void init(uint16 width, uint16 height, uint16 pitch, void *pixels, const PixelFormat &format); + /** * Copy the data from another Surface. * -- cgit v1.2.3 From c22d91405429ad9866c6340939943aa21cd49d03 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:48:41 +0200 Subject: SCUMM: Do not set Surface::pixels directly anymore. --- engines/scumm/base-costume.cpp | 6 +++--- engines/scumm/cursor.cpp | 8 +++----- engines/scumm/gfx.cpp | 2 +- engines/scumm/object.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index ff9058538b..b87bc77c29 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -32,13 +32,13 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const _out = vs; if (drawToBackBuf) - _out.pixels = vs.getBackPixels(0, 0); + _out.setPixels(vs.getBackPixels(0, 0)); else - _out.pixels = vs.getPixels(0, 0); + _out.setPixels(vs.getPixels(0, 0)); _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _out.w = _out.pitch / _vm->_bytesPerPixel; - _out.pixels = (byte *)_out.getBasePtr(-(_vm->_virtscr[kMainVirtScreen].xstart & 7), 0); + _out.setPixels((byte *)_out.getPixels() - (_vm->_virtscr[kMainVirtScreen].xstart & 7)); _numStrips = numStrips; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 3eb7246b3a..721644b554 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -417,13 +417,11 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { Graphics::Surface s; byte buf[16*17]; memset(buf, 123, 16*17); - s.pixels = buf; - s.w = _charset->getCharWidth(chr); - s.h = _charset->getFontHeight(); - s.pitch = s.w; + s.init(_charset->getCharWidth(chr), _charset->getFontHeight(), + _charset->getCharWidth(chr), buf, + Graphics::PixelFormat::createFormatCLUT8()); // s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917 assert(s.w <= 16 && s.h <= 17); - s.format = Graphics::PixelFormat::createFormatCLUT8(); _charset->drawChar(chr, s, 0, 0); diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 3da07610eb..57436dc03c 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -421,7 +421,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int } _res->createResource(rtBuffer, slot + 1, size); - vs->pixels = getResourceAddress(rtBuffer, slot + 1); + vs->setPixels(getResourceAddress(rtBuffer, slot + 1)); memset(vs->getPixels(0, 0), 0, size); // reset background if (twobufs) { diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index ed77a863cd..d266183f85 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -1715,7 +1715,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { error("object %d is not a blast object", eo->number); bdd.dst = *vs; - bdd.dst.pixels = vs->getPixels(0, 0); + bdd.dst.setPixels(vs->getPixels(0, 0)); bdd.x = eo->rect.left; bdd.y = eo->rect.top; -- cgit v1.2.3 From 61fcf866798a0066d5aabd6cc0ec26f4356acb69 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:50:06 +0200 Subject: HUGO: Do not set Surface::pixels directly anymore. --- engines/hugo/intro.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index 505e356049..6f314c8774 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -89,11 +89,7 @@ void intro_v1d::preNewGame() { void intro_v1d::introInit() { _introState = 0; _introTicks = 0; - _surf.w = 320; - _surf.h = 200; - _surf.pixels = _vm->_screen->getFrontBuffer(); - _surf.pitch = 320; - _surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8()); _vm->_screen->displayList(kDisplayInit); } @@ -243,11 +239,7 @@ void intro_v2d::preNewGame() { void intro_v2d::introInit() { _vm->_screen->displayList(kDisplayInit); _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - _surf.w = 320; - _surf.h = 200; - _surf.pixels = _vm->_screen->getFrontBuffer(); - _surf.pitch = 320; - _surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8()); char buffer[128]; @@ -289,11 +281,7 @@ void intro_v3d::preNewGame() { void intro_v3d::introInit() { _vm->_screen->displayList(kDisplayInit); _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - _surf.w = 320; - _surf.h = 200; - _surf.pixels = _vm->_screen->getFrontBuffer(); - _surf.pitch = 320; - _surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _surf.init(320, 200, 320, _vm->_screen->getFrontBuffer(), Graphics::PixelFormat::createFormatCLUT8()); char buffer[128]; if (_vm->_boot._registered) -- cgit v1.2.3 From 3917608df7153fccdd70c28d24e187233d653b58 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:52:28 +0200 Subject: MORTEVIELLE: Do not set Surface::pixels directly anymore. --- engines/mortevielle/graphics.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index dd0710655c..059f5a9be8 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -897,12 +897,7 @@ Graphics::Surface ScreenSurface::lockArea(const Common::Rect &bounds) { _dirtyRects.push_back(bounds); Graphics::Surface s; - s.format = format; - s.pixels = getBasePtr(bounds.left, bounds.top); - s.pitch = pitch; - s.w = bounds.width(); - s.h = bounds.height(); - + s.init(bounds.width(), bounds.height(), pitch, getBasePtr(bounds.left, bounds.top), format); return s; } -- cgit v1.2.3 From d06cbe90435753055724927f57099d437393b0f3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:53:41 +0200 Subject: PARALLACTION: Do not set Surface::pixels directly anymore. --- engines/parallaction/exec_ns.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 3ea4332e50..816f220b1f 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -126,9 +126,7 @@ DECLARE_INSTRUCTION_OPCODE(put) { inst->_a->getFrameRect(r); Graphics::Surface v18; - v18.w = r.width(); - v18.h = r.height(); - v18.pixels = inst->_a->getFrameData(); + v18.init(r.width(), r.height(), r.width(), inst->_a->getFrameData(), Graphics::PixelFormat::createFormatCLUT8()); int16 x = inst->_opA.getValue(); int16 y = inst->_opB.getValue(); -- cgit v1.2.3 From eb224176391ff3860d4210d7c4fcca09bee3ea31 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:56:08 +0200 Subject: SWORD25: Do not set Surface::pixels directly anymore. --- engines/sword25/gfx/image/renderedimage.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index c0138c8fd3..346b46f3b4 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -251,14 +251,10 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe // Create an encapsulating surface for the data Graphics::Surface srcImage; // TODO: Is the data really in the screen format? - srcImage.format = g_system->getScreenFormat(); - srcImage.pitch = _width * 4; - srcImage.w = _width; - srcImage.h = _height; - srcImage.pixels = _data; + srcImage.init(_width, _height, _width * 4, _data, g_system->getScreenFormat()); if (pPartRect) { - srcImage.pixels = &_data[pPartRect->top * srcImage.pitch + pPartRect->left * 4]; + srcImage.setPixels(&_data[pPartRect->top * srcImage.pitch + pPartRect->left * 4]); srcImage.w = pPartRect->right - pPartRect->left; srcImage.h = pPartRect->bottom - pPartRect->top; @@ -464,7 +460,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } if (imgScaled) { - imgScaled->pixels = savedPixels; + imgScaled->setPixels(savedPixels); imgScaled->free(); delete imgScaled; } -- cgit v1.2.3 From b7330ea28bad73d6ed2cb405134cbde4b58a8161 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:57:39 +0200 Subject: TSAGE: Do not set Surface::pixels directly anymore. --- engines/tsage/graphics.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 3080cfe7c2..1815c3d751 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -332,12 +332,7 @@ Graphics::Surface GfxSurface::lockSurface() { // Setup the returned surface either as one pointing to the same pixels as the source, or // as a subset of the source one based on the currently set bounds Graphics::Surface result; - result.w = _bounds.width(); - result.h = _bounds.height(); - result.pitch = src->pitch; - result.format = src->format; - result.pixels = src->getBasePtr(_bounds.left, _bounds.top); - + result.init(_bounds.width(), _bounds.height(), src->pitch, src->getBasePtr(_bounds.left, _bounds.top), src->format); return result; } -- cgit v1.2.3 From d5298006f3af4af61443e4b4a91d4cef5ae84f89 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 04:05:21 +0200 Subject: WINTERMUTE: Do not set Surface::pixels directly anymore. --- engines/wintermute/graphics/transparent_surface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index faaa3b138c..459669154a 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -347,13 +347,13 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p // Handle off-screen clipping if (posY < 0) { img->h = MAX(0, (int)img->h - -posY); - img->pixels = (byte *)img->getBasePtr(0, -posY); + img->setPixels((byte *)img->getBasePtr(0, -posY)); posY = 0; } if (posX < 0) { img->w = MAX(0, (int)img->w - -posX); - img->pixels = (byte *)img->getBasePtr(-posX, 0); + img->setPixels((byte *)img->getBasePtr(-posX, 0)); posX = 0; } @@ -490,7 +490,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p retSize.setHeight(img->h); if (imgScaled) { - imgScaled->pixels = savedPixels; + imgScaled->setPixels(savedPixels); imgScaled->free(); delete imgScaled; } -- cgit v1.2.3 From 9a80fa88e0742c38eeb32fd91334570fff6c60ae Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 04:07:44 +0200 Subject: SDL: Do not set Surface::pixels directly anymore. --- .../graphics/surfacesdl/surfacesdl-graphics.cpp | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 860ed0f4a3..871c6c49b2 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -1308,15 +1308,13 @@ Graphics::Surface *SurfaceSdlGraphicsManager::lockScreen() { if (SDL_LockSurface(_screen) == -1) error("SDL_LockSurface failed: %s", SDL_GetError()); - _framebuffer.pixels = _screen->pixels; - _framebuffer.w = _screen->w; - _framebuffer.h = _screen->h; - _framebuffer.pitch = _screen->pitch; + _framebuffer.init(_screen->w, _screen->h, _screen->pitch, _screen->pixels, #ifdef USE_RGB_COLOR - _framebuffer.format = _screenFormat; + _screenFormat #else - _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); + Graphics::PixelFormat::createFormatCLUT8() #endif + ); return &_framebuffer; } @@ -2062,15 +2060,12 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) { error("displayMessageOnOSD: SDL_LockSurface failed: %s", SDL_GetError()); Graphics::Surface dst; - dst.pixels = _osdSurface->pixels; - dst.w = _osdSurface->w; - dst.h = _osdSurface->h; - dst.pitch = _osdSurface->pitch; - dst.format = Graphics::PixelFormat(_osdSurface->format->BytesPerPixel, - 8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss, - 8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss, - _osdSurface->format->Rshift, _osdSurface->format->Gshift, - _osdSurface->format->Bshift, _osdSurface->format->Ashift); + dst.init(_osdSurface->w, _osdSurface->h, _osdSurface->pitch, _osdSurface->pixels, + Graphics::PixelFormat(_osdSurface->format->BytesPerPixel, + 8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss, + 8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss, + _osdSurface->format->Rshift, _osdSurface->format->Gshift, + _osdSurface->format->Bshift, _osdSurface->format->Ashift)); // The font we are going to use: const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); -- cgit v1.2.3 From 0cb1504a5b96ad90634a86af8cad30ecc6588517 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 04:11:40 +0200 Subject: VIDEO: Do not set Surface::pixels directly anymore. --- video/coktel_decoder.cpp | 15 ++++----------- video/dxa_decoder.cpp | 6 +++--- video/theora_decoder.cpp | 9 +++------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 32eef5acc3..40ac035582 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -97,12 +97,8 @@ void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uin assert(bpp == getPixelFormat().bytesPerPixel); // Create a surface over this memory - _surface.w = width; - _surface.h = height; - _surface.pitch = width * bpp; - _surface.pixels = mem; // TODO: Check whether it is fine to assume we want the setup PixelFormat. - _surface.format = getPixelFormat(); + _surface.init(width, height, width * bpp, mem, getPixelFormat()); _ownSurface = false; } @@ -143,7 +139,7 @@ void CoktelDecoder::freeSurface() { _surface.w = 0; _surface.h = 0; _surface.pitch = 0; - _surface.pixels = 0; + _surface.setPixels(0); _surface.format = Graphics::PixelFormat(); } else _surface.free(); @@ -1879,11 +1875,8 @@ bool VMDDecoder::assessVideoProperties() { _videoBuffer[i] = new byte[_videoBufferSize]; memset(_videoBuffer[i], 0, _videoBufferSize); - _8bppSurface[i].w = _width * _bytesPerPixel; - _8bppSurface[i].h = _height; - _8bppSurface[i].pitch = _width * _bytesPerPixel; - _8bppSurface[i].pixels = _videoBuffer[i]; - _8bppSurface[i].format = Graphics::PixelFormat::createFormatCLUT8(); + _8bppSurface[i].init(_width * _bytesPerPixel, _height, _width * _bytesPerPixel, + _videoBuffer[i], Graphics::PixelFormat::createFormatCLUT8()); } } diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp index 5ac9bd2088..27b1664b07 100644 --- a/video/dxa_decoder.cpp +++ b/video/dxa_decoder.cpp @@ -521,17 +521,17 @@ const Graphics::Surface *DXADecoder::DXAVideoTrack::decodeNextFrame() { memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width); memset(&_scaledBuffer[((2 * cy) + 1) * _width], 0, _width); } - _surface->pixels = _scaledBuffer; + _surface->setPixels(_scaledBuffer); break; case S_DOUBLE: for (int cy = 0; cy < _curHeight; cy++) { memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width); memcpy(&_scaledBuffer[((2 * cy) + 1) * _width], &_frameBuffer1[cy * _width], _width); } - _surface->pixels = _scaledBuffer; + _surface->setPixels(_scaledBuffer); break; case S_NONE: - _surface->pixels = _frameBuffer1; + _surface->setPixels(_frameBuffer1); break; } diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp index 63aa93e2f5..53e528faf2 100644 --- a/video/theora_decoder.cpp +++ b/video/theora_decoder.cpp @@ -262,11 +262,8 @@ TheoraDecoder::TheoraVideoTrack::TheoraVideoTrack(const Graphics::PixelFormat &f _surface.create(theoraInfo.frame_width, theoraInfo.frame_height, format); // Set up a display surface - _displaySurface.pixels = _surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y); - _displaySurface.w = theoraInfo.pic_width; - _displaySurface.h = theoraInfo.pic_height; - _displaySurface.format = format; - _displaySurface.pitch = _surface.pitch; + _displaySurface.init(theoraInfo.pic_width, theoraInfo.pic_height, _surface.pitch, + _surface.getBasePtr(theoraInfo.pic_x, theoraInfo.pic_y), format); // Set the frame rate _frameRate = Common::Rational(theoraInfo.fps_numerator, theoraInfo.fps_denominator); @@ -280,7 +277,7 @@ TheoraDecoder::TheoraVideoTrack::~TheoraVideoTrack() { th_decode_free(_theoraDecode); _surface.free(); - _displaySurface.pixels = 0; + _displaySurface.setPixels(0); } bool TheoraDecoder::TheoraVideoTrack::decodePacket(ogg_packet &oggPacket) { -- cgit v1.2.3 From c79ce89680d2c46e468152791a46f2700d04b336 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Aug 2013 12:09:13 +0200 Subject: MORTEVIELLE: Rework code using _openObjects --- engines/mortevielle/actions.cpp | 52 +++++++++++++++++---------------------- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 16 ++++++------ 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5738a8fd3a..f9426def85 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -503,13 +503,10 @@ void MortevielleEngine::fctSearch() { if (_num == 0) { setCoordinates(7); if (_num != 0) { - int cx = 0; - do { - ++cx; - } while ((cx <= 6) && (_num != _openObjects[cx])); - if (_num != _openObjects[cx]) - _crep = 187; - else { + int i; + for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++) + ; + if (_num == _openObjects[i]) { if (_currBitIndex > 0) _coreVar._faithScore += 3; @@ -521,7 +518,8 @@ void MortevielleEngine::fctSearch() { tsuiv(); } else _crep = 997; - } + } else + _crep = 187; } else { setCoordinates(8); _crep = 997; @@ -608,11 +606,10 @@ void MortevielleEngine::fctOpen() { if (_currBitIndex > 0) _coreVar._faithScore += 2; ++_openObjCount; - int tmpPlace = 0; - do { - ++tmpPlace; - } while (!((tmpPlace > 6) || (_openObjects[tmpPlace] == 0) || (_openObjects[tmpPlace] == _num))); - if (_openObjects[tmpPlace] != _num) { + int i; + for (i = 1; !(i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++) + ; + if (_openObjects[i] != _num) { if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) || (_coreVar._currPlace == ROOM9) || (_coreVar._currPlace == BLUE_ROOM) @@ -635,10 +632,10 @@ void MortevielleEngine::fctOpen() { if (getRandomNumber(1, 4) == 3) _speechManager.startSpeech(7, 9, 1); } - _openObjects[tmpPlace] = _num; + _openObjects[i] = _num; displayAnimFrame(1, _num); } - tmpPlace = _coreVar._currPlace; + int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; _crep = _tabdon[kAouvr + (tmpPlace * 7) + _num - 1]; @@ -886,14 +883,13 @@ void MortevielleEngine::fctClose() { return; setCoordinates(7); if (_num != 0) { - int cx = 0; - do { - ++cx; - } while ((cx <= 6) && (_num != _openObjects[cx])); - if (_num == _openObjects[cx]) { + int i; + for (i = 1; (i <= 6) && (_num != _openObjects[i]); ++i) + ; + if (_num == _openObjects[i]) { displayAnimFrame(2, _num); _crep = 998; - _openObjects[cx] = 0; + _openObjects[i] = 0; --_openObjCount; if (_openObjCount < 0) _openObjCount = 0; @@ -983,16 +979,14 @@ void MortevielleEngine::fctSelfPut() { if (chai == 0) _crep = 997; else { - int cx = 0; - do { - ++cx; - } while ((cx <= 6) && (_num != _openObjects[cx])); - if (_num != _openObjects[cx]) - _crep = 187; - else { + int i; + for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++) + ; + if (_num == _openObjects[i]) { _mchai = chai; _crep = 999; - } + } else + _crep = 187; } } else { setCoordinates(8); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 795bac5652..62935137b0 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -257,7 +257,7 @@ private: Common::String _hintPctMessage; byte *_cfiecBuffer; int _cfiecBufferSize; - int _openObjects[8]; + int _openObjects[7]; uint16 _dialogIndexArray[kMaxDialogIndex + 1]; Hint _dialogHintArray[kMaxDialogHint + 1]; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 8fa608953d..4985a6023c 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2717,8 +2717,8 @@ void MortevielleEngine::mapMessageId(int &mesgId) { * @remarks Originally called 'initouv' */ void MortevielleEngine::resetOpenObjects() { - for (int cx = 1; cx <= 7; ++cx) - _openObjects[cx] = 0; + for (int i = 1; i <= 6; ++i) + _openObjects[i] = 0; _openObjCount = 0; } @@ -2997,9 +2997,9 @@ void MortevielleEngine::drawPicture() { draw(0, 12); prepareScreenType1(); if ((_caff < 30) || (_caff > 32)) { - for (int cx = 1; cx <= 6; ++cx) { - if (_openObjects[cx] != 0) - displayAnimFrame(1, _openObjects[cx]); + for (int i = 1; i <= 6; ++i) { + if (_openObjects[i] != 0) + displayAnimFrame(1, _openObjects[i]); } if (_caff == ATTIC) { @@ -3230,11 +3230,11 @@ L1: _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); exitRoom(); _menu.setDestinationText(LANDING); - int cx = convertBitIndexToCharacterIndex(_currBitIndex); - _caff = 69 + cx; + int charIdx = convertBitIndexToCharacterIndex(_currBitIndex); + _caff = 69 + charIdx; _crep = _caff; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; + _currAction = (_menu._discussMenu[charIdx]._menuId << 8) | _menu._discussMenu[charIdx]._actionId; _syn = true; _col = true; } else { -- cgit v1.2.3 From 65b0b59bd50b715d6be859e723beb4e30ca9037b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Aug 2013 12:56:21 +0200 Subject: MORTEVIELLE: Some more renaming --- engines/mortevielle/actions.cpp | 26 ++++++------- engines/mortevielle/mortevielle.h | 12 +++--- engines/mortevielle/utils.cpp | 77 +++++++++++++++++++++++---------------- 3 files changed, 65 insertions(+), 50 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index f9426def85..6a368f6bce 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -209,8 +209,8 @@ void MortevielleEngine::fctTake() { _obpart = false; prepareDisplayText(); } else { - _tabdon[kAcha + ((_mchai - 1) * 10) + _searchCount - 1] = 0; - tsuiv(); + _tabdon[kAcha + ((_curSearchObjId - 1) * 10) + _searchCount - 1] = 0; + prepareNextObject(); ++_takeObjCount; if (_takeObjCount > 6) { _coreVar._faithScore += 2; @@ -510,12 +510,12 @@ void MortevielleEngine::fctSearch() { if (_currBitIndex > 0) _coreVar._faithScore += 3; - _mchai = rechai(); - if (_mchai != 0) { + _curSearchObjId = getFirstObject(); + if (_curSearchObjId != 0) { _searchCount = 0; _heroSearching = true; _menu.setSearchMenu(); - tsuiv(); + prepareNextObject(); } else _crep = 997; } else @@ -893,9 +893,9 @@ void MortevielleEngine::fctClose() { --_openObjCount; if (_openObjCount < 0) _openObjCount = 0; - int chai = rechai(); - if (_mchai == chai) - _mchai = 0; + int objId = getFirstObject(); + if (_curSearchObjId == objId) + _curSearchObjId = 0; } else { _crep = 187; } @@ -964,7 +964,7 @@ void MortevielleEngine::fctSelfPut() { else { if (_caff > 99) { _crep = 999; - ajchai(); + putObject(); if (_crep != 192) displayEmptyHand(); return; @@ -975,15 +975,15 @@ void MortevielleEngine::fctSelfPut() { setCoordinates(7); _crep = 124; if (_num != 0) { - int chai = rechai(); - if (chai == 0) + int objId = getFirstObject(); + if (objId == 0) _crep = 997; else { int i; for (i = 1; (i <= 6) && (_num != _openObjects[i]); i++) ; if (_num == _openObjects[i]) { - _mchai = chai; + _curSearchObjId = objId; _crep = 999; } else _crep = 187; @@ -1036,7 +1036,7 @@ void MortevielleEngine::fctSelfPut() { _crep = 185; if ((_crep == 999) || (_crep == 185) || (_crep == 998)) { if (_crep == 999) - ajchai(); + putObject(); if (_crep != 192) displayEmptyHand(); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 62935137b0..fc5c7ad25e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -112,7 +112,7 @@ const int kFleche = 1758; const int kAsoul = 154; const int kAouvr = 282; -const int kAchai = 387; +const int kAsearch = 387; const int kArcf = 1272; const int kArep = 1314; const int kAmzon = 1650; @@ -234,7 +234,7 @@ private: int _day; int _hour; int _minute; - int _mchai; + int _curSearchObjId; int _controlMenu; int _startHour; int _endHour; @@ -411,17 +411,17 @@ private: void putInHand(int &objId); void initMaxAnswer(); void displayAnimFrame(int frameNum, int animId); + int getFirstObject(); + void prepareNextObject(); + void putObject(); + void resetObjectPlace(); - void copcha(); void adzon(); void premtet(); - void ajchai(); void ecr2(Common::String text); void tlu(int af, int ob); void mennor(); - void tsuiv(); void treg(int objId); - int rechai(); public: Common::Point _prevPos; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 4985a6023c..9e72f81195 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -332,7 +332,7 @@ void MortevielleEngine::handleAction() { _caff = _coreVar._currPlace; _crep = 998; } else - tsuiv(); + prepareNextObject(); mennor(); } } @@ -1284,7 +1284,7 @@ void MortevielleEngine::startMusicOrSpeech(int so) { void MortevielleEngine::loseGame() { resetOpenObjects(); _roomDoorId = OWN_ROOM; - _mchai = 0; + _curSearchObjId = 0; _menu.unsetSearchMenu(); if (!_blo) getPresence(MANOR_FRONT); @@ -1497,7 +1497,7 @@ void MortevielleEngine::gameLoaded() { _roomDoorId = OWN_ROOM; _syn = true; _heroSearching = true; - _mchai = 0; + _curSearchObjId = 0; _manorDistance = 0; resetOpenObjects(); _takeObjCount = 0; @@ -1914,7 +1914,11 @@ Common::String MortevielleEngine::getString(int num) { return wrkStr; } -void MortevielleEngine::copcha() { +/** + * Reset object place + * @remarks Originally called 'copcha' + */ +void MortevielleEngine::resetObjectPlace() { for (int i = kAcha; i < kAcha + 390; i++) _tabdon[i] = _tabdon[i + 390]; } @@ -1924,7 +1928,7 @@ void MortevielleEngine::copcha() { * @remarks Originally called 'inzon' */ void MortevielleEngine::resetVariables() { - copcha(); + resetObjectPlace(); _coreVar._alreadyEnteredManor = false; _coreVar._selectedObjectId = 0; @@ -3098,7 +3102,7 @@ void MortevielleEngine::exitRoom() { resetOpenObjects(); _roomDoorId = OWN_ROOM; - _mchai = 0; + _curSearchObjId = 0; resetRoomVariables(_coreVar._currPlace); } @@ -3171,15 +3175,18 @@ void MortevielleEngine::premtet() { _screenSurface.drawBox(18, 79, 155, 92, 15); } -void MortevielleEngine::ajchai() { - int cy = kAcha + ((_mchai - 1) * 10) - 1; - int cx = 0; - do { - ++cx; - } while ((cx <= 9) && (_tabdon[cy + cx] != 0)); +/** + * Try to put an object somewhere + * @remarks Originally called 'ajchai' + */ +void MortevielleEngine::putObject() { + int putId = kAcha + ((_curSearchObjId - 1) * 10) - 1; + int i; + for (i = 1; (i <= 9) && (_tabdon[putId + i] != 0); i++) + ; - if (_tabdon[cy + cx] == 0) - _tabdon[cy + cx] = _coreVar._selectedObjectId; + if (_tabdon[putId + i] == 0) + _tabdon[putId + i] = _coreVar._selectedObjectId; else _crep = 192; } @@ -3189,10 +3196,10 @@ void MortevielleEngine::ajchai() { * @remarks Originally called 'ajjer' */ void MortevielleEngine::addObjectToInventory(int objectId) { - int i = 0; - do { - ++i; - } while ((i <= 5) && (_coreVar._inventory[i] != 0)); + int i; + + for (i = 1; (i <= 5) && (_coreVar._inventory[i] != 0); i++) + ; if (_coreVar._inventory[i] == 0) { _coreVar._inventory[i] = objectId; @@ -3256,26 +3263,30 @@ L1: _menu.drawMenu(); } -void MortevielleEngine::tsuiv() { - int tbcl; - int cy = kAcha + ((_mchai - 1) * 10) - 1; - int cx = 0; +/** + * Search - Prepare next object + * @remarks Originally called 'tsuiv' + */ +void MortevielleEngine::prepareNextObject() { + int objId; + int tabIdx = kAcha + ((_curSearchObjId - 1) * 10) - 1; + int localSeearchCount = 0; do { - ++cx; + ++localSeearchCount; ++_searchCount; - int cl = cy + _searchCount; - tbcl = _tabdon[cl]; - } while ((tbcl == 0) && (_searchCount <= 9)); + objId = _tabdon[tabIdx + _searchCount]; + } while ((objId == 0) && (_searchCount <= 9)); - if ((tbcl != 0) && (_searchCount < 11)) { - _caff = tbcl; + if ((objId != 0) && (_searchCount < 11)) { + _caff = objId; _crep = _caff + 400; if (_currBitIndex != 0) + // Someone is present in the room _coreVar._faithScore += 2; } else { prepareDisplayText(); endSearch(); - if (cx > 9) + if (localSeearchCount > 9) _crep = 131; } } @@ -3413,13 +3424,17 @@ void MortevielleEngine::putInHand(int &objId) { } } -int MortevielleEngine::rechai() { +/** + * Search - Get the first object + * @remarks Originally called 'rechai' + */ +int MortevielleEngine::getFirstObject() { int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) tmpPlace = CELLAR; - return _tabdon[kAchai + (tmpPlace * 7) + _num - 1]; + return _tabdon[kAsearch + (tmpPlace * 7) + _num - 1]; } /** -- cgit v1.2.3 From 6d2f53a63c7f9c4d14b88629f7c644b6f9fd3644 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Aug 2013 13:18:34 +0200 Subject: MORTEVIELLE: Fix error in c79ce89680d2c46e468152791a46f2700d04b336 --- engines/mortevielle/actions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 6a368f6bce..3638847135 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -607,7 +607,7 @@ void MortevielleEngine::fctOpen() { _coreVar._faithScore += 2; ++_openObjCount; int i; - for (i = 1; !(i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++) + for (i = 1; (i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++) ; if (_openObjects[i] != _num) { if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) @@ -1135,8 +1135,8 @@ void MortevielleEngine::fctEnter() { else if (_roomDoorId == OWN_ROOM) _crep = 997; else if ((_roomDoorId == ROOM9) && (_coreVar._selectedObjectId != 136)) { - _crep = 189; - _coreVar._availableQuestion[8] = '*'; + _crep = 189; + _coreVar._availableQuestion[8] = '*'; } else { int z = 0; if (!_blo) -- cgit v1.2.3 From 178feb8e8bd46b0bb5222c7a4a09e6da91df9752 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 Aug 2013 14:55:19 +0200 Subject: MORTEVIELLE: Rename ROOM9 into JULIA_ROOM --- engines/mortevielle/actions.cpp | 10 +++++----- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 6 +++--- engines/mortevielle/utils.cpp | 32 ++++++++++++++++---------------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 3638847135..73d258af6c 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -283,7 +283,7 @@ void MortevielleEngine::fctTake() { || ((_coreVar._currPlace == RED_ROOM) && (_num == 2)) || ((_coreVar._currPlace == BATHROOM) && (_num == 6)) || ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 4)) - || ((_coreVar._currPlace == ROOM9) && (_num == 4)) + || ((_coreVar._currPlace == JULIA_ROOM) && (_num == 4)) || ((_coreVar._currPlace == DINING_ROOM) && (_num > 2)) || ((_coreVar._currPlace == BUREAU) && (_num == 7)) || ((_coreVar._currPlace == KITCHEN) && (_num == 6)) @@ -457,7 +457,7 @@ void MortevielleEngine::fctLook() { treg(147); if ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 3)) treg(149); - if ((_coreVar._currPlace == ROOM9) && (_num == 2)) + if ((_coreVar._currPlace == JULIA_ROOM) && (_num == 2)) treg(30); if ((_coreVar._currPlace == DINING_ROOM) && (_num == 3)) treg(31); @@ -611,7 +611,7 @@ void MortevielleEngine::fctOpen() { ; if (_openObjects[i] != _num) { if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM) - || (_coreVar._currPlace == ROOM9) + || (_coreVar._currPlace == JULIA_ROOM) || (_coreVar._currPlace == BLUE_ROOM) || (_coreVar._currPlace == BATHROOM))) || ((_num == 4) && ((_coreVar._currPlace == GREEN_ROOM) @@ -1134,7 +1134,7 @@ void MortevielleEngine::fctEnter() { showMoveMenuAlert(); else if (_roomDoorId == OWN_ROOM) _crep = 997; - else if ((_roomDoorId == ROOM9) && (_coreVar._selectedObjectId != 136)) { + else if ((_roomDoorId == JULIA_ROOM) && (_coreVar._selectedObjectId != 136)) { _crep = 189; _coreVar._availableQuestion[8] = '*'; } else { @@ -1155,7 +1155,7 @@ void MortevielleEngine::fctEnter() { _currMenu = MENU_DISCUSS; _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId; _syn = true; - if (_roomDoorId == ROOM9) { + if (_roomDoorId == JULIA_ROOM) { _col = true; _caff = 70; drawPictureWithText(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 2d45923032..c481b7371b 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -74,7 +74,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _roomPresencePat = false; _toiletsPresenceBobMax = false; _bathRoomPresenceBobMax = false; - _room9PresenceLeo = false; + _juliaRoomPresenceLeo = false; _soundOff = false; _largestClearScreen = false; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index fc5c7ad25e..37901bb1b3 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -138,7 +138,7 @@ const int kMaxPatt = 20; */ enum Places { OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4, - BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9, + BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, JULIA_ROOM = 9, DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14, LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19, CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24, @@ -213,7 +213,7 @@ private: bool _roomPresencePat; bool _toiletsPresenceBobMax; bool _bathRoomPresenceBobMax; - bool _room9PresenceLeo; + bool _juliaRoomPresenceLeo; bool _hiddenHero; bool _heroSearching; bool _keyPressedEsc; @@ -352,7 +352,7 @@ private: void setRandomPresencePurpleRoom(int faithScore); void setRandomPresenceBlueRoom(int faithScore); void setRandomPresenceRedRoom(int faithScore); - void setRandomPresenceRoom9(int faithScore); + void setRandomPresenceJuliaRoom(int faithScore); void setRandomPresenceDiningRoom(int faithScore); void setRandomPresenceBureau(int faithScore); void setRandomPresenceKitchen(int faithScore); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 9e72f81195..705237c4eb 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -492,8 +492,8 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { _toiletsPresenceBobMax = false; if (roomId != BATHROOM) _bathRoomPresenceBobMax = false; - if (roomId != ROOM9) - _room9PresenceLeo = false; + if (roomId != JULIA_ROOM) + _juliaRoomPresenceLeo = false; } /** @@ -870,7 +870,7 @@ void MortevielleEngine::setPresencePurpleRoom() { if (_place == PURPLE_ROOM) _purpleRoomPresenceLeo = true; else - _room9PresenceLeo = true; + _juliaRoomPresenceLeo = true; _currBitIndex = 10; } @@ -976,7 +976,7 @@ int MortevielleEngine::setPresenceLanding() { int rand = 0; do { rand = getRandomNumber(1, 8); - test = (((rand == 1) && (_purpleRoomPresenceLeo || _room9PresenceLeo)) || + test = (((rand == 1) && (_purpleRoomPresenceLeo || _juliaRoomPresenceLeo)) || ((rand == 2) && _roomPresencePat) || ((rand == 3) && _roomPresenceGuy) || ((rand == 4) && _roomPresenceEva) || @@ -1050,7 +1050,7 @@ int MortevielleEngine::getPresenceBitIndex(int roomId) { if (_roomPresenceIda) bitIndex = 2; // IDA } else if ( ((roomId == PURPLE_ROOM) && (_purpleRoomPresenceLeo)) - || ((roomId == ROOM9) && (_room9PresenceLeo))) + || ((roomId == JULIA_ROOM) && (_juliaRoomPresenceLeo))) bitIndex = 128; // LEO else if (roomId == DARKBLUE_ROOM) { if (_roomPresenceGuy) @@ -1152,8 +1152,8 @@ void MortevielleEngine::setRandomPresenceRedRoom(int faithScore) { * Engine function - Set Random Presence - Room 9 * @remarks Originally called 'pl9' */ -void MortevielleEngine::setRandomPresenceRoom9(int faithScore) { - if (!_room9PresenceLeo) { +void MortevielleEngine::setRandomPresenceJuliaRoom(int faithScore) { + if (!_juliaRoomPresenceLeo) { faithScore = -10; if (getRandomNumber(1, 100) > faithScore) // always true? displayAloneText(); @@ -2361,8 +2361,8 @@ void MortevielleEngine::prepareRoom() { case GREEN_ROOM2: setRandomPresenceRedRoom(_coreVar._faithScore); break; - case ROOM9: - setRandomPresenceRoom9(_coreVar._faithScore); + case JULIA_ROOM: + setRandomPresenceJuliaRoom(_coreVar._faithScore); break; case DINING_ROOM: setRandomPresenceDiningRoom(_coreVar._faithScore); @@ -2816,7 +2816,7 @@ int MortevielleEngine::getPresenceStats(int &rand, int faithScore, int roomId) { if ( ((roomId == GREEN_ROOM) && (!_roomPresenceLuc) && (!_roomPresenceIda)) || ((roomId == DARKBLUE_ROOM) && (!_roomPresenceGuy) && (!_roomPresenceEva)) ) retVal = getPresenceStatsGreenRoom(); - if ((roomId == PURPLE_ROOM) && (!_purpleRoomPresenceLeo) && (!_room9PresenceLeo)) + if ((roomId == PURPLE_ROOM) && (!_purpleRoomPresenceLeo) && (!_juliaRoomPresenceLeo)) retVal = getPresenceStatsPurpleRoom(); if ( ((roomId == TOILETS) && (!_toiletsPresenceBobMax)) || ((roomId == BATHROOM) && (!_bathRoomPresenceBobMax)) ) @@ -2826,10 +2826,10 @@ int MortevielleEngine::getPresenceStats(int &rand, int faithScore, int roomId) { if ( ((roomId == RED_ROOM) && (!_roomPresenceBob)) || ((roomId == GREEN_ROOM2) && (!_roomPresencePat))) retVal = getPresenceStatsRedRoom(); - if ((roomId == ROOM9) && (!_room9PresenceLeo) && (!_purpleRoomPresenceLeo)) + if ((roomId == JULIA_ROOM) && (!_juliaRoomPresenceLeo) && (!_purpleRoomPresenceLeo)) retVal = 10; - if ( ((roomId == PURPLE_ROOM) && (_room9PresenceLeo)) - || ((roomId == ROOM9) && (_purpleRoomPresenceLeo))) + if ( ((roomId == PURPLE_ROOM) && (_juliaRoomPresenceLeo)) + || ((roomId == JULIA_ROOM) && (_purpleRoomPresenceLeo))) retVal = -400; if (retVal != -500) { retVal += faithScore; @@ -2869,8 +2869,8 @@ void MortevielleEngine::setPresenceFlags(int roomId) { _bathRoomPresenceBobMax = true; else if (roomId == GREEN_ROOM2) _roomPresencePat = true; - else if (roomId == ROOM9) - _room9PresenceLeo = true; + else if (roomId == JULIA_ROOM) + _juliaRoomPresenceLeo = true; } /** @@ -2907,7 +2907,7 @@ int MortevielleEngine::getPresence(int roomId) { retVal = getPresenceBitIndex(_place); } - if (roomId > ROOM9) { + if (roomId > JULIA_ROOM) { if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26)) displayAloneText(); else { -- cgit v1.2.3 From 0a2e64b903a65e9ffcfc3f7f81eba708c774d0f2 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 3 Aug 2013 16:45:05 +0100 Subject: DEVTOOLS: Include English menu in mortevielle dat file --- devtools/create_mortdat/create_mortdat.cpp | 27 ++++++++++ devtools/create_mortdat/menudata.h | 79 +++++++++++++++++++++++++++++ dists/engine-data/mort.dat | Bin 75737 -> 75887 bytes engines/mortevielle/menu.cpp | 54 +++++++++++++++++--- 4 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 devtools/create_mortdat/menudata.h diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 653a0754eb..93ca721d95 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -41,6 +41,7 @@ #include "create_mortdat.h" #include "enginetext.h" #include "gametext.h" +#include "menudata.h" bool File::open(const char *filename, AccessMode mode) { @@ -200,10 +201,36 @@ void writeGameStrings() { writeStaticStrings(gameDataDe, kGameStrings, 2); } +/** + * Write out the data for the English menu + */ +void writeMenuBlock() { + // Write out a section header to the output file and the font data + const char menuHeader[4] = { 'M', 'E', 'N', 'U' }; + outputFile.write(menuHeader, 4); // Section Id + outputFile.writeWord(strlen(menuDataEn) / 8); // Section size + // Write each 8-characters block as a byte (one bit per character) + // ' ' -> 0, anything else -> 1 + byte value; + int valueCpt = 0; + const char* str = menuDataEn; + while (*str != 0) { + if (*(str++) != ' ') + value |= (1 << (7 - valueCpt)); + ++valueCpt; + if (valueCpt == 8) { + outputFile.writeByte(value); + value = 0; + valueCpt = 0; + } + } +} + void process() { writeFontBlock(); writeGameStrings(); writeEngineStrings(); + writeMenuBlock(); } /** diff --git a/devtools/create_mortdat/menudata.h b/devtools/create_mortdat/menudata.h new file mode 100644 index 0000000000..aa4557b336 --- /dev/null +++ b/devtools/create_mortdat/menudata.h @@ -0,0 +1,79 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This is a utility for extracting needed resource data from different language + * version of the Mortevielle executable files into a new file mort.dat - this + * is required for the ScummVM Mortevielle module to work properly + */ + +#ifndef MENUDATA_H +#define MENUDATA_H + +const char *menuDataEn = + " @@@ " + " @ " + " @ @ @@ @@@ @@@ " + " @ @ @ @ @ " + " @ @ @ @ @ " + " @ @ @ @ @ " + "@@@ @@@ @@ @@ " + " " + " @@ @@ " + " @@ @ @ " + " @ @ @ @ @@@ @@@ @@@" + " @ @ @ @ @ @ @ " + " @ @ @ @ @ @ " + " @ @ @ @ @ @ " + "@@@ @@@ @@@@ @@ " + " " + " @ @ " + " @@ @ " + " @ @ @@@@ @@@@ " + " @ @ @ @ @ " + " @@@@@ @ @ " + " @ @ @ @ @ " + "@@@ @@@ @@@ @@ " + " " + " @@@@@ @@@ @@@" + " @ @ @ @ @" + " @ @@@ @ @ " + " @@@@ @ @ @ @@@ " + " @ @@@@@ @ @ " + " @ @ @ @ @ " + "@@@@@@ @@@ @@@ @@@ " + " " + "@@@@@@@ @@@ @@@ " + "@ @ @ @ @ " + " @ @@@@ @ @ @@" + " @ @ @ @ @@ @ " + " @ @ @ @ @ @@ " + " @ @ @ @ @ @ " + "@@@ @@@@ @@@ @@@ @@@" + " " + " @@@@@@@ @ @@@ " + " @ @ @ " + " @ @ @@ @ @@@ " + " @@@@ @ @ @ @" + " @ @ @ @ @@@@@ " + " @ @ @ @ " + "@@@ @@@ @@@ @@@ " + " "; + +#endif diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index fca30ab238..466c491a25 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f86fd208c1..aa8d67e98a 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -491,14 +491,56 @@ void Menu::initMenu(MortevielleEngine *vm) { int i; Common::File f; + + bool enMenuLoaded = false; + if (_vm->getLanguage() == Common::EN_ANY) { + // Open the mort.dat file + if (!f.open(MORT_DAT)) + warning("File %s not found. Using default menu from game data", MORT_DAT); + else { + // Validate the data file header + char fileId[4]; + f.read(fileId, 4); + // Do not display warnings here. They would already have been displayed in MortevielleEngine::loadMortDat(). + if (strncmp(fileId, "MORT", 4) == 0 && f.readByte() >= MORT_DAT_REQUIRED_VERSION) { + f.readByte(); // Minor version + // Loop to load resources from the data file + while (f.pos() < f.size()) { + // Get the Id and size of the next resource + char dataType[4]; + int dataSize; + f.read(dataType, 4); + dataSize = f.readUint16LE(); + if (!strncmp(dataType, "MENU", 4)) { + // MENU section + if (dataSize <= 7 * 24) { + f.read(_charArr, dataSize); + enMenuLoaded = true; + } else + warning("Wrong size %d for menu data. Expected %d or less", dataSize, 7*24); + break; + } else { + // Other sections + f.skip(dataSize); + } + } + } + // Close the file + f.close(); + if (!enMenuLoaded) + warning("Failed to load English menu. Will use default menu from game data instead"); + } + } - if (!f.open("menufr.mor")) - if (!f.open("menual.mor")) - if (!f.open("menu.mor")) - error("Missing file - menufr.mor or menual.mor or menu.mor"); + if (!enMenuLoaded) { + if (!f.open("menufr.mor")) + if (!f.open("menual.mor")) + if (!f.open("menu.mor")) + error("Missing file - menufr.mor or menual.mor or menu.mor"); - f.read(_charArr, 7 * 24); - f.close(); + f.read(_charArr, 7 * 24); + f.close(); + } // Skipped: dialog asking to swap floppy -- cgit v1.2.3 From c02934df37824537c6b4b6a3a7d3f5551d000ebb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 Aug 2013 16:57:17 -0400 Subject: TSAGE: Cleanup of code in R2R scene 1000 to use AnimationPlayer --- engines/tsage/ringworld2/ringworld2_logic.cpp | 20 ---- engines/tsage/ringworld2/ringworld2_logic.h | 26 +---- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 10 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 134 ++++++++++++------------ engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 5 files changed, 78 insertions(+), 114 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f872d8edd2..c5f6dc9fb7 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2457,26 +2457,6 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX /*--------------------------------------------------------------------------*/ -DataManager::DataManager(): EventHandler() { - -} - -void DataManager::synchronize(Serializer &s) { - EventHandler::synchronize(s); - -} - -void DataManager::load(int v) { - warning("TODO"); -} - -void DataManager::remove() { - if (_endHandler) - _endHandler->signal(); - - _endHandler = NULL; -} - } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 9ea2494124..b740783581 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -392,6 +392,8 @@ public: enum AnimationPaletteMode { ANIMPALMODE_REPLACE_PALETTE = 0, ANIMPALMODE_CURR_PALETTE = 1, ANIMPALMODE_NONE = 2 }; +enum AnimationObjectMode { ANIMOBJMODE_1 = 1, ANIMOBJMODE_2 = 2, ANIMOBJMODE_42 = 42 }; + class AnimationPlayer: public EventHandler { private: void rleDecode(const byte *pSrc, byte *pDest, int size); @@ -406,8 +408,9 @@ public: Common::File _resourceFile; Rect _rect1, _screenBounds; int _field38; - int _field3A, _paletteMode; - int _objectMode; + int _field3A; + AnimationPaletteMode _paletteMode; + AnimationObjectMode _objectMode; int _field58, _sliceHeight; byte _palIndexes[256]; ScenePalette _palette; @@ -514,25 +517,6 @@ public: void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; -class DataManager: public EventHandler { -public: - int _field3C; - int _field56; - - int _palStart; - int _palLength; - byte _palData[256 * 3]; - EventHandler *_endHandler; -public: - DataManager(); - - virtual Common::String getClassName() { return "DataManager"; } - virtual void synchronize(Serializer &s); - virtual void remove(); - - void load(int v); -}; - } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index b977ea1516..53610ced25 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1554,7 +1554,7 @@ void Scene180::signal() { R2_GLOBALS._sceneManager._hasPalette = true; _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._v = 1; - _animationPlayer._objectMode = 1; + _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 1; _animationPlayer.load(1); @@ -1597,7 +1597,7 @@ void Scene180::signal() { case 5: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._v = 1; - _animationPlayer._objectMode = 1; + _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 2; _animationPlayer.load(2); @@ -1702,7 +1702,7 @@ void Scene180::signal() { _field412 = 1; _animationPlayer._paletteMode = ANIMPALMODE_REPLACE_PALETTE; _animationPlayer._v = 1; - _animationPlayer._objectMode = 42; + _animationPlayer._objectMode = ANIMOBJMODE_42; R2_GLOBALS._scene180Mode = 3; _animationPlayer.load(3); break; @@ -1801,7 +1801,7 @@ void Scene180::signal() { case 40: _animationPlayer._paletteMode = ANIMPALMODE_NONE; - _animationPlayer._objectMode = 1; + _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 4; if (_animationPlayer.load(4)) { _animationPlayer.dispatch(); @@ -1840,7 +1840,7 @@ void Scene180::signal() { _field412 = 1; _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._v = 1; - _animationPlayer._objectMode = 1; + _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 15; _animationPlayer.load(15, NULL); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index ffc491725e..a23db73b7f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -106,13 +106,13 @@ void Scene1000::signal() { R2_GLOBALS._fontColors.background = 224; R2_GLOBALS._fontColors.foreground = 119; - _dataManager._field56 = 2; - _dataManager._field3C = 2; - _dataManager.load(5); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer.load(5); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, true, 0); @@ -163,13 +163,13 @@ void Scene1000::signal() { for (int percent = 100; percent >= 0; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(7); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(7); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -193,13 +193,13 @@ void Scene1000::signal() { break; case 10: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(6); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(6); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -210,18 +210,18 @@ void Scene1000::signal() { break; case 11: - R2_GLOBALS._scenePalette.loadPalette(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); R2_GLOBALS._sceneManager.changeScene(300); break; case 20: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(8); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(8); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -230,18 +230,18 @@ void Scene1000::signal() { break; case 21: - R2_GLOBALS._scenePalette.loadPalette(NULL); + R2_GLOBALS._scenePalette.loadPalette(0); R2_GLOBALS._sceneManager.changeScene(1530); break; case 30: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(17); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(17); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -260,13 +260,13 @@ void Scene1000::signal() { break; case 40: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(18); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(18); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -286,13 +286,13 @@ void Scene1000::signal() { for (int percent = 100; percent >= 0; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(13); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(13); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -308,13 +308,13 @@ void Scene1000::signal() { for (int percent = 100; percent >= 0; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(14); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(14); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -335,13 +335,13 @@ void Scene1000::signal() { for (int percent = 100; percent >= 0; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(12); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(12); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -360,13 +360,13 @@ void Scene1000::signal() { for (int percent = 100; percent >= 0; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(9); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(9); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -383,13 +383,13 @@ void Scene1000::signal() { break; case 80: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(10); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(10); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -401,13 +401,13 @@ void Scene1000::signal() { break; case 90: - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(11); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(11); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); @@ -428,13 +428,13 @@ void Scene1000::signal() { R2_GLOBALS._sound1.play(304); R2_GLOBALS._sound2.play(82); - _dataManager._field3C = 2; - _dataManager._field56 = 2; - _dataManager.load(19); + _animationPlayer._paletteMode = ANIMPALMODE_NONE; + _animationPlayer._objectMode = ANIMOBJMODE_2; + _animationPlayer.load(19); - R2_GLOBALS._scenePalette.loadPalette(_dataManager._palData, 0, 256); + R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; - _dataManager.dispatch(); + _animationPlayer.dispatch(); _fieldD2E = 1; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 4ee0c29f4f..23ebb2c276 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -44,7 +44,7 @@ public: SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; SpeakerGameText _gameTextSpeaker; - DataManager _dataManager; + AnimationPlayer _animationPlayer; int _field412; int _fieldD2E; -- cgit v1.2.3 From 1ce54c217a98bd80fa38ecba2562997ce00b01a3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 00:48:41 +0200 Subject: WINTERMUTE: Fix end of namespace comments. --- engines/wintermute/ad/ad_actor.cpp | 2 +- engines/wintermute/ad/ad_actor.h | 2 +- engines/wintermute/ad/ad_entity.cpp | 2 +- engines/wintermute/ad/ad_entity.h | 2 +- engines/wintermute/ad/ad_game.cpp | 2 +- engines/wintermute/ad/ad_game.h | 2 +- engines/wintermute/ad/ad_inventory.cpp | 2 +- engines/wintermute/ad/ad_inventory.h | 2 +- engines/wintermute/ad/ad_inventory_box.cpp | 2 +- engines/wintermute/ad/ad_inventory_box.h | 2 +- engines/wintermute/ad/ad_item.cpp | 2 +- engines/wintermute/ad/ad_item.h | 2 +- engines/wintermute/ad/ad_layer.cpp | 2 +- engines/wintermute/ad/ad_layer.h | 2 +- engines/wintermute/ad/ad_node_state.cpp | 2 +- engines/wintermute/ad/ad_node_state.h | 2 +- engines/wintermute/ad/ad_object.cpp | 2 +- engines/wintermute/ad/ad_object.h | 2 +- engines/wintermute/ad/ad_path.cpp | 2 +- engines/wintermute/ad/ad_path.h | 2 +- engines/wintermute/ad/ad_path_point.cpp | 2 +- engines/wintermute/ad/ad_path_point.h | 2 +- engines/wintermute/ad/ad_region.cpp | 2 +- engines/wintermute/ad/ad_region.h | 2 +- engines/wintermute/ad/ad_response.cpp | 2 +- engines/wintermute/ad/ad_response.h | 2 +- engines/wintermute/ad/ad_response_box.cpp | 2 +- engines/wintermute/ad/ad_response_box.h | 2 +- engines/wintermute/ad/ad_response_context.cpp | 2 +- engines/wintermute/ad/ad_response_context.h | 2 +- engines/wintermute/ad/ad_rot_level.cpp | 2 +- engines/wintermute/ad/ad_rot_level.h | 2 +- engines/wintermute/ad/ad_scale_level.cpp | 2 +- engines/wintermute/ad/ad_scale_level.h | 2 +- engines/wintermute/ad/ad_scene.cpp | 2 +- engines/wintermute/ad/ad_scene.h | 2 +- engines/wintermute/ad/ad_scene_node.cpp | 2 +- engines/wintermute/ad/ad_scene_state.cpp | 2 +- engines/wintermute/ad/ad_scene_state.h | 2 +- engines/wintermute/ad/ad_sentence.cpp | 2 +- engines/wintermute/ad/ad_sentence.h | 2 +- engines/wintermute/ad/ad_sprite_set.cpp | 2 +- engines/wintermute/ad/ad_sprite_set.h | 2 +- engines/wintermute/ad/ad_talk_def.cpp | 2 +- engines/wintermute/ad/ad_talk_def.h | 2 +- engines/wintermute/ad/ad_talk_holder.cpp | 2 +- engines/wintermute/ad/ad_talk_holder.h | 2 +- engines/wintermute/ad/ad_talk_node.cpp | 2 +- engines/wintermute/ad/ad_talk_node.h | 2 +- engines/wintermute/ad/ad_types.h | 2 +- engines/wintermute/ad/ad_waypoint_group.cpp | 2 +- engines/wintermute/ad/ad_waypoint_group.h | 2 +- engines/wintermute/base/base.cpp | 2 +- engines/wintermute/base/base.h | 2 +- engines/wintermute/base/base_active_rect.cpp | 2 +- engines/wintermute/base/base_active_rect.h | 2 +- engines/wintermute/base/base_dynamic_buffer.cpp | 2 +- engines/wintermute/base/base_dynamic_buffer.h | 2 +- engines/wintermute/base/base_engine.cpp | 2 +- engines/wintermute/base/base_engine.h | 2 +- engines/wintermute/base/base_fader.cpp | 2 +- engines/wintermute/base/base_fader.h | 2 +- engines/wintermute/base/base_file_manager.cpp | 2 +- engines/wintermute/base/base_file_manager.h | 2 +- engines/wintermute/base/base_frame.cpp | 2 +- engines/wintermute/base/base_frame.h | 2 +- engines/wintermute/base/base_game.cpp | 2 +- engines/wintermute/base/base_game.h | 2 +- engines/wintermute/base/base_game_music.cpp | 2 +- engines/wintermute/base/base_game_music.h | 2 +- engines/wintermute/base/base_game_settings.cpp | 2 +- engines/wintermute/base/base_game_settings.h | 2 +- engines/wintermute/base/base_keyboard_state.cpp | 2 +- engines/wintermute/base/base_keyboard_state.h | 2 +- engines/wintermute/base/base_named_object.cpp | 2 +- engines/wintermute/base/base_named_object.h | 2 +- engines/wintermute/base/base_object.cpp | 2 +- engines/wintermute/base/base_object.h | 2 +- engines/wintermute/base/base_parser.cpp | 2 +- engines/wintermute/base/base_parser.h | 2 +- engines/wintermute/base/base_persistence_manager.cpp | 2 +- engines/wintermute/base/base_persistence_manager.h | 2 +- engines/wintermute/base/base_point.cpp | 2 +- engines/wintermute/base/base_point.h | 2 +- engines/wintermute/base/base_quick_msg.cpp | 2 +- engines/wintermute/base/base_quick_msg.h | 2 +- engines/wintermute/base/base_region.cpp | 2 +- engines/wintermute/base/base_region.h | 2 +- engines/wintermute/base/base_script_holder.cpp | 2 +- engines/wintermute/base/base_script_holder.h | 2 +- engines/wintermute/base/base_scriptable.cpp | 2 +- engines/wintermute/base/base_scriptable.h | 2 +- engines/wintermute/base/base_sprite.cpp | 2 +- engines/wintermute/base/base_sprite.h | 2 +- engines/wintermute/base/base_string_table.cpp | 2 +- engines/wintermute/base/base_string_table.h | 2 +- engines/wintermute/base/base_sub_frame.cpp | 2 +- engines/wintermute/base/base_sub_frame.h | 2 +- engines/wintermute/base/base_surface_storage.cpp | 2 +- engines/wintermute/base/base_surface_storage.h | 2 +- engines/wintermute/base/base_transition_manager.cpp | 2 +- engines/wintermute/base/base_transition_manager.h | 2 +- engines/wintermute/base/base_viewport.cpp | 2 +- engines/wintermute/base/base_viewport.h | 2 +- engines/wintermute/base/file/base_disk_file.cpp | 2 +- engines/wintermute/base/file/base_disk_file.h | 2 +- engines/wintermute/base/file/base_file.cpp | 2 +- engines/wintermute/base/file/base_file.h | 2 +- engines/wintermute/base/file/base_file_entry.cpp | 2 +- engines/wintermute/base/file/base_file_entry.h | 2 +- engines/wintermute/base/file/base_package.cpp | 2 +- engines/wintermute/base/file/base_package.h | 2 +- engines/wintermute/base/file/base_save_thumb_file.cpp | 2 +- engines/wintermute/base/file/base_save_thumb_file.h | 2 +- engines/wintermute/base/file/dcpackage.h | 2 +- engines/wintermute/base/font/base_font.cpp | 2 +- engines/wintermute/base/font/base_font.h | 2 +- engines/wintermute/base/font/base_font_bitmap.cpp | 2 +- engines/wintermute/base/font/base_font_bitmap.h | 2 +- engines/wintermute/base/font/base_font_storage.cpp | 2 +- engines/wintermute/base/font/base_font_storage.h | 2 +- engines/wintermute/base/font/base_font_truetype.cpp | 2 +- engines/wintermute/base/font/base_font_truetype.h | 2 +- engines/wintermute/base/gfx/base_image.cpp | 2 +- engines/wintermute/base/gfx/base_image.h | 2 +- engines/wintermute/base/gfx/base_renderer.cpp | 2 +- engines/wintermute/base/gfx/base_renderer.h | 2 +- engines/wintermute/base/gfx/base_surface.cpp | 2 +- engines/wintermute/base/gfx/base_surface.h | 2 +- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 2 +- engines/wintermute/base/gfx/osystem/base_render_osystem.h | 2 +- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 2 +- engines/wintermute/base/gfx/osystem/base_surface_osystem.h | 2 +- engines/wintermute/base/gfx/osystem/render_ticket.cpp | 2 +- engines/wintermute/base/gfx/osystem/render_ticket.h | 2 +- engines/wintermute/base/particles/part_emitter.cpp | 2 +- engines/wintermute/base/particles/part_emitter.h | 2 +- engines/wintermute/base/particles/part_force.cpp | 2 +- engines/wintermute/base/particles/part_force.h | 2 +- engines/wintermute/base/particles/part_particle.cpp | 2 +- engines/wintermute/base/particles/part_particle.h | 2 +- engines/wintermute/base/save_thumb_helper.cpp | 2 +- engines/wintermute/base/save_thumb_helper.h | 2 +- engines/wintermute/base/saveload.cpp | 2 +- engines/wintermute/base/saveload.h | 2 +- engines/wintermute/base/scriptables/dcscript.h | 2 +- engines/wintermute/base/scriptables/script.cpp | 2 +- engines/wintermute/base/scriptables/script.h | 2 +- engines/wintermute/base/scriptables/script_engine.cpp | 2 +- engines/wintermute/base/scriptables/script_engine.h | 2 +- engines/wintermute/base/scriptables/script_ext_array.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_array.h | 2 +- engines/wintermute/base/scriptables/script_ext_date.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_date.h | 2 +- engines/wintermute/base/scriptables/script_ext_file.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_file.h | 2 +- engines/wintermute/base/scriptables/script_ext_math.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_math.h | 2 +- engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_mem_buffer.h | 2 +- engines/wintermute/base/scriptables/script_ext_object.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_object.h | 2 +- engines/wintermute/base/scriptables/script_ext_string.cpp | 2 +- engines/wintermute/base/scriptables/script_ext_string.h | 2 +- engines/wintermute/base/scriptables/script_stack.cpp | 2 +- engines/wintermute/base/scriptables/script_stack.h | 2 +- engines/wintermute/base/scriptables/script_value.cpp | 2 +- engines/wintermute/base/scriptables/script_value.h | 2 +- engines/wintermute/base/sound/base_sound.cpp | 2 +- engines/wintermute/base/sound/base_sound.h | 2 +- engines/wintermute/base/sound/base_sound_buffer.cpp | 2 +- engines/wintermute/base/sound/base_sound_buffer.h | 2 +- engines/wintermute/base/sound/base_sound_manager.cpp | 2 +- engines/wintermute/base/sound/base_sound_manager.h | 2 +- engines/wintermute/coll_templ.h | 2 +- engines/wintermute/dctypes.h | 2 +- engines/wintermute/debugger.cpp | 2 +- engines/wintermute/detection.cpp | 2 +- engines/wintermute/graphics/transparent_surface.cpp | 2 +- engines/wintermute/graphics/transparent_surface.h | 2 +- engines/wintermute/math/math_util.cpp | 2 +- engines/wintermute/math/math_util.h | 2 +- engines/wintermute/math/matrix4.cpp | 2 +- engines/wintermute/math/matrix4.h | 2 +- engines/wintermute/math/rect32.h | 2 +- engines/wintermute/math/vector2.cpp | 2 +- engines/wintermute/math/vector2.h | 2 +- engines/wintermute/persistent.h | 4 ++-- engines/wintermute/platform_osystem.cpp | 2 +- engines/wintermute/platform_osystem.h | 2 +- engines/wintermute/system/sys_class.cpp | 2 +- engines/wintermute/system/sys_class.h | 2 +- engines/wintermute/system/sys_class_registry.cpp | 2 +- engines/wintermute/system/sys_class_registry.h | 2 +- engines/wintermute/system/sys_instance.cpp | 2 +- engines/wintermute/system/sys_instance.h | 2 +- engines/wintermute/ui/ui_button.cpp | 2 +- engines/wintermute/ui/ui_button.h | 2 +- engines/wintermute/ui/ui_edit.cpp | 2 +- engines/wintermute/ui/ui_edit.h | 2 +- engines/wintermute/ui/ui_entity.cpp | 2 +- engines/wintermute/ui/ui_entity.h | 2 +- engines/wintermute/ui/ui_object.cpp | 2 +- engines/wintermute/ui/ui_object.h | 2 +- engines/wintermute/ui/ui_text.cpp | 2 +- engines/wintermute/ui/ui_text.h | 2 +- engines/wintermute/ui/ui_tiled_image.cpp | 2 +- engines/wintermute/ui/ui_tiled_image.h | 2 +- engines/wintermute/ui/ui_window.cpp | 2 +- engines/wintermute/ui/ui_window.h | 2 +- engines/wintermute/utils/crc.cpp | 2 +- engines/wintermute/utils/path_util.cpp | 2 +- engines/wintermute/utils/path_util.h | 2 +- engines/wintermute/utils/string_util.cpp | 2 +- engines/wintermute/utils/string_util.h | 2 +- engines/wintermute/utils/utils.cpp | 2 +- engines/wintermute/utils/utils.h | 2 +- engines/wintermute/video/video_player.cpp | 2 +- engines/wintermute/video/video_player.h | 2 +- engines/wintermute/video/video_theora_player.cpp | 2 +- engines/wintermute/video/video_theora_player.h | 2 +- engines/wintermute/wintypes.h | 2 +- 222 files changed, 223 insertions(+), 223 deletions(-) diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index e4c18d6287..94df17c543 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -1457,4 +1457,4 @@ bool AdActor::playAnim(const char *filename) { return AdTalkHolder::playAnim(filename); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index 3630c6665b..582b41b8b0 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.h @@ -103,6 +103,6 @@ private: int32 _pFCount; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index c43f74b620..388accf34f 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -1134,4 +1134,4 @@ bool AdEntity::setSprite(const char *filename) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index c23b37366d..bdbd271667 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.h @@ -68,6 +68,6 @@ private: TEntityType _subtype; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index ead68f7729..d5799e851b 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -2282,4 +2282,4 @@ bool AdGame::onScriptShutdown(ScScript *script) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 2032a1723f..cb5147501d 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -158,6 +158,6 @@ private: AdInventoryBox *_inventoryBox; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_inventory.cpp b/engines/wintermute/ad/ad_inventory.cpp index e9b6e56f16..544d8310d0 100644 --- a/engines/wintermute/ad/ad_inventory.cpp +++ b/engines/wintermute/ad/ad_inventory.cpp @@ -133,4 +133,4 @@ bool AdInventory::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_inventory.h b/engines/wintermute/ad/ad_inventory.h index 999200b465..9de831b2a0 100644 --- a/engines/wintermute/ad/ad_inventory.h +++ b/engines/wintermute/ad/ad_inventory.h @@ -47,6 +47,6 @@ public: int32 _scrollOffset; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 110359917b..d703de1714 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -386,4 +386,4 @@ bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_inventory_box.h b/engines/wintermute/ad/ad_inventory_box.h index 9792b1ea66..f65bd8d8f0 100644 --- a/engines/wintermute/ad/ad_inventory_box.h +++ b/engines/wintermute/ad/ad_inventory_box.h @@ -60,6 +60,6 @@ private: int32 _itemWidth; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index 1a46eb783b..7d05461169 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.cpp @@ -810,4 +810,4 @@ bool AdItem::getExtendedFlag(const char *flagName) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index b8351448a7..dd7039db43 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.h @@ -64,6 +64,6 @@ private: char *_amountString; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index 7bf79e4ae5..c833b59163 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.cpp @@ -561,4 +561,4 @@ bool AdLayer::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h index 8fe4d4f91e..b260b919fd 100644 --- a/engines/wintermute/ad/ad_layer.h +++ b/engines/wintermute/ad/ad_layer.h @@ -53,6 +53,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index d52201a08d..876c5a8bb4 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_state.cpp @@ -192,4 +192,4 @@ bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool s return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_node_state.h b/engines/wintermute/ad/ad_node_state.h index e2050815a7..4b5b46ee60 100644 --- a/engines/wintermute/ad/ad_node_state.h +++ b/engines/wintermute/ad/ad_node_state.h @@ -55,6 +55,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 741d6e6fc6..0d5011f92d 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -1299,4 +1299,4 @@ bool AdObject::updatePartEmitter() { return _partEmitter->update(); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index c6573315da..9e30f69855 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_object.h @@ -123,6 +123,6 @@ private: AdInventory *_inventory; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp index 5b36ed6471..91a24cbf7d 100644 --- a/engines/wintermute/ad/ad_path.cpp +++ b/engines/wintermute/ad/ad_path.cpp @@ -117,4 +117,4 @@ bool AdPath::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_path.h b/engines/wintermute/ad/ad_path.h index 3f38355b94..9de0bcad2c 100644 --- a/engines/wintermute/ad/ad_path.h +++ b/engines/wintermute/ad/ad_path.h @@ -51,6 +51,6 @@ public: bool _ready; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp index be4b487466..d5108ad8c1 100644 --- a/engines/wintermute/ad/ad_path_point.cpp +++ b/engines/wintermute/ad/ad_path_point.cpp @@ -72,4 +72,4 @@ bool AdPathPoint::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_path_point.h b/engines/wintermute/ad/ad_path_point.h index 04648b1733..5e6b8c61ea 100644 --- a/engines/wintermute/ad/ad_path_point.h +++ b/engines/wintermute/ad/ad_path_point.h @@ -45,6 +45,6 @@ public: int32 _distance; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index acd5f13397..444ada2433 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -409,4 +409,4 @@ bool AdRegion::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index bc9eab085e..637c742c9c 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_region.h @@ -59,6 +59,6 @@ private: bool _decoration; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index d59bcf363c..fa05224b06 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -175,4 +175,4 @@ const char *AdResponse::getTextOrig() const { return _textOrig; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response.h b/engines/wintermute/ad/ad_response.h index 57cd302e9d..00ebafbdb0 100644 --- a/engines/wintermute/ad/ad_response.h +++ b/engines/wintermute/ad/ad_response.h @@ -68,6 +68,6 @@ private: char *_textOrig; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index a589bf3a30..9d7c17ac74 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -737,4 +737,4 @@ bool AdResponseBox::getObjects(BaseArray &objects, bool interactiveO return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h index cb57b98924..7598e8b569 100644 --- a/engines/wintermute/ad/ad_response_box.h +++ b/engines/wintermute/ad/ad_response_box.h @@ -94,6 +94,6 @@ private: UIWindow *_window; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_response_context.cpp b/engines/wintermute/ad/ad_response_context.cpp index 663ef49a24..0b58f5ba0c 100644 --- a/engines/wintermute/ad/ad_response_context.cpp +++ b/engines/wintermute/ad/ad_response_context.cpp @@ -68,4 +68,4 @@ void AdResponseContext::setContext(const char *context) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_response_context.h b/engines/wintermute/ad/ad_response_context.h index dd0008a728..bc30b4a1c9 100644 --- a/engines/wintermute/ad/ad_response_context.h +++ b/engines/wintermute/ad/ad_response_context.h @@ -47,6 +47,6 @@ private: char *_context; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index 4d7f27aec7..b11fad96d7 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -158,4 +158,4 @@ bool AdRotLevel::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_rot_level.h b/engines/wintermute/ad/ad_rot_level.h index 3466e46ba5..fe2d1691cd 100644 --- a/engines/wintermute/ad/ad_rot_level.h +++ b/engines/wintermute/ad/ad_rot_level.h @@ -45,6 +45,6 @@ public: bool loadBuffer(byte *buffer, bool complete = true); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index e80f38bd0f..9cf7bfa600 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -159,4 +159,4 @@ bool AdScaleLevel::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scale_level.h b/engines/wintermute/ad/ad_scale_level.h index 516f507a5a..b2dd7aa91f 100644 --- a/engines/wintermute/ad/ad_scale_level.h +++ b/engines/wintermute/ad/ad_scale_level.h @@ -47,6 +47,6 @@ private: float _scale; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index 4d0068fad1..668b39853b 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -2989,4 +2989,4 @@ bool AdScene::getRegionObjects(AdRegion *region, BaseArray &objects, return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index cd144b77ef..5beb10e546 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.h @@ -176,6 +176,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_scene_node.cpp b/engines/wintermute/ad/ad_scene_node.cpp index e9b80b3cc8..8548da91db 100644 --- a/engines/wintermute/ad/ad_scene_node.cpp +++ b/engines/wintermute/ad/ad_scene_node.cpp @@ -79,4 +79,4 @@ bool AdSceneNode::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index 8e022ab115..58cb5f514a 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_state.cpp @@ -95,4 +95,4 @@ AdNodeState *AdSceneState::getNodeState(const char *name, bool saving) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene_state.h b/engines/wintermute/ad/ad_scene_state.h index 600aa4b581..067c737b2e 100644 --- a/engines/wintermute/ad/ad_scene_state.h +++ b/engines/wintermute/ad/ad_scene_state.h @@ -48,6 +48,6 @@ private: BaseArray _nodeStates; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index 70a57a624d..d5baa8291f 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -358,4 +358,4 @@ bool AdSentence::canSkip() { return (_gameRef->getTimer()->getTime() - _startTime) > 300; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_sentence.h b/engines/wintermute/ad/ad_sentence.h index 6f255578f7..c491ad99a2 100644 --- a/engines/wintermute/ad/ad_sentence.h +++ b/engines/wintermute/ad/ad_sentence.h @@ -80,6 +80,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index 6c802c4863..9eb3bd0686 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.cpp @@ -353,4 +353,4 @@ bool AdSpriteSet::containsSprite(BaseSprite *sprite) { return false; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_sprite_set.h b/engines/wintermute/ad/ad_sprite_set.h index 61043aa3d6..ef5ef3a94f 100644 --- a/engines/wintermute/ad/ad_sprite_set.h +++ b/engines/wintermute/ad/ad_sprite_set.h @@ -48,6 +48,6 @@ public: BaseSprite *_sprites[NUM_DIRECTIONS]; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index bf72b2916b..f10a0e2fb9 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.cpp @@ -282,4 +282,4 @@ BaseSprite *AdTalkDef::getDefaultSprite(TDirection dir) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_def.h b/engines/wintermute/ad/ad_talk_def.h index 2375360d89..726eefbe4c 100644 --- a/engines/wintermute/ad/ad_talk_def.h +++ b/engines/wintermute/ad/ad_talk_def.h @@ -53,6 +53,6 @@ public: virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0) override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 33deab7805..6041105b93 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_holder.cpp @@ -399,4 +399,4 @@ bool AdTalkHolder::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h index 501acbc885..ab48c3aaf4 100644 --- a/engines/wintermute/ad/ad_talk_holder.h +++ b/engines/wintermute/ad/ad_talk_holder.h @@ -52,6 +52,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index f03c24ea94..ce86dccd8e 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.cpp @@ -292,4 +292,4 @@ BaseSprite *AdTalkNode::getSprite(TDirection dir) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_talk_node.h b/engines/wintermute/ad/ad_talk_node.h index 012fa2133e..01dfb6b4ff 100644 --- a/engines/wintermute/ad/ad_talk_node.h +++ b/engines/wintermute/ad/ad_talk_node.h @@ -58,6 +58,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_types.h b/engines/wintermute/ad/ad_types.h index ae5882f4ee..dc1a54b91d 100644 --- a/engines/wintermute/ad/ad_types.h +++ b/engines/wintermute/ad/ad_types.h @@ -102,6 +102,6 @@ typedef enum { GEOM_GENERIC } TGeomNodeType; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index 96dece34b8..cb754516b3 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -267,4 +267,4 @@ bool AdWaypointGroup::mimic(AdWaypointGroup *wpt, float scale, int argX, int arg return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h index 79b28e0d22..af97a21290 100644 --- a/engines/wintermute/ad/ad_waypoint_group.h +++ b/engines/wintermute/ad/ad_waypoint_group.h @@ -56,6 +56,6 @@ private: int32 _lastMimicY; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp index d01972b82f..a64770c577 100644 --- a/engines/wintermute/base/base.cpp +++ b/engines/wintermute/base/base.cpp @@ -183,4 +183,4 @@ bool BaseClass::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h index 7f2796c6e0..48ebe49a97 100644 --- a/engines/wintermute/base/base.h +++ b/engines/wintermute/base/base.h @@ -57,6 +57,6 @@ protected: Common::HashMap::iterator _editorPropsIter; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index 7a91854c57..abeaa18d54 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -109,4 +109,4 @@ void BaseActiveRect::clipRect() { BasePlatform::intersectRect(&_rect, &_rect, &rc); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_active_rect.h b/engines/wintermute/base/base_active_rect.h index 982a0902d0..a3c0746618 100644 --- a/engines/wintermute/base/base_active_rect.h +++ b/engines/wintermute/base/base_active_rect.h @@ -55,6 +55,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp index f684420b1e..5334ae46c4 100644 --- a/engines/wintermute/base/base_dynamic_buffer.cpp +++ b/engines/wintermute/base/base_dynamic_buffer.cpp @@ -201,4 +201,4 @@ void BaseDynamicBuffer::putTextForm(const char *format, va_list argptr) { putBytes((byte *)buff, strlen(buff)); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h index ad78ebad00..2804d78895 100644 --- a/engines/wintermute/base/base_dynamic_buffer.h +++ b/engines/wintermute/base/base_dynamic_buffer.h @@ -60,6 +60,6 @@ private: void putTextForm(const char *format, va_list argptr); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index 79b16e5c74..67e3d80cc8 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -124,4 +124,4 @@ const Timer *BaseEngine::getLiveTimer() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h index 1b3b976bda..a5eafd3597 100644 --- a/engines/wintermute/base/base_engine.h +++ b/engines/wintermute/base/base_engine.h @@ -75,6 +75,6 @@ public: Common::Language getLanguage() const { return _language; } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp index 0d17b07a9d..7978230964 100644 --- a/engines/wintermute/base/base_fader.cpp +++ b/engines/wintermute/base/base_fader.cpp @@ -193,4 +193,4 @@ bool BaseFader::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index 845ce2f244..087b19bc44 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -58,6 +58,6 @@ private: uint32 _startTime; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index 64bdbd1660..bea7e53445 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -360,4 +360,4 @@ BaseFileManager *BaseFileManager::getEngineInstance() { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 7ed3a6c7cb..8c2876f681 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -74,6 +74,6 @@ private: // the detector too, without launching the entire engine: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index 9fb5770f79..eaad024120 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -764,4 +764,4 @@ const char *BaseFrame::scToString() { return "[frame]"; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h index 954851c77f..bf1e40daa1 100644 --- a/engines/wintermute/base/base_frame.h +++ b/engines/wintermute/base/base_frame.h @@ -70,6 +70,6 @@ private: BaseSound *_sound; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 0f0d928285..5b88dab90e 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -3920,4 +3920,4 @@ Common::String BaseGame::readRegistryString(const Common::String &key, const Com return result; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index f635339286..d295bb6b1a 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -358,6 +358,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp index eff5d47210..c50969df76 100644 --- a/engines/wintermute/base/base_game_music.cpp +++ b/engines/wintermute/base/base_game_music.cpp @@ -503,4 +503,4 @@ bool BaseGameMusic::scCallMethod(ScScript *script, ScStack *stack, ScStack *this } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game_music.h b/engines/wintermute/base/base_game_music.h index 150ea6200c..72c7a171a6 100644 --- a/engines/wintermute/base/base_game_music.h +++ b/engines/wintermute/base/base_game_music.h @@ -68,6 +68,6 @@ private: int32 _musicCrossfadeChannel2; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_game_settings.cpp b/engines/wintermute/base/base_game_settings.cpp index 9b5eb314bb..1de8b31ca7 100644 --- a/engines/wintermute/base/base_game_settings.cpp +++ b/engines/wintermute/base/base_game_settings.cpp @@ -219,4 +219,4 @@ char *BaseGameSettings::getKeyFromStringTable(const char *str) const { return _stringTable->getKey(str); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_game_settings.h b/engines/wintermute/base/base_game_settings.h index 92c00ab0c2..38a2fd1042 100644 --- a/engines/wintermute/base/base_game_settings.h +++ b/engines/wintermute/base/base_game_settings.h @@ -66,6 +66,6 @@ private: bool _richSavedGames; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp index 072a1bb71b..aeb56ad282 100644 --- a/engines/wintermute/base/base_keyboard_state.cpp +++ b/engines/wintermute/base/base_keyboard_state.cpp @@ -310,4 +310,4 @@ Common::KeyCode BaseKeyboardState::vKeyToKeyCode(uint32 vkey) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h index e321dfee16..14a57ee7b8 100644 --- a/engines/wintermute/base/base_keyboard_state.h +++ b/engines/wintermute/base/base_keyboard_state.h @@ -71,6 +71,6 @@ private: Common::KeyCode vKeyToKeyCode(uint32 vkey); //TODO, reimplement using ScummVM-backend }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_named_object.cpp b/engines/wintermute/base/base_named_object.cpp index f99ec2f5db..3d1df5ab84 100644 --- a/engines/wintermute/base/base_named_object.cpp +++ b/engines/wintermute/base/base_named_object.cpp @@ -68,4 +68,4 @@ void BaseNamedObject::setName(const char *name) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_named_object.h b/engines/wintermute/base/base_named_object.h index d25fec4a82..ee4a3bba6a 100644 --- a/engines/wintermute/base/base_named_object.h +++ b/engines/wintermute/base/base_named_object.h @@ -46,6 +46,6 @@ public: void setName(const char *name); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index ad181b922e..9d5548be0f 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -1242,4 +1242,4 @@ bool BaseObject::afterMove() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h index 7afe9cf94c..42041c5e3c 100644 --- a/engines/wintermute/base/base_object.h +++ b/engines/wintermute/base/base_object.h @@ -142,6 +142,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp index a7e3bd5efb..0b677b6cb2 100644 --- a/engines/wintermute/base/base_parser.cpp +++ b/engines/wintermute/base/base_parser.cpp @@ -464,4 +464,4 @@ int32 BaseParser::scanStr(const char *in, const char *format, ...) { return num; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h index 4953ac3c0b..4bf48cc016 100644 --- a/engines/wintermute/base/base_parser.h +++ b/engines/wintermute/base/base_parser.h @@ -83,6 +83,6 @@ private: char *_whiteSpace; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 23290e1574..6f0f7e289f 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -887,4 +887,4 @@ bool BasePersistenceManager::checkVersion(byte verMajor, byte verMinor, byte ver return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h index 7b578085ba..6949bfe278 100644 --- a/engines/wintermute/base/base_persistence_manager.h +++ b/engines/wintermute/base/base_persistence_manager.h @@ -115,6 +115,6 @@ private: BaseGame *_gameRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_point.cpp b/engines/wintermute/base/base_point.cpp index fbd8960894..fe6ca941f3 100644 --- a/engines/wintermute/base/base_point.cpp +++ b/engines/wintermute/base/base_point.cpp @@ -60,4 +60,4 @@ bool BasePoint::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_point.h b/engines/wintermute/base/base_point.h index 26568d5d0b..cf8a5be336 100644 --- a/engines/wintermute/base/base_point.h +++ b/engines/wintermute/base/base_point.h @@ -45,6 +45,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp index 9f19dfd74a..ac0c107d3b 100644 --- a/engines/wintermute/base/base_quick_msg.cpp +++ b/engines/wintermute/base/base_quick_msg.cpp @@ -52,4 +52,4 @@ uint32 BaseQuickMsg::getStartTime() const { return _startTime; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h index 377f7733fd..b706424c18 100644 --- a/engines/wintermute/base/base_quick_msg.h +++ b/engines/wintermute/base/base_quick_msg.h @@ -44,6 +44,6 @@ private: uint32 _startTime; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 2dabe6ae44..61e9deefb3 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -532,4 +532,4 @@ bool BaseRegion::mimic(BaseRegion *region, float scale, int x, int y) { return createRegion() ? STATUS_OK : STATUS_FAILED; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h index 67ca158897..93ad6a6fbe 100644 --- a/engines/wintermute/base/base_region.h +++ b/engines/wintermute/base/base_region.h @@ -65,6 +65,6 @@ private: int32 _lastMimicY; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index 036bac1dd8..25b8775a98 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -500,4 +500,4 @@ bool BaseScriptHolder::sendEvent(const char *eventName) { return DID_SUCCEED(applyEvent(eventName)); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h index 38a3f935d3..c34b0378a1 100644 --- a/engines/wintermute/base/base_script_holder.h +++ b/engines/wintermute/base/base_script_holder.h @@ -71,6 +71,6 @@ public: virtual bool sendEvent(const char *eventName); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index 5753b0482b..be1e18c2c4 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -188,4 +188,4 @@ ScScript *BaseScriptable::invokeMethodThread(const char *methodName) { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h index f23d7faa5b..08fd32081a 100644 --- a/engines/wintermute/base/base_scriptable.h +++ b/engines/wintermute/base/base_scriptable.h @@ -78,6 +78,6 @@ BaseScriptable *makeSXObject(BaseGame *inGame, ScStack *stack); BaseScriptable *makeSXStore(BaseGame *inGame); BaseScriptable *makeSXString(BaseGame *inGame, ScStack *stack); -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index c920da9ee9..ab78c5ac7c 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -817,4 +817,4 @@ bool BaseSprite::killAllSounds() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index d464899b04..1387796895 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -89,6 +89,6 @@ private: bool killAllSounds(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index 8207c32244..3d9cc4f8b3 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -253,4 +253,4 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h index 128807bd1a..f8808f5b27 100644 --- a/engines/wintermute/base/base_string_table.h +++ b/engines/wintermute/base/base_string_table.h @@ -50,6 +50,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 7012c28feb..8a8f63240b 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -673,4 +673,4 @@ bool BaseSubFrame::setSurfaceSimple() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h index 37ba34b748..ba3d5b955a 100644 --- a/engines/wintermute/base/base_sub_frame.h +++ b/engines/wintermute/base/base_sub_frame.h @@ -88,6 +88,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 8dbd6a6d2a..f1d068674b 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -203,4 +203,4 @@ bool BaseSurfaceStorage::surfaceSortCB(const BaseSurface *s1, const BaseSurface } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h index 61738e69a2..c0049d676c 100644 --- a/engines/wintermute/base/base_surface_storage.h +++ b/engines/wintermute/base/base_surface_storage.h @@ -52,6 +52,6 @@ public: Common::Array _surfaces; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp index 1c869e6a2b..eee5f1aae7 100644 --- a/engines/wintermute/base/base_transition_manager.cpp +++ b/engines/wintermute/base/base_transition_manager.cpp @@ -135,4 +135,4 @@ bool BaseTransitionMgr::update() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h index edb3045a58..82edb9ff88 100644 --- a/engines/wintermute/base/base_transition_manager.h +++ b/engines/wintermute/base/base_transition_manager.h @@ -49,6 +49,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index f79e5c9f13..09ac80e9de 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -97,4 +97,4 @@ int BaseViewport::getHeight() const { return _rect.bottom - _rect.top; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 584e5a78f9..0225c02c7c 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -52,6 +52,6 @@ private: Rect32 _rect; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 5ffb06f854..7391d819fc 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -192,4 +192,4 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h index c9f93b80d9..81cc22b86d 100644 --- a/engines/wintermute/base/file/base_disk_file.h +++ b/engines/wintermute/base/file/base_disk_file.h @@ -36,6 +36,6 @@ namespace Wintermute { Common::SeekableReadStream *openDiskFile(const Common::String &filename); bool diskFileExists(const Common::String &filename); -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_file.cpp b/engines/wintermute/base/file/base_file.cpp index f52a13211e..42eea69824 100644 --- a/engines/wintermute/base/file/base_file.cpp +++ b/engines/wintermute/base/file/base_file.cpp @@ -65,4 +65,4 @@ Common::SeekableReadStream *BaseFile::getMemStream() { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_file.h b/engines/wintermute/base/file/base_file.h index 8eda6d51d9..9acda7ffce 100644 --- a/engines/wintermute/base/file/base_file.h +++ b/engines/wintermute/base/file/base_file.h @@ -62,6 +62,6 @@ public: virtual Common::SeekableReadStream *getMemStream(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp index 1968da6f47..846f56b55c 100644 --- a/engines/wintermute/base/file/base_file_entry.cpp +++ b/engines/wintermute/base/file/base_file_entry.cpp @@ -70,4 +70,4 @@ BaseFileEntry::~BaseFileEntry() { _package = nullptr; // ref only } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_file_entry.h b/engines/wintermute/base/file/base_file_entry.h index 6e4823d994..9d738c8c11 100644 --- a/engines/wintermute/base/file/base_file_entry.h +++ b/engines/wintermute/base/file/base_file_entry.h @@ -55,6 +55,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 73f767c3ef..512279b72c 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -273,4 +273,4 @@ Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common:: return nullptr; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index bcf088aaea..18156c4f65 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -85,6 +85,6 @@ private: Common::HashMap::iterator _filesIter; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index 2c4ddf4875..bb172ca66a 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -150,4 +150,4 @@ bool BaseSaveThumbFile::seek(uint32 pos, int whence) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/file/base_save_thumb_file.h b/engines/wintermute/base/file/base_save_thumb_file.h index 3b217525fd..faf1af9255 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.h +++ b/engines/wintermute/base/file/base_save_thumb_file.h @@ -47,6 +47,6 @@ private: byte *_data; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h index 2234139408..a2ec5d28d5 100644 --- a/engines/wintermute/base/file/dcpackage.h +++ b/engines/wintermute/base/file/dcpackage.h @@ -75,6 +75,6 @@ v2: uint32 TimeDate1 */ -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp index 596f9fb5c6..26bc0e7985 100644 --- a/engines/wintermute/base/font/base_font.cpp +++ b/engines/wintermute/base/font/base_font.cpp @@ -137,4 +137,4 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const Common::String &filename) { return ret; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font.h b/engines/wintermute/base/font/base_font.h index 50587fa7eb..d75d3f4fb5 100644 --- a/engines/wintermute/base/font/base_font.h +++ b/engines/wintermute/base/font/base_font.h @@ -56,6 +56,6 @@ private: static bool isTrueType(BaseGame *game, const Common::String &filename); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index 03bd471636..890a9a2f83 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -587,4 +587,4 @@ int BaseFontBitmap::getLetterHeight() { return _tileHeight; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h index 0bdac64026..c810777446 100644 --- a/engines/wintermute/base/font/base_font_bitmap.h +++ b/engines/wintermute/base/font/base_font_bitmap.h @@ -66,6 +66,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp index 3286742478..8abd368b70 100644 --- a/engines/wintermute/base/font/base_font_storage.cpp +++ b/engines/wintermute/base/font/base_font_storage.cpp @@ -138,4 +138,4 @@ bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_storage.h b/engines/wintermute/base/font/base_font_storage.h index 60874167e7..f4ac490324 100644 --- a/engines/wintermute/base/font/base_font_storage.h +++ b/engines/wintermute/base/font/base_font_storage.h @@ -50,6 +50,6 @@ public: bool initLoop(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 2fcdebc117..3059a69047 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -644,4 +644,4 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight }*/ } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index f93505921f..fdbae30684 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -148,6 +148,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index 75de95128f..d0dbae352e 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -228,4 +228,4 @@ bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) { return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h index 017305e5d0..4b04fd1252 100644 --- a/engines/wintermute/base/gfx/base_image.h +++ b/engines/wintermute/base/gfx/base_image.h @@ -67,6 +67,6 @@ private: BaseFileManager *_fileManager; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index b3f05ce977..1f171209d7 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -401,4 +401,4 @@ bool BaseRenderer::displayIndicator() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index bfef29a5ed..31dc2a022d 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -228,6 +228,6 @@ private: BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/base_surface.cpp b/engines/wintermute/base/gfx/base_surface.cpp index 42ec51f39e..19639c0c33 100644 --- a/engines/wintermute/base/gfx/base_surface.cpp +++ b/engines/wintermute/base/gfx/base_surface.cpp @@ -146,4 +146,4 @@ void BaseSurface::setSize(int width, int height) { _height = height; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index e308b29996..8a0603734e 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -96,6 +96,6 @@ protected: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 7905184190..964762f077 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -698,4 +698,4 @@ bool BaseRenderOSystem::endSpriteBatch() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 5531961623..bf2914b430 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -118,6 +118,6 @@ private: bool _skipThisFrame; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index b809318133..eeb0a8097b 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -454,4 +454,4 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 5290170db8..da86833517 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -96,6 +96,6 @@ private: byte *_alphaMask; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 8d9d5325c4..98739e0778 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -125,4 +125,4 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h index ec1412b032..b1313e932d 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.h +++ b/engines/wintermute/base/gfx/osystem/render_ticket.h @@ -64,6 +64,6 @@ private: Common::Rect _srcRect; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index c86e1ce369..5c21988141 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -1252,4 +1252,4 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index a0d701f338..94b4dc8126 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -135,6 +135,6 @@ private: BaseArray _sprites; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp index df84162504..122cdf1afe 100644 --- a/engines/wintermute/base/particles/part_force.cpp +++ b/engines/wintermute/base/particles/part_force.cpp @@ -62,4 +62,4 @@ bool PartForce::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_force.h b/engines/wintermute/base/particles/part_force.h index 27f4cb7d90..cdb1ce40f9 100644 --- a/engines/wintermute/base/particles/part_force.h +++ b/engines/wintermute/base/particles/part_force.h @@ -52,6 +52,6 @@ public: bool persist(BasePersistenceManager *PersistMgr); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp index f1aba114de..2ae867fd42 100644 --- a/engines/wintermute/base/particles/part_particle.cpp +++ b/engines/wintermute/base/particles/part_particle.cpp @@ -266,4 +266,4 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/particles/part_particle.h b/engines/wintermute/base/particles/part_particle.h index 8cca6b4057..281d87cf72 100644 --- a/engines/wintermute/base/particles/part_particle.h +++ b/engines/wintermute/base/particles/part_particle.h @@ -85,6 +85,6 @@ private: int32 _fadeStartAlpha; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/save_thumb_helper.cpp b/engines/wintermute/base/save_thumb_helper.cpp index 535648eddd..77514849a6 100644 --- a/engines/wintermute/base/save_thumb_helper.cpp +++ b/engines/wintermute/base/save_thumb_helper.cpp @@ -107,4 +107,4 @@ bool SaveThumbHelper::storeScummVMThumbNail(bool doFlip) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/save_thumb_helper.h b/engines/wintermute/base/save_thumb_helper.h index d3bc5f5523..44792e3d75 100644 --- a/engines/wintermute/base/save_thumb_helper.h +++ b/engines/wintermute/base/save_thumb_helper.h @@ -47,6 +47,6 @@ private: BaseGame *_gameRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp index 1b7dfd42ed..8d37909bb4 100644 --- a/engines/wintermute/base/saveload.cpp +++ b/engines/wintermute/base/saveload.cpp @@ -201,4 +201,4 @@ bool SaveLoad::emptySaveSlot(int slot) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h index 722f7a89b6..15d4d86b26 100644 --- a/engines/wintermute/base/saveload.h +++ b/engines/wintermute/base/saveload.h @@ -52,6 +52,6 @@ private: static void afterLoadScript(void *script, void *data); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h index 4aae897dc2..d6bb3cd176 100644 --- a/engines/wintermute/base/scriptables/dcscript.h +++ b/engines/wintermute/base/scriptables/dcscript.h @@ -136,6 +136,6 @@ typedef enum { ELEMENT_STRING = 0 } TElementType; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp index 0cffa94b50..5aeff78c50 100644 --- a/engines/wintermute/base/scriptables/script.cpp +++ b/engines/wintermute/base/scriptables/script.cpp @@ -1465,4 +1465,4 @@ void ScScript::afterLoad() { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h index ee9f45e204..488ff63606 100644 --- a/engines/wintermute/base/scriptables/script.h +++ b/engines/wintermute/base/scriptables/script.h @@ -169,6 +169,6 @@ public: virtual const char *dbgGetFilename(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp index f83fb36843..dd24457d6c 100644 --- a/engines/wintermute/base/scriptables/script_engine.cpp +++ b/engines/wintermute/base/scriptables/script_engine.cpp @@ -605,4 +605,4 @@ void ScEngine::dumpStats() { }*/ } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h index 639875ffb6..622b3c4b94 100644 --- a/engines/wintermute/base/scriptables/script_engine.h +++ b/engines/wintermute/base/scriptables/script_engine.h @@ -130,6 +130,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp index a466d361ec..7f1c769ec5 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.cpp +++ b/engines/wintermute/base/scriptables/script_ext_array.cpp @@ -249,4 +249,4 @@ bool SXArray::push(ScValue *val) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h index 68f808641e..e6381a011e 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.h +++ b/engines/wintermute/base/scriptables/script_ext_array.h @@ -51,6 +51,6 @@ private: Common::String _strRep; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp index afca0c4bbf..d88bfc5851 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.cpp +++ b/engines/wintermute/base/scriptables/script_ext_date.cpp @@ -307,4 +307,4 @@ int SXDate::scCompare(BaseScriptable *Value) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h index 062b7c55c7..0ccf093a7b 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.h +++ b/engines/wintermute/base/scriptables/script_ext_date.h @@ -49,6 +49,6 @@ private: Common::String _strRep; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp index 29e032a759..18f7b8213a 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.cpp +++ b/engines/wintermute/base/scriptables/script_ext_file.cpp @@ -825,4 +825,4 @@ Common::WriteStream *SXFile::openForAppend(const Common::String &filename, bool error("SXFile::openForAppend - WriteFiles not supported"); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h index fa2384109f..a1298929f2 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.h +++ b/engines/wintermute/base/scriptables/script_ext_file.h @@ -61,6 +61,6 @@ private: Common::WriteStream *openForAppend(const Common::String &filename, bool binary); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index f4c6be2d6c..ec53b983e7 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -291,4 +291,4 @@ bool SXMath::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h index 48c43ea7e8..1aa274a96f 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.h +++ b/engines/wintermute/base/scriptables/script_ext_math.h @@ -48,6 +48,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp index 9de9905fea..6a47c09136 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp @@ -526,4 +526,4 @@ int SXMemBuffer::scCompare(BaseScriptable *val) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h index 6700a03f50..4aad8b6484 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h @@ -55,6 +55,6 @@ private: bool checkBounds(ScScript *script, int start, int length); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp index b87aac81f9..a72b244f0a 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.cpp +++ b/engines/wintermute/base/scriptables/script_ext_object.cpp @@ -64,4 +64,4 @@ bool SXObject::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h index c85d16d44e..566111292a 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.h +++ b/engines/wintermute/base/scriptables/script_ext_object.h @@ -41,6 +41,6 @@ public: virtual ~SXObject(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index 7cb3b9360b..2f2422cdf9 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -430,4 +430,4 @@ int SXString::scCompare(BaseScriptable *val) { return strcmp(_string, ((SXString *)val)->_string); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h index 50b61deba4..7a95c59b4c 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.h +++ b/engines/wintermute/base/scriptables/script_ext_string.h @@ -53,6 +53,6 @@ private: int32 _capacity; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp index b53457c81b..801ac6ab52 100644 --- a/engines/wintermute/base/scriptables/script_stack.cpp +++ b/engines/wintermute/base/scriptables/script_stack.cpp @@ -192,4 +192,4 @@ bool ScStack::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h index 82c3debefa..ee04485a51 100644 --- a/engines/wintermute/base/scriptables/script_stack.h +++ b/engines/wintermute/base/scriptables/script_stack.h @@ -61,6 +61,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp index 5e2923e029..3532e127d0 100644 --- a/engines/wintermute/base/scriptables/script_value.cpp +++ b/engines/wintermute/base/scriptables/script_value.cpp @@ -992,4 +992,4 @@ bool ScValue::setProperty(const char *propName) { return ret; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h index a8e815023e..90ad9f182a 100644 --- a/engines/wintermute/base/scriptables/script_value.h +++ b/engines/wintermute/base/scriptables/script_value.h @@ -108,6 +108,6 @@ public: bool setProperty(const char *propName); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp index d027c03c8b..c1923b3ca8 100644 --- a/engines/wintermute/base/sound/base_sound.cpp +++ b/engines/wintermute/base/sound/base_sound.cpp @@ -289,4 +289,4 @@ bool BaseSound::applyFX(TSFXType type, float param1, float param2, float param3, return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound.h b/engines/wintermute/base/sound/base_sound.h index 3412e6c3a3..0a984d240a 100644 --- a/engines/wintermute/base/sound/base_sound.h +++ b/engines/wintermute/base/sound/base_sound.h @@ -82,6 +82,6 @@ private: BaseSoundBuffer *_sound; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index 9c919abac6..7666a441a3 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -292,4 +292,4 @@ bool BaseSoundBuffer::applyFX(TSFXType type, float param1, float param2, float p return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h index e78d062cd4..53b86f64c6 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.h +++ b/engines/wintermute/base/sound/base_sound_buffer.h @@ -95,6 +95,6 @@ private: int32 _volume; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp index f3e7bfb408..68e62f25b0 100644 --- a/engines/wintermute/base/sound/base_sound_manager.cpp +++ b/engines/wintermute/base/sound/base_sound_manager.cpp @@ -287,4 +287,4 @@ float BaseSoundMgr::posToPan(int x, int y) { return minPan + relPos * (maxPan - minPan); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/base/sound/base_sound_manager.h b/engines/wintermute/base/sound/base_sound_manager.h index 602571765f..5993a05001 100644 --- a/engines/wintermute/base/sound/base_sound_manager.h +++ b/engines/wintermute/base/sound/base_sound_manager.h @@ -64,6 +64,6 @@ private: bool setMasterVolume(byte percent); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h index 4a8e92c121..a3df92d6c8 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -138,6 +138,6 @@ public: } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/dctypes.h b/engines/wintermute/dctypes.h index bd4966eb6b..b40322147f 100644 --- a/engines/wintermute/dctypes.h +++ b/engines/wintermute/dctypes.h @@ -220,6 +220,6 @@ enum TShadowType { SHADOW_STENCIL = 3 }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp index 6e865befb9..8c8b8255ab 100644 --- a/engines/wintermute/debugger.cpp +++ b/engines/wintermute/debugger.cpp @@ -81,4 +81,4 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) { return true; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index 1bf2c76a50..ac21d78ef5 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -181,7 +181,7 @@ public: } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE) REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, Wintermute::WintermuteMetaEngine); diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 5b7c416ee9..3469bcbe1e 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -597,4 +597,4 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool } } -} // End of namespace Graphics +} // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 7b5579f389..4287aabcdc 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -134,7 +134,7 @@ private: };*/ -} // End of namespace Graphics +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/math_util.cpp b/engines/wintermute/math/math_util.cpp index 0aa0f841ac..903cea6d39 100644 --- a/engines/wintermute/math/math_util.cpp +++ b/engines/wintermute/math/math_util.cpp @@ -49,4 +49,4 @@ float MathUtil::roundUp(float val) { return result; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/math_util.h b/engines/wintermute/math/math_util.h index 38b6d9abf9..41a7a43e2e 100644 --- a/engines/wintermute/math/math_util.h +++ b/engines/wintermute/math/math_util.h @@ -37,6 +37,6 @@ public: static float roundUp(float val); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/matrix4.cpp b/engines/wintermute/math/matrix4.cpp index a50514457e..011766f510 100644 --- a/engines/wintermute/math/matrix4.cpp +++ b/engines/wintermute/math/matrix4.cpp @@ -83,4 +83,4 @@ void Matrix4::transformVector2(Vector2 &vec) { vec.y = y; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/matrix4.h b/engines/wintermute/math/matrix4.h index 273633f723..4198b50484 100644 --- a/engines/wintermute/math/matrix4.h +++ b/engines/wintermute/math/matrix4.h @@ -45,6 +45,6 @@ public: float m[4][4]; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 79d6e80017..f522ab3a35 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -116,6 +116,6 @@ struct Rect32 { } }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/math/vector2.cpp b/engines/wintermute/math/vector2.cpp index 98dca70b44..618ee9bda9 100644 --- a/engines/wintermute/math/vector2.cpp +++ b/engines/wintermute/math/vector2.cpp @@ -52,4 +52,4 @@ float Vector2::length() const { return (float)sqrt(x * x + y * y); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/math/vector2.h b/engines/wintermute/math/vector2.h index 31f31daaa0..e4ba97c517 100644 --- a/engines/wintermute/math/vector2.h +++ b/engines/wintermute/math/vector2.h @@ -70,6 +70,6 @@ public: float y; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index 1464ae0fd6..ddc0791054 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -37,7 +37,7 @@ class BasePersistenceManager; typedef void *(*PERSISTBUILD)(void); typedef bool(*PERSISTLOAD)(void *, BasePersistenceManager *); typedef void(*SYS_INSTANCE_CALLBACK)(void *instance, void *data); -} // end of namespace Wintermute +} // End of namespace Wintermute #include "engines/wintermute/system/sys_class_registry.h" namespace Wintermute { @@ -85,6 +85,6 @@ namespace Wintermute { #define TMEMBER_PTR(memberName) #memberName, &memberName #define TMEMBER_INT(memberName) #memberName, (int32*)&memberName -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 8b1a6e38e9..87a127d001 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -275,4 +275,4 @@ char *BasePlatform::strlwr(char *string) { return string; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h index 8c39b29ea9..46c86df909 100644 --- a/engines/wintermute/platform_osystem.h +++ b/engines/wintermute/platform_osystem.h @@ -70,6 +70,6 @@ private: static WintermuteEngine *_engineRef; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_class.cpp b/engines/wintermute/system/sys_class.cpp index cda58bbb48..0577f29e2c 100644 --- a/engines/wintermute/system/sys_class.cpp +++ b/engines/wintermute/system/sys_class.cpp @@ -217,4 +217,4 @@ void SystemClass::instanceCallback(SYS_INSTANCE_CALLBACK lpCallback, void *lpDat } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_class.h b/engines/wintermute/system/sys_class.h index 3f91723ed8..9fb3f70696 100644 --- a/engines/wintermute/system/sys_class.h +++ b/engines/wintermute/system/sys_class.h @@ -125,6 +125,6 @@ private: InstanceMap _instanceMap; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 8a6aae754f..20e4661efb 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -333,4 +333,4 @@ void SystemClassRegistry::dumpClasses(Common::WriteStream *stream) { } } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_class_registry.h b/engines/wintermute/system/sys_class_registry.h index ef7218c7c1..48a6738ffb 100644 --- a/engines/wintermute/system/sys_class_registry.h +++ b/engines/wintermute/system/sys_class_registry.h @@ -101,6 +101,6 @@ public: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/system/sys_instance.cpp b/engines/wintermute/system/sys_instance.cpp index d106119dba..b8e5c9b50a 100644 --- a/engines/wintermute/system/sys_instance.cpp +++ b/engines/wintermute/system/sys_instance.cpp @@ -46,4 +46,4 @@ SystemInstance::SystemInstance(void *instance, int id, SystemClass *sysClass) { SystemInstance::~SystemInstance() { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/system/sys_instance.h b/engines/wintermute/system/sys_instance.h index 215a6d1437..115de28094 100644 --- a/engines/wintermute/system/sys_instance.h +++ b/engines/wintermute/system/sys_instance.h @@ -63,6 +63,6 @@ private: SystemClass *_class; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 9db1f4f4b4..b2e6c3953b 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -1206,4 +1206,4 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index 5db9356ef9..b5002f3166 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -75,6 +75,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 91ca7326cb..caed157e0b 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -949,4 +949,4 @@ bool UIEdit::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index ac626f0f06..a057be9ead 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -67,6 +67,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 1872400cdd..6d4cfdb7eb 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -363,4 +363,4 @@ bool UIEntity::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 3bd3ec9888..1b6e8a10d6 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -54,6 +54,6 @@ public: virtual const char *scToString(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 07efc5e4cb..c32ae75c20 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -648,4 +648,4 @@ bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_FAILED; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 935c27613c..5d9508c2cf 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -80,6 +80,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 98d70b770e..5dc25f5852 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -519,4 +519,4 @@ bool UIText::sizeToFit() { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index be074755ba..29ed62a5ef 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -55,6 +55,6 @@ public: virtual const char *scToString() override; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index abccdd6c39..de4b86a6dd 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -388,4 +388,4 @@ bool UITiledImage::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index a6cd22d53d..39bc6495a9 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -59,6 +59,6 @@ private: Rect32 _downRight; }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 2ce9f68605..9066ee9f5b 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -1442,4 +1442,4 @@ bool UIWindow::getWindowObjects(BaseArray &objects, bool interactive return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 70799cea25..8a726fdff8 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -89,6 +89,6 @@ public: virtual const char *scToString(); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/crc.cpp b/engines/wintermute/utils/crc.cpp index e7ec45511b..a9781500fa 100644 --- a/engines/wintermute/utils/crc.cpp +++ b/engines/wintermute/utils/crc.cpp @@ -234,4 +234,4 @@ crc crc_finalize(crc remainder) { return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp index 298f0c268f..ee8b298562 100644 --- a/engines/wintermute/utils/path_util.cpp +++ b/engines/wintermute/utils/path_util.cpp @@ -98,4 +98,4 @@ AnsiString PathUtil::getExtension(const AnsiString &path) { return Common::lastPathComponent(path, '.'); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h index 7358c2aba0..2c7dfa99d1 100644 --- a/engines/wintermute/utils/path_util.h +++ b/engines/wintermute/utils/path_util.h @@ -44,6 +44,6 @@ public: static AnsiString getExtension(const AnsiString &path); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index 9fffad85cd..23abb5d579 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -231,4 +231,4 @@ AnsiString StringUtil::toString(int val) { } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h index e419e2bca8..3ae5e47493 100644 --- a/engines/wintermute/utils/string_util.h +++ b/engines/wintermute/utils/string_util.h @@ -51,6 +51,6 @@ public: static AnsiString toString(int val); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp index 6e0d69edbe..8fa6313ba6 100644 --- a/engines/wintermute/utils/utils.cpp +++ b/engines/wintermute/utils/utils.cpp @@ -258,4 +258,4 @@ float BaseUtils::Hue2RGB(float v1, float v2, float vH) { return (v1); } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h index d6a603ec72..6c804ff01e 100644 --- a/engines/wintermute/utils/utils.h +++ b/engines/wintermute/utils/utils.h @@ -59,6 +59,6 @@ private: static float Hue2RGB(float v1, float v2, float vH); }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/video/video_player.cpp b/engines/wintermute/video/video_player.cpp index 42857b5c1b..f18311c3e1 100644 --- a/engines/wintermute/video/video_player.cpp +++ b/engines/wintermute/video/video_player.cpp @@ -106,4 +106,4 @@ bool VideoPlayer::loadSubtitles(const char *filename, const char *subtitleFile) return STATUS_OK; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/video/video_player.h b/engines/wintermute/video/video_player.h index 033ab50dfa..51c6bf41d3 100644 --- a/engines/wintermute/video/video_player.h +++ b/engines/wintermute/video/video_player.h @@ -85,6 +85,6 @@ public: BaseArray _subtitles;*/ }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index ac24c6f15e..b33001c6b7 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -529,4 +529,4 @@ BaseSurface *VideoTheoraPlayer::getTexture() const { return _texture; } -} // end of namespace Wintermute +} // End of namespace Wintermute diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h index 40b9ba104a..ddeba48bbc 100644 --- a/engines/wintermute/video/video_theora_player.h +++ b/engines/wintermute/video/video_theora_player.h @@ -142,6 +142,6 @@ private: }; -} // end of namespace Wintermute +} // End of namespace Wintermute #endif diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h index c7723808ea..1288ac1a65 100644 --- a/engines/wintermute/wintypes.h +++ b/engines/wintermute/wintypes.h @@ -48,6 +48,6 @@ namespace Wintermute { #define MAX_PATH_LENGTH 512 -} // end of namespace Wintermute +} // End of namespace Wintermute #endif -- cgit v1.2.3 From b95858bb918c94158df8ee65ce305b30dd9564b8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 00:52:52 +0200 Subject: WINTERMUTE: Small formatting fixes. --- engines/wintermute/graphics/transparent_surface.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 4287aabcdc..f2a0c1852a 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -63,16 +63,16 @@ struct TransparentSurface : public Graphics::Surface { @brief The possible flipping parameters for the blit methode. */ enum FLIP_FLAGS { - /// The image will not be flipped. - FLIP_NONE = 0, - /// The image will be flipped at the horizontal axis. - FLIP_H = 1, - /// The image will be flipped at the vertical axis. - FLIP_V = 2, - /// The image will be flipped at the horizontal and vertical axis. - FLIP_HV = FLIP_H | FLIP_V, - /// The image will be flipped at the horizontal and vertical axis. - FLIP_VH = FLIP_H | FLIP_V + /// The image will not be flipped. + FLIP_NONE = 0, + /// The image will be flipped at the horizontal axis. + FLIP_H = 1, + /// The image will be flipped at the vertical axis. + FLIP_V = 2, + /// The image will be flipped at the horizontal and vertical axis. + FLIP_HV = FLIP_H | FLIP_V, + /// The image will be flipped at the horizontal and vertical axis. + FLIP_VH = FLIP_H | FLIP_V }; bool _enableAlphaBlit; -- cgit v1.2.3 From 604e1b00701c4a01031a06f175b88107710cbd32 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 01:01:15 +0200 Subject: GRAPHICS: Fix typo. --- graphics/surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/surface.h b/graphics/surface.h index 8ce2cf3ecc..c64f2363e6 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -98,7 +98,7 @@ struct Surface { /** * Sets the pixel data. * - * Note that this is a simply setter. Be careful what you are doing! + * Note that this is a simply a setter. Be careful what you are doing! * * @param newPixels The new pixel data. */ -- cgit v1.2.3 From 8fc54d6d77d36c18c22272e2dc3d70414f195e0c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 01:07:34 +0200 Subject: VIDEO: Fix regression in Urban Runner videos. This is a regression from 6fce92b0ea2fce78c375ade0bc6c2ac4231b96bd. Thanks to DrMcCoy for tracking this down. --- video/coktel_decoder.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp index 40ac035582..024e479bf7 100644 --- a/video/coktel_decoder.cpp +++ b/video/coktel_decoder.cpp @@ -2399,7 +2399,10 @@ void VMDDecoder::blit16(const Graphics::Surface &srcSurf, Common::Rect &rect) { Graphics::PixelFormat pixelFormat = getPixelFormat(); - const byte *src = (const byte *)srcSurf.getBasePtr(srcRect.left, srcRect.top); + // We cannot use getBasePtr here because srcSurf.format.bytesPerPixel is + // different from _bytesPerPixel. + const byte *src = (const byte *)srcSurf.getPixels() + + (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; byte *dst = (byte *)_surface.getBasePtr(_x + rect.left, _y + rect.top); for (int i = 0; i < rect.height(); i++) { @@ -2437,7 +2440,10 @@ void VMDDecoder::blit24(const Graphics::Surface &srcSurf, Common::Rect &rect) { Graphics::PixelFormat pixelFormat = getPixelFormat(); - const byte *src = (const byte *)srcSurf.getBasePtr(srcRect.left, srcRect.top); + // We cannot use getBasePtr here because srcSurf.format.bytesPerPixel is + // different from _bytesPerPixel. + const byte *src = (const byte *)srcSurf.getPixels() + + (srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel; byte *dst = (byte *)_surface.getBasePtr(_x + rect.left, _y + rect.top); for (int i = 0; i < rect.height(); i++) { -- cgit v1.2.3 From 6485b291e9080acbd2e3d29a1bbaf7da9e79568d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 02:29:13 +0200 Subject: SCUMM: Fix Loom (and some other graphics regressions). These are regressions from c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038. They were caused by VirtualScreen::getPixels differing from Surface::getBasePtr and I accidently used the former in some cases in the conversion. I also fixed a bug in debugger.cpp which exchanged x and y. --- engines/scumm/charset.cpp | 1 + engines/scumm/debugger.cpp | 2 +- engines/scumm/gfx.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 298fb149f4..dd79aff2da 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1242,6 +1242,7 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) { if (ignoreCharsetMask) { VirtScreen *vs = &_vm->_virtscr[kMainVirtScreen]; s = *vs; + s.setPixels(vs->getPixels(0, 0)); } else { s = _vm->_textSurface; drawTop -= _vm->_screenTop; diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 5e5719d6bc..872293f821 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -641,7 +641,7 @@ static void hlineColor(ScummEngine *scumm, int x1, int x2, int y, byte color) { x2 = right - 1; - ptr = (byte *)vs->getBasePtr(y, x1); + ptr = (byte *)vs->getBasePtr(x1, y); while (x1++ <= x2) { *ptr++ = color; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 57436dc03c..4c1fdaf673 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -422,7 +422,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int _res->createResource(rtBuffer, slot + 1, size); vs->setPixels(getResourceAddress(rtBuffer, slot + 1)); - memset(vs->getPixels(0, 0), 0, size); // reset background + memset(vs->getBasePtr(0, 0), 0, size); // reset background if (twobufs) { vs->backBuf = _res->createResource(rtBuffer, slot + 5, size); @@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, if (vs->hasTwoBuffers) dst = vs->backBuf + y * vs->pitch + x * 8; else - dst = (byte *)vs->getPixels(x * 8, y); + dst = (byte *)vs->getBasePtr(x * 8, y); mask_ptr = getMaskBuffer(x, y, 1); @@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const if (vs->hasTwoBuffers) dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); else - dstPtr = (byte *)vs->getPixels(x * 8, y); + dstPtr = (byte *)vs->getBasePtr(x * 8, y); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); @@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const transpStrip = true; if (vs->hasTwoBuffers) { - byte *frontBuf = (byte *)vs->getPixels(x * 8, y); + byte *frontBuf = (byte *)vs->getBasePtr(x * 8, y); if (lightsOn) copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); else @@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) { vs->bdirty[strip] = bottom; bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; - backbuff_ptr = (byte *)vs->getPixels((strip + vs->xstart/8) * 8, top); + backbuff_ptr = (byte *)vs->getBasePtr((strip + vs->xstart/8) * 8, top); numLinesToProcess = bottom - top; if (numLinesToProcess) { -- cgit v1.2.3 From a96a427fc84312f7cb7fef45b992a1e9e3f93f93 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 02:32:12 +0200 Subject: SCUMM: Add comment about getPixels uses in BaseCostumeRenderer. --- engines/scumm/base-costume.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index b87bc77c29..e1a8688bb9 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -38,6 +38,8 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _out.w = _out.pitch / _vm->_bytesPerPixel; + // We do not use getBasePtr here because the offset to pixels never used + // _vm->_bytesPerPixel, but it seems unclear why. _out.setPixels((byte *)_out.getPixels() - (_vm->_virtscr[kMainVirtScreen].xstart & 7)); _numStrips = numStrips; -- cgit v1.2.3 From 38071bc5c5d2b2543dc23b38e1b810d791bf4a26 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 4 Aug 2013 09:14:11 +0200 Subject: MORTEVIELLE: Fix out-of-bounds read This should be sufficient. At this point, cy is at most 23, and if cx is 41 it's either 23 or less than 20. That means ix is either 46 or less than 43. If it's less than 43, there is no out of bounds access, and now we look at the special case first. This was a Coverity issue, but for some reason I don't see any CID for it. --- engines/mortevielle/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 73d258af6c..361917d53b 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1448,7 +1448,7 @@ void MortevielleEngine::fctDiscuss() { displayQuestionText(lib[choice], 1); questionAsked[choice] = ! questionAsked[choice]; } - if ((_coreVar._availableQuestion[ix] == '*') || (ix == 46)) { + if ((ix == 46) || (_coreVar._availableQuestion[ix] == '*')) { posY = ((ix - 1) % 23) << 3; if (ix > 23) posX = 320; -- cgit v1.2.3 From 870a583c8b93eb560dca37add3cf9d98f21d594a Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 4 Aug 2013 09:24:33 +0200 Subject: MORTEVIELLE: Pass Pattern struct by reference This should avoid unnecessary copying of a 400+ byte struct. This was a low-priority Coverity issue, for some reason without a CID. --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/utils.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 37901bb1b3..eb5c8dfe52 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -272,7 +272,7 @@ private: void mainGame(); void playGame(); void handleAction(); - void displayCGAPattern(int n, Pattern p, nhom *pal); + void displayCGAPattern(int n, Pattern *p, nhom *pal); void loadPalette(); void loadTexts(); void loadBRUIT5(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 705237c4eb..af2c4868de 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1997,7 +1997,7 @@ void MortevielleEngine::setPal(int n) { palette(_cgaPal[n]._p); for (int i = 0; i <= 15; ++i) - displayCGAPattern(i, _patternArr[pal[i]._id], pal); + displayCGAPattern(i, &_patternArr[pal[i]._id], pal); } break; default: @@ -2009,15 +2009,15 @@ void MortevielleEngine::setPal(int n) { * Engine function - Display a CGA pattern, using a specified palette * @remarks Originally called 'outbloc' */ -void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) { +void MortevielleEngine::displayCGAPattern(int n, Pattern *p, nhom *pal) { int addr = n * 404 + 0xd700; - WRITE_LE_UINT16(&_curPict[addr], p._tax); - WRITE_LE_UINT16(&_curPict[addr + 2], p._tay); + WRITE_LE_UINT16(&_curPict[addr], p->_tax); + WRITE_LE_UINT16(&_curPict[addr + 2], p->_tay); addr += 4; - for (int i = 0; i < p._tax; ++i) { - for (int j = 0; j < p._tay; ++j) - _curPict[addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]]; + for (int i = 0; i < p->_tax; ++i) { + for (int j = 0; j < p->_tay; ++j) + _curPict[addr + j * p->_tax + i] = pal[n]._hom[p->_des[i + 1][j + 1]]; } } -- cgit v1.2.3 From 134532090bac167979b3114b8caccb25f3a8dc86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Aug 2013 10:39:34 +0200 Subject: MORTEVIELLE: Implement music in intro screen --- engines/mortevielle/mortevielle.cpp | 5 +--- engines/mortevielle/mortevielle.h | 19 +------------ engines/mortevielle/sound.cpp | 54 +++++++++++++------------------------ engines/mortevielle/sound.h | 5 ++-- engines/mortevielle/speech.cpp | 2 +- engines/mortevielle/utils.cpp | 14 ++++++---- 6 files changed, 34 insertions(+), 65 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c481b7371b..7126df933f 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -105,7 +105,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _curAnim = nullptr; _rightFramePict = nullptr; _compMusicBuf1 = nullptr; - _compMusicBuf2 = nullptr; } MortevielleEngine::~MortevielleEngine() { @@ -113,7 +112,6 @@ MortevielleEngine::~MortevielleEngine() { free(_curAnim); free(_rightFramePict); free(_compMusicBuf1); - free(_compMusicBuf2); } /** @@ -388,10 +386,9 @@ void MortevielleEngine::showIntroduction() { if (shouldQuit()) return; - // TODO: Once music (Amiga/Atari ports) is implemented, only use the below delay if music is turned off showTitleScreen(); - delay(3000); music(); + _mixer->stopAll(); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index eb5c8dfe52..8c7da8cc97 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -49,22 +49,6 @@ namespace Mortevielle { -/*---------------------------------------------------------------------------*/ -/*------------------- MEMORY MAP ------------------------*/ -/*---------------------------------------------------------------------------*/ -/* The following is a list of physical addresses in memory currently used - * by the game. - * - * Address - * ------- - * 5000:0 - Music data - * 6000:0 - Decompressed current image - * 7000:0+ - Compressed images - * 7000:2 - 16 words representing palette map - * 7000:4138 - width, height, x/y offset of decoded image - */ -const int kAdrMusic = 0x5000; - // Debug channels enum { kMortevielleCore = 1 << 0, @@ -197,7 +181,6 @@ private: Pattern _patternArr[15]; int _menuOpcode; - bool _mouseClick; bool _inMainGameLoop; // Flag when the main game loop is active bool _quitGame; // Quit game flag. Originally called 'arret' bool _endGame; // End game flag. Originally called 'solu' @@ -441,6 +424,7 @@ public: int _savedBitIndex; int _numpal; int _key; + bool _mouseClick; SaveStruct _coreVar, _saveStruct; int _maff; @@ -456,7 +440,6 @@ public: byte *_curAnim; byte *_rightFramePict; byte *_compMusicBuf1; - byte *_compMusicBuf2; Debugger _debugger; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index f9b53ffed7..76495c6658 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -28,6 +28,7 @@ #include "mortevielle/mortevielle.h" #include "mortevielle/sound.h" +#include "audio/decoders/raw.h" #include "common/scummsys.h" namespace Mortevielle { @@ -128,8 +129,6 @@ int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { /*-------------------------------------------------------------------------*/ -const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; - // The PC timer chip works at a frequency of 1.19318Mhz #define TIMER_FREQUENCY 1193180 @@ -149,21 +148,21 @@ SoundManager::~SoundManager() { /** * Decode music data */ -void SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg) { - int seed = 128; +void SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { + static const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; + + uint seed = 128; int v; - for (int idx1 = 0; idx1 < (NbreSeg * 2); ++idx1) { - for (int idx2 = 0; idx2 < 64; ++idx2) { - byte srcByte = *PSrc++; - v = tab[srcByte >> 4]; - seed += v; - *PDest++ = seed & 0xff; - - v = tab[srcByte & 0xf]; - seed += v; - *PDest++ = seed & 0xff; - } + for (int idx1 = 0; idx1 < size; ++idx1) { + byte srcByte = *PSrc++; + v = tab[srcByte >> 4]; + seed += v; + *PDest++ = seed & 0xff; + + v = tab[srcByte & 0xf]; + seed += v; + *PDest++ = seed & 0xff; } } @@ -176,27 +175,12 @@ void SoundManager::playNote(int frequency, int32 length) { } -void SoundManager::musyc(tablint &tb, int nbseg, int att) { -#ifdef DEBUG - const byte *pSrc = &_vm->_mem[kAdrMusic * 16]; - - // Convert the countdown amount to a tempo rate, and then to note length in microseconds - int tempo = TIMER_FREQUENCY / att; - int length = 1000000 / tempo; +void SoundManager::playSong(const byte* buf, int size) { + Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - for (int noteIndex = 0; noteIndex < (nbseg * 16); ++noteIndex) { - int lookupValue = *pSrc++; - int noteCountdown = tb[lookupValue]; - int noteFrequency = TIMER_FREQUENCY / noteCountdown; - - playNote(noteFrequency, length); - } - - // Keep waiting until the song has been finished - while (_speakerStream->isPlaying() && !_vm->shouldQuit()) { - _vm->delay(10); - } -#endif + while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick) + ; } void SoundManager::setParent(MortevielleEngine *vm) { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index a47e8db32e..c1df98e937 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -105,9 +105,10 @@ public: void setParent(MortevielleEngine *vm); void playNote(int frequency, int32 length); - void decodeMusic(const byte *PSrc, byte *PDest, int NbreSeg); + void decodeMusic(const byte *PSrc, byte *PDest, int size); + void playSong(const byte *buf, int size); + void litph(tablint &t, int typ, int tempo); - void musyc(tablint &tb, int nbseg, int att); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 68ae3dac3e..35eefc898f 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -170,7 +170,7 @@ void SpeechManager::loadMusicSound() { _vm->_compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); f.read(_vm->_compMusicBuf1, size); - _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, &_vm->_mem[kAdrNoise * 16], size / 128); + _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, &_vm->_mem[kAdrNoise * 16], size); f.close(); } diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index af2c4868de..b729d5951e 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2201,13 +2201,15 @@ void MortevielleEngine::music() { if (!f.open("mort.img")) error("Missing file - mort.img"); - free(_compMusicBuf2); int size = f.size(); - _compMusicBuf2 = (byte *)malloc(sizeof(byte) * size); - f.read(_compMusicBuf2, size); + byte *compMusicBuf = (byte *)malloc(sizeof(byte) * size); + byte *musicBuf = (byte *)malloc(sizeof(byte) * size * 2); + f.read(compMusicBuf, size); f.close(); - _soundManager.decodeMusic(_compMusicBuf2, &_mem[kAdrMusic * 16], size / 128); + _soundManager.decodeMusic(compMusicBuf, musicBuf, size); + free(compMusicBuf); + _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); @@ -2215,12 +2217,14 @@ void MortevielleEngine::music() { int k = 0; do { fin = keyPressed(); - _soundManager.musyc(_speechManager._tbi, 9958, kTempoMusic); + _soundManager.playSong(musicBuf, size * 2); ++k; fin = fin | keyPressed() | (k >= 5); } while (!fin); while (keyPressed()) getChar(); + + free(musicBuf); } /** -- cgit v1.2.3 From 2af07d5d8e5b4312af154b7b66dbc66fb1e78a03 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Sun, 4 Aug 2013 10:41:07 +0200 Subject: SCUMM: Add detection/version for Moonbase Commander v1.1. --- devtools/scumm-md5.txt | 3 ++- engines/scumm/detection_tables.h | 3 ++- engines/scumm/he/logic/moonbase.cpp | 2 ++ engines/scumm/scumm-md5.h | 5 +++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 450860b587..76c12f57f4 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -626,7 +626,8 @@ jungle Let's Explore the Jungle with Buzzy 8801fb4a1200b347f7a38523339526dd -1 en Windows - - - Kirben moonbase Moonbase Commander - cf400d20769fb70eb21766582f4924f7 -1 en Windows - - - Kirben + cf400d20769fb70eb21766582f4924f7 -1 en Windows 1.0 1.0 - Kirben + e1c9998826ce7fa8bde5cc3a5023edec -1 en Windows 1.1 1.1 - fuzzie ef71a322b6530ac45b1a070f7c0795f7 -1 en Windows Demo Demo - Kirben pajama Pajama Sam 1: No Need to Hide When It's Dark Outside diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 395051d2a5..aaf84c1471 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -385,7 +385,8 @@ static const GameSettings gameVariantsTable[] = { {"Soccer2004", 0, 0, GID_SOCCER2004, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, // U32 code required, for testing only - {"moonbase", 0, 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"moonbase", "1.0", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"moonbase", "1.1", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, {"moonbase", "Demo", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR | GF_DEMO, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, // HE100 games, which use older o72_debugInput code diff --git a/engines/scumm/he/logic/moonbase.cpp b/engines/scumm/he/logic/moonbase.cpp index fac2ea27ff..5b4618a4ad 100644 --- a/engines/scumm/he/logic/moonbase.cpp +++ b/engines/scumm/he/logic/moonbase.cpp @@ -39,6 +39,8 @@ public: int LogicHEmoonbase::versionID() { if (_vm->_game.features & GF_DEMO) return -100; + else if (strcmp(_vm->_game.variant, "1.1") == 0) + return 110; else return 100; } diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 7f0eb41a1e..f5609f1b03 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Tue Jul 09 01:43:38 2013 + This file was generated by the md5table tool on Sat Aug 3 16:52:02 2013 DO NOT EDIT MANUALLY! */ @@ -536,7 +536,7 @@ static const MD5Table md5table[] = { { "ce7733f185b838e248927c7ba1a04204", "maniac", "V2", "V2", -1, Common::FR_FRA, Common::kPlatformAmiga }, { "ce7fd0c382389a6791fc3e199c117ef4", "indy3", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformDOS }, { "cea91e3dd47f2518ea418e41611aa77f", "spyfox2", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown }, - { "cf400d20769fb70eb21766582f4924f7", "moonbase", "", "", -1, Common::EN_ANY, Common::kPlatformWindows }, + { "cf400d20769fb70eb21766582f4924f7", "moonbase", "1.0", "1.0", -1, Common::EN_ANY, Common::kPlatformWindows }, { "cf4ef315214c7d8cdab6302cdb7e50db", "freddi", "HE 73", "Demo", -1, Common::DE_DEU, Common::kPlatformWindows }, { "cf8d13446ec6cb6222287a925fd47c1d", "baseball", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "cf8ef3a1fb483c5c4b1c584d1167b2c4", "freddi", "HE 73", "", -1, Common::DE_DEU, Common::kPlatformWindows }, @@ -584,6 +584,7 @@ static const MD5Table md5table[] = { { "e03ed1474ec14de78359970e0457a820", "freddi4", "HE 99", "Demo", -1, Common::EN_GRB, Common::kPlatformWindows }, { "e144f5f49d9241d2a9dee2576b3d09cb", "airport", "", "Demo", 51152, Common::EN_ANY, Common::kPlatformWindows }, { "e17db1ddf91b39ca6bbc8ad3ed19e883", "monkey", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, + { "e1c9998826ce7fa8bde5cc3a5023edec", "moonbase", "1.1", "1.1", -1, Common::EN_ANY, Common::kPlatformWindows }, { "e246e02db9630533a40d99c9f54a8e01", "monkey2", "", "", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "e361a7058ed8e8ebb462663c0a3ae8d6", "puttputt", "HE 62", "", -1, Common::HE_ISR, Common::kPlatformDOS }, { "e41de1c2a15abbcdbf9977e2d7e8a340", "freddi2", "HE 100", "Updated", -1, Common::RU_RUS, Common::kPlatformWindows }, -- cgit v1.2.3 From c1f93815ee9d41d4e505dde87fdd503f94e31dae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Aug 2013 10:45:32 +0200 Subject: MORTEVIELLE: Compute real buffer size in order to avoid ticks at the end of the song --- engines/mortevielle/sound.cpp | 12 +++++++++++- engines/mortevielle/sound.h | 2 +- engines/mortevielle/utils.cpp | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 76495c6658..3cb5284494 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -148,11 +148,13 @@ SoundManager::~SoundManager() { /** * Decode music data */ -void SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { +int SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { static const int tab[16] = { -96, -72, -48, -32, -20, -12, -8, -4, 0, 4, 8, 12, 20, 32, 48, 72 }; uint seed = 128; int v; + int decompSize = 0; + int skipSize = 0; for (int idx1 = 0; idx1 < size; ++idx1) { byte srcByte = *PSrc++; @@ -163,7 +165,15 @@ void SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { v = tab[srcByte & 0xf]; seed += v; *PDest++ = seed & 0xff; + + if (srcByte == 0) + skipSize += 2; + else { + decompSize += skipSize + 2; + skipSize = 0; + } } + return decompSize; } void SoundManager::litph(tablint &t, int typ, int tempo) { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index c1df98e937..313859dacf 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -105,7 +105,7 @@ public: void setParent(MortevielleEngine *vm); void playNote(int frequency, int32 length); - void decodeMusic(const byte *PSrc, byte *PDest, int size); + int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, int size); void litph(tablint &t, int typ, int tempo); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index b729d5951e..d5dc678a72 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2207,7 +2207,7 @@ void MortevielleEngine::music() { f.read(compMusicBuf, size); f.close(); - _soundManager.decodeMusic(compMusicBuf, musicBuf, size); + int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); _addFix = (float)((kTempoMusic - 8)) / 256; @@ -2217,7 +2217,7 @@ void MortevielleEngine::music() { int k = 0; do { fin = keyPressed(); - _soundManager.playSong(musicBuf, size * 2); + _soundManager.playSong(musicBuf, musicSize); ++k; fin = fin | keyPressed() | (k >= 5); } while (!fin); -- cgit v1.2.3 From fbb1137f946e929b675e181d1cccfabf46c5b83a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 Aug 2013 10:49:06 +0200 Subject: MORTEVIELLE: Take shouldQuit() into account while a song is played --- engines/mortevielle/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 3cb5284494..95da5c0e01 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -189,7 +189,7 @@ void SoundManager::playSong(const byte* buf, int size) { Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick) + while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) ; } -- cgit v1.2.3 From deef0b955ca95c6c4141668f60fd0bccc0b9949d Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 4 Aug 2013 12:56:15 +0100 Subject: MORTEVIELLE: Fix crash in sound mixer when closing the engine This was due to the _speakerHandle being reused between its initialisation in the SoundManager constructor and the destructor causing it to have a wrong value when trying (and failing) to stop the PCSpeaker channel in the mixer before deleting the stream. --- engines/mortevielle/sound.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 95da5c0e01..d95b12da3c 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -187,10 +187,13 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::playSong(const byte* buf, int size) { Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS); - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); + Audio::SoundHandle songHandle; + _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); - while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) + while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) ; + // In case the handle is still active, stop it. + _mixer->stopHandle(songHandle); } void SoundManager::setParent(MortevielleEngine *vm) { -- cgit v1.2.3 From 7b517f7fd1b463f268b2aa381ab00351092ba97b Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 4 Aug 2013 12:59:34 +0100 Subject: MORTEVIELLE: Improve looping of the intro song Using a LoopingAudioStream gets rid of the pause between each loop (and simplifies the code). --- engines/mortevielle/sound.cpp | 4 ++-- engines/mortevielle/sound.h | 2 +- engines/mortevielle/utils.cpp | 9 +-------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index d95b12da3c..042097f52c 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -185,8 +185,8 @@ void SoundManager::playNote(int frequency, int32 length) { } -void SoundManager::playSong(const byte* buf, int size) { - Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS); +void SoundManager::playSong(const byte* buf, int size, int loops) { + Audio::AudioStream *stream = Audio::makeLoopingAudioStream(Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS), loops); Audio::SoundHandle songHandle; _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 313859dacf..ee6aaff4ad 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -106,7 +106,7 @@ public: void playNote(int frequency, int32 length); int decodeMusic(const byte *PSrc, byte *PDest, int size); - void playSong(const byte *buf, int size); + void playSong(const byte *buf, int size, int loops = 1); void litph(tablint &t, int typ, int tempo); }; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index d5dc678a72..5667e6e5c0 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2213,14 +2213,7 @@ void MortevielleEngine::music() { _addFix = (float)((kTempoMusic - 8)) / 256; _speechManager.cctable(_speechManager._tbi); - bool fin = false; - int k = 0; - do { - fin = keyPressed(); - _soundManager.playSong(musicBuf, musicSize); - ++k; - fin = fin | keyPressed() | (k >= 5); - } while (!fin); + _soundManager.playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); -- cgit v1.2.3 From 89e14f6862bbd61af0f532442e298f2323f9b88d Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Sun, 4 Aug 2013 15:48:55 +0200 Subject: SCUMM: Fix backwards-in-same-array case of v72he::copyArray. --- engines/scumm/he/script_v72he.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index b9f454de0f..f36f5cc130 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1779,8 +1779,11 @@ void ScummEngine_v72he::copyArray(int array1, int a1_dim2start, int a1_dim2end, copyArrayHelper(ah, a1_dim2start, a1_dim1start, a1_dim1end, &dst, &dstPitch, &rowSize); copyArrayHelper(ah, a2_dim2start, a2_dim1start, a2_dim1end, &src, &srcPitch, &rowSize); } else { + // start at the end, so we copy backwards (in case the indices overlap) copyArrayHelper(ah, a1_dim2end, a1_dim1start, a1_dim1end, &dst, &dstPitch, &rowSize); copyArrayHelper(ah, a2_dim2end, a2_dim1start, a2_dim1end, &src, &srcPitch, &rowSize); + dstPitch = -dstPitch; + srcPitch = -srcPitch; } for (; a1_dim2start <= a1_dim2end; ++a1_dim2start) { memcpy(dst, src, rowSize); -- cgit v1.2.3 From c92ffa95df999265f5a63d9e0f7843c97040643e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Aug 2013 10:00:10 -0400 Subject: TSAGE: Completed R2R starship cutscene --- engines/tsage/ringworld2/ringworld2_logic.cpp | 11 ++++-- engines/tsage/ringworld2/ringworld2_logic.h | 2 ++ engines/tsage/ringworld2/ringworld2_scenes0.cpp | 6 ++-- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 45 ++++++++++++++++--------- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c5f6dc9fb7..0495834307 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -108,7 +108,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { /* Scene group #1 */ // case 1000: - // Cutscene: Ship moving + // Cutscene scene return new Scene1000(); case 1010: // Cutscene - trip in space @@ -570,6 +570,13 @@ void SceneExt::scalePalette(int RFactor, int GFactor, int BFactor) { } } +void SceneExt::loadBlankScene() { + _backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2); + _backSurface.fillRect(_backSurface.getBounds(), 0); + + R2_GLOBALS._screenSurface.fillRect(R2_GLOBALS._screenSurface.getBounds(), 0); +} + /*--------------------------------------------------------------------------*/ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { @@ -1750,7 +1757,7 @@ AnimationPlayer::~AnimationPlayer() { void AnimationPlayer::synchronize(Serializer &s) { EventHandler::synchronize(s); - warning("TODO AnimationPlayer::load"); + warning("TODO AnimationPlayer::synchronize"); } void AnimationPlayer::remove() { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index b740783581..1b4b7fca1f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -108,6 +108,7 @@ public: void fadeOut(); void clearScreen(); void scalePalette(int RFactor, int GFactor, int BFactor); + void loadBlankScene(); }; class SceneHandlerExt: public SceneHandler { @@ -435,6 +436,7 @@ public: virtual void changePane() {} virtual void closing() {} + bool load(int animId, Action *endAction = NULL); bool isCompleted(); void close(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 53610ced25..e37d5bfff3 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3080,10 +3080,10 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { } else { R2_GLOBALS._player.disableControl(); scene->_stripId = 171; - } - scene->_sceneMode = 310; - scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL); + scene->_sceneMode = 310; + scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL); + } return true; case R2_READER: diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index a23db73b7f..fa24658586 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -30,7 +30,7 @@ namespace TsAGE { namespace Ringworld2 { /*-------------------------------------------------------------------------- - * Scene 1000 - Cutscene: Ship moving + * Scene 1000 - Cutscene scene * *--------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ Scene1000::Scene1000(): SceneExt() { } void Scene1000::postInit(SceneObjectList *OwnerList) { + loadBlankScene(); SceneExt::postInit(); _stripManager.addSpeaker(&_gameTextSpeaker); @@ -85,6 +86,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) { break; } + R2_GLOBALS._uiElements._active = false; setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); } @@ -98,7 +100,7 @@ void Scene1000::signal() { ScenePalette scenePalette1, scenePalette2; uint32 black = 0; - switch (R2_GLOBALS._sceneManager._previousScene) { + switch (_sceneMode++) { case 0: // TODO: Sort out values R2_GLOBALS._gfxColors.foreground = 191; @@ -108,7 +110,7 @@ void Scene1000::signal() { _animationPlayer._objectMode = ANIMOBJMODE_2; _animationPlayer._paletteMode = ANIMPALMODE_NONE; - _animationPlayer.load(5); + _animationPlayer.load(5, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -165,7 +167,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(7); + _animationPlayer.load(7, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -195,7 +197,7 @@ void Scene1000::signal() { case 10: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(6); + _animationPlayer.load(6, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -217,7 +219,7 @@ void Scene1000::signal() { case 20: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(8); + _animationPlayer.load(8, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -237,7 +239,7 @@ void Scene1000::signal() { case 30: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(17); + _animationPlayer.load(17, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -262,7 +264,7 @@ void Scene1000::signal() { case 40: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(18); + _animationPlayer.load(18, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -288,7 +290,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(13); + _animationPlayer.load(13, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -310,7 +312,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(14); + _animationPlayer.load(14, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -337,7 +339,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(12); + _animationPlayer.load(12, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -362,7 +364,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(9); + _animationPlayer.load(9, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -385,7 +387,7 @@ void Scene1000::signal() { case 80: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(10); + _animationPlayer.load(10, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -403,7 +405,7 @@ void Scene1000::signal() { case 90: _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(11); + _animationPlayer.load(11, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -430,7 +432,7 @@ void Scene1000::signal() { _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._objectMode = ANIMOBJMODE_2; - _animationPlayer.load(19); + _animationPlayer.load(19, this); R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._subData._palData, 0, 256); R2_GLOBALS._sceneManager._hasPalette = false; @@ -452,7 +454,20 @@ void Scene1000::signal() { } void Scene1000::dispatch() { + if (_fieldD2E) { + if (_animationPlayer.isCompleted()) { + _fieldD2E = 0; + _animationPlayer.close(); + _animationPlayer.remove(); + + if (_sceneMode == 52) + _endHandler = this; + } else { + _animationPlayer.dispatch(); + } + } + Scene::dispatch(); } -- cgit v1.2.3 From 0d2f81238720bef663f96942b2036e1e59e1f689 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Aug 2013 10:16:26 -0400 Subject: TSAGE: Bugfixes for further R2R scene 1000 cutscenes --- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index fa24658586..8d165fba07 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -146,12 +146,12 @@ void Scene1000::signal() { case 2: if (R2_GLOBALS._speechSubtitles & SPEECH_TEXT) { - setAction(&_sequenceManager1, this, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); } else { if (++_field412 < 3) _sceneMode = 2; - setAction(&_sequenceManager1, this, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 2, &R2_GLOBALS._player, NULL); } break; @@ -162,7 +162,7 @@ void Scene1000::signal() { R2_GLOBALS._fontColors.background = 224; R2_GLOBALS._fontColors.foreground = 119; - for (int percent = 100; percent >= 0; percent += 5) + for (int percent = 100; percent >= 0; percent -= 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); _animationPlayer._paletteMode = ANIMPALMODE_NONE; @@ -285,7 +285,7 @@ void Scene1000::signal() { case 50: R2_GLOBALS._sound2.play(306); - for (int percent = 100; percent >= 0; percent += 5) + for (int percent = 100; percent >= 0; percent -= 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); _animationPlayer._paletteMode = ANIMPALMODE_NONE; @@ -307,7 +307,7 @@ void Scene1000::signal() { R2_GLOBALS._sound2.play(307); R2_GLOBALS._sound1.play(308); - for (int percent = 100; percent >= 0; percent += 5) + for (int percent = 100; percent >= 0; percent -= 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); _animationPlayer._paletteMode = ANIMPALMODE_NONE; @@ -334,7 +334,7 @@ void Scene1000::signal() { case 60: R2_GLOBALS._sound1.play(333); - for (int percent = 100; percent >= 0; percent += 5) + for (int percent = 100; percent >= 0; percent -= 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); _animationPlayer._paletteMode = ANIMPALMODE_NONE; @@ -359,7 +359,7 @@ void Scene1000::signal() { case 70: R2_GLOBALS._sound2.play(113); - for (int percent = 100; percent >= 0; percent += 5) + for (int percent = 100; percent >= 0; percent -= 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); _animationPlayer._paletteMode = ANIMPALMODE_NONE; -- cgit v1.2.3 From 80cc1700a7a3e151f25a45dcad868b4d5b62d334 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Aug 2013 00:13:57 +0200 Subject: MORTEVIELLE: Fix leak in playSong, refactor it a bit --- engines/mortevielle/sound.cpp | 7 ++++--- engines/mortevielle/sound.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 042097f52c..bfdadaa048 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -185,10 +185,11 @@ void SoundManager::playNote(int frequency, int32 length) { } -void SoundManager::playSong(const byte* buf, int size, int loops) { - Audio::AudioStream *stream = Audio::makeLoopingAudioStream(Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS), loops); +void SoundManager::playSong(const byte* buf, uint size, uint loops) { + Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS, DisposeAfterUse::NO); + Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; - _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) ; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index ee6aaff4ad..1f9e0d9c4d 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -106,7 +106,7 @@ public: void playNote(int frequency, int32 length); int decodeMusic(const byte *PSrc, byte *PDest, int size); - void playSong(const byte *buf, int size, int loops = 1); + void playSong(const byte *buf, uint usize, uint loops); void litph(tablint &t, int typ, int tempo); }; -- cgit v1.2.3 From 71a1d18b0cffccf8f871b0ea77bc8ba239cb10cc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Aug 2013 00:40:47 +0200 Subject: MORTEVIELLE: Fix flags in playSong(). Thanks clone2727 for telling about it --- engines/mortevielle/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index bfdadaa048..24cec8911d 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -186,7 +186,7 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::playSong(const byte* buf, uint size, uint loops) { - Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS, DisposeAfterUse::NO); + Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); -- cgit v1.2.3 From a932e51b14b0bee5d79988587b3e5161efcb812a Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 5 Aug 2013 03:25:22 +0200 Subject: WINTERMUTE: Fix formatting. --- engines/wintermute/graphics/transform_struct.h | 26 +-- engines/wintermute/graphics/transform_tools.cpp | 11 +- engines/wintermute/graphics/transform_tools.h | 6 +- .../wintermute/graphics/transparent_surface.cpp | 211 ++++++++++----------- engines/wintermute/graphics/transparent_surface.h | 6 +- 5 files changed, 129 insertions(+), 131 deletions(-) diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index acde410e89..a54c4cc5d0 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -27,12 +27,12 @@ #include "engines/wintermute/dctypes.h" namespace Wintermute { -/** +/** * Contains all the required information that define a transform. * Same source sprite + same TransformStruct = Same resulting sprite. * Has a number of overloaded constructors to accomodate various argument lists. */ - + const uint32 kDefaultZoomX = 100; const uint32 kDefaultZoomY = 100; const uint32 kDefaultRgbaMod = 0xFFFFFFFF; @@ -41,9 +41,9 @@ const int32 kDefaultHotspotY = 0; const int32 kDefaultOffsetX = 0; const int32 kDefaultOffsetY = 0; const int32 kDefaultAngle = 0; - + struct TransformStruct { -private: +private: void init(Point32 zoom, uint32 angle, Point32 hotspot, bool alphaDisable, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX, bool mirrorY, Point32 offset); public: @@ -51,16 +51,16 @@ public: TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 alpha, bool mirrorX = false, bool mirrorY = false); TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX = 0, int32 hotspotY = 0); TransformStruct(); - - Point32 _zoom; ///< Zoom; 100 = no zoom + + Point32 _zoom; ///< Zoom; 100 = no zoom Point32 _hotspot; ///< Position of the hotspot - uint32 _angle; ///< Rotation angle, in degrees - byte _flip; ///< Bitflag: see TransparentSurface::FLIP_XXX + uint32 _angle; ///< Rotation angle, in degrees + byte _flip; ///< Bitflag: see TransparentSurface::FLIP_XXX bool _alphaDisable; TSpriteBlendMode _blendMode; - uint32 _rgbaMod; ///< RGBa - Point32 _offset; - + uint32 _rgbaMod; ///< RGBa + Point32 _offset; + bool getMirrorX() const; bool getMirrorY() const; @@ -72,9 +72,9 @@ public: compare._alphaDisable == _alphaDisable && compare._rgbaMod == _rgbaMod && compare._blendMode == _blendMode - ); + ); } - + bool operator!=(const TransformStruct &compare) const { return !(compare == *this); } diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 4f05e19a92..ebf9092aaa 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -25,7 +25,7 @@ #include namespace Wintermute { - + FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { float rotateRad = rotate * M_PI / 180.0f; FloatPoint newPoint; @@ -40,20 +40,19 @@ FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float r return newPoint; } -Rect32 TransformTools::newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { - +Rect32 TransformTools::newRect(const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot) { Point32 nw(oldRect.left, oldRect.top); Point32 ne(oldRect.right, oldRect.top); Point32 sw(oldRect.left, oldRect.bottom); Point32 se(oldRect.right, oldRect.bottom); - + FloatPoint nw1, ne1, sw1, se1; nw1 = transformPoint(nw - transform._hotspot, transform._angle, transform._zoom); ne1 = transformPoint(ne - transform._hotspot, transform._angle, transform._zoom); sw1 = transformPoint(sw - transform._hotspot, transform._angle, transform._zoom); se1 = transformPoint(se - transform._hotspot, transform._angle, transform._zoom); - + float top = MIN(nw1.y, MIN(ne1.y, MIN(sw1.y, se1.y))); float bottom = MAX(nw1.y, MAX(ne1.y, MAX(sw1.y, se1.y))); float left = MIN(nw1.x, MIN(ne1.x, MIN(sw1.x, se1.x))); @@ -64,7 +63,7 @@ Rect32 TransformTools::newRect (const Rect32 &oldRect, const TransformStruct &tr newHotspot->x = (uint32)(-floor(left)); res.top = (int32)(floor(top)) + transform._hotspot.y; - res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; + res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; res.left = (int32)(floor(left)) + transform._hotspot.x; res.right = (int32)(ceil(right)) + transform._hotspot.x; diff --git a/engines/wintermute/graphics/transform_tools.h b/engines/wintermute/graphics/transform_tools.h index e59c47272a..c92b81fd11 100644 --- a/engines/wintermute/graphics/transform_tools.h +++ b/engines/wintermute/graphics/transform_tools.h @@ -30,10 +30,10 @@ namespace Wintermute { class TransformTools { -public: +public: /** * Basic transform (scale + rotate) for a single point - */ + */ static FloatPoint transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX = false, const bool mirrorY = false); /** @@ -46,7 +46,7 @@ public: * and, as a side-effect, "newHotspot" will tell you where the hotspot will * have ended up in the new rect, for centering. */ - static Rect32 newRect (const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot); + static Rect32 newRect(const Rect32 &oldRect, const TransformStruct &transform, Point32 *newHotspot); }; } // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 3469bcbe1e..663c0ed01a 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -34,112 +34,111 @@ namespace Wintermute { #if ENABLE_BILINEAR void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); - int srcW = srcRect.width(); - int srcH = srcRect.height(); - int dstW = dstRect.width(); - int dstH = dstRect.height(); + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); - assert(dstX >= 0 && dstX < dstW); - assert(dstY >= 0 && dstY < dstH); + float x1 = floor(projX); + float x2 = ceil(projX); + float y1 = floor(projY); + float y2 = ceil(projY); - float x1 = floor(projX); - float x2 = ceil(projX); - float y1 = floor(projY); - float y2 = ceil(projY); + uint32 Q11, Q12, Q21, Q22; - uint32 Q11, Q12, Q21, Q22; + if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { + Q11 = 0; + } else { + Q11 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y1 + srcRect.top))); + } - if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { - Q11 = 0; - } else { - Q11 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left),(int)(y1 + srcRect.top))); - } + if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { + Q12 = 0; + } else { + Q12 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y2 + srcRect.top))); + } - if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { - Q12 = 0; - } else { - Q12 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y2 + srcRect.top))); - } + if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { + Q21 = 0; + } else { + Q21 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y1 + srcRect.top))); + } - if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { - Q21 = 0; - } else { - Q21 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y1 + srcRect.top))); - } + if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { + Q22 = 0; + } else { + Q22 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y2 + srcRect.top))); + } - if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { - Q22 = 0; - } else { - Q22 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y2 + srcRect.top))); - } + byte *Q11s = (byte *)&Q11; + byte *Q12s = (byte *)&Q12; + byte *Q21s = (byte *)&Q21; + byte *Q22s = (byte *)&Q22; - byte *Q11s = (byte *)&Q11; - byte *Q12s = (byte *)&Q12; - byte *Q21s = (byte *)&Q21; - byte *Q22s = (byte *)&Q22; - - uint32 color; - byte *dest = (byte *)&color; - - float q11x = (x2 - projX); - float q11y = (y2 - projY); - float q21x = (projX - x1); - float q21y = (y2 - projY); - float q12x = (x2 - projX); - float q12y = (projY - y1); - - if (x1 == x2 && y1 == y2) { - for (int c = 0; c < 4; c++) { - dest[c] = ((float)Q11s[c]); - } - } else { + uint32 color; + byte *dest = (byte *)&color; - if (x1 == x2) { - q11x = 0.5; - q12x = 0.5; - q21x = 0.5; - } else if (y1 == y2) { - q11y = 0.5; - q12y = 0.5; - q21y = 0.5; - } - - for (int c = 0; c < 4; c++) { - dest[c] = (byte)( - ((float)Q11s[c]) * q11x * q11y + - ((float)Q21s[c]) * q21x * q21y + - ((float)Q12s[c]) * q12x * q12y + - ((float)Q22s[c]) * (1.0 - - q11x * q11y - - q21x * q21y - - q12x * q12y) - ); - } - } - WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); + float q11x = (x2 - projX); + float q11y = (y2 - projY); + float q21x = (projX - x1); + float q21y = (y2 - projY); + float q12x = (x2 - projX); + float q12y = (projY - y1); + + if (x1 == x2 && y1 == y2) { + for (int c = 0; c < 4; c++) { + dest[c] = ((float)Q11s[c]); + } + } else { + + if (x1 == x2) { + q11x = 0.5; + q12x = 0.5; + q21x = 0.5; + } else if (y1 == y2) { + q11y = 0.5; + q12y = 0.5; + q21y = 0.5; + } + + for (int c = 0; c < 4; c++) { + dest[c] = (byte)( + ((float)Q11s[c]) * q11x * q11y + + ((float)Q21s[c]) * q21x * q21y + + ((float)Q12s[c]) * q12x * q12y + + ((float)Q22s[c]) * (1.0 - + q11x * q11y - + q21x * q21y - + q12x * q12y) + ); + } + } + WRITE_UINT32((byte *)dst->getBasePtr(dstX + dstRect.left, dstY + dstRect.top), color); } #else void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int dstX, int dstY, const Common::Rect &srcRect, const Common::Rect &dstRect, const TransparentSurface *src, TransparentSurface *dst) { - int srcW = srcRect.width(); - int srcH = srcRect.height(); - int dstW = dstRect.width(); - int dstH = dstRect.height(); - - assert(dstX >= 0 && dstX < dstW); - assert(dstY >= 0 && dstY < dstH); - - uint32 color; - - if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { - color = 0; - } else { - color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); - } + int srcW = srcRect.width(); + int srcH = srcRect.height(); + int dstW = dstRect.width(); + int dstH = dstRect.height(); + + assert(dstX >= 0 && dstX < dstW); + assert(dstY >= 0 && dstY < dstH); + + uint32 color; + + if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { + color = 0; + } else { + color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); + } - WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); + WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); } -#endif +#endif byte *TransparentSurface::_lookup = nullptr; @@ -162,7 +161,7 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur } } -void doBlitOpaque(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { +void doBlitOpaque(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in, *out; #ifdef SCUMM_LITTLE_ENDIAN @@ -193,7 +192,7 @@ void TransparentSurface::generateLookup() { } } -void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { +void TransparentSurface::doBlitAlpha(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in, *out; if (!_lookup) { @@ -312,11 +311,11 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p srcImage.h = pPartRect->height(); debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, - pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height); + pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height); } else { debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0, - srcImage.w, srcImage.h, color, width, height); + srcImage.w, srcImage.h, color, width, height); } if (width == -1) @@ -496,12 +495,12 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p } TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const { - + assert(transform._angle != 0); // This would not be ideal; rotoscale() should never be called in conditional branches where angle = 0 anyway. Point32 newHotspot; Common::Rect srcRect(0, 0, (int16)w, (int16)h); - Rect32 rect = TransformTools::newRect(Rect32 (srcRect), transform, &newHotspot); + Rect32 rect = TransformTools::newRect(Rect32(srcRect), transform, &newHotspot); Common::Rect dstRect(0, 0, (int16)(rect.right - rect.left), (int16)(rect.bottom - rect.top)); TransparentSurface *target = new TransparentSurface(); @@ -523,16 +522,16 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo int x1 = x - newHotspot.x; int y1 = y - newHotspot.y; - targX = ((x1 * invCos - y1 * invSin)) * kDefaultZoomX / transform._zoom.x + srcRect.left; - targY = ((x1 * invSin + y1 * invCos)) * kDefaultZoomY / transform._zoom.y + srcRect.top; - + targX = ((x1 * invCos - y1 * invSin)) * kDefaultZoomX / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * kDefaultZoomY / transform._zoom.y + srcRect.top; + targX += transform._hotspot.x; targY += transform._hotspot.y; - + #if ENABLE_BILINEAR - copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); + copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target); #else - copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); + copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target); #endif } } @@ -542,7 +541,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const { Common::Rect srcRect(0, 0, (int16)w, (int16)h); Common::Rect dstRect(0, 0, (int16)newWidth, (int16)newHeight); - + TransparentSurface *target = new TransparentSurface(); assert(format.bytesPerPixel == 4); @@ -562,9 +561,9 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) projX = x / (float)dstW * srcW; projY = y / (float)dstH * srcH; #if ENABLE_BILINEAR - copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); + copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target); #else - copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); + copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); #endif } } diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index f2a0c1852a..9d06f3e006 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -112,12 +112,12 @@ struct TransparentSurface : public Graphics::Surface { int width = -1, int height = -1); void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false); - TransparentSurface *scale (uint16 newWidth, uint16 newHeight) const; - TransparentSurface *rotoscale (const TransformStruct &transform) const; + TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const; + TransparentSurface *rotoscale(const TransformStruct &transform) const; static byte *_lookup; static void destroyLookup(); private: - static void doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); + static void doBlitAlpha(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep); static void generateLookup(); }; -- cgit v1.2.3 From bd0db73a641e6538e999fe7a4802d0bbc9d2a950 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Aug 2013 11:44:27 +0200 Subject: BUILD: fix 'make test' compile error --- test/audio/raw.h | 1 + 1 file changed, 1 insertion(+) diff --git a/test/audio/raw.h b/test/audio/raw.h index e7cb42ac44..3792f82674 100644 --- a/test/audio/raw.h +++ b/test/audio/raw.h @@ -1,6 +1,7 @@ #include #include "audio/decoders/raw.h" +#include "audio/audiostream.h" #include "helper.h" -- cgit v1.2.3 From a993b8dc308b22755f13f1436579b65cf50a75fe Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Aug 2013 11:47:11 +0200 Subject: NEVERHOOD: Remove NRect constructor Otherwise, every global variable of type NRect requires a constructor to be run, which can cause portability issue. --- engines/neverhood/graphics.h | 8 ++-- engines/neverhood/menumodule.cpp | 74 ++++++++++++++++---------------- engines/neverhood/modules/module1100.cpp | 14 +++--- engines/neverhood/modules/module2400.cpp | 10 ++--- engines/neverhood/modules/module2500.cpp | 8 ++-- engines/neverhood/modules/module2700.cpp | 8 ++-- engines/neverhood/scene.cpp | 2 +- 7 files changed, 63 insertions(+), 61 deletions(-) diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h index 703e274576..b80bd60729 100644 --- a/engines/neverhood/graphics.h +++ b/engines/neverhood/graphics.h @@ -43,9 +43,11 @@ struct NDimensions { struct NRect { int16 x1, y1, x2, y2; - NRect() : x1(0), y1(0), x2(0), y2(0) {} - - NRect(int16 x01, int16 y01, int16 x02, int16 y02) : x1(x01), y1(y01), x2(x02), y2(y02) {} + static NRect make(int16 x01, int16 y01, int16 x02, int16 y02) { + NRect r; + r.set(x01, y01, x02, y02); + return r; + } void set(int16 x01, int16 y01, int16 x02, int16 y02) { x1 = x01; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index d59afa4ba5..7bf64a4602 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -338,15 +338,15 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) }; static const NRect kMenuButtonCollisionBounds[] = { - NRect(52, 121, 110, 156), - NRect(52, 192, 109, 222), - NRect(60, 257, 119, 286), - NRect(67, 326, 120, 354), - NRect(70, 389, 128, 416), - NRect(523, 113, 580, 144), - NRect(525, 176, 577, 206), - NRect(527, 384, 580, 412), - NRect(522, 255, 580, 289) + { 52, 121, 110, 156 }, + { 52, 192, 109, 222 }, + { 60, 257, 119, 286 }, + { 67, 326, 120, 354 }, + { 70, 389, 128, 416 }, + { 523, 113, 580, 144 }, + { 525, 176, 577, 206 }, + { 527, 384, 580, 412 }, + { 522, 255, 580, 289 } }; setBackground(0x08C0020C); @@ -1026,17 +1026,17 @@ static const uint32 kSaveGameMenuButtonFileHashes[] = { }; static const NRect kSaveGameMenuButtonCollisionBounds[] = { - NRect(518, 106, 602, 160), - NRect(516, 378, 596, 434), - NRect(394, 108, 458, 206), - NRect(400, 204, 458, 276), - NRect(398, 292, 456, 352), - NRect(396, 352, 460, 444) + { 518, 106, 602, 160 }, + { 516, 378, 596, 434 }, + { 394, 108, 458, 206 }, + { 400, 204, 458, 276 }, + { 398, 292, 456, 352 }, + { 396, 352, 460, 444 } }; -static const NRect kSaveGameMenuListBoxRect(0, 0, 320, 272); -static const NRect kSaveGameMenuTextEditRect(0, 0, 377, 17); -static const NRect kSaveGameMenuMouseRect(50, 47, 427, 64); +static const NRect kSaveGameMenuListBoxRect = { 0, 0, 320, 272 }; +static const NRect kSaveGameMenuTextEditRect = { 0, 0, 377, 17 }; +static const NRect kSaveGameMenuMouseRect = { 50, 47, 427, 64 }; SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kSaveGameMenuButtonFileHashes, kSaveGameMenuButtonCollisionBounds, @@ -1060,17 +1060,17 @@ static const uint32 kLoadGameMenuButtonFileHashes[] = { }; static const NRect kLoadGameMenuButtonCollisionBounds[] = { - NRect( 44, 115, 108, 147), - NRect( 52, 396, 112, 426), - NRect(188, 116, 245, 196), - NRect(189, 209, 239, 269), - NRect(187, 301, 233, 349), - NRect(182, 358, 241, 433) + { 44, 115, 108, 147 }, + { 52, 396, 112, 426 }, + { 188, 116, 245, 196 }, + { 189, 209, 239, 269 }, + { 187, 301, 233, 349 }, + { 182, 358, 241, 433 } }; -static const NRect kLoadGameMenuListBoxRect(0, 0, 320, 271); -static const NRect kLoadGameMenuTextEditRect(0, 0, 320, 17); -static const NRect kLoadGameMenuMouseRect(263, 48, 583, 65); +static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kLoadGameMenuTextEditRect = { 0, 0, 320, 17 }; +static const NRect kLoadGameMenuMouseRect = { 263, 48, 583, 65 }; LoadGameMenu::LoadGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kLoadGameMenuButtonFileHashes, kLoadGameMenuButtonCollisionBounds, @@ -1093,16 +1093,16 @@ static const uint32 kDeleteGameMenuButtonFileHashes[] = { }; static const NRect kDeleteGameMenuButtonCollisionBounds[] = { - NRect(518, 46, 595, 91), - NRect(524, 322, 599, 369), - NRect(395, 40, 462, 127), - NRect(405, 126, 460, 185), - NRect(397, 205, 456, 273), - NRect(395, 278, 452, 372) + { 518, 46, 595, 91 }, + { 524, 322, 599, 369 }, + { 395, 40, 462, 127 }, + { 405, 126, 460, 185 }, + { 397, 205, 456, 273 }, + { 395, 278, 452, 372 } }; -static const NRect kDeleteGameMenuListBoxRect(0, 0, 320, 271); -static const NRect kDeleteGameMenuTextEditRect(0, 0, 320, 17); +static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kDeleteGameMenuTextEditRect = { 0, 0, 320, 17 }; DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kDeleteGameMenuButtonFileHashes, kDeleteGameMenuButtonCollisionBounds, @@ -1128,8 +1128,8 @@ QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule }; static const NRect kQueryOverwriteMenuCollisionBounds[] = { - NRect(145, 334, 260, 385), - NRect(365, 340, 477, 388) + { 145, 334, 260, 385 }, + { 365, 340, 477, 388 } }; setBackground(0x043692C4); diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 03810915dd..faa0516d7e 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -555,19 +555,19 @@ void Scene1105::createObjects() { _ssSymbolDice[1] = insertSprite(1, 339, 304); _ssSymbolDice[2] = insertSprite(2, 485, 304); - _ssSymbol1UpButton = insertSprite(this, 0x08002860, NRect(146, 362, 192, 403)); + _ssSymbol1UpButton = insertSprite(this, 0x08002860, NRect::make(146, 362, 192, 403)); addCollisionSprite(_ssSymbol1UpButton); - _ssSymbol1DownButton = insertSprite(this, 0x42012460, NRect(147, 404, 191, 442)); + _ssSymbol1DownButton = insertSprite(this, 0x42012460, NRect::make(147, 404, 191, 442)); addCollisionSprite(_ssSymbol1DownButton); - _ssSymbol2UpButton = insertSprite(this, 0x100030A0, NRect(308, 361, 355, 402)); + _ssSymbol2UpButton = insertSprite(this, 0x100030A0, NRect::make(308, 361, 355, 402)); addCollisionSprite(_ssSymbol2UpButton); - _ssSymbol2DownButton = insertSprite(this, 0x840228A0, NRect(306, 406, 352, 445)); + _ssSymbol2DownButton = insertSprite(this, 0x840228A0, NRect::make(306, 406, 352, 445)); addCollisionSprite(_ssSymbol2DownButton); - _ssSymbol3UpButton = insertSprite(this, 0x20000120, NRect(476, 358, 509, 394)); + _ssSymbol3UpButton = insertSprite(this, 0x20000120, NRect::make(476, 358, 509, 394)); addCollisionSprite(_ssSymbol3UpButton); - _ssSymbol3DownButton = insertSprite(this, 0x08043121, NRect(463, 401, 508, 438)); + _ssSymbol3DownButton = insertSprite(this, 0x08043121, NRect::make(463, 401, 508, 438)); addCollisionSprite(_ssSymbol3DownButton); - _ssActionButton = insertSprite(this, 0x8248AD35, NRect(280, 170, 354, 245)); + _ssActionButton = insertSprite(this, 0x8248AD35, NRect::make(280, 170, 354, 245)); addCollisionSprite(_ssActionButton); _isPanelOpen = true; diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 3a152543cf..21ea390ba2 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -168,11 +168,11 @@ static const uint32 kScene2401FileHashes3[] = { }; static const NRect kScene2401Rects[] = { - NRect(369, 331, 394, 389), - NRect(395, 331, 419, 389), - NRect(420, 331, 441, 389), - NRect(442, 331, 464, 389), - NRect(465, 331, 491, 389) + { 369, 331, 394, 389 }, + { 395, 331, 419, 389 }, + { 420, 331, 441, 389 }, + { 442, 331, 464, 389 }, + { 465, 331, 491, 389 } }; static const uint32 kAsScene2401WaterSpitFileHashes2[] = { diff --git a/engines/neverhood/modules/module2500.cpp b/engines/neverhood/modules/module2500.cpp index 1b525f12af..46ce2ba4fc 100644 --- a/engines/neverhood/modules/module2500.cpp +++ b/engines/neverhood/modules/module2500.cpp @@ -29,25 +29,25 @@ static const uint32 kScene2505StaticSprites[] = { 0x4000A226, 0 }; -static const NRect kScene2505ClipRect = NRect(0, 0, 564, 480); +static const NRect kScene2505ClipRect = { 0, 0, 564, 480 }; static const uint32 kScene2506StaticSprites[] = { 0x4027AF02, 0 }; -static const NRect kScene2506ClipRect = NRect(0, 0, 640, 441); +static const NRect kScene2506ClipRect = { 0, 0, 640, 441 }; static const uint32 kScene2508StaticSprites1[] = { 0x2F08E610, 0xD844E6A0, 0 }; -static const NRect kScene2508ClipRect1 = NRect(0, 0, 594, 448); +static const NRect kScene2508ClipRect1 = { 0, 0, 594, 448 }; static const uint32 kScene2508StaticSprites2[] = { 0x2F08E610, 0 }; -static const NRect kScene2508ClipRect2 = NRect(0, 0, 594, 448); +static const NRect kScene2508ClipRect2 = { 0, 0, 594, 448 }; Module2500::Module2500(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundIndex(0) { diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index f8f3c71042..7aea82f6b1 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -26,14 +26,14 @@ namespace Neverhood { -static const NRect kScene2710ClipRect = NRect(0, 0, 626, 480); +static const NRect kScene2710ClipRect = { 0, 0, 626, 480 }; static const uint32 kScene2710StaticSprites[] = { 0x0D2016C0, 0 }; -static const NRect kScene2711ClipRect = NRect(0, 0, 521, 480); +static const NRect kScene2711ClipRect = { 0, 0, 521, 480 }; static const uint32 kScene2711FileHashes1[] = { 0, @@ -68,14 +68,14 @@ static const uint32 kScene2711FileHashes3[] = { 0 }; -static const NRect kScene2724ClipRect = NRect(0, 141, 640, 480); +static const NRect kScene2724ClipRect = { 0, 141, 640, 480 }; static const uint32 kScene2724StaticSprites[] = { 0xC20D00A5, 0 }; -static const NRect kScene2725ClipRect = NRect(0, 0, 640, 413); +static const NRect kScene2725ClipRect = { 0, 0, 640, 413 }; static const uint32 kScene2725StaticSprites[] = { 0xC20E00A5, diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index e76a9ca521..c8d7490753 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -212,7 +212,7 @@ Sprite *Scene::insertStaticSprite(uint32 fileHash, int surfacePriority) { } void Scene::insertScreenMouse(uint32 fileHash, const NRect *mouseRect) { - NRect rect(-1, -1, -1, -1); + NRect rect = NRect::make(-1, -1, -1, -1); if (mouseRect) rect = *mouseRect; insertMouse(new Mouse(_vm, fileHash, rect)); -- cgit v1.2.3 From 0f050fe797f2f7d0b5da65f443142c0ffdd006ce Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:29:16 +0200 Subject: WII: Do not access Surface::pixels directly. --- backends/platform/wii/osystem_gfx.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index a9bcdbb8d1..92c890b0a9 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -528,16 +528,13 @@ void OSystem_Wii::updateScreen() { } Graphics::Surface *OSystem_Wii::lockScreen() { - _surface.pixels = _gamePixels; - _surface.w = _gameWidth; - _surface.h = _gameHeight; + _surface.init(_gameWidth, _gameHeight, #ifdef USE_RGB_COLOR - _surface.pitch = _gameWidth * _pfGame.bytesPerPixel; - _surface.format = _pfGame; + _gameWidth * _pfGame.bytesPerPixel, _gamePixels, _pfGame #else - _surface.pitch = _gameWidth; - _surface.format = Graphics::PixelFormat::createFormatCLUT8(); + _gameWidth, _gamePixels, Graphics::PixelFormat::createFormatCLUT8() #endif + ); return &_surface; } -- cgit v1.2.3 From 6639958d7af352db5f500292b3c0398a3c0579b0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:30:38 +0200 Subject: PS2: Do not access Surface::pixels directly. --- backends/platform/ps2/Gs2dScreen.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index e818305c29..58667c0230 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -392,12 +392,8 @@ void Gs2dScreen::copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w Graphics::Surface *Gs2dScreen::lockScreen() { WaitSema(g_DmacSema); - _framebuffer.pixels = _screenBuf; - _framebuffer.w = _width; - _framebuffer.h = _height; - _framebuffer.pitch = _width; // -not- _pitch; ! It's EE mem, not Tex - _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); - + // -not- _pitch; ! It's EE mem, not Tex + _framebuffer.init(_width, _height, _width, _screenBuf, Graphics::PixelFormat::createFormatCLUT8()); return &_framebuffer; } -- cgit v1.2.3 From 6d86a66493a7f9b74eeb14a5ff4bd750805d00ee Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:33:56 +0200 Subject: NDS: Do not access Surface::pixels directly. --- backends/platform/ds/arm9/source/osystem_ds.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 2f6358d8ee..f109983fbc 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -296,7 +296,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int // to save a few pennies/euro cents on the hardware. if (_frameBufferExists) { - bg = (u16 *)_framebuffer.pixels; + bg = (u16 *)_framebuffer.getPixels(); stride = _framebuffer.pitch; } else { bg = (u16 *)DS::get8BitBackBuffer(); @@ -455,7 +455,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int dmaCopyHalfWords(3, src, dest1, w); - if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) { + if ((!_frameBufferExists) || (buf == _framebuffer.getPixels())) { dmaCopyHalfWords(2, src, dest2, w); } @@ -476,7 +476,7 @@ void OSystem_DS::updateScreen() { _frameBufferExists = false; // Copy temp framebuffer back to screen - copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h); + copyRectToScreen((byte *)_framebuffer.getPixels(), _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h); } DS::displayMode16BitFlipBuffer(); @@ -755,11 +755,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() { if (DS::isCpuScalerEnabled()) { - _framebuffer.pixels = DS::getScalerBuffer(); - _framebuffer.w = DS::getGameWidth(); - _framebuffer.h = DS::getGameHeight(); - _framebuffer.pitch = DS::getGameWidth(); - _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); + _framebuffer.init(DS::getGameWidth(), DS::getGameHeight(), DS::getGameWidth(), + DS::getScalerBuffer(), Graphics::PixelFormat::createFormatCLUT8()); } else { @@ -780,11 +777,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() { dmaCopyHalfWords(3, srcLine, destLine, width); } - _framebuffer.pixels = dest; - _framebuffer.w = width; - _framebuffer.h = height; - _framebuffer.pitch = width; - _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); + _framebuffer.init(width, height, width, dest, Graphics::PixelFormat::createFormatCLUT8()); } @@ -798,8 +791,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() { for (int y = 0; y < DS::getGameHeight(); y++) { DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth()); for (int x = 0; x < DS::getGameWidth() >> 1; x++) { - *(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x]; -// *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x]; + *(((u16 *) (_framebuffer.getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x]; +// *(((u16 *) (surf->getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x]; } }*/ -- cgit v1.2.3 From 09f7e4d5d4d45a4db7c85520be66cf81fe975607 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:35:07 +0200 Subject: IPHONE: Do not access Surface::pixels directly. --- backends/platform/iphone/iphone_video.mm | 6 +++--- backends/platform/iphone/osys_main.cpp | 2 +- backends/platform/iphone/osys_video.mm | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm index 0bfae30fc7..f2c1527658 100644 --- a/backends/platform/iphone/iphone_video.mm +++ b/backends/platform/iphone/iphone_video.mm @@ -365,7 +365,7 @@ const char *iPhone_getDocumentsDir() { _mouseTexCoords[5] = _mouseTexCoords[7] = _videoContext.mouseHeight / (GLfloat)_videoContext.mouseTexture.h; glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError(); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.pixels); printOpenGLError(); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.getPixels()); printOpenGLError(); } - (void)updateMainSurface { @@ -377,7 +377,7 @@ const char *iPhone_getDocumentsDir() { // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases // due to the iPhone internals having to convert the whole texture back from its internal format when used. // In the future we could use several tiled textures instead. - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.pixels); printOpenGLError(); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.getPixels()); printOpenGLError(); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError(); } @@ -386,7 +386,7 @@ const char *iPhone_getDocumentsDir() { glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError(); glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError(); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.pixels); printOpenGLError(); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.getPixels()); printOpenGLError(); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError(); } diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 460d3fd2ac..ea566c3da0 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -78,7 +78,7 @@ OSystem_IPHONE::~OSystem_IPHONE() { // Prevent accidental freeing of the screen texture here. This needs to be // checked since we might use the screen texture as framebuffer in the case // of hi-color games for example. - if (_framebuffer.pixels == _videoContext->screenTexture.pixels) + if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels()) _framebuffer.free(); _mouseBuffer.free(); } diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index d48003be95..ce7f94f5bd 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -76,8 +76,8 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm // In case we use the screen texture as frame buffer we reset the pixels // pointer here to avoid freeing the screen texture. - if (_framebuffer.pixels == _videoContext->screenTexture.pixels) - _framebuffer.pixels = 0; + if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels()) + _framebuffer.setPixels(0); // Create the screen texture right here. We need to do this here, since // when a game requests hi-color mode, we actually set the framebuffer @@ -417,7 +417,7 @@ void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspot #endif assert(pixelFormat.bytesPerPixel == 1 || pixelFormat.bytesPerPixel == 2); - if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.pixels) + if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.getPixels()) _mouseBuffer.create(w, h, pixelFormat); _videoContext->mouseWidth = w; -- cgit v1.2.3 From 9179f0b78fc3548b2fdddb97cc6108d0a49e593c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:39:58 +0200 Subject: PSP: Do not access Surface::pixels directly. --- backends/platform/psp/default_display_client.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index bc252144fa..6d6eb641f7 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -192,11 +192,8 @@ void Screen::setScummvmPixelFormat(const Graphics::PixelFormat *format) { Graphics::Surface *Screen::lockAndGetForEditing() { DEBUG_ENTER_FUNC(); - _frameBuffer.pixels = _buffer.getPixels(); - _frameBuffer.w = _buffer.getSourceWidth(); - _frameBuffer.h = _buffer.getSourceHeight(); - _frameBuffer.pitch = _buffer.getBytesPerPixel() * _buffer.getWidth(); - _frameBuffer.format = _pixelFormat; + _frameBuffer.init(_buffer.getSourceWidth(), _buffer.getSourceHeight(), _buffer.getBytesPerPixel() * _buffer.getWidth(), + _buffer.getPixels(), _pixelFormat); // We'll set to dirty once we unlock the screen return &_frameBuffer; -- cgit v1.2.3 From d9b90d67d3145147f90ed0dd9b53e7c3928f78ba Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:43:08 +0200 Subject: ANDROID: Do not access Surface::pixels directly. --- backends/platform/android/gfx.cpp | 4 ++-- backends/platform/android/texture.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index cd0fd88484..882dcff9a4 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -552,7 +552,7 @@ Graphics::Surface *OSystem_Android::lockScreen() { GLTHREADCHECK; Graphics::Surface *surface = _game_texture->surface(); - assert(surface->pixels); + assert(surface->getPixels()); return surface; } @@ -645,7 +645,7 @@ void OSystem_Android::grabOverlay(void *buf, int pitch) { assert(surface->format.bytesPerPixel == sizeof(uint16)); byte *dst = (byte *)buf; - const byte *src = (const byte *)surface->pixels; + const byte *src = (const byte *)surface->getPixels(); uint h = surface->h; do { diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index b174e93191..cc41c0d8a6 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -233,7 +233,7 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { _pixels = new byte[w * h * _surface.format.bytesPerPixel]; assert(_pixels); - _surface.pixels = _pixels; + _surface.setPixels(_pixels); fillBuffer(0); @@ -256,7 +256,7 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, } void GLESTexture::fillBuffer(uint32 color) { - assert(_surface.pixels); + assert(_surface.getPixels()); if (_pixelFormat.bytesPerPixel == 1 || ((color & 0xff) == ((color >> 8) & 0xff))) @@ -377,7 +377,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { assert(_pixels); // fixup surface, for the outside this is a CLUT8 surface - _surface.pixels = _pixels; + _surface.setPixels(_pixels); fillBuffer(0); @@ -386,8 +386,8 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { } void GLESFakePaletteTexture::fillBuffer(uint32 color) { - assert(_surface.pixels); - memset(_surface.pixels, color & 0xff, _surface.pitch * _surface.h); + assert(_surface.getPixels()); + memset(_surface.getPixels(), color & 0xff, _surface.pitch * _surface.h); setDirty(); } -- cgit v1.2.3 From 30d2eb7a97ac744e767fb6d48cc2419928312afe Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:44:20 +0200 Subject: DC: Do not access Surface::pixels directly. --- backends/platform/dc/display.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index cc5798fc10..54ee6000ed 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -711,11 +711,7 @@ Graphics::Surface *OSystem_Dreamcast::lockScreen() if (!screen) return 0; - _framebuffer.pixels = screen; - _framebuffer.w = _screen_w; - _framebuffer.h = _screen_h; - _framebuffer.pitch = SCREEN_W*2; - _framebuffer.format = screenFormats[_screenFormat]; + _framebuffer.init(_screen_w, _screen_h, SCREEN_W*2, screen, screenFormats[_screenFormat]); return &_framebuffer; } -- cgit v1.2.3 From c28f3baa7745453945e2ddd1f9fc474830b1e97b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:45:13 +0200 Subject: N64: Do not access Surface::pixels anymore. --- backends/platform/n64/osys_n64_base.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index afd93f5e09..36e5085764 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -605,11 +605,7 @@ void OSystem_N64::updateScreen() { } Graphics::Surface *OSystem_N64::lockScreen() { - _framebuffer.pixels = _offscreen_pal; - _framebuffer.w = _gameWidth; - _framebuffer.h = _gameHeight; - _framebuffer.pitch = _screenWidth; - _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); + _framebuffer.init(_gameWidth, _gameHeight, _screenWidth, _offscreen_pal, Graphics::PixelFormat::createFormatCLUT8()); return &_framebuffer; } -- cgit v1.2.3 From 911c74e82c7653da01bca6398149deb7013d7378 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:47:00 +0200 Subject: VKEYBD: Do not access Surface::pixels anymore. --- backends/vkeybd/virtual-keyboard-gui.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 75de86472f..8bf9a54251 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -36,7 +36,7 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor)) return; - const OverlayColor *src = (const OverlayColor *)surf_src->pixels; + const OverlayColor *src = (const OverlayColor *)surf_src->getPixels(); int blitW = surf_src->w; int blitH = surf_src->h; @@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() { _system->clearOverlay(); } _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); + _system->grabOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch); setupCursor(); @@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() { removeCursor(); - _system->copyRectToOverlay(_overlayBackup.pixels, _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h); + _system->copyRectToOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h); if (!g_gui.isActive()) _system->hideOverlay(); _overlayBackup.free(); @@ -262,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() { _screenH = newScreenH; _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch); + _system->grabOverlay(_overlayBackup.getPixels(), _overlayBackup.pitch); if (!_kbd->checkModeResolutions()) { _displaying = false; @@ -356,7 +356,7 @@ void VirtualKeyboardGUI::redraw() { Graphics::Surface surf; surf.create(w, h, _system->getOverlayFormat()); - OverlayColor *dst = (OverlayColor *)surf.pixels; + OverlayColor *dst = (OverlayColor *)surf.getPixels(); const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); while (h--) { @@ -371,7 +371,7 @@ void VirtualKeyboardGUI::redraw() { blit(&surf, &_dispSurface, _dispX - _dirtyRect.left, _dispY - _dirtyRect.top, _dispBackColor); } - _system->copyRectToOverlay(surf.pixels, surf.pitch, + _system->copyRectToOverlay(surf.getPixels(), surf.pitch, _dirtyRect.left, _dirtyRect.top, surf.w, surf.h); surf.free(); -- cgit v1.2.3 From 363a5a95cf9b6f69ba9b04615022431d3f79dbc6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:51:49 +0200 Subject: GRAPHICS: Make Surface::pixels protected. --- graphics/surface.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/surface.h b/graphics/surface.h index c64f2363e6..8e1e696121 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -61,11 +61,13 @@ struct Surface { */ uint16 pitch; +protected: /** * The surface's pixel data. */ void *pixels; +public: /** * The pixel format of the surface. */ -- cgit v1.2.3 From 043bd1b9f91719e2d80f17cbecb9b2e11ce49ba4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 5 Aug 2013 23:24:00 -0400 Subject: VIDEO: Clean up the AVI decoder --- video/avi_decoder.cpp | 153 +++++++++++++++++++++++++++----------------------- video/avi_decoder.h | 30 +++++----- 2 files changed, 99 insertions(+), 84 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index ff728a8437..92a60fcccf 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -67,6 +67,7 @@ namespace Video { #define ID_STRD MKTAG('s','t','r','d') //#define ID_INFO MKTAG('I','N','F','O') #define ID_ISFT MKTAG('I','S','F','T') +#define ID_DISP MKTAG('D','I','S','P') // Codec tags #define ID_RLE MKTAG('R','L','E',' ') @@ -78,18 +79,6 @@ namespace Video { #define ID_DUCK MKTAG('D','U','C','K') #define ID_MPG2 MKTAG('m','p','g','2') -static byte char2num(char c) { - c = tolower((byte)c); - return (c >= 'a' && c <= 'f') ? c - 'a' + 10 : c - '0'; -} - -static byte getStreamIndex(uint32 tag) { - return char2num((tag >> 24) & 0xFF) << 4 | char2num((tag >> 16) & 0xFF); -} - -static uint16 getStreamType(uint32 tag) { - return tag & 0xffff; -} AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) { initCommon(); @@ -107,29 +96,26 @@ AVIDecoder::~AVIDecoder() { void AVIDecoder::initCommon() { _decodedHeader = false; _foundMovieList = false; + _movieListStart = 0; _fileStream = 0; - memset(&_ixInfo, 0, sizeof(_ixInfo)); memset(&_header, 0, sizeof(_header)); } -void AVIDecoder::runHandle(uint32 tag) { - assert(_fileStream); +bool AVIDecoder::parseNextChunk() { + uint32 tag = _fileStream->readUint32BE(); + uint32 size = _fileStream->readUint32LE(); + if (_fileStream->eos()) - return; + return false; debug(3, "Decoding tag %s", tag2str(tag)); switch (tag) { - case ID_RIFF: - /*_filesize = */_fileStream->readUint32LE(); - if (_fileStream->readUint32BE() != ID_AVI) - error("RIFF file is not an AVI video"); - break; case ID_LIST: - handleList(); + handleList(size); break; case ID_AVIH: - _header.size = _fileStream->readUint32LE(); + _header.size = size; _header.microSecondsPerFrame = _fileStream->readUint32LE(); _header.maxBytesPerSecond = _fileStream->readUint32LE(); _header.padding = _fileStream->readUint32LE(); @@ -144,58 +130,64 @@ void AVIDecoder::runHandle(uint32 tag) { _fileStream->skip(16); break; case ID_STRH: - handleStreamHeader(); + handleStreamHeader(size); break; case ID_STRD: // Extra stream info, safe to ignore case ID_VEDT: // Unknown, safe to ignore case ID_JUNK: // Alignment bytes, should be ignored case ID_ISFT: // Metadata, safe to ignore - { - uint32 junkSize = _fileStream->readUint32LE(); - _fileStream->skip(junkSize + (junkSize & 1)); // Alignment - } break; + case ID_DISP: // Metadata, should be safe to ignore + skipChunk(size); + break; case ID_IDX1: - _ixInfo.size = _fileStream->readUint32LE(); - _ixInfo.indices = new OldIndex::Index[_ixInfo.size / 16]; - debug(0, "%d Indices", (_ixInfo.size / 16)); - for (uint32 i = 0; i < (_ixInfo.size / 16); i++) { - _ixInfo.indices[i].id = _fileStream->readUint32BE(); - _ixInfo.indices[i].flags = _fileStream->readUint32LE(); - _ixInfo.indices[i].offset = _fileStream->readUint32LE(); - _ixInfo.indices[i].size = _fileStream->readUint32LE(); - debug(0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(_ixInfo.indices[i].id), _ixInfo.indices[i].offset, _ixInfo.indices[i].size); + debug(0, "%d Indices", size / 16); + for (uint32 i = 0; i < size / 16; i++) { + OldIndex indexEntry; + indexEntry.id = _fileStream->readUint32BE(); + indexEntry.flags = _fileStream->readUint32LE(); + indexEntry.offset = _fileStream->readUint32LE(); + indexEntry.size = _fileStream->readUint32LE(); + _indexEntries.push_back(indexEntry); + debug(0, "Index %d == Tag \'%s\', Offset = %d, Size = %d", i, tag2str(indexEntry.id), indexEntry.offset, indexEntry.size); } break; default: error("Unknown tag \'%s\' found", tag2str(tag)); } + + return true; } -void AVIDecoder::handleList() { - uint32 listSize = _fileStream->readUint32LE() - 4; // Subtract away listType's 4 bytes +void AVIDecoder::skipChunk(uint32 size) { + // Make sure we're aligned on a word boundary + _fileStream->skip(size + (size & 1)); +} + +void AVIDecoder::handleList(uint32 listSize) { uint32 listType = _fileStream->readUint32BE(); + listSize -= 4; // Subtract away listType's 4 bytes uint32 curPos = _fileStream->pos(); debug(0, "Found LIST of type %s", tag2str(listType)); if (listType == ID_MOVI) { - // Found the 'movi' list - // We're done parsing everything + // If we found the movie block _foundMovieList = true; + _movieListStart = curPos; + _fileStream->skip(listSize); return; + } else if (listType == ID_HDRL) { + // Mark the header as decoded + _decodedHeader = true; } while ((_fileStream->pos() - curPos) < listSize) - runHandle(_fileStream->readUint32BE()); - - // We now have all the header data - if (listType == ID_HDRL) - _decodedHeader = true; + parseNextChunk(); } -void AVIDecoder::handleStreamHeader() { +void AVIDecoder::handleStreamHeader(uint32 size) { AVIStreamHeader sHeader; - sHeader.size = _fileStream->readUint32LE(); + sHeader.size = size; sHeader.streamType = _fileStream->readUint32BE(); if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) @@ -286,28 +278,41 @@ void AVIDecoder::handleStreamHeader() { bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); - _fileStream = stream; - _decodedHeader = false; - _foundMovieList = false; + uint32 riffTag = stream->readUint32BE(); + if (riffTag != ID_RIFF) { + warning("Failed to find RIFF header"); + return false; + } - // Read chunks until we have decoded the header - while (!_decodedHeader && _fileStream->pos() < _fileStream->size()) - runHandle(_fileStream->readUint32BE()); + /* uint32 fileSize = */ stream->readUint32LE(); + uint32 riffType = stream->readUint32BE(); - if (_fileStream->pos() >= _fileStream->size()) { - warning("Failed to find AVI header"); + if (riffType != ID_AVI) { + warning("RIFF not an AVI file"); return false; } - // Then read until we find the movie list - while (!_foundMovieList && _fileStream->pos() < _fileStream->size()) - runHandle(_fileStream->readUint32BE()); + _fileStream = stream; + + // Go through all chunks in the file + while (parseNextChunk()) + ; - if (_fileStream->pos() >= _fileStream->size()) { - warning("Failed to find AVI 'movi' LIST"); + if (!_decodedHeader) { + warning("Failed to parse AVI header"); + close(); return false; } + if (!_foundMovieList) { + warning("Failed to find 'MOVI' list"); + close(); + return false; + } + + // Seek back to the start of the MOVI list + _fileStream->seek(_movieListStart); + return true; } @@ -318,33 +323,35 @@ void AVIDecoder::close() { _fileStream = 0; _decodedHeader = false; _foundMovieList = false; + _movieListStart = 0; - delete[] _ixInfo.indices; - memset(&_ixInfo, 0, sizeof(_ixInfo)); + _indexEntries.clear(); memset(&_header, 0, sizeof(_header)); } void AVIDecoder::readNextPacket() { uint32 nextTag = _fileStream->readUint32BE(); + uint32 size = _fileStream->readUint32LE(); if (_fileStream->eos()) return; if (nextTag == ID_LIST) { // A list of audio/video chunks - uint32 listSize = _fileStream->readUint32LE() - 4; int32 startPos = _fileStream->pos(); if (_fileStream->readUint32BE() != ID_REC) error("Expected 'rec ' LIST"); + size -= 4; // subtract list type + // Decode chunks in the list - while (_fileStream->pos() < startPos + (int32)listSize) + while (_fileStream->pos() < startPos + (int32)size) readNextPacket(); return; } else if (nextTag == ID_JUNK || nextTag == ID_IDX1) { - runHandle(nextTag); + skipChunk(size); return; } @@ -353,12 +360,11 @@ void AVIDecoder::readNextPacket() { if (!track) error("Cannot get track from tag '%s'", tag2str(nextTag)); - uint32 chunkSize = _fileStream->readUint32LE(); Common::SeekableReadStream *chunk = 0; - if (chunkSize != 0) { - chunk = _fileStream->readStream(chunkSize); - _fileStream->skip(chunkSize & 1); + if (size != 0) { + chunk = _fileStream->readStream(size); + _fileStream->skip(size & 1); } if (track->getTrackType() == Track::kTrackTypeAudio) { @@ -403,6 +409,13 @@ void AVIDecoder::readNextPacket() { } } +byte AVIDecoder::getStreamIndex(uint32 tag) const { + char string[3]; + WRITE_BE_UINT16(string, tag >> 16); + string[2] = 0; + return strtol(string, 0, 16); +} + AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader) : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader) { memset(_palette, 0, sizeof(_palette)); diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 6082232464..5d52c7c797 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -20,10 +20,10 @@ * */ -#ifndef VIDEO_AVI_PLAYER_H -#define VIDEO_AVI_PLAYER_H +#ifndef VIDEO_AVI_DECODER_H +#define VIDEO_AVI_DECODER_H -#include "common/endian.h" +#include "common/array.h" #include "common/rational.h" #include "common/rect.h" #include "common/str.h" @@ -102,13 +102,10 @@ private: }; struct OldIndex { + uint32 id; + uint32 flags; + uint32 offset; uint32 size; - struct Index { - uint32 id; - uint32 flags; - uint32 offset; - uint32 size; - } *indices; }; // Index Flags @@ -218,19 +215,24 @@ private: Audio::QueuingAudioStream *createAudioStream(); }; - OldIndex _ixInfo; + Common::Array _indexEntries; AVIHeader _header; Common::SeekableReadStream *_fileStream; - bool _decodedHeader, _foundMovieList; + bool _decodedHeader; + bool _foundMovieList; + uint32 _movieListStart; Audio::Mixer::SoundType _soundType; Common::Rational _frameRateOverride; void initCommon(); - void runHandle(uint32 tag); - void handleList(); - void handleStreamHeader(); + bool parseNextChunk(); + void skipChunk(uint32 size); + void handleList(uint32 listSize); + void handleStreamHeader(uint32 size); + uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } + byte getStreamIndex(uint32 tag) const; }; } // End of namespace Video -- cgit v1.2.3 From d041177e2f8fe71853b974868e20d4919374bd3f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 Aug 2013 12:45:39 +0300 Subject: SCI: Add another version of Jones CD (bug #3614668) --- engines/sci/detection_tables.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index 66164a1937..7c4638a992 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -1054,6 +1054,23 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO4(GUIO_MIDIGM, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_FB01_MIDI, GAMEOPTION_JONES_CDAUDIO) }, + // Jones in the Fast Lane - English DOS US CD (alternate version) + // Supplied by collector9 in bug #3614668 + {"jones", "CD", { + {"resource.map", 0, "4344ff3f796707843b992adec2c87663", 4878}, + {"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652062}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformDOS, ADGF_CD, GUIO1(GAMEOPTION_JONES_CDAUDIO) }, + + // Jones in the Fast Lane - English DOS US CD (alternate version) + // Same entry as the DOS version above. This one is used for the alternate + // General MIDI music tracks in the Windows version + {"jones", "CD", { + {"resource.map", 0, "4344ff3f796707843b992adec2c87663", 4878}, + {"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652062}, + AD_LISTEND}, + Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO4(GUIO_MIDIGM, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_FB01_MIDI, GAMEOPTION_JONES_CDAUDIO) }, + // King's Quest 1 SCI Remake - English Amiga (from www.back2roots.org) // Executable scanning reports "1.003.007" // SCI interpreter version 0.001.010 -- cgit v1.2.3 From e5f0c42a65f38611272542a144228753e0496493 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 20:11:27 +0200 Subject: WINTERMUTE: Fix incorrect parameter order for getBasePtr. This is a regression from 19fa89b8f58df702c5cb16d03a9cb51c1acce7ab. Thanks to fuzzie for noticing. --- engines/wintermute/graphics/transparent_surface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 459669154a..53380a2d55 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -310,7 +310,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p } if (pPartRect) { - srcImage.pixels = getBasePtr(pPartRect->top, pPartRect->left); + srcImage.pixels = getBasePtr(pPartRect->left, pPartRect->top); srcImage.w = pPartRect->width(); srcImage.h = pPartRect->height(); -- cgit v1.2.3 From 6e9390feb8166d5f9d6c6fdfe00a336b4f71de4c Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 6 Aug 2013 22:26:15 -0400 Subject: VIDEO: Don't allow VideoDecoder::seek() to be overridden A new seekIntern() that performs the actual seeking is to be overriden instead. Having the caller override seek() and then call VideoDecoder::seek() kind of defeated the purpose of stopping/starting the audio. --- video/video_decoder.cpp | 14 +++++++++++--- video/video_decoder.h | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp index 5df811008c..a512a49fac 100644 --- a/video/video_decoder.cpp +++ b/video/video_decoder.cpp @@ -336,9 +336,9 @@ bool VideoDecoder::seek(const Audio::Timestamp &time) { if (isPlaying()) stopAudio(); - for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) - if (!(*it)->seek(time)) - return false; + // Do the actual seeking + if (!seekIntern(time)) + return false; _lastTimeChange = time; @@ -471,6 +471,14 @@ Audio::Timestamp VideoDecoder::getDuration() const { return maxDuration; } +bool VideoDecoder::seekIntern(const Audio::Timestamp &time) { + for (TrackList::iterator it = _tracks.begin(); it != _tracks.end(); it++) + if (!(*it)->seek(time)) + return false; + + return true; +} + VideoDecoder::Track::Track() { _paused = false; } diff --git a/video/video_decoder.h b/video/video_decoder.h index d0a6e08005..7811734dd5 100644 --- a/video/video_decoder.h +++ b/video/video_decoder.h @@ -168,14 +168,15 @@ public: /** * Seek to a given time in the video. * - * If the video is playing, it will continue to play. The default - * implementation will seek each track and must still be called - * from any other implementation. + * If the video is playing, it will continue to play. This calls + * seekIntern(), which can be overriden. By default, seekIntern() + * will call Track::seek() on all tracks with the time passed to + * this function. * * @param time The time to seek to * @return true on success, false otherwise */ - virtual bool seek(const Audio::Timestamp &time); + bool seek(const Audio::Timestamp &time); /** * Seek to a given frame. @@ -820,6 +821,15 @@ protected: */ TrackListIterator getTrackListEnd() { return _tracks.end(); } + /** + * The internal seek function that does the actual seeking. + * + * @see seek() + * + * @return true on success, false otherwise + */ + virtual bool seekIntern(const Audio::Timestamp &time); + private: // Tracks owned by this VideoDecoder TrackList _tracks; -- cgit v1.2.3 From 952a119ae16da8795785ca05a3f62ba7f5aee50b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 7 Aug 2013 21:41:24 +0200 Subject: IPHONE: Fix accidental double free. This was a copy&paste error. I also adapted the comment to be more clear. --- backends/platform/iphone/osys_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index ea566c3da0..a814495b80 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -77,8 +77,8 @@ OSystem_IPHONE::~OSystem_IPHONE() { delete _mixer; // Prevent accidental freeing of the screen texture here. This needs to be // checked since we might use the screen texture as framebuffer in the case - // of hi-color games for example. - if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels()) + // of hi-color games for example. Otherwise this can lead to a double free. + if (_framebuffer.getPixels() != _videoContext->screenTexture.getPixels()) _framebuffer.free(); _mouseBuffer.free(); } -- cgit v1.2.3 From fffb2ee3ffab2a4689b32651efa0b345923ddd69 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 7 Aug 2013 21:57:51 +0200 Subject: HOPKINS: Respect pitch when drawing on OSystem's screen surface. --- engines/hopkins/graphics.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 66ddbfaae6..de9f043763 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1202,15 +1202,13 @@ void GraphicsManager::displayZones() { void GraphicsManager::displayLines() { Graphics::Surface *screenSurface = g_system->lockScreen(); - uint16 *pixels = (uint16 *)screenSurface->getPixels(); - for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) { int i = 0; do { int x = _vm->_linesMan->_lineItem[lineIndex]._lineData[i] - _scrollPosX; int y = _vm->_linesMan->_lineItem[lineIndex]._lineData[i+1]; if (x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT) { - pixels[ y * screenSurface->w + x ] = 0xffff; + WRITE_UINT16(screenSurface->getBasePtr(x, y), 0xffff); } i += 2; } -- cgit v1.2.3 From 11eb168582a8a580bbed0e55e594bded201e39e4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 03:12:02 +0200 Subject: GUI: Use Domain::const_iterator in EventRecorder code when possible. --- gui/EventRecorder.cpp | 8 ++++---- gui/EventRecorder.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 4bf5832864..21152dd079 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -372,8 +372,8 @@ SdlMixerManager *EventRecorder::getMixerManager() { } } -void EventRecorder::getConfigFromDomain(Common::ConfigManager::Domain *domain) { - for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { +void EventRecorder::getConfigFromDomain(const Common::ConfigManager::Domain *domain) { + for (Common::ConfigManager::Domain::const_iterator entry = domain->begin(); entry!= domain->end(); ++entry) { _playbackFile->getHeader().settingsRecords[entry->_key] = entry->_value; } } @@ -386,7 +386,7 @@ void EventRecorder::getConfig() { void EventRecorder::applyPlaybackSettings() { - for (Common::StringMap::iterator i = _playbackFile->getHeader().settingsRecords.begin(); i != _playbackFile->getHeader().settingsRecords.end(); ++i) { + for (Common::StringMap::const_iterator i = _playbackFile->getHeader().settingsRecords.begin(); i != _playbackFile->getHeader().settingsRecords.end(); ++i) { Common::String currentValue = ConfMan.get(i->_key); if (currentValue != i->_value) { ConfMan.set(i->_key, i->_value, ConfMan.kTransientDomain); @@ -400,7 +400,7 @@ void EventRecorder::applyPlaybackSettings() { } void EventRecorder::removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain) { - for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { + for (Common::ConfigManager::Domain::const_iterator entry = domain->begin(); entry!= domain->end(); ++entry) { if (_playbackFile->getHeader().settingsRecords.find(entry->_key) == _playbackFile->getHeader().settingsRecords.end()) { debugC(1, kDebugLevelEventRec, "playback:action=\"Apply settings\" checksettings:key=%s storedvalue=%s currentvalue="" result=different", entry->_key.c_str(), entry->_value.c_str()); domain->erase(entry->_key); diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h index 68ffe16fbc..b2a549ece8 100644 --- a/gui/EventRecorder.h +++ b/gui/EventRecorder.h @@ -199,7 +199,7 @@ private: void setFileHeader(); void setGameMd5(const ADGameDescription *gameDesc); void getConfig(); - void getConfigFromDomain(Common::ConfigManager::Domain *domain); + void getConfigFromDomain(const Common::ConfigManager::Domain *domain); void removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain); void applyPlaybackSettings(); -- cgit v1.2.3 From 774d53045dd92ec36f6a6c13eb9771ea3eb5c491 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 03:14:23 +0200 Subject: COMMON: Do not let ConfigManager::Domain inherit from StringMap. Instead we provide wrapper functionality now. Intuitively a Domain is not a simple StringMap. --- common/config-manager.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/common/config-manager.h b/common/config-manager.h index d43a7bec51..d79f647fe3 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -47,12 +47,31 @@ class ConfigManager : public Singleton { public: - class Domain : public StringMap { + class Domain { private: + StringMap _entries; StringMap _keyValueComments; String _domainComment; public: + typedef StringMap::const_iterator const_iterator; + const_iterator begin() const { return _entries.begin(); } + const_iterator end() const { return _entries.end(); } + + bool empty() const { return _entries.empty(); } + + bool contains(const String &key) const { return _entries.contains(key); } + + String &operator[](const String &key) { return _entries[key]; } + const String &operator[](const String &key) const { return _entries[key]; } + + String &getVal(const String &key) { return _entries.getVal(key); } + const String &getVal(const String &key) const { return _entries.getVal(key); } + + void clear() { _entries.clear(); } + + void erase(const String &key) { _entries.erase(key); } + void setDomainComment(const String &comment); const String &getDomainComment() const; -- cgit v1.2.3 From b8850522b6a94a1375d110d58f34e1106b428e2e Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 8 Aug 2013 06:55:17 +0200 Subject: GRAPHICS: Fix incorrect parameter order for getBasePtr. This caused createThumbnail() to crash, e.g. when saving in the Kyrandia engine. Probably other engines as well. --- graphics/scaler/thumbnail_intern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index e6e4a1a298..c30fc3b6fd 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -247,7 +247,7 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, g = palette[pixels[y * w + x] * 3 + 1]; b = palette[pixels[y * w + x] * 3 + 2]; - *((uint16 *)screen.getBasePtr(y, x)) = Graphics::RGBToColor >(r, g, b); + *((uint16 *)screen.getBasePtr(x, y)) = Graphics::RGBToColor >(r, g, b); } } -- cgit v1.2.3 From 6e5c308b91031b8b7ae2dc5dd87bb4c2bc20ad81 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 8 Aug 2013 07:16:24 +0200 Subject: KYRA: Fix Kyra3 family album animation glitch, CID 1004139 The first page wasn't animated, and it's likely that some of the other right-page animations were slightly off as well. --- engines/kyra/gui_mr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index bcbfe27b69..ee0303c8c3 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -737,7 +737,7 @@ void KyraEngine_MR::loadAlbumPageWSA() { if (_album.curPage != 14) { filename = Common::String::format("PAGE%x.WSA", _album.curPage+1); _album.rightPage.wsa->open(filename.c_str(), 1, 0); - _album.rightPage.maxFrame = _album.leftPage.wsa->frames()-1; + _album.rightPage.maxFrame = _album.rightPage.wsa->frames()-1; } } -- cgit v1.2.3 From 0f59009e6e57ad58c4bc4f925c0c75361c304544 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 21 Jun 2012 01:26:50 +0200 Subject: GRAPHICS: Fix VectorRendererSpec for RGBA8888. Formerly values in the gradient and blending code overflowed and thus caused incorrect colors. Now there's some special case for 32bpp modes, which needs slightly more operations but assures a correct output. --- graphics/VectorRendererSpec.cpp | 71 +++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 4c5dd33cb5..1fee861539 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -317,9 +317,15 @@ setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2) { _gradientEnd = _format.RGBToColor(r2, g2, b2); _gradientStart = _format.RGBToColor(r1, g1, b1); - _gradientBytes[0] = (_gradientEnd & _redMask) - (_gradientStart & _redMask); - _gradientBytes[1] = (_gradientEnd & _greenMask) - (_gradientStart & _greenMask); - _gradientBytes[2] = (_gradientEnd & _blueMask) - (_gradientStart & _blueMask); + if (sizeof(PixelType) == 4) { + _gradientBytes[0] = ((_gradientEnd & _redMask) >> _format.rShift) - ((_gradientStart & _redMask) >> _format.rShift); + _gradientBytes[1] = ((_gradientEnd & _greenMask) >> _format.gShift) - ((_gradientStart & _greenMask) >> _format.gShift); + _gradientBytes[2] = ((_gradientEnd & _blueMask) >> _format.bShift) - ((_gradientStart & _blueMask) >> _format.bShift); + } else { + _gradientBytes[0] = (_gradientEnd & _redMask) - (_gradientStart & _redMask); + _gradientBytes[1] = (_gradientEnd & _greenMask) - (_gradientStart & _greenMask); + _gradientBytes[2] = (_gradientEnd & _blueMask) - (_gradientStart & _blueMask); + } } template @@ -328,9 +334,15 @@ calcGradient(uint32 pos, uint32 max) { PixelType output = 0; pos = (MIN(pos * Base::_gradientFactor, max) << 12) / max; - output |= ((_gradientStart & _redMask) + ((_gradientBytes[0] * pos) >> 12)) & _redMask; - output |= ((_gradientStart & _greenMask) + ((_gradientBytes[1] * pos) >> 12)) & _greenMask; - output |= ((_gradientStart & _blueMask) + ((_gradientBytes[2] * pos) >> 12)) & _blueMask; + if (sizeof(PixelType) == 4) { + output |= ((_gradientStart & _redMask) + (((_gradientBytes[0] * pos) >> 12) << _format.rShift)) & _redMask; + output |= ((_gradientStart & _greenMask) + (((_gradientBytes[1] * pos) >> 12) << _format.gShift)) & _greenMask; + output |= ((_gradientStart & _blueMask) + (((_gradientBytes[2] * pos) >> 12) << _format.bShift)) & _blueMask; + } else { + output |= ((_gradientStart & _redMask) + ((_gradientBytes[0] * pos) >> 12)) & _redMask; + output |= ((_gradientStart & _greenMask) + ((_gradientBytes[1] * pos) >> 12)) & _greenMask; + output |= ((_gradientStart & _blueMask) + ((_gradientBytes[2] * pos) >> 12)) & _blueMask; + } output |= _alphaMask; return output; @@ -537,20 +549,39 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { template inline void VectorRendererSpec:: blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { - int idst = *ptr; - int isrc = color; - - *ptr = (PixelType)( - (_redMask & ((idst & _redMask) + - ((int)(((int)(isrc & _redMask) - - (int)(idst & _redMask)) * alpha) >> 8))) | - (_greenMask & ((idst & _greenMask) + - ((int)(((int)(isrc & _greenMask) - - (int)(idst & _greenMask)) * alpha) >> 8))) | - (_blueMask & ((idst & _blueMask) + - ((int)(((int)(isrc & _blueMask) - - (int)(idst & _blueMask)) * alpha) >> 8))) | - (idst & _alphaMask)); + if (sizeof(PixelType) == 4) { + const byte sR = (color & _redMask) >> _format.rShift; + const byte sG = (color & _greenMask) >> _format.gShift; + const byte sB = (color & _blueMask) >> _format.bShift; + + byte dR = (*ptr & _redMask) >> _format.rShift; + byte dG = (*ptr & _greenMask) >> _format.gShift; + byte dB = (*ptr & _blueMask) >> _format.bShift; + + dR += ((sR - dR) * alpha) >> 8; + dG += ((sG - dG) * alpha) >> 8; + dB += ((sB - dB) * alpha) >> 8; + + *ptr = ((dR << _format.rShift) & _redMask) + | ((dG << _format.gShift) & _greenMask) + | ((dB << _format.bShift) & _blueMask) + | (*ptr & _alphaMask); + } else { + int idst = *ptr; + int isrc = color; + + *ptr = (PixelType)( + (_redMask & ((idst & _redMask) + + ((int)(((int)(isrc & _redMask) - + (int)(idst & _redMask)) * alpha) >> 8))) | + (_greenMask & ((idst & _greenMask) + + ((int)(((int)(isrc & _greenMask) - + (int)(idst & _greenMask)) * alpha) >> 8))) | + (_blueMask & ((idst & _blueMask) + + ((int)(((int)(isrc & _blueMask) - + (int)(idst & _blueMask)) * alpha) >> 8))) | + (idst & _alphaMask)); + } } template -- cgit v1.2.3 From 1d40dca7a0446aad81380c7c207461b18b79428d Mon Sep 17 00:00:00 2001 From: Narek Mailian Date: Thu, 1 Aug 2013 17:30:11 +0200 Subject: GRAPHICS: Add error-checking in blendPixelPtr for invalid BPPs --- graphics/VectorRendererSpec.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 1fee861539..e594be98df 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -566,7 +566,7 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { | ((dG << _format.gShift) & _greenMask) | ((dB << _format.bShift) & _blueMask) | (*ptr & _alphaMask); - } else { + } else if (sizeof(PixelType) == 2) { int idst = *ptr; int isrc = color; @@ -581,6 +581,8 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { ((int)(((int)(isrc & _blueMask) - (int)(idst & _blueMask)) * alpha) >> 8))) | (idst & _alphaMask)); + } else { + error("Unsupported BPP format: %d", sizeof(PixelType)); } } -- cgit v1.2.3 From ece8b7fb65402238ab7df896361a9cefe28b8897 Mon Sep 17 00:00:00 2001 From: Narek Mailian Date: Sun, 7 Jul 2013 18:58:25 +0200 Subject: GRAPHICS: Fix fonts/bdf.cpp to allow for 32bpp to be used --- graphics/fonts/bdf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp index 6d4befa37c..e523a36ad5 100644 --- a/graphics/fonts/bdf.cpp +++ b/graphics/fonts/bdf.cpp @@ -102,7 +102,7 @@ void BdfFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const // equal to 50 and the decision of the theme designer? // asserting _data.maxAdvance <= 50: let the theme designer decide what looks best assert(_data.maxAdvance <= 50); - assert(dst->format.bytesPerPixel == 1 || dst->format.bytesPerPixel == 2); + assert(dst->format.bytesPerPixel == 1 || dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); const int idx = mapToIndex(chr); if (idx < 0) @@ -165,6 +165,8 @@ void BdfFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const drawCharIntern(ptr, dst->pitch, src, height, originalWidth, xStart, xEnd, color); else if (dst->format.bytesPerPixel == 2) drawCharIntern(ptr, dst->pitch, src, height, originalWidth, xStart, xEnd, color); + else if (dst->format.bytesPerPixel == 4) + drawCharIntern(ptr, dst->pitch, src, height, originalWidth, xStart, xEnd, color); } namespace { -- cgit v1.2.3 From 969a33a32dc331ec8d89da056e584a68974dfeec Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 20 Jun 2012 18:39:03 +0200 Subject: GUI: Allow GUI cursor creation to work with abitrary 2/4Bpp formats. --- gui/ThemeEngine.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 0f8b449b58..2ba45a4bc3 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1320,22 +1320,31 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int memset(_cursor, 0xFF, sizeof(byte) * _cursorWidth * _cursorHeight); // the transparent color is 0xFF00FF - const int colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF); + const uint32 colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF); // Now, scan the bitmap. We have to convert it from 16 bit color mode // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; Common::HashMap colorToIndex; - const OverlayColor *src = (const OverlayColor *)cursor->getPixels(); + const byte *src = (const byte *)cursor->getPixels(); for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { + uint32 color = colTransparent; byte r, g, b; + if (cursor->format.bytesPerPixel == 2) { + color = READ_UINT16(src); + } else if (cursor->format.bytesPerPixel == 4) { + color = READ_UINT32(src); + } + + src += cursor->format.bytesPerPixel; + // Skip transparency - if (src[x] == colTransparent) + if (color == colTransparent) continue; - _overlayFormat.colorToRGB(src[x], r, g, b); + cursor->format.colorToRGB(color, r, g, b); const int col = (r << 16) | (g << 8) | b; // If there is no entry yet for this color in the palette: Add one @@ -1357,7 +1366,6 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int const int index = colorToIndex[col]; _cursor[y * _cursorWidth + x] = index; } - src += _cursorWidth; } _useCursor = true; -- cgit v1.2.3 From f545a2f08fc8989fa22726ce0b74e03ece099300 Mon Sep 17 00:00:00 2001 From: Narek Mailian Date: Thu, 1 Aug 2013 01:38:22 +0200 Subject: GUI: Change name of GUI-renderers to remove "16-bit" --- graphics/VectorRendererSpec.cpp | 6 +++--- gui/ThemeEngine.cpp | 12 ++++++------ gui/ThemeEngine.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index e594be98df..c60d9ca231 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -277,15 +277,15 @@ void colorFill(PixelType *first, PixelType *last, PixelType color) { VectorRenderer *createRenderer(int mode) { #ifdef DISABLE_FANCY_THEMES - assert(mode == GUI::ThemeEngine::kGfxStandard16bit); + assert(mode == GUI::ThemeEngine::kGfxStandard); #endif PixelFormat format = g_system->getOverlayFormat(); switch (mode) { - case GUI::ThemeEngine::kGfxStandard16bit: + case GUI::ThemeEngine::kGfxStandard: return new VectorRendererSpec(format); #ifndef DISABLE_FANCY_THEMES - case GUI::ThemeEngine::kGfxAntialias16bit: + case GUI::ThemeEngine::kGfxAntialias: return new VectorRendererAA(format); #endif default: diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 2ba45a4bc3..b7199fbf68 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -343,9 +343,9 @@ ThemeEngine::~ThemeEngine() { *********************************************************/ const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = { { _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled }, - { _s("Standard Renderer (16bpp)"), _s("Standard (16bpp)"), "normal_16bpp", kGfxStandard16bit }, + { _s("Standard Renderer"), _s("Standard"), "normal", kGfxStandard }, #ifndef DISABLE_FANCY_THEMES - { _s("Antialiased Renderer (16bpp)"), _s("Antialiased (16bpp)"), "aa_16bpp", kGfxAntialias16bit } + { _s("Antialiased Renderer"), _s("Antialiased"), "antialias", kGfxAntialias } #endif }; @@ -353,9 +353,9 @@ const uint ThemeEngine::_rendererModesSize = ARRAYSIZE(ThemeEngine::_rendererMod const ThemeEngine::GraphicsMode ThemeEngine::_defaultRendererMode = #ifndef DISABLE_FANCY_THEMES - ThemeEngine::kGfxAntialias16bit; + ThemeEngine::kGfxAntialias; #else - ThemeEngine::kGfxStandard16bit; + ThemeEngine::kGfxStandard; #endif ThemeEngine::GraphicsMode ThemeEngine::findMode(const Common::String &cfg) { @@ -494,9 +494,9 @@ void ThemeEngine::disable() { void ThemeEngine::setGraphicsMode(GraphicsMode mode) { switch (mode) { - case kGfxStandard16bit: + case kGfxStandard: #ifndef DISABLE_FANCY_THEMES - case kGfxAntialias16bit: + case kGfxAntialias: #endif _bytesPerPixel = sizeof(uint16); break; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 160ceb3259..c0e47a19e6 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -250,8 +250,8 @@ public: */ enum GraphicsMode { kGfxDisabled = 0, ///< No GFX - kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer. - kGfxAntialias16bit ///< 2BPP with the optimized AA renderer. + kGfxStandard, ///< Standard (aliased) renderer. + kGfxAntialias ///< Optimized AA renderer. }; /** Constant value to expand dirty rectangles, to make sure they are fully copied */ -- cgit v1.2.3 From 1f1d35bd3d31fe3430b9b5227b6127cfd52e52a2 Mon Sep 17 00:00:00 2001 From: Narek Mailian Date: Mon, 5 Aug 2013 17:59:36 +0200 Subject: GRAPHICS: Allow VectorRenderer and ThemeEngine to init with 4BPP --- graphics/VectorRendererSpec.cpp | 10 ++++++++-- gui/ThemeEngine.cpp | 10 +++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index c60d9ca231..1e01744fad 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -283,10 +283,16 @@ VectorRenderer *createRenderer(int mode) { PixelFormat format = g_system->getOverlayFormat(); switch (mode) { case GUI::ThemeEngine::kGfxStandard: - return new VectorRendererSpec(format); + if (g_system->getOverlayFormat().bytesPerPixel == 4) + return new VectorRendererSpec(format); + else if (g_system->getOverlayFormat().bytesPerPixel == 2) + return new VectorRendererSpec(format); #ifndef DISABLE_FANCY_THEMES case GUI::ThemeEngine::kGfxAntialias: - return new VectorRendererAA(format); + if (g_system->getOverlayFormat().bytesPerPixel == 4) + return new VectorRendererAA(format); + else if (g_system->getOverlayFormat().bytesPerPixel == 2) + return new VectorRendererAA(format); #endif default: break; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index b7199fbf68..561c0244a2 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -498,9 +498,13 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) { #ifndef DISABLE_FANCY_THEMES case kGfxAntialias: #endif - _bytesPerPixel = sizeof(uint16); - break; - + if (g_system->getOverlayFormat().bytesPerPixel == 4) { + _bytesPerPixel = sizeof(uint32); + break; + } else if (g_system->getOverlayFormat().bytesPerPixel == 2) { + _bytesPerPixel = sizeof(uint16); + break; + } default: error("Invalid graphics mode"); } -- cgit v1.2.3 From 63750d678068aa92ee95dc9de2b2908a983b489d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 16:22:08 +0200 Subject: COMMON: Rename ConfigFile to INIFile. This clears up that 'ConfigFile' is actually a class handling only INI-files. --- common/config-file.cpp | 392 ------------------------------------- common/config-file.h | 140 ------------- common/config-manager.h | 2 +- common/ini-file.cpp | 392 +++++++++++++++++++++++++++++++++++++ common/ini-file.h | 140 +++++++++++++ common/module.mk | 2 +- engines/composer/composer.h | 4 +- engines/gob/iniconfig.cpp | 4 +- engines/gob/iniconfig.h | 4 +- engines/mohawk/livingbooks.cpp | 4 +- engines/mohawk/livingbooks.h | 4 +- engines/mohawk/livingbooks_lbx.cpp | 10 +- engines/scumm/he/script_v80he.cpp | 6 +- engines/testbed/config.cpp | 8 +- engines/testbed/config.h | 4 +- 15 files changed, 558 insertions(+), 558 deletions(-) delete mode 100644 common/config-file.cpp delete mode 100644 common/config-file.h create mode 100644 common/ini-file.cpp create mode 100644 common/ini-file.h diff --git a/common/config-file.cpp b/common/config-file.cpp deleted file mode 100644 index 0ce6dcf0c8..0000000000 --- a/common/config-file.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "common/config-file.h" -#include "common/file.h" -#include "common/savefile.h" -#include "common/system.h" -#include "common/textconsole.h" - -namespace Common { - -bool ConfigFile::isValidName(const String &name) { - const char *p = name.c_str(); - while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.')) - p++; - return *p == 0; -} - -ConfigFile::ConfigFile() { -} - -ConfigFile::~ConfigFile() { -} - -void ConfigFile::clear() { - _sections.clear(); -} - -bool ConfigFile::loadFromFile(const String &filename) { - File file; - if (file.open(filename)) - return loadFromStream(file); - else - return false; -} - -bool ConfigFile::loadFromSaveFile(const char *filename) { - assert(g_system); - SaveFileManager *saveFileMan = g_system->getSavefileManager(); - SeekableReadStream *loadFile; - - assert(saveFileMan); - if (!(loadFile = saveFileMan->openForLoading(filename))) - return false; - - bool status = loadFromStream(*loadFile); - delete loadFile; - return status; -} - -bool ConfigFile::loadFromStream(SeekableReadStream &stream) { - Section section; - KeyValue kv; - String comment; - int lineno = 0; - - // TODO: Detect if a section occurs multiple times (or likewise, if - // a key occurs multiple times inside one section). - - while (!stream.eos() && !stream.err()) { - lineno++; - - // Read a line - String line = stream.readLine(); - - if (line.size() == 0) { - // Do nothing - } else if (line[0] == '#' || line[0] == ';' || line.hasPrefix("//")) { - // Accumulate comments here. Once we encounter either the start - // of a new section, or a key-value-pair, we associate the value - // of the 'comment' variable with that entity. The semicolon and - // C++-style comments are used for Living Books games in Mohawk. - comment += line; - comment += "\n"; - } else if (line[0] == '(') { - // HACK: The following is a hack added by Kirben to support the - // "map.ini" used in the HE SCUMM game "SPY Fox in Hold the Mustard". - // - // It would be nice if this hack could be restricted to that game, - // but the current design of this class doesn't allow to do that - // in a nice fashion (a "isMustard" parameter is *not* a nice - // solution). - comment += line; - comment += "\n"; - } else if (line[0] == '[') { - // It's a new section which begins here. - const char *p = line.c_str() + 1; - // Get the section name, and check whether it's valid (that - // is, verify that it only consists of alphanumerics, - // periods, dashes and underscores). Mohawk Living Books games - // can have periods in their section names. - while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.')) - p++; - - if (*p == '\0') - error("ConfigFile::loadFromStream: missing ] in line %d", lineno); - else if (*p != ']') - error("ConfigFile::loadFromStream: Invalid character '%c' occurred in section name in line %d", *p, lineno); - - // Previous section is finished now, store it. - if (!section.name.empty()) - _sections.push_back(section); - - section.name = String(line.c_str() + 1, p); - section.keys.clear(); - section.comment = comment; - comment.clear(); - - assert(isValidName(section.name)); - } else { - // This line should be a line with a 'key=value' pair, or an empty one. - - // Skip leading whitespaces - const char *t = line.c_str(); - while (isSpace(*t)) - t++; - - // Skip empty lines / lines with only whitespace - if (*t == 0) - continue; - - // If no section has been set, this config file is invalid! - if (section.name.empty()) { - error("ConfigFile::loadFromStream: Key/value pair found outside a section in line %d", lineno); - } - - // Split string at '=' into 'key' and 'value'. First, find the "=" delimeter. - const char *p = strchr(t, '='); - if (!p) - error("Config file buggy: Junk found in line line %d: '%s'", lineno, t); - - // Extract the key/value pair - kv.key = String(t, p); - kv.value = String(p + 1); - - // Trim of spaces - kv.key.trim(); - kv.value.trim(); - - // Store comment - kv.comment = comment; - comment.clear(); - - assert(isValidName(kv.key)); - - section.keys.push_back(kv); - } - } - - // Save last section - if (!section.name.empty()) - _sections.push_back(section); - - return (!stream.err() || stream.eos()); -} - -bool ConfigFile::saveToFile(const String &filename) { - DumpFile file; - if (file.open(filename)) - return saveToStream(file); - else - return false; -} - -bool ConfigFile::saveToSaveFile(const char *filename) { - assert(g_system); - SaveFileManager *saveFileMan = g_system->getSavefileManager(); - WriteStream *saveFile; - - assert(saveFileMan); - if (!(saveFile = saveFileMan->openForSaving(filename))) - return false; - - bool status = saveToStream(*saveFile); - delete saveFile; - return status; -} - -bool ConfigFile::saveToStream(WriteStream &stream) { - for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { - // Write out the section comment, if any - if (! i->comment.empty()) { - stream.writeString(i->comment); - } - - // Write out the section name - stream.writeByte('['); - stream.writeString(i->name); - stream.writeByte(']'); - stream.writeByte('\n'); - - // Write out the key/value pairs - for (List::iterator kv = i->keys.begin(); kv != i->keys.end(); ++kv) { - // Write out the comment, if any - if (! kv->comment.empty()) { - stream.writeString(kv->comment); - } - // Write out the key/value pair - stream.writeString(kv->key); - stream.writeByte('='); - stream.writeString(kv->value); - stream.writeByte('\n'); - } - } - - stream.flush(); - return !stream.err(); -} - -void ConfigFile::addSection(const String §ion) { - Section *s = getSection(section); - if (s) - return; - - Section newSection; - newSection.name = section; - _sections.push_back(newSection); -} - -void ConfigFile::removeSection(const String §ion) { - assert(isValidName(section)); - for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { - if (section.equalsIgnoreCase(i->name)) { - _sections.erase(i); - return; - } - } -} - -bool ConfigFile::hasSection(const String §ion) const { - assert(isValidName(section)); - const Section *s = getSection(section); - return s != 0; -} - -void ConfigFile::renameSection(const String &oldName, const String &newName) { - assert(isValidName(oldName)); - assert(isValidName(newName)); - - Section *os = getSection(oldName); - const Section *ns = getSection(newName); - if (os) { - // HACK: For now we just print a warning, for more info see the TODO - // below. - if (ns) - warning("ConfigFile::renameSection: Section name \"%s\" already used", newName.c_str()); - else - os->name = newName; - } - // TODO: Check here whether there already is a section with the - // new name. Not sure how to cope with that case, we could: - // - simply remove the existing "newName" section - // - error out - // - merge the two sections "oldName" and "newName" -} - - -bool ConfigFile::hasKey(const String &key, const String §ion) const { - assert(isValidName(key)); - assert(isValidName(section)); - - const Section *s = getSection(section); - if (!s) - return false; - return s->hasKey(key); -} - -void ConfigFile::removeKey(const String &key, const String §ion) { - assert(isValidName(key)); - assert(isValidName(section)); - - Section *s = getSection(section); - if (s) - s->removeKey(key); -} - -bool ConfigFile::getKey(const String &key, const String §ion, String &value) const { - assert(isValidName(key)); - assert(isValidName(section)); - - const Section *s = getSection(section); - if (!s) - return false; - const KeyValue *kv = s->getKey(key); - if (!kv) - return false; - value = kv->value; - return true; -} - -void ConfigFile::setKey(const String &key, const String §ion, const String &value) { - assert(isValidName(key)); - assert(isValidName(section)); - // TODO: Verify that value is valid, too. In particular, it shouldn't - // contain CR or LF... - - Section *s = getSection(section); - if (!s) { - KeyValue newKV; - newKV.key = key; - newKV.value = value; - - Section newSection; - newSection.name = section; - newSection.keys.push_back(newKV); - - _sections.push_back(newSection); - } else { - s->setKey(key, value); - } -} - -const ConfigFile::SectionKeyList ConfigFile::getKeys(const String §ion) const { - const Section *s = getSection(section); - - return s->getKeys(); -} - -ConfigFile::Section *ConfigFile::getSection(const String §ion) { - for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { - if (section.equalsIgnoreCase(i->name)) { - return &(*i); - } - } - return 0; -} - -const ConfigFile::Section *ConfigFile::getSection(const String §ion) const { - for (List
::const_iterator i = _sections.begin(); i != _sections.end(); ++i) { - if (section.equalsIgnoreCase(i->name)) { - return &(*i); - } - } - return 0; -} - -bool ConfigFile::Section::hasKey(const String &key) const { - return getKey(key) != 0; -} - -const ConfigFile::KeyValue* ConfigFile::Section::getKey(const String &key) const { - for (List::const_iterator i = keys.begin(); i != keys.end(); ++i) { - if (key.equalsIgnoreCase(i->key)) { - return &(*i); - } - } - return 0; -} - -void ConfigFile::Section::setKey(const String &key, const String &value) { - for (List::iterator i = keys.begin(); i != keys.end(); ++i) { - if (key.equalsIgnoreCase(i->key)) { - i->value = value; - return; - } - } - - KeyValue newKV; - newKV.key = key; - newKV.value = value; - keys.push_back(newKV); -} - -void ConfigFile::Section::removeKey(const String &key) { - for (List::iterator i = keys.begin(); i != keys.end(); ++i) { - if (key.equalsIgnoreCase(i->key)) { - keys.erase(i); - return; - } - } -} - -} // End of namespace Common diff --git a/common/config-file.h b/common/config-file.h deleted file mode 100644 index 8bba851110..0000000000 --- a/common/config-file.h +++ /dev/null @@ -1,140 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef COMMON_CONFIG_FILE_H -#define COMMON_CONFIG_FILE_H - -#include "common/hash-str.h" -#include "common/list.h" -#include "common/str.h" - -namespace Common { - -class SeekableReadStream; -class WriteStream; - -/** - * This class allows reading/writing INI style config files. - * It is used by the ConfigManager for storage, but can also - * be used by other code if it needs to read/write custom INI - * files. - * - * Lines starting with a '#' are ignored (i.e. treated as comments). - * Some effort is made to preserve comments, though. - * - * This class makes no attempts to provide fast access to key/value pairs. - * In particular, it stores all sections and k/v pairs in lists, not - * in dictionaries/maps. This makes it very easy to read/write the data - * from/to files, but of course is not appropriate for fast access. - * The main reason is that this class is indeed geared toward doing precisely - * that! - * If you need fast access to the game config, use higher level APIs, like the - * one provided by ConfigManager. - */ -class ConfigFile { -public: - struct KeyValue { - String key; - String value; - String comment; - }; - - typedef List SectionKeyList; - - /** A section in a config file. I.e. corresponds to something like this: - * [mySection] - * key=value - * - * Comments are also stored, to keep users happy who like editing their - * config files manually. - */ - struct Section { - String name; - List keys; - String comment; - - bool hasKey(const String &key) const; - const KeyValue* getKey(const String &key) const; - void setKey(const String &key, const String &value); - void removeKey(const String &key); - const SectionKeyList getKeys() const { return keys; } - }; - - typedef List
SectionList; - -public: - ConfigFile(); - ~ConfigFile(); - - // TODO: Maybe add a copy constructor etc.? - - /** - * Check whether the given string is a valid section or key name. - * For that, it must only consist of letters, numbers, dashes and - * underscores. In particular, white space and "#", "=", "[", "]" - * are not valid! - */ - static bool isValidName(const String &name); - - /** Reset everything stored in this config file. */ - void clear(); - - bool loadFromFile(const String &filename); - bool loadFromSaveFile(const char *filename); - bool loadFromStream(SeekableReadStream &stream); - bool saveToFile(const String &filename); - bool saveToSaveFile(const char *filename); - bool saveToStream(WriteStream &stream); - - bool hasSection(const String §ion) const; - void addSection(const String §ion); - void removeSection(const String §ion); - void renameSection(const String &oldName, const String &newName); - - bool hasKey(const String &key, const String §ion) const; - bool getKey(const String &key, const String §ion, String &value) const; - void setKey(const String &key, const String §ion, const String &value); - void removeKey(const String &key, const String §ion); - - const SectionList getSections() const { return _sections; } - const SectionKeyList getKeys(const String §ion) const; - - void listKeyValues(StringMap &kv); - -private: - SectionList _sections; - - Section *getSection(const String §ion); - const Section *getSection(const String §ion) const; -}; - -/* -- ConfigMan owns a config file -- allow direct access to that config file (for the launcher) -- simplify and unify the regular ConfigMan API in exchange - - -*/ - -} // End of namespace Common - -#endif diff --git a/common/config-manager.h b/common/config-manager.h index d43a7bec51..45a1f2d103 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -24,7 +24,7 @@ #define COMMON_CONFIG_MANAGER_H #include "common/array.h" -//#include "common/config-file.h" +//#include "common/ini-file.h" #include "common/hashmap.h" #include "common/singleton.h" #include "common/str.h" diff --git a/common/ini-file.cpp b/common/ini-file.cpp new file mode 100644 index 0000000000..be5247dcfb --- /dev/null +++ b/common/ini-file.cpp @@ -0,0 +1,392 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/ini-file.h" +#include "common/file.h" +#include "common/savefile.h" +#include "common/system.h" +#include "common/textconsole.h" + +namespace Common { + +bool INIFile::isValidName(const String &name) { + const char *p = name.c_str(); + while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.')) + p++; + return *p == 0; +} + +INIFile::INIFile() { +} + +INIFile::~INIFile() { +} + +void INIFile::clear() { + _sections.clear(); +} + +bool INIFile::loadFromFile(const String &filename) { + File file; + if (file.open(filename)) + return loadFromStream(file); + else + return false; +} + +bool INIFile::loadFromSaveFile(const char *filename) { + assert(g_system); + SaveFileManager *saveFileMan = g_system->getSavefileManager(); + SeekableReadStream *loadFile; + + assert(saveFileMan); + if (!(loadFile = saveFileMan->openForLoading(filename))) + return false; + + bool status = loadFromStream(*loadFile); + delete loadFile; + return status; +} + +bool INIFile::loadFromStream(SeekableReadStream &stream) { + Section section; + KeyValue kv; + String comment; + int lineno = 0; + + // TODO: Detect if a section occurs multiple times (or likewise, if + // a key occurs multiple times inside one section). + + while (!stream.eos() && !stream.err()) { + lineno++; + + // Read a line + String line = stream.readLine(); + + if (line.size() == 0) { + // Do nothing + } else if (line[0] == '#' || line[0] == ';' || line.hasPrefix("//")) { + // Accumulate comments here. Once we encounter either the start + // of a new section, or a key-value-pair, we associate the value + // of the 'comment' variable with that entity. The semicolon and + // C++-style comments are used for Living Books games in Mohawk. + comment += line; + comment += "\n"; + } else if (line[0] == '(') { + // HACK: The following is a hack added by Kirben to support the + // "map.ini" used in the HE SCUMM game "SPY Fox in Hold the Mustard". + // + // It would be nice if this hack could be restricted to that game, + // but the current design of this class doesn't allow to do that + // in a nice fashion (a "isMustard" parameter is *not* a nice + // solution). + comment += line; + comment += "\n"; + } else if (line[0] == '[') { + // It's a new section which begins here. + const char *p = line.c_str() + 1; + // Get the section name, and check whether it's valid (that + // is, verify that it only consists of alphanumerics, + // periods, dashes and underscores). Mohawk Living Books games + // can have periods in their section names. + while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.')) + p++; + + if (*p == '\0') + error("INIFile::loadFromStream: missing ] in line %d", lineno); + else if (*p != ']') + error("INIFile::loadFromStream: Invalid character '%c' occurred in section name in line %d", *p, lineno); + + // Previous section is finished now, store it. + if (!section.name.empty()) + _sections.push_back(section); + + section.name = String(line.c_str() + 1, p); + section.keys.clear(); + section.comment = comment; + comment.clear(); + + assert(isValidName(section.name)); + } else { + // This line should be a line with a 'key=value' pair, or an empty one. + + // Skip leading whitespaces + const char *t = line.c_str(); + while (isSpace(*t)) + t++; + + // Skip empty lines / lines with only whitespace + if (*t == 0) + continue; + + // If no section has been set, this config file is invalid! + if (section.name.empty()) { + error("INIFile::loadFromStream: Key/value pair found outside a section in line %d", lineno); + } + + // Split string at '=' into 'key' and 'value'. First, find the "=" delimeter. + const char *p = strchr(t, '='); + if (!p) + error("Config file buggy: Junk found in line line %d: '%s'", lineno, t); + + // Extract the key/value pair + kv.key = String(t, p); + kv.value = String(p + 1); + + // Trim of spaces + kv.key.trim(); + kv.value.trim(); + + // Store comment + kv.comment = comment; + comment.clear(); + + assert(isValidName(kv.key)); + + section.keys.push_back(kv); + } + } + + // Save last section + if (!section.name.empty()) + _sections.push_back(section); + + return (!stream.err() || stream.eos()); +} + +bool INIFile::saveToFile(const String &filename) { + DumpFile file; + if (file.open(filename)) + return saveToStream(file); + else + return false; +} + +bool INIFile::saveToSaveFile(const char *filename) { + assert(g_system); + SaveFileManager *saveFileMan = g_system->getSavefileManager(); + WriteStream *saveFile; + + assert(saveFileMan); + if (!(saveFile = saveFileMan->openForSaving(filename))) + return false; + + bool status = saveToStream(*saveFile); + delete saveFile; + return status; +} + +bool INIFile::saveToStream(WriteStream &stream) { + for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { + // Write out the section comment, if any + if (! i->comment.empty()) { + stream.writeString(i->comment); + } + + // Write out the section name + stream.writeByte('['); + stream.writeString(i->name); + stream.writeByte(']'); + stream.writeByte('\n'); + + // Write out the key/value pairs + for (List::iterator kv = i->keys.begin(); kv != i->keys.end(); ++kv) { + // Write out the comment, if any + if (! kv->comment.empty()) { + stream.writeString(kv->comment); + } + // Write out the key/value pair + stream.writeString(kv->key); + stream.writeByte('='); + stream.writeString(kv->value); + stream.writeByte('\n'); + } + } + + stream.flush(); + return !stream.err(); +} + +void INIFile::addSection(const String §ion) { + Section *s = getSection(section); + if (s) + return; + + Section newSection; + newSection.name = section; + _sections.push_back(newSection); +} + +void INIFile::removeSection(const String §ion) { + assert(isValidName(section)); + for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { + if (section.equalsIgnoreCase(i->name)) { + _sections.erase(i); + return; + } + } +} + +bool INIFile::hasSection(const String §ion) const { + assert(isValidName(section)); + const Section *s = getSection(section); + return s != 0; +} + +void INIFile::renameSection(const String &oldName, const String &newName) { + assert(isValidName(oldName)); + assert(isValidName(newName)); + + Section *os = getSection(oldName); + const Section *ns = getSection(newName); + if (os) { + // HACK: For now we just print a warning, for more info see the TODO + // below. + if (ns) + warning("INIFile::renameSection: Section name \"%s\" already used", newName.c_str()); + else + os->name = newName; + } + // TODO: Check here whether there already is a section with the + // new name. Not sure how to cope with that case, we could: + // - simply remove the existing "newName" section + // - error out + // - merge the two sections "oldName" and "newName" +} + + +bool INIFile::hasKey(const String &key, const String §ion) const { + assert(isValidName(key)); + assert(isValidName(section)); + + const Section *s = getSection(section); + if (!s) + return false; + return s->hasKey(key); +} + +void INIFile::removeKey(const String &key, const String §ion) { + assert(isValidName(key)); + assert(isValidName(section)); + + Section *s = getSection(section); + if (s) + s->removeKey(key); +} + +bool INIFile::getKey(const String &key, const String §ion, String &value) const { + assert(isValidName(key)); + assert(isValidName(section)); + + const Section *s = getSection(section); + if (!s) + return false; + const KeyValue *kv = s->getKey(key); + if (!kv) + return false; + value = kv->value; + return true; +} + +void INIFile::setKey(const String &key, const String §ion, const String &value) { + assert(isValidName(key)); + assert(isValidName(section)); + // TODO: Verify that value is valid, too. In particular, it shouldn't + // contain CR or LF... + + Section *s = getSection(section); + if (!s) { + KeyValue newKV; + newKV.key = key; + newKV.value = value; + + Section newSection; + newSection.name = section; + newSection.keys.push_back(newKV); + + _sections.push_back(newSection); + } else { + s->setKey(key, value); + } +} + +const INIFile::SectionKeyList INIFile::getKeys(const String §ion) const { + const Section *s = getSection(section); + + return s->getKeys(); +} + +INIFile::Section *INIFile::getSection(const String §ion) { + for (List
::iterator i = _sections.begin(); i != _sections.end(); ++i) { + if (section.equalsIgnoreCase(i->name)) { + return &(*i); + } + } + return 0; +} + +const INIFile::Section *INIFile::getSection(const String §ion) const { + for (List
::const_iterator i = _sections.begin(); i != _sections.end(); ++i) { + if (section.equalsIgnoreCase(i->name)) { + return &(*i); + } + } + return 0; +} + +bool INIFile::Section::hasKey(const String &key) const { + return getKey(key) != 0; +} + +const INIFile::KeyValue* INIFile::Section::getKey(const String &key) const { + for (List::const_iterator i = keys.begin(); i != keys.end(); ++i) { + if (key.equalsIgnoreCase(i->key)) { + return &(*i); + } + } + return 0; +} + +void INIFile::Section::setKey(const String &key, const String &value) { + for (List::iterator i = keys.begin(); i != keys.end(); ++i) { + if (key.equalsIgnoreCase(i->key)) { + i->value = value; + return; + } + } + + KeyValue newKV; + newKV.key = key; + newKV.value = value; + keys.push_back(newKV); +} + +void INIFile::Section::removeKey(const String &key) { + for (List::iterator i = keys.begin(); i != keys.end(); ++i) { + if (key.equalsIgnoreCase(i->key)) { + keys.erase(i); + return; + } + } +} + +} // End of namespace Common diff --git a/common/ini-file.h b/common/ini-file.h new file mode 100644 index 0000000000..c7da6de50e --- /dev/null +++ b/common/ini-file.h @@ -0,0 +1,140 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef COMMON_INI_FILE_H +#define COMMON_INI_FILE_H + +#include "common/hash-str.h" +#include "common/list.h" +#include "common/str.h" + +namespace Common { + +class SeekableReadStream; +class WriteStream; + +/** + * This class allows reading/writing INI style config files. + * It is used by the ConfigManager for storage, but can also + * be used by other code if it needs to read/write custom INI + * files. + * + * Lines starting with a '#' are ignored (i.e. treated as comments). + * Some effort is made to preserve comments, though. + * + * This class makes no attempts to provide fast access to key/value pairs. + * In particular, it stores all sections and k/v pairs in lists, not + * in dictionaries/maps. This makes it very easy to read/write the data + * from/to files, but of course is not appropriate for fast access. + * The main reason is that this class is indeed geared toward doing precisely + * that! + * If you need fast access to the game config, use higher level APIs, like the + * one provided by ConfigManager. + */ +class INIFile { +public: + struct KeyValue { + String key; + String value; + String comment; + }; + + typedef List SectionKeyList; + + /** A section in a ini file. I.e. corresponds to something like this: + * [mySection] + * key=value + * + * Comments are also stored, to keep users happy who like editing their + * ini files manually. + */ + struct Section { + String name; + List keys; + String comment; + + bool hasKey(const String &key) const; + const KeyValue* getKey(const String &key) const; + void setKey(const String &key, const String &value); + void removeKey(const String &key); + const SectionKeyList getKeys() const { return keys; } + }; + + typedef List
SectionList; + +public: + INIFile(); + ~INIFile(); + + // TODO: Maybe add a copy constructor etc.? + + /** + * Check whether the given string is a valid section or key name. + * For that, it must only consist of letters, numbers, dashes and + * underscores. In particular, white space and "#", "=", "[", "]" + * are not valid! + */ + static bool isValidName(const String &name); + + /** Reset everything stored in this ini file. */ + void clear(); + + bool loadFromFile(const String &filename); + bool loadFromSaveFile(const char *filename); + bool loadFromStream(SeekableReadStream &stream); + bool saveToFile(const String &filename); + bool saveToSaveFile(const char *filename); + bool saveToStream(WriteStream &stream); + + bool hasSection(const String §ion) const; + void addSection(const String §ion); + void removeSection(const String §ion); + void renameSection(const String &oldName, const String &newName); + + bool hasKey(const String &key, const String §ion) const; + bool getKey(const String &key, const String §ion, String &value) const; + void setKey(const String &key, const String §ion, const String &value); + void removeKey(const String &key, const String §ion); + + const SectionList getSections() const { return _sections; } + const SectionKeyList getKeys(const String §ion) const; + + void listKeyValues(StringMap &kv); + +private: + SectionList _sections; + + Section *getSection(const String §ion); + const Section *getSection(const String §ion) const; +}; + +/* +- ConfigMan owns a config file +- allow direct access to that config file (for the launcher) +- simplify and unify the regular ConfigMan API in exchange + + +*/ + +} // End of namespace Common + +#endif diff --git a/common/module.mk b/common/module.mk index 9f9126c8ef..1b34d151d0 100644 --- a/common/module.mk +++ b/common/module.mk @@ -2,7 +2,6 @@ MODULE := common MODULE_OBJS := \ archive.o \ - config-file.o \ config-manager.o \ coroutines.o \ dcl.o \ @@ -15,6 +14,7 @@ MODULE_OBJS := \ gui_options.o \ hashmap.o \ iff_container.o \ + ini-file.o \ installshield_cab.o \ language.o \ localization.o \ diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 33a5356b3a..7d8022455a 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -23,7 +23,7 @@ #ifndef COMPOSER_H #define COMPOSER_H -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/random.h" #include "common/system.h" #include "common/debug.h" @@ -174,7 +174,7 @@ private: Common::List _sprites; uint _directoriesToStrip; - Common::ConfigFile _bookIni; + Common::INIFile _bookIni; Common::String _bookGroup; Common::List _libraries; Common::Array _pendingPageChanges; diff --git a/engines/gob/iniconfig.cpp b/engines/gob/iniconfig.cpp index bba531723c..032231bd4d 100644 --- a/engines/gob/iniconfig.cpp +++ b/engines/gob/iniconfig.cpp @@ -73,7 +73,7 @@ bool INIConfig::getConfig(const Common::String &file, Config &config) { } bool INIConfig::openConfig(const Common::String &file, Config &config) { - config.config = new Common::ConfigFile(); + config.config = new Common::INIFile(); config.created = false; if (!config.config->loadFromFile(file)) { @@ -89,7 +89,7 @@ bool INIConfig::openConfig(const Common::String &file, Config &config) { } bool INIConfig::createConfig(const Common::String &file, Config &config) { - config.config = new Common::ConfigFile(); + config.config = new Common::INIFile(); config.created = true; _configs.setVal(file, config); diff --git a/engines/gob/iniconfig.h b/engines/gob/iniconfig.h index bf60f2d125..c1890170dc 100644 --- a/engines/gob/iniconfig.h +++ b/engines/gob/iniconfig.h @@ -24,7 +24,7 @@ #define GOB_INICONFIG_H #include "common/str.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/hashmap.h" namespace Gob { @@ -43,7 +43,7 @@ public: private: struct Config { - Common::ConfigFile *config; + Common::INIFile *config; bool created; }; diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index efa0dd3fd3..634ff441b6 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -311,8 +311,8 @@ void MohawkEngine_LivingBooks::loadBookInfo(const Common::String &filename) { // - fDebugWindow (always 0?) if (_bookInfoFile.hasSection("Globals")) { - const Common::ConfigFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals"); - for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { + const Common::INIFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals"); + for (Common::INIFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str()); LBCode tempCode(this, 0); uint offset = tempCode.parseCode(command); diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 76da7d8219..615fcd0e16 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -28,7 +28,7 @@ #include "mohawk/livingbooks_graphics.h" #include "mohawk/sound.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/rect.h" #include "common/queue.h" #include "common/random.h" @@ -759,7 +759,7 @@ public: private: LivingBooksConsole *_console; - Common::ConfigFile _bookInfoFile; + Common::INIFile _bookInfoFile; Common::String getBookInfoFileName() const; void loadBookInfo(const Common::String &filename); diff --git a/engines/mohawk/livingbooks_lbx.cpp b/engines/mohawk/livingbooks_lbx.cpp index 2b8b22ec81..dcf8caa4a5 100644 --- a/engines/mohawk/livingbooks_lbx.cpp +++ b/engines/mohawk/livingbooks_lbx.cpp @@ -33,7 +33,7 @@ public: bool call(uint callId, const Common::Array ¶ms, LBValue &result); protected: - Common::ConfigFile _dataFile; + Common::INIFile _dataFile; Common::String _curSection; void open(const Common::String &filename); @@ -77,8 +77,8 @@ bool LBXDataFile::call(uint callId, const Common::Array ¶ms, LBValu case kLBXDataFileGetSectionList: { Common::SharedPtr list = Common::SharedPtr(new LBList); - Common::ConfigFile::SectionList sections = _dataFile.getSections(); - for (Common::List::const_iterator i = sections.begin(); i != sections.end(); ++i) + Common::INIFile::SectionList sections = _dataFile.getSections(); + for (Common::List::const_iterator i = sections.begin(); i != sections.end(); ++i) list->array.push_back(LBValue(i->name)); result = LBValue(list); } @@ -103,8 +103,8 @@ bool LBXDataFile::call(uint callId, const Common::Array ¶ms, LBValu error("incorrect number of parameters (%d) to LBXDataFile::loadCurSectionVars", params.size()); { - const Common::ConfigFile::SectionKeyList globals = _dataFile.getKeys(_curSection); - for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { + const Common::INIFile::SectionKeyList globals = _dataFile.getKeys(_curSection); + for (Common::INIFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str()); LBCode tempCode(_vm, 0); uint offset = tempCode.parseCode(command); diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index eb62b650a4..ae43d714ad 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -23,7 +23,7 @@ #ifdef ENABLE_HE #include "common/archive.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/config-manager.h" #include "common/macresman.h" #include "common/savefile.h" @@ -180,7 +180,7 @@ void ScummEngine_v80he::o80_readConfigFile() { } } else { // Normal Windows INI files - Common::ConfigFile confFile; + Common::INIFile confFile; if (!strcmp((char *)filename + r, "map.ini")) confFile.loadFromFile((const char *)filename + r); else @@ -250,7 +250,7 @@ void ScummEngine_v80he::o80_writeConfigFile() { memcpy(section, "BluesTreasureHunt-Disc2\0", 24); } - Common::ConfigFile ConfFile; + Common::INIFile ConfFile; ConfFile.loadFromSaveFile((const char *)filename + r); ConfFile.setKey((char *)option, (char *)section, (char *)string); ConfFile.saveToSaveFile((const char *)filename + r); diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp index 6b56616c9b..a40d239ebf 100644 --- a/engines/testbed/config.cpp +++ b/engines/testbed/config.cpp @@ -213,22 +213,22 @@ void TestbedConfigManager::parseConfigFile() { return; } _configFileInterface.loadFromStream(*rs); - Common::ConfigFile::SectionList sections = _configFileInterface.getSections(); + Common::INIFile::SectionList sections = _configFileInterface.getSections(); Testsuite *currTS = 0; - for (Common::ConfigFile::SectionList::const_iterator i = sections.begin(); i != sections.end(); i++) { + for (Common::INIFile::SectionList::const_iterator i = sections.begin(); i != sections.end(); i++) { if (i->name.equalsIgnoreCase("Global")) { // Global params may be directly queried, ignore them } else { // A testsuite, process it. currTS = getTestsuiteByName(i->name); - Common::ConfigFile::SectionKeyList kList = i->getKeys(); + Common::INIFile::SectionKeyList kList = i->getKeys(); if (!currTS) { Testsuite::logPrintf("Warning! Error in config: Testsuite %s not found\n", i->name.c_str()); continue; } - for (Common::ConfigFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) { + for (Common::INIFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) { if (j->key.equalsIgnoreCase("this")) { currTS->enable(stringToBool(j->value)); } else { diff --git a/engines/testbed/config.h b/engines/testbed/config.h index fd5588aa31..d611ae4ec3 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -24,7 +24,7 @@ #include "common/array.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/str-array.h" #include "common/tokenizer.h" @@ -62,7 +62,7 @@ public: private: Common::Array &_testsuiteList; Common::String _configFileName; - Common::ConfigFile _configFileInterface; + Common::INIFile _configFileInterface; void parseConfigFile(); }; -- cgit v1.2.3 From 6da6e4e68628bba656c3c3e1d2f6f9e27013f8f8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 16:30:38 +0200 Subject: COMMON: Remove outdated comments on INIFile. These very old comments claimed that ConfigManager uses INIFile. This is not true however. Thus removing them should clear things up a little bit. --- common/ini-file.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/common/ini-file.h b/common/ini-file.h index c7da6de50e..1d94ce7bdc 100644 --- a/common/ini-file.h +++ b/common/ini-file.h @@ -34,9 +34,6 @@ class WriteStream; /** * This class allows reading/writing INI style config files. - * It is used by the ConfigManager for storage, but can also - * be used by other code if it needs to read/write custom INI - * files. * * Lines starting with a '#' are ignored (i.e. treated as comments). * Some effort is made to preserve comments, though. @@ -47,8 +44,6 @@ class WriteStream; * from/to files, but of course is not appropriate for fast access. * The main reason is that this class is indeed geared toward doing precisely * that! - * If you need fast access to the game config, use higher level APIs, like the - * one provided by ConfigManager. */ class INIFile { public: @@ -127,14 +122,6 @@ private: const Section *getSection(const String §ion) const; }; -/* -- ConfigMan owns a config file -- allow direct access to that config file (for the launcher) -- simplify and unify the regular ConfigMan API in exchange - - -*/ - } // End of namespace Common #endif -- cgit v1.2.3 From 0dae60a3577a78f75ae3cf2d2dc88177ba6f128e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 16:32:41 +0200 Subject: COMMON: Remove commented out include in config-manager.h. --- common/config-manager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/common/config-manager.h b/common/config-manager.h index 45a1f2d103..6295a93ba5 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -24,7 +24,6 @@ #define COMMON_CONFIG_MANAGER_H #include "common/array.h" -//#include "common/ini-file.h" #include "common/hashmap.h" #include "common/singleton.h" #include "common/str.h" -- cgit v1.2.3 From 0d14f9d00934bf10bcca4c11002b7357309b76ac Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 8 Aug 2013 17:57:58 +0200 Subject: LURE: Fix some formatting. --- engines/lure/hotspots.cpp | 197 ++++++++++++++++++++++++++++++---------------- 1 file changed, 131 insertions(+), 66 deletions(-) diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index efd4051eba..d0b439677d 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -260,8 +260,10 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { _anim = NULL; _numFrames = 0; _frameNumber = 0; - if (!newRecord) return; - if (!disk.exists(newRecord->animId)) return; + if (!newRecord) + return; + if (!disk.exists(newRecord->animId)) + return; // Scan for any size overrides - some animations get their size set after decoding, but // we want it in advance so we can decode the animation straight to a graphic surface @@ -516,7 +518,8 @@ void Hotspot::endAction() { } void Hotspot::setDirection(Direction dir) { - if ((_numFrames == 0) || (_direction == dir)) return; + if ((_numFrames == 0) || (_direction == dir)) + return; uint8 newFrameNumber = 0; switch (dir) { @@ -634,7 +637,8 @@ void Hotspot::setOccupied(bool occupiedFlag) { if (xp < 0) { xp = -xp; widthVal -= xp; - if (widthVal <= 0) return; + if (widthVal <= 0) + return; xp = 0; } @@ -642,7 +646,8 @@ void Hotspot::setOccupied(bool occupiedFlag) { int x2 = xp + widthVal - ROOM_PATHS_WIDTH - 1; if (x2 >= 0) { widthVal -= (x2 + 1); - if (widthVal <= 0) return; + if (widthVal <= 0) + return; } RoomPathsData &paths = Resources::getReference().getRoom(_roomNumber)->paths; @@ -656,14 +661,16 @@ void Hotspot::setOccupied(bool occupiedFlag) { // walks the character a single step in a sequence defined by the walking list bool Hotspot::walkingStep() { - if (_pathFinder.isEmpty()) return true; + if (_pathFinder.isEmpty()) + return true; // Check to see if the end of the next straight walking slice if (_pathFinder.stepCtr() >= _pathFinder.top().numSteps()) { // Move to next slice in walking sequence _pathFinder.stepCtr() = 0; _pathFinder.pop(); - if (_pathFinder.isEmpty()) return true; + if (_pathFinder.isEmpty()) + return true; } if (_pathFinder.stepCtr() == 0) @@ -782,13 +789,15 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) { uint16 *v = (uint16 *) (msgData + READ_LE_UINT16(msgData + idx + sizeof(uint16))); while ((idVal = READ_LE_UINT16(v)) != 0xffff) { ++v; - if (READ_LE_UINT16(v) == messageId) break; + if (READ_LE_UINT16(v) == messageId) + break; ++v; } // default response if a specific response not found - if (idVal == 0xffff) idVal = 0x8c4; + if (idVal == 0xffff) + idVal = 0x8c4; debugC(ERROR_DETAILED, kLureDebugStrings, "Hotspot::showMessage idVal=%xh", idVal); if (idVal == 0x76) { @@ -826,7 +835,8 @@ void Hotspot::handleTalkDialog() { Room &room = Room::getReference(); // Return if no talk dialog is necessary - if (_data->talkCountdown == 0) return; + if (_data->talkCountdown == 0) + return; debugC(ERROR_DETAILED, kLureDebugAnimations, "Talk countdown = %d", _data->talkCountdown); if (_data->talkCountdown == CONVERSE_COUNTDOWN_SIZE) { @@ -933,7 +943,8 @@ static const uint16 validRoomExitHotspots[] = {0x2711, 0x2712, 0x2714, 0x2715, 0 bool Hotspot::isRoomExit(uint16 id) { for (const uint16 *p = &validRoomExitHotspots[0]; *p != 0; ++p) - if (*p == id) return true; + if (*p == id) + return true; return false; } @@ -1043,7 +1054,7 @@ BarPlaceResult Hotspot::getBarPlace() { index = -1; while (++index < NUM_SERVE_CUSTOMERS) { if (barEntry.customers[index].hotspotId == 0) - break; + break; } if (index == NUM_SERVE_CUSTOMERS) @@ -1391,7 +1402,8 @@ void Hotspot::doGet(HotspotData *hotspot) { Resources &res = Resources::getReference(); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1409,7 +1421,8 @@ void Hotspot::doGet(HotspotData *hotspot) { if (sequenceOffset != 0) { uint16 execResult = Script::execute(sequenceOffset); - if (execResult == 1) return; + if (execResult == 1) + return; else if (execResult != 0) { showMessage(execResult); return; @@ -1432,7 +1445,8 @@ void Hotspot::doOperate(HotspotData *hotspot) { Action action = currentActions().top().supportData().action(); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1467,7 +1481,8 @@ void Hotspot::doOpen(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1487,7 +1502,8 @@ void Hotspot::doOpen(HotspotData *hotspot) { if (sequenceOffset != 0) { sequenceOffset = Script::execute(sequenceOffset); - if (sequenceOffset == 1) return; + if (sequenceOffset == 1) + return; if (sequenceOffset != 0) { if (_exitCtr != 0) _exitCtr = 4; @@ -1522,7 +1538,8 @@ void Hotspot::doClose(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1575,7 +1592,8 @@ void Hotspot::doUse(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1616,7 +1634,8 @@ void Hotspot::doGive(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1662,7 +1681,8 @@ void Hotspot::doTalkTo(HotspotData *hotspot) { (hotspot->hotspotId != BLACKSMITH_ID))) { HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1706,7 +1726,8 @@ void Hotspot::doTell(HotspotData *hotspot) { assert(character); HotspotPrecheckResult hsResult = actionPrecheck(hotspot); - if (hsResult == PC_WAIT) return; + if (hsResult == PC_WAIT) + return; else if (hsResult != PC_EXECUTE) { endAction(); return; @@ -1800,7 +1821,8 @@ void Hotspot::doAsk(HotspotData *hotspot) { _data->useHotspotId = usedId; HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1886,14 +1908,17 @@ void Hotspot::doStatus(HotspotData *hotspot) { HotspotData const &rec = **i; if (rec.roomNumber == PLAYER_ID) { - if (numItems++ == 0) strcat(buffer, ": "); - else strcat(buffer, ", "); + if (numItems++ == 0) + strcat(buffer, ": "); + else + strcat(buffer, ", "); strings.getString(rec.nameId, buffer + strlen(buffer)); } } // If there were no items, add in the word 'nothing' - if (numItems == 0) strcat(buffer, stringList.getString(S_INV_NOTHING)); + if (numItems == 0) + strcat(buffer, stringList.getString(S_INV_NOTHING)); // If the player has money, add it in uint16 numGroats = res.fieldList().numGroats(); @@ -1943,7 +1968,8 @@ void Hotspot::doBribe(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1968,7 +1994,8 @@ void Hotspot::doBribe(HotspotData *hotspot) { sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, BRIBE); if (sequenceOffset != 0) { sequenceOffset = Script::execute(sequenceOffset); - if (sequenceOffset != 0) return; + if (sequenceOffset != 0) + return; } uint16 talkIndex = res.fieldList().getField(TALK_INDEX); @@ -2004,7 +2031,8 @@ void Hotspot::doLockUnlock(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -2156,7 +2184,8 @@ void Hotspot::npcTalkNpcToNpc(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -2594,7 +2623,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { if (h.characterMode() == CHARMODE_PLAYER_WAIT) { h.updateMovement(); - if (bumpedPlayer) return; + if (bumpedPlayer) + return; } else { // All other character modes if (h.delayCtr() > 0) { @@ -2691,7 +2721,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { res.pausedList().scan(h); pfResult = pathFinder.process(); - if (pfResult == PF_UNFINISHED) break; + if (pfResult == PF_UNFINISHED) + break; debugC(ERROR_DETAILED, kLureDebugAnimations, "pathFinder done: result = %d", pfResult); @@ -2863,7 +2894,8 @@ void HotspotTickHandlers::roomExitAnimHandler(Hotspot &h) { Room &room = Room::getReference(); RoomExitJoinData *rec = res.getExitJoin(h.hotspotId()); - if (!rec) return; + if (!rec) + return; RoomExitJoinStruct &rs = (rec->hotspots[0].hotspotId == h.hotspotId()) ? rec->hotspots[0] : rec->hotspots[1]; @@ -3036,7 +3068,8 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { res.pausedList().scan(h); pfResult = pathFinder.process(); - if (pfResult == PF_UNFINISHED) break; + if (pfResult == PF_UNFINISHED) + break; // Pathfinding is now complete buffer = pathFinder.getDebugInfo(); @@ -3474,7 +3507,8 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { showSelections |= (entry->descId & 0x3fff) != TALK_MAGIC_ID; } - if ((entry->preSequenceId & 0x8000) != 0) break; + if ((entry->preSequenceId & 0x8000) != 0) + break; } if (showSelections && (numLines > 1)) { @@ -3584,7 +3618,8 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Character response pre id = %xh", _talkResponse->preSequenceId); - if (!_talkResponse->preSequenceId) break; + if (!_talkResponse->preSequenceId) + break; responseNumber = Script::execute(_talkResponse->preSequenceId); debugC(ERROR_DETAILED, kLureDebugAnimations, "Character response new response = %d", responseNumber); @@ -3680,9 +3715,12 @@ void HotspotTickHandlers::grubAnimHandler(Hotspot &h) { character = ratpouch; } - if (character->x() < 72) frameNumber = 0; - else if (character->x() < 172) frameNumber = 1; - else frameNumber = 2; + if (character->x() < 72) + frameNumber = 0; + else if (character->x() < 172) + frameNumber = 1; + else + frameNumber = 2; h.setActionCtr(frameNumber); h.setFrameNumber(frameNumber); @@ -3782,7 +3820,8 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { // Moving right h.setPosition(h.x() + 2, h.y()); h.setActionCtr(h.actionCtr() + 1); - if (h.actionCtr() >= 6) h.setActionCtr(0); + if (h.actionCtr() >= 6) + h.setActionCtr(0); } } else { // Stop the barman moving @@ -4231,7 +4270,8 @@ PathFinderResult PathFinder::process() { while (1) { // Loop through to process cells in the given area - if (!returnFlag) _yCtr = 0; + if (!returnFlag) + _yCtr = 0; while (returnFlag || (_yCtr < ROOM_PATHS_HEIGHT)) { if (!returnFlag) _xCtr = 0; @@ -4239,7 +4279,8 @@ PathFinderResult PathFinder::process() { if (!returnFlag) { processCell(&_layer[(_yChangeStart + _yCtr * _yChangeInc) * DECODED_PATHS_WIDTH + (_xChangeStart + _xCtr * _xChangeInc)]); - if (breakFlag && (_countdownCtr <= 0)) return PF_UNFINISHED; + if (breakFlag && (_countdownCtr <= 0)) + return PF_UNFINISHED; } else { returnFlag = false; } @@ -4249,7 +4290,8 @@ PathFinderResult PathFinder::process() { } // If the destination cell has been filled in, then break out of loop - if (*_pDest != 0) break; + if (*_pDest != 0) + break; if (_cellPopulated) { // At least one cell populated, so go repeat loop @@ -4307,27 +4349,37 @@ PathFinderResult PathFinder::process() { currDirection = NO_DIRECTION; while (1) { v = *pCurrent - 1; - if (v == 0) break; + if (v == 0) + break; newDirection = NO_DIRECTION; if (!altFlag && (currDirection != LEFT) && (currDirection != RIGHT)) { // Standard order direction checking - if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; - else if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; + if (*(pCurrent - DECODED_PATHS_WIDTH) == v) + newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) + newDirection = UP; + else if (*(pCurrent + 1) == v) + newDirection = LEFT; + else if (*(pCurrent - 1) == v) + newDirection = RIGHT; } else { // Alternate order direction checking - if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; - else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; + if (*(pCurrent + 1) == v) + newDirection = LEFT; + else if (*(pCurrent - 1) == v) + newDirection = RIGHT; + else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) + newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) + newDirection = UP; } if (newDirection == NO_DIRECTION) error("Path finding process failed"); // Process for the specified direction - if (newDirection != currDirection) add(newDirection, 0); + if (newDirection != currDirection) + add(newDirection, 0); switch (newDirection) { case UP: @@ -4374,8 +4426,10 @@ PathFinderResult PathFinder::process() { } // Final Step - if (_xPos < 0) add(RIGHT, -_xPos); - else if (_xPos > 0) add(LEFT, _xPos); + if (_xPos < 0) + add(RIGHT, -_xPos); + else if (_xPos > 0) + add(LEFT, _xPos); return result; } @@ -4402,16 +4456,20 @@ void PathFinder::processCell(uint16 *p) { // Check the surrounding cells (up,down,left,right) for values // Up vTemp = *(p - DECODED_PATHS_WIDTH); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Down vTemp = *(p + DECODED_PATHS_WIDTH); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Left vTemp = *(p - 1); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Right vTemp = *(p + 1); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; if (vMax != 0xffff) { // A surrounding cell with a value was found @@ -4433,7 +4491,8 @@ void PathFinder::scanLine(int numScans, int changeAmount, uint16 *&pEnd, int &v) for (int ctr = 1; ctr <= numScans; ++ctr) { pTemp += changeAmount; if ((*pTemp != 0) && (*pTemp != 0xffff)) { - if ((v < ctr) || ((v == ctr) && (*pTemp >= *pEnd))) return; + if ((v < ctr) || ((v == ctr) && (*pTemp >= *pEnd))) + return; pEnd = pTemp; v = ctr; break; @@ -4448,11 +4507,15 @@ void PathFinder::initVars() { _destX = _hotspot->destX(); _destY = _hotspot->destY(); - if (_destX < 10) _destX -= 50; - if (_destX >= FULL_SCREEN_WIDTH-10) _destX += 50; + if (_destX < 10) + _destX -= 50; + if (_destX >= FULL_SCREEN_WIDTH-10) + _destX += 50; - _xPos = 0; _yPos = 0; - _xDestPos = 0; _yDestPos = 0; + _xPos = 0; + _yPos = 0; + _xDestPos = 0; + _yDestPos = 0; _xCurrent = _hotspot->x(); if (_xCurrent < 0) { @@ -4622,7 +4685,8 @@ void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, if (h.hotspotId() == PLAYER_ID) { // Room change code for the player - if (room.cursorState() != CS_NONE) return; + if (room.cursorState() != CS_NONE) + return; PlayerNewPosition &p = fields.playerNewPos(); if (checkForIntersectingCharacter(h, newX, newY - 48, roomNumber)) { @@ -4679,7 +4743,8 @@ bool Support::charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) { while (numEntries-- > 0) - if (*lst++ == charId) return true; + if (*lst++ == charId) + return true; return false; } -- cgit v1.2.3 From a1d02cbe97f6ff3fbd27e3a70f93dbd8cf3e545e Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Fri, 9 Aug 2013 14:19:12 +0200 Subject: WINTERMUTE: Avoid setting alpha-image when filename is "" --- engines/wintermute/video/video_theora_player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 12884a76c3..ef4d6b4dd9 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -417,7 +417,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) { bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) { delete _alphaImage; _alphaImage = new BaseImage(); - if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { + if (filename == "" || !_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { delete _alphaImage; _alphaImage = nullptr; _alphaFilename = ""; -- cgit v1.2.3 From 7306979f6d3277239857d36f2a2618eb4f71ba69 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Fri, 9 Aug 2013 18:28:06 +0200 Subject: WINTERMUTE: Fix uninitialized scalar field (CID1060922) --- engines/wintermute/base/base_engine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index 67e3d80cc8..acb12bbe5f 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -44,6 +44,7 @@ BaseEngine::BaseEngine() { _classReg = nullptr; _rnd = nullptr; _gameId = ""; + _language = Common::UNK_LANG; } void BaseEngine::init() { -- cgit v1.2.3 From 7d6d7a7945dc75f94fce5e68ed0b0d784edb43c1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Aug 2013 18:37:17 +0200 Subject: MORTEVIELLE: Use more accurate frequency for music --- engines/mortevielle/sound.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 24cec8911d..717236546c 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -186,7 +186,10 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::playSong(const byte* buf, uint size, uint loops) { - Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); + + int freq = kTempoMusic * 10 * 25.2; + warning("%d", freq); + Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, freq, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); -- cgit v1.2.3 From 62b6c333d5f33f8957558c8678d383121d2139ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 13:41:50 +0200 Subject: MORTEVIELLE: Play ambiant sounds --- engines/mortevielle/mortevielle.cpp | 2 + engines/mortevielle/mortevielle.h | 1 + engines/mortevielle/sound.cpp | 103 ++++++++++++++++++++++++++++++++++-- engines/mortevielle/sound.h | 4 +- engines/mortevielle/speech.cpp | 23 +++++++- engines/mortevielle/speech.h | 5 +- 6 files changed, 127 insertions(+), 11 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7126df933f..4e2582ceb1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -105,6 +105,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _curAnim = nullptr; _rightFramePict = nullptr; _compMusicBuf1 = nullptr; + _noiseBuf = nullptr; } MortevielleEngine::~MortevielleEngine() { @@ -112,6 +113,7 @@ MortevielleEngine::~MortevielleEngine() { free(_curAnim); free(_rightFramePict); free(_compMusicBuf1); + free(_noiseBuf); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 8c7da8cc97..0201d8f70d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -440,6 +440,7 @@ public: byte *_curAnim; byte *_rightFramePict; byte *_compMusicBuf1; + byte *_noiseBuf; Debugger _debugger; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 717236546c..9d451dadd3 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -137,12 +137,14 @@ SoundManager::SoundManager(Audio::Mixer *mixer) { _speakerStream = new PCSpeaker(mixer->getOutputRate()); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + _audioStream = nullptr; } SoundManager::~SoundManager() { + if (_audioStream) + _audioStream->finish(); _mixer->stopHandle(_speakerHandle); - delete _speakerStream; - + delete _speakerStream; } /** @@ -177,7 +179,100 @@ int SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { } void SoundManager::litph(tablint &t, int typ, int tempo) { - return; + if (_vm->_speechManager._typlec == 2) { + warning("--->"); + for (int i = 0; i < _vm->_speechManager._ptr_oct; i++) + warning("%d", _vm->_mem[(kAdrTroct * 16) + i]); + warning("---<"); + } else + return; + + int i = 0; + while (i < _vm->_speechManager._ptr_oct) { + int idx = _vm->_mem[(kAdrTroct * 16) + i]; + i++; + switch(idx) { + case 0: { + warning("IPCX"); +/* adbrui + dw 5CB0h, 0, 17224 + dw 6000h, 3656, 20108 + dw 6000h, 20108, 37446 + dw 6924h, 6, 8388 + dw 6B30h, 4, 1893 + dw 6BA6h, 6, 8595 +*/ + int val = _vm->_mem[(kAdrTroct * 16) + i]; + i++; + warning("idx %d", val); + if (_vm->_speechManager._typlec == 0) + warning("vclas"); + else if (!_vm->_speechManager._typlec == 1) + warning("duson"); + else { // 2 + warning("vadson"); + const static int ambiantNoiseAdr[] = {0, 14020, + 14020, 18994, + 18994, 19630, + 19630, 22258, + 22258, 37322, + 37322, 44472, + 44472, 52324, + 52324, 59598, + 59598, 69748}; + if (val > 8) { + warning("unhandled index %d", val); + } else { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(22428, false); + _audioStream->queueBuffer(&_vm->_noiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); +// Audio::SeekableAudioStream *raw = nullptr; +// raw = Audio::makeRawStream(&_vm->_mem[(kAdrNoise * 16)] + ambiantNoiseAdr[val * 2], ambiantNoiseAdr[(val * 2) + 1], 22428, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); +// Audio::SoundHandle soundHandle; +// _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, raw, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); +// while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) +// ; + + } + } + break; + } + case 2: { + warning("parc"); + int val = _vm->_mem[(kAdrTroct * 16) + i]; + i++; + int tmpidx = (val * 12) + 268; + val = _vm->_mem[(kAdrTroct * 16) + i]; + i++; + warning("%d %d", tmpidx, val); + warning("reech"); + } + break; + case 4: + if (_vm->_speechManager._typlec) { + warning("Skip interphoneme: %d %d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); + i += 2; + } else { + // Speech + warning("Interphoneme: consonne:%d voyelle:%d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); + i += 2; + } + break; + case 6: + warning("pari2"); + break; + default: + if (idx == 62) + warning("blab"); + else if (idx == 35) { + if (i < _vm->_speechManager._ptr_oct) + warning("unexpected 35"); + i = _vm->_speechManager._ptr_oct; + } else + warning("Other code: %d", idx); + break; + } + } } void SoundManager::playNote(int frequency, int32 length) { @@ -186,9 +281,7 @@ void SoundManager::playNote(int frequency, int32 length) { void SoundManager::playSong(const byte* buf, uint size, uint loops) { - int freq = kTempoMusic * 10 * 25.2; - warning("%d", freq); Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, freq, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 1f9e0d9c4d..a2459acee5 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -95,10 +95,12 @@ public: class SoundManager { private: MortevielleEngine *_vm; - Audio::Mixer *_mixer; PCSpeaker *_speakerStream; Audio::SoundHandle _speakerHandle; public: + Audio::Mixer *_mixer; + Audio::QueuingAudioStream *_audioStream; + SoundManager(Audio::Mixer *mixer); ~SoundManager(); diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 35eefc898f..2bf2e2c286 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -30,6 +30,7 @@ #include "mortevielle/speech.h" #include "mortevielle/sound.h" +#include "audio/decoders/raw.h" #include "common/endian.h" #include "common/file.h" @@ -98,7 +99,7 @@ void SpeechManager::charg_car(int &currWordNumb) { _queue[2]._val = int_; _queue[2]._code = 6; } else if ((int_ >= 22) && (int_ <= 47)) { - int_ = int_ - 22; + int_ -= 22; _queue[2]._val = int_; _queue[2]._code = _typcon[int_]; } else if ((int_ >= 48) && (int_ <= 56)) { @@ -166,11 +167,13 @@ void SpeechManager::loadMusicSound() { error("Missing file - sonmus.mor"); free(_vm->_compMusicBuf1); + free(_vm->_noiseBuf); int size = f.size(); _vm->_compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); + _vm->_noiseBuf = (byte *)malloc(sizeof(byte) * size * 2); f.read(_vm->_compMusicBuf1, size); - _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, &_vm->_mem[kAdrNoise * 16], size); + _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, _vm->_noiseBuf, size); f.close(); } @@ -274,6 +277,7 @@ void SpeechManager::trait_car() { entroct(_queue[1]._val); entroct(3); } + break; case 7: case 8: @@ -321,6 +325,7 @@ void SpeechManager::trait_car() { entroct(0); else entroct(1); + break; default: break; @@ -551,6 +556,9 @@ void SpeechManager::handlePhoneme() { do { moveQueue(); charg_car(currWord); + if (_typlec == 2) + warning("%d %d %d %d %d", _queue[2]._acc, _queue[2]._code, _queue[2]._freq, _queue[2]._rep, _queue[2]._val); + trait_car(); } while (currWord < wordCount); @@ -597,6 +605,17 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { } handlePhoneme(); _vm->_soundManager.litph(_tbi, typ, tempo); + + if (typ == 2) { + Audio::SoundHandle soundHandle; + _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, _vm->_soundManager._audioStream); + while (_vm->_soundManager._mixer->isSoundHandleActive(soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) + ; + _vm->_soundManager._audioStream->finish(); + _vm->_soundManager._mixer->stopHandle(soundHandle); + _vm->_soundManager._audioStream = nullptr; + } + if (_typlec != 0) for (int i = 0; i <= 500; ++i) { _cfiphBuffer[i] = savph[i]; diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index c3c4c32942..57f0116827 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -68,13 +68,12 @@ class SpeechManager { private: MortevielleEngine *_vm; - int _typlec; int _phonemeNumb; - SpeechQueue _queue[3]; - int _ptr_oct; public: + int _typlec; + int _ptr_oct; uint16 *_cfiphBuffer; int _tbi[256]; int _mlec; -- cgit v1.2.3 From 673ea511ea4340cd6685343101d280535335b84b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 14:01:30 +0200 Subject: MORTEVIELLE: some refactoring in ambiant sound code --- engines/mortevielle/mortevielle.cpp | 4 ---- engines/mortevielle/mortevielle.h | 2 -- engines/mortevielle/sound.cpp | 24 +++++++++++++++++++++++- engines/mortevielle/sound.h | 3 +++ engines/mortevielle/speech.cpp | 23 ++--------------------- engines/mortevielle/speech.h | 1 - 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4e2582ceb1..c117e36636 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -104,16 +104,12 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _curPict = nullptr; _curAnim = nullptr; _rightFramePict = nullptr; - _compMusicBuf1 = nullptr; - _noiseBuf = nullptr; } MortevielleEngine::~MortevielleEngine() { free(_curPict); free(_curAnim); free(_rightFramePict); - free(_compMusicBuf1); - free(_noiseBuf); } /** diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0201d8f70d..bedb6a1ceb 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -439,8 +439,6 @@ public: byte *_curPict; byte *_curAnim; byte *_rightFramePict; - byte *_compMusicBuf1; - byte *_noiseBuf; Debugger _debugger; ScreenSurface _screenSurface; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 9d451dadd3..5dea574a81 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -138,6 +138,7 @@ SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); _audioStream = nullptr; + _ambiantNoiseBuf = nullptr; } SoundManager::~SoundManager() { @@ -145,6 +146,7 @@ SoundManager::~SoundManager() { _audioStream->finish(); _mixer->stopHandle(_speakerHandle); delete _speakerStream; + free(_ambiantNoiseBuf); } /** @@ -178,6 +180,26 @@ int SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { return decompSize; } +/** + * Load sonmus.mor file + * @remarks Originally called 'charge_son' + */ +void SoundManager::loadAmbiantSounds() { + Common::File f; + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + free(_ambiantNoiseBuf); + int size = f.size(); + byte *compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); + _ambiantNoiseBuf = (byte *)malloc(sizeof(byte) * size * 2); + f.read(compMusicBuf1, size); + f.close(); + + decodeMusic(compMusicBuf1, _ambiantNoiseBuf, size); + free(compMusicBuf1); +} + void SoundManager::litph(tablint &t, int typ, int tempo) { if (_vm->_speechManager._typlec == 2) { warning("--->"); @@ -225,7 +247,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } else { if (!_audioStream) _audioStream = Audio::makeQueuingAudioStream(22428, false); - _audioStream->queueBuffer(&_vm->_noiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + _audioStream->queueBuffer(&_ambiantNoiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); // Audio::SeekableAudioStream *raw = nullptr; // raw = Audio::makeRawStream(&_vm->_mem[(kAdrNoise * 16)] + ambiantNoiseAdr[val * 2], ambiantNoiseAdr[(val * 2) + 1], 22428, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); // Audio::SoundHandle soundHandle; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index a2459acee5..763e18a622 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -97,6 +97,8 @@ private: MortevielleEngine *_vm; PCSpeaker *_speakerStream; Audio::SoundHandle _speakerHandle; + byte *_ambiantNoiseBuf; + public: Audio::Mixer *_mixer; Audio::QueuingAudioStream *_audioStream; @@ -109,6 +111,7 @@ public: int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); + void loadAmbiantSounds(); void litph(tablint &t, int typ, int tempo); }; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 2bf2e2c286..c721aa2e02 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -157,26 +157,6 @@ void SpeechManager::regenbruit() { } while (i < kOffsetB3 + 8790); } -/** - * Load sonmus.mor file - * @remarks Originally called 'charge_son' - */ -void SpeechManager::loadMusicSound() { - Common::File f; - if (!f.open("sonmus.mor")) - error("Missing file - sonmus.mor"); - - free(_vm->_compMusicBuf1); - free(_vm->_noiseBuf); - int size = f.size(); - _vm->_compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); - _vm->_noiseBuf = (byte *)malloc(sizeof(byte) * size * 2); - f.read(_vm->_compMusicBuf1, size); - - _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, _vm->_noiseBuf, size); - f.close(); -} - /** * Load phoneme sound file * @remarks Originally called 'charge_phbruit' @@ -597,7 +577,8 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { regenbruit(); break; case 2: - loadMusicSound(); + //TODO: Only call it once + _vm->_soundManager.loadAmbiantSounds(); loadPhonemeSounds(); break; default: diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 57f0116827..4fe9a34dca 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -89,7 +89,6 @@ public: void veracf(byte b); void cctable(tablint &t); void regenbruit(); - void loadMusicSound(); void loadPhonemeSounds(); void loadNoise(); void trait_car(); -- cgit v1.2.3 From 272740bb5c4ef1576ccf270f944c4f7dfef66d5c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 16:23:51 +0200 Subject: MORTEVIELLE: Handle sounds --- engines/mortevielle/mortevielle.h | 3 ++- engines/mortevielle/sound.cpp | 56 ++++++++++++++++----------------------- engines/mortevielle/speech.cpp | 5 +--- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index bedb6a1ceb..19e580816d 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -52,7 +52,8 @@ namespace Mortevielle { // Debug channels enum { kMortevielleCore = 1 << 0, - kMortevielleGraphics = 1 << 1 + kMortevielleGraphics = 1 << 1, + kMortevielleSounds = 1 << 2 }; // Game languages diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 5dea574a81..01d7176ab2 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -201,38 +201,38 @@ void SoundManager::loadAmbiantSounds() { } void SoundManager::litph(tablint &t, int typ, int tempo) { - if (_vm->_speechManager._typlec == 2) { - warning("--->"); - for (int i = 0; i < _vm->_speechManager._ptr_oct; i++) - warning("%d", _vm->_mem[(kAdrTroct * 16) + i]); - warning("---<"); - } else + // Skip speech + if (_vm->_speechManager._typlec == 0) return; + int freq = tempo * 10 * 25.2; int i = 0; while (i < _vm->_speechManager._ptr_oct) { int idx = _vm->_mem[(kAdrTroct * 16) + i]; i++; switch(idx) { case 0: { - warning("IPCX"); -/* adbrui - dw 5CB0h, 0, 17224 - dw 6000h, 3656, 20108 - dw 6000h, 20108, 37446 - dw 6924h, 6, 8388 - dw 6B30h, 4, 1893 - dw 6BA6h, 6, 8595 -*/ int val = _vm->_mem[(kAdrTroct * 16) + i]; i++; - warning("idx %d", val); if (_vm->_speechManager._typlec == 0) warning("vclas"); - else if (!_vm->_speechManager._typlec == 1) - warning("duson"); - else { // 2 - warning("vadson"); + else if (_vm->_speechManager._typlec == 1) { + debugC(5, kMortevielleSounds, "litph - duson"); + const static int noiseAdr[] = {0, 17224, + 17224, 33676, + 33676, 51014, + 51014, 59396, + 59396, 61286, + 61286, 69875}; + if (val > 5) { + warning("unhandled index %d", val); + } else { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + _audioStream->queueBuffer(&_vm->_mem[(kAdrNoise * 16) + noiseAdr[val * 2]], noiseAdr[(val * 2) + 1] - noiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } + } else { // 2 + debugC(5, kMortevielleSounds, "litph - vadson"); const static int ambiantNoiseAdr[] = {0, 14020, 14020, 18994, 18994, 19630, @@ -246,37 +246,27 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { warning("unhandled index %d", val); } else { if (!_audioStream) - _audioStream = Audio::makeQueuingAudioStream(22428, false); + _audioStream = Audio::makeQueuingAudioStream(freq, false); _audioStream->queueBuffer(&_ambiantNoiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); -// Audio::SeekableAudioStream *raw = nullptr; -// raw = Audio::makeRawStream(&_vm->_mem[(kAdrNoise * 16)] + ambiantNoiseAdr[val * 2], ambiantNoiseAdr[(val * 2) + 1], 22428, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); -// Audio::SoundHandle soundHandle; -// _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, raw, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); -// while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) -// ; - } } break; } case 2: { - warning("parc"); int val = _vm->_mem[(kAdrTroct * 16) + i]; i++; int tmpidx = (val * 12) + 268; val = _vm->_mem[(kAdrTroct * 16) + i]; i++; - warning("%d %d", tmpidx, val); - warning("reech"); + warning("TODO: reech %d %d", tmpidx, val); } break; case 4: if (_vm->_speechManager._typlec) { - warning("Skip interphoneme: %d %d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); i += 2; } else { // Speech - warning("Interphoneme: consonne:%d voyelle:%d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); + warning("TODO: Interphoneme: consonne:%d voyelle:%d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); i += 2; } break; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index c721aa2e02..aaa2c6a906 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -536,9 +536,6 @@ void SpeechManager::handlePhoneme() { do { moveQueue(); charg_car(currWord); - if (_typlec == 2) - warning("%d %d %d %d %d", _queue[2]._acc, _queue[2]._code, _queue[2]._freq, _queue[2]._rep, _queue[2]._val); - trait_car(); } while (currWord < wordCount); @@ -587,7 +584,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { handlePhoneme(); _vm->_soundManager.litph(_tbi, typ, tempo); - if (typ == 2) { + if (typ != 0) { Audio::SoundHandle soundHandle; _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, _vm->_soundManager._audioStream); while (_vm->_soundManager._mixer->isSoundHandleActive(soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) -- cgit v1.2.3 From 56431cfc596a8af6d821239253acc07b16f783bf Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 10 Aug 2013 16:56:07 +0200 Subject: TINSEL: Fix DW2 assertion when quitting during cutscene Call _bmv->FinishBMV() before setting g_pCurBgnd to NULL. Otherwise, there will be an assertion if quitting during a cutscene while a subtitle is being shown. (At least I think that's the condition.) (Also, it seems to be a good idea to call it before EndScene(), because even though there was no assertion, I got a lot of warnings when I did it after.) --- engines/tinsel/tinsel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 9075e1adb1..5d410e62c7 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -868,9 +868,6 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) } TinselEngine::~TinselEngine() { - if (_bmv->MoviePlaying()) - _bmv->FinishBMV(); - _system->getAudioCDManager()->stop(); delete _bmv; delete _sound; @@ -1007,6 +1004,9 @@ Common::Error TinselEngine::run() { g_system->delayMillis(10); } + if (_bmv->MoviePlaying()) + _bmv->FinishBMV(); + // Write configuration _vm->_config->writeToDisk(); -- cgit v1.2.3 From 0c00a7fde8f373d45172afc53a2d44f8dc99702d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 21:56:21 +0200 Subject: MORTEVIELLE: Some refactoring in noise sound code --- engines/mortevielle/sound.cpp | 41 +++++++++++++++++++++++++++++++++++++---- engines/mortevielle/sound.h | 3 +++ engines/mortevielle/speech.cpp | 32 ++------------------------------ engines/mortevielle/speech.h | 14 -------------- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 01d7176ab2..a3ac56c27b 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -139,6 +139,7 @@ SoundManager::SoundManager(Audio::Mixer *mixer) { _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); _audioStream = nullptr; _ambiantNoiseBuf = nullptr; + _noiseBuf = nullptr; } SoundManager::~SoundManager() { @@ -147,6 +148,7 @@ SoundManager::~SoundManager() { _mixer->stopHandle(_speakerHandle); delete _speakerStream; free(_ambiantNoiseBuf); + free(_noiseBuf); } /** @@ -200,6 +202,37 @@ void SoundManager::loadAmbiantSounds() { free(compMusicBuf1); } +/** + * Speech function - Load Noise file + * @remarks Originally called 'charge_bruit' + */ +void SoundManager::loadNoise() { + Common::File f1, f2; + + if (!f1.open("bruits")) //Translation: "noise" + error("Missing file - bruits"); + if (!f2.open("bruit5")) + error("Missing file - bruit5"); + + _noiseBuf = (byte *)malloc(sizeof(byte) * (f1.size() + f2.size())); + assert(f1.size() > 32000); + + f1.read(_noiseBuf, 32000); // 250 * 128 + f2.read(&_noiseBuf[32000], f2.size()); + f1.read(&_noiseBuf[32000 + f2.size()], f1.size() - 32000); // 19072 + + f1.close(); + f2.close(); +} + +void SoundManager::regenbruit() { + int i = 69876; + for (int j = 0; j < 100; j++) { + _vm->_speechManager._cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); + i += 2; + } +} + void SoundManager::litph(tablint &t, int typ, int tempo) { // Skip speech if (_vm->_speechManager._typlec == 0) @@ -215,7 +248,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { int val = _vm->_mem[(kAdrTroct * 16) + i]; i++; if (_vm->_speechManager._typlec == 0) - warning("vclas"); + warning("TODO: vclas"); else if (_vm->_speechManager._typlec == 1) { debugC(5, kMortevielleSounds, "litph - duson"); const static int noiseAdr[] = {0, 17224, @@ -229,7 +262,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } else { if (!_audioStream) _audioStream = Audio::makeQueuingAudioStream(freq, false); - _audioStream->queueBuffer(&_vm->_mem[(kAdrNoise * 16) + noiseAdr[val * 2]], noiseAdr[(val * 2) + 1] - noiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + _audioStream->queueBuffer(&_noiseBuf[noiseAdr[val * 2]], noiseAdr[(val * 2) + 1] - noiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); } } else { // 2 debugC(5, kMortevielleSounds, "litph - vadson"); @@ -271,11 +304,11 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } break; case 6: - warning("pari2"); + warning("TODO: pari2"); break; default: if (idx == 62) - warning("blab"); + warning("TODO: blab"); else if (idx == 35) { if (i < _vm->_speechManager._ptr_oct) warning("unexpected 35"); diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 763e18a622..dccae0eaab 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -98,6 +98,7 @@ private: PCSpeaker *_speakerStream; Audio::SoundHandle _speakerHandle; byte *_ambiantNoiseBuf; + byte *_noiseBuf; public: Audio::Mixer *_mixer; @@ -112,7 +113,9 @@ public: int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); void loadAmbiantSounds(); + void loadNoise(); + void regenbruit(); void litph(tablint &t, int typ, int tempo); }; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index aaa2c6a906..1037d0abe4 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -147,16 +147,6 @@ void SpeechManager::cctable(tablint &t) { } } -void SpeechManager::regenbruit() { - int i = kOffsetB3 + 8590; - int j = 0; - do { - _cfiphBuffer[j] = READ_BE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]); - i += 2; - ++j; - } while (i < kOffsetB3 + 8790); -} - /** * Load phoneme sound file * @remarks Originally called 'charge_phbruit' @@ -173,24 +163,6 @@ void SpeechManager::loadPhonemeSounds() { f.close(); } -/** - * Speech function - Load Noise file - * @remarks Originally called 'charge_bruit' - */ -void SpeechManager::loadNoise() { - Common::File f; - - if (!f.open("bruits")) //Translation: "noise" - error("Missing file - bruits"); - - f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); // 32000 - for (int i = 0; i < _noise5Size; ++i) - _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _noise5Buf[i]; - f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); // 19072 - - f.close(); -} - void SpeechManager::trait_car() { byte d3; int d2, i; @@ -570,8 +542,8 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { cctable(_tbi); switch (typ) { case 1: - loadNoise(); - regenbruit(); + _vm->_soundManager.loadNoise(); + _vm->_soundManager.regenbruit(); break; case 2: //TODO: Only call it once diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 4fe9a34dca..0117a61931 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -34,13 +34,8 @@ namespace Mortevielle { -const int kAdrNoise = 0x5cb0;/*2C00;*/ -const int kAdrNoise1 = 0x6924; -const int kAdrNoise3 = 0x6ba6;/*3AF6;*/ const int kAdrTroct = 0x406b; const int kAdrWord = 0x4000; -const int kOffsetB1 = 6; -const int kOffsetB3 = 6; const float kfreq0 = 1.19318e6; const int kNullValue = 255; @@ -49,13 +44,6 @@ const int kTempoNoise = 78; const int kTempoF = 80; const int kTempoM = 89; -// Useless constants -//const int segdon = 0x6c00; -//const int adbruit2 = 0x6b30;/*3A80;*/ -//const int adson2 = 0x60b0;/*3000;*/ -//const int seg_syst = 0x6fed; -//const int offsetb2 = 4; - struct SpeechQueue { int _val; int _code; @@ -88,9 +76,7 @@ public: void entroct(byte o); void veracf(byte b); void cctable(tablint &t); - void regenbruit(); void loadPhonemeSounds(); - void loadNoise(); void trait_car(); void moveQueue(); -- cgit v1.2.3 From eb61855ca02cf2d058244b49d972d36ea3e0c2a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 22:17:10 +0200 Subject: MORTEVIELLE: Avoid loading sfx and noise files multiple times --- engines/mortevielle/mortevielle.cpp | 3 +++ engines/mortevielle/speech.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c117e36636..d46dfc16ac 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -227,6 +227,9 @@ Common::ErrorCode MortevielleEngine::initialize() { _currGraphicalDevice = _newGraphicalDevice; hirs(); + _soundManager.loadNoise(); + _soundManager.loadAmbiantSounds(); + return Common::kNoError; } diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 1037d0abe4..0966930718 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -542,12 +542,9 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { cctable(_tbi); switch (typ) { case 1: - _vm->_soundManager.loadNoise(); _vm->_soundManager.regenbruit(); break; case 2: - //TODO: Only call it once - _vm->_soundManager.loadAmbiantSounds(); loadPhonemeSounds(); break; default: -- cgit v1.2.3 From e209e1583321f756a93ca253f1aca1c10f996ab9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Aug 2013 22:37:26 +0200 Subject: MORTEVIELLE: Fix check of end of stream --- engines/mortevielle/speech.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 0966930718..4940c93754 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -555,10 +555,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { if (typ != 0) { Audio::SoundHandle soundHandle; + _vm->_soundManager._audioStream->finish(); _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, _vm->_soundManager._audioStream); while (_vm->_soundManager._mixer->isSoundHandleActive(soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) ; - _vm->_soundManager._audioStream->finish(); _vm->_soundManager._mixer->stopHandle(soundHandle); _vm->_soundManager._audioStream = nullptr; } -- cgit v1.2.3 From 4e08dc04da97ffe6739a6100e39c6bab4f2717c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 10 Aug 2013 17:37:21 -0400 Subject: TSAGE: Fix for standard screens not showing after an animation ends --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index cb28d6d60b..c407aa2c64 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2066,7 +2066,7 @@ void AnimationPlayer::close() { _field38 = 0; if (g_globals != NULL) - R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr, 0); + R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr - 1, 0); } void AnimationPlayer::rleDecode(const byte *pSrc, byte *pDest, int size) { -- cgit v1.2.3 From 4b1c0b29ea3e6ab48b5a2fa8101a3a53c8e737ee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 00:01:22 +0200 Subject: MORTEVIELLE: Add an initialization of _charAnswerCount in initMaxAnswer() --- engines/mortevielle/utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 5667e6e5c0..603dc6eae4 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2877,8 +2877,10 @@ void MortevielleEngine::setPresenceFlags(int roomId) { void MortevielleEngine::initMaxAnswer() { static const byte maxAnswer[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - for (int idx = 0; idx < 9; ++idx) + for (int idx = 0; idx < 9; ++idx) { _charAnswerMax[idx] = maxAnswer[idx]; + _charAnswerCount[idx] = 0; + } } /** -- cgit v1.2.3 From f125dce608026b868fa2d705ecd1c15b3e0272ac Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 10 Aug 2013 23:25:54 +0100 Subject: GUI: Initialise _hotkey in ButtonWidget constructor One of the two ButtonWidget constructor did not initialise _hotkey when given a non-null value. This caused valgrind to report an access to uninitialised variable in Dialog::handleKeyDown(). --- gui/widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/widget.cpp b/gui/widget.cpp index d97c46a5cc..e96b62e359 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -287,7 +287,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Co ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Common::String &label, const char *tooltip, uint32 cmd, uint8 hotkey) : StaticTextWidget(boss, name, cleanupHotkey(label), tooltip), CommandSender(boss), - _cmd(cmd), _lastTime(0) { + _cmd(cmd), _hotkey(hotkey), _lastTime(0) { if (hotkey == 0) _hotkey = parseHotkey(label); setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); -- cgit v1.2.3 From 13ddf33e78109d7f1c8433a250bee66872a787fc Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 11 Aug 2013 01:08:00 +0100 Subject: MORTEVIELLE: Update English translation I checked some of the dialogs for which we were not sure, fixed them when needed and removed the debug number. There are two lines however that causes an issue as they are used for both men and women, and in English we would need a different translation. The two texts are: It is his/her business… Oh I don't have anything against him/her The first one seems to be used more often for men than women (so far I have seen it used for 3 men and 1 woman). For the second one I changed it to plural in English as it also works with the context and while it changes the meaning this is not important. --- devtools/create_mortdat/gametext.h | 48 ++++++++++++++++++------------------- dists/engine-data/mort.dat | Bin 75887 -> 75820 bytes 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index 9a4f0f7fc5..e4a54cb92a 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -165,17 +165,17 @@ const char *gameDataEn[] = { "? ?$", "Your move$", "OK !$", - "Suddenly Max arrives with your suitcase: \"Thank you for your @visit!\".Mister discreet \"private eye\" (in need of a private optici@an!). Thoroughly demoralised, you@leave the manor. You are useless!$", - "Leo interrupts: \"The storm has died down,I am going into town in@1 hour. Get ready\". You have lost@time...but not your life$", - "Congestion, the deadly flu... You@are stuck here! Your whole case@sinks slowly beneath the water$", - "The water is rising fast, freezing your last illusions. Before you@have time to react...you are dead$", - "As soon as you reach the bottom of the well, a hand cuts the rope@Farewell sweet life!$", - "The storm covers your footprints.A wall of silence falls heavily@on your shoulders. Slowly you succumb to frosbite...$", - "You're not completely alone! A cold blade plunges into your back@In future, be more careful!$", - "You don't know what implication Leo may have had in Murielle's@death. Was she dead outright? In@any case, the family problems that you have uncovered in the course@of your enquiries would explain Leo's behaviour. You're not sure@that's the reason Julia had asked@for your help, but that's reason enough for you!Out of respect for@her, after taking certain precau-@tions you have a revealing talk with Leo.$", + "Suddenly Max arrives with your suitcase: \"Thank you for your visit!\".@Mister discreet \"private eye\" (in need of a private optician!). Thoroughly demoralised, you leave the manor. You are useless!$", + "Leo interrupts: \"The storm has died down,I am going into town in 1 hour. Get ready\".@You have lost time...but not your life$", + "Congestion, the deadly flu... You are stuck here! Your whole case sinks slowly beneath the water$", + "The water is rising fast, freezing your last illusions. Before you have time to react... you are dead$", + "As soon as you reach the bottom of the well, a hand cuts the rope Farewell sweet life!$", + "The storm covers your footprints.A wall of silence falls heavily on your shoulders. Slowly you succumb to frosbite...$", + "You're not completely alone! A cold blade plunges into your back. In future, be more careful!$", + "You don't know what implication Leo may have had in Murielle's death. Was she dead outright? In any case, the family problems that you have uncovered in the course of your enquiries would explain Leo's behaviour. You're not sure that's the reason Julia had asked for your help, but that's reason enough for you! Out of respect for her, after taking certain precautions you have a revealing talk with Leo.$", "$", - "You don't have the keys to the manor. Your cries rest unheard@You're going to catch... your death!$", - "With a circular movement, the sword slices across you. Guts and@intestines spill out all over. A sorry state of affairs!$", + "You don't have the keys to the manor. Your cries rest unheard You're going to catch... your death!$", + "With a circular movement, the sword slices across you. Guts and intestines spill out all over. A sorry state of affairs!$", "Home, Sweet home !$", "The mystery behind a closed door$", "Bewitching charm of these old rooms$", @@ -338,14 +338,14 @@ const char *gameDataEn[] = { "Him! He is an upstart rogue! Perfumes must have killed his common sense. Moreover, when he's here he spends his evenings in his room$", "I was very concerned about my mother's health, and now I don't feel like doing anything at all$", "He would have done better to look after me a bit more and a bit less after his mother$", - "(313) It is his business...$", + "It is his business...$", "He does not have much luck at the moment although his business is satisfactory$", "I work with Pat but it's not going too well at the moment$", - "Oh really?! He has activities? He better take care of them seriously then$", + "Oh really?! He has occupations? He should take them seriously then$", "Him and Pat are patners. I think it's going pretty well$", "I take care of myself and that's already lots. How about you?$", - "(319) Oh that! I trust her. She knows how to keep herself busy$", - "(320) What! You have not yet discovered her main occupation..?$", + "Oh for that I trust her! She knows how to keep herself busy$", + "What! You have not yet discovered her main occupation..?$", "She is working in the decoration business, and tastefully with that. She is always very well dressed$", "If you like jewels, I have some good deals to propose for a short while$", "The jewels...$", @@ -363,19 +363,19 @@ const char *gameDataEn[] = { "He has a temper. You have to learn how to deal with him...$", "Business is business. As for the family, I leave it as it is...$", "Relations? Friendly relations? Financial relations, without a doubt$", - "Oh I don't have anything against him$", + "Oh I don't have anything against them$", "He is a resourceful businessman. He sometimes tries to swim upstream but... he will always find a way to make it work$", - "(340) They all bore me... No! Not even that... Even if... some people...$", + "They are all boring .. No! Not even that .. Even if .. some of them ..$", "Contrary to his mother, he is a very shy person ! So when you say relations...$", "He must be trying very hard to remain nice despite all his troubles$", - "(343) His romantic relationship: it's over. His relationship with me: hasn't really started. As for the other ones: I don't follow the \"other ones\"$", + "His romantic relationship: it's over. His relationship with me: hasn't really started. As for the other ones: I don't follow the \"other ones\"$", "I like everyone, as long as they are not trying to screw me over$", "It is not enough to have a bit of money and to know how to talk for everyone to like you$", "Not much to say about him... He is a nice and generous man. And what's more, he can be quite funny$", "Nowadays I get along rather well with everyone. But, here, I am not going to say more about this$", - "(348) Nice feathers, but a bird's brain... Ask her husband$", + "Nice feathers, but a bird's brain... Ask her husband$", "Is it for an appointment?$", - "(350) She is very lively! She does not burden herself with stupids prejudices$", + "She is very lively! She does not burden herself with stupids prejudices$", "In my line of work, one mostly encounters beautiful women and gangsters$", "The only sure thing he has going for him, it's his jewelery... And his wife, but he doesn't realize that$", "It's an interesting character. Who is not always very easy to follow, but worth knowing$", @@ -402,7 +402,7 @@ const char *gameDataEn[] = { "I met Julia when buying the manor. It was the only thing she owned. But all my wealth was hers...$", "Apart from a few personal belongings, I think she didn't own anything anymore$", "I think all her fortune came from Leo. So, pfft!$", - "(377) Apart from the letter for you I posted, nothing very important!$", + "Apart from the letter for you I posted, nothing very important!$", "I was very happy she gave me her bound bible as a present$", "It happened fast and she didn't have time to make any particular will$", "Her last gift suprised me$", @@ -412,15 +412,15 @@ const char *gameDataEn[] = { "Well yes! Like everyone, I believe$", "A dagger$", "I have never been looking around in the attic!$", - "(387) You either can read the past or pick a door$", + "You can either see through walls or pick a door$", "The portrait of a young girl: it's Murielle...$", "You know, I didn't know her that well$", "She was very charming, but above all she was Julia's lady-in-waiting$", "She was the only truly interesting woman I've met$", "She had a great knowledge in history, and you learned a great deal when you asked her about it$", - "(393) I've always wondered why some people fancied her!$", + "I've always wondered why some people fancied her!$", "If the room is closed, ask Leo$", - "(395) I closed her door after her death and I'd like it to remain this way for a while$", + "I closed her door after her death and I'd like it to remain this way for a while$", "You know how it is: family relations$", "All those years, I've never regretted serving her$", "I loved her as much as she loved me, I think$", @@ -429,7 +429,7 @@ const char *gameDataEn[] = { "I don't remember$", "This is Murielle. I took that picture, and actually they developed it backwards$", "You sure are curious!... It's not worth anything$", - "(404) Grimoires, parchment and manuscripts: it is Leo's realm$", + "Grimoires, parchment and manuscripts: it is Leo's realm$", "Too bad the motto doesn't appear here...$", "This is beautiful... And very old...$", "Hey! That's a place I've never visited$", diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 466c491a25..a57a866437 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From b749c2115b66a20fa6457a82eb1edf6f872fd6a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 11:39:47 +0200 Subject: MORTEVIELLE: Move the end of "sentence" to the main loop in order to fix the display --- engines/mortevielle/sound.cpp | 5 +++++ engines/mortevielle/sound.h | 2 ++ engines/mortevielle/speech.cpp | 8 +++----- engines/mortevielle/speech.h | 2 +- engines/mortevielle/utils.cpp | 3 +++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index a3ac56c27b..b3edead6f2 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -238,6 +238,11 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { if (_vm->_speechManager._typlec == 0) return; + if (!_vm->_speechManager._buildingSentence) { + if (!_mixer->isSoundHandleActive(_soundHandle)) + _mixer->stopHandle(_speakerHandle); + _vm->_speechManager._buildingSentence = true; + } int freq = tempo * 10 * 25.2; int i = 0; while (i < _vm->_speechManager._ptr_oct) { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index dccae0eaab..101a62b348 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -103,6 +103,8 @@ private: public: Audio::Mixer *_mixer; Audio::QueuingAudioStream *_audioStream; + Audio::SoundHandle _soundHandle; + SoundManager(Audio::Mixer *mixer); ~SoundManager(); diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 4940c93754..499f852b55 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -70,6 +70,7 @@ SpeechManager::SpeechManager() { _queue[i]._rep = 0; } _noise5Buf = nullptr; + _buildingSentence = false; } SpeechManager::~SpeechManager() { @@ -553,13 +554,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { handlePhoneme(); _vm->_soundManager.litph(_tbi, typ, tempo); + _vm->_speechManager._buildingSentence = false; if (typ != 0) { - Audio::SoundHandle soundHandle; _vm->_soundManager._audioStream->finish(); - _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, _vm->_soundManager._audioStream); - while (_vm->_soundManager._mixer->isSoundHandleActive(soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) - ; - _vm->_soundManager._mixer->stopHandle(soundHandle); + _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &_vm->_soundManager._soundHandle, _vm->_soundManager._audioStream); _vm->_soundManager._audioStream = nullptr; } diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 0117a61931..aa231c3536 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -58,7 +58,6 @@ private: int _phonemeNumb; SpeechQueue _queue[3]; - public: int _typlec; int _ptr_oct; @@ -67,6 +66,7 @@ public: int _mlec; byte *_noise5Buf; int _noise5Size; + bool _buildingSentence; SpeechManager(); ~SpeechManager(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 603dc6eae4..db1861c146 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -276,6 +276,9 @@ void MortevielleEngine::handleAction() { if (shouldQuit()) return; ++temps; + if (!_soundManager._mixer->isSoundHandleActive(_soundManager._soundHandle) || keyPressed() || _mouseClick) { + _soundManager._mixer->stopHandle(_soundManager._soundHandle); + } } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; -- cgit v1.2.3 From e48515d4020d22814e5ddb1a6caa64c28f4a43ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 11:45:53 +0200 Subject: MORTEVIELLE: Get rid of the PCSpeaker class --- engines/mortevielle/sound.cpp | 111 +----------------------------------------- engines/mortevielle/sound.h | 44 ----------------- 2 files changed, 1 insertion(+), 154 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index b3edead6f2..1007ccc4aa 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -33,110 +33,8 @@ namespace Mortevielle { -/** - * Constructor - */ -PCSpeaker::PCSpeaker(int rate) { - _rate = rate; - _oscLength = 0; - _oscSamples = 0; - _remainingSamples = 0; - _volume = 255; -} - -/** - * Destructor - */ -PCSpeaker::~PCSpeaker() { -} - -/** - * Adds a new note to the queue of notes to be played. - */ -void PCSpeaker::play(int freq, uint32 length) { - assert((freq > 0) && (length > 0)); - Common::StackLock lock(_mutex); - - _pendingNotes.push(SpeakerNote(freq, length)); -} - -/** - * Stops the currently playing song - */ -void PCSpeaker::stop() { - Common::StackLock lock(_mutex); - - _remainingSamples = 0; - _pendingNotes.clear(); -} - -void PCSpeaker::setVolume(byte volume) { - _volume = volume; -} - -/** - * Return true if a song is currently playing - */ -bool PCSpeaker::isPlaying() const { - return !_pendingNotes.empty() || (_remainingSamples != 0); -} - -/** - * Method used by the mixer to pull off pending samples to play - */ -int PCSpeaker::readBuffer(int16 *buffer, const int numSamples) { - Common::StackLock lock(_mutex); - - int i; - - for (i = 0; (_remainingSamples || !_pendingNotes.empty()) && (i < numSamples); ++i) { - if (!_remainingSamples) - // Used up the current note, so queue the next one - dequeueNote(); - - buffer[i] = generateSquare(_oscSamples, _oscLength) * _volume; - if (_oscSamples++ >= _oscLength) - _oscSamples = 0; - - _remainingSamples--; - } - - // Clear the rest of the buffer - if (i < numSamples) - memset(buffer + i, 0, (numSamples - i) * sizeof(int16)); - - return numSamples; -} - -/** - * Dequeues a note from the pending note list - */ -void PCSpeaker::dequeueNote() { - SpeakerNote note = _pendingNotes.pop(); - - _oscLength = _rate / note.freq; - _oscSamples = 0; - _remainingSamples = (_rate * note.length) / 1000000; - assert((_oscLength > 0) && (_remainingSamples > 0)); -} - -/** - * Support method for generating a square wave - */ -int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { - return (x < (oscLength / 2)) ? 127 : -128; -} - -/*-------------------------------------------------------------------------*/ - -// The PC timer chip works at a frequency of 1.19318Mhz -#define TIMER_FREQUENCY 1193180 - SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; - _speakerStream = new PCSpeaker(mixer->getOutputRate()); - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, - _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); _audioStream = nullptr; _ambiantNoiseBuf = nullptr; _noiseBuf = nullptr; @@ -145,8 +43,6 @@ SoundManager::SoundManager(Audio::Mixer *mixer) { SoundManager::~SoundManager() { if (_audioStream) _audioStream->finish(); - _mixer->stopHandle(_speakerHandle); - delete _speakerStream; free(_ambiantNoiseBuf); free(_noiseBuf); } @@ -240,7 +136,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { if (!_vm->_speechManager._buildingSentence) { if (!_mixer->isSoundHandleActive(_soundHandle)) - _mixer->stopHandle(_speakerHandle); + _mixer->stopHandle(_soundHandle); _vm->_speechManager._buildingSentence = true; } int freq = tempo * 10 * 25.2; @@ -325,11 +221,6 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } } -void SoundManager::playNote(int frequency, int32 length) { - _speakerStream->play(frequency, length); -} - - void SoundManager::playSong(const byte* buf, uint size, uint loops) { int freq = kTempoMusic * 10 * 25.2; Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, freq, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 101a62b348..322648140b 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -51,52 +51,9 @@ struct SpeakerNote { } }; -/** - * This is a modified PC Speaker class that allows the queueing of an entire song - * sequence one note at a time. - */ -class PCSpeaker : public Audio::AudioStream { -private: - Common::Queue _pendingNotes; - Common::Mutex _mutex; - - int _rate; - uint32 _oscLength; - uint32 _oscSamples; - uint32 _remainingSamples; - uint32 _mixedSamples; - byte _volume; - - void dequeueNote(); -protected: - static int8 generateSquare(uint32 x, uint32 oscLength); -public: - PCSpeaker(int rate = 44100); - ~PCSpeaker(); - - /** Play a note for length microseconds. - */ - void play(int freq, uint32 length); - /** Stop the currently playing sequence */ - void stop(); - /** Adjust the volume. */ - void setVolume(byte volume); - - bool isPlaying() const; - - int readBuffer(int16 *buffer, const int numSamples); - - bool isStereo() const { return false; } - bool endOfData() const { return false; } - bool endOfStream() const { return false; } - int getRate() const { return _rate; } -}; - class SoundManager { private: MortevielleEngine *_vm; - PCSpeaker *_speakerStream; - Audio::SoundHandle _speakerHandle; byte *_ambiantNoiseBuf; byte *_noiseBuf; @@ -110,7 +67,6 @@ public: ~SoundManager(); void setParent(MortevielleEngine *vm); - void playNote(int frequency, int32 length); int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); -- cgit v1.2.3 From 17245005c340982d7cfe70c26980ce790a70ebc5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 12:40:53 +0200 Subject: MORTEVIELLE: Fix sound checks (thanks to fuzzie for pointing them out) --- engines/mortevielle/sound.cpp | 2 +- engines/mortevielle/utils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 1007ccc4aa..a39bdf5120 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -135,7 +135,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { return; if (!_vm->_speechManager._buildingSentence) { - if (!_mixer->isSoundHandleActive(_soundHandle)) + if (_mixer->isSoundHandleActive(_soundHandle)) _mixer->stopHandle(_soundHandle); _vm->_speechManager._buildingSentence = true; } diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index db1861c146..81bdb6e387 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -276,7 +276,7 @@ void MortevielleEngine::handleAction() { if (shouldQuit()) return; ++temps; - if (!_soundManager._mixer->isSoundHandleActive(_soundManager._soundHandle) || keyPressed() || _mouseClick) { + if (keyPressed() || _mouseClick) { _soundManager._mixer->stopHandle(_soundManager._soundHandle); } } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); -- cgit v1.2.3 From 4ddf729c0782d25b9e388291f197a15ecf2e0d66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 12:53:01 +0200 Subject: MORTEVIELLE: Remove some useless code and variables --- engines/mortevielle/mortevielle.cpp | 2 -- engines/mortevielle/mortevielle.h | 1 - engines/mortevielle/sound.cpp | 12 ++++++------ engines/mortevielle/speech.cpp | 21 +++++++++------------ engines/mortevielle/speech.h | 8 +++----- engines/mortevielle/utils.cpp | 13 ------------- 6 files changed, 18 insertions(+), 39 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index d46dfc16ac..3fcd8b663a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -377,7 +377,6 @@ Common::Error MortevielleEngine::run() { */ void MortevielleEngine::showIntroduction() { _dialogManager.displayIntroScreen(false); - _speechManager._mlec = 0; _dialogManager.checkForF8(142, false); if (shouldQuit()) return; @@ -403,7 +402,6 @@ void MortevielleEngine::mainGame() { for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - loadBRUIT5(); _menu.initMenu(this); charToHour(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 19e580816d..6211914b57 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -259,7 +259,6 @@ private: void displayCGAPattern(int n, Pattern *p, nhom *pal); void loadPalette(); void loadTexts(); - void loadBRUIT5(); void loadCFIEC(); void loadCFIPH(); void showTitleScreen(); diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index a39bdf5120..d1f8f789a9 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -99,8 +99,8 @@ void SoundManager::loadAmbiantSounds() { } /** - * Speech function - Load Noise file - * @remarks Originally called 'charge_bruit' + * Speech function - Load Noise files + * @remarks Originally called 'charge_bruit' and 'charge_bruit5' */ void SoundManager::loadNoise() { Common::File f1, f2; @@ -131,7 +131,7 @@ void SoundManager::regenbruit() { void SoundManager::litph(tablint &t, int typ, int tempo) { // Skip speech - if (_vm->_speechManager._typlec == 0) + if (_vm->_speechManager._soundType == 0) return; if (!_vm->_speechManager._buildingSentence) { @@ -148,9 +148,9 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { case 0: { int val = _vm->_mem[(kAdrTroct * 16) + i]; i++; - if (_vm->_speechManager._typlec == 0) + if (_vm->_speechManager._soundType == 0) warning("TODO: vclas"); - else if (_vm->_speechManager._typlec == 1) { + else if (_vm->_speechManager._soundType == 1) { debugC(5, kMortevielleSounds, "litph - duson"); const static int noiseAdr[] = {0, 17224, 17224, 33676, @@ -196,7 +196,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } break; case 4: - if (_vm->_speechManager._typlec) { + if (_vm->_speechManager._soundType) { i += 2; } else { // Speech diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 499f852b55..6ea43ad54a 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -59,7 +59,7 @@ const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; SpeechManager::SpeechManager() { - _typlec = 0; + _soundType = 0; _phonemeNumb = 0; for (int i = 0; i < 3; i++) { @@ -69,17 +69,15 @@ SpeechManager::SpeechManager() { _queue[i]._freq = 0; _queue[i]._rep = 0; } - _noise5Buf = nullptr; _buildingSentence = false; } SpeechManager::~SpeechManager() { - free(_noise5Buf); } void SpeechManager::spfrac(int wor) { _queue[2]._rep = (uint)wor >> 12; - if ((_typlec == 0) && (_queue[2]._code != 9)) + if ((_soundType == 0) && (_queue[2]._code != 9)) if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { ++_queue[2]._rep; @@ -493,8 +491,8 @@ void SpeechManager::initQueue() { void SpeechManager::handlePhoneme() { const uint16 deca[3] = {300, 30, 40}; - uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_typlec]; - uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_typlec]; + uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; + uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; int wordCount = endPos - startPos; startPos /= 2; @@ -530,8 +528,8 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { _phonemeNumb = rep; int haut = ht; - _typlec = typ; - if (_typlec != 0) { + _soundType = typ; + if (_soundType != 0) { for (int i = 0; i <= 500; ++i) savph[i] = _cfiphBuffer[i]; tempo = kTempoNoise; @@ -561,11 +559,10 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) { _vm->_soundManager._audioStream = nullptr; } - if (_typlec != 0) - for (int i = 0; i <= 500; ++i) { + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) _cfiphBuffer[i] = savph[i]; - _mlec = _typlec; - } + } _vm->setPal(_vm->_numpal); } diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index aa231c3536..43cdbd5326 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -59,14 +59,12 @@ private: int _phonemeNumb; SpeechQueue _queue[3]; public: - int _typlec; + int _soundType; + bool _buildingSentence; + int _ptr_oct; uint16 *_cfiphBuffer; int _tbi[256]; - int _mlec; - byte *_noise5Buf; - int _noise5Size; - bool _buildingSentence; SpeechManager(); ~SpeechManager(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 81bdb6e387..a5a64d604d 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2135,19 +2135,6 @@ void MortevielleEngine::loadTexts() { } -void MortevielleEngine::loadBRUIT5() { - Common::File f; - - if (!f.open("bruit5")) - error("Missing file - bruit5"); - - free(_speechManager._noise5Buf); - _speechManager._noise5Size = f.size(); - _speechManager._noise5Buf = (byte *)malloc(sizeof(byte) * _speechManager._noise5Size); - f.read(_speechManager._noise5Buf, _speechManager._noise5Size); - f.close(); -} - void MortevielleEngine::loadCFIEC() { Common::File f; -- cgit v1.2.3 From 8f8ea10c03728ad6a31b5585bd85a5c24e49ddad Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 11 Aug 2013 11:55:07 +0100 Subject: MORTEVIELLE: Improve English translation Two sentences are used for both men and women and therefore need to be gender agnostic. --- devtools/create_mortdat/gametext.h | 4 ++-- dists/engine-data/mort.dat | Bin 75820 -> 75822 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index e4a54cb92a..b1809c614c 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -338,7 +338,7 @@ const char *gameDataEn[] = { "Him! He is an upstart rogue! Perfumes must have killed his common sense. Moreover, when he's here he spends his evenings in his room$", "I was very concerned about my mother's health, and now I don't feel like doing anything at all$", "He would have done better to look after me a bit more and a bit less after his mother$", - "It is his business...$", + "It is not my business...$", "He does not have much luck at the moment although his business is satisfactory$", "I work with Pat but it's not going too well at the moment$", "Oh really?! He has occupations? He should take them seriously then$", @@ -363,7 +363,7 @@ const char *gameDataEn[] = { "He has a temper. You have to learn how to deal with him...$", "Business is business. As for the family, I leave it as it is...$", "Relations? Friendly relations? Financial relations, without a doubt$", - "Oh I don't have anything against them$", + "Oh, I have no issue with this person$", "He is a resourceful businessman. He sometimes tries to swim upstream but... he will always find a way to make it work$", "They are all boring .. No! Not even that .. Even if .. some of them ..$", "Contrary to his mother, he is a very shy person ! So when you say relations...$", diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index a57a866437..8775b46c38 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 62e4945ec4638ad66c90a5363d71166f07914b8e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 15:07:30 +0200 Subject: MORTEVIELLE: Fix warnings about converting from double to int --- engines/mortevielle/sound.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index d1f8f789a9..f96aae4357 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -139,7 +139,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { _mixer->stopHandle(_soundHandle); _vm->_speechManager._buildingSentence = true; } - int freq = tempo * 10 * 25.2; + int freq = tempo * 252; // 25.2 * 10 int i = 0; while (i < _vm->_speechManager._ptr_oct) { int idx = _vm->_mem[(kAdrTroct * 16) + i]; @@ -222,7 +222,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } void SoundManager::playSong(const byte* buf, uint size, uint loops) { - int freq = kTempoMusic * 10 * 25.2; + int freq = kTempoMusic * 252; // 25.2 * 10 Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, freq, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; -- cgit v1.2.3 From f621297dc76bb545ed5312fb941eea1da26a7052 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 17:16:30 +0200 Subject: MORTEVIELLE: Get rid of the 640Kb _mem buffer --- engines/mortevielle/mortevielle.cpp | 1 - engines/mortevielle/mortevielle.h | 2 -- engines/mortevielle/sound.cpp | 10 +++++----- engines/mortevielle/speech.cpp | 9 ++++++--- engines/mortevielle/speech.h | 5 ++--- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 3fcd8b663a..1296e645e2 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -100,7 +100,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _caff = -1; _day = 0; - memset(_mem, 0, sizeof(_mem)); _curPict = nullptr; _curAnim = nullptr; _rightFramePict = nullptr; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 6211914b57..e849138dd1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -434,8 +434,6 @@ public: int _resolutionScaler; byte _destinationArray[7][25]; - // TODO: Replace the following with proper implementations, or refactor out the code using them - byte _mem[65536 * 16]; byte *_curPict; byte *_curAnim; byte *_rightFramePict; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index f96aae4357..3198de6ee8 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -142,11 +142,11 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { int freq = tempo * 252; // 25.2 * 10 int i = 0; while (i < _vm->_speechManager._ptr_oct) { - int idx = _vm->_mem[(kAdrTroct * 16) + i]; + int idx = _vm->_speechManager._troctBuf[i]; i++; switch(idx) { case 0: { - int val = _vm->_mem[(kAdrTroct * 16) + i]; + int val = _vm->_speechManager._troctBuf[i]; i++; if (_vm->_speechManager._soundType == 0) warning("TODO: vclas"); @@ -187,10 +187,10 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { break; } case 2: { - int val = _vm->_mem[(kAdrTroct * 16) + i]; + int val = _vm->_speechManager._troctBuf[i]; i++; int tmpidx = (val * 12) + 268; - val = _vm->_mem[(kAdrTroct * 16) + i]; + val = _vm->_speechManager._troctBuf[i]; i++; warning("TODO: reech %d %d", tmpidx, val); } @@ -200,7 +200,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { i += 2; } else { // Speech - warning("TODO: Interphoneme: consonne:%d voyelle:%d", _vm->_mem[(kAdrTroct * 16) + i], _vm->_mem[(kAdrTroct * 16) + i + 1]); + warning("TODO: Interphoneme: consonne:%d voyelle:%d", _vm->_speechManager._troctBuf[i], _vm->_speechManager._troctBuf[i + 1]); i += 2; } break; diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index 6ea43ad54a..6c90c8ea26 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -88,7 +88,8 @@ void SpeechManager::spfrac(int wor) { } void SpeechManager::charg_car(int &currWordNumb) { - int wor = READ_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb]); + assert(currWordNumb < 1712); + int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { @@ -128,7 +129,8 @@ void SpeechManager::charg_car(int &currWordNumb) { void SpeechManager::entroct(byte o) { - _vm->_mem[(kAdrTroct * 16) + _ptr_oct] = o; + assert(_ptr_oct < 10576); + _troctBuf[_ptr_oct] = o; ++_ptr_oct; } @@ -497,8 +499,9 @@ void SpeechManager::handlePhoneme() { startPos /= 2; endPos /= 2; + assert((endPos - startPos) < 1711); for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) - WRITE_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]); + WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); _ptr_oct = 0; int currWord = 0; diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 43cdbd5326..c21d3a44c8 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -34,9 +34,6 @@ namespace Mortevielle { -const int kAdrTroct = 0x406b; -const int kAdrWord = 0x4000; - const float kfreq0 = 1.19318e6; const int kNullValue = 255; const int kTempoMusic = 71; @@ -58,7 +55,9 @@ private: int _phonemeNumb; SpeechQueue _queue[3]; + byte _wordBuf[1712]; public: + byte _troctBuf[10576]; int _soundType; bool _buildingSentence; -- cgit v1.2.3 From 54f391a6899cc46c651ba0d077ae5ea47fc32dd5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 18:09:40 +0200 Subject: MORTEVIELLE: Merge SpeechManager and SoundManager --- engines/mortevielle/actions.cpp | 15 +- engines/mortevielle/dialogs.cpp | 3 +- engines/mortevielle/module.mk | 1 - engines/mortevielle/mortevielle.cpp | 3 +- engines/mortevielle/mortevielle.h | 2 - engines/mortevielle/sound.cpp | 559 ++++++++++++++++++++++++++++++++++- engines/mortevielle/sound.h | 62 ++-- engines/mortevielle/speech.cpp | 575 ------------------------------------ engines/mortevielle/speech.h | 87 ------ engines/mortevielle/utils.cpp | 32 +- 10 files changed, 610 insertions(+), 729 deletions(-) delete mode 100644 engines/mortevielle/speech.cpp delete mode 100644 engines/mortevielle/speech.h diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 361917d53b..3e3db5b224 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -30,7 +30,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" @@ -630,7 +629,7 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); @@ -699,7 +698,7 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); @@ -800,7 +799,7 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) _endGame = true; @@ -810,7 +809,7 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { _coreVar._currPlace = CRYPT; @@ -932,7 +931,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _speechManager.startSpeech(11, rand, 1); + _soundManager.startSpeech(11, rand, 1); int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); int l = _roomDoorId; if (l != OWN_ROOM) { @@ -1146,7 +1145,7 @@ void MortevielleEngine::fctEnter() { _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); int charIndex = convertBitIndexToCharacterIndex(z); @@ -1167,7 +1166,7 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); _coreVar._currPlace = _roomDoorId; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index ba5d984886..264839c158 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -30,7 +30,6 @@ #include "mortevielle/dialogs.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/str.h" @@ -428,7 +427,7 @@ void DialogManager::drawF3F8() { void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { - _vm->_speechManager.startSpeech(SpeechNum, 0, 0); + _vm->_soundManager.startSpeech(SpeechNum, 0, 0); _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index e18657cb6a..a9f02c2a67 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -12,7 +12,6 @@ MODULE_OBJS := \ outtext.o \ saveload.o \ sound.o \ - speech.o \ utils.o # This module can be built as a plugin diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1296e645e2..0b6b82c1a9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -56,7 +56,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _mouse.setParent(this); _text.setParent(this); _soundManager.setParent(this); - _speechManager.setParent(this); _savegameManager.setParent(this); _lastGameFrame = 0; @@ -365,7 +364,7 @@ Common::Error MortevielleEngine::run() { // Cleanup (allocated in initialize()) _screenSurface.free(); - free(_speechManager._cfiphBuffer); + free(_soundManager._cfiphBuffer); free(_cfiecBuffer); return Common::kNoError; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index e849138dd1..699ee3f37a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -44,7 +44,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" -#include "mortevielle/speech.h" #include "mortevielle/outtext.h" namespace Mortevielle { @@ -445,7 +444,6 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; - SpeechManager _speechManager; Menu _menu; MouseHandler _mouse; TextHandler _text; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 3198de6ee8..3fd47de714 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -33,11 +33,45 @@ namespace Mortevielle { + const byte _tnocon[364] = { + 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 byte _intcon[26] = {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 byte _typcon[26] = {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 byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; + const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; + SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; _audioStream = nullptr; _ambiantNoiseBuf = nullptr; _noiseBuf = nullptr; + + _soundType = 0; + _phonemeNumb = 0; + + for (int i = 0; i < 3; i++) { + _queue[i]._val = 0; + _queue[i]._code = 0; + _queue[i]._acc = 0; + _queue[i]._freq = 0; + _queue[i]._rep = 0; + } + _buildingSentence = false; } SoundManager::~SoundManager() { @@ -124,33 +158,33 @@ void SoundManager::loadNoise() { void SoundManager::regenbruit() { int i = 69876; for (int j = 0; j < 100; j++) { - _vm->_speechManager._cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); + _cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); i += 2; } } void SoundManager::litph(tablint &t, int typ, int tempo) { // Skip speech - if (_vm->_speechManager._soundType == 0) + if (_soundType == 0) return; - if (!_vm->_speechManager._buildingSentence) { + if (!_buildingSentence) { if (_mixer->isSoundHandleActive(_soundHandle)) _mixer->stopHandle(_soundHandle); - _vm->_speechManager._buildingSentence = true; + _buildingSentence = true; } int freq = tempo * 252; // 25.2 * 10 int i = 0; - while (i < _vm->_speechManager._ptr_oct) { - int idx = _vm->_speechManager._troctBuf[i]; + while (i < _ptr_oct) { + int idx = _troctBuf[i]; i++; switch(idx) { case 0: { - int val = _vm->_speechManager._troctBuf[i]; + int val = _troctBuf[i]; i++; - if (_vm->_speechManager._soundType == 0) + if (_soundType == 0) warning("TODO: vclas"); - else if (_vm->_speechManager._soundType == 1) { + else if (_soundType == 1) { debugC(5, kMortevielleSounds, "litph - duson"); const static int noiseAdr[] = {0, 17224, 17224, 33676, @@ -187,20 +221,20 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { break; } case 2: { - int val = _vm->_speechManager._troctBuf[i]; + int val = _troctBuf[i]; i++; int tmpidx = (val * 12) + 268; - val = _vm->_speechManager._troctBuf[i]; + val = _troctBuf[i]; i++; warning("TODO: reech %d %d", tmpidx, val); } break; case 4: - if (_vm->_speechManager._soundType) { + if (_soundType) { i += 2; } else { // Speech - warning("TODO: Interphoneme: consonne:%d voyelle:%d", _vm->_speechManager._troctBuf[i], _vm->_speechManager._troctBuf[i + 1]); + warning("TODO: Interphoneme: consonne:%d voyelle:%d", _troctBuf[i], _troctBuf[i + 1]); i += 2; } break; @@ -211,9 +245,9 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { if (idx == 62) warning("TODO: blab"); else if (idx == 35) { - if (i < _vm->_speechManager._ptr_oct) + if (i < _ptr_oct) warning("unexpected 35"); - i = _vm->_speechManager._ptr_oct; + i = _ptr_oct; } else warning("Other code: %d", idx); break; @@ -237,4 +271,499 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) { void SoundManager::setParent(MortevielleEngine *vm) { _vm = vm; } + +void SoundManager::spfrac(int wor) { + _queue[2]._rep = (uint)wor >> 12; + if ((_soundType == 0) && (_queue[2]._code != 9)) + if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || + ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { + ++_queue[2]._rep; + } + + _queue[2]._freq = ((uint)wor >> 6) & 7; + _queue[2]._acc = ((uint)wor >> 9) & 7; +} + +void SoundManager::charg_car(int &currWordNumb) { + assert(currWordNumb < 1712); + int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); + int int_ = wor & 0x3f; // 63 + + if ((int_ >= 0) && (int_ <= 13)) { + _queue[2]._val = int_; + _queue[2]._code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + _queue[2]._val = int_; + _queue[2]._code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { + int_ -= 22; + _queue[2]._val = int_; + _queue[2]._code = _typcon[int_]; + } else if ((int_ >= 48) && (int_ <= 56)) { + _queue[2]._val = int_ - 22; + _queue[2]._code = 4; + } else { + switch (int_) { + case 60: + _queue[2]._val = 32; /* " " */ + _queue[2]._code = 9; + break; + case 61: + _queue[2]._val = 46; /* "." */ + _queue[2]._code = 9; + break; + case 62: + _queue[2]._val = 35; /* "#" */ + _queue[2]._code = 9; + default: + break; + } + } + + spfrac(wor); + currWordNumb += 2; +} + + +void SoundManager::entroct(byte o) { + assert(_ptr_oct < 10576); + _troctBuf[_ptr_oct] = o; + ++_ptr_oct; +} + +void SoundManager::veracf(byte b) { + ; +} + +void SoundManager::cctable(tablint &t) { + float tb[257]; + + tb[0] = 0; + for (int k = 0; k <= 255; ++k) { + tb[k + 1] = _vm->_addFix + tb[k]; + t[255 - k] = abs((int)tb[k] + 1); + } +} + +/** + * Load phoneme sound file + * @remarks Originally called 'charge_phbruit' + */ +void SoundManager::loadPhonemeSounds() { + Common::File f; + + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= f.size() / 2; ++i) + _cfiphBuffer[i] = f.readUint16BE(); + + f.close(); +} + +void SoundManager::trait_car() { + byte d3; + int d2, i; + + switch (_queue[1]._code) { + case 9: + if (_queue[1]._val != (int)'#') + for (i = 0; i <= _queue[1]._rep; ++i) + entroct(_queue[1]._val); + break; + case 5: + case 6: + if (_queue[1]._code == 6) + d3 = _tabdph[(_queue[1]._val - 14) << 1]; + else + d3 = kNullValue; + if (_queue[0]._code >= 5) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { + entroct(4); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(22); + } + } + + switch (_queue[1]._rep) { + case 0: + entroct(0); + entroct(_queue[1]._val); + if (d3 == kNullValue) + if (_queue[2]._code == 9) + entroct(2); + else + entroct(4); + else if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + break; + case 4: + case 5: + case 6: + if (_queue[1]._rep != 4) { + i = _queue[1]._rep - 5; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(4); + entroct(_queue[1]._val); + entroct(0); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(3); + } + + break; + case 7: + case 8: + case 9: + if (_queue[1]._rep != 7) { + i = _queue[1]._rep - 8; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(0); + entroct(_queue[1]._val); + entroct(2); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(0); + } + break; + case 1: + case 2: + case 3: + if (_queue[1]._rep != 1) { + i = _queue[1]._rep - 2; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + entroct(0); + entroct(_queue[1]._val); + if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + + break; + default: + break; + } // switch c2.rep + break; + + case 2: + case 3: + d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel + if (_queue[0]._code > 4) { + veracf(_queue[1]._acc); + if (_queue[0]._code == 9) { + entroct(4); + entroct(d3); + entroct(22); + } + } + i = _queue[1]._rep; + assert(i >= 0); + if (i != 0) { + do { + --i; + entroct(0); + entroct(d3); + entroct(3); + } while (i > 0); + } + veracf(_queue[2]._acc); + if (_queue[2]._code == 6) { + entroct(4); + entroct(_tabdph[(_queue[2]._val - 14) << 1]); + entroct(_queue[1]._val); + } else { + entroct(4); + if (_queue[2]._val == 4) + entroct(3); + else + entroct(_queue[2]._val); + entroct(_queue[1]._val); + } + break; + case 0: + case 1: + veracf(_queue[1]._acc); + switch (_queue[2]._code) { + case 2: + d2 = 7; + break; + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 10; + break; + } // switch c3._code + d2 = (d2 * 26) + _queue[1]._val; + if (_tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; + if (_queue[1]._rep >= 5) { + _queue[1]._rep -= 5; + d3 = 8 - d3; // Swap 2 and 6 + } + if (_queue[1]._code == 0) { + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } else { + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } while (i > 0); + } + } + if (_queue[2]._code == 9) { + entroct(d3); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) + _queue[1]._val = 16; + + entroct(4); + entroct(d2); + entroct(_queue[1]._val); + } + + break; + case 4: + veracf(_queue[1]._acc); + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(2); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(2); + entroct(_queue[1]._val); + entroct(4); + if (_queue[2]._code == 9) { + entroct(2); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + veracf(_queue[2]._acc); + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + entroct(4); + entroct(d2); + entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); + } + + break; + default: + break; + } // switch c2.code +} + +/** + * Make the queue evolve by 1 value + * @remarks Originally called 'rot_chariot' + */ +void SoundManager::moveQueue() { + _queue[0] = _queue[1]; + _queue[1] = _queue[2]; + _queue[2]._val = 32; + _queue[2]._code = 9; +} + +/** + * initialize the queue + * @remarks Originally called 'init_chariot' + */ +void SoundManager::initQueue() { + _queue[2]._rep = 0; + _queue[2]._freq = 0; + _queue[2]._acc = 0; + moveQueue(); + moveQueue(); +} + +/** + * Handle a phoneme + * @remarks Originally called 'trait_ph' + */ +void SoundManager::handlePhoneme() { + const uint16 deca[3] = {300, 30, 40}; + + uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; + uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; + int wordCount = endPos - startPos; + + startPos /= 2; + endPos /= 2; + assert((endPos - startPos) < 1711); + for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) + WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); + + _ptr_oct = 0; + int currWord = 0; + initQueue(); + + do { + moveQueue(); + charg_car(currWord); + trait_car(); + } while (currWord < wordCount); + + moveQueue(); + trait_car(); + entroct((int)'#'); +} + +/** + * Start speech + * @remarks Originally called 'parole' + */ +void SoundManager::startSpeech(int rep, int ht, int typ) { + uint16 savph[501]; + int tempo; + + if (_vm->_soundOff) + return; + + _phonemeNumb = rep; + int haut = ht; + _soundType = typ; + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + savph[i] = _cfiphBuffer[i]; + tempo = kTempoNoise; + } else if (haut > 5) + tempo = kTempoF; + else + tempo = kTempoM; + _vm->_addFix = (float)((tempo - 8)) / 256; + cctable(_tbi); + switch (typ) { + case 1: + regenbruit(); + break; + case 2: + loadPhonemeSounds(); + break; + default: + break; + } + handlePhoneme(); + litph(_tbi, typ, tempo); + + _buildingSentence = false; + if (typ != 0) { + _audioStream->finish(); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream); + _audioStream = nullptr; + } + + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + _cfiphBuffer[i] = savph[i]; + } + _vm->setPal(_vm->_numpal); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 322648140b..e52de32d04 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -36,45 +36,69 @@ namespace Mortevielle { class MortevielleEngine; -typedef int tablint[256]; - -/** - * Structure used to store pending notes to play - */ -struct SpeakerNote { - int freq; - uint32 length; - - SpeakerNote(int noteFreq, uint32 noteLength) { - freq = noteFreq; - length = noteLength; - } +const int kNullValue = 255; +const int kTempoMusic = 71; +const int kTempoNoise = 78; +const int kTempoF = 80; +const int kTempoM = 89; + +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; }; +typedef int tablint[256]; + class SoundManager { private: MortevielleEngine *_vm; + byte *_ambiantNoiseBuf; byte *_noiseBuf; + int _phonemeNumb; + int _soundType; + SpeechQueue _queue[3]; + byte _wordBuf[1712]; + byte _troctBuf[10576]; + bool _buildingSentence; + int _ptr_oct; + int _tbi[256]; -public: - Audio::Mixer *_mixer; Audio::QueuingAudioStream *_audioStream; - Audio::SoundHandle _soundHandle; + void loadPhonemeSounds(); + void moveQueue(); + void initQueue(); + void handlePhoneme(); + + void spfrac(int wor); + void charg_car(int &currWordNumb); + void entroct(byte o); + void veracf(byte b); + void cctable(tablint &t); + void trait_car(); + void regenbruit(); + void litph(tablint &t, int typ, int tempo); + +public: SoundManager(Audio::Mixer *mixer); ~SoundManager(); + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; + uint16 *_cfiphBuffer; + void setParent(MortevielleEngine *vm); int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); void loadAmbiantSounds(); void loadNoise(); - - void regenbruit(); - void litph(tablint &t, int typ, int tempo); + void startSpeech(int rep, int ht, int typ); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp deleted file mode 100644 index 6c90c8ea26..0000000000 --- a/engines/mortevielle/speech.cpp +++ /dev/null @@ -1,575 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#include "mortevielle/mortevielle.h" - -#include "mortevielle/speech.h" -#include "mortevielle/sound.h" - -#include "audio/decoders/raw.h" -#include "common/endian.h" -#include "common/file.h" - -namespace Mortevielle { - -const byte _tnocon[364] = { - 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 byte _intcon[26] = {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 byte _typcon[26] = {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 byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; - -SpeechManager::SpeechManager() { - _soundType = 0; - _phonemeNumb = 0; - - for (int i = 0; i < 3; i++) { - _queue[i]._val = 0; - _queue[i]._code = 0; - _queue[i]._acc = 0; - _queue[i]._freq = 0; - _queue[i]._rep = 0; - } - _buildingSentence = false; -} - -SpeechManager::~SpeechManager() { -} - -void SpeechManager::spfrac(int wor) { - _queue[2]._rep = (uint)wor >> 12; - if ((_soundType == 0) && (_queue[2]._code != 9)) - if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || - ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { - ++_queue[2]._rep; - } - - _queue[2]._freq = ((uint)wor >> 6) & 7; - _queue[2]._acc = ((uint)wor >> 9) & 7; -} - -void SpeechManager::charg_car(int &currWordNumb) { - assert(currWordNumb < 1712); - int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); - int int_ = wor & 0x3f; // 63 - - if ((int_ >= 0) && (int_ <= 13)) { - _queue[2]._val = int_; - _queue[2]._code = 5; - } else if ((int_ >= 14) && (int_ <= 21)) { - _queue[2]._val = int_; - _queue[2]._code = 6; - } else if ((int_ >= 22) && (int_ <= 47)) { - int_ -= 22; - _queue[2]._val = int_; - _queue[2]._code = _typcon[int_]; - } else if ((int_ >= 48) && (int_ <= 56)) { - _queue[2]._val = int_ - 22; - _queue[2]._code = 4; - } else { - switch (int_) { - case 60: - _queue[2]._val = 32; /* " " */ - _queue[2]._code = 9; - break; - case 61: - _queue[2]._val = 46; /* "." */ - _queue[2]._code = 9; - break; - case 62: - _queue[2]._val = 35; /* "#" */ - _queue[2]._code = 9; - default: - break; - } - } - - spfrac(wor); - currWordNumb += 2; -} - - -void SpeechManager::entroct(byte o) { - assert(_ptr_oct < 10576); - _troctBuf[_ptr_oct] = o; - ++_ptr_oct; -} - -void SpeechManager::veracf(byte b) { - ; -} - -void SpeechManager::cctable(tablint &t) { - float tb[257]; - - tb[0] = 0; - for (int k = 0; k <= 255; ++k) { - tb[k + 1] = _vm->_addFix + tb[k]; - t[255 - k] = abs((int)tb[k] + 1); - } -} - -/** - * Load phoneme sound file - * @remarks Originally called 'charge_phbruit' - */ -void SpeechManager::loadPhonemeSounds() { - Common::File f; - - if (!f.open("phbrui.mor")) - error("Missing file - phbrui.mor"); - - for (int i = 1; i <= f.size() / 2; ++i) - _cfiphBuffer[i] = f.readUint16BE(); - - f.close(); -} - -void SpeechManager::trait_car() { - byte d3; - int d2, i; - - switch (_queue[1]._code) { - case 9: - if (_queue[1]._val != (int)'#') - for (i = 0; i <= _queue[1]._rep; ++i) - entroct(_queue[1]._val); - break; - case 5: - case 6: - if (_queue[1]._code == 6) - d3 = _tabdph[(_queue[1]._val - 14) << 1]; - else - d3 = kNullValue; - if (_queue[0]._code >= 5) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(22); - } - } - - switch (_queue[1]._rep) { - case 0: - entroct(0); - entroct(_queue[1]._val); - if (d3 == kNullValue) - if (_queue[2]._code == 9) - entroct(2); - else - entroct(4); - else if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - break; - case 4: - case 5: - case 6: - if (_queue[1]._rep != 4) { - i = _queue[1]._rep - 5; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(4); - entroct(_queue[1]._val); - entroct(0); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(3); - } - - break; - case 7: - case 8: - case 9: - if (_queue[1]._rep != 7) { - i = _queue[1]._rep - 8; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(0); - entroct(_queue[1]._val); - entroct(2); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(0); - } - break; - case 1: - case 2: - case 3: - if (_queue[1]._rep != 1) { - i = _queue[1]._rep - 2; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - entroct(0); - entroct(_queue[1]._val); - if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - - break; - default: - break; - } // switch c2.rep - break; - - case 2: - case 3: - d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel - if (_queue[0]._code > 4) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - entroct(d3); - entroct(22); - } - } - i = _queue[1]._rep; - assert(i >= 0); - if (i != 0) { - do { - --i; - entroct(0); - entroct(d3); - entroct(3); - } while (i > 0); - } - veracf(_queue[2]._acc); - if (_queue[2]._code == 6) { - entroct(4); - entroct(_tabdph[(_queue[2]._val - 14) << 1]); - entroct(_queue[1]._val); - } else { - entroct(4); - if (_queue[2]._val == 4) - entroct(3); - else - entroct(_queue[2]._val); - entroct(_queue[1]._val); - } - break; - case 0: - case 1: - veracf(_queue[1]._acc); - switch (_queue[2]._code) { - case 2: - d2 = 7; - break; - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 10; - break; - } // switch c3._code - d2 = (d2 * 26) + _queue[1]._val; - if (_tnocon[d2] == 0) - d3 = 2; - else - d3 = 6; - if (_queue[1]._rep >= 5) { - _queue[1]._rep -= 5; - d3 = 8 - d3; // Swap 2 and 6 - } - if (_queue[1]._code == 0) { - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } else { - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } while (i > 0); - } - } - if (_queue[2]._code == 9) { - entroct(d3); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) - _queue[1]._val = 16; - - entroct(4); - entroct(d2); - entroct(_queue[1]._val); - } - - break; - case 4: - veracf(_queue[1]._acc); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(2); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(2); - entroct(_queue[1]._val); - entroct(4); - if (_queue[2]._code == 9) { - entroct(2); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - entroct(4); - entroct(d2); - entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); - } - - break; - default: - break; - } // switch c2.code -} - -/** - * Make the queue evolve by 1 value - * @remarks Originally called 'rot_chariot' - */ -void SpeechManager::moveQueue() { - _queue[0] = _queue[1]; - _queue[1] = _queue[2]; - _queue[2]._val = 32; - _queue[2]._code = 9; -} - -/** - * initialize the queue - * @remarks Originally called 'init_chariot' - */ -void SpeechManager::initQueue() { - _queue[2]._rep = 0; - _queue[2]._freq = 0; - _queue[2]._acc = 0; - moveQueue(); - moveQueue(); -} - -/** - * Handle a phoneme - * @remarks Originally called 'trait_ph' - */ -void SpeechManager::handlePhoneme() { - const uint16 deca[3] = {300, 30, 40}; - - uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; - uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; - int wordCount = endPos - startPos; - - startPos /= 2; - endPos /= 2; - assert((endPos - startPos) < 1711); - for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) - WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); - - _ptr_oct = 0; - int currWord = 0; - initQueue(); - - do { - moveQueue(); - charg_car(currWord); - trait_car(); - } while (currWord < wordCount); - - moveQueue(); - trait_car(); - entroct((int)'#'); -} - -/** - * Start speech - * @remarks Originally called 'parole' - */ -void SpeechManager::startSpeech(int rep, int ht, int typ) { - uint16 savph[501]; - int tempo; - - if (_vm->_soundOff) - return; - - _phonemeNumb = rep; - int haut = ht; - _soundType = typ; - if (_soundType != 0) { - for (int i = 0; i <= 500; ++i) - savph[i] = _cfiphBuffer[i]; - tempo = kTempoNoise; - } else if (haut > 5) - tempo = kTempoF; - else - tempo = kTempoM; - _vm->_addFix = (float)((tempo - 8)) / 256; - cctable(_tbi); - switch (typ) { - case 1: - _vm->_soundManager.regenbruit(); - break; - case 2: - loadPhonemeSounds(); - break; - default: - break; - } - handlePhoneme(); - _vm->_soundManager.litph(_tbi, typ, tempo); - - _vm->_speechManager._buildingSentence = false; - if (typ != 0) { - _vm->_soundManager._audioStream->finish(); - _vm->_soundManager._mixer->playStream(Audio::Mixer::kSFXSoundType, &_vm->_soundManager._soundHandle, _vm->_soundManager._audioStream); - _vm->_soundManager._audioStream = nullptr; - } - - if (_soundType != 0) { - for (int i = 0; i <= 500; ++i) - _cfiphBuffer[i] = savph[i]; - } - _vm->setPal(_vm->_numpal); -} - -void SpeechManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} -} // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h deleted file mode 100644 index c21d3a44c8..0000000000 --- a/engines/mortevielle/speech.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#ifndef MORTEVIELLE_SPEECH_H -#define MORTEVIELLE_SPEECH_H - -#include "mortevielle/sound.h" - -#include "common/scummsys.h" - -namespace Mortevielle { - -const float kfreq0 = 1.19318e6; -const int kNullValue = 255; -const int kTempoMusic = 71; -const int kTempoNoise = 78; -const int kTempoF = 80; -const int kTempoM = 89; - -struct SpeechQueue { - int _val; - int _code; - int _acc; - int _freq; - int _rep; -}; - -class SpeechManager { -private: - MortevielleEngine *_vm; - - int _phonemeNumb; - SpeechQueue _queue[3]; - byte _wordBuf[1712]; -public: - byte _troctBuf[10576]; - int _soundType; - bool _buildingSentence; - - int _ptr_oct; - uint16 *_cfiphBuffer; - int _tbi[256]; - - SpeechManager(); - ~SpeechManager(); - void setParent(MortevielleEngine *vm); - void spfrac(int wor); - void charg_car(int &currWordNumb); - void entroct(byte o); - void veracf(byte b); - void cctable(tablint &t); - void loadPhonemeSounds(); - void trait_car(); - - void moveQueue(); - void initQueue(); - void handlePhoneme(); - void startSpeech(int rep, int ht, int typ); -}; - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index a5a64d604d..80f19277df 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -31,7 +31,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" #include "graphics/cursorman.h" @@ -1259,24 +1258,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) { ; } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech - _speechManager.startSpeech(10, 1, 1); + _soundManager.startSpeech(10, 1, 1); _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech - _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + _soundManager.startSpeech(9, getRandomNumber(2, 4), 1); else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech - _speechManager.startSpeech(8, 1, 1); + _soundManager.startSpeech(8, 1, 1); else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech - _speechManager.startSpeech(12, 1, 1); + _soundManager.startSpeech(12, 1, 1); else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech - _speechManager.startSpeech(13, 1, 1); + _soundManager.startSpeech(13, 1, 1); else // Type 2 : music - _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1344,7 +1343,7 @@ void MortevielleEngine::startDialog(int16 rep) { key = 0; do { - _speechManager.startSpeech(rep, haut[_caff - 69], 0); + _soundManager.startSpeech(rep, haut[_caff - 69], 0); key = _dialogManager.waitForF3F8(); if (shouldQuit()) return; @@ -2169,10 +2168,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _speechManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); + _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _speechManager._cfiphBuffer[i] = f.readUint16BE(); + _soundManager._cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2200,9 +2199,6 @@ void MortevielleEngine::music() { int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); - _addFix = (float)((kTempoMusic - 8)) / 256; - _speechManager.cctable(_speechManager._tbi); - _soundManager.playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); @@ -2388,7 +2384,7 @@ void MortevielleEngine::prepareRoom() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(1, rand, 1); + _soundManager.startSpeech(1, rand, 1); clearVerbBar(); } } @@ -2514,7 +2510,7 @@ void MortevielleEngine::initCaveOrCellar() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(2, rand, 1); + _soundManager.startSpeech(2, rand, 1); // The original was doing here a useless loop. // It has been removed @@ -3214,9 +3210,9 @@ L1: _crep = 138; handleDescriptionText(2, _crep); if (_crep == 138) - _speechManager.startSpeech(5, 2, 1); + _soundManager.startSpeech(5, 2, 1); else - _speechManager.startSpeech(4, 4, 1); + _soundManager.startSpeech(4, 4, 1); if (_openObjCount == 0) _coreVar._faithScore += 2; @@ -3241,7 +3237,7 @@ L1: } else { handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(3, rand, 1); + _soundManager.startSpeech(3, rand, 1); clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); -- cgit v1.2.3 From 43b729cae8c2f98cb38b94a5f9caf3bd80d8afab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Aug 2013 19:13:21 +0200 Subject: MORTEVIELLE: Remove useless code --- engines/mortevielle/sound.cpp | 14 ++------------ engines/mortevielle/sound.h | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 3fd47de714..45f91aba5c 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -274,11 +274,12 @@ void SoundManager::setParent(MortevielleEngine *vm) { void SoundManager::spfrac(int wor) { _queue[2]._rep = (uint)wor >> 12; - if ((_soundType == 0) && (_queue[2]._code != 9)) + if ((_soundType == 0) && (_queue[2]._code != 9)) { if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { ++_queue[2]._rep; } + } _queue[2]._freq = ((uint)wor >> 6) & 7; _queue[2]._acc = ((uint)wor >> 9) & 7; @@ -331,10 +332,6 @@ void SoundManager::entroct(byte o) { ++_ptr_oct; } -void SoundManager::veracf(byte b) { - ; -} - void SoundManager::cctable(tablint &t) { float tb[257]; @@ -378,7 +375,6 @@ void SoundManager::trait_car() { else d3 = kNullValue; if (_queue[0]._code >= 5) { - veracf(_queue[1]._acc); if (_queue[0]._code == 9) { entroct(4); if (d3 == kNullValue) @@ -486,7 +482,6 @@ void SoundManager::trait_car() { case 3: d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel if (_queue[0]._code > 4) { - veracf(_queue[1]._acc); if (_queue[0]._code == 9) { entroct(4); entroct(d3); @@ -503,7 +498,6 @@ void SoundManager::trait_car() { entroct(3); } while (i > 0); } - veracf(_queue[2]._acc); if (_queue[2]._code == 6) { entroct(4); entroct(_tabdph[(_queue[2]._val - 14) << 1]); @@ -519,7 +513,6 @@ void SoundManager::trait_car() { break; case 0: case 1: - veracf(_queue[1]._acc); switch (_queue[2]._code) { case 2: d2 = 7; @@ -578,7 +571,6 @@ void SoundManager::trait_car() { entroct(_queue[1]._val); entroct(5); } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); switch (_queue[2]._code) { case 3: d2 = 8; @@ -609,7 +601,6 @@ void SoundManager::trait_car() { break; case 4: - veracf(_queue[1]._acc); i = _queue[1]._rep; if (i != 0) { do { @@ -627,7 +618,6 @@ void SoundManager::trait_car() { entroct(_queue[1]._val); entroct(5); } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); switch (_queue[2]._code) { case 3: d2 = 8; diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index e52de32d04..1e4a4cd54c 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -77,7 +77,6 @@ private: void spfrac(int wor); void charg_car(int &currWordNumb); void entroct(byte o); - void veracf(byte b); void cctable(tablint &t); void trait_car(); -- cgit v1.2.3 From 9d9833537f98a24b9be37e426917856bb1193be1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Aug 2013 14:10:24 -0400 Subject: TSAGE: Added missing logic for copying foreground to background in R2R scene 1100 --- engines/tsage/core.cpp | 4 ++-- engines/tsage/core.h | 2 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 +- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7ca529f2ed..6b4e2963a5 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2762,8 +2762,8 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum, fixPriority(priority); } -void BackgroundSceneObject::proc27() { - warning("STUB: BackgroundSceneObject::proc27()"); +void BackgroundSceneObject::copySceneToBackground() { + GLOBALS._sceneManager._scene->_backSurface.copyFrom(g_globals->gfxManager().getSurface(), 0, 0); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 1f9d7cd3a5..f7a5a43b16 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -613,7 +613,7 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void draw(); void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority, int32 arg10); - void proc27(); + static void copySceneToBackground(); }; class SceneText : public SceneObject { diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c407aa2c64..cb28d6d60b 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2066,7 +2066,7 @@ void AnimationPlayer::close() { _field38 = 0; if (g_globals != NULL) - R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr - 1, 0); + R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr, 0); } void AnimationPlayer::rleDecode(const byte *pSrc, byte *pDest, int size) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 8d165fba07..6ea53d0852 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1062,7 +1062,7 @@ void Scene1100::signal() { setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_actor18, NULL); break; case 9: - _object1.proc27(); + _object1.copySceneToBackground(); _actor15.postInit(); _actor15.setup(1103, 2, 1); @@ -1076,7 +1076,7 @@ void Scene1100::signal() { _actor13.setAction(&_sequenceManager2, this, 1108, &_actor13, NULL); break; case 11: { - setAction(&_sequenceManager1, this, 1116, &_actor11, &_actor10, &_actor12, NULL); + setAction(&_sequenceManager1, this, 1106, &_actor11, &_actor10, &_actor12, NULL); R2_GLOBALS._player._effect = 5; R2_GLOBALS._player.setup(1102, 3, 2); R2_GLOBALS._player.setPosition(Common::Point(-50, 131)); -- cgit v1.2.3 From 9966f195233539dafdf6d01bf70847ddab3b903b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Aug 2013 16:13:53 -0400 Subject: TSAGE: Workaround to allow debugging animation scenes easier --- engines/tsage/ringworld2/ringworld2_logic.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index cb28d6d60b..f1f9f9fe5a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -323,6 +323,12 @@ SceneExt::SceneExt(): Scene() { _savedUiEnabled = false; _savedCanWalk = false; _focusObject = NULL; + + // WORKAROUND: In the original, playing animations don't reset the global _animationCtr + // counter as scene changes unless the playing animation explicitly finishes. For now, + // to make inter-scene debugging easier, I'm explicitly resetting the _animationCtr + // on scene start, since scene objects aren't drawn while it's non-zero + R2_GLOBALS._animationCtr = 0; } void SceneExt::postInit(SceneObjectList *OwnerList) { -- cgit v1.2.3 From 4f360a703a70b697cad8de58485858555ed8faa8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Aug 2013 16:14:19 -0400 Subject: TSAGE: Minor comments and constant fix for text display in R2R scene 300 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 ++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index ead4f5c770..da7948ff31 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3394,9 +3394,11 @@ void Scene300::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._events.setCursor(CURSOR_ARROW); if (R2_GLOBALS.getFlag(51)) { + // Things don't seem right _sceneMode = 13; _stripManager.start3(300, this, R2_GLOBALS._stripManager_lookupList); } else { + // Back in Ringworld space _sceneMode = 11; _stripManager.start3(200, this, R2_GLOBALS._stripManager_lookupList); } diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index b8d593b90a..cd2ff669ff 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -76,7 +76,7 @@ void VisualSpeaker::signal() { if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { // TODO: Check global that is passed - setFrame2(/* word_55F90 */ 0); + setFrame2(/* word_55F90 */ 1); } } else if (_action && _object2) { _action->setDelay(1); -- cgit v1.2.3 From 6454721e31c01fc94be2cdc1ffb0852c3c8a33b8 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 12 Aug 2013 00:11:10 +0200 Subject: VIDEO: Set stereo as bool instead of writing channel amount directly --- video/theora_decoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp index 53e528faf2..a0ee0a36b4 100644 --- a/video/theora_decoder.cpp +++ b/video/theora_decoder.cpp @@ -335,7 +335,7 @@ TheoraDecoder::VorbisAudioTrack::VorbisAudioTrack(Audio::Mixer::SoundType soundT vorbis_block_init(&_vorbisDSP, &_vorbisBlock); info = &vorbisInfo; - _audStream = Audio::makeQueuingAudioStream(vorbisInfo.rate, vorbisInfo.channels); + _audStream = Audio::makeQueuingAudioStream(vorbisInfo.rate, vorbisInfo.channels != 1); _audioBufferFill = 0; _audioBuffer = 0; -- cgit v1.2.3 From 41c1ea29b3ae0f0846199ad825718bbdfdeeb846 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Mon, 12 Aug 2013 00:33:41 +0200 Subject: WINTERMUTE: Add detection for Blue Madonna-demo. --- engines/wintermute/detection_tables.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 3d9afe7c97..702c0b28ba 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -141,6 +141,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Carol Reed 7 - Blue Madonna (Demo) + { + "carolreed7", + "Demo", + AD_ENTRY1s("data.dcp", "0372ad0c775266f6355e9e8ae397a2f1", 103719442), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Carol Reed 7 - Blue Madonna { "carolreed7", -- cgit v1.2.3 From f7d3b0671124dba28541c56fb74edd535fdad386 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 8 Aug 2013 03:55:02 +0200 Subject: COMMON: Get rid of write version of ConfigManager::getGameDomains. This can be abused to insert Domains into the game domains without any checks. Instead, only write iterator access is given. --- base/commandLine.cpp | 5 ++--- common/config-manager.h | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base/commandLine.cpp b/base/commandLine.cpp index a39c748adc..a032f37a25 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -827,9 +827,8 @@ void upgradeTargets() { printf("Upgrading all your existing targets\n"); - Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); - Common::ConfigManager::DomainMap::iterator iter = domains.begin(); - for (iter = domains.begin(); iter != domains.end(); ++iter) { + Common::ConfigManager::DomainMap::iterator iter = ConfMan.beginGameDomains(); + for (; iter != ConfMan.endGameDomains(); ++iter) { Common::ConfigManager::Domain &dom = iter->_value; Common::String name(iter->_key); Common::String gameid(dom.getVal("gameid")); diff --git a/common/config-manager.h b/common/config-manager.h index d79f647fe3..31966cd05d 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -162,7 +162,8 @@ public: bool hasMiscDomain(const String &domName) const; const DomainMap & getGameDomains() const { return _gameDomains; } - DomainMap & getGameDomains() { return _gameDomains; } + DomainMap::iterator beginGameDomains() { return _gameDomains.begin(); } + DomainMap::iterator endGameDomains() { return _gameDomains.end(); } static void defragment(); // move in memory to reduce fragmentation void copyFrom(ConfigManager &source); -- cgit v1.2.3 From 452ffa53a6704f1a207acdba23b6f7572dd9e8ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Aug 2013 20:30:53 -0400 Subject: TAGE: Bugfixes for R2R bridge console --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 138 ++++++++++++++---------- 1 file changed, 79 insertions(+), 59 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index da7948ff31..8e4da2b66f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2976,7 +2976,7 @@ bool Scene300::Miranda::startAction(CursorType action, Event &event) { } else if (!R2_GLOBALS.getFlag(55)) { R2_GLOBALS._events.setCursor(CURSOR_ARROW); scene->_sceneMode = 10; - scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList); + scene->_stripManager.start3(201, scene, R2_GLOBALS._stripManager_lookupList); } else { scene->_sceneMode = 16; @@ -3357,7 +3357,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { break; case 325: if (!R2_GLOBALS.getFlag(44) || R2_GLOBALS.getFlag(25)) - setAction(&_sequenceManager1, this, 309, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 307, &R2_GLOBALS._player, NULL); else { R2_GLOBALS.setFlag(60); R2_GLOBALS._player.setup(302, 3, 1); @@ -3895,8 +3895,8 @@ Scene325::Scene325(): SceneExt() { } void Scene325::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(325); + SceneExt::postInit(); R2_GLOBALS.clearFlag(50); _stripManager.addSpeaker(&_quinnSpeaker); @@ -4023,7 +4023,7 @@ void Scene325::signal() { if (R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51)) { if (v != 13) { - setMessage(328, 0); + setMessage(328, v); } else { _field420 = 864; @@ -4034,7 +4034,7 @@ void Scene325::signal() { _object13.postInit(); _object13.setup(326, 4, 2); - _object13.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR))); + _object13.setPosition(Common::Point(149, 22 + (int)(_field420 * ADJUST_FACTOR))); _object13.fixPriority(21); _object10.postInit(); @@ -4045,7 +4045,7 @@ void Scene325::signal() { _object1.postInit(); _object1.setup(326, 1, 1); _object1.setPosition(Common::Point(210, 32)); - _object10.fixPriority(10); + _object1.fixPriority(10); _object2.postInit(); _object2.setup(326, 1, 1); @@ -4095,7 +4095,7 @@ void Scene325::signal() { } else if (R2_GLOBALS.getFlag(51)) { setMessage(329, (v == 12) ? 10 : v); } else { - setMessage(327, (v < 15) ? 1 : v); + setMessage(327, (v >= 15) ? 1 : v); } break; } @@ -4136,12 +4136,12 @@ void Scene325::signal() { setMessage(128, _field416); break; default: - R2_GLOBALS._player.enableControl(); - R2_GLOBALS._player._canWalk = false; - _field416 = 105; - setMessage(128, _field416); + _field416 = 0; break; } + + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; break; case 10: R2_GLOBALS._player.enableControl(); @@ -4223,31 +4223,50 @@ void Scene325::consoleAction(int id) { _icon1.hideIcon(); _icon2.hideIcon(); _icon3.hideIcon(); - // TODO: Finish - break; - case 3: - _icon1.setIcon(5); - _icon2.setIcon(6); - _icon3.setIcon(R2_GLOBALS.getFlag(50) ? 16 : 15); - break; - case 4: - case 5: - _field418 = id; - _icon1.setIcon(17); - _icon2.setIcon(18); - _icon3.setIcon(19); - break; - case 7: - consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7); + + if (id == 2 || (id == 19 && _field418 == 5 && R2_GLOBALS.getFlag(50) && + R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51))) { + _icon5.setIcon(13); + _icon4.setPosition(Common::Point(52, 107)); + _icon4._sceneRegionId = 9; + _icon4.setIcon(14); + _icon4._object2.hide(); + + } else { + _icon4.hideIcon(); + _icon5.hideIcon(); + } + + _icon6.setIcon(12); + _sceneMode = 10; + _palette.loadPalette(161); + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); break; - case 8: - R2_GLOBALS._sceneManager.changeScene(300); - case 9: - case 10: - _iconFontNumber = (id - 1) == 9 ? 50 : 52; - _text1.remove(); - _icon6.setIcon(7); + + case 22: + case 23: + case 24: + case 25: + R2_GLOBALS._player.disableControl(); + consoleAction(2); + _field412 = id; + _icon1.hideIcon(); + _icon2.hideIcon(); + _icon3.hideIcon(); + _icon4.hideIcon(); + + _icon5.setIcon(13); + _icon4.setPosition(Common::Point(52, 107)); + _icon4._sceneRegionId = 9; + _icon4.setIcon(14); + _icon4._object2.hide(); + + _icon6.setIcon(12); + _sceneMode = 10; + _palette.loadPalette(161); + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); break; + case 11: if (R2_GLOBALS.getFlag(57) && (R2_GLOBALS._player._characterIndex == 1) && !R2_GLOBALS.getFlag(25)) { R2_GLOBALS._player.disableControl(); @@ -4256,6 +4275,7 @@ void Scene325::consoleAction(int id) { _stripManager.start(403, this); } else { R2_GLOBALS._player.disableControl(); + id = 8; _text1.remove(); _icon4.setPosition(Common::Point(80, 62)); @@ -4282,6 +4302,31 @@ void Scene325::consoleAction(int id) { BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); } break; + + case 3: + _icon1.setIcon(5); + _icon2.setIcon(6); + _icon3.setIcon(R2_GLOBALS.getFlag(50) ? 16 : 15); + break; + case 4: + case 5: + _field418 = id; + _icon1.setIcon(17); + _icon2.setIcon(18); + _icon3.setIcon(19); + _icon4.setIcon(20); + break; + case 7: + consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7); + break; + case 8: + R2_GLOBALS._sceneManager.changeScene(300); + case 9: + case 10: + _iconFontNumber = (id - 1) == 9 ? 50 : 52; + _text1.remove(); + _icon6.setIcon(7); + break; case 12: _icon4.setIcon(14); _icon4._object2.hide(); @@ -4333,31 +4378,6 @@ void Scene325::consoleAction(int id) { consoleAction(4); id = 4; break; - case 22: - case 23: - case 24: - case 25: - R2_GLOBALS._player.disableControl(); - consoleAction(2); - _field412 = id; - - _icon1.hideIcon(); - _icon2.hideIcon(); - _icon3.hideIcon(); - _icon4.hideIcon(); - - _icon5.setIcon(13); - _icon4.setPosition(Common::Point(52, 107)); - _icon4._sceneRegionId = 9; - _icon4.setIcon(14); - _icon4._object2.hide(); - - _icon6.setIcon(12); - _sceneMode = 10; - _palette.loadPalette(161); - - BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); - break; case 6: default: _icon1.setIcon(1); -- cgit v1.2.3 From 3134e4a4ba3067815364a1c1ca0ccf441a463782 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Aug 2013 21:54:30 -0400 Subject: TSAGE: Fixes for R2R bridge console scanner --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 32 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes0.h | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 8e4da2b66f..8d35fc7222 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3887,7 +3887,7 @@ Scene325::Scene325(): SceneExt() { _field412 = 7; _iconFontNumber = 50; _field416 = _field418 = 0; - _field41A = _field41C = _field41E = _field420 = 0; + _field41A = _field41C = _field41E = _scannerLocation = 0; _soundCount = _soundIndex = 0; for (int idx = 0; idx < 10; ++idx) @@ -3922,7 +3922,7 @@ void Scene325::synchronize(Serializer &s) { s.syncAsSint16LE(_field41A); s.syncAsSint16LE(_field41C); s.syncAsSint16LE(_field41E); - s.syncAsSint16LE(_field420); + s.syncAsSint16LE(_scannerLocation); s.syncAsSint16LE(_soundCount); s.syncAsSint16LE(_soundIndex); @@ -4025,17 +4025,17 @@ void Scene325::signal() { if (v != 13) { setMessage(328, v); } else { - _field420 = 864; + _scannerLocation = 864; _object12.postInit(); - _object2.setup(326, 4, 1); + _object12.setup(326, 4, 1); _object12.setPosition(Common::Point(149, 128)); _object12.fixPriority(20); - _object13.postInit(); - _object13.setup(326, 4, 2); - _object13.setPosition(Common::Point(149, 22 + (int)(_field420 * ADJUST_FACTOR))); - _object13.fixPriority(21); + _scannerTab.postInit(); + _scannerTab.setup(326, 4, 2); + _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR))); + _scannerTab.fixPriority(21); _object10.postInit(); _object10.setup(326, 1, 1); @@ -4283,7 +4283,7 @@ void Scene325::consoleAction(int id) { _icon4.hideIcon(); _object12.remove(); - _object13.remove(); + _scannerTab.remove(); _object10.remove(); _object1.remove(); _object2.remove(); @@ -4336,7 +4336,7 @@ void Scene325::consoleAction(int id) { case 18: case 19: case 20: - if (_field420) { + if (_scannerLocation) { R2_GLOBALS._player.disableControl(); _field41A = 1296; _field41E = 1; @@ -4356,7 +4356,7 @@ void Scene325::consoleAction(int id) { case 18: case 19: case 20: - if (_field420 < 1620) { + if (_scannerLocation < 1620) { R2_GLOBALS._player.disableControl(); _field41A = 1296; _field41E = -1; @@ -4452,21 +4452,21 @@ void Scene325::dispatch() { if (yp >= 30) { yp -= 12; - --_field420; + --_scannerLocation; flag = true; } if (yp <= 10) { yp += 12; - ++_field420; + ++_scannerLocation; flag = true; } - _object3.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR) + 22)); + _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR))); for (int idx = 0; idx < 4; ++idx) _objList[idx].remove(); if (flag) { - int v = _field420 - 758; + int v = _scannerLocation - 758; _object10.setFrame((v++ <= 0) ? 1 : v); _object1.setFrame((v++ <= 0) ? 1 : v); _object2.setFrame((v++ <= 0) ? 1 : v); @@ -4506,7 +4506,7 @@ void Scene325::dispatch() { R2_GLOBALS._sound3.stop(); _field41C = 0; - if (_field420 == 756) { + if (_scannerLocation == 756) { R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_USE); _sceneMode = 12; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index bad946fbd6..bc30743aca 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -451,7 +451,7 @@ private: Common::String parseMessage(const Common::String &msg); public: int _field412, _iconFontNumber, _field416, _field418; - int _field41A, _field41C, _field41E, _field420; + int _field41A, _field41C, _field41E, _scannerLocation; int _soundCount, _soundIndex; int _soundQueue[10]; SpeakerQuinn _quinnSpeaker; @@ -459,7 +459,7 @@ public: SceneHotspot _background, _item2; SceneObject _object1, _object2, _object3, _object4, _object5; SceneObject _object6, _object7, _object8, _object9, _object10; - SceneObject _object11, _object12, _object13; + SceneObject _object11, _object12, _scannerTab; SceneObject _objList[4]; Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6; ASoundExt _sound1; -- cgit v1.2.3 From d05f90fa0fe71750c6126fc0f14c4215cf3bfc32 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 12 Aug 2013 04:47:11 +0200 Subject: KYRA: Fix palette glitch in Kyra3 when loading from main menu. Formerly, the main menu was shown with the palette of the first screen for a short time. Thanks to eriktorbjorn for noticing this. --- engines/kyra/scene_mr.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index c9486d9c45..d2b4907b6a 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -577,6 +577,7 @@ void KyraEngine_MR::initSceneScreen(int unk1) { } updateCharPal(0); + _screen->updateScreen(); if (!_menuDirectlyToLoad) { _emc->start(&_sceneScriptState, 3); -- cgit v1.2.3 From 160c5f4345d9d72faf3e42f1f82339d6ea9cc79e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 12 Aug 2013 04:58:27 +0200 Subject: KYRA: Fix palette glitch when quitting while viewing the family album in Kyra3. Thanks to eriktorbjorn for noticing. --- engines/kyra/screen.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 054397a34a..8c97e46a8f 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -718,6 +718,13 @@ void Screen::fadePalette(const Palette &pal, int delay, const UpdateFunctor *upF _vm->delay((delayAcc >> 8) * 1000 / 60); delayAcc &= 0xFF; } + + // In case we should quit we setup the final palette here. This avoids + // ugly palette glitches when quitting while fading. This can for example + // be noticed when quitting while viewing the family album in Kyra3. + if (_vm->shouldQuit()) { + setScreenPalette(pal); + } } void Screen::getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) { -- cgit v1.2.3 From 5e7e67beb97aebe05c254327fd31ba1e8fc3187a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Aug 2013 08:17:10 +0200 Subject: MORTEVIELLE: Improve sound support --- engines/mortevielle/sound.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 45f91aba5c..30dc4ce79f 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -218,6 +218,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { _audioStream->queueBuffer(&_ambiantNoiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); } } + i++; break; } case 2: { @@ -240,16 +241,28 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { break; case 6: warning("TODO: pari2"); + i += 2; break; default: + static byte emptyBuf[19] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if (idx == 62) warning("TODO: blab"); - else if (idx == 35) { + else if (idx == 32) { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + _audioStream->queueBuffer(emptyBuf, 19, DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } else if (idx == 35) { if (i < _ptr_oct) - warning("unexpected 35"); + warning("unexpected 35 - stop the buffering"); i = _ptr_oct; - } else - warning("Other code: %d", idx); + } else if (idx == 46) { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + for (int i = 0; i < 10; i++) + _audioStream->queueBuffer(emptyBuf, 19, DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } else { + warning("Other code: %d - %d %d", idx, _troctBuf[i], _troctBuf[i + 1]); + } break; } } @@ -364,9 +377,10 @@ void SoundManager::trait_car() { switch (_queue[1]._code) { case 9: - if (_queue[1]._val != (int)'#') + if (_queue[1]._val != (int)'#') { for (i = 0; i <= _queue[1]._rep; ++i) entroct(_queue[1]._val); + } break; case 5: case 6: @@ -703,6 +717,20 @@ void SoundManager::handlePhoneme() { moveQueue(); trait_car(); entroct((int)'#'); + +#ifdef DEBUG + warning("---"); + for (int i = 0; i < _ptr_oct; ) { + if ((_troctBuf[i] == 32) || (_troctBuf[i] == 35) || (_troctBuf[i] == 46)) { + warning("%d", _troctBuf[i]); + i++; + } else { + warning("%d %d %d", _troctBuf[i], _troctBuf[i + 1], _troctBuf[i + 1]); + i += 3; + } + } + warning("---"); +#endif } /** -- cgit v1.2.3 From a2a5d42a585f6baba1677b29655e55b7cde39a73 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 12 Aug 2013 16:43:35 +0200 Subject: GRAPHICS: Fix warnings about mismatching format arguments. --- graphics/VectorRendererSpec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 1e01744fad..e4843ba78b 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -588,7 +588,7 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { (int)(idst & _blueMask)) * alpha) >> 8))) | (idst & _alphaMask)); } else { - error("Unsupported BPP format: %d", sizeof(PixelType)); + error("Unsupported BPP format: %u", (uint)sizeof(PixelType)); } } -- cgit v1.2.3 From bb7e95f1ad7f432fd2daa90200f750b37c5c6c2e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 12 Aug 2013 16:44:35 +0200 Subject: I18N: Update po/POTFILES for bada => tizen change. --- po/POTFILES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/POTFILES b/po/POTFILES index b812620c25..869323b8f3 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -99,5 +99,5 @@ backends/events/default/default-events.cpp backends/events/gph/gph-events.cpp backends/events/openpandora/op-events.cpp backends/updates/macosx/macosx-updates.mm -backends/platform/bada/form.cpp +backends/platform/tizen/form.cpp backends/events/maemosdl/maemosdl-events.cpp -- cgit v1.2.3 From d811df89ff4c786ec36b44f598e6f373519e5e2b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Aug 2013 00:06:09 +0200 Subject: MORTEVIELLE: Fix door animation display when opening the doors --- engines/mortevielle/actions.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 3e3db5b224..f7cc239997 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1147,6 +1147,10 @@ void MortevielleEngine::fctEnter() { int randVal = (getRandomNumber(0, 10)) - 5; _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); + while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit()) + ; + // In case the handle is still active, stop it. + _mixer->stopHandle(_soundManager._soundHandle); int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; @@ -1168,6 +1172,10 @@ void MortevielleEngine::fctEnter() { int randVal = (getRandomNumber(0, 10)) - 5; _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); + while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit()) + ; + // In case the handle is still active, stop it. + _mixer->stopHandle(_soundManager._soundHandle); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); -- cgit v1.2.3 From 7c2660c97e7f851cbb1d35e494d913adea2c8653 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 13 Aug 2013 00:11:46 +0200 Subject: COMMON: Add setVal to ConfigManager::Domain. This fixes compilation in the keymapper. --- common/config-manager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/config-manager.h b/common/config-manager.h index a7c949902c..6bf56749c5 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -64,6 +64,8 @@ public: String &operator[](const String &key) { return _entries[key]; } const String &operator[](const String &key) const { return _entries[key]; } + void setVal(const String &key, const String &value) { _entries.setVal(key, value); } + String &getVal(const String &key) { return _entries.getVal(key); } const String &getVal(const String &key) const { return _entries.getVal(key); } -- cgit v1.2.3 From 7c58e9a6d57aa88590b0929110a617c6fe84a4fe Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 13 Aug 2013 00:26:58 +0200 Subject: DC: Use const version of ConfigManager::getGameDomains. This should fix compilation for the DC port. --- backends/platform/dc/selector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 339e5df62d..4026c7dde6 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -219,7 +219,7 @@ static int findGames(Game *games, int max, bool use_ini) if (use_ini) { ConfMan.loadDefaultConfigFile(); - Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); + const Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); for(Common::ConfigManager::DomainMap::const_iterator i = game_domains.begin(); curr_game < max && i != game_domains.end(); i++) { Common::String path = (*i)._value["path"]; -- cgit v1.2.3 From 3e75c5acc10259fb3cfbef4d275acbaf92cde1c0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Aug 2013 07:53:42 +0200 Subject: MORTEVIELLE: Wait for the end of sound in some more places --- engines/mortevielle/actions.cpp | 11 +++-------- engines/mortevielle/sound.cpp | 9 +++++++++ engines/mortevielle/sound.h | 1 + engines/mortevielle/utils.cpp | 3 ++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index f7cc239997..233f252c79 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -633,6 +633,7 @@ void MortevielleEngine::fctOpen() { } _openObjects[i] = _num; displayAnimFrame(1, _num); + _soundManager.waitSpeech(); } int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -1147,10 +1148,7 @@ void MortevielleEngine::fctEnter() { int randVal = (getRandomNumber(0, 10)) - 5; _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit()) - ; - // In case the handle is still active, stop it. - _mixer->stopHandle(_soundManager._soundHandle); + _soundManager.waitSpeech(); int charIndex = convertBitIndexToCharacterIndex(z); ++_coreVar._faithScore; @@ -1172,10 +1170,7 @@ void MortevielleEngine::fctEnter() { int randVal = (getRandomNumber(0, 10)) - 5; _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - while (_mixer->isSoundHandleActive(_soundManager._soundHandle) && !keyPressed() && !_mouseClick && !shouldQuit()) - ; - // In case the handle is still active, stop it. - _mixer->stopHandle(_soundManager._soundHandle); + _soundManager.waitSpeech(); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 30dc4ce79f..9fff106b61 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -784,4 +784,13 @@ void SoundManager::startSpeech(int rep, int ht, int typ) { _vm->setPal(_vm->_numpal); } +void SoundManager::waitSpeech() { + while (_mixer->isSoundHandleActive(_soundHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) + ; + // In case the handle is still active, stop it. + _mixer->stopHandle(_soundHandle); + + if (!_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit()) + g_system->delayMillis(600); +} } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 1e4a4cd54c..cc0567fd98 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -98,6 +98,7 @@ public: void loadAmbiantSounds(); void loadNoise(); void startSpeech(int rep, int ht, int typ); + void waitSpeech(); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 80f19277df..eac4546fff 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -2385,6 +2385,7 @@ void MortevielleEngine::prepareRoom() { displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; _soundManager.startSpeech(1, rand, 1); + _soundManager.waitSpeech(); clearVerbBar(); } } @@ -2511,7 +2512,7 @@ void MortevielleEngine::initCaveOrCellar() { displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; _soundManager.startSpeech(2, rand, 1); - + _soundManager.waitSpeech(); // The original was doing here a useless loop. // It has been removed -- cgit v1.2.3 From ef3c4689b3bfb558bb257da9c1c3c9d6b5dcb3ad Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Aug 2013 07:57:50 +0200 Subject: MORTEVIELLE: Remove the detection of a broken menu.mor file. Bug reported by criezy --- engines/mortevielle/detection_tables.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 689fee1222..5d59a4872b 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -37,20 +37,6 @@ static const ADGameDescription MortevielleGameDescriptions[] = { ADGF_NO_FLAGS, GUIO0() }, - // French - { - "mortevielle", - "", - { - {"menu.mor", 0, "3fef0a3f8fca99fdcb6dbca8cbcef46f", 160}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::FR_FRA, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO0() - }, // German { "mortevielle", -- cgit v1.2.3 From 0d1772b95d35a88f18977aeda5149c98cf619a0c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Aug 2013 08:34:36 +0200 Subject: MORTEVIELLE: Introduce original language in detection --- engines/mortevielle/detection.cpp | 16 ++++-- engines/mortevielle/detection_tables.h | 93 +++++++++++++++++++++------------- engines/mortevielle/mortevielle.cpp | 2 +- engines/mortevielle/mortevielle.h | 6 ++- 4 files changed, 75 insertions(+), 42 deletions(-) diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 28cbc77b8b..7d0f3c4d88 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -24,13 +24,17 @@ #include "engines/advancedDetector.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/detection_tables.h" #include "mortevielle/saveload.h" namespace Mortevielle { -uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->flags; } +struct MortevielleGameDescription { + ADGameDescription desc; + Common::Language originalLanguage; +}; + +uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->desc.flags; } -Common::Language MortevielleEngine::getLanguage() const { return _gameDescription->language; } +Common::Language MortevielleEngine::getLanguage() const { return _gameDescription->desc.language; } } @@ -39,9 +43,11 @@ static const PlainGameDescriptor MortevielleGame[] = { {0, 0} }; +#include "mortevielle/detection_tables.h" + class MortevielleMetaEngine : public AdvancedMetaEngine { public: - MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::MortevielleGameDescriptions, sizeof(ADGameDescription), + MortevielleMetaEngine() : AdvancedMetaEngine(Mortevielle::MortevielleGameDescriptions, sizeof(Mortevielle::MortevielleGameDescription), MortevielleGame) { _md5Bytes = 512; _singleid = "mortevielle"; @@ -63,7 +69,7 @@ public: bool MortevielleMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { if (desc) { - *engine = new Mortevielle::MortevielleEngine(syst, desc); + *engine = new Mortevielle::MortevielleEngine(syst, (const Mortevielle::MortevielleGameDescription *)desc); } return desc != 0; } diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 5d59a4872b..9bb5fbea87 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -22,53 +22,78 @@ namespace Mortevielle { -static const ADGameDescription MortevielleGameDescriptions[] = { +static const MortevielleGameDescription MortevielleGameDescriptions[] = { // French { - "mortevielle", - "", { - {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::FR_FRA, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO0() + "mortevielle", + "", + { + {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, Common::FR_FRA }, // German { - "mortevielle", - "", { - {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::DE_DEU, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO0() + "mortevielle", + "", + { + {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, Common::DE_DEU }, - // English. Note that this is technically the French version, but English strings in mort.dat - // will automatically replace all the French strings + // DOS English version doesn't exist. Technically, they are French or German versions, + // using English strings stored mort.dat + + // English on top of French version { - "mortevielle", - "", { - {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, - {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, - AD_LISTEND - }, - Common::EN_ANY, - Common::kPlatformDOS, - ADGF_NO_FLAGS, - GUIO0() + "mortevielle", + "", + { + {"menufr.mor", 0, "e413f36b9e14eef16130adc347a9391f", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, Common::FR_FRA }, - AD_TABLE_END_MARKER + // English on top of German version + { + { + "mortevielle", + "", + { + {"menual.mor", 0, "792aea282b07a1d74c4a4abeabc90c19", 144}, + {"dxx.mor", 0, "949e68e829ecd5ad29e36a00347a9e7e", 207744}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO0() + }, Common::DE_DEU + }, + + { AD_TABLE_END_MARKER , Common::EN_ANY} }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 0b6b82c1a9..d657bda7ab 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -46,7 +46,7 @@ namespace Mortevielle { MortevielleEngine *g_vm; -MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc): +MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc): Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"), _soundManager(_mixer) { g_vm = this; diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 699ee3f37a..820046b17c 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -169,9 +169,11 @@ struct Hint { byte _point; }; +struct MortevielleGameDescription; + class MortevielleEngine : public Engine { private: - const ADGameDescription *_gameDescription; + const MortevielleGameDescription *_gameDescription; Common::Stack _keypresses; uint32 _lastGameFrame; Common::Point _mousePos; @@ -449,7 +451,7 @@ public: TextHandler _text; DialogManager _dialogManager; - MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); + MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc); ~MortevielleEngine(); virtual bool hasFeature(EngineFeature f) const; virtual bool canLoadGameStateCurrently(); -- cgit v1.2.3 From 693c8ca5cca4c09b049ce9833cec5a76cdbbb0c7 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 13 Aug 2013 18:18:16 +0200 Subject: WINTERMUTE: Add atleast some comments to the renderTicket-system. --- .../base/gfx/osystem/base_render_osystem.h | 37 ++++++++++++++++++++-- .../wintermute/base/gfx/osystem/render_ticket.h | 13 ++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index bf2914b430..928a52d4fc 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -38,6 +38,25 @@ namespace Wintermute { class BaseSurfaceOSystem; class RenderTicket; +/** + * A 2D-renderer implementation for WME. + * This renderer makes use of a "ticket"-system, where all draw-calls + * are stored as tickets until flip() is called, and compared against the tickets + * from last frame, to determine which calls were the same as last round + * (i.e. in the exact same order, with the exact same arguments), and thus + * figure out which parts of the screen need to be redrawn. + * + * Important concepts to handle here, is the ordered number of any ticket + * which is called the "drawNum", every frame this starts from scratch, and + * then the incoming tickets created from the draw-calls are checked to see whether + * they came before, on, or after the drawNum they had last frame. Everything else + * being equal, this information is then used to check whether the draw order changed, + * which will then create a need for redrawing, as we draw with an alpha-channel here. + * + * There is also a draw path that draws without tickets, for debugging purposes, + * as well as to accomodate situations with large enough amounts of draw calls, + * that there will be too much overhead involved with comparing the generated tickets. + */ class BaseRenderOSystem : public BaseRenderer { public: BaseRenderOSystem(BaseGame *inGame); @@ -59,6 +78,11 @@ public: void invalidateTicket(RenderTicket *renderTicket); void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf); + /** + * Insert a ticket into the queue, adding a dirty rect if it's + * new, or out-of-order from last draw from the ticket. + * param renderTicket the ticket to be added. + */ void drawFromTicket(RenderTicket *renderTicket); bool setViewport(int left, int top, int right, int bottom) override; @@ -79,11 +103,18 @@ public: virtual bool startSpriteBatch() override; virtual bool endSpriteBatch() override; void endSaveLoad(); - void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform); + void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, TransformStruct &transform); void repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY); BaseSurface *createSurface() override; private: - void addDirtyRect(const Common::Rect &rect) ; + /** + * Mark a specified rect of the screen as dirty. + * @param rect the region to be marked as dirty + */ + void addDirtyRect(const Common::Rect &rect); + /** + * Traverse the tickets that are dirty, and draw them + */ void drawTickets(); // Non-dirty-rects: void drawFromSurface(RenderTicket *ticket); @@ -96,7 +127,7 @@ private: RenderTicket *_previousTicket; bool _needsFlip; - uint32 _drawNum; + uint32 _drawNum; ///< The global number of the current draw-operation. Common::Rect _renderRect; Graphics::Surface *_renderSurface; Graphics::Surface *_blankSurface; diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h index b1313e932d..875102d01c 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.h +++ b/engines/wintermute/base/gfx/osystem/render_ticket.h @@ -36,6 +36,19 @@ namespace Wintermute { class BaseSurfaceOSystem; +/** + * A single RenderTicket. + * A render ticket is a collection of the data and draw specifications made + * for a single draw-call in the OSystem-backend for WME. The ticket additionally + * holds the order in which this call was made, so that it can be detected if + * the same call is done in the following frame. Thus allowing us to potentially + * skip drawing the same region again, unless anything has changed. Since a surface + * can have a potentially large amount of draw-calls made to it, at varying rotation, + * zoom, and crop-levels we also need to hold a copy of the necessary data. + * (Video-surfaces may even change their data). The promise that is made when a ticket + * is created is that what the state was of the surface at THAT point, is what will end + * up on screen at flip() time. + */ class RenderTicket { public: RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, TransformStruct transform); -- cgit v1.2.3 From 9ea315747e9e8e8089b9ceab97b4b52c90c190fe Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan SømaĚŠen Date: Tue, 13 Aug 2013 19:09:08 +0200 Subject: WINTERMUTE: Be explicit when storing Floats in savegames. --- engines/wintermute/ad/ad_region.cpp | 2 +- engines/wintermute/ad/ad_rot_level.cpp | 2 +- engines/wintermute/ad/ad_scale_level.cpp | 2 +- engines/wintermute/ad/ad_waypoint_group.cpp | 2 +- engines/wintermute/base/base_game.cpp | 4 ++-- engines/wintermute/base/base_object.cpp | 20 ++++++++++---------- engines/wintermute/base/base_persistence_manager.cpp | 2 +- engines/wintermute/base/base_persistence_manager.h | 2 +- engines/wintermute/base/base_region.cpp | 2 +- engines/wintermute/base/particles/part_emitter.cpp | 20 ++++++++++---------- engines/wintermute/base/particles/part_particle.cpp | 10 +++++----- engines/wintermute/video/video_theora_player.cpp | 2 +- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index 444ada2433..bc9ac903c6 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -404,7 +404,7 @@ bool AdRegion::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha)); persistMgr->transfer(TMEMBER(_blocked)); persistMgr->transfer(TMEMBER(_decoration)); - persistMgr->transfer(TMEMBER(_zoom)); + persistMgr->transferFloat(TMEMBER(_zoom)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index b11fad96d7..d925b0d57a 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -153,7 +153,7 @@ bool AdRotLevel::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_rotation)); + persistMgr->transferFloat(TMEMBER(_rotation)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index 9cf7bfa600..59e6d57787 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -154,7 +154,7 @@ bool AdScaleLevel::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index cb754516b3..cc7982cb9d 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -196,7 +196,7 @@ bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); - persistMgr->transfer(TMEMBER(_lastMimicScale)); + persistMgr->transferFloat(TMEMBER(_lastMimicScale)); persistMgr->transfer(TMEMBER(_lastMimicX)); persistMgr->transfer(TMEMBER(_lastMimicY)); _points.persist(persistMgr); diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 5b88dab90e..b2c05d271d 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -3068,8 +3068,8 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_offsetX)); persistMgr->transfer(TMEMBER(_offsetY)); - persistMgr->transfer(TMEMBER(_offsetPercentX)); - persistMgr->transfer(TMEMBER(_offsetPercentY)); + persistMgr->transferFloat(TMEMBER(_offsetPercentX)); + persistMgr->transferFloat(TMEMBER(_offsetPercentY)); persistMgr->transfer(TMEMBER(_origInteractive)); persistMgr->transfer(TMEMBER_INT(_origState)); diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index 9d5548be0f..ea754f8f23 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -968,9 +968,9 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_movable)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); - persistMgr->transfer(TMEMBER(_relativeScale)); + persistMgr->transferFloat(TMEMBER(_relativeScale)); persistMgr->transfer(TMEMBER(_rotatable)); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); persistMgr->transferPtr(TMEMBER_PTR(_sFX)); persistMgr->transfer(TMEMBER(_sFXStart)); persistMgr->transfer(TMEMBER(_sFXVolume)); @@ -982,21 +982,21 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_soundEvent)); persistMgr->transfer(TMEMBER(_zoomable)); - persistMgr->transfer(TMEMBER(_scaleX)); - persistMgr->transfer(TMEMBER(_scaleY)); + persistMgr->transferFloat(TMEMBER(_scaleX)); + persistMgr->transferFloat(TMEMBER(_scaleY)); - persistMgr->transfer(TMEMBER(_rotate)); + persistMgr->transferFloat(TMEMBER(_rotate)); persistMgr->transfer(TMEMBER(_rotateValid)); - persistMgr->transfer(TMEMBER(_relativeRotate)); + persistMgr->transferFloat(TMEMBER(_relativeRotate)); persistMgr->transfer(TMEMBER(_saveState)); persistMgr->transfer(TMEMBER(_nonIntMouseEvents)); persistMgr->transfer(TMEMBER_INT(_sFXType)); - persistMgr->transfer(TMEMBER(_sFXParam1)); - persistMgr->transfer(TMEMBER(_sFXParam2)); - persistMgr->transfer(TMEMBER(_sFXParam3)); - persistMgr->transfer(TMEMBER(_sFXParam4)); + persistMgr->transferFloat(TMEMBER(_sFXParam1)); + persistMgr->transferFloat(TMEMBER(_sFXParam2)); + persistMgr->transferFloat(TMEMBER(_sFXParam3)); + persistMgr->transferFloat(TMEMBER(_sFXParam4)); persistMgr->transfer(TMEMBER_INT(_blendMode)); diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 6f0f7e289f..2e2726f361 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -637,7 +637,7 @@ bool BasePersistenceManager::transfer(const char *name, uint32 *val) { ////////////////////////////////////////////////////////////////////////// // float -bool BasePersistenceManager::transfer(const char *name, float *val) { +bool BasePersistenceManager::transferFloat(const char *name, float *val) { if (_saving) { putFloat(*val); if (_saveStream->err()) { diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h index 6949bfe278..c09b3345b7 100644 --- a/engines/wintermute/base/base_persistence_manager.h +++ b/engines/wintermute/base/base_persistence_manager.h @@ -76,7 +76,7 @@ public: bool transferPtr(const char *name, void *val); bool transfer(const char *name, int32 *val); bool transfer(const char *name, uint32 *val); - bool transfer(const char *name, float *val); + bool transferFloat(const char *name, float *val); bool transfer(const char *name, double *val); bool transfer(const char *name, bool *val); bool transfer(const char *name, byte *val); diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 61e9deefb3..36036a1f18 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -432,7 +432,7 @@ bool BaseRegion::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_editorSelectedPoint)); - persistMgr->transfer(TMEMBER(_lastMimicScale)); + persistMgr->transferFloat(TMEMBER(_lastMimicScale)); persistMgr->transfer(TMEMBER(_lastMimicX)); persistMgr->transfer(TMEMBER(_lastMimicY)); _points.persist(persistMgr); diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index 5c21988141..aaffa0965a 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -1163,12 +1163,12 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_angle1)); persistMgr->transfer(TMEMBER(_angle2)); - persistMgr->transfer(TMEMBER(_velocity1)); - persistMgr->transfer(TMEMBER(_velocity2)); + persistMgr->transferFloat(TMEMBER(_velocity1)); + persistMgr->transferFloat(TMEMBER(_velocity2)); persistMgr->transfer(TMEMBER(_velocityZBased)); - persistMgr->transfer(TMEMBER(_scale1)); - persistMgr->transfer(TMEMBER(_scale2)); + persistMgr->transferFloat(TMEMBER(_scale1)); + persistMgr->transferFloat(TMEMBER(_scale2)); persistMgr->transfer(TMEMBER(_scaleZBased)); persistMgr->transfer(TMEMBER(_maxParticles)); @@ -1196,14 +1196,14 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_alphaTimeBased)); - persistMgr->transfer(TMEMBER(_angVelocity1)); - persistMgr->transfer(TMEMBER(_angVelocity2)); + persistMgr->transferFloat(TMEMBER(_angVelocity1)); + persistMgr->transferFloat(TMEMBER(_angVelocity2)); - persistMgr->transfer(TMEMBER(_rotation1)); - persistMgr->transfer(TMEMBER(_rotation2)); + persistMgr->transferFloat(TMEMBER(_rotation1)); + persistMgr->transferFloat(TMEMBER(_rotation2)); - persistMgr->transfer(TMEMBER(_growthRate1)); - persistMgr->transfer(TMEMBER(_growthRate2)); + persistMgr->transferFloat(TMEMBER(_growthRate1)); + persistMgr->transferFloat(TMEMBER(_growthRate2)); persistMgr->transfer(TMEMBER(_exponentialGrowth)); persistMgr->transfer(TMEMBER(_useRegion)); diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp index 2ae867fd42..86cacacb5c 100644 --- a/engines/wintermute/base/particles/part_particle.cpp +++ b/engines/wintermute/base/particles/part_particle.cpp @@ -234,9 +234,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_border)); persistMgr->transfer(TMEMBER(_pos)); - persistMgr->transfer(TMEMBER(_posZ)); + persistMgr->transferFloat(TMEMBER(_posZ)); persistMgr->transfer(TMEMBER(_velocity)); - persistMgr->transfer(TMEMBER(_scale)); + persistMgr->transferFloat(TMEMBER(_scale)); persistMgr->transfer(TMEMBER(_creationTime)); persistMgr->transfer(TMEMBER(_lifeTime)); persistMgr->transfer(TMEMBER(_isDead)); @@ -244,9 +244,9 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_fadeStart)); persistMgr->transfer(TMEMBER(_fadeTime)); persistMgr->transfer(TMEMBER(_currentAlpha)); - persistMgr->transfer(TMEMBER(_angVelocity)); - persistMgr->transfer(TMEMBER(_rotation)); - persistMgr->transfer(TMEMBER(_growthRate)); + persistMgr->transferFloat(TMEMBER(_angVelocity)); + persistMgr->transferFloat(TMEMBER(_rotation)); + persistMgr->transferFloat(TMEMBER(_growthRate)); persistMgr->transfer(TMEMBER(_exponentialGrowth)); persistMgr->transfer(TMEMBER(_fadeStartAlpha)); diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index ef4d6b4dd9..f3317684b5 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -498,7 +498,7 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_alphaFilename)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); - persistMgr->transfer(TMEMBER(_playZoom)); + persistMgr->transferFloat(TMEMBER(_playZoom)); persistMgr->transfer(TMEMBER_INT(_playbackType)); persistMgr->transfer(TMEMBER(_looping)); persistMgr->transfer(TMEMBER(_volume)); -- cgit v1.2.3 From d7eff2f8848f4846987675fd97ce06de3a0edd58 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Tue, 13 Aug 2013 21:32:17 +0100 Subject: GIT: Ignore create_mortdat and extract_mort executables --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a74f45bec0..7512928543 100644 --- a/.gitignore +++ b/.gitignore @@ -117,12 +117,14 @@ project.xcworkspace /devtools/create_kyradat/create_kyradat /devtools/create_lure/create_lure /devtools/create_mads/create_mads +/devtools/create_mortdat/create_mortdat /devtools/create_neverhood/create_neverhood /devtools/create_project/create_project /devtools/create_teenagent/create_teenagent /devtools/create_tony/create_tony /devtools/create_toon/create_toon /devtools/create_translations/create_translations +/devtools/extract_mort/extract_mort /devtools/qtable/qtable /devtools/skycpt/skycpt -- cgit v1.2.3 From cfc8ebc9a8823f3478120c284ba0b484e033ca22 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Tue, 13 Aug 2013 21:35:39 +0100 Subject: GIT: Ignore Mac .DS_Store files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 7512928543..99c9296dba 100644 --- a/.gitignore +++ b/.gitignore @@ -177,3 +177,6 @@ ScummVM.includes #Ignore Komodo IDE/Edit project files *.komodoproject + +#Ignore Mac DS_Store files +.DS_Store -- cgit v1.2.3 From b830f68bacd18f51f4dd912ce3b54ec47d63f31d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 14 Aug 2013 01:57:29 +0200 Subject: DEVTOOLS: Disable builtin theme in MSVC 2005 and 2008 in create_project. This is a copy of d089658fb84f67652e9569bc03c76bcc65e7b881 for older MSVC versions. Thanks to Strangerke for noticing. --- devtools/create_project/visualstudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 23225d3435..17e378fd0f 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -286,7 +286,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea if (isRelease) { properties << "\t\tEnableIntrinsicFunctions=\"true\"\n" "\t\tWholeProgramOptimization=\"true\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD\"\n" "\t\tStringPooling=\"true\"\n" "\t\tBufferSecurityCheck=\"false\"\n" "\t\tDebugInformationFormat=\"0\"\n" @@ -300,7 +300,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea "\t\tSetChecksum=\"true\"\n"; } else { properties << "\t\tOptimization=\"0\"\n" - "\t\tPreprocessorDefinitions=\"WIN32\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME\"\n" "\t\tMinimalRebuild=\"true\"\n" "\t\tBasicRuntimeChecks=\"3\"\n" "\t\tRuntimeLibrary=\"1\"\n" -- cgit v1.2.3 From 1731d25466bb18c6278d642944f55b22236af6e2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Aug 2013 07:36:32 +0200 Subject: DEVTOOLS: Fix error in create_mortdat. Thanks to LordHoto for pointing it out --- devtools/create_mortdat/create_mortdat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 93ca721d95..f12a69bd37 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -134,8 +134,8 @@ void writeFontBlock() { mortCom.seek(knownAddr[i]); mortCom.read(checkBuffer, 7); - if ((checkBuffer[0] == 0x59) && (checkBuffer[1] == 0x5B) && (checkBuffer[2] == 0x58) || - (checkBuffer[3] == 0xC3) && (checkBuffer[4] == 0xE8) && (checkBuffer[5] == 0xD6) || + if ((checkBuffer[0] == 0x59) && (checkBuffer[1] == 0x5B) && (checkBuffer[2] == 0x58) && + (checkBuffer[3] == 0xC3) && (checkBuffer[4] == 0xE8) && (checkBuffer[5] == 0xD6) && (checkBuffer[6] == 0x02)) { break; } -- cgit v1.2.3 From cb0a0880a2e495b56b7eb875daa543c1fbd8b3f4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Aug 2013 07:46:22 +0200 Subject: MORTEVIELLE: Fix shadowed variable. Thanks LordHoto for pointing out --- engines/mortevielle/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 9fff106b61..3bea96b92f 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -258,7 +258,7 @@ void SoundManager::litph(tablint &t, int typ, int tempo) { } else if (idx == 46) { if (!_audioStream) _audioStream = Audio::makeQueuingAudioStream(freq, false); - for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) _audioStream->queueBuffer(emptyBuf, 19, DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); } else { warning("Other code: %d - %d %d", idx, _troctBuf[i], _troctBuf[i + 1]); -- cgit v1.2.3 From 6d5580f4edd3f6a7ef69bb6c05b89cb425f88a1e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Aug 2013 08:17:37 +0200 Subject: MORTEVIELLE: Some renaming --- engines/mortevielle/actions.cpp | 139 ++++++++++++++++++------------------ engines/mortevielle/dialogs.cpp | 4 +- engines/mortevielle/mortevielle.cpp | 4 +- engines/mortevielle/mortevielle.h | 12 ++-- engines/mortevielle/utils.cpp | 94 +++++++++++++++--------- 5 files changed, 137 insertions(+), 116 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 233f252c79..2a66100e17 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -340,7 +340,7 @@ void MortevielleEngine::fctLift() { ++_coreVar._faithScore; _crep = 997; if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0)) - treg(_coreVar._purpleRoomObjectId); + displayLookScreen(_coreVar._purpleRoomObjectId); } return; } @@ -409,29 +409,29 @@ void MortevielleEngine::fctLook() { if (_num == 1) { _crep = 164; if (_coreVar._atticRodHoleObjectId != 0) - treg(_coreVar._atticRodHoleObjectId); + displayLookScreen(_coreVar._atticRodHoleObjectId); else if (_coreVar._atticBallHoleObjectId != 0) - treg(_coreVar._atticBallHoleObjectId); + displayLookScreen(_coreVar._atticBallHoleObjectId); } else { _crep = 193; if (_coreVar._atticRodHoleObjectId != 0) - treg(_coreVar._atticRodHoleObjectId); + displayLookScreen(_coreVar._atticRodHoleObjectId); } } if (_coreVar._currPlace == CELLAR) { _crep = 164; if (_coreVar._cellarObjectId != 0) - treg(_coreVar._cellarObjectId); + displayLookScreen(_coreVar._cellarObjectId); } if (_coreVar._currPlace == SECRET_PASSAGE) { _crep = 174; if (_coreVar._secretPassageObjectId != 0) - treg(_coreVar._secretPassageObjectId); + displayLookScreen(_coreVar._secretPassageObjectId); } if (_coreVar._currPlace == WELL) { _crep = 131; if (_coreVar._wellObjectId != 0) - treg(_coreVar._wellObjectId); + displayLookScreen(_coreVar._wellObjectId); } } return; @@ -451,15 +451,15 @@ void MortevielleEngine::fctLook() { if (_crep == 255) _crep = 131; if ((_coreVar._currPlace == GREEN_ROOM) && (_num == 1)) - treg(144); + displayLookScreen(144); if ((_coreVar._currPlace == BLUE_ROOM) && (_num == 3)) - treg(147); + displayLookScreen(147); if ((_coreVar._currPlace == GREEN_ROOM2) && (_num == 3)) - treg(149); + displayLookScreen(149); if ((_coreVar._currPlace == JULIA_ROOM) && (_num == 2)) - treg(30); + displayLookScreen(30); if ((_coreVar._currPlace == DINING_ROOM) && (_num == 3)) - treg(31); + displayLookScreen(31); } /** @@ -468,7 +468,7 @@ void MortevielleEngine::fctLook() { */ void MortevielleEngine::fctSelftLook() { if (_coreVar._selectedObjectId != 0) - treg(_coreVar._selectedObjectId); + displayLookScreen(_coreVar._selectedObjectId); else _crep = 186; } @@ -529,12 +529,12 @@ void MortevielleEngine::fctSearch() { if (_coreVar._currPlace == PURPLE_ROOM) { _crep = 123; if (_coreVar._purpleRoomObjectId != 0) - treg(_coreVar._purpleRoomObjectId); + displayLookScreen(_coreVar._purpleRoomObjectId); } if (_coreVar._currPlace == CRYPT) { _crep = 123; if (_coreVar._cryptObjectId != 0) - treg(_coreVar._cryptObjectId); + displayLookScreen(_coreVar._cryptObjectId); } } } @@ -709,7 +709,7 @@ void MortevielleEngine::fctPlace() { bool enterPassageFl = _dialogManager.showKnowledgeCheck(); _mouse.hideMouse(); - hirs(); + clearScreen(); drawRightFrame(); clearDescriptionBar(); clearVerbBar(); @@ -933,14 +933,13 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; _soundManager.startSpeech(11, rand, 1); - int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); - int l = _roomDoorId; - if (l != OWN_ROOM) { - if (p != -500) { - if (rand > p) + int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); + if (_roomDoorId != OWN_ROOM) { + if (pres != -500) { + if (rand > pres) _crep = 190; else { - setPresenceFlags(l); + setPresenceFlags(_roomDoorId); getKnockAnswer(); } } else @@ -1054,18 +1053,17 @@ void MortevielleEngine::fctListen() { if (_currBitIndex != 0) ++_coreVar._faithScore; int rand; - int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); - int l = _roomDoorId; - if (l != OWN_ROOM) { - if (p != -500) { - if (rand > p) + int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); + if (_roomDoorId != OWN_ROOM) { + if (pres != -500) { + if (rand > pres) _crep = 101; else { - setPresenceFlags(l); - int j, h, m; - updateHour(j, h, m); + setPresenceFlags(_roomDoorId); + int day, hour, minute; + updateHour(day, hour, minute); rand = getRandomNumber(1, 100); - if ((h >= 0) && (h < 8)) { + if ((hour >= 0) && (hour < 8)) { if (rand > 30) _crep = 101; else @@ -1095,25 +1093,25 @@ void MortevielleEngine::fctEat() { resetRoomVariables(_coreVar._currPlace); _menu.setDestinationText(_coreVar._currPlace); - int j, h, m; - updateHour(j, h, m); - if ((h == 12) || (h == 13) || (h == 19)) { + int day, hour, minute; + updateHour(day, hour, minute); + if ((hour == 12) || (hour == 13) || (hour == 19)) { _coreVar._faithScore -= (_coreVar._faithScore / 7); - if (h == 12) { - if (m == 0) - h = 4; + if (hour == 12) { + if (minute == 0) + hour = 4; else - h = 3; + hour = 3; } - if ((h == 13) || (h == 19)) { - if (m == 0) - h = 2; + if ((hour == 13) || (hour == 19)) { + if (minute == 0) + hour = 2; else - h = 1; + hour = 1; } - _currentHourCount += h; + _currentHourCount += hour; _crep = 135; prepareRoom(); } else { @@ -1138,10 +1136,10 @@ void MortevielleEngine::fctEnter() { _crep = 189; _coreVar._availableQuestion[8] = '*'; } else { - int z = 0; + int pres = 0; if (!_blo) - z = getPresence(_roomDoorId); - if (z != 0) { + pres = getPresence(_roomDoorId); + if (pres != 0) { if ((_roomDoorId == TOILETS) || (_roomDoorId == BATHROOM)) _crep = 179; else { @@ -1150,7 +1148,7 @@ void MortevielleEngine::fctEnter() { displayAnimFrame(1, 1); _soundManager.waitSpeech(); - int charIndex = convertBitIndexToCharacterIndex(z); + int charIndex = convertBitIndexToCharacterIndex(pres); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _currMenu = MENU_DISCUSS; @@ -1188,8 +1186,6 @@ void MortevielleEngine::fctEnter() { * @remarks Originally called 'tdormir' */ void MortevielleEngine::fctSleep() { - int j, h, m; - if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) { _crep = 148; return; @@ -1205,23 +1201,24 @@ void MortevielleEngine::fctSleep() { clearVerbBar(); clearDescriptionBar(); prepareScreenType2(); - ecr2(getEngineString(S_WANT_TO_WAKE_UP)); - updateHour(j, h, m); + displayTextBlock(getEngineString(S_WANT_TO_WAKE_UP)); + int day, hour, minute; + updateHour(day, hour, minute); int answer; do { - if (h < 8) { + if (hour < 8) { _coreVar._faithScore -= (_coreVar._faithScore / 20); - int z = (7 - h) * 2; - if (m == 30) + int z = (7 - hour) * 2; + if (minute == 30) --z; _currentHourCount += z; - h = 7; + hour = 7; } _currentHourCount += 2; - ++h; - if (h > 23) - h = 0; + ++hour; + if (hour > 23) + hour = 0; prepareRoom(); answer = _dialogManager.show(getEngineString(S_YES_NO), 1); _anyone = false; @@ -1364,12 +1361,12 @@ void MortevielleEngine::fctDiscuss() { displId = _caff + 60; } testKey(false); - mennor(); + menuUp(); _mouse.hideMouse(); - hirs(); - premtet(); + clearScreen(); + drawDiscussionBox(); startDialog(displId); - hirs(); + clearScreen(); for (int ix = 1; ix <= 46; ++ix) questionAsked[ix] = false; for (int ix = 1; ix <= 45; ++ix) { @@ -1496,8 +1493,8 @@ void MortevielleEngine::fctDiscuss() { displId = 139; } _mouse.hideMouse(); - hirs(); - premtet(); + clearScreen(); + drawDiscussionBox(); startDialog(displId); _mouse.showMouse(); if ((displId == 84) || (displId == 86)) { @@ -1514,15 +1511,15 @@ void MortevielleEngine::fctDiscuss() { _coreVar._availableQuestion[32] = '*'; } _mouse.hideMouse(); - hirs(); + clearScreen(); _mouse.showMouse(); } } while ((choice != 46) && (displId != 138)); if (_col) { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); _mouse.hideMouse(); - hirs(); - premtet(); + clearScreen(); + drawDiscussionBox(); startDialog(138); _mouse.showMouse(); _col = false; @@ -1530,7 +1527,7 @@ void MortevielleEngine::fctDiscuss() { } _controlMenu = 0; _mouse.hideMouse(); - hirs(); + clearScreen(); drawRightFrame(); _mouse.showMouse(); showPeoplePresent(_currBitIndex); @@ -1580,7 +1577,7 @@ void MortevielleEngine::fctScratch() { */ void MortevielleEngine::endGame() { _quitGame = true; - tlu(13, 152); + displayNarrativePicture(13, 152); displayEmptyHand(); clearUpperLeftPart(); clearDescriptionBar(); @@ -1590,8 +1587,8 @@ void MortevielleEngine::endGame() { _mouse.hideMouse(); _caff = 70; _text.taffich(); - hirs(); - premtet(); + clearScreen(); + drawDiscussionBox(); startDialog(141); _mouse.showMouse(); clearUpperLeftPart(); diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 264839c158..abaf38c59b 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -300,7 +300,7 @@ bool DialogManager::showKnowledgeCheck() { for (int indx = 0; indx < 10; ++indx) { _vm->_mouse.hideMouse(); - _vm->hirs(); + _vm->clearScreen(); _vm->_mouse.showMouse(); int dialogHeight; if (_vm->_resolutionScaler == 1) @@ -434,7 +434,7 @@ void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { if (_vm->_newGraphicalDevice != _vm->_currGraphicalDevice) { _vm->_currGraphicalDevice = _vm->_newGraphicalDevice; - _vm->hirs(); + _vm->clearScreen(); displayIntroScreen(drawFrame2Fl); } } while (_vm->_key != 66); // keycode for F8 diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index d657bda7ab..7b2a648221 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -223,7 +223,7 @@ Common::ErrorCode MortevielleEngine::initialize() { testKeyboard(); if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; - hirs(); + clearScreen(); _soundManager.loadNoise(); _soundManager.loadAmbiantSounds(); @@ -404,7 +404,7 @@ void MortevielleEngine::mainGame() { charToHour(); initGame(); - hirs(); + clearScreen(); drawRightFrame(); _mouse.showMouse(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 820046b17c..27a3d5697a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -386,6 +386,7 @@ private: void displayQuestionText(Common::String s, int cmd); void displayTextInDescriptionBar(int x, int y, int nb, int mesgId); void displayTextInVerbBar(Common::String text); + void displayTextBlock(Common::String text); void mapMessageId(int &mesgId); void resetOpenObjects(); void setCoordinates(int sx); @@ -399,13 +400,12 @@ private: void prepareNextObject(); void putObject(); void resetObjectPlace(); + void drawDiscussionBox(); + void displayNarrativePicture(int af, int ob); + void menuUp(); + void displayLookScreen(int objId); void adzon(); - void premtet(); - void ecr2(Common::String text); - void tlu(int af, int ob); - void mennor(); - void treg(int objId); public: Common::Point _prevPos; @@ -492,7 +492,7 @@ public: void handleDescriptionText(int f, int mesgId); int getAnimOffset(int frameNum, int animNum); - void hirs(); + void clearScreen(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index eac4546fff..fff53dbc30 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -335,7 +335,7 @@ void MortevielleEngine::handleAction() { _crep = 998; } else prepareNextObject(); - mennor(); + menuUp(); } } } @@ -1348,7 +1348,7 @@ void MortevielleEngine::startDialog(int16 rep) { if (shouldQuit()) return; } while (key != 66); - hirs(); + clearScreen(); _mouse.showMouse(); } @@ -1385,10 +1385,10 @@ void MortevielleEngine::gotoDiningRoom() { _screenSurface.drawBox(223, 47, 155, 92, 15); handleDescriptionText(2, 33); testKey(false); - mennor(); + menuUp(); _mouse.hideMouse(); - hirs(); - premtet(); + clearScreen(); + drawDiscussionBox(); startDialog(140); drawRightFrame(); drawClock(); @@ -1456,7 +1456,7 @@ void MortevielleEngine::floodedInWell() { void MortevielleEngine::changeGraphicalDevice(int newDevice) { _mouse.hideMouse(); _currGraphicalDevice = newDevice; - hirs(); + clearScreen(); _mouse.initMouse(); _mouse.showMouse(); drawRightFrame(); @@ -1538,7 +1538,7 @@ void MortevielleEngine::handleOpcode() { if (_uptodatePresence) { if ((_currMenu == MENU_MOVE) || (_currAction == OPCODE_LEAVE) || (_currAction == OPCODE_SLEEP) || (_currAction == OPCODE_EAT)) { _controlMenu = 4; - mennor(); + menuUp(); return; } } @@ -1606,7 +1606,7 @@ void MortevielleEngine::handleOpcode() { if (_anyone) { interactNPC(); _anyone = false; - mennor(); + menuUp(); return; } } @@ -1630,7 +1630,7 @@ void MortevielleEngine::handleOpcode() { loseGame(); } } - mennor(); + menuUp(); } /** @@ -2211,14 +2211,14 @@ void MortevielleEngine::music() { * @remarks Originally called 'suite' */ void MortevielleEngine::showTitleScreen() { - hirs(); + clearScreen(); handleDescriptionText(7, 2035); _caff = 51; _text.taffich(); testKeyboard(); if (_newGraphicalDevice != _currGraphicalDevice) _currGraphicalDevice = _newGraphicalDevice; - hirs(); + clearScreen(); draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; @@ -2481,7 +2481,11 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t return result; } -void MortevielleEngine::hirs() { +/** + * Clear Screen + * @remarks Originally called 'hirs' + */ +void MortevielleEngine::clearScreen() { // Note: The original used this to set the graphics mode and clear the screen, both at // the start of the game, and whenever the screen need to be cleared. As such, this // method is deprecated in favour of clearing the screen @@ -2710,7 +2714,11 @@ void MortevielleEngine::resetOpenObjects() { _openObjCount = 0; } -void MortevielleEngine::ecr2(Common::String text) { +/** + * Display Text Block + * @remarks Originally called 'ecr2' + */ +void MortevielleEngine::displayTextBlock(Common::String text) { // Some dead code was present in the original: removed _screenSurface.putxy(8, 177); int tlig = 59 + (_resolutionScaler - 1) * 36; @@ -2878,11 +2886,11 @@ int MortevielleEngine::getPresence(int roomId) { int retVal = 0; int rand; - int p = getPresenceStats(rand, _coreVar._faithScore, roomId); + int pres = getPresenceStats(rand, _coreVar._faithScore, roomId); _place = roomId; if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) { - if (p != -500) { - if (rand > p) { + if (pres != -500) { + if (rand > pres) { displayAloneText(); retVal = 0; } else { @@ -2899,34 +2907,34 @@ int MortevielleEngine::getPresence(int roomId) { else { int h = 0; if (roomId == DINING_ROOM) - p = getPresenceStatsDiningRoom(h); + pres = getPresenceStatsDiningRoom(h); else if (roomId == BUREAU) - p = getPresenceStatsBureau(h); + pres = getPresenceStatsBureau(h); else if (roomId == KITCHEN) - p = getPresenceStatsKitchen(); + pres = getPresenceStatsKitchen(); else if ((roomId == ATTIC) || (roomId == CELLAR)) - p = getPresenceStatsAttic(); + pres = getPresenceStatsAttic(); else if ((roomId == LANDING) || (roomId == ROOM26)) - p = getPresenceStatsLanding(); + pres = getPresenceStatsLanding(); else if (roomId == CHAPEL) - p = getPresenceStatsChapel(h); - p += _coreVar._faithScore; + pres = getPresenceStatsChapel(h); + pres += _coreVar._faithScore; rand = getRandomNumber(1, 100); - if (rand > p) { + if (rand > pres) { displayAloneText(); retVal = 0; } else { if (roomId == DINING_ROOM) - p = setPresenceDiningRoom(h); + pres = setPresenceDiningRoom(h); else if (roomId == BUREAU) - p = setPresenceBureau(h); + pres = setPresenceBureau(h); else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR)) - p = setPresenceKitchen(); + pres = setPresenceKitchen(); else if ((roomId == LANDING) || (roomId == ROOM26)) - p = setPresenceLanding(); + pres = setPresenceLanding(); else if (roomId == CHAPEL) - p = setPresenceChapel(h); - retVal = p; + pres = setPresenceChapel(h); + retVal = pres; } } } @@ -3053,7 +3061,11 @@ void MortevielleEngine::testKey(bool d) { _mouse.showMouse(); } -void MortevielleEngine::tlu(int af, int ob) { +/** + * Display Narrative Picture + * @remarks Originally called 'tlu' + */ +void MortevielleEngine::displayNarrativePicture(int af, int ob) { _caff = 32; drawPictureWithText(); handleDescriptionText(6, ob + 4000); @@ -3119,7 +3131,7 @@ void MortevielleEngine::getReadDescription(int objId) { case 157: case 160: case 161 : - tlu(_caff, objId); + displayNarrativePicture(_caff, objId); break; default: break; @@ -3152,11 +3164,19 @@ void MortevielleEngine::getSearchDescription(int objId) { } } -void MortevielleEngine::mennor() { +/** + * Menu up + * @remarks Originally called 'mennor' + */ +void MortevielleEngine::menuUp() { _menu.menuUp(_currMenu); } -void MortevielleEngine::premtet() { +/** + * Draw discussion box + * @remarks Originally called 'premtet' + */ +void MortevielleEngine::drawDiscussionBox() { draw(10, 80); _screenSurface.drawBox(18, 79, 155, 92, 15); } @@ -3372,7 +3392,11 @@ void MortevielleEngine::setCoordinates(int sx) { _crep = 997; } -void MortevielleEngine::treg(int objId) { +/** + * Display LOOK Screen + * @remarks Originally called 'treg' + */ +void MortevielleEngine::displayLookScreen(int objId) { int mdes = _caff; _caff = objId; -- cgit v1.2.3 From b23421585421753e37a79adaaa3b6da3d393d300 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Aug 2013 23:54:33 +0200 Subject: DEVTOOLS: Add Menu 3 & 4 verb indexes in MORT.DAT --- devtools/create_mortdat/create_mortdat.cpp | 21 +++++++++++++++++- devtools/create_mortdat/create_mortdat.h | 2 +- devtools/create_mortdat/gametext.h | 34 ++++++++++++++--------------- devtools/create_mortdat/menudata.h | 14 ++++++++++++ dists/engine-data/mort.dat | Bin 75822 -> 75999 bytes 5 files changed, 52 insertions(+), 19 deletions(-) diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index f12a69bd37..00b9b1ce4a 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -205,7 +205,7 @@ void writeGameStrings() { * Write out the data for the English menu */ void writeMenuBlock() { - // Write out a section header to the output file and the font data + // Write out a section header to the output file and the menu data const char menuHeader[4] = { 'M', 'E', 'N', 'U' }; outputFile.write(menuHeader, 4); // Section Id outputFile.writeWord(strlen(menuDataEn) / 8); // Section size @@ -226,10 +226,29 @@ void writeMenuBlock() { } } +void writeVerbNums(const int *verbs, int languageId) { + // Write out a section header to the output file + const char menuHeader[4] = { 'V', 'E', 'R', 'B' }; + outputFile.write(menuHeader, 4); // Section Id + int size = 52 + 1; // Language code + 26 words + outputFile.writeWord(size); + + outputFile.writeByte(languageId); + for (int i = 0; i < 26; i++) + outputFile.writeWord(verbs[i]); +} + +void writeMenuVerbs() { + writeVerbNums(verbsEn, 1); + writeVerbNums(verbsFr, 0); + writeVerbNums(verbsDe, 2); +} + void process() { writeFontBlock(); writeGameStrings(); writeEngineStrings(); + writeMenuVerbs(); writeMenuBlock(); } diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h index 8c210d32d9..1ebbbe37e0 100644 --- a/devtools/create_mortdat/create_mortdat.h +++ b/devtools/create_mortdat/create_mortdat.h @@ -24,7 +24,7 @@ */ #define VERSION_MAJOR 1 -#define VERSION_MINOR 0 +#define VERSION_MINOR 1 enum AccessMode { kFileReadMode = 1, diff --git a/devtools/create_mortdat/gametext.h b/devtools/create_mortdat/gametext.h index b1809c614c..4f7b1f9776 100644 --- a/devtools/create_mortdat/gametext.h +++ b/devtools/create_mortdat/gametext.h @@ -505,31 +505,31 @@ const char *gameDataEn[] = { "$", "YOUR MOVE$", " attach$", - " wait$", - " force$", - " sleep$", - " listen$", - " enter$", " close$", - " search$", - " knock$", - " scratch$", - " read$", " eat$", - " place$", - " open$", - " take$", + " enter$", + " force$", + " knock$", + " leave$", + " lift$", + " listen$", " look$", + " open$", + " place$", + " read$", + " scratch$", + " search$", + " sleep$", " smell$", " sound$", - " leave$", - " lift$", + " take$", " turn$", + " wait$", " hide yourself$", - " search$", - " read$", - " put$", " look$", + " put$", + " read$", + " search$", " Leo$", " Pat$", " Guy$", diff --git a/devtools/create_mortdat/menudata.h b/devtools/create_mortdat/menudata.h index aa4557b336..a927d31757 100644 --- a/devtools/create_mortdat/menudata.h +++ b/devtools/create_mortdat/menudata.h @@ -76,4 +76,18 @@ const char *menuDataEn = "@@@ @@@ @@@ @@@ " " "; +const int verbsFr[26] = { 0x301, 0x302, 0x303, 0x304, 0x305, 0x306, 0x307, 0x308, + 0x309, 0x30a, 0x30b, 0x30c, 0x30d, 0x30e, 0x30f, 0x310, + 0x311, 0x312, 0x313, 0x314, 0x315, 0x401, 0x402, 0x403, + 0x404, 0x405 }; + +const int verbsEn[26] = { 0x301, 0x307, 0x30c, 0x306, 0x303, 0x309, 0x313, 0x314, + 0x305, 0x310, 0x30e, 0x30d, 0x30b, 0x30a, 0x308, 0x304, + 0x311, 0x312, 0x30f, 0x315, 0x302, 0x401, 0x405, 0x404, + 0x403, 0x402 }; + +const int verbsDe[26] = { 0x30a, 0x310, 0x313, 0x301, 0x315, 0x308, 0x303, 0x306, + 0x30c, 0x311, 0x314, 0x309, 0x30b, 0x30f, 0x30e, 0x304, + 0x307, 0x30d, 0x312, 0x302, 0x305, 0x405, 0x402, 0x404, + 0x403, 0x401 }; #endif diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 8775b46c38..2b0b507307 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 019f7e59fdbcc6bdd2ad49dc5ab7e87c84cf4093 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Aug 2013 07:56:11 +0200 Subject: DEVTOOLS: Fix English verbs order in Mortevielle --- devtools/create_mortdat/menudata.h | 6 +++--- dists/engine-data/mort.dat | Bin 75999 -> 75999 bytes 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/devtools/create_mortdat/menudata.h b/devtools/create_mortdat/menudata.h index a927d31757..6a5f8dcfad 100644 --- a/devtools/create_mortdat/menudata.h +++ b/devtools/create_mortdat/menudata.h @@ -81,9 +81,9 @@ const int verbsFr[26] = { 0x301, 0x302, 0x303, 0x304, 0x305, 0x306, 0x307, 0x308 0x311, 0x312, 0x313, 0x314, 0x315, 0x401, 0x402, 0x403, 0x404, 0x405 }; -const int verbsEn[26] = { 0x301, 0x307, 0x30c, 0x306, 0x303, 0x309, 0x313, 0x314, - 0x305, 0x310, 0x30e, 0x30d, 0x30b, 0x30a, 0x308, 0x304, - 0x311, 0x312, 0x30f, 0x315, 0x302, 0x401, 0x405, 0x404, +const int verbsEn[26] = { 0x301, 0x315, 0x305, 0x310, 0x309, 0x304, 0x302, 0x30f, + 0x306, 0x30d, 0x30e, 0x303, 0x30c, 0x30b, 0x313, 0x30a, + 0x311, 0x312, 0x307, 0x308, 0x314, 0x401, 0x405, 0x404, 0x403, 0x402 }; const int verbsDe[26] = { 0x30a, 0x310, 0x313, 0x301, 0x315, 0x308, 0x303, 0x306, diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.dat index 2b0b507307..ae9579ee13 100644 Binary files a/dists/engine-data/mort.dat and b/dists/engine-data/mort.dat differ -- cgit v1.2.3 From 563e62d625e0b287a7eca1bb2f09c9a034a1a48b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Aug 2013 07:57:07 +0200 Subject: MORTEVIELLE: Use verb order stored in mort.dat --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/menu.cpp | 107 +++++++++++++++++++++++++++++++++++- engines/mortevielle/menu.h | 57 +++++++++++-------- engines/mortevielle/mortevielle.cpp | 6 +- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/utils.cpp | 60 ++++++++++---------- 6 files changed, 178 insertions(+), 56 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 2a66100e17..1b1e10daa2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -584,7 +584,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _currAction = OPCODE_ENTER; + _currAction = _menu.OPCODE_ENTER; _syn = true; } else _crep = 997; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f32c551ddb..c8f34991bd 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,6 +48,109 @@ const byte menuConstants[8][4] = { {62, 46, 13, 10} }; +Menu::Menu() { + OPCODE_ATTACH = OPCODE_WAIT = OPCODE_FORCE = OPCODE_SLEEP = OPCODE_NONE; + OPCODE_LISTEN = OPCODE_ENTER = OPCODE_CLOSE = OPCODE_SEARCH = OPCODE_NONE; + OPCODE_KNOCK = OPCODE_SCRATCH = OPCODE_READ = OPCODE_EAT = OPCODE_NONE; + OPCODE_PLACE = OPCODE_OPEN = OPCODE_TAKE = OPCODE_LOOK = OPCODE_NONE; + OPCODE_SMELL = OPCODE_SOUND = OPCODE_LEAVE = OPCODE_LIFT = OPCODE_NONE; + OPCODE_TURN = OPCODE_SHIDE = OPCODE_SSEARCH = OPCODE_SREAD = OPCODE_NONE; + OPCODE_SPUT = OPCODE_SLOOK = OPCODE_NONE; +} + +void Menu::readVerbNums(Common::File &f, int dataSize) { + // Figure out what language Id is needed + byte desiredLanguageId; + switch(_vm->getLanguage()) { + case Common::EN_ANY: + desiredLanguageId = MORTDAT_LANG_ENGLISH; + break; + case Common::FR_FRA: + desiredLanguageId = MORTDAT_LANG_FRENCH; + break; + case Common::DE_DEU: + desiredLanguageId = MORTDAT_LANG_GERMAN; + break; + default: + warning("Language not supported, switching to English"); + desiredLanguageId = MORTDAT_LANG_ENGLISH; + break; + } + // Read in the language + byte languageId = f.readByte(); + --dataSize; + + // If the language isn't correct, then skip the entire block + if (languageId != desiredLanguageId) { + f.skip(dataSize); + return; + } + + assert(dataSize == 52); + OPCODE_ATTACH = f.readUint16LE(); + OPCODE_WAIT = f.readUint16LE(); + OPCODE_FORCE = f.readUint16LE(); + OPCODE_SLEEP = f.readUint16LE(); + OPCODE_LISTEN = f.readUint16LE(); + OPCODE_ENTER = f.readUint16LE(); + OPCODE_CLOSE = f.readUint16LE(); + OPCODE_SEARCH = f.readUint16LE(); + OPCODE_KNOCK = f.readUint16LE(); + OPCODE_SCRATCH = f.readUint16LE(); + OPCODE_READ = f.readUint16LE(); + OPCODE_EAT = f.readUint16LE(); + OPCODE_PLACE = f.readUint16LE(); + OPCODE_OPEN = f.readUint16LE(); + OPCODE_TAKE = f.readUint16LE(); + OPCODE_LOOK = f.readUint16LE(); + OPCODE_SMELL = f.readUint16LE(); + OPCODE_SOUND = f.readUint16LE(); + OPCODE_LEAVE = f.readUint16LE(); + OPCODE_LIFT = f.readUint16LE(); + OPCODE_TURN = f.readUint16LE(); + OPCODE_SHIDE = f.readUint16LE(); + OPCODE_SSEARCH = f.readUint16LE(); + OPCODE_SREAD = f.readUint16LE(); + OPCODE_SPUT = f.readUint16LE(); + OPCODE_SLOOK = f.readUint16LE(); + + _actionMenu[0]._menuId = OPCODE_NONE >> 8; + _actionMenu[0]._actionId = OPCODE_NONE & 0xFF; + + _actionMenu[1]._menuId = OPCODE_SHIDE >> 8; + _actionMenu[1]._actionId = OPCODE_SHIDE & 0xFF; + + _actionMenu[2]._menuId = OPCODE_ATTACH >> 8; + _actionMenu[2]._actionId = OPCODE_ATTACH & 0xFF; + + _actionMenu[3]._menuId = OPCODE_FORCE >> 8; + _actionMenu[3]._actionId = OPCODE_FORCE & 0xFF; + + _actionMenu[4]._menuId = OPCODE_SLEEP >> 8; + _actionMenu[4]._actionId = OPCODE_SLEEP & 0xFF; + + _actionMenu[5]._menuId = OPCODE_ENTER >> 8; + _actionMenu[5]._actionId = OPCODE_ENTER & 0xFF; + + _actionMenu[6]._menuId = OPCODE_CLOSE >> 8; + _actionMenu[6]._menuId = OPCODE_CLOSE & 0xFF; + + _actionMenu[7]._menuId = OPCODE_KNOCK >> 8; + _actionMenu[7]._menuId = OPCODE_KNOCK & 0xFF; + + _actionMenu[8]._menuId = OPCODE_EAT >> 8; + _actionMenu[8]._menuId = OPCODE_EAT & 0xFF; + + _actionMenu[9]._menuId = OPCODE_PLACE >> 8; + _actionMenu[9]._menuId = OPCODE_PLACE & 0xFF; + + _actionMenu[10]._menuId = OPCODE_OPEN >> 8; + _actionMenu[10]._menuId = OPCODE_OPEN & 0xFF; + + _actionMenu[11]._menuId = OPCODE_LEAVE >> 8; + _actionMenu[11]._menuId = OPCODE_LEAVE & 0xFF; +} + /** * Setup a menu's contents * @remarks Originally called 'menut' @@ -486,9 +589,11 @@ void Menu::updateMenu() { } } -void Menu::initMenu(MortevielleEngine *vm) { +void Menu::setParent(MortevielleEngine *vm) { _vm = vm; +} +void Menu::initMenu() { int i; Common::File f; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 2428d8917b..a1b654ccaf 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -40,33 +40,13 @@ enum { MENU_LOAD = 8 }; -enum verbs {OPCODE_NONE = 0, OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, -OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, -OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, -OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, -OPCODE_TURN = 0x315, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404, -OPCODE_SLOOK = 0x405}; +const int OPCODE_NONE = 0; struct menuItem { int _menuId; int _actionId; }; -static const menuItem _actionMenu[12] = { - {OPCODE_NONE >> 8, OPCODE_NONE & 0xFF}, - {OPCODE_SHIDE >> 8, OPCODE_SHIDE & 0xFF}, - {OPCODE_ATTACH >> 8, OPCODE_ATTACH & 0xFF}, - {OPCODE_FORCE >> 8, OPCODE_FORCE & 0xFF}, - {OPCODE_SLEEP >> 8, OPCODE_SLEEP & 0xFF}, - {OPCODE_ENTER >> 8, OPCODE_ENTER & 0xFF}, - {OPCODE_CLOSE >> 8, OPCODE_CLOSE & 0xFF}, - {OPCODE_KNOCK >> 8, OPCODE_KNOCK & 0xFF}, - {OPCODE_EAT >> 8, OPCODE_EAT & 0xFF}, - {OPCODE_PLACE >> 8, OPCODE_PLACE & 0xFF}, - {OPCODE_OPEN >> 8, OPCODE_OPEN & 0xFF}, - {OPCODE_LEAVE >> 8, OPCODE_LEAVE & 0xFF} -}; - class Menu { private: MortevielleEngine *_vm; @@ -78,7 +58,10 @@ private: void util(Common::Point pos); void invert(int indx); void menuDown(int ii); + public: + Menu(); + bool _menuActive; bool _menuSelected; bool _multiTitle; @@ -92,6 +75,36 @@ public: menuItem _inventoryMenu[9]; menuItem _moveMenu[8]; + int OPCODE_ATTACH; + int OPCODE_WAIT; + int OPCODE_FORCE; + int OPCODE_SLEEP; + int OPCODE_LISTEN; + int OPCODE_ENTER; + int OPCODE_CLOSE; + int OPCODE_SEARCH; + int OPCODE_KNOCK; + int OPCODE_SCRATCH; + int OPCODE_READ; + int OPCODE_EAT; + int OPCODE_PLACE; + int OPCODE_OPEN; + int OPCODE_TAKE; + int OPCODE_LOOK; + int OPCODE_SMELL; + int OPCODE_SOUND; + int OPCODE_LEAVE; + int OPCODE_LIFT; + int OPCODE_TURN; + int OPCODE_SHIDE; + int OPCODE_SSEARCH; + int OPCODE_SREAD; + int OPCODE_SPUT; + int OPCODE_SLOOK; + menuItem _actionMenu[12]; + + void setParent(MortevielleEngine *vm); + void readVerbNums(Common::File &f, int dataSize); void setText(int menuId, int actionId, Common::String name); void setDestinationText(int roomId); void setInventoryText(); @@ -102,7 +115,7 @@ public: void menuUp(int msgId); void eraseMenu(); void updateMenu(); - void initMenu(MortevielleEngine *vm); + void initMenu(); void setSearchMenu(); void unsetSearchMenu(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7b2a648221..059bde4614 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -57,6 +57,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr _text.setParent(this); _soundManager.setParent(this); _savegameManager.setParent(this); + _menu.setParent(this); _lastGameFrame = 0; _mouseClick = false; @@ -273,6 +274,8 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { readStaticStrings(f, dataSize, kStaticStrings); } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { readStaticStrings(f, dataSize, kGameStrings); + } else if (!strncmp(dataType, "VERB", 4)) { + _menu.readVerbNums(f, dataSize); } else { // Unknown section f.skip(dataSize); @@ -286,6 +289,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { return Common::kNoError; } + /** * Read in a static strings block, and if the language matches, load up the static strings */ @@ -400,7 +404,7 @@ void MortevielleEngine::mainGame() { for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - _menu.initMenu(this); + _menu.initMenu(); charToHour(); initGame(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 99c06c7c4c..9451e655dd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -314,7 +314,7 @@ void TextHandler::taffich() { loadAniFile(filename, drawingStartPos, drawingSize); } _vm->_mouse.showMouse(); - if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) { + if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu.OPCODE_ENTER)) { if ((a == ATTIC) || (a == CELLAR)) _vm->displayAloneText(); else if (!_vm->_blo) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index fff53dbc30..3cacbec630 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -327,9 +327,9 @@ void MortevielleEngine::handleAction() { if (_mouse._pos.y < 12) return; - if ((_currAction == OPCODE_SOUND) || (_currAction == OPCODE_LIFT)) { + if ((_currAction == _menu.OPCODE_SOUND) || (_currAction == _menu.OPCODE_LIFT)) { handledOpcodeFl = true; - if ((_currAction == OPCODE_LIFT) || (_obpart)) { + if ((_currAction == _menu.OPCODE_LIFT) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; _crep = 998; @@ -1536,7 +1536,7 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_uptodatePresence) { - if ((_currMenu == MENU_MOVE) || (_currAction == OPCODE_LEAVE) || (_currAction == OPCODE_SLEEP) || (_currAction == OPCODE_EAT)) { + if ((_currMenu == MENU_MOVE) || (_currAction == _menu.OPCODE_LEAVE) || (_currAction == _menu.OPCODE_SLEEP) || (_currAction == _menu.OPCODE_EAT)) { _controlMenu = 4; menuUp(); return; @@ -1548,59 +1548,59 @@ void MortevielleEngine::handleOpcode() { fctDiscuss(); if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - if (_currAction == OPCODE_ATTACH) + if (_currAction == _menu.OPCODE_ATTACH) fctAttach(); - if (_currAction == OPCODE_WAIT) + if (_currAction == _menu.OPCODE_WAIT) fctWait(); - if (_currAction == OPCODE_FORCE) + if (_currAction == _menu.OPCODE_FORCE) fctForce(); - if (_currAction == OPCODE_SLEEP) + if (_currAction == _menu.OPCODE_SLEEP) fctSleep(); - if (_currAction == OPCODE_LISTEN) + if (_currAction == _menu.OPCODE_LISTEN) fctListen(); - if (_currAction == OPCODE_ENTER) + if (_currAction == _menu.OPCODE_ENTER) fctEnter(); - if (_currAction == OPCODE_CLOSE) + if (_currAction == _menu.OPCODE_CLOSE) fctClose(); - if (_currAction == OPCODE_SEARCH) + if (_currAction == _menu.OPCODE_SEARCH) fctSearch(); - if (_currAction == OPCODE_KNOCK) + if (_currAction == _menu.OPCODE_KNOCK) fctKnock(); - if (_currAction == OPCODE_SCRATCH) + if (_currAction == _menu.OPCODE_SCRATCH) fctScratch(); - if (_currAction == OPCODE_READ) + if (_currAction == _menu.OPCODE_READ) fctRead(); - if (_currAction == OPCODE_EAT) + if (_currAction == _menu.OPCODE_EAT) fctEat(); - if (_currAction == OPCODE_PLACE) + if (_currAction == _menu.OPCODE_PLACE) fctPlace(); - if (_currAction == OPCODE_OPEN) + if (_currAction == _menu.OPCODE_OPEN) fctOpen(); - if (_currAction == OPCODE_TAKE) + if (_currAction == _menu.OPCODE_TAKE) fctTake(); - if (_currAction == OPCODE_LOOK) + if (_currAction == _menu.OPCODE_LOOK) fctLook(); - if (_currAction == OPCODE_SMELL) + if (_currAction == _menu.OPCODE_SMELL) fctSmell(); - if (_currAction == OPCODE_SOUND) + if (_currAction == _menu.OPCODE_SOUND) fctSound(); - if (_currAction == OPCODE_LEAVE) + if (_currAction == _menu.OPCODE_LEAVE) fctLeave(); - if (_currAction == OPCODE_LIFT) + if (_currAction == _menu.OPCODE_LIFT) fctLift(); - if (_currAction == OPCODE_TURN) + if (_currAction == _menu.OPCODE_TURN) fctTurn(); - if (_currAction == OPCODE_SSEARCH) + if (_currAction == _menu.OPCODE_SSEARCH) fctSelfSearch(); - if (_currAction == OPCODE_SREAD) + if (_currAction == _menu.OPCODE_SREAD) fctSelfRead(); - if (_currAction == OPCODE_SPUT) + if (_currAction == _menu.OPCODE_SPUT) fctSelfPut(); - if (_currAction == OPCODE_SLOOK) + if (_currAction == _menu.OPCODE_SLOOK) fctSelftLook(); _hiddenHero = false; - if (_currAction == OPCODE_SHIDE) + if (_currAction == _menu.OPCODE_SHIDE) fctSelfHide(); } else { if (_anyone) { @@ -3400,7 +3400,7 @@ void MortevielleEngine::displayLookScreen(int objId) { int mdes = _caff; _caff = objId; - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == OPCODE_SLOOK)) { + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu.OPCODE_SLOOK)) { drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) handleDescriptionText(2, _caff); -- cgit v1.2.3 From 2a807b188006ebe3c70292d057da139a695aea20 Mon Sep 17 00:00:00 2001 From: Kirben Date: Thu, 15 Aug 2013 22:50:45 +1000 Subject: SCUMM: Add Remastered version of Putt-Putt Saves the Zoo from Nimbus Games. --- devtools/scumm-md5.txt | 1 + engines/scumm/detection_tables.h | 1 + engines/scumm/scumm-md5.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 76c12f57f4..0dbcbf4792 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -775,6 +775,7 @@ puttzoo Putt-Putt Saves the Zoo 3a3e592b074f595489f7f11e150c398d -1 us Windows HE 99 Updated - Adrian c5cc7cba02a2fbd539c4439e775b0536 43470 de Windows HE 99 Updated - Lightkey 5c9cecbd2952ccec14c9ecebf5822a34 -1 en iOS HE 100 - - clone2727 + 7b4ee071eecadc2d8cd0c3509110825c -1 en Windows HE 100 Remastered - Kirben 3486ede0f904789267d4bcc5537a46d4 14337 en Mac - Demo - khalek d220d154aafbfa12bd6f3ab1b2dae420 -1 de Mac - Demo - Joachim Eberhard diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index aaf84c1471..f13a8c15e6 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -860,6 +860,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "puttzoo", "Zoo Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "puttzoo", "Putt-Putt Saves the Zoo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "puttzoo", "game", kGenHEPC, Common::EN_ANY, Common::kPlatformIOS, 0 }, + { "puttzoo", "pp3_unlocked", kGenHEPC, Common::EN_ANY, Common::kPlatformWindows, 0 }, { "SamsFunShop", "SamsFunShop", kGenHEPC, UNK_LANG, UNK, 0 }, { "SamsFunShop", "Sam's FunShop", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index f5609f1b03..979573c5f5 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Sat Aug 3 16:52:02 2013 + This file was generated by the md5table tool on Thu Aug 15 12:47:39 2013 DO NOT EDIT MANUALLY! */ @@ -344,6 +344,7 @@ static const MD5Table md5table[] = { { "78c07ca088526d8d4446a4c2cb501203", "freddi3", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "7974365d3dc0f43a2748c975f91ff042", "monkey2", "", "", -1, Common::ES_ESP, Common::kPlatformDOS }, { "79b05f628586837e7166e82b2279bb50", "loom", "PC-Engine", "", -1, Common::JA_JPN, Common::kPlatformPCEngine }, + { "7b4ee071eecadc2d8cd0c3509110825c", "puttzoo", "HE 100", "Remastered", -1, Common::EN_ANY, Common::kPlatformWindows }, { "7bad72e332a59f9fcc1d437f4edad32a", "puttcircus", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown }, { "7c2e76087027eeee9c8f8985f93a1cc5", "freddi4", "", "Demo", 13584, Common::EN_ANY, Common::kPlatformUnknown }, { "7c8100e360e8ef05f88069d4cfa0afd1", "puttrace", "HE 99", "Demo", 13108, Common::EN_GRB, Common::kPlatformWindows }, -- cgit v1.2.3 From 28b60781d0d912bcc4fe1f71016049315a254133 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 Aug 2013 09:33:01 -0400 Subject: TSAGE: Bugfixes for R2R canyon fight with trooper --- engines/tsage/converse.cpp | 3 + engines/tsage/ringworld2/ringworld2_logic.cpp | 1 + engines/tsage/ringworld2/ringworld2_scenes1.cpp | 153 ++++++++++++----------- engines/tsage/ringworld2/ringworld2_scenes1.h | 12 +- engines/tsage/ringworld2/ringworld2_speakers.cpp | 6 +- 5 files changed, 91 insertions(+), 84 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 753a835389..909da62541 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -754,6 +754,9 @@ void StripManager::remove() { if (_onEnd) _onEnd(); + if (g_vm->getGameID() == GType_Ringworld2) + _endHandler = NULL; + Action::remove(); } diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f1f9f9fe5a..2a8e50bd67 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -358,6 +358,7 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { void SceneExt::remove() { _sceneAreas.clear(); Scene::remove(); + R2_GLOBALS._uiElements._active = true; } void SceneExt::process(Event &event) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 6ea53d0852..021ccd44dc 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -672,7 +672,7 @@ void Scene1100::synchronize(Serializer &s) { s.syncAsSint16LE(_field414); } -bool Scene1100::Actor16::startAction(CursorType action, Event &event) { +bool Scene1100::Seeker::startAction(CursorType action, Event &event) { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; if (action != CURSOR_TALK) @@ -706,7 +706,7 @@ bool Scene1100::Actor16::startAction(CursorType action, Event &event) { return true; } -bool Scene1100::Actor17::startAction(CursorType action, Event &event) { +bool Scene1100::Trooper::startAction(CursorType action, Event &event) { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; switch (action) { @@ -714,7 +714,7 @@ bool Scene1100::Actor17::startAction(CursorType action, Event &event) { if (_visage == 1105) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 1114; - scene->setAction(&scene->_sequenceManager1, scene, 1114, &R2_GLOBALS._player, &scene->_actor17, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 1114, &R2_GLOBALS._player, &scene->_trooper, NULL); return true; } else { return SceneActor::startAction(action, event); @@ -727,19 +727,19 @@ bool Scene1100::Actor17::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._characterIndex == 1) { scene->_sceneMode = 1112; - scene->setAction(&scene->_sequenceManager1, scene, 1112, &R2_GLOBALS._player, &scene->_actor17, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 1112, &R2_GLOBALS._player, &scene->_trooper, NULL); } else { scene->_sceneMode = 1115; - scene->setAction(&scene->_sequenceManager1, scene, 1115, &R2_GLOBALS._player, &scene->_actor17, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 1115, &R2_GLOBALS._player, &scene->_trooper, NULL); } return true; } else if (_strip == 2) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 1113; if (R2_GLOBALS._player._characterIndex == 1) { - scene->setAction(&scene->_sequenceManager1, scene, 1113, &R2_GLOBALS._player, &scene->_actor17, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 1113, &R2_GLOBALS._player, &scene->_trooper, NULL); } else { - scene->setAction(&scene->_sequenceManager1, scene, 1118, &R2_GLOBALS._player, &scene->_actor17, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 1118, &R2_GLOBALS._player, &scene->_trooper, NULL); } return true; } else { @@ -752,7 +752,7 @@ bool Scene1100::Actor17::startAction(CursorType action, Event &event) { } } -bool Scene1100::Actor18::startAction(CursorType action, Event &event) { +bool Scene1100::Chief::startAction(CursorType action, Event &event) { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; if ((action == CURSOR_TALK) && (!R2_GLOBALS.getFlag(54)) && (R2_GLOBALS.getFlag(52))) { @@ -824,28 +824,28 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor16.postInit(); - _actor16.hide(); + _seeker.postInit(); + _seeker.hide(); if (R2_GLOBALS._player._characterIndex == 1) - _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + _seeker.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); else - _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + _seeker.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); - _actor18.postInit(); - _actor18.setup(1113, 3, 1); - _actor18.setPosition(Common::Point(181, 125)); - _actor18.fixPriority(110); + _chief.postInit(); + _chief.setup(1113, 3, 1); + _chief.setPosition(Common::Point(181, 125)); + _chief.fixPriority(110); if (R2_GLOBALS.getFlag(54)) - _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); + _chief.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); else - _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); + _chief.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); - _actor17.postInit(); - _actor17.setup(1105, 3, 1); - _actor17.setPosition(Common::Point(312, 165)); - _actor17._numFrames = 5; - _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); + _trooper.postInit(); + _trooper.setup(1105, 3, 1); + _trooper.setPosition(Common::Point(312, 165)); + _trooper._numFrames = 5; + _trooper.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); _actor1.postInit(); _actor1.setup(1512, 1, 1); @@ -907,66 +907,66 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - _actor16.postInit(); + _seeker.postInit(); if (R2_GLOBALS.getFlag(52)) { if (R2_GLOBALS._player._characterIndex == 1) { R2_GLOBALS._player.setup(19, 7, 1); - _actor16.setup(29, 6, 1); + _seeker.setup(29, 6, 1); } else { R2_GLOBALS._player.setup(29, 7, 1); - _actor16.setup(19, 6, 1); + _seeker.setup(19, 6, 1); } R2_GLOBALS._player.setPosition(Common::Point(140, 124)); - _actor16.setPosition(Common::Point(237, 134)); + _seeker.setPosition(Common::Point(237, 134)); R2_GLOBALS._player.enableControl(); } else { if (R2_GLOBALS._player._characterIndex == 1) { R2_GLOBALS._player.setup(1107, 2, 1); - _actor16.setup(1107, 4, 1); + _seeker.setup(1107, 4, 1); R2_GLOBALS._player.setPosition(Common::Point(247, 169)); - _actor16.setPosition(Common::Point(213, 169)); + _seeker.setPosition(Common::Point(213, 169)); } else { R2_GLOBALS._player.setup(1107, 4, 1); - _actor16.setup(1107, 2, 1); + _seeker.setup(1107, 2, 1); R2_GLOBALS._player.setPosition(Common::Point(213, 169)); - _actor16.setPosition(Common::Point(247, 169)); + _seeker.setPosition(Common::Point(247, 169)); } R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; } if (R2_GLOBALS._player._characterIndex == 1) - _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); + _seeker.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL); else - _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); + _seeker.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL); - _actor18.postInit(); - _actor18.setup(1113, 3, 1); - _actor18.setPosition(Common::Point(181, 125)); - _actor18.fixPriority(110); + _chief.postInit(); + _chief.setup(1113, 3, 1); + _chief.setPosition(Common::Point(181, 125)); + _chief.fixPriority(110); if (R2_GLOBALS.getFlag(54)) - _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); + _chief.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL); else - _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); + _chief.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL); if (!R2_GLOBALS.getFlag(52)) { - _actor17.postInit(); + _trooper.postInit(); if (R2_GLOBALS.getFlag(53)) - _actor17.setup(1106, 2, 4); + _trooper.setup(1106, 2, 4); else - _actor17.setup(1105, 4, 4); + _trooper.setup(1105, 4, 4); - _actor17.setPosition(Common::Point(17, 54)); - _actor17._numFrames = 5; + _trooper.setPosition(Common::Point(17, 54)); + _trooper._numFrames = 5; if (R2_GLOBALS.getFlag(53)) - _actor17.setDetails(1100, 28, -1, -1, 1, (SceneItem *) NULL); + _trooper.setDetails(1100, 28, -1, -1, 1, (SceneItem *) NULL); else - _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); + _trooper.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL); - _actor17.fixPriority(200); + _trooper.fixPriority(200); } _actor1.postInit(); _actor1.setup(1512, 1, 1); @@ -1026,9 +1026,9 @@ void Scene1100::signal() { } break; case 4: - _actor18.postInit(); - _actor18.show(); - setAction(&_sequenceManager1, this, 1101, &_actor18, &_actor10, NULL); + _chief.postInit(); + _chief.show(); + setAction(&_sequenceManager1, this, 1101, &_chief, &_actor10, NULL); break; case 5: _actor13.postInit(); @@ -1054,12 +1054,12 @@ void Scene1100::signal() { } break; case 7: - setAction(&_sequenceManager1, this, 1103, &_actor18, &_actor10); + setAction(&_sequenceManager1, this, 1103, &_chief, &_actor10); break; case 8: R2_GLOBALS._player._effect = 0; _actor11.postInit(); - setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_actor18, NULL); + setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_chief, NULL); break; case 9: _object1.copySceneToBackground(); @@ -1090,8 +1090,8 @@ void Scene1100::signal() { // Really nothing break; case 13: - _actor17.postInit(); - R2_GLOBALS._scrollFollower = &_actor17; + _trooper.postInit(); + R2_GLOBALS._scrollFollower = &_trooper; _actor11.setup(1100, 2, 1); _actor11.setPosition(Common::Point(408, 121)); @@ -1099,7 +1099,7 @@ void Scene1100::signal() { _actor10.setup(1100, 3, 5); _actor10.setPosition(Common::Point(409, 121)); - setAction(&_sequenceManager1, this, 1104, &_actor17, NULL); + setAction(&_sequenceManager1, this, 1104, &_trooper, NULL); break; case 14: setAction(&_sequenceManager1, this, 1100, &_actor11, &_actor10, NULL); @@ -1115,14 +1115,14 @@ void Scene1100::signal() { break; case 21: { R2_GLOBALS._sound2.play(92); - _actor17.animate(ANIM_MODE_5, NULL); + _trooper.animate(ANIM_MODE_5, NULL); Common::Point pt(187, 45); NpcMover *mover = new NpcMover(); _actor1.addMover(mover, &pt, this); } break; case 22: - setAction(&_sequenceManager1, this, 1110, &_actor16, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 1110, &_seeker, &R2_GLOBALS._player, NULL); break; case 23: R2_GLOBALS._player.disableControl(); @@ -1136,34 +1136,37 @@ void Scene1100::signal() { break; case 25: R2_GLOBALS._player.disableControl(); - _stripManager._lookupList[9] = 1; - _stripManager._lookupList[10] = 1; - _stripManager._lookupList[11] = 1; + R2_GLOBALS._stripManager_lookupList[9] = 1; + R2_GLOBALS._stripManager_lookupList[10] = 1; + R2_GLOBALS._stripManager_lookupList[11] = 1; R2_GLOBALS._sound1.play(95); - setAction(&_sequenceManager1, this, 1111, &_actor17, &R2_GLOBALS._player, &_actor16, NULL); + setAction(&_sequenceManager1, this, 1111, &_trooper, &R2_GLOBALS._player, &_seeker, NULL); break; case 26: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); _stripManager.start(302, this); break; case 27: R2_GLOBALS._player.disableControl(); - setAction(&_sequenceManager1, this, 1120, &_actor16, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 1120, &_seeker, &R2_GLOBALS._player, NULL); break; case 28: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); _stripManager.start(303, this); break; + case 29: + case 50: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; case 51: R2_GLOBALS.setFlag(53); - _actor17.setDetails(1100, 28, -1, -1, 3, (SceneItem *) NULL); - // No break on purpose - case 50: - // No break on purpose - case 29: + _trooper.setDetails(1100, 28, -1, -1, 3, (SceneItem *) NULL); + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; break; case 52: R2_GLOBALS._sound1.play(98); @@ -1172,10 +1175,10 @@ void Scene1100::signal() { _sceneMode = 1116; if (R2_GLOBALS._player._characterIndex == 1) { setAction(&_sequenceManager1, this, 1116, &R2_GLOBALS._player, NULL); - _actor16.setAction(&_sequenceManager2, NULL, 1123, &_actor16, NULL); + _seeker.setAction(&_sequenceManager2, NULL, 1123, &_seeker, NULL); } else { setAction(&_sequenceManager1, this, 1124, &R2_GLOBALS._player, NULL); - _actor16.setAction(&_sequenceManager2, NULL, 1117, &_actor16, NULL); + _seeker.setAction(&_sequenceManager2, NULL, 1117, &_seeker, NULL); } break; case 53: @@ -1203,7 +1206,7 @@ void Scene1100::signal() { if (_stripManager._field2E8 == 1) { R2_GLOBALS._player.disableControl(); _sceneMode = 1125; - setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_actor16, NULL); + setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_seeker, NULL); } else R2_GLOBALS._player.enableControl(CURSOR_TALK); break; @@ -1244,9 +1247,9 @@ void Scene1100::signal() { break; case 1116: R2_GLOBALS._player.enableControl(CURSOR_ARROW); - _stripManager._lookupList[9] = 1; - _stripManager._lookupList[10] = 1; - _stripManager._lookupList[11] = 1; + R2_GLOBALS._stripManager_lookupList[9] = 1; + R2_GLOBALS._stripManager_lookupList[10] = 1; + R2_GLOBALS._stripManager_lookupList[11] = 1; break; case 1125: { _sceneMode = 99; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 23ebb2c276..eaca667377 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -75,15 +75,15 @@ public: }; class Scene1100 : public SceneExt { - class Actor16 : public SceneActor { + class Seeker : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor17 : public SceneActor { + class Trooper : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor18 : public SceneActor { + class Chief : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; @@ -118,9 +118,9 @@ public: SceneActor _actor15; BackgroundSceneObject _object1; BackgroundSceneObject _object2; - Actor16 _actor16; - Actor17 _actor17; - Actor18 _actor18; + Seeker _seeker; + Trooper _trooper; + Chief _chief; SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; SequenceManager _sequenceManager3; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index cd2ff669ff..8d91787272 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -360,7 +360,7 @@ void SpeakerChief1100::proc15() { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor18; + _object2 = &scene->_chief; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1231,7 +1231,7 @@ void SpeakerQuinn1100::proc15() { _object2 = &R2_GLOBALS._player; } else { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor16; + _object2 = &scene->_seeker; } _object2->hide(); @@ -1991,7 +1991,7 @@ void SpeakerSeeker1100::proc15() { _object2 = &R2_GLOBALS._player; } else { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor16; + _object2 = &scene->_seeker; } _object2->hide(); -- cgit v1.2.3 From 3af7b8d8724bbefb3f3943d0402d7d0c0f83dd43 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Aug 2013 20:03:27 +0200 Subject: MORTEVIELLE: Rename opcode variables --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/menu.cpp | 118 ++++++++++++++++++++-------------------- engines/mortevielle/menu.h | 52 +++++++++--------- engines/mortevielle/outtext.cpp | 2 +- engines/mortevielle/utils.cpp | 60 ++++++++++---------- 5 files changed, 117 insertions(+), 117 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 1b1e10daa2..2035f4307f 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -584,7 +584,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _currAction = _menu.OPCODE_ENTER; + _currAction = _menu._opcodeEnter; _syn = true; } else _crep = 997; diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index c8f34991bd..67199b97bc 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -49,13 +49,13 @@ const byte menuConstants[8][4] = { }; Menu::Menu() { - OPCODE_ATTACH = OPCODE_WAIT = OPCODE_FORCE = OPCODE_SLEEP = OPCODE_NONE; - OPCODE_LISTEN = OPCODE_ENTER = OPCODE_CLOSE = OPCODE_SEARCH = OPCODE_NONE; - OPCODE_KNOCK = OPCODE_SCRATCH = OPCODE_READ = OPCODE_EAT = OPCODE_NONE; - OPCODE_PLACE = OPCODE_OPEN = OPCODE_TAKE = OPCODE_LOOK = OPCODE_NONE; - OPCODE_SMELL = OPCODE_SOUND = OPCODE_LEAVE = OPCODE_LIFT = OPCODE_NONE; - OPCODE_TURN = OPCODE_SHIDE = OPCODE_SSEARCH = OPCODE_SREAD = OPCODE_NONE; - OPCODE_SPUT = OPCODE_SLOOK = OPCODE_NONE; + _opcodeAttach = _opcodeWait = _opcodeForce = _opcodeSleep = OPCODE_NONE; + _opcodeListen = _opcodeEnter = _opcodeClose = _opcodeSearch = OPCODE_NONE; + _opcodeKnock = _opcodeScratch = _opcodeRead = _opcodeEat = OPCODE_NONE; + _opcodePlace = _opcodeOpen = _opcodeTake = _opcodeLook = OPCODE_NONE; + _opcodeSmell = _opcodeSound = _opcodeLeave = _opcodeLift = OPCODE_NONE; + _opcodeTurn = _opcodeSHide = _opcodeSSearch = _opcodeSRead = OPCODE_NONE; + _opcodeSPut = _opcodeSLook = OPCODE_NONE; } void Menu::readVerbNums(Common::File &f, int dataSize) { @@ -87,68 +87,68 @@ void Menu::readVerbNums(Common::File &f, int dataSize) { } assert(dataSize == 52); - OPCODE_ATTACH = f.readUint16LE(); - OPCODE_WAIT = f.readUint16LE(); - OPCODE_FORCE = f.readUint16LE(); - OPCODE_SLEEP = f.readUint16LE(); - OPCODE_LISTEN = f.readUint16LE(); - OPCODE_ENTER = f.readUint16LE(); - OPCODE_CLOSE = f.readUint16LE(); - OPCODE_SEARCH = f.readUint16LE(); - OPCODE_KNOCK = f.readUint16LE(); - OPCODE_SCRATCH = f.readUint16LE(); - OPCODE_READ = f.readUint16LE(); - OPCODE_EAT = f.readUint16LE(); - OPCODE_PLACE = f.readUint16LE(); - OPCODE_OPEN = f.readUint16LE(); - OPCODE_TAKE = f.readUint16LE(); - OPCODE_LOOK = f.readUint16LE(); - OPCODE_SMELL = f.readUint16LE(); - OPCODE_SOUND = f.readUint16LE(); - OPCODE_LEAVE = f.readUint16LE(); - OPCODE_LIFT = f.readUint16LE(); - OPCODE_TURN = f.readUint16LE(); - OPCODE_SHIDE = f.readUint16LE(); - OPCODE_SSEARCH = f.readUint16LE(); - OPCODE_SREAD = f.readUint16LE(); - OPCODE_SPUT = f.readUint16LE(); - OPCODE_SLOOK = f.readUint16LE(); + _opcodeAttach = f.readUint16LE(); + _opcodeWait = f.readUint16LE(); + _opcodeForce = f.readUint16LE(); + _opcodeSleep = f.readUint16LE(); + _opcodeListen = f.readUint16LE(); + _opcodeEnter = f.readUint16LE(); + _opcodeClose = f.readUint16LE(); + _opcodeSearch = f.readUint16LE(); + _opcodeKnock = f.readUint16LE(); + _opcodeScratch = f.readUint16LE(); + _opcodeRead = f.readUint16LE(); + _opcodeEat = f.readUint16LE(); + _opcodePlace = f.readUint16LE(); + _opcodeOpen = f.readUint16LE(); + _opcodeTake = f.readUint16LE(); + _opcodeLook = f.readUint16LE(); + _opcodeSmell = f.readUint16LE(); + _opcodeSound = f.readUint16LE(); + _opcodeLeave = f.readUint16LE(); + _opcodeLift = f.readUint16LE(); + _opcodeTurn = f.readUint16LE(); + _opcodeSHide = f.readUint16LE(); + _opcodeSSearch = f.readUint16LE(); + _opcodeSRead = f.readUint16LE(); + _opcodeSPut = f.readUint16LE(); + _opcodeSLook = f.readUint16LE(); _actionMenu[0]._menuId = OPCODE_NONE >> 8; _actionMenu[0]._actionId = OPCODE_NONE & 0xFF; - _actionMenu[1]._menuId = OPCODE_SHIDE >> 8; - _actionMenu[1]._actionId = OPCODE_SHIDE & 0xFF; + _actionMenu[1]._menuId = _opcodeSHide >> 8; + _actionMenu[1]._actionId = _opcodeSHide & 0xFF; - _actionMenu[2]._menuId = OPCODE_ATTACH >> 8; - _actionMenu[2]._actionId = OPCODE_ATTACH & 0xFF; + _actionMenu[2]._menuId = _opcodeAttach >> 8; + _actionMenu[2]._actionId = _opcodeAttach & 0xFF; - _actionMenu[3]._menuId = OPCODE_FORCE >> 8; - _actionMenu[3]._actionId = OPCODE_FORCE & 0xFF; + _actionMenu[3]._menuId = _opcodeForce >> 8; + _actionMenu[3]._actionId = _opcodeForce & 0xFF; - _actionMenu[4]._menuId = OPCODE_SLEEP >> 8; - _actionMenu[4]._actionId = OPCODE_SLEEP & 0xFF; + _actionMenu[4]._menuId = _opcodeSleep >> 8; + _actionMenu[4]._actionId = _opcodeSleep & 0xFF; - _actionMenu[5]._menuId = OPCODE_ENTER >> 8; - _actionMenu[5]._actionId = OPCODE_ENTER & 0xFF; + _actionMenu[5]._menuId = _opcodeEnter >> 8; + _actionMenu[5]._actionId = _opcodeEnter & 0xFF; - _actionMenu[6]._menuId = OPCODE_CLOSE >> 8; - _actionMenu[6]._menuId = OPCODE_CLOSE & 0xFF; + _actionMenu[6]._menuId = _opcodeClose >> 8; + _actionMenu[6]._menuId = _opcodeClose & 0xFF; - _actionMenu[7]._menuId = OPCODE_KNOCK >> 8; - _actionMenu[7]._menuId = OPCODE_KNOCK & 0xFF; + _actionMenu[7]._menuId = _opcodeKnock >> 8; + _actionMenu[7]._menuId = _opcodeKnock & 0xFF; - _actionMenu[8]._menuId = OPCODE_EAT >> 8; - _actionMenu[8]._menuId = OPCODE_EAT & 0xFF; + _actionMenu[8]._menuId = _opcodeEat >> 8; + _actionMenu[8]._menuId = _opcodeEat & 0xFF; - _actionMenu[9]._menuId = OPCODE_PLACE >> 8; - _actionMenu[9]._menuId = OPCODE_PLACE & 0xFF; + _actionMenu[9]._menuId = _opcodePlace >> 8; + _actionMenu[9]._menuId = _opcodePlace & 0xFF; - _actionMenu[10]._menuId = OPCODE_OPEN >> 8; - _actionMenu[10]._menuId = OPCODE_OPEN & 0xFF; + _actionMenu[10]._menuId = _opcodeOpen >> 8; + _actionMenu[10]._menuId = _opcodeOpen & 0xFF; - _actionMenu[11]._menuId = OPCODE_LEAVE >> 8; - _actionMenu[11]._menuId = OPCODE_LEAVE & 0xFF; + _actionMenu[11]._menuId = _opcodeLeave >> 8; + _actionMenu[11]._menuId = _opcodeLeave & 0xFF; } /** @@ -701,8 +701,8 @@ void Menu::setSearchMenu() { for (int i = 1; i <= 11; ++i) disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); - setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_SUITE)); - setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_STOP)); + setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_SUITE)); + setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_STOP)); } /** @@ -714,8 +714,8 @@ void Menu::unsetSearchMenu() { for (int i = 1; i <= 11; ++i) enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); - setText(OPCODE_SOUND >> 8, OPCODE_SOUND & 0xFF, _vm->getEngineString(S_PROBE)); - setText(OPCODE_LIFT >> 8, OPCODE_LIFT & 0xFF, _vm->getEngineString(S_RAISE)); + setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_PROBE)); + setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_RAISE)); } /** diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index a1b654ccaf..9afa99cfa8 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -75,32 +75,32 @@ public: menuItem _inventoryMenu[9]; menuItem _moveMenu[8]; - int OPCODE_ATTACH; - int OPCODE_WAIT; - int OPCODE_FORCE; - int OPCODE_SLEEP; - int OPCODE_LISTEN; - int OPCODE_ENTER; - int OPCODE_CLOSE; - int OPCODE_SEARCH; - int OPCODE_KNOCK; - int OPCODE_SCRATCH; - int OPCODE_READ; - int OPCODE_EAT; - int OPCODE_PLACE; - int OPCODE_OPEN; - int OPCODE_TAKE; - int OPCODE_LOOK; - int OPCODE_SMELL; - int OPCODE_SOUND; - int OPCODE_LEAVE; - int OPCODE_LIFT; - int OPCODE_TURN; - int OPCODE_SHIDE; - int OPCODE_SSEARCH; - int OPCODE_SREAD; - int OPCODE_SPUT; - int OPCODE_SLOOK; + int _opcodeAttach; + int _opcodeWait; + int _opcodeForce; + int _opcodeSleep; + int _opcodeListen; + int _opcodeEnter; + int _opcodeClose; + int _opcodeSearch; + int _opcodeKnock; + int _opcodeScratch; + int _opcodeRead; + int _opcodeEat; + int _opcodePlace; + int _opcodeOpen; + int _opcodeTake; + int _opcodeLook; + int _opcodeSmell; + int _opcodeSound; + int _opcodeLeave; + int _opcodeLift; + int _opcodeTurn; + int _opcodeSHide; + int _opcodeSSearch; + int _opcodeSRead; + int _opcodeSPut; + int _opcodeSLook; menuItem _actionMenu[12]; void setParent(MortevielleEngine *vm); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 9451e655dd..d1cbeea683 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -314,7 +314,7 @@ void TextHandler::taffich() { loadAniFile(filename, drawingStartPos, drawingSize); } _vm->_mouse.showMouse(); - if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu.OPCODE_ENTER)) { + if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu._opcodeEnter)) { if ((a == ATTIC) || (a == CELLAR)) _vm->displayAloneText(); else if (!_vm->_blo) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 3cacbec630..356b6a830d 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -327,9 +327,9 @@ void MortevielleEngine::handleAction() { if (_mouse._pos.y < 12) return; - if ((_currAction == _menu.OPCODE_SOUND) || (_currAction == _menu.OPCODE_LIFT)) { + if ((_currAction == _menu._opcodeSound) || (_currAction == _menu._opcodeLift)) { handledOpcodeFl = true; - if ((_currAction == _menu.OPCODE_LIFT) || (_obpart)) { + if ((_currAction == _menu._opcodeLift) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; _crep = 998; @@ -1536,7 +1536,7 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_uptodatePresence) { - if ((_currMenu == MENU_MOVE) || (_currAction == _menu.OPCODE_LEAVE) || (_currAction == _menu.OPCODE_SLEEP) || (_currAction == _menu.OPCODE_EAT)) { + if ((_currMenu == MENU_MOVE) || (_currAction == _menu._opcodeLeave) || (_currAction == _menu._opcodeSleep) || (_currAction == _menu._opcodeEat)) { _controlMenu = 4; menuUp(); return; @@ -1548,59 +1548,59 @@ void MortevielleEngine::handleOpcode() { fctDiscuss(); if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - if (_currAction == _menu.OPCODE_ATTACH) + if (_currAction == _menu._opcodeAttach) fctAttach(); - if (_currAction == _menu.OPCODE_WAIT) + if (_currAction == _menu._opcodeWait) fctWait(); - if (_currAction == _menu.OPCODE_FORCE) + if (_currAction == _menu._opcodeForce) fctForce(); - if (_currAction == _menu.OPCODE_SLEEP) + if (_currAction == _menu._opcodeSleep) fctSleep(); - if (_currAction == _menu.OPCODE_LISTEN) + if (_currAction == _menu._opcodeListen) fctListen(); - if (_currAction == _menu.OPCODE_ENTER) + if (_currAction == _menu._opcodeEnter) fctEnter(); - if (_currAction == _menu.OPCODE_CLOSE) + if (_currAction == _menu._opcodeClose) fctClose(); - if (_currAction == _menu.OPCODE_SEARCH) + if (_currAction == _menu._opcodeSearch) fctSearch(); - if (_currAction == _menu.OPCODE_KNOCK) + if (_currAction == _menu._opcodeKnock) fctKnock(); - if (_currAction == _menu.OPCODE_SCRATCH) + if (_currAction == _menu._opcodeScratch) fctScratch(); - if (_currAction == _menu.OPCODE_READ) + if (_currAction == _menu._opcodeRead) fctRead(); - if (_currAction == _menu.OPCODE_EAT) + if (_currAction == _menu._opcodeEat) fctEat(); - if (_currAction == _menu.OPCODE_PLACE) + if (_currAction == _menu._opcodePlace) fctPlace(); - if (_currAction == _menu.OPCODE_OPEN) + if (_currAction == _menu._opcodeOpen) fctOpen(); - if (_currAction == _menu.OPCODE_TAKE) + if (_currAction == _menu._opcodeTake) fctTake(); - if (_currAction == _menu.OPCODE_LOOK) + if (_currAction == _menu._opcodeLook) fctLook(); - if (_currAction == _menu.OPCODE_SMELL) + if (_currAction == _menu._opcodeSmell) fctSmell(); - if (_currAction == _menu.OPCODE_SOUND) + if (_currAction == _menu._opcodeSound) fctSound(); - if (_currAction == _menu.OPCODE_LEAVE) + if (_currAction == _menu._opcodeLeave) fctLeave(); - if (_currAction == _menu.OPCODE_LIFT) + if (_currAction == _menu._opcodeLift) fctLift(); - if (_currAction == _menu.OPCODE_TURN) + if (_currAction == _menu._opcodeTurn) fctTurn(); - if (_currAction == _menu.OPCODE_SSEARCH) + if (_currAction == _menu._opcodeSSearch) fctSelfSearch(); - if (_currAction == _menu.OPCODE_SREAD) + if (_currAction == _menu._opcodeSRead) fctSelfRead(); - if (_currAction == _menu.OPCODE_SPUT) + if (_currAction == _menu._opcodeSPut) fctSelfPut(); - if (_currAction == _menu.OPCODE_SLOOK) + if (_currAction == _menu._opcodeSLook) fctSelftLook(); _hiddenHero = false; - if (_currAction == _menu.OPCODE_SHIDE) + if (_currAction == _menu._opcodeSHide) fctSelfHide(); } else { if (_anyone) { @@ -3400,7 +3400,7 @@ void MortevielleEngine::displayLookScreen(int objId) { int mdes = _caff; _caff = objId; - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu.OPCODE_SLOOK)) { + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu._opcodeSLook)) { drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) handleDescriptionText(2, _caff); -- cgit v1.2.3 From 0aa669cc479e87cf66c7edcf5aed5299f2895bed Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 16 Aug 2013 00:33:03 +0200 Subject: WINTERMUTE: Fix (still disabled) modTargetRect logic Width and height were computed incorrectly. Also, the shift by _renderRect is not necessary since that was to compensate for the coordinate translation done by the original SDL_RenderSetViewport, which we don't perform. --- .../wintermute/base/gfx/osystem/base_render_osystem.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index b16cf60752..0e7e5aa819 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -631,15 +631,13 @@ Rect32 BaseRenderOSystem::getViewPort() { ////////////////////////////////////////////////////////////////////////// void BaseRenderOSystem::modTargetRect(Common::Rect *rect) { - // FIXME: This is wrong in quite a few ways right now, and ends up - // breaking the notebook in Dirty Split, so we disable the correction - // for now, this will need fixing when a game with odd aspect-ratios - // show up. return; - rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft - _renderRect.left); - rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop - _renderRect.top); - rect->setWidth((int16)MathUtil::roundUp(rect->width() * _ratioX)); - rect->setHeight((int16)MathUtil::roundUp(rect->height() * _ratioY)); + int newWidth = (int16)MathUtil::roundUp(rect->width() * _ratioX); + int newHeight = (int16)MathUtil::roundUp(rect->height() * _ratioY); + rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft); + rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop); + rect->setWidth(newWidth); + rect->setHeight(newHeight); } ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 21314e2389dfe4fa7f7cacc94fa2b99421fe4a66 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Thu, 15 Aug 2013 14:08:00 +0200 Subject: WINTERMUTE: Fix computation of _renderRect. This reverts the changes in 4cf1d671. Fixes the "notebook bug" - i.e. the notebook being only partially drawn - in Dirty Split. --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 0e7e5aa819..668105457f 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -613,8 +613,8 @@ bool BaseRenderOSystem::setViewport(int left, int top, int right, int bottom) { // TODO: Hopefully this is the same logic that ScummVM uses. rect.left = (int16)(left + _borderLeft); rect.top = (int16)(top + _borderTop); - rect.right = (int16)((right - left) * _ratioX); - rect.bottom = (int16)((bottom - top) * _ratioY); + rect.setWidth((int16)((right - left) * _ratioX)); + rect.setHeight((int16)((bottom - top) * _ratioY)); _renderRect = rect; return STATUS_OK; -- cgit v1.2.3 From a653ae20d59efe4260d3e2febdf4533943027d00 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Wed, 14 Aug 2013 16:55:50 +0200 Subject: WINTERMUTE: Fix offset calculation with partial rects when sprites are mirrored. This fixes the dress bug, aka Rosemary appearing "jigsawed" when passing over her with the cursor when she is facing east. See bug #3592907 --- engines/wintermute/graphics/transparent_surface.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index df6286e37a..e375322ae9 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -309,7 +309,19 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p } if (pPartRect) { - srcImage.pixels = getBasePtr(pPartRect->left, pPartRect->top); + + int xOffset = pPartRect->left; + int yOffset = pPartRect->top; + + if (flipping & FLIP_V) { + yOffset = srcImage.h - pPartRect->bottom; + } + + if (flipping & FLIP_H) { + xOffset = srcImage.w - pPartRect->right; + } + + srcImage.pixels = getBasePtr(xOffset, yOffset); srcImage.w = pPartRect->width(); srcImage.h = pPartRect->height(); -- cgit v1.2.3 From 67137434416df22f5e75cd29d94c8a9fa195ed66 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 14 Aug 2013 00:15:40 +0200 Subject: VKEYBD: Make code agnostic of OverlayColor. This removes the use of OverlayColor in vkeybd and supports both 16 and 32bit overlays. --- backends/vkeybd/virtual-keyboard-gui.cpp | 34 ++++++++++++++++++++------------ backends/vkeybd/virtual-keyboard-gui.h | 6 +++--- backends/vkeybd/virtual-keyboard.h | 4 ++-- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 8bf9a54251..ec4cbf1de2 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -32,11 +32,9 @@ namespace Common { -static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, OverlayColor transparent) { - if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor)) - return; - - const OverlayColor *src = (const OverlayColor *)surf_src->getPixels(); +template +static void blitImplementation(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, ColorType transparent) { + const ColorType *src = (const ColorType *)surf_src->getPixels(); int blitW = surf_src->w; int blitH = surf_src->h; @@ -58,13 +56,13 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 if (blitW <= 0 || blitH <= 0) return; - OverlayColor *dst = (OverlayColor *)surf_dst->getBasePtr(x, y); + ColorType *dst = (ColorType *)surf_dst->getBasePtr(x, y); int dstAdd = surf_dst->w - blitW; int srcAdd = surf_src->w - blitW; for (int i = 0; i < blitH; ++i) { for (int j = 0; j < blitW; ++j, ++dst, ++src) { - OverlayColor col = *src; + ColorType col = *src; if (col != transparent) *dst = col; } @@ -73,6 +71,16 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 } } +static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, uint32 transparent) { + if (surf_dst->format.bytesPerPixel != surf_src->format.bytesPerPixel) + return; + + if (surf_dst->format.bytesPerPixel == 2) + blitImplementation(surf_dst, surf_src, x, y, transparent); + else if (surf_dst->format.bytesPerPixel == 4) + blitImplementation(surf_dst, surf_src, x, y, transparent); +} + VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) : _kbd(kbd), _displaying(false), _drag(false), _drawCaret(false), _displayEnabled(false), _firstRun(true), @@ -111,7 +119,7 @@ void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { } } -void VirtualKeyboardGUI::setupDisplayArea(Rect &r, OverlayColor forecolor) { +void VirtualKeyboardGUI::setupDisplayArea(Rect &r, uint32 forecolor) { _dispFont = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); if (!fontIsSuitable(_dispFont, r)) { @@ -356,13 +364,13 @@ void VirtualKeyboardGUI::redraw() { Graphics::Surface surf; surf.create(w, h, _system->getOverlayFormat()); - OverlayColor *dst = (OverlayColor *)surf.getPixels(); - const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); + byte *dst = (byte *)surf.getPixels(); + const byte *src = (const byte *)_overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); while (h--) { - memcpy(dst, src, surf.w * sizeof(OverlayColor)); - dst += surf.w; - src += _overlayBackup.w; + memcpy(dst, src, surf.pitch); + dst += surf.pitch; + src += _overlayBackup.pitch; } blit(&surf, _kbdSurface, _kbdBound.left - _dirtyRect.left, diff --git a/backends/vkeybd/virtual-keyboard-gui.h b/backends/vkeybd/virtual-keyboard-gui.h index d0f9c884ed..a2000adea0 100644 --- a/backends/vkeybd/virtual-keyboard-gui.h +++ b/backends/vkeybd/virtual-keyboard-gui.h @@ -99,7 +99,7 @@ private: VirtualKeyboard *_kbd; Rect _kbdBound; Graphics::Surface *_kbdSurface; - OverlayColor _kbdTransparentColor; + uint32 _kbdTransparentColor; Point _dragPoint; bool _drag; @@ -113,7 +113,7 @@ private: const Graphics::Font *_dispFont; int16 _dispX, _dispY; uint _dispI; - OverlayColor _dispForeColor, _dispBackColor; + uint32 _dispForeColor, _dispBackColor; int _lastScreenChanged; int16 _screenW, _screenH; @@ -121,7 +121,7 @@ private: bool _displaying; bool _firstRun; - void setupDisplayArea(Rect &r, OverlayColor forecolor); + void setupDisplayArea(Rect &r, uint32 forecolor); void move(int16 x, int16 y); void moveToDefaultPosition(); void screenChanged(); diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 4ab5ad446d..3b2b2196bd 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -112,11 +112,11 @@ protected: String resolution; String bitmapName; Graphics::Surface *image; - OverlayColor transparentColor; + uint32 transparentColor; ImageMap imageMap; VKEventMap events; Rect displayArea; - OverlayColor displayFontColor; + uint32 displayFontColor; Mode() : image(0) {} ~Mode() { -- cgit v1.2.3 From 764a34edf74813d703f81c48778bd4494079f49f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 14 Aug 2013 02:37:19 +0200 Subject: TESTBED: Make code agonstic to OverlayColor. --- engines/testbed/graphics.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index 590e6c6d81..26e073d407 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -927,17 +927,29 @@ TestExitStatus GFXtests::overlayGraphics() { Graphics::PixelFormat pf = g_system->getOverlayFormat(); - OverlayColor buffer[50 * 100]; - OverlayColor value = pf.RGBToColor(0, 255, 0); + byte *buffer = new byte[50 * 100 * pf.bytesPerPixel]; + const uint32 value = pf.RGBToColor(0, 255, 0); - for (int i = 0; i < 50 * 100; i++) { - buffer[i] = value; + if (pf.bytesPerPixel == 2) { + uint16 *dst = (uint16 *)buffer; + for (int i = 50 * 100; i > 0; --i) { + *dst++ = value; + } + } else if (pf.bytesPerPixel == 4) { + uint32 *dst = (uint32 *)buffer; + for (int i = 50 * 100; i > 0; --i) { + *dst++ = value; + } + } else { + error("GFXtests::overlayGraphics: Unsupported color depth: %d", pf.bytesPerPixel); } g_system->showOverlay(); - g_system->copyRectToOverlay(buffer, 200, 270, 175, 100, 50); + g_system->copyRectToOverlay(buffer, 100 * pf.bytesPerPixel, 270, 175, 100, 50); g_system->updateScreen(); + delete[] buffer; + g_system->delayMillis(1000); g_system->hideOverlay(); -- cgit v1.2.3 From 0c8f8898ffe2eeea15691a315eb890d74fdc29a7 Mon Sep 17 00:00:00 2001 From: Kirben Date: Fri, 16 Aug 2013 15:19:17 +1000 Subject: SCUMM: Add new variables in Nimbus Games version of Putt-Putt Saves the Zoo. --- engines/scumm/detection_tables.h | 6 +++++- engines/scumm/scumm.h | 1 + engines/scumm/vars.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index f13a8c15e6..6717ea9b06 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -299,7 +299,11 @@ static const GameSettings gameVariantsTable[] = { // Changed o_getResourceSize to cover all resource types {"farm", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, - {"puttzoo", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"puttzoo", "", 0, GID_PUTTZOO, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"puttzoo", "HE 72", 0, GID_PUTTZOO, 6, 72, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"puttzoo", "HE 98.5", 0, GID_PUTTZOO, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"puttzoo", "HE 99", 0, GID_PUTTZOO, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, + {"puttzoo", "HE 100", 0, GID_PUTTZOO, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, // Added VAR_PLATFORM variable {"jungle", "", 0, GID_HEGAME, 6, 74, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)}, diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index a77c1c0141..ca05c90936 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -240,6 +240,7 @@ enum ScummGameId { GID_FBEAR, GID_PUTTMOON, GID_FUNPACK, + GID_PUTTZOO, GID_FREDDI3, GID_BIRTHDAYRED, GID_BIRTHDAYYELLOW, diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 77c7daa0df..9c90d7575d 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -714,6 +714,12 @@ void ScummEngine_v99he::resetScummVars() { VAR(140) = 0; #endif } + + if (_game.id == GID_PUTTZOO && _game.heversion == 100 && _game.platform == Common::kPlatformWindows) { + // Specific to Nimbus Games version. + VAR(156) = 1; + VAR(157) = 0; + } } #endif -- cgit v1.2.3 From b4f2e2ead43087dec0ad355118f05c1115b18908 Mon Sep 17 00:00:00 2001 From: Kirben Date: Fri, 16 Aug 2013 15:49:30 +1000 Subject: SCUMM: Always confirm quit when required in HE games. --- engines/scumm/he/script_v100he.cpp | 2 +- engines/scumm/he/script_v70he.cpp | 2 +- engines/scumm/he/script_v72he.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index b024154c7f..987f74957c 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -2148,7 +2148,7 @@ void ScummEngine_v100he::o100_systemOps() { break; case 132: // Confirm shutdown - quitGame(); + confirmExitDialog(); break; case 133: quitGame(); diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index adb2fcac2e..9259e0db2f 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -309,7 +309,7 @@ void ScummEngine_v70he::o70_systemOps() { break; case 160: // Confirm shutdown - quitGame(); + confirmExitDialog(); break; case 244: quitGame(); diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index f36f5cc130..d4920cf430 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1199,7 +1199,7 @@ void ScummEngine_v72he::o72_systemOps() { break; case 160: // Confirm shutdown - quitGame(); + confirmExitDialog(); break; case 244: quitGame(); -- cgit v1.2.3 From 49ea7cd1fdac7e85f6744ca79232fcfc9e11d3c4 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 06:54:54 +0100 Subject: GUI: Add too long string literal warning code to theme generation tool. This has the same effect as clang's -Woverlength-strings warning of string literals longer than C++ compilers are specified to work with. --- gui/themes/scummtheme.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gui/themes/scummtheme.py b/gui/themes/scummtheme.py index 4c55fd79de..e8001f8bc6 100755 --- a/gui/themes/scummtheme.py +++ b/gui/themes/scummtheme.py @@ -37,6 +37,7 @@ def parseSTX(theme_file, def_file): comm = re.compile("", re.DOTALL) head = re.compile("<\?(.*?)\?>") + strlitcount = 0 output = "" for line in theme_file: output += line.rstrip("\r\n\t ").lstrip() + " \n" @@ -48,7 +49,9 @@ def parseSTX(theme_file, def_file): for line in output.splitlines(): if line and not line.isspace(): + strlitcount += len(line) def_file.write("\"" + line + "\"\n") + return strlitcount def buildDefTheme(themeName): def_file = open("default.inc", "w") @@ -57,16 +60,23 @@ def buildDefTheme(themeName): print ("Cannot open default theme dir.") def_file.write(""" ""\n""") + strlitcount = 24 for filename in os.listdir(themeName): filename = os.path.join(themeName, filename) if os.path.isfile(filename) and filename.endswith(".stx"): theme_file = open(filename, "r") - parseSTX(theme_file, def_file) + strlitcount += parseSTX(theme_file, def_file) theme_file.close() def_file.close() + if strlitcount > 65535: + print("WARNING: default.inc string literal is of length %d which exceeds the" % strlitcount) + print(" maximum length of 65536 that C++ compilers are required to support.") + print(" It is likely that bugs will occur dependent on compiler behaviour.") + print(" To avoid this, reduce the size of the theme.") + def printUsage(): print ("===============================") print ("ScummVM Theme Generation Script") -- cgit v1.2.3 From 01a1e63786cc8c37d1a49f9eb33635d2ad1a2b62 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 06:57:40 +0100 Subject: GUI: Add code to default theme generation to reduce string length. The additional code skips the extraneous spaces after the end of an XML close brace (>) reducing the string literal by 3106 characters, thus bringing it within the limit for C++ string literals. Have regenerated the default.inc from scummclassic with this change. --- gui/themes/default.inc | 2892 +++++++++++++++++++++++----------------------- gui/themes/scummtheme.py | 5 +- 2 files changed, 1450 insertions(+), 1447 deletions(-) diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 1b6ae3ec27..352cc86852 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,142 +1,142 @@ "" -" " -" " +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" " " -" " -" " +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " -" " +"/>" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"
" +"
" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" +"" " " -" " -" " -" " +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " -" " -" " +"/>" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " +"/>" +"" " " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" " " +"/>" " " +"/>" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " +"/>" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" +"" +"" " " +"/>" " " -" " +"/>" +"" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"" " " -" " +"/>" +"" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " +"/>" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " +"/>" +"" +"" +"" " " +"/>" " " +"/>" " " -" " -" " -" " -" " +"/>" +"" +"" +"" +"
" diff --git a/gui/themes/scummtheme.py b/gui/themes/scummtheme.py index e8001f8bc6..524e91468e 100755 --- a/gui/themes/scummtheme.py +++ b/gui/themes/scummtheme.py @@ -40,7 +40,10 @@ def parseSTX(theme_file, def_file): strlitcount = 0 output = "" for line in theme_file: - output += line.rstrip("\r\n\t ").lstrip() + " \n" + output += line.rstrip("\r\n\t ").lstrip() + if not output.endswith('>'): + output += ' ' + output += "\n" output = re.sub(comm, "", output) output = re.sub(head, "", output) -- cgit v1.2.3 From c67508b42d4d19ff58e766e63a0f5796436b6c65 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 07:20:51 +0100 Subject: DEVTOOLS: Enable builtin theme in MSVC 2005 and 2008 in create_project. This reverts commit b830f68bacd18f51f4dd912ce3b54ec47d63f31d as the builtin theme is less than 64K again. --- devtools/create_project/visualstudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp index 17e378fd0f..23225d3435 100644 --- a/devtools/create_project/visualstudio.cpp +++ b/devtools/create_project/visualstudio.cpp @@ -286,7 +286,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea if (isRelease) { properties << "\t\tEnableIntrinsicFunctions=\"true\"\n" "\t\tWholeProgramOptimization=\"true\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD\"\n" + "\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n" "\t\tStringPooling=\"true\"\n" "\t\tBufferSecurityCheck=\"false\"\n" "\t\tDebugInformationFormat=\"0\"\n" @@ -300,7 +300,7 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea "\t\tSetChecksum=\"true\"\n"; } else { properties << "\t\tOptimization=\"0\"\n" - "\t\tPreprocessorDefinitions=\"WIN32;DISABLE_GUI_BUILTIN_THEME\"\n" + "\t\tPreprocessorDefinitions=\"WIN32\"\n" "\t\tMinimalRebuild=\"true\"\n" "\t\tBasicRuntimeChecks=\"3\"\n" "\t\tRuntimeLibrary=\"1\"\n" -- cgit v1.2.3 From 9d36991e16e7e806bd376b10200e10bb76a03225 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 16 Aug 2013 07:22:26 +0100 Subject: CREATE_PROJECT: Enable built-in theme for MSVC builds again. This reverts commit d089658fb84f67652e9569bc03c76bcc65e7b881. --- devtools/create_project/msbuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp index 23bf1bc28a..60aa35b739 100644 --- a/devtools/create_project/msbuild.cpp +++ b/devtools/create_project/msbuild.cpp @@ -405,7 +405,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b if (isRelease) { properties << "\t\t\ttrue\n" "\t\t\ttrue\n" - "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;RELEASE_BUILD;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;RELEASE_BUILD;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tfalse\n" "\t\t\t\n" @@ -417,7 +417,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b "\t\t\ttrue\n"; } else { properties << "\t\t\tDisabled\n" - "\t\t\tWIN32;DISABLE_GUI_BUILTIN_THEME;%(PreprocessorDefinitions)\n" + "\t\t\tWIN32;%(PreprocessorDefinitions)\n" "\t\t\ttrue\n" "\t\t\tEnableFastChecks\n" "\t\t\tMultiThreadedDebug\n" -- cgit v1.2.3 From 4a885af83a21af25d4d26cf768871aa2bcebb69e Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Fri, 16 Aug 2013 10:47:11 +0100 Subject: MORTEVIELLE: Improve reading of menu file Do not try to read the menu.mor file as it has a different format not supported (and detection for it was already removed). Also only tries to read the menu for the original language. This avoids using the French menu with the German game when both files are present in the search path. --- engines/mortevielle/detection.cpp | 2 ++ engines/mortevielle/menu.cpp | 10 ++++++---- engines/mortevielle/mortevielle.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 7d0f3c4d88..8e2eab52b8 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -36,6 +36,8 @@ uint32 MortevielleEngine::getGameFlags() const { return _gameDescription->desc.f Common::Language MortevielleEngine::getLanguage() const { return _gameDescription->desc.language; } +Common::Language MortevielleEngine::getOriginalLanguage() const { return _gameDescription->originalLanguage; } + } static const PlainGameDescriptor MortevielleGame[] = { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 67199b97bc..7962c176af 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -638,11 +638,13 @@ void Menu::initMenu() { } if (!enMenuLoaded) { - if (!f.open("menufr.mor")) + if (_vm->getOriginalLanguage() == Common::FR_FRA) { + if (!f.open("menufr.mor")) + error("Missing file - menufr.mor"); + } else { // Common::DE_DEU if (!f.open("menual.mor")) - if (!f.open("menu.mor")) - error("Missing file - menufr.mor or menual.mor or menu.mor"); - + error("Missing file - menual.mor"); + } f.read(_charArr, 7 * 24); f.close(); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 27a3d5697a..d3930f7107 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -461,6 +461,7 @@ public: virtual Common::Error run(); uint32 getGameFlags() const; Common::Language getLanguage() const; + Common::Language getOriginalLanguage() const; static Common::String generateSaveFilename(const Common::String &target, int slot); Common::String generateSaveFilename(int slot) { return generateSaveFilename(_targetName, slot); } -- cgit v1.2.3 From dcfb1298dc6166c66e5e6787fd9f52b619c0ad52 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 13:29:23 +0200 Subject: MORTEVIELLE: Some refactoring in Menu --- engines/mortevielle/menu.cpp | 124 +++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 70 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 7962c176af..a64c5a8c90 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -192,7 +192,7 @@ void Menu::setText(int menuId, int actionId, Common::String name) { void Menu::setDestinationText(int roomId) { Common::String nomp; - if (roomId == 26) + if (roomId == ROOM26) roomId = LANDING; int destinationId = 0; @@ -258,8 +258,6 @@ void Menu::enableMenuItem(int menuId, int actionId) { break; case MENU_SELF: _selfStringArray[actionId].setChar(' ', 0); - // The original sets two times the same value. Skipped - // _selfStringArray[l].setChar(' ', 0); break; case MENU_DISCUSS: _discussStringArray[actionId].setChar(' ', 0); @@ -270,44 +268,38 @@ void Menu::enableMenuItem(int menuId, int actionId) { } void Menu::displayMenu() { - int ind_tabl, k, col; - - int pt, x, y, color, msk, num_letr; - _vm->_mouse.hideMouse(); - _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - col = 28 * _vm->_resolutionScaler; + + int col = 28 * _vm->_resolutionScaler; + int color; if (_vm->_currGraphicalDevice == MODE_CGA) color = 1; else color = 9; - num_letr = 0; - do { // One character after the other - ++num_letr; - ind_tabl = 0; - y = 1; - do { // One column after the other - k = 0; - x = col; - do { // One line after the other - msk = 0x80; - for (pt = 0; pt <= 7; ++pt) { - if ((_charArr[num_letr - 1][ind_tabl] & msk) != 0) { + for (int charNum = 0; charNum < 6; charNum++) { + // One character after the other + int idx = 0; + for (int y = 1; y < 9; ++y) { + // One column after the other + int x = col; + for (int k = 0; k < 3; ++k) { + // One line after the other + uint msk = 0x80; + for (int pt = 0; pt <= 7; ++pt) { + if ((_charArr[charNum][idx] & msk) != 0) { _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); _vm->_screenSurface.setPixel(Common::Point(x, y), color); } - msk = (uint)msk >> 1; + msk >>= 1; ++x; } - ++ind_tabl; - ++k; - } while (k != 3); - ++y; - } while (y != 9); + ++idx; + } + } col += 48 * _vm->_resolutionScaler; - } while (num_letr != 6); + } _vm->_mouse.showMouse(); } @@ -408,79 +400,74 @@ void Menu::util(Common::Point pos) { * Draw a menu */ void Menu::menuDown(int ii) { - int cx, xcc, xco; - int lignNumb; - // Make a copy of the current screen surface for later restore _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); // Draw the menu - xco = menuConstants[ii - 1][0]; - lignNumb = menuConstants[ii - 1][3]; + int minX = menuConstants[ii - 1][0] << 3; + int lineNum = menuConstants[ii - 1][3]; _vm->_mouse.hideMouse(); - xco = xco << 3; + int deltaX; if (_vm->_resolutionScaler == 1) - cx = 10; + deltaX = 10; else - cx = 6; - xcc = xco + (menuConstants[ii - 1][2] * cx) + 6; + deltaX = 6; + int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6; if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version - xcc = 435; - - _vm->_screenSurface.fillRect(15, Common::Rect(xco, 12, xcc, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(xcc, 12, xcc + 4, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(xco, 8 + (menuConstants[ii - 1][1] << 1), xcc + 4, 12 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.putxy(xco, 16); - cx = 0; - do { - ++cx; + maxX = 435; + + _vm->_screenSurface.fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface.putxy(minX, 16); + for (int i = 1; i <= lineNum; i++) { switch (ii) { case 1: - if (_inventoryStringArray[cx][0] != '*') - _vm->_screenSurface.drawString(_inventoryStringArray[cx], 4); + if (_inventoryStringArray[i][0] != '*') + _vm->_screenSurface.drawString(_inventoryStringArray[i], 4); break; case 2: - if (_moveStringArray[cx][0] != '*') - _vm->_screenSurface.drawString(_moveStringArray[cx], 4); + if (_moveStringArray[i][0] != '*') + _vm->_screenSurface.drawString(_moveStringArray[i], 4); break; case 3: - if (_actionStringArray[cx][0] != '*') - _vm->_screenSurface.drawString(_actionStringArray[cx], 4); + if (_actionStringArray[i][0] != '*') + _vm->_screenSurface.drawString(_actionStringArray[i], 4); break; case 4: - if (_selfStringArray[cx][0] != '*') - _vm->_screenSurface.drawString(_selfStringArray[cx], 4); + if (_selfStringArray[i][0] != '*') + _vm->_screenSurface.drawString(_selfStringArray[i], 4); break; case 5: - if (_discussStringArray[cx][0] != '*') - _vm->_screenSurface.drawString(_discussStringArray[cx], 4); + if (_discussStringArray[i][0] != '*') + _vm->_screenSurface.drawString(_discussStringArray[i], 4); break; case 6: - _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + cx), 4); + _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); break; case 7: { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; - s += (char)(48 + cx); + s += (char)(48 + i); _vm->_screenSurface.drawString(s, 4); } break; case 8: - if (cx == 1) + if (i == 1) _vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4); else { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; - s += (char)(47 + cx); + s += (char)(47 + i); _vm->_screenSurface.drawString(s, 4); } break; default: break; } - _vm->_screenSurface.putxy(xco, _vm->_screenSurface._textPos.y + 8); - } while (cx != lignNumb); + _vm->_screenSurface.putxy(minX, _vm->_screenSurface._textPos.y + 8); + } _multiTitle = true; _vm->_mouse.showMouse(); } @@ -594,7 +581,6 @@ void Menu::setParent(MortevielleEngine *vm) { } void Menu::initMenu() { - int i; Common::File f; bool enMenuLoaded = false; @@ -651,13 +637,12 @@ void Menu::initMenu() { // Skipped: dialog asking to swap floppy - for (i = 1; i <= 8; ++i) + for (int i = 1; i <= 8; ++i) _inventoryStringArray[i] = "* "; _inventoryStringArray[7] = "< -*-*-*-*-*-*-*-*-*- "; - for (i = 1; i <= 7; ++i) + for (int i = 1; i <= 7; ++i) _moveStringArray[i] = "* "; - i = 1; - do { + for (int i = 1; i < 22; i++) { _actionStringArray[i] = _vm->getString(i + kMenuActionStringIndex); while (_actionStringArray[i].size() < 10) @@ -671,9 +656,8 @@ void Menu::initMenu() { } _discussStringArray[i] = _vm->getString(i + kMenuSayStringIndex) + ' '; } - ++i; - } while (i != 22); - for (i = 1; i <= 8; ++i) { + } + for (int i = 1; i <= 8; ++i) { _discussMenu[i]._menuId = MENU_DISCUSS; _discussMenu[i]._actionId = i; if (i < 8) { -- cgit v1.2.3 From e6582fe7d1cbfd3ebe32e49248b829d7b4a09e17 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 14:25:11 +0200 Subject: MORTEVIELLE: Fix the initialization of verbs from the DAT file --- engines/mortevielle/menu.cpp | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index a64c5a8c90..8fdef34d14 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -114,41 +114,41 @@ void Menu::readVerbNums(Common::File &f, int dataSize) { _opcodeSPut = f.readUint16LE(); _opcodeSLook = f.readUint16LE(); - _actionMenu[0]._menuId = OPCODE_NONE >> 8; - _actionMenu[0]._actionId = OPCODE_NONE & 0xFF; + _actionMenu[0]._menuId = OPCODE_NONE >> 8; + _actionMenu[0]._actionId = OPCODE_NONE & 0xFF; - _actionMenu[1]._menuId = _opcodeSHide >> 8; - _actionMenu[1]._actionId = _opcodeSHide & 0xFF; + _actionMenu[1]._menuId = _opcodeSHide >> 8; + _actionMenu[1]._actionId = _opcodeSHide & 0xFF; - _actionMenu[2]._menuId = _opcodeAttach >> 8; - _actionMenu[2]._actionId = _opcodeAttach & 0xFF; + _actionMenu[2]._menuId = _opcodeAttach >> 8; + _actionMenu[2]._actionId = _opcodeAttach & 0xFF; - _actionMenu[3]._menuId = _opcodeForce >> 8; - _actionMenu[3]._actionId = _opcodeForce & 0xFF; + _actionMenu[3]._menuId = _opcodeForce >> 8; + _actionMenu[3]._actionId = _opcodeForce & 0xFF; - _actionMenu[4]._menuId = _opcodeSleep >> 8; - _actionMenu[4]._actionId = _opcodeSleep & 0xFF; + _actionMenu[4]._menuId = _opcodeSleep >> 8; + _actionMenu[4]._actionId = _opcodeSleep & 0xFF; - _actionMenu[5]._menuId = _opcodeEnter >> 8; - _actionMenu[5]._actionId = _opcodeEnter & 0xFF; + _actionMenu[5]._menuId = _opcodeEnter >> 8; + _actionMenu[5]._actionId = _opcodeEnter & 0xFF; - _actionMenu[6]._menuId = _opcodeClose >> 8; - _actionMenu[6]._menuId = _opcodeClose & 0xFF; + _actionMenu[6]._menuId = _opcodeClose >> 8; + _actionMenu[6]._actionId = _opcodeClose & 0xFF; - _actionMenu[7]._menuId = _opcodeKnock >> 8; - _actionMenu[7]._menuId = _opcodeKnock & 0xFF; + _actionMenu[7]._menuId = _opcodeKnock >> 8; + _actionMenu[7]._actionId = _opcodeKnock & 0xFF; - _actionMenu[8]._menuId = _opcodeEat >> 8; - _actionMenu[8]._menuId = _opcodeEat & 0xFF; + _actionMenu[8]._menuId = _opcodeEat >> 8; + _actionMenu[8]._actionId = _opcodeEat & 0xFF; - _actionMenu[9]._menuId = _opcodePlace >> 8; - _actionMenu[9]._menuId = _opcodePlace & 0xFF; + _actionMenu[9]._menuId = _opcodePlace >> 8; + _actionMenu[9]._actionId = _opcodePlace & 0xFF; - _actionMenu[10]._menuId = _opcodeOpen >> 8; - _actionMenu[10]._menuId = _opcodeOpen & 0xFF; + _actionMenu[10]._menuId = _opcodeOpen >> 8; + _actionMenu[10]._actionId = _opcodeOpen & 0xFF; - _actionMenu[11]._menuId = _opcodeLeave >> 8; - _actionMenu[11]._menuId = _opcodeLeave & 0xFF; + _actionMenu[11]._menuId = _opcodeLeave >> 8; + _actionMenu[11]._actionId = _opcodeLeave & 0xFF; } /** -- cgit v1.2.3 From 481aeb0b0b7b831a45092975f56efb68b3a6f119 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 18:50:28 +0200 Subject: MORTEVIELLE: Remove code related to unsupported display modes --- engines/mortevielle/dialogs.cpp | 6 --- engines/mortevielle/graphics.cpp | 8 +-- engines/mortevielle/menu.cpp | 7 +-- engines/mortevielle/mortevielle.cpp | 8 --- engines/mortevielle/mortevielle.h | 5 -- engines/mortevielle/outtext.cpp | 16 ------ engines/mortevielle/utils.cpp | 103 +++--------------------------------- 7 files changed, 9 insertions(+), 144 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index abaf38c59b..55e73538d3 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -431,12 +431,6 @@ void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; - - if (_vm->_newGraphicalDevice != _vm->_currGraphicalDevice) { - _vm->_currGraphicalDevice = _vm->_newGraphicalDevice; - _vm->clearScreen(); - displayIntroScreen(drawFrame2Fl); - } } while (_vm->_key != 66); // keycode for F8 } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 059f5a9be8..a15195f616 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1165,13 +1165,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { * @remarks Originally called 'paint_rect' */ void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { - int co; - - if (_vm->_currGraphicalDevice == MODE_CGA) - co = 3; - else - co = 11; - _vm->_screenSurface.fillRect(co, Common::Rect(x, y, x + dx, y + dy)); + _vm->_screenSurface.fillRect(11, Common::Rect(x, y, x + dx, y + dy)); } void ScreenSurface::setParent(MortevielleEngine *vm) { diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 8fdef34d14..f815f48a31 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -272,11 +272,6 @@ void Menu::displayMenu() { _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); int col = 28 * _vm->_resolutionScaler; - int color; - if (_vm->_currGraphicalDevice == MODE_CGA) - color = 1; - else - color = 9; for (int charNum = 0; charNum < 6; charNum++) { // One character after the other int idx = 0; @@ -290,7 +285,7 @@ void Menu::displayMenu() { if ((_charArr[charNum][idx] & msk) != 0) { _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y), color); + _vm->_screenSurface.setPixel(Common::Point(x, y), 9); } msk >>= 1; ++x; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 059bde4614..fa5683d127 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -92,8 +92,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr _uptodatePresence = false; _textColor = 0; - _currGraphicalDevice = -1; - _newGraphicalDevice = -1; _place = -1; _x26KeyCount = -1; @@ -181,7 +179,6 @@ Common::ErrorCode MortevielleEngine::initialize() { _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); // Set the screen mode - _currGraphicalDevice = MODE_EGA; _resolutionScaler = 2; _txxFileFl = false; @@ -204,8 +201,6 @@ Common::ErrorCode MortevielleEngine::initialize() { // Setup the mouse cursor initMouse(); - _currGraphicalDevice = MODE_EGA; - _newGraphicalDevice = _currGraphicalDevice; loadPalette(); loadCFIPH(); loadCFIEC(); @@ -220,10 +215,7 @@ Common::ErrorCode MortevielleEngine::initialize() { testKeyboard(); showConfigScreen(); - _newGraphicalDevice = _currGraphicalDevice; testKeyboard(); - if (_newGraphicalDevice != _currGraphicalDevice) - _currGraphicalDevice = _newGraphicalDevice; clearScreen(); _soundManager.loadNoise(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index d3930f7107..443f588141 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -129,8 +129,6 @@ enum Places { DOOR = 25, ROOM26 = 26, COAT_ARMS = 27 }; -enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 }; - struct nhom { byte _id; /* number between 0 and 32 */ byte _hom[4]; @@ -278,7 +276,6 @@ private: void getReadDescription(int objId); void getSearchDescription(int objId); int checkLeaveSecretPassage(); - void changeGraphicalDevice(int newDevice); void startDialog(int16 rep); void endSearch(); int convertCharacterIndexToBitIndex(int characterIndex); @@ -419,8 +416,6 @@ public: bool _blo; bool _destinationOk; bool _largestClearScreen; - int _currGraphicalDevice; - int _newGraphicalDevice; float _addFix; int _savedBitIndex; int _numpal; diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d1cbeea683..824684862a 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -175,7 +175,6 @@ void TextHandler::taffich() { int cx, drawingSize, npal; int32 drawingStartPos; - int alllum[16]; int a = _vm->_caff; if ((a >= 153) && (a <= 161)) @@ -272,21 +271,6 @@ void TextHandler::taffich() { npal = a + 37; } loadPictureFile(filename, altFilename, drawingStartPos, drawingSize); - if (_vm->_currGraphicalDevice == MODE_HERCULES) { - for (int i = 0; i <= 15; ++i) { - int palh = READ_LE_UINT16(&_vm->_curPict[2 + (i << 1)]); - alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15); - } - for (int i = 0; i <= 15; ++i) { - int k = 0; - for (int j = 0; j <= 15; ++j) { - if (alllum[j] > alllum[k]) - k = j; - } - _vm->_curPict[2 + (k << 1)] = rang[i]; - alllum[k] = -1; - } - } _vm->_numpal = npal; _vm->setPal(npal); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 356b6a830d..465de4e3f5 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -283,10 +283,6 @@ void MortevielleEngine::handleAction() { _menu.eraseMenu(); _menu._menuDisplayed = false; - if ((inkey == '\1') || (inkey == '\3') || (inkey == '\5') || (inkey == '\7') || (inkey == '\11')) { - changeGraphicalDevice((uint)((int)inkey - 1) >> 1); - return; - } if (_menu._menuSelected && (_currMenu == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", _currAction & 15); _savegameManager.saveGame(_currAction & 15, saveName); @@ -1449,31 +1445,6 @@ void MortevielleEngine::floodedInWell() { loseGame(); } -/** - * Engine function - Change Graphical Device - * @remarks Originally called 'change_gd' - */ -void MortevielleEngine::changeGraphicalDevice(int newDevice) { - _mouse.hideMouse(); - _currGraphicalDevice = newDevice; - clearScreen(); - _mouse.initMouse(); - _mouse.showMouse(); - drawRightFrame(); - prepareRoom(); - drawClock(); - if (_currBitIndex != 0) - showPeoplePresent(_currBitIndex); - else - displayAloneText(); - clearDescriptionBar(); - clearVerbBar(); - _maff = 68; - drawPictureWithText(); - handleDescriptionText(2, _crep); - _menu.displayMenu(); -} - /** * Called when a savegame has been loaded. * @remarks Originally called 'antegame' @@ -1980,30 +1951,9 @@ void MortevielleEngine::resetVariables() { * @remarks Originally called 'writepal' */ void MortevielleEngine::setPal(int n) { - switch (_currGraphicalDevice) { - case MODE_TANDY: - case MODE_EGA: - case MODE_AMSTRAD1512: - for (int i = 1; i <= 16; ++i) { - _curPict[(2 * i)] = _stdPal[n][i].x; - _curPict[(2 * i) + 1] = _stdPal[n][i].y; - } - break; - case MODE_CGA: { - nhom pal[16]; - for (int i = 0; i < 16; ++i) { - pal[i] = _cgaPal[n]._a[i]; - } - - if (n < 89) - palette(_cgaPal[n]._p); - - for (int i = 0; i <= 15; ++i) - displayCGAPattern(i, &_patternArr[pal[i]._id], pal); - } - break; - default: - break; + for (int i = 1; i <= 16; ++i) { + _curPict[(2 * i)] = _stdPal[n][i].x; + _curPict[(2 * i) + 1] = _stdPal[n][i].y; } } @@ -2216,8 +2166,6 @@ void MortevielleEngine::showTitleScreen() { _caff = 51; _text.taffich(); testKeyboard(); - if (_newGraphicalDevice != _currGraphicalDevice) - _currGraphicalDevice = _newGraphicalDevice; clearScreen(); draw(0, 0); @@ -2243,9 +2191,6 @@ void MortevielleEngine::draw(int x, int y) { */ void MortevielleEngine::drawRightFrame() { setPal(89); - if (_currGraphicalDevice == MODE_HERCULES) - _curPict[14] = 15; - _mouse.hideMouse(); displayPicture(_rightFramePict, 0, 0); _mouse.showMouse(); @@ -2418,21 +2363,16 @@ void MortevielleEngine::drawClock() { const int x = 580; const int y = 123; const int rg = 9; - int hourColor; _mouse.hideMouse(); _screenSurface.drawRectangle(570, 118, 20, 10); _screenSurface.drawRectangle(578, 114, 6, 18); - if ((_currGraphicalDevice == MODE_CGA) || (_currGraphicalDevice == MODE_HERCULES)) - hourColor = 0; - else - hourColor = 1; if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), hourColor); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), 1); else - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), hourColor); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), 1); int hour12 = _hour; if (hour12 > 12) @@ -2440,7 +2380,7 @@ void MortevielleEngine::drawClock() { if (hour12 == 0) hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], hourColor); + _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], 1); _mouse.showMouse(); _screenSurface.putxy(568, 154); @@ -2486,20 +2426,6 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t * @remarks Originally called 'hirs' */ void MortevielleEngine::clearScreen() { - // Note: The original used this to set the graphics mode and clear the screen, both at - // the start of the game, and whenever the screen need to be cleared. As such, this - // method is deprecated in favour of clearing the screen - debugC(1, kMortevielleCore, "TODO: hirs is deprecated in favour of ScreenSurface::clearScreen"); - - if (_currGraphicalDevice == MODE_TANDY) { - _screenSurface.fillRect(0, Common::Rect(0, 0, 639, 200)); - _resolutionScaler = 1; - } else if (_currGraphicalDevice == MODE_CGA) { - palette(1); - _resolutionScaler = 1; - } else - _resolutionScaler = 2; - _screenSurface.clearScreen(); } @@ -2540,12 +2466,6 @@ void MortevielleEngine::displayControlMenu() { void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { GfxSurface surface; surface.decode(pic); - - if (_currGraphicalDevice == MODE_HERCULES) { - _curPict[2] = 0; - _curPict[32] = 15; - } - _screenSurface.drawPicture(surface, x, y); } @@ -3465,17 +3385,8 @@ int MortevielleEngine::checkLeaveSecretPassage() { * @remarks Originally called 'fenat' */ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { - int color; - _mouse.hideMouse(); - if (_currGraphicalDevice == MODE_CGA) - color = 2; - else if (_currGraphicalDevice == MODE_HERCULES) - color = 1; - else - color = 12; - - _screenSurface.writeCharacter(Common::Point(306, 193), stat, color); + _screenSurface.writeCharacter(Common::Point(306, 193), stat, 12); _screenSurface.drawBox(300, 191, 16, 8, 15); _mouse.showMouse(); } -- cgit v1.2.3 From 9dd65e5ef3cf88f882e6a7d35bd50cb7a1de838c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 19:23:29 +0200 Subject: MORTEVIELLE: Put resolution scaler in a const, remove some dead code related to it --- engines/mortevielle/actions.cpp | 2 +- engines/mortevielle/dialogs.cpp | 30 +++++++------------------ engines/mortevielle/graphics.cpp | 13 ++--------- engines/mortevielle/menu.cpp | 44 +++++++++++++++---------------------- engines/mortevielle/mortevielle.cpp | 3 --- engines/mortevielle/mortevielle.h | 2 +- engines/mortevielle/mouse.cpp | 22 +++++++++---------- engines/mortevielle/outtext.cpp | 6 +---- engines/mortevielle/utils.cpp | 44 ++++++++++++------------------------- 9 files changed, 56 insertions(+), 110 deletions(-) diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 2035f4307f..c06f19dadc 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -1408,7 +1408,7 @@ void MortevielleEngine::fctDiscuss() { return; _mouse.getMousePosition(x, y, click); - x *= (3 - _resolutionScaler); + x *= (3 - kResolutionScaler); if (x > 319) cx = 41; else diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 55e73538d3..b8d197da2a 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -71,10 +71,7 @@ int DialogManager::show(const Common::String &msg, int n) { while ((alertStr[i + 1] != '\174') && (alertStr[i + 1] != '\135')) { ++i; displayStr += alertStr[i]; - if (_vm->_resolutionScaler == 2) - curPos.x -= 3; - else - curPos.x -= 5; + curPos.x -= 3; } _vm->_screenSurface.putxy(curPos.x, _vm->_screenSurface._textPos.y); _vm->_screenSurface._textPos.y += 6; @@ -95,12 +92,12 @@ int DialogManager::show(const Common::String &msg, int n) { int limit[3][3]; memset(&limit[0][0], 0, sizeof(int) * 3 * 3); - limit[1][1] = ((uint)(coldep) / 2) * _vm->_resolutionScaler; + limit[1][1] = ((uint)(coldep) / 2) * kResolutionScaler; limit[1][2] = limit[1][1] + 40; if (caseNumb == 1) { limit[2][1] = limit[2][2]; } else { - limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * _vm->_resolutionScaler; + limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * kResolutionScaler; limit[2][2] = (limit[2][1]) + 40; } _vm->_mouse.showMouse(); @@ -221,10 +218,7 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, } choiceListStr = Common::String(inputStr.c_str() + i); - if (_vm->_resolutionScaler == 2) - col *= 6; - else - col *= 10; + col *= 6; } void DialogManager::setPosition(int ji, int coldep, int esp) { @@ -302,11 +296,7 @@ bool DialogManager::showKnowledgeCheck() { _vm->_mouse.hideMouse(); _vm->clearScreen(); _vm->_mouse.showMouse(); - int dialogHeight; - if (_vm->_resolutionScaler == 1) - dialogHeight = 29; - else - dialogHeight = 23; + int dialogHeight = 23; _vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = _vm->getString(textIndexArr[indx]); _vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); @@ -335,7 +325,7 @@ bool DialogManager::showKnowledgeCheck() { } for (int j = 1; j <= lastOption - firstOption + 1; ++j) { - coor[j]._rect = Common::Rect(45 * _vm->_resolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * _vm->_resolutionScaler, 34 + j * 8); + coor[j]._rect = Common::Rect(45 * kResolutionScaler, 27 + j * 8, (maxLength * 3 + 55) * kResolutionScaler, 34 + j * 8); coor[j]._enabled = true; while ((int)choiceArray[j].size() < maxLength) { @@ -343,11 +333,7 @@ bool DialogManager::showKnowledgeCheck() { } } coor[lastOption - firstOption + 2]._enabled = false; - int rep; - if (_vm->_resolutionScaler == 1) - rep = 10; - else - rep = 6; + int rep = 6; _vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; @@ -477,7 +463,7 @@ void DialogManager::displayIntroFrame2() { _vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12); _vm->_crep = _vm->getAnimOffset(2, 1); _vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12); - _vm->_largestClearScreen = (_vm->_resolutionScaler == 1); + _vm->_largestClearScreen = false; _vm->handleDescriptionText(2, kDialogStringIndex + 143); } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index a15195f616..daf7926438 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1015,11 +1015,6 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { - if (_vm->_resolutionScaler == 1) { - x = (uint)x >> 1; - dx = (uint)dx >> 1; - } - Graphics::Surface destSurface = lockArea(Common::Rect(x, y * 2, x + dx, (y + dy) * 2)); destSurface.hLine(0, 0, dx, col); @@ -1078,11 +1073,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { _vm->_mouse.hideMouse(); Common::Point pt = _textPos; - int charWidth; - if (_vm->_resolutionScaler == 2) - charWidth = 6; - else - charWidth = 10; + int charWidth = 6; int x = pt.x + charWidth * l.size(); int color = 0; @@ -1118,7 +1109,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { * Gets the width in pixels of the specified string */ int ScreenSurface::getStringWidth(const Common::String &s) { - int charWidth = (_vm->_resolutionScaler == 2) ? 6 : 10; + int charWidth = 6; return s.size() * charWidth; } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index f815f48a31..9e03e83127 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -271,7 +271,7 @@ void Menu::displayMenu() { _vm->_mouse.hideMouse(); _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); - int col = 28 * _vm->_resolutionScaler; + int col = 28 * kResolutionScaler; for (int charNum = 0; charNum < 6; charNum++) { // One character after the other int idx = 0; @@ -293,7 +293,7 @@ void Menu::displayMenu() { ++idx; } } - col += 48 * _vm->_resolutionScaler; + col += 48 * kResolutionScaler; } _vm->_mouse.showMouse(); } @@ -370,16 +370,12 @@ void Menu::util(Common::Point pos) { int ymx = (menuConstants[_msg3 - 1][3] << 3) + 16; int dxcar = menuConstants[_msg3 - 1][2]; - int xmn = (menuConstants[_msg3 - 1][0] << 2) * _vm->_resolutionScaler; + int xmn = (menuConstants[_msg3 - 1][0] << 2) * kResolutionScaler; - int ix; - if (_vm->_resolutionScaler == 1) - ix = 5; - else - ix = 3; - int xmx = dxcar * ix * _vm->_resolutionScaler + xmn + 2; + int charWidth = 6; + int xmx = dxcar * charWidth + xmn + 2; if ((pos.x > xmn) && (pos.x < xmx) && (pos.y < ymx) && (pos.y > 15)) { - ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); + int ix = (((uint)pos.y >> 3) - 1) + (_msg3 << 8); if (ix != _msg4) { invert(1); _msg4 = ix; @@ -402,11 +398,7 @@ void Menu::menuDown(int ii) { int minX = menuConstants[ii - 1][0] << 3; int lineNum = menuConstants[ii - 1][3]; _vm->_mouse.hideMouse(); - int deltaX; - if (_vm->_resolutionScaler == 1) - deltaX = 10; - else - deltaX = 6; + int deltaX = 6; int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6; if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version @@ -512,24 +504,24 @@ void Menu::updateMenu() { _vm->_prevPos = curPos; bool tes = (curPos.y < 11) - && ((curPos.x >= (28 * _vm->_resolutionScaler) && curPos.x <= (28 * _vm->_resolutionScaler + 24)) - || (curPos.x >= (76 * _vm->_resolutionScaler) && curPos.x <= (76 * _vm->_resolutionScaler + 24)) - || ((curPos.x > 124 * _vm->_resolutionScaler) && (curPos.x < 124 * _vm->_resolutionScaler + 24)) - || ((curPos.x > 172 * _vm->_resolutionScaler) && (curPos.x < 172 * _vm->_resolutionScaler + 24)) - || ((curPos.x > 220 * _vm->_resolutionScaler) && (curPos.x < 220 * _vm->_resolutionScaler + 24)) - || ((curPos.x > 268 * _vm->_resolutionScaler) && (curPos.x < 268 * _vm->_resolutionScaler + 24))); + && ((curPos.x >= (28 * kResolutionScaler) && curPos.x <= (28 * kResolutionScaler + 24)) + || (curPos.x >= (76 * kResolutionScaler) && curPos.x <= (76 * kResolutionScaler + 24)) + || ((curPos.x > 124 * kResolutionScaler) && (curPos.x < 124 * kResolutionScaler + 24)) + || ((curPos.x > 172 * kResolutionScaler) && (curPos.x < 172 * kResolutionScaler + 24)) + || ((curPos.x > 220 * kResolutionScaler) && (curPos.x < 220 * kResolutionScaler + 24)) + || ((curPos.x > 268 * kResolutionScaler) && (curPos.x < 268 * kResolutionScaler + 24))); if (tes) { int ix; - if (curPos.x < 76 * _vm->_resolutionScaler) + if (curPos.x < 76 * kResolutionScaler) ix = MENU_INVENTORY; - else if (curPos.x < 124 * _vm->_resolutionScaler) + else if (curPos.x < 124 * kResolutionScaler) ix = MENU_MOVE; - else if (curPos.x < 172 * _vm->_resolutionScaler) + else if (curPos.x < 172 * kResolutionScaler) ix = MENU_ACTION; - else if (curPos.x < 220 * _vm->_resolutionScaler) + else if (curPos.x < 220 * kResolutionScaler) ix = MENU_SELF; - else if (curPos.x < 268 * _vm->_resolutionScaler) + else if (curPos.x < 268 * kResolutionScaler) ix = MENU_DISCUSS; else ix = MENU_FILE; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index fa5683d127..e958d0bada 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -178,9 +178,6 @@ Common::ErrorCode MortevielleEngine::initialize() { // Set up an intermediate screen surface _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); - // Set the screen mode - _resolutionScaler = 2; - _txxFileFl = false; // Load texts from TXX files loadTexts(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 443f588141..c9eebe1347 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -115,6 +115,7 @@ const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; const int kMaxPatt = 20; +const int kResolutionScaler = 2; /* 9 "A glance at the forbidden$", 18 "It's already open$", @@ -427,7 +428,6 @@ public: int _caff; int _crep; - int _resolutionScaler; byte _destinationArray[7][25]; byte *_curPict; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index dfc9ccd706..9eb4e129c0 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -65,8 +65,8 @@ void MouseHandler::showMouse() { * @remarks Originally called 'pos_mouse' */ void MouseHandler::setMousePosition(Common::Point newPos) { - if (newPos.x > 314 * _vm->_resolutionScaler) - newPos.x = 314 * _vm->_resolutionScaler; + if (newPos.x > 314 * kResolutionScaler) + newPos.x = 314 * kResolutionScaler; else if (newPos.x < 0) newPos.x = 0; if (newPos.y > 199) @@ -138,16 +138,16 @@ void MouseHandler::moveMouse(bool &funct, char &key) { cy = 190; break; case '9': - cx = 315 * _vm->_resolutionScaler; + cx = 315 * kResolutionScaler; cy = 1; break; case '3': cy = 190; - cx = 315 * _vm->_resolutionScaler; + cx = 315 * kResolutionScaler; break; case '5': cy = 100; - cx = 155 * _vm->_resolutionScaler; + cx = 155 * kResolutionScaler; break; case ' ': case '\15': @@ -201,27 +201,27 @@ void MouseHandler::moveMouse(bool &funct, char &key) { } break; case 'I': - cx = _vm->_resolutionScaler * 32; + cx = kResolutionScaler * 32; cy = 8; break; case 'D': - cx = 80 * _vm->_resolutionScaler; + cx = 80 * kResolutionScaler; cy = 8; break; case 'A': - cx = 126 * _vm->_resolutionScaler; + cx = 126 * kResolutionScaler; cy = 8; break; case 'S': - cx = 174 * _vm->_resolutionScaler; + cx = 174 * kResolutionScaler; cy = 8; break; case 'P': - cx = 222 * _vm->_resolutionScaler; + cx = 222 * kResolutionScaler; cy = 8; break; case 'F': - cx = _vm->_resolutionScaler * 270; + cx = kResolutionScaler * 270; cy = 8; break; case '\23': diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 824684862a..4629a47c36 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -53,7 +53,6 @@ int TextHandler::nextWord(int p, const char *ch, int &tab) { * @remarks Originally called 'afftex' */ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) { - int tab; Common::String s; int i, j; @@ -61,10 +60,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int inputStr += '$'; _vm->_screenSurface.putxy(x, y); - if (_vm->_resolutionScaler == 1) - tab = 10; - else - tab = 6; + int tab = 6; dx *= 6; dy *= 6; int xc = x; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 465de4e3f5..375b2ef4d9 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1679,19 +1679,12 @@ void MortevielleEngine::clearVerbBar() { * @remarks Originally called 'clsf10' */ void MortevielleEngine::clearUpperRightPart() { - int x1, x2; Common::String st; _mouse.hideMouse(); - if (_resolutionScaler == 1) { - x2 = 634; - x1 = 534; - } else { - x2 = 600; - x1 = 544; - } + // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(x1, 93, x2, 98)); + _screenSurface.fillRect(15, Common::Rect(600, 93, 544, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) @@ -1699,7 +1692,7 @@ void MortevielleEngine::clearUpperRightPart() { else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - x1 = 580 - (_screenSurface.getStringWidth(st) / 2); + int x1 = 580 - (_screenSurface.getStringWidth(st) / 2); _screenSurface.putxy(x1, 92); _screenSurface.drawString(st, 4); @@ -2170,7 +2163,7 @@ void MortevielleEngine::showTitleScreen() { draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * _resolutionScaler, 185); + _screenSurface.putxy(104 + 72 * kResolutionScaler, 185); _screenSurface.drawString(cpr, 0); } @@ -2370,9 +2363,9 @@ void MortevielleEngine::drawClock() { _screenSurface.drawRectangle(578, 114, 6, 18); if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y - rg), 1); + _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); else - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)x >> 1) * _resolutionScaler, (y + rg), 1); + _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); int hour12 = _hour; if (hour12 > 12) @@ -2380,7 +2373,7 @@ void MortevielleEngine::drawClock() { if (hour12 == 0) hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * _resolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * _resolutionScaler, y + cv[1][hour12 - 1], 1); + _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); _mouse.showMouse(); _screenSurface.putxy(568, 154); @@ -2512,14 +2505,8 @@ int MortevielleEngine::getAnimOffset(int frameNum, int animNum) { * @remarks Originally called 'text1' */ void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int mesgId) { - int co; - - if (_resolutionScaler == 1) - co = 10; - else - co = 6; Common::String tmpStr = getString(mesgId); - if ((y == 182) && ((int) tmpStr.size() * co > nb * 6)) + if ((y == 182) && ((int) tmpStr.size() > nb)) y = 176; _text.displayStr(tmpStr, x, y, nb, 20, _textColor); } @@ -2532,7 +2519,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { if ((mesgId > 499) && (mesgId < 563)) { Common::String tmpStr = getString(mesgId - 501 + kInventoryStringIndex); - if ((int) tmpStr.size() > ((58 + (_resolutionScaler - 1) * 37) << 1)) + if ((int) tmpStr.size() > ((58 + (kResolutionScaler - 1) * 37) << 1)) _largestClearScreen = true; else _largestClearScreen = false; @@ -2641,7 +2628,7 @@ void MortevielleEngine::resetOpenObjects() { void MortevielleEngine::displayTextBlock(Common::String text) { // Some dead code was present in the original: removed _screenSurface.putxy(8, 177); - int tlig = 59 + (_resolutionScaler - 1) * 36; + int tlig = 59 + (kResolutionScaler - 1) * 36; if ((int)text.size() < tlig) _screenSurface.drawString(text, 5); @@ -2867,10 +2854,7 @@ int MortevielleEngine::getPresence(int roomId) { * @remarks Originally called 'writetp' */ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { - if (_resolutionScaler == 2) - _screenSurface.drawString(s, cmd); - else - _screenSurface.drawString(copy(s, 1, 25), cmd); + _screenSurface.drawString(s, cmd); } /** @@ -3239,7 +3223,7 @@ void MortevielleEngine::displayStatusArrow() { return; if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * _resolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + inRect = (_mouse._pos.x < 256 * kResolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); prepareRoom(); } while (!(qust || inRect || _anyone)); @@ -3296,10 +3280,10 @@ void MortevielleEngine::setCoordinates(int sx) { cy = 1; do { cb += 2; - sx = _tabdon[a + cb] * _resolutionScaler; + sx = _tabdon[a + cb] * kResolutionScaler; sy = _tabdon[(a + cb + 1)]; cb += 2; - ix = _tabdon[a + cb] * _resolutionScaler; + ix = _tabdon[a + cb] * kResolutionScaler; iy = _tabdon[(a + cb + 1)]; ++cy; } while (!(((_x >= sx) && (_x <= ix) && (_y >= sy) && (_y <= iy)) || (cy > ib))); -- cgit v1.2.3 From 1d21f5db264b98c53ef1475bdf0f2ffbe01c2e79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 20:06:34 +0200 Subject: MORTEVIELLE: Fix bug in previous commit, some multiple if statement optimizations --- engines/mortevielle/utils.cpp | 76 +++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 375b2ef4d9..52e3b7c29b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1513,73 +1513,73 @@ void MortevielleEngine::handleOpcode() { return; } } + if (_currMenu == MENU_MOVE) fctMove(); - if (_currMenu == MENU_DISCUSS) + else if (_currMenu == MENU_DISCUSS) fctDiscuss(); - if (_currMenu == MENU_INVENTORY) + else if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - if (_currAction == _menu._opcodeAttach) + else if (_currAction == _menu._opcodeAttach) fctAttach(); - if (_currAction == _menu._opcodeWait) + else if (_currAction == _menu._opcodeWait) fctWait(); - if (_currAction == _menu._opcodeForce) + else if (_currAction == _menu._opcodeForce) fctForce(); - if (_currAction == _menu._opcodeSleep) + else if (_currAction == _menu._opcodeSleep) fctSleep(); - if (_currAction == _menu._opcodeListen) + else if (_currAction == _menu._opcodeListen) fctListen(); - if (_currAction == _menu._opcodeEnter) + else if (_currAction == _menu._opcodeEnter) fctEnter(); - if (_currAction == _menu._opcodeClose) + else if (_currAction == _menu._opcodeClose) fctClose(); - if (_currAction == _menu._opcodeSearch) + else if (_currAction == _menu._opcodeSearch) fctSearch(); - if (_currAction == _menu._opcodeKnock) + else if (_currAction == _menu._opcodeKnock) fctKnock(); - if (_currAction == _menu._opcodeScratch) + else if (_currAction == _menu._opcodeScratch) fctScratch(); - if (_currAction == _menu._opcodeRead) + else if (_currAction == _menu._opcodeRead) fctRead(); - if (_currAction == _menu._opcodeEat) + else if (_currAction == _menu._opcodeEat) fctEat(); - if (_currAction == _menu._opcodePlace) + else if (_currAction == _menu._opcodePlace) fctPlace(); - if (_currAction == _menu._opcodeOpen) + else if (_currAction == _menu._opcodeOpen) fctOpen(); - if (_currAction == _menu._opcodeTake) + else if (_currAction == _menu._opcodeTake) fctTake(); - if (_currAction == _menu._opcodeLook) + else if (_currAction == _menu._opcodeLook) fctLook(); - if (_currAction == _menu._opcodeSmell) + else if (_currAction == _menu._opcodeSmell) fctSmell(); - if (_currAction == _menu._opcodeSound) + else if (_currAction == _menu._opcodeSound) fctSound(); - if (_currAction == _menu._opcodeLeave) + else if (_currAction == _menu._opcodeLeave) fctLeave(); - if (_currAction == _menu._opcodeLift) + else if (_currAction == _menu._opcodeLift) fctLift(); - if (_currAction == _menu._opcodeTurn) + else if (_currAction == _menu._opcodeTurn) fctTurn(); - if (_currAction == _menu._opcodeSSearch) + else if (_currAction == _menu._opcodeSSearch) fctSelfSearch(); - if (_currAction == _menu._opcodeSRead) + else if (_currAction == _menu._opcodeSRead) fctSelfRead(); - if (_currAction == _menu._opcodeSPut) + else if (_currAction == _menu._opcodeSPut) fctSelfPut(); - if (_currAction == _menu._opcodeSLook) + else if (_currAction == _menu._opcodeSLook) fctSelftLook(); + _hiddenHero = false; if (_currAction == _menu._opcodeSHide) fctSelfHide(); - } else { - if (_anyone) { - interactNPC(); - _anyone = false; - menuUp(); - return; - } + } else if (_anyone) { + interactNPC(); + _anyone = false; + menuUp(); + return; } int hour, day, minute; updateHour(day, hour, minute); @@ -1591,12 +1591,10 @@ void MortevielleEngine::handleOpcode() { if ((_coreVar._faithScore > 99) && (hour > 8) && (hour < 16)) { _crep = 1501; loseGame(); - } - if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { + } else if ((_coreVar._faithScore > 99) && (hour > 0) && (hour < 9)) { _crep = 1508; loseGame(); - } - if ((day > 1) && (hour > 8) && (!_loseGame)) { + } else if ((day > 1) && (hour > 8) && (!_loseGame)) { _crep = 1502; loseGame(); } @@ -1684,7 +1682,7 @@ void MortevielleEngine::clearUpperRightPart() { _mouse.hideMouse(); // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(600, 93, 544, 98)); + _screenSurface.fillRect(15, Common::Rect(544, 93, 600, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) -- cgit v1.2.3 From e2856ed85b08b4ab96e5a05cef793052e3232838 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 Aug 2013 23:29:52 +0200 Subject: MORTEVIELLE: Avoid using sav0.mor in run() --- engines/mortevielle/mortevielle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index e958d0bada..7748ce9371 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -350,7 +350,10 @@ Common::Error MortevielleEngine::run() { // Either load the initial game state savegame, or the specified savegame number adzon(); - _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); + if (loadSlot != 0) + _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); + else + resetVariables(); // Run the main game loop mainGame(); -- cgit v1.2.3 From 0d6f6119638ae40a6e849a740452c67919eeb559 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 16 Aug 2013 21:17:11 -0400 Subject: VIDEO: Ignore some AVI lists with metadata --- video/avi_decoder.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 92a60fcccf..34bc8c4a7a 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -65,9 +65,10 @@ namespace Video { #define ID_VEDT MKTAG('v','e','d','t') #define ID_IDX1 MKTAG('i','d','x','1') #define ID_STRD MKTAG('s','t','r','d') -//#define ID_INFO MKTAG('I','N','F','O') +#define ID_INFO MKTAG('I','N','F','O') #define ID_ISFT MKTAG('I','S','F','T') #define ID_DISP MKTAG('D','I','S','P') +#define ID_PRMI MKTAG('P','R','M','I') // Codec tags #define ID_RLE MKTAG('R','L','E',' ') @@ -170,15 +171,25 @@ void AVIDecoder::handleList(uint32 listSize) { debug(0, "Found LIST of type %s", tag2str(listType)); - if (listType == ID_MOVI) { - // If we found the movie block + switch (listType) { + case ID_MOVI: // Movie List + // We found the movie block _foundMovieList = true; _movieListStart = curPos; _fileStream->skip(listSize); return; - } else if (listType == ID_HDRL) { + case ID_HDRL: // Header List // Mark the header as decoded _decodedHeader = true; + break; + case ID_INFO: // Metadata + case ID_PRMI: // Unknown metadata, should be safe to ignore + // Ignore metadata + _fileStream->skip(listSize); + return; + case ID_STRL: // Stream list + default: // (Just hope we can parse it!) + break; } while ((_fileStream->pos() - curPos) < listSize) -- cgit v1.2.3 From ddb9f3862dae190b1e141c0d6ab88b34e49743ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Aug 2013 11:18:13 +0200 Subject: MORTEVIELLE: Fix verb highlighting in Action and Self menus. Refactor functions related to MenuItem --- engines/mortevielle/menu.cpp | 113 ++++++++++++++++++++++++++---------------- engines/mortevielle/menu.h | 16 +++--- engines/mortevielle/utils.cpp | 24 ++++----- 3 files changed, 89 insertions(+), 64 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9e03e83127..d6b9d57141 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -155,30 +155,39 @@ void Menu::readVerbNums(Common::File &f, int dataSize) { * Setup a menu's contents * @remarks Originally called 'menut' */ -void Menu::setText(int menuId, int actionId, Common::String name) { +void Menu::setText(MenuItem item, Common::String name) { Common::String s = name; - while (s.size() < 22) - s += ' '; - - switch (menuId) { + switch (item._menuId) { case MENU_INVENTORY: - if (actionId != 7) { - _inventoryStringArray[actionId] = s; - _inventoryStringArray[actionId].insertChar(' ', 0); + if (item._actionId != 7) { + while (s.size() < 22) + s += ' '; + + _inventoryStringArray[item._actionId] = s; + _inventoryStringArray[item._actionId].insertChar(' ', 0); } break; case MENU_MOVE: - _moveStringArray[actionId] = s; + while (s.size() < 22) + s += ' '; + + _moveStringArray[item._actionId] = s; break; case MENU_ACTION: - _actionStringArray[actionId] = s; + while (s.size() < 10) + s += ' '; + + _actionStringArray[item._actionId] = s; break; case MENU_SELF: - _selfStringArray[actionId] = s; + while (s.size() < 10) + s += ' '; + + _selfStringArray[item._actionId] = s; break; case MENU_DISCUSS: - _discussStringArray[actionId] = s; + _discussStringArray[item._actionId] = s; break; default: break; @@ -200,11 +209,11 @@ void Menu::setDestinationText(int roomId) { nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex); while (nomp.size() < 20) nomp += ' '; - setText(_moveMenu[destinationId + 1]._menuId, _moveMenu[destinationId + 1]._actionId, nomp); + setText(_moveMenu[destinationId + 1], nomp); } nomp = "* "; for (int i = 7; i >= destinationId + 1; --i) - setText(_moveMenu[i]._menuId, _moveMenu[i]._actionId, nomp); + setText(_moveMenu[i], nomp); } /** @@ -212,26 +221,26 @@ void Menu::setDestinationText(int roomId) { * @param menuId Menu number * @param actionId Item index */ -void Menu::disableMenuItem(int menuId, int actionId) { - switch (menuId) { +void Menu::disableMenuItem(MenuItem item) { + switch (item._menuId) { case MENU_INVENTORY: - if (actionId > 6) { - _inventoryStringArray[actionId].setChar('<', 0); - _inventoryStringArray[actionId].setChar('>', 21); + if (item._actionId > 6) { + _inventoryStringArray[item._actionId].setChar('<', 0); + _inventoryStringArray[item._actionId].setChar('>', 21); } else - _inventoryStringArray[actionId].setChar('*', 0); + _inventoryStringArray[item._actionId].setChar('*', 0); break; case MENU_MOVE: - _moveStringArray[actionId].setChar('*', 0); + _moveStringArray[item._actionId].setChar('*', 0); break; case MENU_ACTION: - _actionStringArray[actionId].setChar('*', 0); + _actionStringArray[item._actionId].setChar('*', 0); break; case MENU_SELF: - _selfStringArray[actionId].setChar('*', 0); + _selfStringArray[item._actionId].setChar('*', 0); break; case MENU_DISCUSS: - _discussStringArray[actionId].setChar('*', 0); + _discussStringArray[item._actionId].setChar('*', 0); break; default: break; @@ -244,23 +253,23 @@ void Menu::disableMenuItem(int menuId, int actionId) { * @param actionId Item index * @remarks Originally called menu_enable */ -void Menu::enableMenuItem(int menuId, int actionId) { - switch (menuId) { +void Menu::enableMenuItem(MenuItem item) { + switch (item._menuId) { case MENU_INVENTORY: - _inventoryStringArray[actionId].setChar(' ', 0); - _inventoryStringArray[actionId].setChar(' ', 21); + _inventoryStringArray[item._actionId].setChar(' ', 0); + _inventoryStringArray[item._actionId].setChar(' ', 21); break; case MENU_MOVE: - _moveStringArray[actionId].setChar(' ', 0); + _moveStringArray[item._actionId].setChar(' ', 0); break; case MENU_ACTION: - _actionStringArray[actionId].setChar(' ', 0); + _actionStringArray[item._actionId].setChar(' ', 0); break; case MENU_SELF: - _selfStringArray[actionId].setChar(' ', 0); + _selfStringArray[item._actionId].setChar(' ', 0); break; case MENU_DISCUSS: - _discussStringArray[actionId].setChar(' ', 0); + _discussStringArray[item._actionId].setChar(' ', 0); break; default: break; @@ -654,7 +663,7 @@ void Menu::initMenu() { _inventoryMenu[i]._menuId = MENU_INVENTORY; _inventoryMenu[i]._actionId = i; if (i > 6) - disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); + disableMenuItem(_inventoryMenu[i]); } _msg3 = OPCODE_NONE; _msg4 = OPCODE_NONE; @@ -669,13 +678,21 @@ void Menu::initMenu() { */ void Menu::setSearchMenu() { for (int i = 1; i <= 7; ++i) - disableMenuItem(MENU_MOVE, _moveMenu[i]._actionId); + disableMenuItem(_moveMenu[i]); for (int i = 1; i <= 11; ++i) - disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); + disableMenuItem(_actionMenu[i]); + + MenuItem miSound; + miSound._menuId = _opcodeSound >> 8; + miSound._actionId = _opcodeSound & 0xFF; - setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_SUITE)); - setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_STOP)); + MenuItem miLift; + miLift._menuId = _opcodeLift >> 8; + miLift._actionId = _opcodeLift & 0xFF; + + setText(miSound, _vm->getEngineString(S_SUITE)); + setText(miLift, _vm->getEngineString(S_STOP)); } /** @@ -685,10 +702,18 @@ void Menu::setSearchMenu() { void Menu::unsetSearchMenu() { setDestinationText(_vm->_coreVar._currPlace); for (int i = 1; i <= 11; ++i) - enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); + enableMenuItem(_actionMenu[i]); + + MenuItem miSound; + miSound._menuId = _opcodeSound >> 8; + miSound._actionId = _opcodeSound & 0xFF; + + MenuItem miLift; + miLift._menuId = _opcodeLift >> 8; + miLift._actionId = _opcodeLift & 0xFF; - setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_PROBE)); - setText(_opcodeLift >> 8, _opcodeLift & 0xFF, _vm->getEngineString(S_RAISE)); + setText(miSound, _vm->getEngineString(S_PROBE)); + setText(miLift, _vm->getEngineString(S_RAISE)); } /** @@ -704,15 +729,15 @@ void Menu::setInventoryText() { ++cy; int r = _vm->_coreVar._inventory[i] + 400; nomp = _vm->getString(r - 501 + kInventoryStringIndex); - setText(_inventoryMenu[cy]._menuId, _inventoryMenu[cy]._actionId, nomp); - enableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); + setText(_inventoryMenu[cy], nomp); + enableMenuItem(_inventoryMenu[i]); } } if (cy < 6) { for (int i = cy + 1; i <= 6; ++i) { - setText(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId, " "); - disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); + setText(_inventoryMenu[i], " "); + disableMenuItem(_inventoryMenu[i]); } } } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 9afa99cfa8..d1271bca2e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -42,7 +42,7 @@ enum { const int OPCODE_NONE = 0; -struct menuItem { +struct MenuItem { int _menuId; int _actionId; }; @@ -71,9 +71,9 @@ public: Common::String _actionStringArray[22]; Common::String _selfStringArray[7]; Common::String _discussStringArray[9]; - menuItem _discussMenu[9]; - menuItem _inventoryMenu[9]; - menuItem _moveMenu[8]; + MenuItem _discussMenu[9]; + MenuItem _inventoryMenu[9]; + MenuItem _moveMenu[8]; int _opcodeAttach; int _opcodeWait; @@ -101,15 +101,15 @@ public: int _opcodeSRead; int _opcodeSPut; int _opcodeSLook; - menuItem _actionMenu[12]; + MenuItem _actionMenu[12]; void setParent(MortevielleEngine *vm); void readVerbNums(Common::File &f, int dataSize); - void setText(int menuId, int actionId, Common::String name); + void setText(MenuItem item, Common::String name); void setDestinationText(int roomId); void setInventoryText(); - void disableMenuItem(int menuId, int actionId); - void enableMenuItem(int menuId, int actionId); + void disableMenuItem(MenuItem item); + void enableMenuItem(MenuItem item); void displayMenu(); void drawMenu(); void menuUp(int msgId); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 52e3b7c29b..cc3e879450 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -502,48 +502,48 @@ void MortevielleEngine::showPeoplePresent(int bitIndex) { int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); + _menu.disableMenuItem(_menu._discussMenu[i]); clearUpperRightPart(); if ((bitIndex & 128) == 128) { _screenSurface.putxy(xp, 24); _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]._menuId, _menu._discussMenu[1]._actionId); + _menu.enableMenuItem(_menu._discussMenu[1]); } if ((bitIndex & 64) == 64) { _screenSurface.putxy(xp, 32); _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]._menuId, _menu._discussMenu[2]._actionId); + _menu.enableMenuItem(_menu._discussMenu[2]); } if ((bitIndex & 32) == 32) { _screenSurface.putxy(xp, 40); _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]._menuId, _menu._discussMenu[3]._actionId); + _menu.enableMenuItem(_menu._discussMenu[3]); } if ((bitIndex & 16) == 16) { _screenSurface.putxy(xp, 48); _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]._menuId, _menu._discussMenu[4]._actionId); + _menu.enableMenuItem(_menu._discussMenu[4]); } if ((bitIndex & 8) == 8) { _screenSurface.putxy(xp, 56); _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]._menuId, _menu._discussMenu[5]._actionId); + _menu.enableMenuItem(_menu._discussMenu[5]); } if ((bitIndex & 4) == 4) { _screenSurface.putxy(xp, 64); _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]._menuId, _menu._discussMenu[6]._actionId); + _menu.enableMenuItem(_menu._discussMenu[6]); } if ((bitIndex & 2) == 2) { _screenSurface.putxy(xp, 72); _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]._menuId, _menu._discussMenu[7]._actionId); + _menu.enableMenuItem(_menu._discussMenu[7]); } if ((bitIndex & 1) == 1) { _screenSurface.putxy(xp, 80); _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]._menuId, _menu._discussMenu[8]._actionId); + _menu.enableMenuItem(_menu._discussMenu[8]); } _currBitIndex = bitIndex; } @@ -697,7 +697,7 @@ int MortevielleEngine::getPresenceStatsRedRoom() { */ void MortevielleEngine::displayAloneText() { for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); + _menu.disableMenuItem(_menu._discussMenu[i]); Common::String sYou = getEngineString(S_YOU); Common::String sAre = getEngineString(S_ARE); @@ -2663,8 +2663,8 @@ void MortevielleEngine::displayItemInHand(int objId) { if (objId != 500) strp = getString(objId - 501 + kInventoryStringIndex); - _menu.setText(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId, strp); - _menu.disableMenuItem(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId); + _menu.setText(_menu._inventoryMenu[8], strp); + _menu.disableMenuItem(_menu._inventoryMenu[8]); } /** -- cgit v1.2.3 From a5ec205f46a9c5cc833a1cab616aa82bed1309c2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Aug 2013 11:36:54 +0200 Subject: MORTEVIELLE: Fix occasional alignment issue in Action verb list --- engines/mortevielle/menu.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index d6b9d57141..1077f66fc2 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -174,17 +174,29 @@ void Menu::setText(MenuItem item, Common::String name) { _moveStringArray[item._actionId] = s; break; - case MENU_ACTION: + case MENU_ACTION: { + // If the first character isn't '*' or ' ' then it's missing a heading space + char c = s[0]; + if (c != '*' && c != ' ') + s = ' ' + s; + while (s.size() < 10) s += ' '; _actionStringArray[item._actionId] = s; + } break; - case MENU_SELF: + case MENU_SELF: { + // If the first character isn't '*' or ' ' then it's missing a heading space + char c = s[0]; + if (c != '*' && c != ' ') + s = ' ' + s; + while (s.size() < 10) s += ' '; _selfStringArray[item._actionId] = s; + } break; case MENU_DISCUSS: _discussStringArray[item._actionId] = s; -- cgit v1.2.3 From 818b9a652b730947085b34c4b0ebd2682870fe05 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Aug 2013 12:45:28 +0200 Subject: MORTEVIELLE: Remove some dead code and variables related to graphical modes --- engines/mortevielle/mortevielle.h | 13 ------------- engines/mortevielle/outtext.cpp | 2 -- engines/mortevielle/utils.cpp | 38 +------------------------------------- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c9eebe1347..4c9e57acd1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -130,16 +130,6 @@ enum Places { DOOR = 25, ROOM26 = 26, COAT_ARMS = 27 }; -struct nhom { - byte _id; /* number between 0 and 32 */ - byte _hom[4]; -}; - -struct CgaPalette { - byte _p; - nhom _a[16]; -}; - struct Pattern { byte _tay, _tax; byte _des[kMaxPatt + 1][kMaxPatt + 1]; @@ -179,7 +169,6 @@ private: Common::StringArray _engineStrings; Common::StringArray _gameStrings; - Pattern _patternArr[15]; int _menuOpcode; bool _inMainGameLoop; // Flag when the main game loop is active @@ -223,7 +212,6 @@ private: int _startHour; int _endHour; Common::Point _stdPal[91][17]; - CgaPalette _cgaPal[91]; int _x26KeyCount; int _roomDoorId; @@ -256,7 +244,6 @@ private: void mainGame(); void playGame(); void handleAction(); - void displayCGAPattern(int n, Pattern *p, nhom *pal); void loadPalette(); void loadTexts(); void loadCFIEC(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4629a47c36..d50f4005de 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -164,8 +164,6 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt } void TextHandler::taffich() { - static const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; - static const byte tran1[] = { 121, 121, 138, 139, 120 }; static const byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index cc3e879450..f138dde5c5 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1948,29 +1948,12 @@ void MortevielleEngine::setPal(int n) { } } -/** - * Engine function - Display a CGA pattern, using a specified palette - * @remarks Originally called 'outbloc' - */ -void MortevielleEngine::displayCGAPattern(int n, Pattern *p, nhom *pal) { - int addr = n * 404 + 0xd700; - - WRITE_LE_UINT16(&_curPict[addr], p->_tax); - WRITE_LE_UINT16(&_curPict[addr + 2], p->_tay); - addr += 4; - for (int i = 0; i < p->_tax; ++i) { - for (int j = 0; j < p->_tay; ++j) - _curPict[addr + j * p->_tax + i] = pal[n]._hom[p->_des[i + 1][j + 1]]; - } -} - /** * Engine function - Load Palette from File * @remarks Originally called 'charpal' */ void MortevielleEngine::loadPalette() { Common::File f; - byte b; if (!f.open("fxx.mor")) { if (f.open("mfxx.mor")) @@ -1996,27 +1979,8 @@ void MortevielleEngine::loadPalette() { if (!f.open("cxx.mor")) error("Missing file - cxx.mor"); - for (int j = 0; j <= 90; ++j) { - _cgaPal[j]._p = f.readByte(); - for (int i = 0; i <= 15; ++i) { - nhom &with = _cgaPal[j]._a[i]; + // Skip CGA Palette and Patterns - b = f.readByte(); - with._id = (uint)b >> 4; - with._hom[0] = ((uint)b >> 2) & 3; - with._hom[1] = b & 3; - } - } - - _cgaPal[10]._a[9] = _cgaPal[10]._a[5]; - for (int j = 0; j <= 14; ++j) { - _patternArr[j]._tax = f.readByte(); - _patternArr[j]._tay = f.readByte(); - for (int i = 1; i <= 20; ++i) { - for (int k = 1; k <= 20; ++k) - _patternArr[j]._des[i][k] = f.readByte(); - } - } f.close(); } -- cgit v1.2.3 From 688bc97d14030197e9c4b77ab279a358497910b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Aug 2013 20:34:32 -0400 Subject: TSAGE: Fix for talking to chief in R2R scene 1100 --- engines/tsage/converse.cpp | 10 +++++++++- engines/tsage/ringworld2/ringworld2_scenes1.cpp | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 909da62541..8ae6a0d97e 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -858,6 +858,11 @@ void StripManager::signal() { ++obj44Idx; if (_obj44List[obj44Idx]._field16[0]) { + // WORKAROUND: The _lookupList isn't always correctly initialised. But it always + // seems to be set to the R2_GLOBALS._stripManager_lookupList, so manually set it + if (!_lookupList) + _lookupList = R2_GLOBALS._stripManager_lookupList; + int f16Index = _lookupList[_obj44List[obj44Idx]._field16[0] - 1]; listId = _obj44List[obj44Idx]._field16[f16Index]; @@ -868,13 +873,16 @@ void StripManager::signal() { choiceStr = (const char *)&_script[0] + _obj44List[obj44Idx]._list[listIdx]._scriptOffset; } else { - for (int listIdx = 0; listIdx < OBJ0A_LIST_SIZE; ++listIdx) { + for (int listIdx = idx; listIdx < (OBJ0A_LIST_SIZE - 1); ++listIdx) { obj44._list[listIdx]._id = obj44._list[listIdx + 1]._id; obj44._list[listIdx]._scriptOffset = obj44._list[listIdx + 1]._scriptOffset; if (!obj44._list[listIdx + 1]._id) obj44._list[listIdx]._id = 0; } + + --idx; + continue; } } } diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 021ccd44dc..4e9d019f01 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1203,7 +1203,7 @@ void Scene1100::signal() { } break; case 54: - if (_stripManager._field2E8 == 1) { + if (_stripManager._exitMode == 1) { R2_GLOBALS._player.disableControl(); _sceneMode = 1125; setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_seeker, NULL); -- cgit v1.2.3 From 3c6aaaa1fb51698f1663237e7732e3efcf2b0931 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Aug 2013 22:12:54 -0400 Subject: TSAGE: Fix for leaving bridge in R2R scene 300 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 8d35fc7222..e64e9100c9 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3142,7 +3142,7 @@ bool Scene300::Doorway::startAction(CursorType action, Event &event) { if (action == CURSOR_USE) { if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && - (!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500)) { + (!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_SEEKER] == 500)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 301; scene->setAction(&scene->_sequenceManager1, scene, 301, &R2_GLOBALS._player, this, NULL); @@ -3559,7 +3559,7 @@ void Scene300::signal() { break; case 16: - if (_stripManager._field2E8 == 1) { + if (_stripManager._exitMode == 1) { R2_GLOBALS._player.setAction(NULL); R2_GLOBALS._sceneManager.changeScene(1000); } else { -- cgit v1.2.3 From 598d1a9c9c461c175dc1f57614008766bdb58107 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 18 Aug 2013 09:02:14 +0200 Subject: SCUMM: Remove unnecessary NULL check, CID 1003627 Since ah->data is an array, it can't ever be NULL. --- engines/scumm/he/script_v72he.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index d4920cf430..42bf9a4bb6 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -158,7 +158,7 @@ int ScummEngine_v72he::readArray(int array, int idx2, int idx1) { ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array)); - if (ah == NULL || ah->data == NULL) + if (!ah) error("readArray: invalid array %d (%d)", array, readVar(array)); if (idx2 < (int)FROM_LE_32(ah->dim2start) || idx2 > (int)FROM_LE_32(ah->dim2end) || -- cgit v1.2.3 From b8c198aec9ab92f22b8ddce0bf0049501e14fb62 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 18 Aug 2013 09:05:03 +0200 Subject: SCUMM: Remove unnecessary NULL check, CID 1003628 Since ah->data is an array, it can't ever be NULL. --- engines/scumm/script_v6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index a75e864e7a..6983c51f30 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -394,7 +394,7 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::getArray(int array) { int ScummEngine_v6::readArray(int array, int idx, int base) { ArrayHeader *ah = getArray(array); - if (ah == NULL || ah->data == NULL) + if (!ah) error("readArray: invalid array %d (%d)", array, readVar(array)); // WORKAROUND bug #645711. This is clearly a script bug, as this script -- cgit v1.2.3 From e81d8d8112a1dc7e81bcd7eff5b2b601f64cfd75 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 18 Aug 2013 09:07:49 +0200 Subject: SCUMM: Remove unnecessary NULL check, CID 1003629 Since _actors[i]->_sound is an array, it can't ever be NULL. --- engines/scumm/actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 5c148a7b57..4e14473921 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1485,7 +1485,7 @@ void ScummEngine::playActorSounds() { int sound; for (i = 1; i < _numActors; i++) { - if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom() && _actors[i]->_sound) { + if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom()) { _currentScript = 0xFF; if (_game.version == 0) { sound = v0ActorSounds[i - 1] & 0x3F; -- cgit v1.2.3 From 84d1d28373d782464bd46b10abd6b092f7eb6367 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 18 Aug 2013 09:28:54 +0200 Subject: SCUMM: Read the SMAP size, not the SMAP tag itself This will obviously make 'smapLen' a lot smaller in most cases, so there may be regressions. But I hope this is correct, though I don't know why the size is big-endian while the offset is little- endian. --- engines/scumm/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 4c1fdaf673..4d65ccc88a 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1888,7 +1888,7 @@ bool Gdi::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, if (stripnr * 4 + 4 < smapLen) offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 4); } else { - smapLen = READ_BE_UINT32(smap_ptr); + smapLen = READ_BE_UINT32(smap_ptr + 4); if (stripnr * 4 + 8 < smapLen) offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 8); } -- cgit v1.2.3 From c8f7583542cff8827f38048a9a9d5ec52fead398 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 Aug 2013 10:20:08 +0200 Subject: TSAGE: R2R - Fix cursor behavior (and crash) when leaving room 200 (corridor hall 2) via East (150) and West (175) exits --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index e64e9100c9..63bb24f384 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2026,7 +2026,7 @@ void Scene200::EastExit::changeScene() { Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; _enabled = false; - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_WALK); scene->_sceneMode = 206; scene->setAction(&scene->_sequenceManager, scene, 206, &R2_GLOBALS._player, NULL); } @@ -2035,7 +2035,7 @@ void Scene200::WestExit::changeScene() { Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene; _enabled = false; - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_WALK); scene->_sceneMode = 208; scene->setAction(&scene->_sequenceManager, scene, 208, &R2_GLOBALS._player, NULL); } -- cgit v1.2.3 From c981c52799d25c610c9455dbe251066fa0722d35 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 Aug 2013 10:20:47 +0200 Subject: MORTEVIELLE: some renaming in Dialogs --- engines/mortevielle/dialogs.cpp | 17 ++++++++--------- engines/mortevielle/dialogs.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b8d197da2a..a7bd381603 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -57,13 +57,12 @@ int DialogManager::show(const Common::String &msg, int n) { decodeAlertDetails(msg, caseNumb, lignNumb, colNumb, alertStr, caseStr); - int i = 0; Common::Point curPos; if (alertStr == "") { drawAlertBox(10, 5, colNumb); } else { drawAlertBox(8, 7, colNumb); - i = 0; + int i = 0; _vm->_screenSurface._textPos.y = 70; do { curPos.x = 320; @@ -229,13 +228,13 @@ void DialogManager::setPosition(int ji, int coldep, int esp) { * Alert function - Draw Alert Box * @remarks Originally called 'fait_boite' */ -void DialogManager::drawAlertBox(int lidep, int nli, int tx) { - if (tx > 640) - tx = 640; - int x = 320 - ((uint)tx / 2); - int y = (lidep - 1) * 8; - int xx = x + tx; - int yy = y + (nli * 8); +void DialogManager::drawAlertBox(int firstLine, int lineNum, int width) { + if (width > 640) + width = 640; + int x = 320 - ((uint)width / 2); + int y = (firstLine - 1) * 8; + int xx = x + width; + int yy = y + (lineNum * 8); _vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); _vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); _vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index af667e40c5..ee210a62b2 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -48,7 +48,7 @@ private: void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); void setPosition(int ji, int coldep, int esp); - void drawAlertBox(int lidep, int nli, int tx); + void drawAlertBox(int firstLine, int lineNum, int width); void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: void setParent(MortevielleEngine *vm); -- cgit v1.2.3 From 03bf56ea82c0b89f4e61e5e0787a36473f999efa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 18 Aug 2013 11:45:02 +0300 Subject: INSANE: Mark fall through case statement. CID 1003733 --- engines/scumm/insane/insane_enemy.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index 3876966fd1..d711b63342 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -1519,6 +1519,7 @@ void Insane::chooseEnemyWeaponAnim(int32 buttons) { case INV_BOOT: case INV_HAND: case INV_DUST: + // fallthrough default: switchEnemyWeapon(); } -- cgit v1.2.3